Fix the behavior checklist for a script migration
Your task
An agent is migrating your Bash deploy script to a Python CLI. Twice its rewrite ran the happy path but quietly dropped the rollback on failure and the skip if already deployed guard. Now you list every behavior the old script has, the agent reports what its rewrite does, and a check compares the two.
An assistant wrote missing_behaviors(required, implemented). It is in the editor. It has a bug. Find it and fix it.
Input and output:
required: the behaviors the old script has, by name.implemented: what the rewrite reports, one entry per behavior: a name, or a name,=and a status, such asexit-codes=covered.- Return one
name=droppedorname=untestedstring per required behavior that is not covered, sorted by name.
Rules the tests check:
- Read each
requiredname with whitespace trimmed from both ends, in lowercase. Skip empty names and names already seen. - Split each
implementedentry at its first=. Trim both parts and lowercase both. Skip an entry whose name is empty. - A behavior is covered only when some entry has its name and the status
covered. Any other status, or no status at all, means the behavior is present but not covered. - A required behavior that is not covered is
name=untestedwhen present andname=droppedwhen no entry has its name. Use the lowercase name. - Sort by the name alone, as plain strings.
Examples
missing_behaviors(required: list[str], implemented: list[str]) -> list[str]Example 1
Input
missing_behaviors(["rollback-on-failure", "skip-if-deployed", "exit-codes"], ["exit-codes=covered", "skip-if-deployed"])Output
["rollback-on-failure=dropped", "skip-if-deployed=untested"]Example 2
Input
missing_behaviors(["rollback-on-failure", "skip-if-deployed"], ["Skip-If-Deployed=COVERED", " rollback-on-failure = covered "])Output
[]Example 3
Input
missing_behaviors(["deploy", "rollback", "deploy"], [])Output
["deploy=dropped", "rollback=dropped"]