Public: anyone can read this; the crew can change it.

Move the accessors out of snapshot/service.ts (snapshotsOf) so it leaves the boot's static closure #17302

opened this

Merged 38h 35m ago, live in production

snapshotsOf now lives in its own module, src/snapshot/registry.ts, and snapshot/service.ts is no longer in the boot's static import closure. bun x tsc --noEmit is clean.

Notes

opened this

snapshotsOf now lives in its own module, src/snapshot/registry.ts, and snapshot/service.ts is no longer in the boot's static import closure. bun x tsc --noEmit is clean. The tests I ran pass: test/boot-lazy.test.ts, test/backup-truth.test.ts, test/backups-line.test.ts, test/backups-live.test.ts and test/unused-exports.test.ts (the dead-code test).

I did not run the full suite. I also did not run the /llms.txt byte-budget test or the timed-jobs test; this change touches neither.

What moved where

  • snapshotsOf and the registry map moved out of service.ts into registry.ts. The new registerSnapshots(app, handle) returns a function that forgets the handle, but only if it is still the registered one.
  • startSnapshots calls registerSnapshots when it starts, and stop calls the returned forget function. Behaviour is the same as before.
  • The SnapshotsHandle interface stays in service.ts. Everything that needs it imports it with import type, which the closure walker skips.
  • Callers now import snapshotsOf from the registry. These are the actions (backups_now, destination, backup_retry, health, mirror, resilience), the TUI resilience screen, the backups page, keeper/wire, the MCP tools backups, mirror_set and restore_drill, snapshot/backups_line, and test/backup-truth.test.ts.
  • test/boot-lazy.test.ts now asserts snapshot/service.ts is absent from staticClosure(src/main.ts). I also removed #17183 from its follow-up comment.

What I chose not to do

  • I did not move the SnapshotsHandle type. It stays in service.ts, so registry.ts imports it as a type only.
  • I did not reuse an existing function. The gate flagged registerSnapshots as 0.79 similar to listenForSteer in src/crew/steer.ts, and I kept the new function because it is a different thing.
  • The gate also noted that three action files (destination.ts, mirror.ts, resilience.ts) have comment lines over 100 columns. I left those alone, since the nightly rewrap handles them on main.

How to try it

  • Run bun test test/boot-lazy.test.ts test/backup-truth.test.ts.
  • Open /backups on the preview; it renders as before.

The commit messages carry No door:, No look: and Try: lines for the gate.

Closes #17183

commented

snapshotsOf now lives in its own module, src/snapshot/registry.ts, and snapshot/service.ts is no longer in the boot's static import closure. bun x tsc --noEmit is clean. The tests I ran pass: test/boot-lazy.test.ts, test/backup-truth.test.ts, test/backups-line.test.ts, test/backups-live.test.ts and test/unused-exports.test.ts (the dead-code test).

I did not run the full suite. I also did not run the /llms.txt byte-budget test or the timed-jobs test; this change touches neither.

What moved where

  • snapshotsOf and the registry map moved out of service.ts into registry.ts. The new registerSnapshots(app, handle) returns a function that forgets the handle, but only if it is still the registered one.
  • startSnapshots calls registerSnapshots when it starts, and stop calls the returned forget function. Behaviour is the same as before.
  • The SnapshotsHandle interface stays in service.ts. Everything that needs it imports it with import type, which the closure walker skips.
  • Callers now import snapshotsOf from the registry. These are the actions (backups_now, destination, backup_retry, health, mirror, resilience), the TUI resilience screen, the backups page, keeper/wire, the MCP tools backups, mirror_set and restore_drill, snapshot/backups_line, and test/backup-truth.test.ts.
  • test/boot-lazy.test.ts now asserts snapshot/service.ts is absent from staticClosure(src/main.ts). I also removed #17183 from its follow-up comment.

What I chose not to do

  • I did not move the SnapshotsHandle type. It stays in service.ts, so registry.ts imports it as a type only.
  • I did not reuse an existing function. The gate flagged registerSnapshots as 0.79 similar to listenForSteer in src/crew/steer.ts, and I kept the new function because it is a different thing.
  • The gate also noted that three action files (destination.ts, mirror.ts, resilience.ts) have comment lines over 100 columns. I left those alone, since the nightly rewrap handles them on main.

How to try it

  • Run bun test test/boot-lazy.test.ts test/backup-truth.test.ts.
  • Open /backups on the preview; it renders as before.

The commit messages carry No door:, No look: and Try: lines for the gate.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs