Refactor application and runtime boundaries #61

Merged
hugo merged 4 commits from linux-refactoring-base into main 2026-07-29 16:48:39 +00:00
Owner

Summary

This branch makes the behavior-preserving portions of REFACTOR.md concrete while making the project buildable and testable on Linux. DS4 behavior remains the oracle, and the high-risk Metal execution path is left untouched.

Linux build and test support

  • Adjust conditional compilation so platform-independent engine, generation, checkpoint, and sampling tests compile and run on Linux.
  • Keep Metal runtime code macOS-only while exposing pure helpers under tests.
  • Extract DSML tool-call parsing into a platform-independent module so agent and server parsing can be tested without the macOS runtime.
  • Preserve DS4 recovery behavior for complete tool invokes when generation omits only the outer tool-call closing tag.
  • Gate macOS-only state and imports cleanly and retain an explicit runtime error for local Metal generation on non-macOS platforms.

REFACTOR.md work

  • Add semantic NewMessage constructors for system, user, tool-result, assistant, and compaction database rows.
  • Move preference-message handling out of the large App::update match into the existing preferences domain module.
  • Consolidate generation, compaction, and context-measurement submission through one private runtime helper with explicit metrics tracking policies.
  • Remove the parallel ResponseKind enum and derive matching failure events directly from Operation.
  • Separate request source from checkpoint policy and represent context measurement with no checkpoint instead of an empty one-shot path.
  • Introduce focused runtime context structures where they clarify coherent invocations.
  • Split pure A2UI expression evaluation/formatting and catalog validation into natural modules while leaving store and streaming lifecycle behavior together.

The high-risk Metal FFI wrapper work and broad argument-count cleanup are intentionally not included: REFACTOR.md requires dedicated DS4 parity coverage before changing those execution paths.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --all-features (118 passed before the recovery test; the branch now includes 120 tests, with the Chrome-dependent test ignored)
  • cargo build --release --all-targets --all-features via make bundle

Packaging itself was not completed in the Linux environment because cargo-packager is not installed.

## Summary This branch makes the behavior-preserving portions of `REFACTOR.md` concrete while making the project buildable and testable on Linux. DS4 behavior remains the oracle, and the high-risk Metal execution path is left untouched. ## Linux build and test support - Adjust conditional compilation so platform-independent engine, generation, checkpoint, and sampling tests compile and run on Linux. - Keep Metal runtime code macOS-only while exposing pure helpers under tests. - Extract DSML tool-call parsing into a platform-independent module so agent and server parsing can be tested without the macOS runtime. - Preserve DS4 recovery behavior for complete tool invokes when generation omits only the outer tool-call closing tag. - Gate macOS-only state and imports cleanly and retain an explicit runtime error for local Metal generation on non-macOS platforms. ## REFACTOR.md work - Add semantic `NewMessage` constructors for system, user, tool-result, assistant, and compaction database rows. - Move preference-message handling out of the large `App::update` match into the existing preferences domain module. - Consolidate generation, compaction, and context-measurement submission through one private runtime helper with explicit metrics tracking policies. - Remove the parallel `ResponseKind` enum and derive matching failure events directly from `Operation`. - Separate request source from checkpoint policy and represent context measurement with no checkpoint instead of an empty one-shot path. - Introduce focused runtime context structures where they clarify coherent invocations. - Split pure A2UI expression evaluation/formatting and catalog validation into natural modules while leaving store and streaming lifecycle behavior together. The high-risk Metal FFI wrapper work and broad argument-count cleanup are intentionally not included: `REFACTOR.md` requires dedicated DS4 parity coverage before changing those execution paths. ## Validation - `cargo fmt --all -- --check` - `cargo clippy --all-targets --all-features -- -D warnings` - `cargo test --all-features` (118 passed before the recovery test; the branch now includes 120 tests, with the Chrome-dependent test ignored) - `cargo build --release --all-targets --all-features` via `make bundle` Packaging itself was not completed in the Linux environment because `cargo-packager` is not installed.
hugo added 3 commits 2026-07-29 11:04:15 +00:00
hugo added 1 commit 2026-07-29 16:47:28 +00:00
Author
Owner

Pushed commit 8390569 after reviewing and testing the shared refactor paths on macOS. It preserves completed DSML invocations when generation truncates a later structurally incomplete invocation while still rejecting invalid JSON, and makes Operation the single source of truth for runtime metrics tracking so queue, start, rejection, and completion accounting remain balanced. Regression tests cover both changes. Validation passed: cargo fmt check, Clippy with all targets and features and warnings denied, make bundle including app signing, and cargo test with 158 passed and 13 fixture-dependent tests ignored.

Pushed commit 8390569 after reviewing and testing the shared refactor paths on macOS. It preserves completed DSML invocations when generation truncates a later structurally incomplete invocation while still rejecting invalid JSON, and makes Operation the single source of truth for runtime metrics tracking so queue, start, rejection, and completion accounting remain balanced. Regression tests cover both changes. Validation passed: cargo fmt check, Clippy with all targets and features and warnings denied, make bundle including app signing, and cargo test with 158 passed and 13 fixture-dependent tests ignored.
hugo merged commit 6387538da9 into main 2026-07-29 16:48:39 +00:00
hugo deleted branch linux-refactoring-base 2026-07-29 16:48:39 +00:00
Sign in to join this conversation.