Skip to content

Extract public-API tests from omnigraph.rs to integration tests#40

Merged
aaltshuler merged 1 commit into
mainfrom
refactor/extract-omnigraph-tests
Apr 20, 2026
Merged

Extract public-API tests from omnigraph.rs to integration tests#40
aaltshuler merged 1 commit into
mainfrom
refactor/extract-omnigraph-tests

Conversation

@aaltshuler

Copy link
Copy Markdown
Collaborator

Summary

  • Move 15 public-API-only tests out of the inline mod tests in crates/omnigraph/src/db/omnigraph.rs into two new integration test files.
  • tests/lifecycle.rs — 10 tests covering init/open/snapshot/drift behaviors.
  • tests/schema_apply.rs — 5 tests covering plan/apply via the public API.
  • 10 tests remain inline because they legitimately need crate-private access (db.coordinator, db.table_store(), ManifestCoordinator, SCHEMA_APPLY_LOCK_BRANCH, is_internal_run_branch).

No behavior change: the only semantic edit is swapping db.snapshot() (which is pub(crate)) for the existing snapshot_main helper at integration-test boundaries. omnigraph.rs drops 268 lines; 288 lines are added across the two new test files (slightly more because the extracted tests no longer share the inline TEST_SCHEMA constant and use the fixture-backed helper).

Test plan

  • cargo test -p omnigraph-engine --test lifecycle --test schema_apply — all 15 pass
  • cargo test -p omnigraph-engine --lib db::omnigraph::tests — remaining 10 inline tests pass
  • cargo test -p omnigraph-engine — full engine suite green (lib + all integration files)

🤖 Generated with Claude Code

The inline `mod tests` in crates/omnigraph/src/db/omnigraph.rs had grown
to ~620 lines, mixing tests that need crate-private access with tests
that only exercise the public API. Splits the latter out.

- tests/lifecycle.rs: 10 init/open/snapshot/drift tests
- tests/schema_apply.rs: 5 plan/apply tests
- omnigraph.rs: 10 tests remain inline because they use
  db.coordinator, db.table_store(), ManifestCoordinator,
  SCHEMA_APPLY_LOCK_BRANCH, or is_internal_run_branch — all
  crate-private and intentionally kept so.

No behavior change. Zero semantic edits to the tests themselves beyond
replacing db.snapshot() (pub(crate)) with snapshot_main helper at
integration-test boundaries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aaltshuler aaltshuler merged commit 789c063 into main Apr 20, 2026
4 checks passed
@aaltshuler aaltshuler deleted the refactor/extract-omnigraph-tests branch April 20, 2026 11:15
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