Skip to content

Test that stored commit rows stand on their own - #1779

Closed
joepio wants to merge 1 commit into
developfrom
claude/project-thread-mes3rj-commit-tests
Closed

joepio wants to merge 1 commit into
developfrom
claude/project-thread-mes3rj-commit-tests

Conversation

@joepio

@joepio joepio commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Requested by Joep · project thread

Before: nothing on this branch failed if a stored genesis, rights or destroy commit stopped carrying its own signed payload. The tests that guarded this on an earlier branch never reached this base, and the check that refuses to replay a destroy after the resource is re-created had no test at all.

After: three tests fail as soon as a stored commit depends on its envelope again, or the destroy replay check goes missing. Nothing changes at runtime; this PR only adds tests.

How: in lib/src/envelopes.rs, stored_genesis_commit_keeps_its_signed_payload_after_a_later_edit edits a resource once. The default latest retention then deletes the genesis envelope. The test checks that the genesis commit row still has its loroUpdate and still verifies, and that the same row with loroUpdate removed does not. destroy_replay_after_recreate_is_refused_by_the_commit_row destroys a resource, has a peer send its genesis again, and checks three things: the destroy envelope is gone, the destroy's commit row is still there, and replaying the destroy is refused with "already applied here". In lib/src/db/test.rs, commit_resource_blob_keeps_loro_update_and_is_indexed_by_subject reads the raw Tree::Resources rows. The commit row keeps loroUpdate and has no Loro snapshot. The resource's own row leaves loroUpdate out. A query on subject finds the commit row. The background is in #1776.

Tests:

  • cargo test -p atomic_lib --features "db,db-sled,ws,iroh,config,rdf,discovery,ring" --lib -- envelopes:: db::test::: 65 passed, 0 failed.
  • With the destroy replay check in Db::apply_commit disabled by hand, the replay test fails as intended. The check was restored before committing.
  • cargo fmt --all: clean. cargo clippy -p atomic_lib --tests: no warnings in the changed files.

@joepio joepio self-assigned this Sep 25, 2026
Base automatically changed from trekmeester/combined-20260925 to develop September 25, 2026 13:04
@gitguardian

gitguardian Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

joepio commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

GitGuardian fails here on incident 37585749, which is not from this PR. The flagged commits (4f6fe33, 49ac330, 1d80224) come from #1767 through the base branch. The hit is a false positive: a test fixture in lib/src/vault/secret_envelope.rs with zero-byte placeholder salts for a legacy password wrapper kind. It is explained on #1767. The finding can only be cleared by marking the incident as a false positive in GitGuardian, not by a push here.


Generated by Claude Code

Pins three things the commit row in Tree::Resources is relied on for: a genesis row keeps its signed loroUpdate and still verifies after latest retention drops its envelope, the row blob keeps loroUpdate and is indexed by subject, and a destroy replayed after a re-create is refused because its row is the only record left.
@joepio
joepio force-pushed the claude/project-thread-mes3rj-commit-tests branch from 7785c67 to 67880f8 Compare September 25, 2026 16:21
joepio added a commit that referenced this pull request Sep 25, 2026
…, #1779, #1780, #1784, #1782) (#1852)

Combined batch, green on Mancave in run on 01d080f (CI and Downstream).

Includes #1772, #1777, #1779, #1780, #1784 and #1782, and restores six
catalog strings from #1820 and #1787 that earlier batches dropped.

joepio commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

Landed on develop in 4a3a0bf via the combined batch #1852 (green on Mancave). Closing.


Generated by Claude Code

@joepio joepio closed this Sep 25, 2026
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