Skip to content

Make Redis-backed assertions timing and order independent#104

Merged
flyingsquirrel0419 merged 1 commit into
flyingsquirrel0419:mainfrom
niksy:test/redis-test-semantics
Jul 16, 2026
Merged

Make Redis-backed assertions timing and order independent#104
flyingsquirrel0419 merged 1 commit into
flyingsquirrel0419:mainfrom
niksy:test/redis-test-semantics

Conversation

@niksy

@niksy niksy commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Description

Makes the Redis-backed test suites independent of timing and set-ordering assumptions. Uses vi.waitFor which resolves as soon as the assertion passes, so the suite should be both faster and deterministic.

This also prepares these suites to run unchanged against a real Redis server (pending different PR).

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing behavior to change)
  • Refactor (no functional change, code improvement)
  • Documentation update
  • Test coverage improvement

Testing

  • All existing tests pass (npm test)
  • New tests added for the changes
  • Lint passes (npm run lint)
  • Build succeeds (npm run build:all)

Checklist

  • My changes follow the existing code style (single quotes, no semicolons, 2-space indent)
  • I have updated documentation where applicable
  • I have updated CHANGELOG.md and package versions when the PR changes release scope
  • I have added tests that prove my fix/feature works
  • No type errors suppressed (as any, @ts-ignore, @ts-expect-error)

Summary by CodeRabbit

Summary by CodeRabbit

  • Tests
    • Improved asynchronous test synchronization by replacing fixed delays with proper waiting until expected handler invocations and logging occur.
    • Strengthened invalidation and message validation scenarios, including signed message acceptance/rejection and tampering behavior.
    • Made tag/prefix index assertions deterministic by sorting returned key collections before comparing.
    • Updated async assertions to use direct awaits while preserving existing behavioral coverage.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a8a91950-172b-4b6f-a13a-6573dc6f372f

📥 Commits

Reviewing files that changed from the base of the PR and between c95541b and 74bb773.

📒 Files selected for processing (2)
  • tests/invalidation/RedisInvalidationBus.test.ts
  • tests/invalidation/RedisTagIndex.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/invalidation/RedisTagIndex.test.ts

📝 Walkthrough

Walkthrough

The tests replace fixed delays with vi.waitFor synchronization in invalidation bus cases and sort asynchronous tag-index results before comparison. Covered behavior and public interfaces remain unchanged.

Changes

Test Reliability Updates

Layer / File(s) Summary
Invalidation bus asynchronous synchronization
tests/invalidation/RedisInvalidationBus.test.ts
Replaces timeout-based waits with vi.waitFor around handler, logger, error, subscription, validation, and signature assertions.
Tag index deterministic assertions
tests/invalidation/RedisTagIndex.test.ts
Uses direct awaited results and sorted key collections for deterministic comparisons across tag, prefix, pattern, and visitor tests.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main test-only change: removing timing and ordering assumptions from Redis-backed assertions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

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

@niksy niksy changed the title Make redis-backed assertions timing- and order-independent Make Redis-backed assertions timing and order independent Jul 11, 2026
@niksy
niksy force-pushed the test/redis-test-semantics branch from c95541b to 74bb773 Compare July 11, 2026 11:37
@flyingsquirrel0419
flyingsquirrel0419 merged commit 8c1b82a into flyingsquirrel0419:main Jul 16, 2026
4 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.

2 participants