Skip to content

test: pin the claim term of the inline receipt check - #562

Merged
wchwawa merged 2 commits into
mainfrom
test/inline-receipt-claim-generation
Oct 23, 2026
Merged

wchwawa merged 2 commits into
mainfrom
test/inline-receipt-claim-generation

Conversation

@wchwawa

@wchwawa wchwawa commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

TLDR

A unit test now pins the generation term of the inline receipt check that #555
added, so dropping that term fails a test instead of passing silently. No
product code changes.

Problem

Relates to #551 and #555.

When an inline publication's request fails, records_inline_publication
accepts the stored receipt as a replay only if it records this publication,
including a generation that follows the request's claim: CreateOnly gives
1, and ReplaceOnly or Append { Some(..) } gives the expected generation
plus one. No test failed with the generation term removed. The #555 tests
reuse an id only with a different body or revision, which other terms already
refuse.

Consequences

A refactor could drop the term without any test noticing. The client would
then report a create-only receipt as the success of a replace that reused the
same id, revision, and body.

Example

Publish create-only, then reuse the same operation id, revision, and body with
ReplaceOnly { expected_generation: 1 }. The client must fail with an inline
RequestReplayMismatch and no abort, and the path must still hold generation
1 and the first body. With the term removed, the client instead returns
generation: 1, replayed: true as a success.

Solution

One test in the nokv-client artifact tests,
an_inline_identity_reused_with_another_claim_is_refused_without_a_stale_receipt.
It reuses ScriptedArtifactTransport, whose begin step refuses a stored
request with a different condition, as the engine does.

Gain

The claim term of the replay check is guarded by a test that fails without it.

Tradeoffs

None beyond one more unit test.

Validation

With Rust 1.99.1:

  • cargo fmt --all -- --check: clean.
  • cargo clippy -p nokv-client --all-targets -- -D warnings: passes.
  • cargo test -p nokv-client: 129 passed.
  • Mutation check, removing && generation_follows_claim from
    records_inline_publication: main with the mutant passes 128; this branch
    with the mutant passes 128 and fails 1, the new test; this branch passes 129.
  • Not run locally: workspace clippy and tests, which rust.yml runs, and the
    Workbench contract tests, since nothing Workbench-facing changes.

records_inline_publication accepts a stored receipt only when its
generation follows the request's claim. No test failed with that term
removed, because the reused-identity tests change the body or the
revision, which the other terms already refuse.

The new test publishes create-only, then reuses the operation id,
revision and body with ReplaceOnly { expected_generation: 1 }. The
stored receipt matches every other input, and its generation 1 does not
follow a replace of generation 1, so only the claim term refuses it. The
client keeps the server's RequestReplayMismatch, aborts nothing, and the
path keeps generation 1 and the first body. With the term removed, the
client returns the create-only receipt as a replayed success instead.

Signed-off-by: wchwawa <wch19961116@gmail.com>
@feichai0017 feichai0017 moved this to In Progress in NoKV Delivery Oct 21, 2026
@wchwawa wchwawa changed the title test(client): pin the claim term of the inline receipt check test: pin the claim term of the inline receipt check Oct 23, 2026
@wchwawa
wchwawa merged commit d23c6c7 into main Oct 23, 2026
10 checks passed
@wchwawa
wchwawa deleted the test/inline-receipt-claim-generation branch October 23, 2026 07:13
@github-project-automation github-project-automation Bot moved this from In Progress to Done in NoKV Delivery Oct 23, 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.

2 participants