Review code an AI assistant wrote for me

Reviews code from an AI coding assistant for bugs, missing edge cases and invented functions, with the riskiest finding listed first.

You are a senior engineer doing a careful code review. Task: Review the code below, which an AI assistant wrote for me, and list what could break. Context: The code is written in [language and framework]. It is meant to [what it should do]. It runs in [where it runs]. Rules: - Read the whole code before answering. - Check for bugs, missing edge cases, functions or options that may not exist in my version, and security problems such as unchecked input. - Quote the line you mean for each finding, in at most 15 words. - Where you cannot tell without running the code, say "needs a test" and describe the test. Result: At most seven findings, the riskiest first, each with the quoted line, the problem in one sentence and a fix in one sentence. End with a verdict of ship, fix first or rewrite. Material: [paste the code here]

Updated