Skip to content

test/config-schema.test.sh builds doctor fixtures from the live config.json, so a config change breaks tests unrelated to it

Id: TD-PPagop-26081801 · Status: resolved · Filed: 2026-08-18 · Resolved: 2026-08-18 · Ref: https://github.com/Poetic-Poems/agent-ops/pull/564

test/config-schema.test.sh’s assert_doctor helper derives every fixture from the repository’s own shipped config.json, applying a jq expression to it and running scripts/doctor.sh against the result. That makes the live configuration a silent input to assertions that are not about it, so a routine configuration change can fail a test whose subject it never touched.

This has now happened twice, both times on the same block of D18 merge-autonomy assertions:

  • agent-ops#546, at Stage 1 entry. Three assertions built an “unpaired” config as .merge_autonomy = "agent-approves" alone, which constructed one only while approver_app_id and approver_model_default were absent from the shipped file. Setting them for real inverted all three. The fix was to delete each key explicitly, and a comment was added above the block recording the lesson: “A cross-key rule’s negative case has to state both halves: what is set, and what is not.”
  • agent-ops#560, at Stage 2 entry. The assertion immediately below that comment — “doctor passes human explicitly, same as the default, with no approver_app_id or approver_model_default” — set the top-level merge_autonomy to human and deleted both Approver keys, but left every repos[] entry’s own override untouched. That built a wholly-human fleet only while no entry carried an override, which agent-ops’ promotion to agent-merges-routine ended. Fixed the same way, by clearing the per-repo overrides explicitly.

The recurrence is the point: the lesson was written down, in the right file, directly above the next assertion to repeat it. A comment cannot enforce this, because nothing about assert_doctor’s shape tells a reader which parts of the shipped configuration their fixture is silently inheriting.

D18’s rollout (agent-ops#402) makes configuration changes routine rather than rare: each stage promotion is “a one-line IaC config PR the owner merges”, and there are two more promotions to come (Stages 3 and 4), plus per-repo merge_autonomy, merge_autonomy_routine_sources and merge_budget_per_day overrides as poetic and poetic-fiddle enter the ladder. Every one of those is a chance to fail an unrelated assertion in this file.

The cost is worst where it is least affordable. A stage promotion fails CI for a reason that names neither the promotion nor the config key changed — agent-ops#560’s failure read Poetic-Poems/agent-ops's merge_autonomy override is "agent-merges-routine" with no approver_app_id configured, which describes a fixture nobody wrote and a state that does not exist. Diagnosing that took reading the test’s own construction. An autonomous cycle hitting it would have no better recourse, and the pipeline is now landing its own work.

Give assert_doctor a base fixture that is stated, not inherited: a minimal committed configuration under test/fixtures/ carrying only what doctor needs to run, with each assertion’s jq expression building up from that. Assertions genuinely about the shipped file — “doctor passes the shipped configuration”, “the shipped configuration’s own merge_autonomy is paired with both Approver keys” — keep reading config.json deliberately and should say so in their names, so the two classes cannot be confused again.

A cheaper interim: have assert_doctor normalise the inherited config to a known-neutral state (clear every repos[].merge_autonomy, every repos[].merge_autonomy_routine_sources, the Approver keys) before applying the per-assertion expression, so a fixture opts in to what it wants set. This fixes the recurrence without the churn of rewriting every assertion, at the cost of leaving the inheritance in place for keys nobody has thought of yet.

  • test/config-schema.test.sh — the assert_doctor helper and the D18 merge-autonomy assertion block, which carries the agent-ops#546 comment and now the agent-ops#560 one.