Fix CI: resolve unmerged conflicts across the backend + fix a hidden route collision - #109
Open
prodbycorne wants to merge 1 commit into
Open
Fix CI: resolve unmerged conflicts across the backend + fix a hidden route collision#109prodbycorne wants to merge 1 commit into
prodbycorne wants to merge 1 commit into
Conversation
main was left in a broken state where several PRs' merge conflicts were concatenated instead of resolved, breaking every CI run: - package.json / package-lock.json had duplicate keys and a dropped closing brace, so `npm ci` failed with EJSONPARSE / EUSAGE. - src/index.js had three conflicting "how do we start/stop the server" implementations spliced together (duplicate `server` declarations, a syntax error), reconciled into one: the async startServer()/shutdown() design, with indexerPoller folded back in since it was dropped from that path by the bad merge but is still used elsewhere. - src/routes/airdrops.js had misplaced requires stuck mid-function, a duplicate router/upload/validateWithCurrentLedger, a dead broken validateAirdropCreate() left over from a since-superseded manual validator, and two POST routes each registered twice with different middleware (merged into one registration using every needed middleware). - src/services/priceOracle.js's SOURCES array had 6 entries instead of 3 (two competing circuit-breaker designs for the same 3 sources); merged into 3 entries carrying both the generic CircuitBreaker used for fetch-with-failover and the per-source getCircuitState used by the /health endpoint's price_source_circuits. - src/config.js had duplicate databaseUrl/stellar.* keys where a raw process.env fallback silently overrode the envalid-validated value. - Several test files (test/auth.test.js, test/alerts-routes.test.js, test/circuitBreaker.test.js, test/health.test.js, test/prices.test.js, test/airdrops.test.js) had the same pattern: duplicate mock methods, orphan fragments, or two whole test files concatenated together, fixed by keeping the version that matches current source behavior and removing dead duplicates. Also found and fixed a real, independent routing bug surfaced once the suite could finally run: src/routes/indexer.js registered `GET /airdrops/:id/recipients`, the exact same path as the airdrops CRUD API's paginated recipients endpoint. Since indexerRouter is mounted first, it silently shadowed the real endpoint in the full app — the paginated recipients list was unreachable in production. Renamed the indexer's route to `GET /airdrops/:id/onchain-recipients` (updated its test to match) since it serves indexed on-chain claim data, a different concern from the off-chain uploaded recipient list. npm ci, `npx @redocly/cli lint openapi.yaml`, and `npm test` (337 tests across 37 suites) all pass locally, matching CI's exact steps.
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.
Summary
main's CI has been failing on every run — several previously-merged PRs left their merge conflicts concatenated instead of resolved. This surfaced as a long chain of failures:package.json/package-lock.json: duplicate keys and a dropped closing brace →npm cifailed immediately (EJSONPARSE/EUSAGE).src/index.js: three conflicting "start/stop the server" implementations spliced together (duplicateserverdeclarations, a hard syntax error). Reconciled into the one asyncstartServer()/shutdown()design, foldingindexerPollerback into it — it's still used bysrc/routes/indexer.jsbut had been dropped from the lifecycle code by the bad merge.src/routes/airdrops.js: misplacedrequire()s stuck mid-function, a duplicate router/upload/validator, a dead brokenvalidateAirdropCreate()left over from a since-superseded manual validator, and twoPOSTroutes each registered twice with different middleware — merged into one registration per route using every needed middleware.src/services/priceOracle.js:SOURCEShad 6 entries instead of 3 — two competing circuit-breaker designs for the same 3 sources merged side by side instead of combined. Fixed to 3 entries carrying both the genericCircuitBreaker(used for fetch-with-failover) and the per-sourcegetCircuitState(used by/health'sprice_source_circuits).src/config.js: duplicatedatabaseUrl/stellar.*keys where a rawprocess.envfallback silently overrode theenvalid-validated value (JS object literals: last key wins).auth,alerts-routes,circuitBreaker,health,prices,airdrops): duplicate mock methods, orphan fragments, or two entire test files concatenated together — fixed by keeping whichever version matches current source behavior and removing the dead duplicate.A real bug found once the suite could finally run
src/routes/indexer.jsregisteredGET /airdrops/:id/recipients— the exact same path as the airdrops CRUD API's paginated recipients endpoint insrc/routes/airdrops.js. SinceindexerRouteris mounted beforeairdropsRouterinsrc/index.js, it silently shadowed the real endpoint: the paginated off-chain recipients list has never actually been reachable through the deployed app. Renamed the indexer's endpoint toGET /airdrops/:id/onchain-recipients(it serves indexed on-chain claim data, a different concern from the off-chain uploaded recipient list) and updated its test to match.Test plan
npm ci— succeeds (was failing withEJSONPARSE)npx @redocly/cli lint openapi.yaml— validnpm test— 337/337 passing across 37 suites (was 9 suites failing / 33 tests failing)These are the exact steps
.github/workflows/ci.yml'stestjob runs. (docker-buildjob not verifiable locally — no Docker available in this environment — but theDockerfileandpackage.json/lockfile it depends on are unchanged in shape beyond this fix.)