Skip to content

feat(cli): DX, evidence & hardening — uniform --json, broader doctor, eval harness (Tranche D)#20

Merged
CodeWithJuber merged 1 commit into
masterfrom
claude/logic-algorithm-implementation-c09485
Jul 6, 2026
Merged

feat(cli): DX, evidence & hardening — uniform --json, broader doctor, eval harness (Tranche D)#20
CodeWithJuber merged 1 commit into
masterfrom
claude/logic-algorithm-implementation-c09485

Conversation

@CodeWithJuber

Copy link
Copy Markdown
Owner

What & why

Tranche D — developer-experience, evidence, and hardening from the review.

Uniform --json

doctor, route, preflight, verify, and scope now accept --json (only
impact/substrate/anchor did before). CI and scripts can now gate on the health check, the
routed tier, the assumption gap, and the verification result — not just parse human text.

forge doctor catches more silent misconfiguration

New checks, each targeting a real "it silently stopped working" failure mode:

  • guard scripts present and executable (a non-+x guard makes a hook silently no-op),
  • jq / git availability (several guards degrade without jq — this surfaces the risk the
    audit flagged for secret-redact/protect-paths),
  • atlas presence + freshness (a stale graph misleads impact/verify),
  • model-pricing staleness (warns when the verified date is >90 days old).

Evaluation harness (src/eval.js)

The deterministic core of the Python prototype's mutation-testing idea, brought into the JS
runtime so the graph-quality claim is checkable in CI: score the impact oracle's
precision/recall/F1 over labeled cases and against the edited-file-only baseline the paper
measured against. A test asserts the oracle out-recalls the baseline on a fixture.

Smaller quality wins

  • model_tiers exports PRICING_CURRENCY ("USD") + PRICING_VERIFIED (the date doctor
    checks). The haiku id already matched the canonical dated form, so no id change was needed.
  • One shared call-site extractor (src/extract.js)atlas.js and verify.js each kept a
    copy of the call regex + builtins ignore-list; they now share one module so they can't drift.

On the deeper guard hardening — scoped honestly

The audit flagged protect-paths/secret-redact fail-open without jq. Rewriting their shell
parsing to be safe without jq is fragile to do correctly, so this PR surfaces the risk loudly
(the new doctor jq warning) and defers the full jq-free rewrite rather than shipping a shaky one.

Checklist

  • npm test passes (Node 18/20/22) — 222 tests (+4)
  • npm run check passes (Biome lint + format)
  • New public functions have tests (eval, shared extractor, doctor checks)
  • Conventional commit message (feat:)
  • CHANGELOG.md updated under ## [Unreleased]
  • No new runtime dependency
  • Substrate/docs updated (new --json surfaces)

Risk & rollback

  • Risk level: low--json is additive; the doctor checks only report; the shared
    extractor is behaviour-preserving (atlas keeps its own builtins; CALL_RE is identical).
  • Rollback plan: revert the commit. No migrations.

Extra checks

  • npm run typecheck passes
  • Logs contain no secrets/PII

Verification

Full suite + typecheck + Biome green. Manual: forge doctor --json lists the 14 checks incl.
guards exec / jq / atlas / model pricing; forge route "…" --json emits the route object.
eval unit test confirms oracle recall ≥ edited-file-only baseline on a fixture.

Last up: Tranche E (visual docs treatment).

🤖 Generated with Claude Code

https://claude.ai/code/session_01HGZUYFdUb4EViXV5tRid19


Generated by Claude Code

… eval harness (Tranche D)

- Uniform --json: doctor/route/preflight/verify/scope now emit machine-readable
  output (were human-only), so CI/scripts can gate on them.
- forge doctor sees more silent misconfiguration: guard scripts present AND
  executable; jq/git availability (guards degrade without jq); atlas presence +
  freshness (stale graph misleads impact/verify); model-pricing staleness (>90d).
- Evaluation harness (src/eval.js): the deterministic core of the prototype's
  mutation-testing idea — precision/recall/F1 of the impact oracle vs the
  edited-file-only baseline, checkable in CI.
- model_tiers exports PRICING_CURRENCY + PRICING_VERIFIED (doctor uses the date).
- One shared call-site extractor (src/extract.js): atlas.js and verify.js each
  kept a copy of the call regex + builtins ignore-list; now a single source so
  they can't drift.

Deeper shell-guard fail-open hardening (rewriting protect-paths/secret-redact to
avoid the no-jq degrade) is surfaced via the new doctor jq warning; a full jq-free
parse rewrite is deferred as too fragile to do safely here.

222 tests pass (+4), typecheck + Biome clean, zero new runtime deps.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HGZUYFdUb4EViXV5tRid19
@CodeWithJuber
CodeWithJuber marked this pull request as ready for review July 6, 2026 09:13
@CodeWithJuber
CodeWithJuber merged commit 3ac304e into master Jul 6, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants