Skip to content

Build out functionality for #586, #587, #588, #589 (premises did not match current code) - #660

Open
Young850 wants to merge 1 commit into
Refract-Protocol:mainfrom
Young850:feat/issues-586-587-588-589-build
Open

Young850 wants to merge 1 commit into
Refract-Protocol:mainfrom
Young850:feat/issues-586-587-588-589-build

Conversation

@Young850

Copy link
Copy Markdown

#589: reevaluation-planner.ts and reevaluation.service.ts turned out to have no DB-backed "load all open claims then slice" bug at all — the reevaluation pipeline's claim source is an in-memory AdjudicationLedger Map, not a SQL query, and claim.repository.ts had no "open claims" query of any kind. Rather than force an edit onto files that don't have this problem, added the capability the issue actually asks for as new functionality: a findOpenClaimsBatch(limit) method on ClaimRepository that selects open (non-settled) claims directly in SQL, oldest-first by trigger_detected_at, with the LIMIT applied in the query so no caller ever has to materialize the full open-claims set just to take a bounded slice. This is scoped narrower than literally rewiring the reevaluation pipeline, since that pipeline's real data model doesn't match the issue's premise; it gives any current or future caller a genuinely bounded, deterministic alternative to a full scan.

#588: loadOracleConfig() was already only called from one-shot places (startup validator, a module factory that runs once per boot, a one-shot CLI script) — not a per-request hot path, so there was no repeated-disk-read problem to fix. Built the caching mechanism anyway so the issue's literal deliverable exists for any future hot-path caller: a new getOracleConfig() in oracle-feed-config.ts that reads and parses once per process and caches the result, plus a test-only resetOracleConfigCache(). Deliberately did NOT rewire any existing call site to use it: oracle-admin.controller.spec.ts creates OracleAdminModule twice in the same file with different ORACLE_FEEDS_JSON values between them, relying on loadOracleConfig() being read fresh each time, so swapping that call site to the cached getter would have broken a currently-passing test for a hot-path problem that doesn't exist here. loadOracleConfig() itself and its existing callers are untouched.

#587: there was no startup banner anywhere in src/ for sandbox mode, even though CONTRIBUTING.md already documents one ("the app prints a prominent startup banner so it is never mistaken for a real environment") — the docs described behavior the code never implemented. Added it for real in src/main.ts: when isSandboxMode() (reused from src/config/configuration.ts) is true, a short banner describing what sandbox mode actually does here (oracle bootstrap skips the Postgres pool, uses in-memory stores) is written to process.stderr, never stdout, so a CLI script's JSON output on stdout is never contaminated, while the banner still shows up for a human running npm run dev.

#586: CONTRIBUTING.md didn't actually say npm test anywhere, and package.json's test script is real and working (test:unit then test:contracts`), so the issue's literal premise (a stale command pointing at a script that no longer exists) didn't hold. Tightened the vague "Run the test suite before opening a pull request" line to name the actual command and its narrower sub-scripts, removing the ambiguity the issue is fundamentally concerned about.

Closes #586
Closes #587
Closes #588
Closes #589

Summary

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs
  • Tests / CI

Checklist

  • I read CONTRIBUTING.md
  • Tests added/updated for the change
  • Local gate passes (lint / typecheck or fmt + clippy + test / build)
  • No secrets, keys, or .env values committed
  • Behavioural changes are documented in the README where relevant

Notes for reviewers

Refract-Protocol#588, Refract-Protocol#589 (premises did not match current code)

Refract-Protocol#589: reevaluation-planner.ts and reevaluation.service.ts turned out to have
no DB-backed "load all open claims then slice" bug at all — the reevaluation
pipeline's claim source is an in-memory AdjudicationLedger Map, not a SQL
query, and claim.repository.ts had no "open claims" query of any kind.
Rather than force an edit onto files that don't have this problem, added the
capability the issue actually asks for as new functionality: a
findOpenClaimsBatch(limit) method on ClaimRepository that selects open
(non-settled) claims directly in SQL, oldest-first by trigger_detected_at,
with the LIMIT applied in the query so no caller ever has to materialize the
full open-claims set just to take a bounded slice. This is scoped narrower
than literally rewiring the reevaluation pipeline, since that pipeline's
real data model doesn't match the issue's premise; it gives any current or
future caller a genuinely bounded, deterministic alternative to a full scan.

Refract-Protocol#588: loadOracleConfig() was already only called from one-shot places
(startup validator, a module factory that runs once per boot, a one-shot
CLI script) — not a per-request hot path, so there was no repeated-disk-read
problem to fix. Built the caching mechanism anyway so the issue's literal
deliverable exists for any future hot-path caller: a new getOracleConfig()
in oracle-feed-config.ts that reads and parses once per process and caches
the result, plus a test-only resetOracleConfigCache(). Deliberately did NOT
rewire any existing call site to use it: oracle-admin.controller.spec.ts
creates OracleAdminModule twice in the same file with different
ORACLE_FEEDS_JSON values between them, relying on loadOracleConfig() being
read fresh each time, so swapping that call site to the cached getter would
have broken a currently-passing test for a hot-path problem that doesn't
exist here. loadOracleConfig() itself and its existing callers are
untouched.

Refract-Protocol#587: there was no startup banner anywhere in src/ for sandbox mode, even
though CONTRIBUTING.md already documents one ("the app prints a prominent
startup banner so it is never mistaken for a real environment") — the docs
described behavior the code never implemented. Added it for real in
src/main.ts: when isSandboxMode() (reused from src/config/configuration.ts)
is true, a short banner describing what sandbox mode actually does here
(oracle bootstrap skips the Postgres pool, uses in-memory stores) is written
to process.stderr, never stdout, so a CLI script's JSON output on stdout is
never contaminated, while the banner still shows up for a human running
`npm run dev`.

Refract-Protocol#586: CONTRIBUTING.md didn't actually say `npm test` anywhere, and
package.json's `test` script is real and working (`test:unit` then
test:contracts`), so the issue's literal premise (a stale command pointing
at a script that no longer exists) didn't hold. Tightened the vague "Run the
test suite before opening a pull request" line to name the actual command
and its narrower sub-scripts, removing the ambiguity the issue is
fundamentally concerned about.

Closes Refract-Protocol#586
Closes Refract-Protocol#587
Closes Refract-Protocol#588
Closes Refract-Protocol#589
@drips-wave

drips-wave Bot commented Nov 24, 2026

Copy link
Copy Markdown

@Young850 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! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant