developer-experience: validate ledger append verdict/evaluated against ledger verify's own enum - #49
Draft
ruvnet wants to merge 1 commit into
Draft
developer-experience: validate ledger append verdict/evaluated against ledger verify's own enum#49ruvnet wants to merge 1 commit into
ruvnet wants to merge 1 commit into
Conversation
…t ledger verify's own enum `ledger append` accepted any --verdict/--evaluated string with no validation, even though `ledger verify` enforces ACCEPT|REJECT|INCONCLUSIVE / yes|no|blocked on the same columns. The two functions never shared validation. docs/dream-cycle/LEDGER.md on main already carries 9 real structural errors from 5 rows bulk-added in commit df9ff40 (a direct file edit that bypassed the CLI, so this fix does not retroactively repair them, but does close the CLI write path for future appends). Export VERDICTS/EVALS from @dream-machine/ledger and check them in the CLI's append handler before writing; reject (exit 1, no write) on violation. 2 new tests, 98->100 passing, 0 regressions. Dream Cycle 2026-08-29, developer-experience/cli,tui. Issue #48. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wi6JmDzba4tRzu5id1cBfL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hypothesis
Candidate
ledger append(packages/cli/src/index.ts) accepted any--verdict/--evaluatedstring with zero validation, even thoughledger verifyenforces a strict enum on those exact columns (packages/ledger/src/index.ts,verifyLedger). The two functions never shared validation. Fix: exportVERDICTS/EVALSfrom@dream-machine/ledger(previously module-private) and check them inappendbefore callingappendRow, rejecting with the same error formatverifyuses. 3 files, 32 lines, one conceptual change.Evaluation Receipt
Real evaluator:
npx vitest run(repo'sbenchentrypoint,npm test).7933c359, 2 new tests added, fix NOT applied)Manual replay against a scratch copy of the real
docs/dream-cycle/LEDGER.md: bad--verdict/--evaluatedboth exit 1 with the file's sha256 byte-for-byte unchanged; a valid append still writes correctly.Baseline
Parent commit
7933c359.git stashconfirmed the pre-existingtypecheckscript failure (tsconfig.jsonemptyfileslist) is identical on parent and candidate — environmental, not caused by this diff;npm run build's per-packagetscis the real build/typecheck path and is clean both before and after.Darwin Lineage
Not run.
DARWIN=unavailable—npx --no-install @metaharness/darwinconfirms the optional peer package isn't installed in this checkout.Evidence
ledger verify --path docs/dream-cycle/LEDGER.md→ 9 real structural errors, rows 2-6, onmainright now.git show df9ff40 -- docs/dream-cycle/LEDGER.md→ all 5 malformed rows landed in one commit alongside an unrelated cron-floor fix — a direct file edit that bypassedledger appendentirely. This candidate's CLI validation does not retroactively fix those rows or prevent a future direct edit; it closes the CLI write path only. Recorded honestly, not overclaimed — see Issue [Dream Cycle 2026-08-29] developer-experience:ledger appendaccepts any --verdict/--evaluated value, corrupting ledger schema + cli,tui scan #48 for the full writeup.Reward-Hack Check
Self-review (single session, no second agent spawned tonight — a real, disclosed limitation). No test weakened, no gold/threshold touched, no cherry-picked corpus, no evaluator exploit, no hidden cost. Verdict: clear.
Security Review
Additive input validation on a local CLI flag; reduces attack surface (malformed values can no longer reach a file other commands trust). No new filesystem/network scope, no credentials, no change to
witness/verify-entrypoint. Not security-sensitive enough for its own ADR.Regression Analysis
100/100 tests passing (98 pre-existing + 2 new), 0 removed, 0 modified.
VERDICTS/EVALSexport from@dream-machine/ledgeris additive (no existing signature changed).ADR
None — bug fix / input validation, not an architectural decision.
Gist
GIST=LOCAL(noghCLI, no gist-creation MCP tool this session, matching repo precedent). Full report:docs/dream-cycle/2026-08-29-developer-experience-report.md.Issue
#48
Witness
Reproduce:
node packages/cli/dist/bin.js witness stamp docs/dream-cycle/2026-08-29-developer-experience-report.md 7933c3599abe22df5290f4609d1f93f598feb3deMerge Policy
Human review required — no automerge label applied. Draft PR; the session never merges. Guarded auto-merge (
.github/workflows/automerge.yml) is a separate CI job gated on theautomerge-safelabel, a fully green head, and no protected-path changes — not requested here, since this PR touchesdocs/dream-cycle/LEDGER.md(the durable ledger itself) and a library's public export surface, which warrant a human look even though the change is small.Generated by Claude Code