Skip to content

Plan: Property-based tests for cache key canonicalization invariants (5.1.4a) - #458

Draft
leynos wants to merge 4 commits into
mainfrom
backend-5-1-4a-cache-key-canonicalization-property-tests
Draft

Plan: Property-based tests for cache key canonicalization invariants (5.1.4a)#458
leynos wants to merge 4 commits into
mainfrom
backend-5-1-4a-cache-key-canonicalization-property-tests

Conversation

@leynos

@leynos leynos commented Aug 16, 2026

Copy link
Copy Markdown
Owner

Summary

Draft ExecPlan for roadmap item 5.1.4a: property-based tests (proptest) for route cache key canonicalization invariants, discharging the TODO left in backend/src/domain/ports/cache_key.rs after 5.1.4 shipped.

Plan document: docs/execplans/backend-5-1-4a-cache-key-canonicalization-property-tests.md

The plan covers:

  • Eight properties: theme permutation invariance, coordinate grid-cell equivalence and divergence, normalization idempotence, key-format totality, order materiality for non-canonicalized arrays (two variants), and single-leaf divergence.
  • Two example tests: a -0.0 collapse case and a known-answer SHA-256 digest test (the only test that fails if the hash algorithm or pre-hash serialization is swapped).
  • Non-vacuity via a scoped cargo mutants --file gate (the repo already runs nightly mutation testing) plus two manual seeded faults cargo-mutants cannot generate.
  • Documented exclusions with evidence: object key-order invariance is vacuous in this build (serde_json without preserve_order is BTreeMap-backed), and coordinate generation is bounded to +/-1e6 to stay out of the genuinely non-idempotent extreme-float region.
  • A mechanical test-module split (cache_key/tests.rs + tests/properties.rs) following the apalis_route_queue precedent to respect the 400-line file limit.

The draft was reviewed pre-delivery by a six-lens design panel (structure, alternatives, cost, contracts, failure modes, maintainability); all panel conditions are folded in, including two findings that materially changed the design (the unpinned SHA-256 clause and the unbounded idempotence domain).

Per the ExecPlan discipline, implementation starts only after this plan is approved.

References

🤖 Generated with Claude Code

Summary by Sourcery

Documentation:

  • Introduce a detailed ExecPlan documenting the approach, constraints, verification strategy, and milestones for adding property-based tests to route cache key canonicalization invariants in the backend.

leynos and others added 4 commits August 16, 2026 05:43
…ests (5.1.4a)

Draft ExecPlan covering proptest invariants for RouteCacheKey
canonicalization: theme permutation invariance, coordinate rounding
equivalence/divergence, normalization idempotence, key format, and
documented exclusions (BTreeMap key-order vacuity, large-integer loss).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fold in the six-lens panel findings: add single-leaf divergence (V-8)
and known-answer digest (V-9) obligations; correct the
canonicalize_and_hash and from_f64-fallback claims; bound coordinate
generation to +/-1e6; replace five manual negative controls with a
scoped cargo-mutants gate; add AXM-4 (ryu injectivity); mechanize the
no-mutation-committed and pipefail guards; fix baseline counts and
property naming.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b938faa0-fe8a-46da-ae98-c90562a8228c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai

sourcery-ai Bot commented Aug 16, 2026

Copy link
Copy Markdown

Reviewer's Guide

ExecPlan document for roadmap item 5.1.4a, detailing how to add property-based tests (proptest) for route cache key canonicalization invariants in the backend, including test module splitting, specific properties to implement, verification/non-vacuity strategy, mutation testing gates, and related documentation updates.

File-Level Changes

Change Details Files
Introduce an ExecPlan document that specifies how to implement property-based tests for route cache key canonicalization invariants, including module split, test strategies, verification steps, and documentation updates.
  • Add a detailed planning document under docs/execplans describing the purpose, context, constraints, and risks of adding property-based tests for cache key canonicalization.
  • Define eight specific invariants to be tested using proptest (theme permutation invariance, coordinate grid-cell equivalence/divergence, normalization idempotence, key-format totality, non-canonicalized array order materiality, single-leaf divergence, negative-zero collapse, and known-answer digest).
  • Specify a mechanical split of the existing inline test module in cache_key.rs into cache_key/tests.rs and tests/properties.rs, following existing precedents and line-count constraints.
  • Lay out a verification plan using property tests, example tests, a statistics guard, scoped cargo-mutants runs, and manual negative controls to ensure non-vacuity of the properties.
  • Describe required updates to roadmap, architecture docs, and developers guide to reflect the new property-testing approach and roadmap item 5.1.4a.
  • Define stages, milestones, and concrete shell commands for implementing, validating, and accepting the changes without modifying production behaviour.
docs/execplans/backend-5-1-4a-cache-key-canonicalization-property-tests.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

codescene-access[bot]

This comment was marked as outdated.

@codescene-access codescene-access Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No quality gates enabled for this code.

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