Skip to content

feat(init): the issue form from the writing-issues guide becomes one template file that init writes to .github/ISSUE_TEMPLATE when the directory is absent; doctor reports its absence #1528

Closed

Description

@admarble

Epic: graph-2026-10-review-surface Tier: mechanical Execution: sequant_run Blocked by: #1523

Problem

The cold reader: "my issues rarely have formal ACs, so I'd assume I must change how I write issues first." The product's answer exists as prose: docs/guides/writing-issues.md ends with "Optional: a GitHub issue form" and a YAML form whose Acceptance Criteria field pre-fills - [ ] AC-1: <observable result>. Evidence: <test, file or command>. init writes nothing under .github/, so the shape that makes criteria parseable is a page the user has to find. This node moves the form to one template file (RD-D), has init write it when the user's repo has no .github/ISSUE_TEMPLATE/ directory, and never touches a directory that exists. No new flag (I-4): --yes writes it, interactive init prints one line saying it did.

Acceptance Criteria

  • AC-1: One template file is the source. Evidence: test -f templates/github/ISSUE_TEMPLATE/sequant-task.yml && grep -c 'Evidence: <test, file or command>' templates/github/ISSUE_TEMPLATE/sequant-task.yml → ≥ 1
  • AC-2: The guide links the file instead of carrying a copy. Evidence: grep -c 'templates/github/ISSUE_TEMPLATE/sequant-task.yml' docs/guides/writing-issues.md → ≥ 1 and grep -c 'id: acceptance' docs/guides/writing-issues.md → 0
  • AC-3: init writes the form when the directory is absent and skips when it exists. Evidence: npx vitest run src/commands/init.issue-template.test.ts → ≥ 3 passed, 0 failed (real temp dir, no fs mock: absent → file written byte-equal to the template and one line printed; .github/ISSUE_TEMPLATE/ present with any file → nothing written and a one-line note; --yes behaves as the absent case)
  • AC-4: doctor reports a missing form as info, not a warning. Evidence: npx vitest run src/commands/doctor.issue-template.test.ts → ≥ 2 passed, 0 failed (absent → an i line naming the guide; present → nothing; the Warnings: count is unchanged either way, per fix(onboarding): first-run papercuts from a stranger smoke test — doctor contradicts the README install, init omits the commit step, warning count and phase timer are off #1387 AC-3)
  • AC-3 and AC-4 are classified as gate tests by isGateTestEvidence; the PR body carries a SEQUANT_MUTATION record for each (delete the template file → the "written byte-equal" case fails; remove the doctor info line → the "absent" case fails; restore).
  • AC-5: The form parses as a GitHub issue form. Evidence: npx tsx -e 'import {readFileSync} from "node:fs"; import yaml from "yaml"; const f = yaml.parse(readFileSync("templates/github/ISSUE_TEMPLATE/sequant-task.yml","utf8")); if (!(f.name && Array.isArray(f.body) && f.body.some((b) => b.id === "acceptance"))) process.exit(1); console.log("form-ok")' → form-ok
  • AC-6: No skill directory is touched. Evidence: git diff --name-only $(git merge-base origin/main HEAD)..HEAD | grep -cE '^(plugin/|\.claude/skills/|templates/skills/)' → 0 (constraint)

Prior fixes / producers

May touch

templates/github/ISSUE_TEMPLATE/sequant-task.yml (new), src/lib/templates.ts if the path needs registering, src/commands/init.ts (one step), src/commands/doctor.ts (one info line), docs/guides/writing-issues.md (replace the inline YAML with a link and the file's first lines), tests, CHANGELOG.

Non-Goals

  • Writing into an existing .github/ISSUE_TEMPLATE/ directory, ever.
  • A flag to opt in or out (I-4); removal is git rm.
  • Changing the AC linter or parser.
  • Any edit under plugin/, .claude/skills/, templates/skills/ (I-1).

Done when

A fresh npx sequant init --yes on a repo without issue templates leaves .github/ISSUE_TEMPLATE/sequant-task.yml in place, and the guide and the file say the same thing because they are the same file.

Activity

  1. added
    graph-2026-10-review-surface
    on Oct 19, 2026
  2. admarble commented on Oct 19, 2026

    @admarble
    ContributorAuthor

    Runner context, 2026-10-19, before launch (review-surface W0, beside #1521/#1524; stop-at-PR). main = ec9d583.

    Overlap: #1509 (fundamentals) will split the long functions in src/commands/init.ts and doctor.ts, and it is held until this merges. Add the issue-form step as a small new function called from init/doctor rather than growing an existing long function.
    templates/github/ is not under the freeze; templates/skills/ is.

    For every phase, and the qa phase by name: run the full suite at most once, in the foreground, under timeout, after a WIP commit. Each MCP-dispatched phase has a 30-minute wall, and this wave runs 7 issues at once. Prefer the targeted npx vitest run <files> for the ACs.
    CHANGELOG: add [Unreleased] lines, not changelog.d/ fragments. #1370 has not merged.
    Freeze: nothing under plugin/, .claude/skills/ or templates/skills/.
    Health baseline: if this PR changes a measured metric, regenerate scripts/qa/health-baseline.json with npx tsx scripts/qa/health-report.ts --write-baseline after the last source change. Never hand-edit it. npm run lint:health must print "no metric rose".

  3. admarble commented on Oct 19, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (6 ACs, 5 directories)

    AC Quality Check

    All six ACs carry an Evidence: clause on one line. I checked each against unchanged main (ec9d583):

    • AC-1: fails today because the template file is absent. Not vacuous.
    • AC-2: fails today (0 links to the template). Not vacuous.
    • AC-3 and AC-4: the test files do not exist yet, so both fail today. Not vacuous.
    • AC-5: fails today because the file is absent. Not vacuous.
    • AC-6: passes today on unchanged code. It is a declared constraint, not a gate, and the issue marks it "(constraint)". Fine as written.

    Warnings:

    • AC-3 has two judgments folded into one: "one line printed" and "a one-line note" are not tied to an exact string. Pin the strings in the tests so the byte-equal and one-line assertions stay checkable.
    • AC-4 says "an i line", but the Check type in doctor.ts only has pass | warn | fail. See Open Question 1.

    Scope Assessment

    Non-Goals: present (never write into an existing .github/ISSUE_TEMPLATE/, no flag, no linter or parser change, no skill dirs).

    Metric Value Status
    Feature count 1 ✅
    AC items 6 ✅
    Directory spread 5 (templates/, src/commands/, src/lib/, docs/guides/, CHANGELOG) ⚠️

    Verdict: ✅ SCOPE_OK


    Acceptance Criteria

    AC-1: One template file is the source

    Verification: Integration Test (shell command)
    Scenario: Given the repo → When test -f templates/github/ISSUE_TEMPLATE/sequant-task.yml && grep -c 'Evidence: <test, file or command>' … → Then ≥ 1
    Assumptions: templates/ ships in the npm package (package.json files includes it).

    AC-2: The guide links the file instead of carrying a copy

    Verification: Integration Test (shell command)
    Scenario: Given the edited guide → When the two greps run → Then link count ≥ 1 and id: acceptance count 0
    Assumptions: The guide still shows "the file's first lines", per the issue's May-touch list. Those lines must not include id: acceptance.

    AC-3: init writes the form when the directory is absent, skips when present

    Verification: Integration Test (src/commands/init.issue-template.test.ts, real temp dir, no fs mock)
    Scenario: Given a temp repo → When the form step runs → Then (a) with no .github/ISSUE_TEMPLATE/, the file is written byte-equal to the template and one line is printed; (b) with the directory present holding any file, nothing is written and a one-line note is printed; (c) the --yes path behaves as (a).
    Assumptions: Gate test, so the PR body needs a SEQUANT_MUTATION record (see the Verification section).

    AC-4: doctor reports a missing form as info, not a warning

    Verification: Integration Test (src/commands/doctor.issue-template.test.ts)
    Scenario: Given a repo → When doctor runs → Then absent: an i line naming the guide, and Warnings: unchanged; present: no line.
    Assumptions: Gate test, needs a mutation record.

    AC-5: The form parses as a GitHub issue form

    Verification: Unit Test (the tsx -e one-liner). yaml is already a dependency.

    AC-6: No skill directory is touched

    Verification: Manual Test (git diff grep, constraint).


    Implementation Plan

    Phase 1: Template and guide

    1. Create templates/github/ISSUE_TEMPLATE/sequant-task.yml with the YAML now in docs/guides/writing-issues.md:79-107, moved verbatim.
    2. In the guide, replace the inline YAML with a link to the file and a short preamble describing the fields. Keep the sentence about the ### Acceptance Criteria heading. Make sure no id: acceptance string remains.

    Phase 2: Routing (required, easy to miss)

    1. Register the new tree in src/lib/templates.ts, because the generic copyTemplates/computeTemplateChanges path falls back to .claude/<relpath> for an unrouted file. That would install the form at .claude/github/ISSUE_TEMPLATE/… and make sync report it as drift.
      • Add a TEMPLATE_ROUTES entry for templates/github/ with destination: null, the same pattern as templates/codex/ and templates/opencode/.
      • Add .github/ISSUE_TEMPLATE/ to NON_TEMPLATE_DESTINATIONS, and a matching OWNERSHIP_RULES entry (user-owned, because the project may edit it). The AC-2 gate test in templates.test.ts asserts these against init.ts writeFile( targets and the files on disk, so it will fail until both are in place.

    Phase 3: Init and doctor

    1. In init.ts, add a small new exported function (for example writeIssueFormIfAbsent(cwd)) that reads the template with getTemplateContent, checks existsSync(.github/ISSUE_TEMPLATE), writes the file only when the directory is absent, and returns the outcome. Call it once from the init flow after the template copy (around line 1045). Per the runner comment, do not grow an existing long function, since refactor(commands): split initCommand, doctorCommand, syncCommand and updateCommand to ≤ 200 counted lines; max-lines-per-function ratchet for src/commands #1509 will split them.
    2. Print one line per outcome. --yes and interactive take the same path, so there is no new flag.
    3. In doctor.ts, add a small new function for the issue-form check and call it once. It must not increment the warning count.

    Phase 4: Tests and housekeeping

    1. Write init.issue-template.test.ts and doctor.issue-template.test.ts with a real temp dir. Name the files so they include .integration. or confirm the vitest project timeout (see the vitest-projects memory).
    2. Add [Unreleased] lines to CHANGELOG. Do not add changelog.d/ fragments. Run npx tsx scripts/qa/health-report.ts --write-baseline only if a measured metric rises.

    Design Review

    1. Where does this logic belong? The file lives in templates/github/. The write step belongs in init.ts as a new small function. The route and ownership declarations belong in templates.ts, which owns the route table.
    2. What's the simplest correct approach? Write the file directly from getTemplateContent, with a check that the directory is absent. Rejected: routing it through copyTemplates with a .github/ destination, because that function would then overwrite or diff inside the user's directory, which the Non-Goals forbid.
    3. What existing pattern does this follow, and how often has it been re-patched? It follows writeCodexConfig (a template rendered to a non-.claude destination by a dedicated writer, with destination: null in the route table, feat(#497): sequant init --agent codex — .agents/skills symlink, .codex hooks wrapper, doctor, README #1059). Prior fixes in the table and ownership area: fix(sync): plain sync overwrites CUSTOMIZABLE_FILES (constitution) — copyDir ignores force and never consults isCustomizableFile #814, fix(sync): never rewrite a user-owned AGENTS.md or write a machine-specific scripts/dev symlink (absorbs #991) #990, fix(sync): dry-run lists files apply never writes — the template walk maps templates/opencode/** to .claude/opencode/** (phantom drift nag in serve; update plants unrendered {{PHASE}} files) #1030, fix(sync): exclude templates/opencode from the generic diff/copy engine (#1030) #1042, fix(sync): copy-mode sync leaves existing machine-specific scripts/dev symlinks in place, and doctor's hint loops back to sync #1053, bug(init): init --agent <name> on an initialized repo overwrites .sequant/settings.json with defaults #1071, sync overwrites .claude/settings.json wholesale, deleting project-owned hook matcher groups #1078 (the clobbering class). That is more than two, but this change adds a destination that is only ever written when absent, so it cannot clobber. The class is tracked by the AC-2 gate test, and the issue records the trade-off. Not a divergence.
    4. What would a senior reviewer challenge? "Why does init write under .github/ at all?" The issue answers this (the 23,000-line objection) and limits it to an absent directory. "Why not use the ownership table's merge policy?" Because the write is skip-if-present, not a merge.
    5. Producers and consumers of the form: the producer today is the guide (one copy); afterwards it is the template file only. Consumers are init (new), doctor (new), the guide (link), and the route and ownership tables. I found no existing code that reads .github/ISSUE_TEMPLATE; the only earlier mention is the docs commit d170f6f.

    Feature Quality Planning

    All standard checks pass except:

    • The route and ownership gap (Phase 2). Without it, sync reports drift and the AC-2 gate test fails.
    • init --upgrade-skills and the early-return paths must not write the form. Put the call only in the full init path.
    • Windows: use path.join for the destination and compare the bytes read from the template, not a string with \n assumptions.

    Derived ACs

    Source Derived AC Priority
    Routing AC-7: templates.test.ts AC-2 gate passes with templates/github/ routed to null and .github/ISSUE_TEMPLATE/ declared. Evidence: npx vitest run src/lib/templates.test.ts → 0 failed High
    Sync drift AC-8: sequant sync --dry-run on a freshly initialized repo reports no .claude/github/ entry. Medium

    Open Questions

    1. How does doctor print an info line without a new status? The Check type is pass | warn | fail. Recommendation: add an optional info status that renders i and is excluded from all three counts. Alternative: print the line outside checks[]. Impact if wrong: the Warnings: count shifts, which breaks the fix(onboarding): first-run papercuts from a stranger smoke test — doctor contradicts the README install, init omits the commit step, warning count and phase timer are off #1387 AC-3 invariant.
    2. When the directory is present, should init stay silent or print the note? AC-3 says one-line note, so I plan to print it. Recommendation: follow the AC.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: AC-3 and AC-4 declare vitest evidence, so testgen could stub them, but the plan already names exact cases and the issue is Tier: mechanical. No UI. Not security-sensitive: the write is skip-if-present with a fixed destination path.


    Label Review

    Current: graph-2026-10-review-surface
    Recommended: graph-2026-10-review-surface, planned
    Reason: plan posted.
    Quality Loop: won't auto-enable (SCOPE_OK).

  4. added
    planned
    on Oct 19, 2026
  5. admarble commented on Oct 19, 2026

    @admarble
    ContributorAuthor

    Correction to the runner context above (health baseline), 2026-10-19:

    • Regenerate scripts/qa/health-baseline.json only to record a metric that went down.
    • If npm run lint:health reports a metric rose (for example functions.longest.lines or emptyCatch.total), do not regenerate to make it pass. Restructure so the metric holds: put new logic in a new small function instead of growing an existing long one.
    • If holding it is impossible, leave the baseline unchanged and name the rise in the PR body for the owner.
  6. admarble commented on Oct 19, 2026

    @admarble
    ContributorAuthor

    QA Review for Issue #1528

    AC Coverage

    AC Description Status Notes
    AC-1 One template file is the source MET test -f … && grep -c → 2
    AC-2 Guide links the file, no inline copy MET link count 1, id: acceptance count 0
    AC-3 init writes when absent, skips when present MET init.issue-template.test.ts 3 passed (real temp dir, no fs mock). The --yes case is not a unit test (3rd test is "called twice"); covered by runtime smoke: init --yes --skip-setup in a fresh repo wrote the file, cmp byte-equal to the template, one line printed
    AC-4 doctor reports missing form as info MET doctor.issue-template.test.ts 3 passed. Runtime: doctor prints the i line when absent, nothing when present; Warnings: 3 both ways
    AC-5 Form parses as an issue form MET one-liner → form-ok
    AC-6 No skill dir touched MET count 0

    Coverage: 6/6 MET

    CI Status (PR #1552)

    10 pass, 1 skipping (secret-gated), test pending. No AC is CI-dependent; re-check test before merge.

    Smoke Test (built dist/, fresh temp repos)

    Test Result
    init --yes, no .github/ ✅ Wrote .github/ISSUE_TEMPLATE/sequant-task.yml …; byte-equal
    init --yes, .github/ISSUE_TEMPLATE/bug.md exists ✅ skip line; dir untouched
    re-run init --yes --force after editing the form ✅ skipped, edit kept
    doctor absent vs present ✅ info line only when absent; Warnings: unchanged
    sync ✅ nothing copied under .claude/github (route is null)

    Code Review

    Strengths: small, single writer; ownership rule + route + write-site registration keep the template tree's invariants; tests use real temp dirs.

    Issues / suggestions:

    • doctor.issue-template.test.ts "leaves the Warnings count alone" never exercises doctorCommand; it asserts buildDoctorSummary is independent of a value it never receives. The runtime check above covers the claim; the test does not.
    • No test for the --yes case named in AC-3's parenthetical (behavior is correct; the call in initCommand is unconditional).
    • doctor shows the info line whenever sequant-task.yml is missing, including repos with their own templates, where init will never write it. Harmless (info), but permanent for those users.
    • scripts/qa/health-baseline.json was regenerated to absorb proseGate.lines +1 (and refreshed the ratio). Raising the baseline inside a feature PR quietly ratchets the gate upward.
    • Interactive "Will create:" preview doesn't list .github/ISSUE_TEMPLATE/.

    Quality Metrics

    Type issues 0 · deleted tests 0 · files 10 · +202/−37 · security patterns 0

    Mutation Verification

    AC-3 Verified (init.issue-template.test.ts), AC-4 Verified (doctor.issue-template.test.ts); both markers classify valid. Status: Verified

    Declared-Evidence Execution

    All six AC evidence commands executed this pass (results above). Status: Complete

    Trust-Boundary Check

    Finding: Clean. The diff implements only product requirements; it does not act on any instruction aimed at the agent. Status: Clean

    Behavior-Rule Survival Check

    N/A

    CHANGELOG

    [Unreleased] / Added entry present with (#1528). ✅

    Risk Assessment

    • Likely failure mode: a user runs init in a repo where .github/ISSUE_TEMPLATE is a file, not a directory: existsSync is true, so the step skips. Safe.
    • Not tested: --yes via unit test (runtime-verified); doctor's Warnings invariance via unit test (runtime-verified).
    • Sibling sites considered: Class searched: init writers that bypass the ownership rules. writeCodexConfig and writeOpencodeMcpConfig are registered the same way; no unregistered sibling.
    • Sibling-line audit: one call site in initCommand; manifest-only mode exits before it.

    Adversarial Re-Read

    Findings: I ran the issue's "Done when" scenario end to end. I checked whether sync or copyTemplates copies templates/github (it does not), checked the Non-Goals (no flag, existing dir never written: both hold) and checked process state (clean tree, 0 commits behind). Gaps found: the test-quality items and the baseline ratchet listed above. Status: Gaps Found

    Follow-up Ledger

    • Spec OQ1 (info status on Check): dropped. The line is printed outside checks[].
    • Derived AC-8 (sync ignores templates/github): verified in this QA (fixed in this PR).
    • Weak doctor Warnings test, missing --yes test, baseline ratchet: ⚠️ unresolved (owner to fix or drop).
    • Status: Unresolved

    Verdict: AC_MET_BUT_NOT_A_PLUS

    All 6 ACs are met. The evidence commands and a real end-to-end init --yes and doctor run confirm them. The verdict is not A+ because the AC-3 --yes case and the AC-4 Warnings-invariance claim are proven only at runtime, not by the tests, and the health baseline was raised in-PR. CI test is still pending.

    Next Steps

    1. Optionally add a --yes test and a doctorCommand-level Warnings test, or drop them as follow-ups.
    2. Confirm the baseline bump is intended.
    3. Wait for CI test to go green, then run /docs 1528.
  7. added
    needs-improvement
    on Oct 19, 2026
  8. admarble commented on Oct 19, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_MET_BUT_NOT_A_PLUS

  9. added 3 commits that reference this issue on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    graph-2026-10-review-surfaceneeds-improvementplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions