refactor: move errors/redaction/device into src/kernel — Phase 5 slice 3#940
refactor: move errors/redaction/device into src/kernel — Phase 5 slice 3#940thymikee wants to merge 2 commits into
Conversation
Size Report
Startup median (7 runs, lower is better):
Top changed chunks:
|
|
I checked the path-move surface and the source imports look mechanically clean: the three files are 100% renames into One cleanup before merge: there are still current repo guidance/doc references to the old paths:
|
|
Done — pushed c2c7d56. Updated the three current guidance files to point at the new
Left |
|
Thanks, the stale-path cleanup from the prior review is addressed in |
Relocates the foundational primitive trio from src/utils/ into the kernel/ layer (joining snapshot.ts from slice 2), per the target folder DAG in plans/perfect-shape.md §5.5. A pure path codemod, no behavior change. They form a closed cluster — device -> errors -> redaction, with redaction a leaf — so kernel/ takes no upward dependency, and every importer becomes a clean downward import toward kernel. errors.ts is the most-imported module in the tree; device.ts the §5.5-named headliner. Moving all three atomically avoids a half-state where one would import another across the utils/kernel boundary. Imports rewritten by a resolve-based codemod (compares each specifier's resolved path to the moved files, so the unrelated commands/management/device.ts and other same-named files are untouched): 483 sites across 402 files. The two platform-descriptor doc comments and the fallow health baseline key for device.ts are updated to the new path; the contracts-schema-public guard that asserts the error helpers pull no diagnostics/node: deps now reads kernel/. Verified: tsc --noEmit, oxfmt + oxlint --deny-warnings, rslib build, full vitest suite (2877 pass), fallow audit clean (411 changed files), Layering Guard empty; kernel/ files import only within kernel.
…move AGENTS.md (Apple-family sync rule + normalizeError), ADR-0009, and plans/apple-platform-consolidation.md still named the old src/utils/ paths. Point them at src/kernel/. plans/perfect-shape.md's utils/device.ts mention is left as-is — it describes the pre-move diagnosis.
c2c7d56 to
e196be5
Compare
|
Re-checked current clean head |
|
Rebased onto current |
What
Relocates the foundational primitive trio —
errors.ts,redaction.ts,device.ts— fromsrc/utils/into thekernel/layer (joiningsnapshot.tsfrom slice 2 / #932), per the target folder DAG inplans/perfect-shape.md§5.5.A pure path codemod, no behavior change.
Why these three, atomically
They form a closed cluster —
device → errors → redaction, withredactiona leaf — sokernel/takes no upward dependency, and every importer becomes a clean downward import toward kernel.errors.tsis the most-imported module in the tree (321 importers);device.tsis the §5.5-named headliner (144). Moving all three in one atomic move avoids a half-state where one would import another across theutils/↔kernel/boundary.How
Imports were rewritten by a resolve-based codemod: it compares each specifier's resolved absolute path to the moved files before rewriting, so unrelated same-named files (
commands/management/device.ts, etc.) are left untouched. 481 import sites across 400 files. Intra-cluster imports (device → ./errors,errors → ./redaction) need no change — the three stay co-located inkernel/.Also updated: two
platform-descriptordoc comments, the fallow health-baseline key fordevice.ts, and thecontracts-schema-publicguard (asserting the error helpers pull nodiagnostics/node:deps) now readskernel/errors.ts.Verification
tsc --noEmitexit 0;kernel/files import only within kernel (no upward deps)oxfmt+oxlint src --deny-warningsclean (no unrelated drift — every changed file's diff is an import rewrite)rslib buildexit 0vitest run→ 2870 pass. The only failures were the known-flaky android-fill timing tests under full-suite CPU load (5s timeouts); they pass 92/92 in isolation, and a pure import-path move cannot affect fill logic.fallow audit --base origin/main→ ✓ no issues in 406 changed filesutils/{errors,redaction,device}.tsreferences anywhere (src, test, configs, baselines)Note
Large but mechanical (the inherent cost of relocating the most-imported foundational modules) — best merged promptly to avoid import-drift conflicts.
kernel/now holdssnapshot · errors · redaction · device; remaining kernel members (contracts.ts, andcommand-result/capabilitiesonce theircore/-descriptor coupling is broken) follow in later slices.