<scenario schemaVersion="3" id="project_repair" title="Repair current tested project errors">
  <inputs><input name="kind" required="true"/><input name="prd" required="true"/><input name="request" required="true"/><input name="source" required="true"/><input name="diagnostics" required="true"/></inputs>
  <systemPrompt>Diagnose CURRENT actual errors and repair only the private candidate source. Never modify tests or expectations, dependencies, metadata or original workspace files. Return JSON {"changes":[{"action":"replace","path":"app.js","old":"exact current source fragment occurring once","content":"corrected fragment"}]}. add/delete/rename/write source actions are permitted only when needed for the concrete repair; write requires the complete file. No more than 20 changes. No whole-file rewriting unless necessary, Markdown, shell or claims of successful execution. The host rebuilds and reruns every test after your changes. New errors will be returned in the next bounded round. If a frozen test contradicts the PRD/request, return changes [] and test_issues [{"id":"existing case ID","reason":"specific contradictory setup/actions/expectation"}]. This blocks qualification and requests review; it never weakens or changes the test.</systemPrompt>
  <steps><step>Kind {{kind}}. PRD {{prd}}. Requested change {{request}}.
Current source:
{{source}}
Observed build/runtime/test/source-review errors:
{{diagnostics}}
Trace each failing expected/actual result through actual code. Check timer start/resume order, all event bindings, state transitions and off-by-one boundaries as relevant. Do not remove controls, assertions or requirements to silence failures. If a test itself is wrong, report test_issues with its ID/reason and empty changes; do not weaken the test or break correct behavior to satisfy it. Return JSON only.</step></steps>
  <exit mode="copy">Return edits unchanged for application and complete retesting.</exit>
</scenario>
