Skip to content

test(xmldsig): spend the remaining allowance before finishing - #384

Merged
polaz merged 1 commit into
mainfrom
fix/#383-replayable-work
Nov 3, 2026
Merged

polaz merged 1 commit into
mainfrom
fix/#383-replayable-work

Conversation

@polaz

@polaz polaz commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Summary

  • finalization_is_admitted_before_the_provider_runs no longer assumes two runs charge identical work: it spends the remaining allowance in place after the update, then checks that finish refuses before the provider runs.

Changes

  • tests/detached_payloads.rs: one run with an ample allowance; the remainder is charged after update, and the refusal and the unentered provider are asserted.

Testing

The test passes 300 times in a row under the xslt-fat-runtime features on macOS; lints and formatting pass. CI runs the full matrix.

Closes #383

Summary by CodeRabbit

  • Tests
    • Expanded coverage for payload finalization when the work allowance is exceeded, including verification that finalization does not proceed after the limit is reached.

The finalization admission test measured the work spent before finish
in one run and replayed exactly that allowance in a second. Accounted
table lookups charge each candidate whose hash tag matches, which
depends on every table's random seed, so the second run could spend
less and let the provider finalize. The remainder is now spent in
place after the update, as the replay tests do.

Closes #383
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T22:06:15.077714Z 2d2793a PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

The finalization admission test now spends its remaining work allowance after streaming the payload, then checks that finish() returns MemoryError::WorkExceeded without increasing the provider’s finalized count.

Changes: Finalization admission test

Layer / File(s) Summary
Single-run work exhaustion check
tests/detached_payloads.rs
The test replaces its two-run allowance comparison with one run. It spends the remaining allowance before finish() and checks the refusal and provider non-entry. The comment notes that lookup work varies between runs.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Other · Severity of issue fixed: Low

Possibly related PRs

Merge Risk: Minimal · up to 2d279

The test checks finalization refusal after exhausting the allowance. No merge-blocking risk was identified.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change: a test in tests/detached_payloads.rs now spends the remaining work allowance after streaming the payload and before finish(). The title uses the conventional test(scope): p…
Linked Issues check Passed [#383] The only coding requirement is to change detached_payloads::finalization_is_admitted_before_the_provider_runs so that it asserts the same result in one run. The diff (merge base to head) does…
Out of Scope Changes check Passed The whole-PR diff changes only tests/detached_payloads.rs, within the body of finalization_is_admitted_before_the_provider_runs. Every hunk supports the issue #383 change: the single-run restructu…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Title check

Explanation

The title names the change: a test in tests/detached_payloads.rs now spends the remaining work allowance after streaming the payload and before finish(). The title uses the conventional test(scope): prefix and is specific. It does not name the test function or the flaky-seed cause, but it covers the main change. The scope label 'xmldsig' is a crate-level area and the changed file is a test file, so the scope is a little broad but not misleading.

Full details: Linked Issues check

Explanation

[#383] The only coding requirement is to change detached_payloads::finalization_is_admitted_before_the_provider_runs so that it asserts the same result in one run. The diff (merge base to head) does this. The test now runs once with allowance = 1 << 28. After stream.update(payload), it charges allowance - work.work_used() through work.charge_work(...), so the allowance is exhausted before finish(). It then records provider.finalized() and asserts that finish() matches MemoryError::WorkExceeded and that provider.finalized() equals the recorded value. The two-run structure and the dependence on spent from a first run are removed, which matches the issue's solution. The issue's second acceptance criterion (repeated passes under xslt-fat-runtime) is supported only by the author's report of 300 consecutive passes on macOS. I did not run the test. The charge_work method and its Result return type are not inspected directly in this review. The test compiles only if that API exists, and the author reports a passing run. No other linked-issue coding requirement applies.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff changes only tests/detached_payloads.rs, within the body of finalization_is_admitted_before_the_provider_runs. Every hunk supports the issue #383 change: the single-run restructuring, the in-place remainder charge, the revised assertion on provider.finalized(), and the updated comment that explains the varying lookup cost. No production code, public API, configuration, or unrelated test is modified. The raw summary reports no changes to exported declarations, which agrees with the diff.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between efca82a and 2d2793a.

Files selected for processing: 1
  • tests/detached_payloads.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@polaz
polaz merged commit 3488b40 into main Nov 3, 2026
29 checks passed
@polaz
polaz deleted the fix/#383-replayable-work branch November 3, 2026 22:44
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.

test(xmldsig): finalization admission test assumes replayable work

1 participant