Skip to content

Split the pure core into its own crate #23

Closed

Description

@omesser

Depends on: #2, #3, #14

Why

docs/SPEC.md calls the Engine "pure, synchronous, no I/O" and the single seam
for the entire Spatial Layer, where "the overwhelming majority of tests" live.
The source honours that — engine.rs has no imports outside its own test module.

The crate does not. Everything lives in ai-buddy, which depends on tauri,
objc2 and objc2-app-kit, so cargo test links the whole platform stack to
run arithmetic. Three consequences, all currently visible:

  • .github/workflows/tests.yml skips the Rust hooks on the Linux lint job and
    runs a second macOS job instead, with a comment saying why. A pure core would
    need neither.
  • The Rust job takes minutes where the tests themselves finish in milliseconds.
  • The purity the spec asks for is a property of the source only. Nothing stops
    the next change importing Tauri into the Engine, and no check would fail.

Making it a build property means it cannot rot.

Scope

A Cargo workspace:

  • A core crate with no dependency on tauri, objc2 or any platform
    binding. Holds the Engine, the overlay hit-testing arithmetic, and Memory.
    Memory does file I/O, which is fine — the rule is no platform or toolkit
    dependency, not no I/O.
  • The shell crate, depending on core, keeping main.rs, the Tauri setup,
    the AppKit panel work, and WindowSource.

No behaviour change. This is a move, not a rewrite.

Acceptance criteria

  • The core crate's dependency tree contains no tauri and no objc2*, checked
    mechanically rather than by eye: cargo tree -p <core> shows neither.
  • The core crate's tests and clippy run on a Linux runner in CI.
  • Every existing test still passes, in whichever crate it now lives.
  • The shell crate still builds and runs on macOS, and
    scripts/verify-overlay.sh still passes.
  • .github/workflows/tests.yml no longer needs to skip the Rust hooks on Linux
    for the core crate.

Tests

The existing suites move with their modules and must keep passing unchanged. Add
no new behaviour tests; the dependency-tree check above is the new assertion.

Sequencing

Do this after #22 merges. #20 and #21 have landed, putting memory.rs and
window_source.rs on main already; #22 adds engine.rs, and splitting the
workspace before it lands guarantees a conflict with it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions