Skip to content

Add dynamic overlay lookup discovery and bounded host scheduling - #518

Open
sirdeggen wants to merge 21 commits into
mainfrom
codex/overlay-discovery-c04
Open

Add dynamic overlay lookup discovery and bounded host scheduling#518
sirdeggen wants to merge 21 commits into
mainfrom
codex/overlay-discovery-c04

Conversation

@sirdeggen

@sirdeggen sirdeggen commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Overlay reliability program

This change is one slice of Make Overlays Great Again.

Do not merge until the stacked TypeScript and Go overlay branches have been proven together locally. Isolated CI green is not integration acceptance. Keep this PR draft. No npm publication, live database migration, or Mongo/BASM default activation.

C05 (verified progressive API) is parked. C02 (ts-stack#517) and C04 (ts-stack#518) both edit LookupResolver.ts and must not merge independently.

Keep this pull request in draft until local validation is complete.

Program and scope

  • Tracker or issue: Overlay reliability plan package C04
  • Why this change is needed: Lookup discovery must keep accepting later tracker hosts during an active query, bound hanging peers and response bytes, and preserve 2s/5s delays plus reputation.
  • Explicitly out of scope: C05 verified progressive API (parked), cryptographic verification (C02), publication
  • Exact head SHA reviewed: e82b77eeabfaf78e1a5b60f3367e56dc00fa828b

Impact

  • Public package source or manifest changed; affected packages are listed below
  • Public API, exports, types, runtime targets, or browser/mobile behavior changed
  • Documentation or examples changed

Affected packages: @bsv/sdk

Verification

  • Local commands and results: overlay-tools Jest 12 suites / 260 passed plus BRC100 overlay transport; oxlint overlay-tools clean (implementer evidence)
  • Hosted CI run: not yet (draft)
  • All applicable checks are terminal and successful on the exact head

Security and dependencies

  • No dependency or lockfile change

Release and operations

  • No npm publication was performed from a workstation or from this PR

Notes for reviewers

Sibling C02/C03 PR also edits LookupResolver.ts. Merge conflict expected. C05 stays parked. query() still throws when a deadline admits no host; query$ remains an unverified transport aggregate.

…duling

Subscribe to SLAP tracker updates during an active query so later
advertised hosts can join a fair, concurrency-bounded queue. Read lookup
bodies incrementally with honest resource-limit accounting, keep
trackers as routing sources, and leave raw query$ unverified while
exposing the C02 onEvidence intake seam.

Preserves 2s/5s delays, reputation/backoff, query/query$/freeform APIs,
and existing CORS/public lookup request headers.
Store discovery bounds on the SLAP host cache so a tighter-limit query
cannot freeze a truncated host set for a later broader attempt. Throw
the historical no-competent-hosts error from query()/queryDetailed when
a deadline expires before any host is admitted; query$ still emits the
deadline snapshot.
LookupResolver is a BRC-100 JSON boundary file, so the in-flight
discovery key cannot use JSON.stringify. stringifyBRC100 preserves the
same service-plus-limit tuple without changing cache cover semantics.
Extract query/session and host-tracking helpers so cognitive complexity
stays within Sonar's limit, and clear the remaining overlay-tools
findings without changing lookup behavior.
S7746 on LookupResolver: prefer throw over return Promise.reject in the facilitator start chain.
Jest's istanbul graph still resolved 3.15.1, which fails pnpm audit --audit-level=high.
Health requires overrideRemovalReview.retainedCount to match the live registry.
LookupResolver and evidence helpers pushed the UMD/Vite/Metro payloads
over the previous raw-size gates.
Message-box UMD, wallet Vite gzip, and Hermes bytecode now cover the
evidence/discovery helper payload growth.
…ry-c04

# Conflicts:
#	packages/messaging/message-box-client/browser-budget.json
#	packages/sdk/browser-budget.json
@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.56886% with 63 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
packages/sdk/src/overlay-tools/LookupResolver.ts 85.51% 22 Missing and 41 partials ⚠️

📢 Thoughts on this report? Let us know!

@sirdeggen sirdeggen added the overlay-reliability Part of org overlay reliability program (project 19) label Sep 9, 2026
@sirdeggen

Copy link
Copy Markdown
Contributor Author

Linked to org project Make Overlays Great Again and tracker https://github.com/bsv-blockchain/make-overlays-great-again/issues/1.

This PR stays draft until the overlay stack is proven locally across ts-stack, go-overlay-services, and go-sdk. Do not merge to main/master to make progress.

@sonarqubecloud

Copy link
Copy Markdown

@sirdeggen
sirdeggen marked this pull request as ready for review September 10, 2026 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

overlay-reliability Part of org overlay reliability program (project 19)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant