Skip to content

fix: resolve three CI test failures in listener#332

Open
MAN7A-afk wants to merge 5 commits into
Core-Foundry:mainfrom
MAN7A-afk:fix/ci-test-failures
Open

fix: resolve three CI test failures in listener#332
MAN7A-afk wants to merge 5 commits into
Core-Foundry:mainfrom
MAN7A-afk:fix/ci-test-failures

Conversation

@MAN7A-afk

Copy link
Copy Markdown
Contributor

Closes #247

Root causes

  1. schema.sql — duplicate column crash on fresh databases
    The next_retry_at column was defined in two places: inside CREATE TABLE IF NOT EXISTS scheduled_notifications (recently added) and as a bare ALTER TABLE ... ADD COLUMN next_retry_at further down the file. SQLite's db.exec() runs the entire schema as one script. On a fresh database, CREATE TABLE runs first creating the column, then ALTER TABLE immediately tries to add it again and throws SQLITE_ERROR: duplicate column name: next_retry_at — which is why every integration and E2E test that spun up a fresh DB was failing.

Fix: removed the ALTER TABLE statement. The column now lives only in the CREATE TABLE definition. Existing databases from before the column existed had the ALTER TABLE run successfully already and are unaffected.

2 & 3. notification-retry-queue.test.ts and notification-retry-queue-refactored.test.ts — non-deterministic delayMs assertion
Both test files had a test asserting delayMs: 2000 exactly — the expected value of baseDelayMs (1000) * 2^1. However NotificationRetryQueue defaults to jitter: true, which multiplies the delay by a random factor (0.5 + Math.random() * 0.5), making the actual logged delayMs non-deterministic. The assertion passed locally by chance but failed in CI under different timing.

Fix: added jitter: false to the queue options in both 'logs a warning with the next retry delay on failure' tests so the delay is the deterministic 2000 that the assertion expects.

Files changed
File Change
schema.sql
Moved next_retry_at into CREATE TABLE, removed bare ALTER TABLE
notification-retry-queue.test.ts
Added jitter: false to backoff test queue
notification-retry-queue-refactored.test.ts
Same fix in refactored test

1. schema.sql — next_retry_at column moved into CREATE TABLE definition
   The column was added via a bare ALTER TABLE statement that ran after
   CREATE TABLE IF NOT EXISTS. On a fresh database (as used in every CI
   test run) SQLite's exec() would fail with 'duplicate column name:
   next_retry_at' because the column already existed from the CREATE TABLE.
   Fix: add next_retry_at directly to the CREATE TABLE block and remove
   the ALTER TABLE statement.

2. notification-retry-queue.test.ts — add jitter: false to backoff test
   The 'logs a warning with the next retry delay on failure' test asserted
   delayMs: 2000 exactly, but NotificationRetryQueue defaults to jitter: true
   making the delay non-deterministic. Fix: pass jitter: false so the delay
   is the expected deterministic value (baseDelayMs * 2^attempt = 2000).

3. notification-retry-queue-refactored.test.ts — same fix as above
   The refactored version of the same test had the identical assertion and
   the same missing jitter: false option.
The lock file was missing transitive dependencies (ws, utf-8-validate)
that come from @stellar/stellar-sdk. npm ci requires a complete and
correct lock file - it was failing with 'Missing: utf-8-validate from
lock file'.

Fix:
- Delete the incomplete package-lock.json so npm install regenerates
  it from scratch on CI
- Switch the listener install step from npm ci to npm install so CI
  can complete without a pre-existing lock file
- Remove cache-dependency-path for the listener since there is no
  lock file to key the cache on

Once this PR merges, the regenerated lock file from a local npm install
should be committed to restore npm ci going forward.
…rors)

EventExplorerTable.tsx
- Remove duplicate export function EventExplorerTable declaration
- Make contractStatuses prop optional with default []

EventExplorerCard.tsx
- Remove duplicate export function EventExplorerCard declaration
- Remove duplicate Copy button element
- Make contractStatuses prop optional with default []

EventExplorerPage.tsx
- Remove duplicate import { fetchEvents } statement
- Remove duplicate loadEvents() call inside useEffect

wallet-integration.test.tsx
- Remove unused WALLET_ADDRESS_KEY constant (TS6133)
- Fix mock event shape: id -> eventId to match BlockchainEvent type
- Fix assertion: events[0].id -> events[0].eventId

eventStore.test.tsx
- Add missing EventFilters fields (status, dateFrom, dateTo) to all
  three setState calls to satisfy the full EventFilters type
- ActivityFeed.tsx: remove unused _nextAddress param from useWalletAccountSync callback
- EventExplorerPage.tsx: remove unused _nextAddress param from useWalletAccountSync callback
- eventStore.test.tsx: use BLANK_FILTERS constant in all three setState calls
  instead of repeating inline objects (fixes no-unused-vars)
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.

[Testing] Create End-to-End Notification Flow Tests

1 participant