Skip to content

fix: resolve four Stellar Wave issues (#1211, #1187, #1185, #1195)#1293

Open
goldandrew wants to merge 1 commit into
LabsCrypt:mainfrom
goldandrew:any-issues-stellar-fixes
Open

fix: resolve four Stellar Wave issues (#1211, #1187, #1185, #1195)#1293
goldandrew wants to merge 1 commit into
LabsCrypt:mainfrom
goldandrew:any-issues-stellar-fixes

Conversation

@goldandrew

@goldandrew goldandrew commented Jun 29, 2026

Copy link
Copy Markdown

Summary

#1211 - [Docs] ENVIRONMENT.md lists invalid STELLAR_NETWORK values

Changed documented values from (testnet, pubnet, sandbox) to (testnet, mainnet) to match parseNetwork() in backend/src/config/stellar.ts.

#1187 - [Backend] indexer_state rename + NOT NULL contract column drift breaks eventIndexer at runtime

Updated eventIndexer.ts queries to use last_ledger (renamed from last_indexed_ledger) and provide contract value for the NOT NULL column:

  • getLastIndexedLedger(): SELECT/INSERT use last_ledger + contract parameter
  • updateLastIndexedLedger(): UPDATE/INSERT use last_ledger + contract filter
  • Added getContractId() helper to derive contract identifier from tracked contract IDs

#1185 - [Testing] jwtAuth.ts RBAC/scope middleware has no unit tests

Added comprehensive unit tests covering:

  • requireScopes: admin:all bypass, missing scope (403), unauthenticated (401)
  • requireJwtAuth cookie path: valid cookie, malformed/empty cookie, wrong cookie name, URL-encoded values, token revocation check
  • requireWalletParamMatchesJwt: mismatched param (403), unauthenticated (401), missing param (400)

#1195 - [Testing] No migration up/down or schema integration test

Added migration.test.ts that:

  • Runs all migrations up → down → up without errors
  • Verifies key tables exist (scores, indexer_state, loan_disputes, notifications, loan_events)
  • Runs smoke queries against scores and indexer_state (including last_ledger/contract columns)
  • Uses same conditional DB pattern (describeIf) as existing database.test.ts

Testing

All related test suites pass:

  • jwtAuth: 16/16 ✓
  • eventIndexer: 16/16 ✓
  • stellarConfig: 4/4 ✓
  • migration: skipped without DB (conditional)

Pre-existing failures (9 test suites) are unrelated to this PR (missing DB, environment config issues).

Closes #1211
Closes #1187
Closes #1185
Closes #1195

LabsCrypt#1211 - docs: fix STELLAR_NETWORK documented values (pubnet/sandbox -> mainnet)
LabsCrypt#1187 - fix: reconcile eventIndexer queries with indexer_state migration (last_ledger + contract)
LabsCrypt#1185 - test: add unit tests for jwtAuth RBAC/scope middleware (requireScopes, requireJwtAuth cookie path, requireWalletParamMatchesJwt)
LabsCrypt#1195 - test: add migration up/down schema integration test with smoke queries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment