Repository navigation
Raise the local Realtime event limit for end-to-end tests - #32
Merged
Merged
Conversation
Parallel journeys pass the local tenant's 100 Postgres change messages a second, and Realtime drops the rest, so live updates went missing at random. Co-authored-by: Ferrin <177692050+Ferrin-Y@users.noreply.github.com> Co-authored-by: noorelmosrati <182049385+noorelmosrati@users.noreply.github.com>
Co-authored-by: Ferrin <177692050+Ferrin-Y@users.noreply.github.com> Co-authored-by: noorelmosrati <182049385+noorelmosrati@users.noreply.github.com>
musa-kal
added a commit
that referenced
this pull request
Nov 14, 2026
…aywright) left alone: those failures come from main, not this change. CodeQL fixes: - js/polynomial-redos at packages/core/src/receipts/parse-receipt.ts:158, 361 and 373. Rule: every regex run over OCR text must take linear time. TRAILING_MARKS used `(\s+mark)+\s*$`, which slows down quadratically on long runs of spaces or many marks. A small `withoutTrailingMarks` loop now removes trailing mark words one at a time from the end; it gives the same result because tidied lines have one space between words. QTY_SUFFIX and JUNK_EDGES now use a `(?<!...)` lookbehind, so a trailing match can only start at the beginning of a run. The merchant edge-trim regex (line ~339) had the same slow trailing-run pattern but was not flagged; it got the same lookbehind. The other regexes in the file are already linear on tidied lines. Checked by hand: 100k-character inputs built to trigger the slow case now take 2 ms, and sample lines give the same output as before. - js/stack-trace-exposure (shared http.ts:8, reached from supabase/functions/receipts-sweep/index.ts). The function returned the raw error message to the caller. It now logs the error with console.error and returns `{error: 'sweep_failed'}`, which matches the other functions' constant error codes. The only caller is pg_net, which never reads the body. - js/xss-through-dom at scan-receipt.tsx:267 and 311 and zoomable-image.tsx:46. The blob: URL from URL.createObjectURL(picked) was stored in state and passed to <img src>. State now holds `original: File`, and the URL comes from useMemo, the same way attachments-field.tsx already does it (CodeQL does not flag that pattern). The existing effect revokes the URL. The manual revoke in the catch branch is gone because the effect now covers it. The screen still shows the original photo, not the shrunk upload. E2E (Playwright): plans.spec.ts and guest-links.spec.ts fail on their live-update steps (heatmap or guest count never updates). This PR does not touch plans, guests, realtime subscriptions or the publication. The same tests failed the same way on main before this PR: push runs 43538064876 and 43534909649, and PR runs 43535207016 (dependabot) and 43534909649. In this run, the Realtime log shows MessagePerSecondRateLimitReached at 03:36:00, 03:38:10 and 03:41:15. Those times line up with the 5,000-row import test in each browser project, which runs just before the failing tests, so the limit raised in #32 is still being hit. That is a CI/Realtime flake on main, not this change, so I left it alone. Verification: - core receipts tests: 85/85 passed - core test:coverage: 504 passed - web src/features/expenses: 201/201 passed - receipts-sweep node tests: 4/4 passed - prettier check passed; `pnpm verify --only=lint,typecheck` passed - CodeQL itself was not run locally because the CLI is not installed, so whether the alerts clear will only show on the next CI run
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since #29, live update journeys (plans, guest links, notes) fail at random in CI. The Realtime log from #31 shows why:
MessagePerSecondRateLimitReached: Too many postgres changes messages per second. The local tenant allows 100 a second and drops the rest, and parallel journeys go past that.The e2e job now raises the tenant to 1000 events and 500 joins a second and restarts Realtime before the tests. docs/testing.md says how to do the same locally. Production limits are untouched.