fix: green the backend pipeline and re-arm CI enforcement - #398
Merged
Conversation
Repairs the fallout from merging the 25-PR backlog and restores the feature work that successive merges had silently dropped. Type errors: 98 -> 0. Tests: 1549/1549 across 87 suites. Build clean. Restored code that merges had deleted (no test or typecheck caught it, because the corresponding tests were reverted in the same merges): - indexer_metrics_collector: schema verification hooks (#340), the RPC health check with backoff retry (#334), and resetIndexerMetricsCollectorState - sqlite_vacuum_cleaner: the index accessors (#344) and the opening diagnostics boundary of a cleanup cycle - ledger_range_tracker: schema verification, including migration-gap detection - indexer_runner: IndexerRunnerFailureMonitor, plus its throttle wiring (#256) - poller: historical range import (#254), poll diagnostics (#270), and the dynamic poll interval - routes/jobs: the partial-release cache key and its cache-hit path (#116) Repaired merge damage: - db.ts: SCHEMA_MANAGER_INDEXES declared four times and insertHistoricalEventBatch three; kept the array form and the range-validating overload every caller uses - poller.ts referenced two architectures at once (a bare Server alongside rpcClient); settled on the retry client, exposing rpcServer so fetchEventsWithRetry applies its own policy instead of nesting retries - runMigrations is atomic across pending migrations and reports failures to the schema-manager monitor; bootstrap failures reached neither before - database_writer_pool: the queue's persisted-key cache now clears on reset. It described one database, so it survived a setDb swap and made the pool skip inserts for rows the new database had never seen. Also adds migration 8 with the event_type lookup indexes the topic filter needs - migration 3 indexed (contract_id, event_type), which cannot serve a bare event_type predicate. Three test expectations were stale rather than wrong, and were updated to assert the property instead of an incidental detail: index assertions that named one index before later migrations gave the planner a better one, and a migration list that hardcoded versions. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Repairs the fallout from merging the 25-PR backlog, and re-arms the CI gate that #397 temporarily lifted.
tsc --noEmitnpm testnpm run buildThe part worth reviewing carefully
Most of this is not "fix the type error" — it is restoring feature code that successive merges silently deleted. Nothing caught it, because each merge reverted the implementation and its tests together, so the suite stayed green about code that no longer existed.
Restored:
indexer_metrics_collector— schema verification hooks (Add migration verification hooks to indexer_metrics_collector #340), RPC health check with backoff retry (Build exponential backoff retry strategies on indexer_metrics_collector #334),resetIndexerMetricsCollectorStatesqlite_vacuum_cleaner— index accessors (Configure SQLite index structures for sqlite_vacuum_cleaner #344), opening diagnostics boundary of a cleanup cycleledger_range_tracker— schema verification incl. migration-gap detectionindexer_runner—IndexerRunnerFailureMonitorand its throttle wiring (Optimize poller throttling parameters in indexer_runner #256)poller— historical range import (Configure dynamic historical sync ranges in indexer_runner #254), poll diagnostics (Write polling diagnostics logs for rpc_poller_client #270), dynamic poll intervalroutes/jobs— partial-release cache key and its cache-hit path (Implement Node-Cache lookup values for POST /api/jobs/:contractId/milestones/:index/partial-release #116); the cache was being written and deleted but never readMerge damage repaired
db.tshadSCHEMA_MANAGER_INDEXESdeclared four times andinsertHistoricalEventBatchthree times. Kept the array form and the range-validating overload every caller actually uses.poller.tsreferenced two architectures at once — a bareServerandrpcClient. Settled on the retry client, exposingrpcServersofetchEventsWithRetryapplies its own policy rather than nesting retries 5×3.runMigrationsis now atomic across pending migrations and reports failures to the schema-manager monitor. Bootstrap failures previously reached neither — they threw straight past the monitor, leaving a half-migrated database.database_writer_pool— the queue's persisted-key cache now clears on reset. That cache describes one database, so it survived asetDbswap and made the pool skip inserts for rows the new database had never seen.New migration
Migration 8 adds the
event_typelookup indexes the topic filter needs. Migration 3 indexed(contract_id, event_type), which cannot serve a bareevent_typepredicate —event_typeis not the leading column.Test changes, and why they are not cheating
Three expectations were stale rather than wrong. Each now asserts the property the ticket cared about instead of an incidental detail:
[5, 6, 7]— now derived fromgetShippedMigrationVersions()One genuine conflict needed a design call: two suites demanded different things from the same poll. One asserts exactly one debug line per poll; the other greps for a stall-diagnostics line. Two separate lines cannot satisfy both, so a poll now emits one structured diagnostics record carrying both, with the first line bearing a stall window exempt from the throttle.
CI
continue-on-errorremoved from Type check, Test and Build — the workflow is byte-for-byte its original enforcing form again.🤖 Generated with Claude Code