Repository navigation
refactor: route config_seed and seed_manifest disk access through filesystem (sanitizing symptom 07) #3324
Description
Situation
Sanitizing symptom 07 ("scattered disk access") is still the largest symptom. Gate 07 (npm run sanitizing:disk_access -- --base-ref origin/main, scripts/sanitizing_disk_access.mjs) measures disk_files = 151 on main 56a7d00e (after #3320).
Most remaining config/ files are reserved by other work (config.rs, archive_gate.rs, entity_creation*, replica_identity*, root_agent*, sessions_persistence*), belong to the settings-ownership epic #2992 (settings/, coding-agent catalog and profiles), or are touched by open PRs #3162/#3164 (agent_command*, agent_config*, local_config_io*, local_overlay.rs, teams*). Two related sub-trees are free: the config seed (copy of the seeded configuration into an instance) and the seed manifest (locked, handle-based manifest that records what was seeded). Their 6 counted production files still call std::fs directly (approximate list, read from the production body of each file):
config/config_seed/copy.rs-metadatax2,remove_dir_allx2,read_dirx3,create_dir_all,copyx2,read,writex3;DirEntryand WindowsMetadataExtinis_symlink_or_reparse.config/config_seed/perform.rs-renamex3,symlink_metadatax6,OpenOptions; WindowsMetadataExtinmetadata_is_reparse.config/seed_manifest/guard.rs-File(lock file,File::unlock),canonicalize,read_dir.config/seed_manifest/handles.rs-File,OpenOptions(Unix/WindowsOpenOptionsExt, no-follow directory and file opens),symlink_metadatax4, UnixMetadataExt/ Windows handle facts,is_windows_reparse.config/seed_manifest/publish.rs-Filelocking (TryLockError),remove_filex2,rename.config/seed_manifest/windows.rs-File,OpenOptions(Windows delete handle),File::from_raw_handle,rename.
Tree of symptom 07: these files are not container stores and are not filesystem; they read, copy, lock and atomically publish app data (seeded config, seed manifest) (R2), and several repeat link/reparse-point and no-follow checks that may already exist in filesystem (R1).
Precedents: #3259 (created src-tauri/src/filesystem.rs and its submodules), #3293, #3298, #3308 (PR #3314), #3320 (PR #3322).
Need
Rule 13 of the structure method: only container stores and the filesystem module touch the disk. These 6 files must stop calling std::fs directly; their disk work must go through filesystem as named business operations, or through the matching container store, which delegates physical operations to filesystem.
Intended change
- Decide, through architecture review, where each disk operation of the 6 files goes (
filesystemsubmodule(s) and/or existing container stores), and whether local safety checks are replaced by existingfilesystemprimitives. - Move the disk calls behind those owners; callers receive data or owned handles, not raw
std::fscalls. - Versioned, consensus-approved plan with exact files and no open decisions (partitioned in phases if the size requires it; one branch, one PR).
Scope
In: the 6 production files above, src-tauri/src/filesystem.rs (only its sorted mod lines; shared reservation) and the filesystem submodule(s) the approved design requires, and their tests as needed. src-tauri/tests/c4_state_key_census.rs: only the inventory count literal (assert_eq!(sources.len(), 1395, "inventory count")), set to the verified real .rs count for the new files of the approved plan (shared reservation, same rule as #3320).
Out: every other config/ file, in particular config.rs, config/archive_gate.rs, config/entity_creation*, config/replica_identity*, config/root_agent*, config/sessions_persistence* (reserved by other work), config/settings*, config/coding_agents_catalog*, config/coding_agent_profiles* (#2992), config/agent_command*, config/agent_config*, config/local_config_io*, config/local_overlay.rs, config/teams* (touched by open PRs); the other config_seed/ and seed_manifest/ files that gate 07 does not count (config_seed.rs, seed_manifest.rs, lifecycle.rs, path_identity.rs, state.rs, wire.rs, tests*) unless the approved design needs a call-site change there; the seed manifest row validation of #1622; cli.rs; commands/, cli/, pty/, phone/, api/; filesystem/projects* (reserved by other work); the rest of src-tauri/tests/c4_state_key_census.rs; gates and scripts/containers.json unless the approved design requires a registry entry; tests' own std::fs use.
Must not change
Behavior byte for byte: same seeded files, contents and placeholder expansion, file names and locations, staging/trash/rename order and rollback, manifest wire format, lock acquisition and timeouts, error variants and texts, NotFound handling, paths (no new or removed canonicalization), no-follow opens, link/reparse-point and handle-identity protections, Windows delete-handle semantics, atomic replace semantics, and cfg. No wider public API. Any of these requires a user decision first.
Acceptance criteria
- Approved plan naming the owners and exact files.
- Gate 07 on the PR:
disk_filesdrops by 6 (none of the 6 files counted) and no new file is counted; gatescheck:cyclesandcheck:arcsPASS. cargo clippy --locked --manifest-path src-tauri/Cargo.toml --workspace --all-targets -- -D warningsclean, affected tests pass, CI (ci:full) green.- No behavior change.
Activity
mblua commentedon Oct 27, 2026
Technical score (task-technical-scoring)
config/plus newfilesystemsubmodule(s) and call sites in their parents: a coherent module.OpenOptionsExt), handle identity facts (UnixMetadataExt, Windows FFI),unsafe File::from_raw_handle, Windows delete handles, reparse-point checks, file locks.filesystemsubmodules vs existing primitives; whether handle types move or stay) with a defensible winner to pick.remove_dir_allinside instance directories; the manifest guards what was seeded; protections are involved. Normal rollback.filesystem.rs(room-21) and the shared census literal; no external system.config_seed/tests*andseed_manifest/tests*plus gate counts; byte-for-byte preservation of Windows-only paths needs targeted checks and CI on the other OSes.try_lock,TryLockError,File::unlock), atomic rename publication; clear ownership.cfg(windows)/cfg(unix)branches and FFI that one host cannot prove, shared build slots, clippy-D warningsper platform.Raw = 91. Final = round((91 - 10) / 190 * 99) + 1 = 43.
Band 26-55 (Lite by score); escalated to Full like the precedent #3320: non-obvious owner split for security-relevant, handle-level I/O, so the Partition rule applies. Vetoes: Concurrency >= 10 (architect contract), Blast radius >= 12 (full file-impact tables at the human gate), Verification difficulty >= 8 (Grinch also reviews the proof), Environment >= 8 (owning dev states environment risk in writing before code). Author
ac-architect-v5; reviewersac-dev-rust-v5,ac-dev-rust-grinch-v5,ac-architect-grinch-v5; four matchingPlan-SHA256(andPhase-SHA256per phase if partitioned).Excluded ceremony: issue creation, branch, PR, CI waits, review rounds, messaging, merge and cleanup.
mblua commentedon Oct 27, 2026
Approved partition (consensus 4/4, plan v1)
Plan:
D:/0_repos/AgentsCommander_iac/.ac/plans/3324-seed-disk-access/epic.md—Plan-SHA256: 6BC179845BAEDD62C2BF7F55E51E2DA9508767DB96F7E81CA8F0B2FD96D6E0E8. One branchrefactor/3324-seed-disk-access, one commit per phase, one PR. Design basemain56a7d00e.P01-config-seed.mdCCE5F591BD08D6C0D844D460612E2463D29114516AC931EF9079BB2D2D8670C1P02-seed-manifest.md130EEBAA04BE77546EFFFE88674EB1BE717E665705BC84BE6C14CAF42B1FFFCCNew files:
src-tauri/src/filesystem/config_seed.rs(P01),src-tauri/src/filesystem/seed_manifest.rs(P02). Votes: author READY; owning dev, Rust Grinch and architecture GrinchPLAN_APPROVEDon the same digest set,PHASE_EXECUTABLEP01–P02. Step 7.5 approval pending.merge: integrate main before seed manifest extraction refs #3324
refactor: isolate seed manifest disk operations refs #3324
Merge pull request #3328 from mblua/refactor/3324-seed-disk-access
mblua commentedon Oct 28, 2026
Delivered
PR #3328 merged (admin, merge commit) →
maind10967ae11858ab6fa2e3c09ac6e445e3a68b8f2(2026-10-28T00:23:00Z).Result: the 6 counted files (
config/config_seed/{copy,perform}.rs,config/seed_manifest/{guard,handles,publish,windows}.rs) no longer callstd::fsdirectly; physical disk work lives insrc-tauri/src/filesystem/config_seed.rsandsrc-tauri/src/filesystem/seed_manifest.rs. Gate 07 onmaind10967ae:disk_files= 138, none of the 6 files and neither new leaf counted.2ca44ca4origin/main41762994e2cc148fdf4d1982Plan-SHA256 6BC17984…E0E8,P01=CCE5F591…70C1,P02=130EEBAA…FFCC; consensus 4/4; Step 7.5 approved (coordinator decision by delegation).df4d1982: run 40602580460 success;gh pr checks: 27 pass, 0 fail, 2 skipped (unexpanded matrix placeholder rows).src-tauri/src/pty/container_credentials.rs:28(refers to the oldconfig_seed::is_symlink_or_reparselocation); no behavior impact.