feat(rfc-008): P3a — extract marker reads into enforcement-owned lib/marker-state.mjs#389
Merged
Merged
Conversation
…marker-state.mjs RFC-008 R1 strong form: the memory substrate must not own marker reads. Relocate the stop-gate carve-out predicate, relaxed/strict mtime helpers, and own-session resolver out of em-recall.mjs (and the deleted stop-gate-helpers.mjs) into a new enforcement-owned scripts/lib/marker-state.mjs. Pure extraction — em-recall's --gate stop output is byte-identical (test-stop-gate.sh 31/0; test-issue-146 hook-chain E2E 51/0). The --gate stop dispatch handler stays in em-recall and moves to enforce-contract.mjs in P3b. - new scripts/lib/marker-state.mjs (7 helpers, verbatim move) - em-recall imports 4 helpers from marker-state; drops now-unused TASK_SIGNAL_MARKERS/CHECKPOINT_QUARTET imports - delete scripts/lib/stop-gate-helpers.mjs (sole importer updated same commit) - repoint PLAN_MARKER_ENFORCEMENT_SITES E11/E19 to marker-state (E20 sweep stays) - repoint 4 test fixtures; new tests/test-marker-state.mjs (23/0) Review: plan codex ACCEPT-with-FU + negative-scenario-planner HOLD (3 drift- completeness blockers, folded); code-review negative-scenario-reviewer ACCEPT. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
lantiscooperdev
left a comment
Collaborator
There was a problem hiding this comment.
Substantive review — RFC-008 P3a (marker-state.mjs extraction)
Reviewed the diff against the "byte-identical, pure extraction" invariant. Verdict: looks correct, ready for maintainer approval.
Verified
- Verbatim equivalence — all 7 relocated helpers are character-identical to their origins (
stop-gate-helpers.mjsstrict trio + the 4 carve-out/relaxed functions fromem-recall.mjs); only diff is a prependedexportand one stale-comment fix. No logic / branch / fail-closed / symlink / ENOENT / ENOTDIR handling changed. - Imports & cycle —
marker-state.mjsimports all 9 symbols it uses frommarker-paths.mjs;em-recallstill imports everything its surviving--gate stophandler uses and the removedTASK_SIGNAL_MARKERS/CHECKPOINT_QUARTETnow appear only in comments.em-recall → marker-state → marker-pathsis acyclic. - Drift completeness — zero live references to the deleted
stop-gate-helpers.mjs;install.mjsdeploysscripts/lib/*.mjsby glob so the new file auto-deploys and the deleted one auto-drops with no installer edit. - Registry (Rule 14) —
PLAN_MARKER_ENFORCEMENT_SITESE11/E19 repointed to marker-state; E20 (SessionStart sweep) correctly stays at em-recall;validate-plan-marker-sites.mjsgreen. - Behavior E2E — independent clean-room
--gate stoprun (block + allow) through the relocated lib, plustest-stop-gate.sh31/0 and thetest-issue-146hook-chain E2E 51/0.
Note: 1 NIT — registry entries use line: 0; this is the correct convention for a module-level consumer (matches existing E5b) and is left as-is.
Plan-time + code-review trail: codex ACCEPT-with-FU, negative-scenario-planner HOLD→folded (3 drift blockers), negative-scenario-reviewer ACCEPT (0 blocker/major/minor). CI validate jobs pending at time of review.
Approving is the maintainer's call (UI). I'm posting this as a comment review per the bot-reviews / user-approves split.
lantiscooperdev
approved these changes
Jun 15, 2026
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.
RFC-008 P3a — extract marker reads into enforcement-owned
lib/marker-state.mjsFirst sub-PR of RFC-008 P3 (the thin-waist decoupling phase). Establishes R1's strong form: the memory substrate must not own marker reads.
What
Pure extraction — relocate the stop-gate carve-out predicate, relaxed/strict mtime helpers, and own-session resolver out of
em-recall.mjs(and the deletedstop-gate-helpers.mjs) into a new enforcement-ownedscripts/lib/marker-state.mjs. No behavior change:em-recall --gate stopoutput is byte-identical.scripts/lib/marker-state.mjs— 7 helpers, verbatim move (char-identical to origins)em-recall.mjs— imports 4 helpers from marker-state; drops now-unusedTASK_SIGNAL_MARKERS/CHECKPOINT_QUARTETimports. The--gate stopdispatch handler stays (moves toenforce-contract.mjsin P3b)scripts/lib/stop-gate-helpers.mjs(sole importer updated in the same commit)marker-paths.mjs— repointPLAN_MARKER_ENFORCEMENT_SITESE11/E19 → marker-state; E20 (SessionStart sweep) correctly stays at em-recalltests/test-marker-state.mjsWhy P3a-first
Extracting the marker reads with no behavior change is the low-risk foundation P3b (
enforce-contract.mjs) builds on, and isolates the move from the later em-recall STRICT DELETION (P3d). P3d is ordered last so deletion never breaks a live consumer.Maps to
RFC-008 R1 (memory is the substrate; enforcement owns marker reads). Principle anchor P9.
Tests (all green)
Review trail
negative-scenario-plannerHOLD → 3 drift-completeness blockers (4th fixture ref, 3rd registry site, validator registration) folded before implementation.negative-scenario-reviewerACCEPT — 0 blocker/major/minor, 1 NIT (registryline:0, kept as correct module-level convention). Verbatim-equivalence, imports, import-cycle, drift-completeness, registry, and an independent clean-room--gate stopE2E all verified.🤖 Generated with Claude Code