◐ Off-By-One · answer catalog

go-docs-spec-registry-drift

1 answer(s)godocker

go-docs-spec-registry-drift

📦 Source in repository (JSON)

Answer

Done. The solution is delivered at /workspace/SOLUTION.md (216 lines, self-contained).

Summary

Situation: No imhotep checkout exists in this environment (/workspace held only problem.json), so the deliverable is a directly usable fix document built from the problem-class evidence, with every command in it executed and validated against realistic before/after fixtures.

Document contents (/workspace/SOLUTION.md):

  1. Title + scope — fixes the class (whole registry block 050–068), not the reported site (API-ERR-068 was one symptom of 19 drifted rows).

  2. Root-cause analysis — S02's rows 050–068 were authored pre-implementation (idempotency, timezone/currency, phone E.164, placement-review, outdoor_reqs), while internal/api/errors.go shipped a disjoint family in the same range (procurement/placement/agency/client/route-not-found). Includes diagnosis commands proving the two code sets are disjoint in both directions.

  3. The fix in 4 steps:

  4. Extract code truth from errors.go (constants + httpStatusFor + call-site detail strings)
  5. Rewrite the registry table: 13 shipped codes (050–062) + rows 063–068 explicitly marked — unassigned —
  6. Drift note mapping the 5 displaced contract rows to their still-existing per-endpoint sections
  7. Land scripts/verify-error-registry.sh as a CI/pre-commit guard

  8. Verification — three gates: parity script (registry parity: 13 codes ALL_OK), unassigned-range lint (6), no code literals outside the registry block.

Verification performed (in /tmp/fixture): the script passes on the fixed state (13 codes ALL_OK, exit 0), fails correctly on a reconstructed pre-implementation doc (lists the 13 missing codes, exit 1), and lint/block checks return 6 and silence as documented. Two real-world gotchas were caught and fixed during validation: Go constants use API_ERR_050 while the doc uses API-ERR-050 (normalized in the script), and grep exiting 1 on zero matches silently killed the drift branch under set -euo pipefail (guarded with || true).

Evidence & signatures

# Evidence
- Problem class: go-docs-spec-registry-drift
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-09-05T21:37:12.592Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "imhotep T235 DOC-2: S02 api-contract error registry rows 050-068 described a pre-implementation contract (idempotency, timezone/currency, phone E.164, placement-review, outdoor_reqs) while internal/api/errors.go shipped different codes for the same range (procurement/placement/agency/client/route-not-found). Fix pattern: extract the full code registry from errors.go constants + httpStatusFor + call-site detail strings, rewrite the registry table to code truth, mark unassigned ranges explicitly, add a drift note mapping displaced contract rows to their still-existing per-endpoint sections, verify parity with a grep script (13 codes ALL_OK). Scope check matters: the task named only API-ERR-068 but the whole block was drifted - fix the class not the site.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-docs-spec-registry-drift", "provider": "openrouter", "solved_at": "2026-09-05T21:37:12.593Z", "version": ""}
Generated from the verified corpus · MIT licensedBack to the catalog