Skip to content

refactor(recording): move Swift cache policy to recording ownership #2144

Description

@thymikee

Parent: #2129

Blocked by: none. Wave 1; this child owns Swift compilation/cache policy only.

Scope — exact tracked files

Production:

  • src/utils/swift-cache.ts

Tests:

  • src/utils/__tests__/swift-cache.test.ts

Destination and importer edits

Move to:

  • src/recording/swift-cache.ts
  • src/recording/swift-cache.test.ts

Update exactly these production importers:

  • src/recording/overlay.ts
  • src/utils/video.ts (the video owner child consumes the final path)

The recording module remains the owner of Swift source compilation and executable cache policy. Do not classify this as generic process/file mechanics merely because it calls host-kit ports.

Behavior invariants

Preserve source-file/text compilation, cache-key inputs, module-cache environment handling, host temporary paths, process-lock semantics, atomic executable publication, cached promise behavior, compiler arguments, diagnostics, and typed failure/unavailability handling. Preserve the lazy behavior of overlay/video callers and do not change video validation policy in this child.

Focused validation

Run:

  • pnpm vitest run src/recording/swift-cache.test.ts
  • pnpm vitest run src/recording/__tests__/overlay.test.ts
  • the existing video tests on current main
  • pnpm check:affected --run

Planted-red proof

No new structural rule is added. Temporarily alter the cache-key input or lock acquisition in the moved test seam and observe the independent cache test fail; restore it before the green run. Keep compiler unavailability behavior typed and explicit.

Dependency order

Wave 1. The video child is blocked by this child because video.ts consumes Swift compilation/cache policy. The terminal child is blocked by this child.

Shrink target

Delete the old utility module and test. Move the implementation into the existing recording owner with no compatibility path; after discounting the physical move, production LOC must not grow.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions