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(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
See `packages/loopover-engine/src/discovery-index-contract.ts` for the full request/response contract (`normalizeDiscoveryIndexRequest`/`normalizeDiscoveryIndexResponse`), which this service both consumes and emits through.
17
+
See `packages/loopover-engine/src/discovery-index-contract.ts` for the full query request/response contract (`normalizeDiscoveryIndexRequest`/`normalizeDiscoveryIndexResponse`), which this service both consumes and emits through, and `packages/loopover-engine/src/discovery-soft-claim.ts` for the soft-claim payload builder.
18
+
19
+
Soft-claim design note: the shipped client payload never carries caller identity (`buildSoftClaimRequest` hardcodes `note`/`instanceId` to `null`) — this endpoint only ever sees `repoFullName` + `issueNumber` + `action`. A repeat `claim` call on a still-active key is reported as `accepted: false` (with the existing claim's age) and refreshes its TTL, since there is no identity on the wire to distinguish "the same caller checking in" from "a different caller."
17
20
18
21
## Configuration
19
22
@@ -22,6 +25,7 @@ See `packages/loopover-engine/src/discovery-index-contract.ts` for the full requ
22
25
|`DISCOVERY_INDEX_SHARED_SECRET`| Bearer secret required to call `/v1/discovery-index/*`. Unset ⇒ the service fails closed (503). |
23
26
|`DISCOVERY_INDEX_GITHUB_TOKEN`| This service's own GitHub token, isolated from any other component's (REES, the main engine's installation tokens, etc.). Unset ⇒ `/ready` reports not-ready. |
24
27
|`DISCOVERY_INDEX_CACHE_TTL_MS`| TTL for cached query results, per unique `(repos, orgs, searchTerms)` scope. Default `300000` (5 minutes). |
28
+
|`DISCOVERY_INDEX_SOFT_CLAIM_TTL_MS`| TTL for a soft claim before it's reclaimable. Default `1800000` (30 minutes). |
0 commit comments