Skip to content

refactor: separate Relay tests and Group mirror rules - #685

Merged
Mathih13 merged 2 commits into
mainfrom
t3/audit-codebase-file-sizes
Oct 12, 2026
Merged

Mathih13 merged 2 commits into
mainfrom
t3/audit-codebase-file-sizes

Conversation

@Mathih13

Copy link
Copy Markdown
Contributor

Relay tests for many Protocol Families shared two central files, each over 4,000 lines. Group commands and World Shard mirror rules also shared one file. These mixed responsibilities made the code harder to navigate.

Move Relay packet and audience tests beside their Protocol Families. Keep shared routing, queue, lifetime, and reconciliation tests central. Extract Group mirror rules and their tests into group/mirror.rs, with the existing reducer re-exported from group.rs.

The central Relay files shrink to 1,772 and 1,771 lines. The Group file shrinks from 3,538 to 2,975 lines. The importer is outside this change.

What you verified

  • cargo test -p lyracore-gateway: 2,000 unit tests and 11 other tests passed. The default run ignored 31 tests.
  • cargo test -p lyracore-module --lib --features=debug_reducers: 1565 passed; 0 failed.
  • Module build_script and package_api_lint targets: 7 and 37 tests passed.
  • Module instance_removal and raid_convert targets, including ignored tests: 5 and 7 tests passed against disposable local SpacetimeDB instances.
  • Gateway durable roster Relay test: 1 passed; 0 failed. A Realm-core roster change reached every World Shard mirror.
  • cargo clippy --workspace --all-targets --all-features -- -D warnings and cargo fmt --all -- --check passed.
  • python3 scripts/check-gateway-bindings.py: All 1184 Gateway binding files are current.

The Module integration command used the macOS linker option below for SpacetimeDB host symbols. Durable tests executed the real Wasm Module.

cargo test --config 'target.aarch64-apple-darwin.rustflags=["-C","link-arg=-Wl,-undefined,dynamic_lookup"]' \
  -p lyracore-module --test build_script --test package_api_lint \
  --test raid_convert --test instance_removal -- --include-ignored

What you did NOT verify

No real-client check or migration of an existing Realm. The complete durable suite and unrelated crate test suites were not run locally.

Risk

This refactor preserves runtime behavior, reducer arguments, table definitions, and packet formats. The main risk is a missed test or changed mirror rule during extraction. Test inventory checks, durable tests, and separate standards and scope reviews cover those risks.

Notes for the reviewer

The two commits separate Relay test placement from Group mirror extraction. Most of the diff moves existing code. No unresolved review findings remain.

Model: GPT-6 Astra, high reasoning effort. Harness: Codex in T3 Code.

@Mathih13

Mathih13 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Independent adversarial review of 51c48384 found no actionable defects. The Gateway test moves preserve all 218 tests and 699 assertions in the changed files. The Group extraction preserves the reducer signature, executable body, ordering, authority checks, and side effects. Its tests retain all 92 assertions.

All nine CI checks passed at this head, including Rust, the durable suite and binding comparison, and Runtime Scripts. I checked the actual Group mirror, Instance Removal, and roster Relay results. No repairs were needed. The importer is unchanged.

Merged as ff2e6d6b. A follow-up adversarial review confirmed the merged patch matches the reviewed code exactly and has no material interaction with the concurrently merged Realm-core outage change. Combined Gateway and Module tests also passed at 6c23be8e. No real-client or live Realm check was performed. Independent reviewer and implementing agent used GPT-6 Astra at high effort through Codex.

@Mathih13
Mathih13 merged commit ff2e6d6 into main Oct 12, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant