Skip to content

sfqd-core: add refundable queued cancellation - #23

Merged
pzhin merged 2 commits into
mainfrom
codex/refund-cancelled-cost
Aug 30, 2026
Merged

pzhin merged 2 commits into
mainfrom
codex/refund-cancelled-cost

Conversation

@pzhin

@pzhin pzhin commented Aug 30, 2026

Copy link
Copy Markdown
Owner

Summary

  • add opt-in REFUND_CANCELLED_COST accounting while preserving CHARGE_RESERVED_COST as the default
  • reserve exact-rational capacity during enqueue so every accepted queued job remains cancellable
  • recompute only the affected same-flow queued suffix and preserve prior dispatch decisions
  • cover the contract with reference, differential, numeric-boundary, lifecycle, deterministic concurrency, and jcstress tests
  • benchmark cancellation under both accounting policies

Numeric contract

Refund-mode admission validates a common denominator and the maximum unreduced accumulated numerator for every affected queued chain. A prospective overflow returns NUMERIC_LIMIT as an atomic no-op.

The regression uses a publicly reachable 133-enqueue trace: an anchor preserves the busy period, the first target enqueue is accepted, the second is rejected without mutation, and the accepted target remains cancellable.

Verification

  • ./mvnw --batch-mode --no-transfer-progress clean verify
  • ./mvnw --batch-mode --no-transfer-progress -Pjcstress clean verify — 182/182 passed
  • ./mvnw --batch-mode --no-transfer-progress -Pbenchmarks clean verify — 25 workloads discovered, 90/90 idle-reset smoke cases passed

Short benchmark smoke checks validate wiring only; this PR makes no performance claim.

pzhin added 2 commits August 30, 2026 14:58
Allow callers to opt into returning reserved virtual cost when a queued job
is cancelled.

Move representability checks to admission so accepted queued work remains
unconditionally cancellable. Preserve the existing charged-cost policy as
the default and document the resulting fairness boundary.
Expose accounting policy as an explicit benchmark dimension for isolated
cancellation, cancel-and-replace cycles, and idle-reset workloads.

Keep the default policy for unrelated workloads and extend fixture smoke
coverage so every new cancellation variant is validated before measurement.
@pzhin
pzhin merged commit 47ca13d into main Aug 30, 2026
12 checks passed
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