Skip to content

fix(memory-sync): template carries machine-state entry; profile guard test derives structurally - #74

Merged
LanNguyenSi merged 3 commits into
masterfrom
task/10df0d9d-template-machine-state
Aug 5, 2026
Merged

fix(memory-sync): template carries machine-state entry; profile guard test derives structurally#74
LanNguyenSi merged 3 commits into
masterfrom
task/10df0d9d-template-machine-state

Conversation

@LanNguyenSi

Copy link
Copy Markdown
Owner

Tasks: 10df0d9d + 105d28dd (agent-tasks; the second is an older duplicate of the first, both closed by this PR).

Closes the two review findings deliberately left out of PR #71:

Template (profiles/linux.example.json)

  • machine-state syncPaths entry with placeholder /home/<linux-username>/.harness/machine-state, destination machine-state, kind directory, ownerScoped: true (lockstep shape of the real profiles)
  • per review: ownerScoped: true also on the frictions entry (all three real profiles have it; a template copy without it would re-open the push-echo path closed by 06d09cde) and the FIRST-entry comment wording aligned with macbook/mac-mini

Guard test (tests/integration/cross-machine-profiles.test.ts)

  • profileFiles derived via readdirSync over profiles/*.json (template included) with a non-vacuity guard: length floor 4 + membership of all known profiles, so deletions/renames fail loudly instead of shrinking loops to no-ops
  • machine-state loop over all profiles incl. template; ownerScoped test now covers all 4 profiles structurally
  • new invariant test: rootDir/stateDir absolute, no leading ~, stateDir outside rootDir via path.posix.relative (no sibling-prefix or ..-normalization false results)

Docs (machine-setup.md c/e/f)

  • template steps updated, stale "does not yet include" sentences removed, snippets now show ownerScoped: true, and one sentence names the flag as the owner-writes-only mechanism

Verification:

  • suite 138/138 green, typecheck clean, preflight READY (82%)
  • mutation probes (all documented in task): removing the template machine-state entry, introducing ~, nesting stateDir under rootDir, deleting the template, emptying profiles/ each turn the suite red with a pointed message; sibling-prefix control (/a/b vs /a/bc) passes
  • independent reviewer pass: accept_with_notes; all 4 MEDIUM + 2 LOW findings fixed in-branch, flake finding spun out as task c71de504

Known CI risk: tests/integration/watch-mirror-delete.test.ts is a pre-existing load-dependent flake (tracked in task c71de504); if the coverage job goes red there, it is unrelated to this diff.

Lan Nguyen Si added 3 commits August 5, 2026 12:51
…rives profiles structurally

linux.example.json now includes a placeholder machine-state syncPaths entry
(mirroring linux.json/macbook.json's lockstep form) so a fourth machine
copied from the template starts with it present instead of repeating the
hand-patch divergence closed for the third machine. The cross-machine guard
test derives its profile file list via readdirSync instead of a hardcoded
array, so the machine-state loop now runs over every committed profile
including the template, and a new invariant loop pins rootDir/stateDir as
absolute, un-expanded, and stateDir outside rootDir across all profiles.
docs/machine-setup.md sections c/e/f updated to match; no more "template
does not yet include a machine-state entry" language.
Adds a non-vacuity guard to listProfileFiles() so an emptied or
renamed profiles/ directory fails loudly instead of silently
shrinking test coverage. Rewords the template's syncPaths comment to
match the real profiles verbatim, adds ownerScoped: true to the
template's frictions entry (closing the gap that forced the
ownerScoped test to hand-exclude the template), and switches the
ownerScoped test and the stateDir-outside-rootDir check to derive
their inputs structurally. Brings the docs snippets and prose in line
with the ownerScoped shape.
@LanNguyenSi
LanNguyenSi merged commit ac77fbc into master Aug 5, 2026
3 of 5 checks passed
@LanNguyenSi
LanNguyenSi deleted the task/10df0d9d-template-machine-state branch August 5, 2026 11:27
@LanNguyenSi LanNguyenSi added review:tests-pass merge-approval gate prerequisite review:checklist-complete merge-approval gate prerequisite review:comments-resolved merge-approval gate prerequisite review:scope-matches-task merge-approval gate prerequisite review:evidence-logged merge-approval gate prerequisite labels Aug 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review:checklist-complete merge-approval gate prerequisite review:comments-resolved merge-approval gate prerequisite review:evidence-logged merge-approval gate prerequisite review:scope-matches-task merge-approval gate prerequisite review:tests-pass merge-approval gate prerequisite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant