Skip to content

feat(protocol): add append-only integrity invariants and git merge support#27

Open
leonardobuares wants to merge 1 commit into
mmilanez:mainfrom
leonardobuares:feat-5-append-only-invariants
Open

feat(protocol): add append-only integrity invariants and git merge support#27
leonardobuares wants to merge 1 commit into
mmilanez:mainfrom
leonardobuares:feat-5-append-only-invariants

Conversation

@leonardobuares

Copy link
Copy Markdown
Contributor

Summary

Implements append-only integrity invariants and git merge support for the
shared state logs. Two branches that both appended to JOURNAL.md,
LESSONS.md or decisions.jsonl previously produced a manual conflict, and
a badly resolved one left <<<<<<< markers inside decisions.jsonl,
silently breaking every subsequent boot. Nothing detected any of this.

Closes #5.

Changes

  • PROTOCOL_RULES.md (kernel 2.0.1 to 2.1.0): new §P3 Integrity invariants: corrections are new entries (never rewrites of history),
    every append ends with a final newline, structural corruption blocks new
    appends until repaired and logged.
  • modules/git-substrate.md (1.2.0 to 1.3.0): new §M-git-7 Merge safety for append-only logs, plus a new .agents/.gitattributes shipping
    merge=union for the three append-only logs. sessions/active_sessions.md
    is deliberately excluded (rows are removed on close; union would resurrect
    them). The section mandates post-merge validation and documents when human
    review is still required.
  • validate_state.py: structural checks (conflict markers, missing final
    newline, duplicated top-level header), default targets now include
    JOURNAL.md, LESSONS.md, sessions/active_sessions.md. New pytest
    coverage; pre-commit regex and the state-validation workflow widened.
  • CLI: same checks in lead-protocol validate (auto-discover included);
    three corruption/restore scenarios added to test-pack.mjs. Version
    2.0.3 to 2.1.0. Numbered assuming this lands before feat: add first-run setup interview gate (PROTOCOL_RULES §P10) #22/feat(cli): add update command and stop init from overwriting existing installs #26; happy to
    renumber if they land first.
  • README.md new "State file integrity" section (per §M-git-3),
    cli/README.md, CHANGELOG.md [2.1.0].

Testing

  • pytest .agents/scripts/: 115 passed.
  • npm run typecheck passes; npm run test:pack passes end to end,
    including the three new corruption scenarios (fail while corrupted,
    pass after restore).
  • Manual experiment: two branches appending to decisions.jsonl under the
    shipped .gitattributes merge cleanly, both entries preserved, no markers.

Checklist

  • Code follows project conventions
  • Tests added/updated
  • Documentation updated
  • Protocol files follow defined schemas (state files not modified;
    framework files intentionally changed)

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

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.

feat(protocol): add append-only invariants and git merge support

1 participant