Repository navigation
Refactor/ingest consolidation 225 - #255
Conversation
|
@CHKM001 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…stion (#250) Closes #218. One VenueAdapter contract covering discover, read, derive and write, with scheduling and error handling moved into the runner, and the existing adapters migrated onto it. Verified locally: tsc clean, 607 passing. Merging this first because two other PRs build on the same ground — #255 consolidates the ingest directories and will need a rebase onto this, and #256 defines a second interface of the same name.
|
This has gone conflicting — #250 landed a couple of hours ago and moved the ingest layer onto a single Worth knowing before you start, so the rebase is quick rather than a surprise: No rush and nothing wrong with the work — rebase on main and push, and I will pick it straight up. |
63f8227 to
19fdd4b
Compare
|
DONE! |
19fdd4b to
2e555b5
Compare
|
done |
7e82f7c to
c62295a
Compare
Move the remaining ingester modules out of the legacy `src/ingesters/`
directory and into the unified `src/ingest/` tree, and delete the old
re-export shims:
- `src/ingesters/snapshot.ts` → `src/ingest/snapshot.ts`
- `src/ingesters/toid.ts` → `src/ingest/toid.ts`
- remove `src/ingesters/{amm,sdex,soroswap}.ts` (shims)
Redirect every import, test and doc reference to the new paths; no
`src/ingesters/` reference remains. The consolidation itself is a pure
move/rename plus reference updates — behaviour is unchanged.
Also fold in the fixes needed to land green on the Typecheck & build job,
each a pre-existing defect inherited from the base branch:
- package-lock.json: add the missing `node_modules/@lukeed/ms` install
entry so `npm ci` succeeds (the committed lock was out of sync with
package.json — `npm ci` failed "Missing @lukeed/ms from lock file").
- openapi.yaml: define the `BadRequest` response component. `/rates` (400)
referenced `#/components/responses/BadRequest`, which was never defined,
so `npm run client:gen` failed to resolve the $ref. Regenerated
`openapi.json` and `clients/typescript/src/schema.d.ts` to match.
- auth.test.ts: reset the shared `webhookDeliveryFailure` prisma mocks in
`beforeEach` (clearAllMocks does not reset implementations, so a call
count leaked between admin tests under shuffled order).
- vitest.config.ts: set `hookTimeout` to match `testTimeout` (20s); suites
that build the whole app in `beforeAll` can exceed the 10s hook default
under parallel-fork contention.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
c62295a to
dcae56b
Compare
#225) The classic AMM, SDEX and Soroswap ingesters lived in `src/ingesters/` while every other venue sat behind the `VenueAdapter` interface in `src/ingest/venues/`, so there were two places to look for "how does a venue get ingested" and two shapes to keep in step. They are one now, and the old modules are reduced to the re-exports that keep existing imports working. One fix on top: `openapi.yaml` defined `components/responses/BadRequest` twice after the merge — the branch's own version and the one on `main`. Same duplicate-key failure #604 hit earlier today: `js-yaml` refuses the file outright, so `openapi.json` would not generate and the openapi, live-spec and README guards all failed together without any of them naming the cause. Kept `main`'s definition and removed the branch's. They differ: the branch's carries an optional `code` alongside `error`, `main`'s marks `error` required. That is a real question — an enumerated machine-readable `code` is what #437 is for — but it should be answered once, deliberately, for every error response, not arrive as the losing half of a merge. Nothing referenced the branch's version, so no `$ref` changes meaning. Regenerated `openapi.json`, the TypeScript client and the README tables. 138 test files / 1,666 tests pass; tsc clean. Claude-Session: https://claude.ai/code/session_01USgemLt4Rnz4SGB1Srf3GB
|
Merged as Having two homes for "how a venue gets ingested" — One fix on top: duplicate YAML keyAfter merging so The two definitions genuinely differ: # yours
description: Bad request — a parameter failed validation.
properties: { error: string, code: string }
# main's
description: Invalid request parameters
required: [error]
properties: { error: string }I kept If you want that Regenerated 138 test files / 1,666 tests pass; |
Resolve conflicts with main: - db.ts: take main's upsertPricePoints (observedAt/sourceTime and the Divinity-Labs#620 fix) and keep deriving the row id from the event identity - history/candles: keep main's cursor pagination alongside the gap declaration (gaps cover the full requested window) - openapi.yaml: restore incomplete/gaps on the candles response; regenerate openapi.json, README tables and the TypeScript client - package.json, schema.prisma, README: keep both sides - backfillService: follow toid's move to ../ingest/toid (Divinity-Labs#255) The idempotency test is unchanged. It still fails intermittently in a full run because SDEX trade points carry a wall-clock timestamp since Divinity-Labs#394, which is a bug in main rather than in this branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PR #225 Consolidate the two ingestion trees into
src/ingest/Problem
src/ingesters/andsrc/ingest/both existed and both held ingestion code — the classic SDEX / AMM / Soroswap / snapshot loops plus the TOID helper insrc/ingesters/, and the venue and oracle adapters insrc/ingest/. New contributors put new work in whichever directory they happened to open first, so the split persisted. There was no rule telling them which one was canonical.Solution
One ingestion location:
src/ingest/. The five classic files move into it, andsrc/ingesters/is removed. The venue/oracle sub-trees (src/ingest/venues/,src/ingest/oracles/,src/ingest/cex/) stay where they are, sosrc/ingest/now holds every adapter and every ingester loop under one root.This is a pure move. No source values, price strings, venue names, or behaviour change.
Changes
Moved (100% renames, no content change in the files' own imports):
src/ingesters/amm.ts→src/ingest/amm.tssrc/ingesters/sdex.ts→src/ingest/sdex.tssrc/ingesters/soroswap.ts→src/ingest/soroswap.tssrc/ingesters/snapshot.ts→src/ingest/snapshot.tssrc/ingesters/toid.ts→src/ingest/toid.tssrc/ingest/sits at the same depth assrc/ingesters/did, so each moved file keeps its existing relative imports (../config,../metrics,./toid) unchanged.Deleted:
src/ingesters/.Imports updated:
src/index.ts— the fourstart*Ingesterimports.src/__tests__/dualNetworkAlerts.test.ts,ammIngester.test.ts,sdexIngester.test.ts,snapshotIngester.test.ts,soroswapEnabled.test.ts,soroswapIngester.test.ts,toid.test.ts.tests/ingestMetrics.test.ts.Stale path references corrected:
src/db.ts— comment pointing atingesters/toid.ts.docs/ingest-metrics.md— thesdex.tslink and the adapter-location note.CONTRIBUTING.md— the directory tree now lists a singleingest/entry.Acceptance criteria
src/ingesters/is gone.npm testgreen, build clean.price_points.sourcevalues and every venue name are untouched).Tests
npm test(vitest) — 58 files / 627 tests pass, 1 pre-existing skip.npx tsc --noEmit— clean.npm run build(prisma generate + tsc) — clean.No test semantics changed; only import specifiers moved.
Notes for reviewers
src/index.ts's import block plus a comment insrc/db.ts; everything else is../ingesters/→../ingest/.Closes #225