Skip to content

feat(diff-scope): template UI in .ts/.js counts as frontend; receipt records the static design pass (GST-1718) - #4112

Merged
capy-ai[bot] merged 7 commits into
mainfrom
gst-1718-template-ui-scope
Nov 7, 2026
Merged

capy-ai[bot] merged 7 commits into
mainfrom
gst-1718-template-ui-scope

Conversation

@garrytan

@garrytan garrytan commented Nov 7, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 4112,
  "head": "39d9b29ec99eaa0f83ea06e42fa80b87ffee363c",
  "version": "1.97.0.0",
  "base": "main",
  "gate": {
    "free": {
      "pass": 1625,
      "fail": 0,
      "skip": 0
    }
  },
  "ci_carried": [
    {
      "lane": "free",
      "run": 42346658093,
      "attempt": 1,
      "tree": "7095e67eb79584b7350aad9d2bc92aea380de786"
    }
  ],
  "session_kind": "unattended",
  "head_tree": "7095e67eb79584b7350aad9d2bc92aea380de786",
  "product_patch_id": "54576772456d2ceb2fab01edaace21a48a50041d",
  "gstack_version": "1.97.0.0",
  "review_depth": {
    "depth": "full",
    "class": "gate",
    "runtime_lines": 126,
    "rules": "70895942bb8a8ee2",
    "base": "3742ee9527615b0fa325402d6c02498cc7fc19fa",
    "registry": "3742ee9527615b0fa325402d6c02498cc7fc19fa",
    "gate_scan": {
      "tagged": 0,
      "head": "39d9b29ec99eaa0f83ea06e42fa80b87ffee363c"
    },
    "reasons": [
      "gate-class",
      "runtime=126"
    ],
    "risk": [],
    "mode": "panel"
  },
  "pregate": "requires-remote cleared @7095e67eb795 (8 checks, current for 39d9b29ec99e)",
  "requires_remote": [
    "free-tests.yml/macos-named-regressions: https://github.com/garrytan/gstack/actions/runs/42346658093/attempts/1",
    "windows-smoke.yml/windows-smoke: https://github.com/garrytan/gstack/actions/runs/42345972984/attempts/1",
    "pregate.json/remote_gate: remote-gate tree=7095e67eb795 tests=36154 skipped=111 runs=42346658093/1 profiles=ci-reuse/free-tests heads=39d9b29ec99e verified=2026-11-07T06:31:11.964Z"
  ],
  "issues": {
    "fixes": [],
    "refs": [],
    "flakes": []
  },
  "docs": {
    "status": "current",
    "scope": "docs/, README.md, CLAUDE.md, AGENTS.md and the branch's ship templates and changelog.d fragment (diff 3742ee9..39d9b29)"
  },
  "review_loop": {
    "passes": 2,
    "blocking_found": 4,
    "deferred": 0,
    "noted": 8,
    "fixed": 5,
    "scope": "frozen",
    "fix_checks": 2,
    "rounds": 4,
    "ledgers_read": 7,
    "unbound": 1,
    "dispatches": {
      "specialist": 6,
      "red-team": 2
    }
  }
}

What changed

A CSS-only spacing edit inside a Lit css template: origin/main reads SCOPE_FRONTEND=false and /ship skips its design checks; this branch reads true

A CSS-only spacing edit inside a Lit css template: origin/main reads SCOPE_FRONTEND=false and /ship skips its design checks; this branch reads true.

Before/after as text: A CSS-only spacing edit inside a Lit css template: origin/main reads SCOPE_FRONTEND=false and /ship skips its design checks; this branch reads true
--- Before · before.txt · captured output
+++ After · after.txt · captured output
 $ git diff main --stat
 src/persona-row.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
+$ gstack-diff-scope main --head HEAD   # this branch
+SCOPE_FRONTEND=true
-$ gstack-diff-scope main --head HEAD   # origin/main
-SCOPE_FRONTEND=false
 SCOPE_BACKEND=true
 

