Skip to content

test(redis): prove the relay keeps publishing after the cache loses its scripts - #1003

Merged
cameri merged 3 commits into
mainfrom
test/1002-script-cache-recovery
Oct 31, 2026
Merged

cameri merged 3 commits into
mainfrom
test/1002-script-cache-recovery

Conversation

@chappie-daemon

@chappie-daemon chappie-daemon commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Adds an integration scenario for #1002.

What #1002 actually was

The relay answered HTTP 200, accepted websocket upgrades, and never acknowledged another event after its Redis cache was restarted. The cause is that the relay issues EVALSHA, and Lua scripts live in the cache's memory, so every call after a restart answers NOSCRIPT.

The production failure was an old image, not missing code. The retry landed on 2026-10-21 in #920 (src/adapters/redis-adapter.ts, isNoScriptError + a scriptLoad retry). The relay that failed was built 2026-09-03 from revision 3006eee3, five minor releases behind latest (3.8.0, built 2026-10-24).

So what was missing is proof, not a fix: the unit test stubs evalSha, which cannot catch a retry that stops working through the workers — the path that actually broke — and nothing exercised a real script cache.

What this adds

test/integration/features/redis-script-cache/ — one scenario that publishes, runs SCRIPT FLUSH against the same Redis, and publishes twice more. SCRIPT FLUSH is the whole of a restart as far as the relay can tell, and it is deterministic: no container to restart, no reconnect to wait for.

The @script-cache hook configures a message rate limit on purpose. Both limiters return early when rateLimits is empty, so a scenario without one would pass whether or not the fallback existed — the guard that makes this test mean something.

Verification

run state of the adapter result
41221855127 retry present Integration Tests: success
41222446906 retry removed (probe commit) Integration Tests: failure, Unit Tests: failure
41222894268 retry restored Integration Tests: success

The middle row is the fail-before: the scenario goes red exactly when the fallback goes away, and green when it returns. The probe commit was dropped from the branch afterwards, so the diff here is the test and its changeset only.

cucumber-js --dry-run over the full feature set reports 123 scenarios with no undefined steps.

Refs #1002.

#1002 reported a relay that answered HTTP 200 and never acknowledged another
event once its cache restarted: Lua scripts live in Redis memory, so every
EVALSHA after the restart answered NOSCRIPT. The adapter retries with a fresh
scriptLoad now, but nothing proved it — the unit test stubs evalSha, and the
production failure was in the workers that call it.

The scenario flushes the script cache between two publishes with a message rate
limit configured, because both limiters return early on an empty list and a
scenario without one would pass whether or not the fallback existed.
@changeset-bot

changeset-bot Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 4086a82

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
nostream Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coveralls

coveralls commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 41224717814

Coverage increased (+0.006%) to 76.754%

Details

  • Coverage increased (+0.006%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 11759
Covered Lines: 9419
Line Coverage: 80.1%
Relevant Branches: 6162
Covered Branches: 4336
Branch Coverage: 70.37%
Branches in Coverage %: Yes
Coverage Strength: 781.36 hits per line

💛 - Coveralls

@chappie-daemon
chappie-daemon force-pushed the test/1002-script-cache-recovery branch from aded16f to 80b0a9e Compare October 31, 2026 17:11
@cameri
cameri marked this pull request as ready for review October 31, 2026 17:18
@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge; the settings leak is fixed and no new actionable issues were found.

Summary

Adds an integration scenario that publishes events before and after Redis forgets its Lua scripts.

  • Integration tests check that publishing continues after Redis clears its Lua scripts.

No new actionable issues were found in the latest change.

Reviews (2) · Last reviewed commit: "fix(test): restore settings after the sc..." · Reviewed by Greptile

The @script-cache hook rewrites SettingsStatic._settings so the message
limiter actually runs, but one worker serves every scenario in the process and
controllers read that object through createSettings() on each request. The
mutation therefore outlived its scenario, and every scenario after it ran with
a 100/min message limit, an empty ipWhitelist and the ewma strategy.

Save the previous object in the tagged Before and put it back in a tagged
After, which also runs when the scenario fails.
@cameri
cameri merged commit 7d5d73c into main Oct 31, 2026
16 checks passed
@cameri
cameri deleted the test/1002-script-cache-recovery branch October 31, 2026 17:43
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.

3 participants