Skip to content

feat(worktrees): narrow the manifest store behind a facade (PR 5/6) - #302

Merged
hzcheng merged 2 commits into
mainfrom
agent-pivot/arch-refact
Aug 20, 2026
Merged

feat(worktrees): narrow the manifest store behind a facade (PR 5/6)#302
hzcheng merged 2 commits into
mainfrom
agent-pivot/arch-refact

Conversation

@hzcheng

@hzcheng hzcheng commented Aug 20, 2026

Copy link
Copy Markdown
Owner

Summary

PR 5/6 of the Harness Simplification program. Structural single-writer enforcement for the worktree group manifest store, replacing the type-resolved method scan for this state family.

  • The store class leaves the entrypoint: cross-module consumers receive a capability-free WorktreeGroupManifestStoreHandle plus narrow WorktreeGroupManifestReader / WorktreeGroupManifestWriter views. A write call outside the 5-method writer view is a compile error; importing the store file from outside the module is an entrypoint violation.
  • Intra-module writers (8 files) take the handle and unwrap it via the module-internal worktreeGroupManifestStoreOf, which is never re-exported.
  • dashboard.ts (composition root) holds only the views; its write surface shrinks from 25 methods to the 5 it legitimately needs. The unlisted renameGroup enumeration gap disappears with the scan.
  • checkSingleWriters: a stateFamily with writerFacade: true is enforced by a structural import rule on the dependency graph — only declared writers and the module entrypoint may import the store file. Families sharing one store must agree on the flag. Non-facade families (provisioningStore) keep the type-resolved scan during migration.
  • Invariant catalog: both groupManifest families declare the facade.

Mutation-sensitivity proof: a probe file importing the store from src/todos/ fails the guard (single-writer: src/todos/__sneaky_probe.ts imports facade store ...); removing it restores green.

Skill harvest

no skill change — the facade pattern followed existing codebase conventions (injected closures, handle unwrap); the CI workflow lessons from this program were already harvested in #297/#299.

Owner approvals

Copy each line into a separate PR comment below (both bind the exact head SHA and expire when the head moves):

approve-architecture c7033e76275cfd4aa48e267a49a61f86cb347b39
approve c7033e76275cfd4aa48e267a49a61f86cb347b39

Verification

  • npm run test-compile
  • node --test tests/unit/architecture/** tests/unit/tooling/** — 546 pass (3 new facade edge-rule cases)
  • node --test tests/unit/worktrees/** — 191 pass; full unit/contract/integration suites pass
  • npm run test:behavior-contracts / npm run lint — pass
  • Default-branch gate evaluation replayed against the exact head: classification relaxing, zero errors with approval
  • node scripts/run-trusted-kernel.js — passes with approval, fails closed without

@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown

Architecture impact report — c7033e76

  • classification: relaxing
  • touched modules: MOD-DASHBOARD-SHELL, MOD-WORKTREE-LIFECYCLE
  • protected paths touched: docs/testing/architecture-invariants.json
  • harness surface touched: scripts/architecture/checkSingleWriters.js, tests/unit/architecture/singleWriters.test.js
  • mayDependOn grown: (no)
  • entrypoints grown: (no)
  • invariants changed: ARCH-WORKTREE-MEMBER-WRITER-001, ARCH-WORKTREE-MANIFEST-STRUCTURE-001
  • invariants removed: (no)
  • baseline grown: (no)
  • waivers added: (no)
  • ledger regressions: (no)
  • capabilities: MAIN-WORKTREE-CHANGES-PANEL
  • behaviors: WORKTREE-CHANGES-COLLECT-001, WORKTREE-CHANGES-PANEL-001, WORKTREE-GROUPS-BASELINE-001, WORKTREE-GROUPS-CREATE-001, WORKTREE-GROUPS-CREATE-HANDLER-001, WORKTREE-GROUPS-MERGE-001, WORKTREE-GROUPS-REPLAY-001

Generated by the merge-approval gate from the exact PR head; the PR body carries no machine-checked declaration.

chenghongze added 2 commits August 20, 2026 10:51
Structural single-writer enforcement for the worktree group manifest
store, replacing the type-resolved method scan for this state family:

- The WorktreeGroupManifestStore class is no longer exported from the
  module entrypoint. Cross-module consumers receive a capability-free
  WorktreeGroupManifestStoreHandle plus narrow WorktreeGroupManifestReader
  / WorktreeGroupManifestWriter views — a write call outside the writer
  view is a compile error, and importing the store file from outside the
  module is an entrypoint violation.
- Intra-module writers take the handle and unwrap it via the
  module-internal worktreeGroupManifestStoreOf (never re-exported).
- dashboard.ts (the composition root) holds reader/writer views only;
  its write surface shrinks from 25 methods to the 5 it legitimately
  needs. The renameGroup enumeration gap disappears with the scan.
- checkSingleWriters: a stateFamily declaring writerFacade: true is
  enforced by a structural import rule on the dependency graph — only
  declared writers and the module entrypoint may import the store file.
  Families sharing one store must agree on the flag. Non-facade families
  (provisioningStore) keep the type-resolved scan during migration.
- Invariant catalog: both groupManifest families declare the facade.
@hzcheng
hzcheng force-pushed the agent-pivot/arch-refact branch from db01d76 to c7033e7 Compare August 20, 2026 02:53
@hzcheng

hzcheng commented Aug 20, 2026

Copy link
Copy Markdown
Owner Author

approve-architecture c7033e7
approve c7033e7

@hzcheng
hzcheng merged commit 8575791 into main Aug 20, 2026
13 of 16 checks passed
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