Skip to content

refactor(host-kit): split atomic-file by concern - #4745

Merged
thymikee merged 2 commits into
mainfrom
refactor/host-kit-destination-modules
Nov 19, 2026
Merged

thymikee merged 2 commits into
mainfrom
refactor/host-kit-destination-modules

Conversation

@thymikee

@thymikee thymikee commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

atomic-file.ts (950 lines) mixed three concerns. This splits it by concern, move-only, in 19 files:

  • atomic-publish.ts: generic publication. process-lock.ts and owned-process-record.ts import only this.
  • script-destination.ts: the destination walk, exposure rules, level creation, publishScriptFileSync, Windows creation.
  • script-destination-refusal.ts: exposure wording, hints, typed reasons. The walk and the name rules both use it, so it is its own module to avoid an import cycle.
  • entry-name.ts: entry-name rules and resolveScriptDestination (moved from path-resolution.ts).

hostPathRules moves to path-resolution.ts, which now imports none of the script modules. The @agent-device/host-kit/file surface is unchanged. Tests move beside their owners: 116 cases before and after.

A parallel PR deletes judgeScriptDestination. Whichever lands second rebases; here it moved unchanged into script-destination.ts.

Validation

At a7f803d73f (rebased onto 83328f1d8a; only the two cross-package comment pointers #4742 moved conflicted):

  • Diff review: every function body is byte-identical (sorted-line diff of old vs new modules differs only in imports and export keywords), so checks and their order are unchanged.
  • Eager closure: eager-closure-budgets.test.ts green, no budget change. owned-process-record.ts 5 files / 96 KB → 4 files / 32 KB, process-lock.ts 220 KB → 188 KB.
  • host-kit, remote, capture-kit recording unit suites: 1203 passed. Daemon unit suite, typecheck, lint, check:layering (staged), check:production-exports, fallow audit --base origin/main: pass.
  • a7f803d73f only repoints the ADR 0016 path reference to entry-name.ts.
  • CI validates the pushed head.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Size Report

Metric Base Current Diff
Installed (including dependencies) 6.41 MB 6.41 MB -72 B
Package (unpacked) 6.41 MB 6.41 MB -72 B
Package (download) 1.95 MB 1.95 MB -42 B

Startup median (7 runs, lower is better):

Scenario Base Current Diff
CLI --version 25.2 ms 21.2 ms -4.0 ms
CLI --help 52.5 ms 44.2 ms -8.3 ms

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging

This comment has been minimized.

thymikee and others added 2 commits November 19, 2026 14:32
atomic-file.ts mixed generic atomic publication, the caller-named script
destination walk, and POSIX/Windows entry-name rules. Split it into:

- atomic-publish.ts: publishFileSync, publishDurableFileSync, temp naming,
  directory sync. Generic internal callers import only this.
- script-destination.ts: prepare/confirm/judge, the walk, exposure rules,
  level creation, publishScriptFileSync, the Windows creation branch.
- script-destination-refusal.ts: exposure vocabulary, wording, hints and
  typed reasons, shared by the walk and the name rules without a cycle.
- entry-name.ts: scriptEntryName and its refusals, Windows name rules,
  NAME_MAX, requireWindowsScriptVolume, and resolveScriptDestination
  (moved from path-resolution.ts).

hostPathRules moves to path-resolution.ts, which now holds only general
user-path helpers and imports nothing from the script modules. Function
bodies are unchanged; tests move beside their owners. The public surface
of @agent-device/host-kit/file is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…stination

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@thymikee
thymikee force-pushed the refactor/host-kit-destination-modules branch from 198d0e4 to a7f803d Compare November 19, 2026 13:34
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of a7f803d

Since the review of 198d0e4: 0 new · 0 still open · 0 no longer raised

No open findings.

Reviewed with this repository's own Sentinel configuration (83328f1d8aac).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

@thymikee

Copy link
Copy Markdown
Member Author

This PR is ready at a7f803d: the split of atomic-file is moves and import repoints, and the import graph has no problems. CI is green, with 19 checks and none failing.

Not blocking: tree() and skipOnWindows are now declared in both entry-name.test.ts and script-destination-entry.test.ts, so you could export tree() from script-destination-host.fixtures.ts, and atomic-publish.test.ts still uses the old host-kit-atomic-file- temp-dir prefix, so you could rename it to host-kit-atomic-publish-; take or leave both.

The diff changes no test case or body. No conflicts are known, and nothing else needs to happen before merge.

@thymikee thymikee added the ready-for-human Valid work that needs human implementation, judgment, or maintainer merge label Nov 19, 2026
@thymikee
thymikee added this pull request to stack #4749 November 19, 2026 13:55
@thymikee
thymikee merged commit 4d06746 into main Nov 19, 2026
19 checks passed
@thymikee
thymikee deleted the refactor/host-kit-destination-modules branch November 19, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-human Valid work that needs human implementation, judgment, or maintainer merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant