Skip to content

fix: reject persisted network changes - #43

Open
emma31-dev wants to merge 1 commit into
mainfrom
fix/29-network-mismatch
Open

emma31-dev wants to merge 1 commit into
mainfrom
fix/29-network-mismatch

Conversation

@emma31-dev

Copy link
Copy Markdown
Owner

Closes #29.

What changed

  • Store::write_network and Store::write_changeset now reject a network that differs from the persisted one with Error::NetworkMismatch { stored, attempted }.
  • The check happens inside the write transaction, before commit, so a rejected write leaves the database unchanged.
  • Writing the same network remains idempotent and keeps a single row.
  • Rustdoc for both write paths states that the network is immutable after first persistence and that switching networks requires a new database.

Tests

  • Updated network_table_has_at_most_one_row to assert the typed mismatch error, the original stored network, and one row.
  • Added same-network idempotency coverage.
  • Added a write_changeset mismatch test.

Verification

  • cargo fmt --all -- --check
  • cargo test --all-targets --locked
  • cargo test --all-targets --all-features --locked
  • cargo check --no-default-features --locked
  • RUSTDOCFLAGS="-D warnings" cargo doc --all-features --no-deps --locked

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

This branch has not been deployed

No deployments
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.

[Bug]: Reject network changes instead of silently rewriting the stored network

1 participant