Skip to content

feat(tooling): pure issue-drafting core + CLI to expand a loose prompt into a gate-ready draft - #8148

Merged
JSONbored merged 1 commit into
mainfrom
feat/issue-drafting-core
Jul 23, 2026
Merged

feat(tooling): pure issue-drafting core + CLI to expand a loose prompt into a gate-ready draft#8148
JSONbored merged 1 commit into
mainfrom
feat/issue-drafting-core

Conversation

@JSONbored

Copy link
Copy Markdown
Owner

Summary

  • Adds the pure, adapter-agnostic issue-drafting core (src/services/issue-drafting.ts) required by the issue's ⚠️ shape mandate: no process.argv, no fs, no IO — the searchable corpus is caller-supplied data, so a future ORB dashboard API route (a Worker with no filesystem) can be a second thin consumer of the identical entrypoint. Mirrors the signal-tracking.ts / signal-tracking-wire.ts pure-core/host-adapter split.
  • Grounding pipeline: tiered term extraction from the loose prompt (backticked exact > path > identifier > plain word, each tier consumed before the next scans so fragments never double-extract), case-insensitive corpus search with definition-lines-first / live-code-above-tests ranking, and word-tier terms restricted to files whose path contains them — plain vocabulary can never ground to random comment prose.
  • Draft assembly emits the heavy template (Context / Requirements / Deliverables / Test Coverage Requirements / Expected Outcome / Links & Resources) with real path:line citations, one Requirements bullet per anchor file (not per term), the > ⚠️ Required pattern callout, an explicit ⚠️ UNGROUNDED marker at the exact spot any specific term found no precedent, and <!-- MAINTAINER: ... --> markers on every section a human must fill — it never invents an unverified requirement.
  • scripts/draft-issue.ts is the first thin consumer: reads the prompt (--prompt / --prompt-file), walks the checkout for the corpus, writes the draft to a local file. Never publishes; labels/milestone/relationships stay maintainer decisions (the issue's hard boundary).

Closes #8103

Performance note (the issue's own acceptance bar)

Ran against one-line prompts approximating two real, recently-shipped sub-issues of #8082:

Honest limits: it grounds and cites; it does not decompose scope or write Deliverables — those stay explicit MAINTAINER markers. Word-tier matches can still surface plausible-but-tangential anchors (e.g. "verdict" → gate-verdict-calibration.ts); they're real files with definition lines, and the maintainer edit pass is the filter. A deliberate non-goal: no AI/model call anywhere — output is deterministic (same prompt + corpus ⇒ byte-identical draft, tested).

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 actionlint
  • npm run typecheck
  • npm run test:coverage locally; codecov/patch requires ≥99% coverage of the lines AND branches you changed (aim for 100% on your diff so CI variance does not fail near the threshold). Global coverage is a non-blocking trend with a loose 90% backstop, not the gate.
  • npm run test:workers
  • npm run build:mcp
  • npm run test:mcp-pack
  • npm run ui:openapi:check
  • npm run ui:lint
  • npm run ui:typecheck
  • npm run ui:build
  • 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 npm run test:ci ran green end-to-end (includes every box above). The core has 100% line AND branch coverage (24 tests, scoped v8 report: 58/58 branches). scripts/draft-issue.ts is thin IO glue (arg parsing, checkout walk, file write) under the established export-d1-data.ts exemption.

Safety

  • No secrets, wallet details, hotkeys, coldkeys, user PATs, private keys, raw trust scores, private rankings, or private maintainer evidence are exposed.
  • Public GitHub text stays sanitized, low-noise, and does not imply compensation guarantees or optimization tactics.
  • Auth, cookie, CORS, GitHub App, Cloudflare, or session changes include negative-path tests.
  • API/OpenAPI/MCP behavior is updated and tested where needed.
  • UI changes use live API data or real empty/error/loading states, not production mock/demo fallbacks.
  • Visible UI changes include a UI Evidence section below with JPG/JPEG or PNG screenshots arranged as organized, captioned, clickable thumbnails. SVG screenshots are not used as review evidence. Review-only screenshots or recordings are not committed to the repository.
  • Public docs/changelogs are updated where needed; changelogs are only edited for release-prep PRs.

The core is a pure string transformer over caller-supplied data — no network, no env, no model call, no publish path. The body-text-only boundary has its own test.

UI Evidence

Not applicable — no UI change.

Notes

…t into a gate-ready draft (#8103)

The gate only enforces what an issue explicitly says, so publishable issues
need exact file/function/pattern citations -- repeated, real maintainer work
today. The new pure core (src/services/issue-drafting.ts) extracts tiered
grounding terms from a loose prompt (backticked > path > identifier > word),
searches a caller-supplied corpus for real precedent (definition lines first,
live code above tests, word-tier restricted to path-named files so vocabulary
never grounds to random comment prose), and assembles the heavy-template draft
with per-anchor-file Requirements bullets, explicit UNGROUNDED markers wherever
no precedent exists, and MAINTAINER markers for every section a human must
fill -- never inventing an unverified requirement.

Adapter-agnostic per the issue's required shape: no argv/fs/IO in the core
(the corpus is data, so a future ORB dashboard API route -- a Worker with no
filesystem -- can be a second thin consumer unchanged). scripts/draft-issue.ts
is the first thin consumer: walks the checkout, calls the core, writes a local
file for the maintainer to edit and publish BY HAND. Never publishes; labels/
milestone/relationships stay maintainer decisions (#8103's hard boundary).

100% line+branch coverage on the core (24 tests), including determinism and
the body-text-only boundary.
@JSONbored JSONbored self-assigned this Jul 23, 2026
@superagent-security

Copy link
Copy Markdown
Contributor

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

@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.04%. Comparing base (b3cb3c9) to head (39344e0).
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8148   +/-   ##
=======================================
  Coverage   92.03%   92.04%           
=======================================
  Files         764      765    +1     
  Lines       77540    77634   +94     
  Branches    23436    23458   +22     
=======================================
+ Hits        71366    71460   +94     
  Misses       5062     5062           
  Partials     1112     1112           
Flag Coverage Δ
shard-1 56.72% <100.00%> (-0.92%) ⬇️
shard-2 56.98% <0.00%> (+6.07%) ⬆️
shard-3 48.72% <0.00%> (-5.73%) ⬇️

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

Files with missing lines Coverage Δ
src/services/issue-drafting.ts 100.00% <100.00%> (ø)

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 23, 2026
@loopover-orb

loopover-orb Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Important

🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪🟪

🔍 LoopOver is reviewing…

AI analysis is in progress. This comment will update when the review is complete.

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

@JSONbored
JSONbored merged commit 8b62071 into main Jul 23, 2026
14 checks passed
@JSONbored
JSONbored deleted the feat/issue-drafting-core branch July 23, 2026 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

tooling: maintainer CLI to expand a loose issue prompt into a gate-ready contributor issue

1 participant