Skip to content

test(agent-journal): persist safe evaluation program state#125

Merged
feniix merged 7 commits into
mainfrom
feat/agent-journal-evaluation-ledger
Jul 13, 2026
Merged

test(agent-journal): persist safe evaluation program state#125
feniix merged 7 commits into
mainfrom
feat/agent-journal-evaluation-ledger

Conversation

@feniix

@feniix feniix commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

Clean sessions can now reconcile the Agent Journal evaluation program without inferring progress from conversation history. The ledger records only safe stage, terminal-version, PR/merge/CI, opaque identifier, digest, cleanup, and pending-action metadata, and schema v1 is deliberately incapable of claiming infrastructure acceptance or V4 progress.

A strict validator rejects unknown fields, private-path and credential-shaped metadata, contradictory gate states, cutover claims, exotic object/array prototypes, hidden or symbolic properties, accessors, sparse arrays, and time-of-check/time-of-use substitutions.

Validation

  • Initial RED: missing program-state ledger (ENOENT)
  • Adversarial RED/GREEN cycles recorded in commit bodies for unsafe fields, skipped transitions, path/credential variants, exotic records/arrays, and accessor TOCTOU
  • Agent Journal suite: 230 tests passed
  • Coverage: 86.01% lines, 83.77% statements, 91.10% functions, 79.35% branches
  • npm run check:ci
  • package build and dry-run leak scan
  • specdocs_validate
  • independent closure review: 70/70 state mutations passed, 126/126 record descriptor mutations rejected, 32/32 array descriptor mutations rejected, TOCTOU rejected, no blockers

Compound Engineering
Pi

feniix added 7 commits July 13, 2026 11:55
Record only safe stage, version, PR, merge, CI, historical identifier,
digest, cleanup, and pause metadata so clean sessions cannot skip gates.

RED: npx vitest run packages/pi-agent-journal/__tests__/evaluation-program-ledger.test.ts
Failure: ENOENT for the absent program-state ledger.
Validate the ledger through exact allowlisted schemas and transition
invariants so unknown payloads, private paths, credentials, or skipped
acceptance states cannot be added unnoticed.

RED: npx vitest run packages/pi-agent-journal/__tests__/evaluation-program-ledger.test.ts
Failure: the strict program-state validator module was absent.
Keep schema v1 incapable of representing accepted infrastructure or V4
progress, and reject contradictory actions, path-like branches, and more
credential-shaped metadata. Later gates require committed schema evolution.

RED: npx vitest run packages/pi-agent-journal/__tests__/evaluation-program-ledger.test.ts
Failure: six adversarial state, path, and credential mutations validated unexpectedly.
Require plain JSON objects and inspect every own key so inherited,
non-enumerable, or symbolic payload fields cannot survive validation.

RED: npx vitest run packages/pi-agent-journal/__tests__/evaluation-program-ledger.test.ts
Failure: inherited rawMessages and hidden toolPayload fields were accepted.
Reject inherited, hidden, symbolic, or sparse fields on every ledger array
so validation covers the entire JSON object graph rather than records only.

RED: npx vitest run packages/pi-agent-journal/__tests__/evaluation-program-ledger.test.ts
Failure: inherited, non-enumerable, and symbol payloads on versions were accepted.
Reject hidden, accessor-backed, or nonstandard required properties so a
validated ledger serializes the same safe fields that were checked.

RED: npx vitest run packages/pi-agent-journal/__tests__/evaluation-program-ledger.test.ts
Failure: hidden required root and nested fields were accepted.
Reject accessor-backed, non-writable, non-configurable, or abnormal length
descriptors so array values cannot change after successful validation.

RED: npx vitest run packages/pi-agent-journal/__tests__/evaluation-program-ledger.test.ts
Failure: accessor-backed and non-writable versions indices were accepted.
@feniix
feniix merged commit cf8698b into main Jul 13, 2026
2 checks passed
@feniix
feniix deleted the feat/agent-journal-evaluation-ledger branch July 13, 2026 15:26
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.

1 participant