Skip to content

test(cache): property-based test suite for key construction and TTL (#308) - #434

Open
mayborn005 wants to merge 1 commit into
Adamantine-guild:mainfrom
mayborn005:feature/cache-property-tests
Open

test(cache): property-based test suite for key construction and TTL (#308)#434
mayborn005 wants to merge 1 commit into
Adamantine-guild:mainfrom
mayborn005:feature/cache-property-tests

Conversation

@mayborn005

Copy link
Copy Markdown
Contributor

Closes #308

Summary

Add a property-based test suite using fast-check (39 tests, ~5000 generated cases per property) covering cache-key construction consistency, TTL behaviour, and address normalization for the caching layer.

What is tested

  • Cache key uniqueness (per service): 7 tests, 500 cases each
  • Cross-service namespace isolation: 3 tests, 200 cases each
  • Address normalization consistency: 4 tests, 300 cases each
  • Delimiter-confusion prevention: 2 tests, 300-500 cases each
  • resolveAccessCacheTtl properties: 6 tests, 200 cases each
  • InMemoryCacheAdapter TTL behaviour: 6 tests, 100 cases each
  • Cache miss-hit cycle: 2 tests, 200 cases each
  • Deliberate collision-bug detection: 2 tests, 5000 cases each
  • Roles pagination isolation: 3 tests, 200 cases each

Acceptance criteria

  • The suite catches a deliberately introduced cache-key collision bug (naive concatenation without encoding)
  • The suite passes against the current, correct key-construction implementation across thousands of generated cases
  • Address-casing normalization is explicitly covered (mixed-case, whitespace, idempotency)

… and TTL (Adamantine-guild#308)

Add 39 property-based tests using fast-check covering:
- Cache key uniqueness across all service methods (access, membership, roles, guilds)
- Cross-service key namespace isolation
- Address normalization consistency (mixed-case, whitespace, idempotency)
- Delimiter-confusion prevention via encodeURIComponent
- resolveAccessCacheTtl properties (capping, defaults, idempotency)
- InMemoryCacheAdapter TTL behaviour (expiry, overwrite, independence)
- Cache miss → hit cycle properties
- Deliberate collision-bug detection (broken vs correct key builder)
- Roles pagination cache-key isolation
@Lakes41
Lakes41 enabled auto-merge July 29, 2026 11:50
@Lakes41

Lakes41 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

This PR cannot be merged automatically because one or more workflow checks failed.

Please review the failed checks, push a fix, and wait for the workflows to pass.

After the checks pass and there are no merge conflicts, the automation can review it again.

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.

Design a property-based test suite for cache key construction and TTL behavior

2 participants