Question 50
Two independently scoped GitHub Copilot requirements are being reviewed. Requirement A: A complex legacy-code conversion misses an important database constraint. Requirement B: A user asks for JSON output but receives prose wrapped around it. Choose TWO distinct actions to resolve both situations.
Explanation
Correct Answers
This action addresses requirement B: A user asks for JSON output but receives prose wrapped around it. Prompt instructions alone cannot guarantee valid machine-readable output; downstream schema validation is the enforcement control. Verify by observing: A machine validator parses the result, rejects extra fields and checks required keys, rather than accepting fluent text as guaranteed schema compliance.
This action addresses requirement A: A complex legacy-code conversion misses an important database constraint. Task-specific context is essential for safe modernization prompts. Verify by observing: The rewritten component preserves the documented database constraints under tests.
Incorrect Answers
Reusable prompts require current context substitution. The two requirements instead call for these controls: (A) Include the legacy code, schema contract, behavior invariants and target environment in the prompt; (B) Specify the exact required JSON schema, types and allowed fields, request no Markdown wrapper, and validate any Copilot output through a real schema validator before consuming it.
Prompts should provide local standards that are not inferable from generic language knowledge. The two requirements instead call for these controls: (A) Include the legacy code, schema contract, behavior invariants and target environment in the prompt; (B) Specify the exact required JSON schema, types and allowed fields, request no Markdown wrapper, and validate any Copilot output through a real schema validator before consuming it.
Explicit carry-forward context is safer than assuming unlimited history. The two requirements instead call for these controls: (A) Include the legacy code, schema contract, behavior invariants and target environment in the prompt; (B) Specify the exact required JSON schema, types and allowed fields, request no Markdown wrapper, and validate any Copilot output through a real schema validator before consuming it.