gstack-diff-scope now recognizes a screen written as a Lit or htm tagged template inside a .ts or .js file. Before, it counted only CSS, .tsx, views and similar paths as frontend. A PR that rendered its UI from html`` templates in plain TypeScript read SCOPE_FRONTEND=false`, so /ship skipped its design-lite check and the design specialist without saying so. That is what happened on qm#3186, which shipped three visible spacing problems after a full /ship.

  • Content arm. A changed non-test .ts/.js/.mjs/.cjs/.mts/.cts file that holds a tagged html, css or svg template (at the head, or at the merge base so a deleted screen counts; whitespace before the backtick is allowed) sets SCOPE_FRONTEND when a changed line sits inside one of those templates on its side of the diff (a CSS declaration or a ${} binding counts), or carries markup: a tagged template, an element tag, class= or style=. Logic-only edits, comment lines and TypeScript generics (Promise<void>) don't count. It works for --head ranges and for the working tree, untracked files included, and reads paths NUL-delimited so non-ASCII names work. It sets FRONTEND only, so these files keep SCOPE_BACKEND and the backend reviewers. lib/frontend-scope.ts stays path-only, so the design detector's scan targets don't change.
  • Receipt and disclosure. On a frontend range, gstack-ship-receipt write records design: { mode: "static", reason: "no preview declared" }, taken from the same diff-scope run the review depth reads. The PR body's ## Design Review line, /ship's preflight line and SKILL prose say the same thing: only the static check ran. The field is advisory. Nothing refuses on it, older receipts stay valid, and carry copies it. The schema and docs/ship-policy.md#ship-receipt document it.

Why

Garry on qm#3186: "gstack design skill should prevent this tbh". The plan (GST-1718, /autoplan run autoplan-20261107044135, approved A1 by Garry 2026-11-07) found the silent skip as the root cause. Blind replays on qm#3186 then showed that neither design pass catches its three defects as described: the static design-lite check found 0 of 3, and a rendered /design-review flagged 2 of the 3 elements under other diagnoses. So this PR fixes the skip and the disclosure. The rendered /design-review pass, the spacing lens and any gate are phase 2, built with the first repo preview harness.

Behavior changes

  • Every consumer of SCOPE_FRONTEND now turns on for template-UI diffs: /ship Step 9 design-lite (scripts/resolvers/design.ts, design-checklist.ts), the design and performance specialists (lib/review-depth.ts:502, :505, scripts/resolvers/review-army.ts), /ship preflight's SCOPE: frontend= line (lib/ship-preflight.ts:116), and /review's design checklist. Before, these were skipped on such diffs.
  • The ship receipt gains design on frontend ranges (before: no field).
  • The PR body's Design Review line and the preflight hint name the static-only mode (before: "Design Review (lite)" with no mode).

Blast radius

The CREW rule-15 no-loss replay was preregistered at captain drive handoffs/GST-1718/no-loss-prereg.md before it ran. Old (origin/main 3742ee9) and new gstack-diff-scope ran on the last 100 merged garrytan/gstack PRs and the last 100 merged yc-software/qm PRs, each merge commit against its parent. The first run used b93fb89's script (handoffs/GST-1718/no-loss/result.json). Review fixes then widened the arm, so the same corpus was replayed once more with the final script at 397436f (handoffs/GST-1718/no-loss-final/result.json). Final-head results:

  • All 200 were replayed.
  • 0 flags were lost.
  • 0 flags other than FRONTEND changed, exit codes included.
  • SCOPE_FRONTEND gained on 0 gstack PRs and on 9 qm PRs: 3186, 3156, 3138, 3094, 3093 and 3061 (as before), plus 3157, 3152 and 3116. I read the three new ones by hand at the file level; all three are plugins/web-ui/src UI PRs (composer, sidebar session actions, settings grouping).

gstack itself sees no change in cost. qm UI PRs gain the static design-lite check and the design specialist. The arm costs one awk pass per template file: 0.61 s on a 20,000-line logic rename in a template file, against 0.13 s on origin/main's script.

Tests

  • test/diff-scope.test.ts: five new tests on synthetic Lit files at qm#3186's path shape (no qm source).
    • A markup edit gives FRONTEND=true and BACKEND=true, both on --head and in the working tree.
    • A logic-only or generic-only edit gives false.
    • A test-file template gives false; an untracked template file and a deleted template file give true.
    • A non-ASCII template file gives true on --head and in the working tree; a <placeholder> in a comment gives false.
    • A CSS-only or binding-only edit inside a multiline template gives true, and so does `html `` with a space.
    • Each fails on the script it replaced; the negative-control test passes on both.
  • test/ship-receipt-depth.test.ts: a template-UI diff records design, and a backend diff records none.
  • test/fixtures/golden/*-ship-SKILL.md: regenerated for the static design-review line.
  • Locally (b93fb89, before /ship): typecheck, typecheck:test (no new diagnostics), the parity suite (size ledger recorded, +205 bytes for ship), the module-size ratchet, the spawnSync tripwire, context and catalog budgets, gen-skill-docs, and the diff-scope, frontend-scope, ship-preflight, receipt and artifact suites.

Approvals

Approved: yes (record r-87ba05784bdb). The full approval record stays private: this repository is public or its visibility is unknown.

Review-loop exception: one scoped fix-check after round 2, granted by GStack Minder (GSTA-36), approval a-f777ffd2c1b9 ("Grant: one scoped reader on 397436f. The two phase-2 skips are fine. It's the last round: a new blocker parks it.").

Summary

/ship stopped silently skipping design checks for UI written as Lit or htm templates in plain TypeScript, and now says which design pass ran. Review fixes made the detection count spacing and binding edits inside multiline templates, spaced template tags and non-ASCII file names, and kept it fast on large logic churn.

Test Coverage

Coverage: 64% value-weighted (91% including 4 weakly covered paths), from the Step 7 audit at b93fb89 (audit only, no generation allowance). Since then the review fixes added two tests to test/diff-scope.test.ts (non-ASCII and comment placeholder; CSS-only and binding-only edits inside a multiline template, and html \`` with a space). Each fails on the script it replaced. Test value: 2 tests written, 1 rejected by the authoring gate, 0 existing tests extended, 4 paths weakly covered (weak = ★, gate-failing or unrated). Proposed, not written: a carry copies designunchanged; a receipt withoutdesign` still validates.
Tests ran: free 1625 (test files, carried from CI run 42346658093 at tree 7095e67eb795)

Pre-Landing Review

Pre-Landing Review: 15 issues — 5 auto-fixed, 2 asked (0 fixed, 2 skipped), 0 deferred, 8 noted
REVIEW_LOOP: passes=2 blocking_found=4 deferred=0 noted=8 fixed=5 scope=frozen unbound=1 ledgers_read=7 fix_checks=2 dispatches=8
Gate edits: none detected (GATE_SCAN tagged=0 at 397436f)
Outside review (openai/gpt-6.1-sol, host subagent, at ea6b18e): request changes, 3 findings. Two fixed in 03f5c3c (edits inside multiline templates; whitespace before the backtick). One skipped with the Captain's acceptance: feeding template files to the design detector stays phase 2.
Skipped with the Captain's acceptance (phase 2): the receipt's design record names no file list (p1/red-team#2); the design detector stays path-only (v1/outside-voice#3).
Round 2's blocking finding (a grep fork per changed line, 50.4 s at 40k changed lines against the 60 s scopeOfRange timeout) was fixed in 397436f and read clean by the granted fix-check.

Review notes

Below the blocking floor (advisory, informational, test-gap or wording items); recorded here and not fixed in this PR.

  • INFORMATIONAL bin/gstack-diff-scope:391 The comment-line filter also drops a markup line that starts with an inline comment tag (/html/ <div ...>), so that rare style alone reads SCOPE_FRONTEND=false.
  • INFORMATIONAL bin/gstack-diff-scope:391 git grep/diff output parsed without --no-color/--no-ext-diff; color.ui=always or diff.external corrupts it.
  • INFORMATIONAL bin/gstack-diff-scope:371 every git failure in the arm reads as not frontend (no SCOPE_ERROR/warning).
  • INFORMATIONAL bin/gstack-diff-scope:387 ls-files --others prints cwd-relative paths while _g runs at the root; from a subdirectory an untracked template file is missed.
  • INFORMATIONAL bin/gstack-ship-receipt:334 design field set from review.frontend only; carry copies it unchanged instead of recomputing for the new head.
  • INFORMATIONAL bin/gstack-diff-scope:364 tag regex matches type assertions, spaced comparisons and regex literals in template files (over-reports).
  • INFORMATIONAL test/diff-scope.test.ts:636 new test's Value header lacks why_new=
  • INFORMATIONAL bin/gstack-diff-scope:378 template arm parses git grep/diff output without --no-color/--no-ext-diff/--no-textconv; color.ui=always or diff.external turns the arm off

Exploratory QA

Functional surface: the gstack-diff-scope CLI on an owned fixture repo outside this checkout. Smoke at 397436f, 3 probes, gstack-qa-evidence verdict pass: a class= markup edit in the working tree reads FRONTEND=true and BACKEND=true; a committed CSS-only edit inside a multiline css template reads FRONTEND=true through --head; a logic-only commit reads FRONTEND=false. An earlier smoke at ea6b18e (non-ASCII --head) also passed and is superseded. No plan checks are bound to this branch.

Design Review

No frontend files changed — design review skipped.

Eval Results

Prompt-related files changed (ship/SKILL.md.tmpl, ship/sections/pr-body.md.tmpl). eval-select picked 120+ behavior probes and no quality judges, which is over this lane's $10 paid cap, so no paid evals ran here. CI's evals.yml PR route skipped its slices. Paid coverage runs in the merge train's screen.

Scope Drift

Scope Check: CLEAN
Intent: A1, fix the silent design-check skip for template UI and disclose the static-only design pass.
Delivered: the diff-scope template arm, the receipt design field and the matching prose, with tests.

Plan Completion

Plan completion audit: not run (no plan is bound to this branch and no docs/designs/ file matches). Fix: add "Plan: " to the PR body, or run /autoplan.

TODOS

No TODO items completed in this PR.

Documentation

Status: current. The docs already match GST-1718, so nothing needed editing.

Scope: commits 3742ee9..39d9b29 (7 commits, 20 files); no staged, unstaged or new files.

Documentation health:

  • docs/ship-policy.md: current. It lists the receipt design field and explains it in its own paragraph.
  • ship/SKILL.md.tmpl: current. It has the static design-review wording and notes that Lit and htm templates count.
  • ship/sections/pr-body.md.tmpl: current. Its Design Review line matches the receipt.
  • changelog.d/capy-gst-1718-template-ui-scope.md: current.

Coverage debt: template-UI frontend detection in gstack-diff-scope has reference coverage only (docs/ship-policy.md) and no how-to. The receipt design field also has reference coverage only. No diagram drift.

Test plan

  • bun run test (lane free): carried from CI run 42346658093 at tree 7095e67eb795, 1625 test files, 0 failures (CI_CARRY accepted, 36154 tests)
  • bun test test/diff-scope.test.ts: 101 pass, 0 fail at 397436f
  • bun test test/host-config.test.ts test/module-size-ratchet.test.ts: pass at ea6b18e (goldens regenerated)
  • Pregate guards at 7095e67eb795: typecheck, skill-size, parity-suite, context-budget, module-size, goldens, conflict-markers

Open in Capy

…records the static design pass (GST-1718)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

garrytan and others added 6 commits November 7, 2026 05:38
…1718)

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=specialist
Review-Finding: p1/red-team#1 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…frontend

Review-Finding: v1/outside-voice#1 reader=outside-voice
Review-Finding: v1/adversarial-native#1 reader=adversarial-native
Review-Finding: v1/outside-voice#2 reader=outside-voice
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…ed line

Review-Finding: p2/red-team#2 reader=red-team
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant