You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(miner): wire the opt-in discovery-plane client into discover and attempt (#7220)
* feat(discovery-index): add the soft-claim coordination endpoint
Adds POST /v1/discovery-index/soft-claim as a second endpoint on the
discovery-index service (#7218), accepting the payload shape
discovery-soft-claim.ts's buildSoftClaimRequest already produces
client-side. Lets opted-in miner instances avoid starting duplicate
work on the same discovered opportunity: a claim is accepted if the
key is free, or reported already-held with its age (and its TTL
refreshed) if not; a release frees the key immediately.
Storage reuses the existing TtlCache (a third instance, since it
holds different data than the query-result/policy caches) rather
than a new mechanism. The shipped SoftClaimRequest wire type carries
no caller identity at all (buildSoftClaimRequest hardcodes note and
instanceId to null), so "refresh rather than double-count on repeat
calls" can only mean any repeat claim on a still-active key refreshes
it -- there is no identity on the wire to distinguish callers. The
parser never reads note/instanceId/any other field, so nothing
forbidden can leak into the stored record or response regardless of
what a caller sends.
Closes#7166
* feat(miner): wire the opt-in discovery-plane client into discover and attempt
Adds packages/loopover-miner/lib/discovery-index-client.js, gated fully
behind LOOPOVER_MINER_DISCOVERY_PLANE (default off, zero behavior
change when unset). Wires two integration points:
- discover-cli.js's runDiscover supplements the local fan-out with
hosted discovery-index results for the same scope, deduped against
local candidates (local always wins on a duplicate).
- attempt-cli.js submits a soft-claim right after the local
claim-ledger claim succeeds (before work begins), and a paired
release on every terminal outcome, using discovery-soft-claim.ts's
buildSoftClaimRequest directly against the claim-ledger's own
record shape -- no translation needed, the shapes already match by
design. The opt-in check happens at each attempt-cli.js call site,
not left to the client function's own internal check alone, so a
disabled plane costs zero calls and a test-injected override can't
bypass the gate.
A second, independent opt-in (LOOPOVER_MINER_DISCOVERY_TELEMETRY)
emits a low-cardinality anonymized operational event via the
package's own logger -- no hosted telemetry collector exists for the
discovery plane yet, so this is a structured local log line for now.
Regenerates env-reference.md/ams-env-reference.ts for the four new
env vars and updates DEPLOYMENT.md's discovery-plane section, which
was marked a placeholder pending this wiring.
Closes#7168
Copy file name to clipboardExpand all lines: packages/loopover-miner/DEPLOYMENT.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -207,4 +207,13 @@ and `LOOPOVER_MINER_CONFIG_DIR` are covered above under the fleet/state notes; t
207
207
208
208
## Optional hosted discovery plane (opt-in)
209
209
210
-
The Phase 6 **hosted discovery-index** is **off by default** — unlike Orb fleet export (`ORB_AIR_GAP` is the only opt-out). Operators who want cross-fleet metadata queries or soft-claim coordination must opt in explicitly. See [`docs/discovery-plane-operator-guide.md`](docs/discovery-plane-operator-guide.md) ([#4309](https://github.com/JSONbored/loopover/issues/4309), placeholder until [#4300](https://github.com/JSONbored/loopover/issues/4300) / [#4301](https://github.com/JSONbored/loopover/issues/4301) / [#4302](https://github.com/JSONbored/loopover/issues/4302) ship).
210
+
The Phase 6 **hosted discovery-index** is **off by default** — unlike Orb fleet export (`ORB_AIR_GAP` is the only opt-out). Operators who want cross-fleet metadata queries or soft-claim coordination must opt in explicitly, via `lib/discovery-index-client.js` ([#7168](https://github.com/JSONbored/loopover/issues/7168), wired against the hosted server from [#7164](https://github.com/JSONbored/loopover/issues/7164)/[#7166](https://github.com/JSONbored/loopover/issues/7166)):
211
+
212
+
| Variable | Read by | Purpose |
213
+
| --- | --- | --- |
214
+
|`LOOPOVER_MINER_DISCOVERY_PLANE`|`lib/discovery-index-client.js`| Master opt-in (truthy string, off by default). No hosted discovery-index traffic or telemetry unless set. |
215
+
|`LOOPOVER_MINER_DISCOVERY_INDEX_URL`|`lib/discovery-index-client.js`| Base URL of the hosted discovery-index service. Required for the plane to do anything once enabled. |
216
+
|`LOOPOVER_MINER_DISCOVERY_SHARED_SECRET`|`lib/discovery-index-client.js`| Optional bearer secret for the hosted endpoint, if it requires one. |
217
+
|`LOOPOVER_MINER_DISCOVERY_TELEMETRY`|`lib/discovery-index-client.js`| Second, independent opt-in for anonymized operational telemetry — can stay off while the plane itself is queried/claimed against. |
218
+
219
+
See [`docs/discovery-plane-operator-guide.md`](docs/discovery-plane-operator-guide.md) for the full invariant list (metadata-only, no compensation signals, credentials stay local).
0 commit comments