Skip to content

Conversation

@m-005
Copy link
Member

@m-005 m-005 commented Jan 16, 2026

Summary

Completes PR4 of the test utilities consolidation plan by migrating objects-sync and objects-registry tests to use the shared test utilities foundation.

Full migration - no backwards compatibility or deprecation stubs.

Changes

Sync Module Implementation (Tier 4)

  • sync::sync_engine() - Creates SyncEngine for testing
  • sync::project_from_replica() - Creates Project from ReplicaId using RFC-004
  • sync::asset() - Creates Asset with Result type for test compatibility

Test Migrations

objects-sync:

  • Replaced create_test_sync_engine()sync::sync_engine()
  • Replaced test_identity_id()identity::test_identity_id()
  • Replaced test_project_from_replica()sync::project_from_replica()
  • Replaced test_asset()sync::asset()
  • Replaced ObjectsEndpoint::builder().bind()transport::endpoint()
  • Deleted crates/objects-sync/tests/test_utils.rs (full migration)

objects-registry:

  • Replaced test_passkey_key()crypto::passkey_keypair().signing_key
  • Replaced test_wallet_key()crypto::wallet_keypair().signing_key
  • Replaced current_timestamp()time::now()
  • Removed duplicate helper functions

Dependencies

  • Added objects-sync and anyhow to objects-test-utils/Cargo.toml
  • Added objects-test-utils dev-dependency to objects-sync/Cargo.toml
  • Added objects-test-utils dev-dependency to objects-registry/Cargo.toml

Verification

# All tests pass (excluding registry DB tests)
cargo test --workspace --exclude objects-registry

# Code formatted
cargo fmt --all

# Clippy clean
cargo clippy --workspace -- -D warnings

PR Dependency Chain

PR1 (foundation+identity) ✅ merged
├─> PR2 (data) ✅ merged
│
└─> PR3 (transport) ✅ merged
     │
     └─> PR4 (sync) ← **This PR**
          │
          └─> PR5 (cleanup) - Next

Files Changed

  • crates/objects-test-utils/src/sync.rs (new)
  • crates/objects-test-utils/src/lib.rs
  • crates/objects-test-utils/Cargo.toml
  • crates/objects-sync/Cargo.toml
  • crates/objects-sync/tests/integration_tests.rs
  • crates/objects-sync/tests/test_utils.rs (deleted)
  • bins/objects-registry/Cargo.toml
  • bins/objects-registry/tests/integration_tests.rs
  • bins/objects-registry/tests/concurrency_tests.rs

Related

  • Plan: ~/.claude/plans/logical-purring-comet.md
  • Base: PR3 (feat/test-utils-transport)
  • Next: PR5 (cleanup - remove deprecated modules from identity, data, transport)

Completes PR4 of the test utilities consolidation plan by migrating
objects-sync and objects-registry tests to use the shared test utilities
foundation. This is a full migration with no backwards compatibility.

**Changes:**

Sync module (Tier 4):
- Add sync.rs to objects-test-utils with sync_engine(), project_from_replica(), and asset() helpers
- Add objects-sync and anyhow dependencies to objects-test-utils

Test migrations:
- Migrate objects-sync integration tests to use sync::*, identity::*, and transport::* utilities
- Delete objects-sync/tests/test_utils.rs (full migration, no deprecation stubs)
- Migrate objects-registry tests to use crypto::passkey_keypair().signing_key and time::now()
- Clean up unused imports and helper functions

Dependencies:
- Add objects-test-utils dev-dependency to objects-sync and objects-registry

**Verification:**
- All workspace tests pass (excluding registry DB tests which require DATABASE_URL)
- Code formatted with cargo fmt
- Clippy passes with -D warnings

Follows RFC plan: feat/test-utils-foundation → feat/test-utils-data → feat/test-utils-transport → feat/test-utils-sync
@claude
Copy link

claude bot commented Jan 16, 2026

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

…ts_sync::Result

Fixes semantic error handling issue where data layer validation errors
were incorrectly wrapped as sync layer Iroh errors.

Changes:
- sync_engine(), project_from_replica(), asset() now return anyhow::Result<T>
- Removed incorrect Error::Iroh wrapping of objects_data::Error
- Added proper error context messages

This maintains compatibility with test code using the ? operator while
providing correct error semantics and better error messages.
@m-005 m-005 merged commit 51f2261 into main Jan 16, 2026
5 checks passed
@m-005 m-005 deleted the feat/test-utils-sync branch January 16, 2026 04:20
m-005 added a commit that referenced this pull request Jan 16, 2026
* feat: Migrate sync tests to objects-test-utils foundation

Completes PR4 of the test utilities consolidation plan by migrating
objects-sync and objects-registry tests to use the shared test utilities
foundation. This is a full migration with no backwards compatibility.

**Changes:**

Sync module (Tier 4):
- Add sync.rs to objects-test-utils with sync_engine(), project_from_replica(), and asset() helpers
- Add objects-sync and anyhow dependencies to objects-test-utils

Test migrations:
- Migrate objects-sync integration tests to use sync::*, identity::*, and transport::* utilities
- Delete objects-sync/tests/test_utils.rs (full migration, no deprecation stubs)
- Migrate objects-registry tests to use crypto::passkey_keypair().signing_key and time::now()
- Clean up unused imports and helper functions

Dependencies:
- Add objects-test-utils dev-dependency to objects-sync and objects-registry

**Verification:**
- All workspace tests pass (excluding registry DB tests which require DATABASE_URL)
- Code formatted with cargo fmt
- Clippy passes with -D warnings

Follows RFC plan: feat/test-utils-foundation → feat/test-utils-data → feat/test-utils-transport → feat/test-utils-sync

* fix(test-utils): Use anyhow::Result for sync helpers instead of objects_sync::Result

Fixes semantic error handling issue where data layer validation errors
were incorrectly wrapped as sync layer Iroh errors.

Changes:
- sync_engine(), project_from_replica(), asset() now return anyhow::Result<T>
- Removed incorrect Error::Iroh wrapping of objects_data::Error
- Added proper error context messages

This maintains compatibility with test code using the ? operator while
providing correct error semantics and better error messages.
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.

2 participants