Skip to content

feat(queue): back per-PR transient locks with SubmissionLock DO (#8896) - #8924

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
andriypolanski:feat/8896-submission-lock-do
Jul 26, 2026
Merged

feat(queue): back per-PR transient locks with SubmissionLock DO (#8896)#8924
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
andriypolanski:feat/8896-submission-lock-do

Conversation

@andriypolanski

Copy link
Copy Markdown
Contributor

Summary

Scope

  • The PR title follows type(scope): short summary Conventional Commit format, for example fix(api): restore profile access checks.
  • This PR is focused and does not mix unrelated backend, UI, MCP, docs, dependency, and deploy changes.
  • This follows CONTRIBUTING.md and does not reintroduce GitHub Pages, VitePress, site/, or CNAME.
  • I linked a currently open issue this PR resolves (e.g. Closes #123) — a linked open issue is required for every contributor PR.

Validation

  • git diff --check
  • npm run cf-typegen (committed worker-configuration.d.ts)
  • npx vitest run test/unit/transient-locks.test.ts — 19 passed; CI-scoped simulation (npm run build:miner not required for src/**) with --changed=origin/main --coverage.all=false --coverage: 100% patch lines (44/44) and 100% patch branches (40/40) on changed src/queue/** hunks
  • npm run actionlint
  • npm run typecheck
  • npm run test:coverage
  • npm run test:workers
  • npm audit --audit-level=moderate
  • New or changed behavior has unit/integration tests for new branches, fallback paths, and sanitizer boundaries

If any required check was skipped, explain why:

Full test:ci left for the opener before push; targeted unit coverage above covers the DO, preference wiring, and cache fallback deliverables.

Notes for reviewers / gate

  • No secrets, wallets, hotkeys, trust scores, or reward values.
  • Does not touch site/, CNAME, **/lovable/**, or CHANGELOG.md.
  • Self-host: SUBMISSION_LOCK unset → byte-identical cache lock behavior.
  • Hosted: new DO migration tag v2-submission-lock (additive; RateLimiter v1-rate-limiter unchanged).

…bored#8896)

Prefer the SubmissionLock Durable Object when bound for strongly consistent
per-key mutexes; keep the cache-based path for self-host without DOs.

Co-authored-by: Cursor <cursoragent@cursor.com>
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 26, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.85%. Comparing base (8a3d2c9) to head (4b08e32).
⚠️ Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8924   +/-   ##
=======================================
  Coverage   93.84%   93.85%           
=======================================
  Files         803      804    +1     
  Lines       80084    80128   +44     
  Branches    24277    24293   +16     
=======================================
+ Hits        75157    75201   +44     
  Misses       3562     3562           
  Partials     1365     1365           
Flag Coverage Δ
backend 95.13% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/index.ts 96.26% <ø> (ø)
src/queue/processors.ts 95.71% <ø> (ø)
src/queue/submission-lock.ts 100.00% <100.00%> (ø)
src/queue/transient-locks.ts 100.00% <100.00%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. label Jul 26, 2026
@loopover-orb

loopover-orb Bot commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-26 13:56:05 UTC

11 files · 1 AI reviewer · no blockers · readiness 93/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
This PR replaces the previously-deferred TODO with a real SubmissionLock Durable Object: claimTransientLock/releaseTransientLockIfOwner now prefer the DO (per-key idFromName serialization via the DO input gate) and fall through to the existing cache mutex when SUBMISSION_LOCK is unbound, preserving the documented fail-open posture end-to-end. Wiring is complete across the surfaces that matter — wrangler.jsonc/wrangler.vitest.jsonc bindings + a contiguous v2-submission-lock migration tag, env.d.ts, src/index.ts export, the self-host DurableObject shim, worker-configuration.d.ts regen, and the env-reference generator's injected-binding allowlist. The DO's own claim/release logic (owner-token compare-and-delete, TTL expiry, same-token refresh) is correct and exercised by concurrent-claim, ownership-release, TTL, and malformed-body tests, plus explicit DO-transport-failure and cache-fallback tests for claimTransientLock/releaseTransientLockIfOwner.

Nits — 5 non-blocking
  • src/queue/transient-locks.ts:94/113 — the literal DO fetch URL host "submission-lock" is duplicated between claim and release; pull it into a shared constant.
  • src/queue/submission-lock.ts — the claim/release HTTP status codes (400/404) are unlabeled magic numbers; naming them would help future readers, though this is purely stylistic for a DO-internal contract.
  • src/queue/transient-locks.ts:releaseSubmissionLockIfBound ignores the DO fetch's response body/status entirely (even on success) — fine given the documented best-effort/TTL-backstop posture, but worth a one-line comment noting that's deliberate, not an oversight.
  • Consider extracting the submission-lock fetch base URL/path constants in src/queue/transient-locks.ts to avoid the string duplication flagged above.
  • If a later PR wants observability into DO release failures, log the caught error in releaseSubmissionLockIfBound instead of silently swallowing it, matching the pattern used elsewhere in this file.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #8896
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 199 registered-repo PR(s), 124 merged, 22 issue(s).
Contributor context ✅ Confirmed Gittensor contributor andriypolanski; Gittensor profile; 199 PR(s), 22 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: significant
Linked issue satisfaction

Addressed
The PR adds a SubmissionLock Durable Object with its own migration tag, wires claimTransientLock/releaseTransientLockIfOwner to prefer it while falling back to the cache mutex, and includes tests for concurrent DO claims (only one wins) and cache-fallback behavior for self-host installs.

Review context
  • Author: andriypolanski
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 199 PR(s), 22 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 469e8e6 into JSONbored:main Jul 26, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(queue): replace the best-effort transient-lock PR mutex with the documented SubmissionLock Durable Object

2 participants