pre-push has no TypeScript lint gate — TS lint breaks land on main, caught only post-push by ci (found via #1251) #1252

Closed
opened 2026-09-06 04:09:56 +00:00 by matou-build-agent · 1 comment

Symptom

.sandcastle/git-hooks/pre-push gates factory drift (#932) and Go (#198) but has no TypeScript lint gate. A TS lint break therefore lands on main and is only caught post-push by ci. That is how b5cb2c30 shipped main red on prefer-const (see #1251) and why three further commits (3e8cb171, 25d102a8, 5855aecf) rode on top of it, each reding the same way.

Proposed fix

Add a pre-push gate that runs pnpm run lint (or eslint scoped to changed .ts/.tsx files) when the push touches TypeScript, mirroring how the Go gate scopes to Go changes. Fails the push locally instead of letting a lint break reach main.

Provenance

Found while fixing #1251 (prefer-const red on the #1244 lazy dash getter). .sandcastle/git-hooks/pre-push is a protected path (#445), so per CLAUDE.md the machinery change is filed here rather than edited under the product ticket. Labelled ready-for-session (ADR 0174 — a protected .sandcastle/ path needs an interactive session's standing).

## Symptom `.sandcastle/git-hooks/pre-push` gates factory drift (#932) and Go (#198) but has **no TypeScript lint gate**. A TS lint break therefore lands on `main` and is only caught post-push by `ci`. That is how b5cb2c30 shipped `main` red on `prefer-const` (see #1251) and why three further commits (3e8cb171, 25d102a8, 5855aecf) rode on top of it, each reding the same way. ## Proposed fix Add a pre-push gate that runs `pnpm run lint` (or `eslint` scoped to changed `.ts`/`.tsx` files) when the push touches TypeScript, mirroring how the Go gate scopes to Go changes. Fails the push locally instead of letting a lint break reach `main`. ## Provenance Found while fixing #1251 (prefer-const red on the #1244 lazy `dash` getter). `.sandcastle/git-hooks/pre-push` is a protected path (#445), so per CLAUDE.md the machinery change is filed here rather than edited under the product ticket. Labelled `ready-for-session` (ADR 0174 — a protected `.sandcastle/` path needs an interactive session's standing).
Author
Member

Closed — TypeScript lint gate added to pre-push, run in every workdir. Ruled by agent under ADR 0174 — veto anytime.

Why a two-way door (ADR 0174). Revertible: the fix is a Matou/dev-factory commit plus an idss FACTORY_REF bump, both revert with one commit. Provable: offline gate-lib-test.sh (the same GATE_*_CMD stub seam the Go gate uses), green red-first. Not on the one-way list: a gate tightening (blocks TS lint breaks), the opposite of a security-posture widening; no credentials, trust surface, data destruction or spend. The ticket was minted ready-for-session for exactly this protected .sandcastle/ path (#445).

What landed. .sandcastle/git-hooks/pre-push, gate.sh, gate-lib.sh are factory-vendored (ADR 0180), so the change landed upstream and was re-vendored:

  • Upstream Matou/dev-factory: commit 906c770 — gate: add a TypeScript lint gate to pre-push, run in every workdir (origin idss #1252).
  • idss re-vendor: commit 515034df — FACTORY_REF 529cb1f1→906c770d (4 files updated: gate-lib.sh, gate.sh, git-hooks/pre-push, tests/gate-lib-test.sh; FACTORY_MANIFEST membership unchanged).

The fix.

  • gate-lib.sh: gate_ts_default_cmd (nix develop .#default -> pnpm run lint, ADR 0040 pinned toolchain) + gate_ts_stage, with the same first-match-wins precedence, fail-closed and git-env-scrub as gate_go_stage: GATE_TS_CMD -> executable per-repo .sandcastle/ts-gate.sh (drift-safe, not vendored) -> nix default. gate_run grows an optional <only> language filter and now runs the TS stage on a TS change (was a no-op skip).
  • gate.sh: new --prepush-ts mode.
  • git-hooks/pre-push: the TS lint gate runs in every workdir (mirroring the drift gate), because a TS lint break reaches main through the host reconcile push, not only the sandbox — the sandbox's in-loop pnpm lint did not stop b5cb2c30 (prefer-const) or the three commits that rode on it (#1251). Go stays sandbox-only (#198: a host push runs the full seam via nix develop and reconcile must not stall on a Go build; the sandbox has gated Go reliably). Cheap by construction: eslint runs only when the pushed range touches TypeScript.

Proof.

  • Red-first tests/gate-lib-test.sh: +12 checks (26 total) — TS-only now runs the TS stage, a red TS lint refuses the push, mixed runs both, the only filter, the ts-gate.sh override/precedence/git-env-scrub, and fail-closed. Verified red against the pre-fix gate-lib.sh (FAIL: a TS-only change MUST run the TS lint stage (#1252)), green after.
  • dev-factory offline suite green: gate-lib (26), prepush-drift-gate, git-setup, protected-paths-lib (27), check-harness-drift (12), onboard-lib (235), vendor-manifest-coverage; bash -n clean.
  • In-repo after re-vendor: vendored gate-lib-test green (26); check-harness-drift: OK at pin 906c770d; the idss main push exercised the new hook live (gate: no gated language touched — nothing to check — the TS gate ran on the real host push and skipped, drift gate passed).

Follow-up (not built, out of scope for #1252): the seam also gates prettier format:check; a format-drift red is a separate class this lint gate does not cover — file separately if a format:check pre-push gate is wanted.

**Closed — TypeScript lint gate added to pre-push, run in every workdir.** Ruled by agent under ADR 0174 — veto anytime. **Why a two-way door (ADR 0174).** Revertible: the fix is a `Matou/dev-factory` commit plus an idss `FACTORY_REF` bump, both revert with one commit. Provable: offline `gate-lib-test.sh` (the same `GATE_*_CMD` stub seam the Go gate uses), green red-first. Not on the one-way list: a gate **tightening** (blocks TS lint breaks), the *opposite* of a security-posture widening; no credentials, trust surface, data destruction or spend. The ticket was minted `ready-for-session` for exactly this protected `.sandcastle/` path (#445). **What landed.** `.sandcastle/git-hooks/pre-push`, `gate.sh`, `gate-lib.sh` are factory-vendored (ADR 0180), so the change landed **upstream** and was re-vendored: - Upstream `Matou/dev-factory`: commit `906c770` — `gate: add a TypeScript lint gate to pre-push, run in every workdir (origin idss #1252)`. - idss re-vendor: commit `515034df` — `FACTORY_REF 529cb1f1→906c770d` (4 files updated: `gate-lib.sh`, `gate.sh`, `git-hooks/pre-push`, `tests/gate-lib-test.sh`; `FACTORY_MANIFEST` membership unchanged). **The fix.** - `gate-lib.sh`: `gate_ts_default_cmd` (`nix develop .#default` -> `pnpm run lint`, ADR 0040 pinned toolchain) + `gate_ts_stage`, with the **same** first-match-wins precedence, fail-closed and git-env-scrub as `gate_go_stage`: `GATE_TS_CMD` -> executable per-repo `.sandcastle/ts-gate.sh` (drift-safe, not vendored) -> nix default. `gate_run` grows an optional `<only>` language filter and now **runs** the TS stage on a TS change (was a no-op skip). - `gate.sh`: new `--prepush-ts` mode. - `git-hooks/pre-push`: the TS lint gate runs in **every** workdir (mirroring the drift gate), because a TS lint break reaches `main` through the **host reconcile push**, not only the sandbox — the sandbox's in-loop `pnpm lint` did not stop `b5cb2c30` (prefer-const) or the three commits that rode on it (#1251). **Go stays sandbox-only** (#198: a host push runs the full seam via `nix develop` and reconcile must not stall on a Go build; the sandbox has gated Go reliably). Cheap by construction: eslint runs **only** when the pushed range touches TypeScript. **Proof.** - Red-first `tests/gate-lib-test.sh`: +12 checks (26 total) — TS-only now runs the TS stage, a red TS lint refuses the push, mixed runs both, the `only` filter, the `ts-gate.sh` override/precedence/git-env-scrub, and fail-closed. Verified red against the pre-fix `gate-lib.sh` (`FAIL: a TS-only change MUST run the TS lint stage (#1252)`), green after. - dev-factory offline suite green: `gate-lib` (26), `prepush-drift-gate`, `git-setup`, `protected-paths-lib` (27), `check-harness-drift` (12), `onboard-lib` (235), `vendor-manifest-coverage`; `bash -n` clean. - In-repo after re-vendor: vendored `gate-lib-test` green (26); `check-harness-drift: OK` at pin `906c770d`; the idss `main` push exercised the new hook live (`gate: no gated language touched — nothing to check` — the TS gate ran on the real host push and skipped, drift gate passed). **Follow-up (not built, out of scope for #1252):** the seam also gates prettier `format:check`; a format-drift red is a separate class this lint gate does not cover — file separately if a `format:check` pre-push gate is wanted.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Matou/idss#1252
No description provided.