feat(miner-plan): soft-claim local-write action-spec builder (#2315) - #2813
Conversation
…ed#2315) A miner can optionally make its claim visible to a fleet via a public "soft claim" comment to reduce duplicate work. This builds the SPEC only (never executes), following the src/mcp/local-write-tools.ts spec-builder-not-actuator boundary. - src/miner/soft-claim.ts: - buildSoftClaimCommentBody({ minerId, claimedAt, expiresAt? }): pure, deterministic Markdown body (miner id, claimed-at, optional expiry note). - buildSoftClaimSpec(input): composes the body and delegates to the EXISTING buildPostEligibilityCommentSpec — reusing its single-quote shell escaping rather than duplicating it, so output stays deterministic and injection-safe. Tests: with/without expiresAt, the delegated spec (action/boundary/command/body), and a single-quote-in-minerId shell-injection regression. 4/4 pass, typecheck clean.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2813 +/- ##
==========================================
+ Coverage 96.13% 96.16% +0.03%
==========================================
Files 248 249 +1
Lines 27572 27581 +9
Branches 10014 10015 +1
==========================================
+ Hits 26506 26524 +18
+ Misses 443 434 -9
Partials 623 623
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-03 19:54:40 UTC
⏸️ Suggested Action - Manual Review Review summary Nits — 4 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Closes #2315.
A miner that wants to make its claim visible to a fleet (an optional, public "soft claim" comment — "a miner is working on this") needs a spec builder, not an actuator. This follows the existing
src/mcp/local-write-tools.tspattern exactly: gittensory supplies the content of a shell-safe command; the miner's own harness runs it with its own GitHub credentials. This module builds the spec only and never executes anything, so it's contributor-safe under the sameLOCAL_WRITE_BOUNDARYreasoninglocal-write-tools.tsdocuments.Deliverables
src/miner/soft-claim.ts:buildSoftClaimCommentBody({ minerId, claimedAt, expiresAt? })— a pure, deterministic Markdown body (miner id, claimed-at timestamp, and an expiry note whenexpiresAtis given).buildSoftClaimSpec(input)— composes that body and delegates to the existingbuildPostEligibilityCommentSpec(src/mcp/local-write-tools.ts:54), reusing its single-quote shell-escaping (sq()) rather than duplicating command construction — so output stays deterministic and single-quote-shell-safe.LOCAL_WRITE_BOUNDARY(local-write-tools.ts:8) so the boundary language stays consistent.Placed in the app
src/(not the isolatedgittensory-enginepackage) precisely because it must reusebuildPostEligibilityCommentSpecfromsrc/mcp/.Validation
vitest(test/unit/soft-claim.test.ts) — 4/4 pass,tsc --noEmitclean:expiresAt;action/boundary/command/inputs.body);minerIdis POSIX-escaped ('\'') so the command stays one safe--bodyargument (asserted the quotes balance).Every line + both branches are exercised (100% of the new file), so
codecov/patchstays satisfied.