fix: repair union-merge damage across ledger, cli, compile and witness - #96
Merged
Conversation
Landing the long-stale dream-cycle backlog (#21/#29/#33/#35/#42/#46) required rebasing branches whose conflicts were mostly additive, but a mechanical union of the conflict hunks cut across syntactic boundaries in several places and left main red. This repairs all of it: - ledger/src/index.ts: `pendingFindings` and the closing brace of LearningSignalsOptions landed inside daysBetween()'s body; field moved back into the interface and the function restored. - ledger|compile|cli test files: five `it(...)` blocks lost their closing `});` at the seam between the two sides' test sets. - cli/src/index.test.ts: duplicated import block collapsed. - cli/src/index.ts: `ledger signals` emitted TWO JSON objects (one for --merged, one for --pending) instead of one combined result, so JSON.parse(out) threw for every signals test; both option sets now feed a single learningSignals() call. Duplicated help entry collapsed. - witness/src/index.ts: #35's `termination` and #42's `trace-replay` each export their own `canonicalJson` (TS2308). They are not interchangeable -- trace-replay's does WeakSet cycle detection and takes `unknown`, termination's is typed to JsonValue -- so trace-replay is now re-exported explicitly without it rather than silently promoting either. Verified: typecheck clean, 585/585 vitest, `npm run check` 80/81 (the one failure is the macOS-only /tmp symlink case in mission.test.mjs, which this repo's Linux-only CI does not exercise). Co-Authored-By: RuFlo <ruv@ruv.net> Claude-Session: https://claude.ai/code/session_01Ff2xRKvYrqXJhefvcapfE1
ruvnet
added a commit
that referenced
this pull request
Sep 7, 2026
…0010) (#97) Every gate here freezes a policy before outcomes are visible, then treats the receipt as timeless. PR #11 showed what that misses: evaluated 2026-08-15 against `dream.config.json` as it stood that day, honest evaluation, passed — and three weeks later `autoMerge` had deliberately flipped, so landing it turned main red on two tests. git merged #11 cleanly. `dream.config.json` was never in its diff; it was in its READ SET — a file the evaluation depended on but did not modify. git protects the write set; nothing here protected the read set. Adds `EvidenceFreshnessPolicy`/`Receipt` to @dream-machine/witness: the read set is declared and digest-anchored at evaluation time, then re-digested against the tree a candidate would land in. FRESH / STALE / INDETERMINATE / INVALID, every receipt `authority: 'none'`. Deliberately NOT age-based and NOT base-commit-based: main advances constantly, so a gate keyed on either fires always and gets switched off. Drift in the declared read set is the signal; age is an optional secondary bound. `dream-machine freshness stamp|verify` does the I/O so the primitive stays pure (exit 0 FRESH / 1 STALE / 2 indeterminate|invalid, usable as a CI gate). Security: the CLI validates and anchors the policy BEFORE reading any dependency. Without that ordering an untrusted policy file naming `../../etc/hosts` would be read (and its existence confirmed) before the library rejected it — a read/existence oracle. Caught in adversarial review of this change, fixed, and regression-tested. Validated against real history, not just fixtures: stamping `dream.config.json` from 8ce3857 (PR #11's actual base) and verifying against current main yields STALE, driftedPaths ["dream.config.json"], exit 1. 616/616 vitest, typecheck clean, sub-quadratic cost bound to 4096 deps. Also removes a duplicated stale `tui` help line left behind by the #96 union merge. Claude-Session: https://claude.ai/code/session_01Ff2xRKvYrqXJhefvcapfE1
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.
mainis currently red. Landing the stale dream-cycle backlog required rebasing branches whose conflicts were largely additive, but a mechanical union of the hunks cut across syntactic boundaries in several spots.Repaired
ledger/src/index.ts—pendingFindings+ the interface's closing brace ended up insidedaysBetween(); moved back intoLearningSignalsOptions.it(...)blocks lost their closing});at the seam between the two sides' test sets.cli/src/index.test.ts— duplicated import block collapsed.cli/src/index.ts—ledger signalsemitted two JSON objects (one per flag) instead of one combined result, soJSON.parse(out)threw in all 8 signals tests. Both--mergedand--pendingnow feed a singlelearningSignals()call.witness/src/index.ts— feat(witness): require evidence carrying completion certificates #35'sterminationand feat(witness): anchored trace replay for causal failure experiments #42'strace-replayeach export their owncanonicalJson(TS2308). They are not interchangeable (trace-replay's has WeakSet cycle detection and takesunknown; termination's is typed toJsonValue), so trace-replay is re-exported explicitly without it rather than silently promoting either.Verified: typecheck clean, 585/585 vitest,
npm run check80/81 — the one remaining failure is the macOS-only/tmp→/private/tmpsymlink case inmission.test.mjs, not exercised by this repo's Linux-only CI.🤖 Generated with RuFlo
https://claude.ai/code/session_01Ff2xRKvYrqXJhefvcapfE1