Skip to content

No CI runs any test — add a PR test-gating workflow - #1544

Merged
malibio merged 2 commits into
mainfrom
worktree-issue-1495-ci-test-gate
Jul 6, 2026
Merged

malibio merged 2 commits into
mainfrom
worktree-issue-1495-ci-test-gate

Conversation

@malibio

@malibio malibio commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Closes #1495

No CI runs any test today — release.yml only builds/signs on release
and never runs on pull_request or push. Since this is a desktop app
with GitHub Actions scoped to release/signing only, the gate lives
locally: a pre-push hook runs test:all + test:e2e (headless daemon
round-trip) and blocks the push on failure, with a documented
--no-verify escape hatch for intentional WIP pushes.

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Jul 6, 2026 •

Copy link
Copy Markdown
Collaborator Author

Principal Engineer Review — PR #1544 (Local pre-push test gate via Husky)

Scope reviewed: package.json (+3/-1), bun.lock (+3), .husky/pre-push (new, 1 line), scripts/test-gate.ts (new, 33 lines). Total diff: 40/-1 across 4 files.

Requirements framing

Issue #1495's literal acceptance criteria (a ci.yml GitHub Actions workflow as a required status check) are not what's implemented here — and that's by design. Per the session record, the project owner explicitly redirected the approach: this is a desktop app with zero external contributors, GitHub Actions is reserved for release.yml only, and CI/CD is intentionally local. That decision is captured in the revised ADR-047 (nodespace-docs, committed separately, not part of this diff). The delivered mechanism — a mandatory local pre-push hook running the full test pyramid — satisfies the issue's underlying intent (block untested code from merging) via a different, deliberately chosen mechanism. This is not scored as a missed requirement.

Correctness of the hook mechanism

  • Husky wiring: "prepare": "husky" is the correct Husky v9 idiom — bun install runs prepare scripts, and husky's bin (with no args) installs core.hooksPath pointing at .husky/, so .husky/pre-push is picked up without any manual chmod/copy step into .git/hooks. Confirmed correct.
  • Executable bit: Verified via git log --diff-filter=A -p -- .husky/pre-push — the diff header shows new file mode 100755. Correct; git will preserve the exec bit on checkout.
  • .husky/_ exclusion: Confirmed via git ls-tree -r HEAD --name-only | grep husky — only .husky/pre-push is tracked, no shim directory. Husky v9 writes .husky/_ at install time as a local artifact; it's correctly absent from the tree (Husky's own installer keeps it out of VCS by convention — no explicit .gitignore entry was needed or added, and none is required since the dir is only generated post-install and not scaffolded into the commit).

scripts/test-gate.ts correctness

  • Exit code propagation: run() wraps each stage in try/catch around bun's $ shell helper. $ throws on non-zero exit by default (Bun's Bun.$ semantics — ShellError on failure), so a failing test:all, cargo build, or test:e2e is caught and triggers process.exit(1). Husky's pre-push hook, when the script inside exits non-zero, blocks the underlying git push. Chain verified end-to-end: $ throws → catch → process.exit(1) → hook script exits 1 → git aborts push. Correct.
  • NODESPACED_BINARY plumbing: correctly set to ${process.cwd()}/target/debug/nodespaced and passed via .env({ ...process.env, NODESPACED_BINARY: binary }). Cross-checked against packages/desktop-app/src/tests/e2e/daemon-harness.ts (line ~125-126), which reads process.env.NODESPACED_BINARY first before falling back to a prebuilt sidecar — matches exactly, and the harness's own error message even suggests the same cargo build -p nodespaced step this script performs. Correct integration.
  • Hardcoded path portability (Improvement, non-blocking): target/debug/nodespaced assumes (a) no custom Cargo [build] target-dir override — confirmed none exists in the workspace Cargo.toml or member manifests, so this holds today; (b) Unix path separators — fine on macOS/Linux, but on Windows the binary would be target\debug\nodespaced.exe, so this script would fail to locate the binary if ever run on Windows. Given the team is currently macOS/Linux-only (per CLAUDE.md's Tauri/desktop framing and no evidence of active Windows contributor workflows), this is a reasonable gap to accept now, not a blocker — but worth a one-line comment or process.platform guard if Windows contributors ever onboard.

Performance / DX

  • The hook runs a full test:all (frontend + skill + Rust) plus a Rust build plus a headless e2e daemon round-trip on every git push. Worst case (cold cache, post cargo clean, or after deep dependency-graph changes) this is a genuinely multi-minute wait. Steady-state (incremental compilation, warm target dir) it should be cheap — mostly bounded by test:all's own cost, since cargo build --bin nodespaced will usually be a near-no-op if nothing in the daemon's dependency graph changed. This is a reasonable tradeoff for a small team wanting a hard local gate, and matches the "protect a small team from pushing broken code" bar rather than an enterprise-CI bar.
  • Bypass discoverability: git push --no-verify is documented in two places — the script's own header comment (Bypass (intentional WIP pushes only): git push --no-verify) and again in the failure-path console output (Fix the failure, or bypass intentionally with: git push --no-verify). That's the moment a contributor actually needs it, so this is adequately discoverable without requiring a separate CONTRIBUTING doc. No README/CONTRIBUTING file exists in this repo to begin with (consistent with CLAUDE.md's "one root CLAUDE.md + one README, no other docs" rule), so there's no natural second home for this note — the in-script documentation is sufficient given that constraint.

Known limitation — silent no-gate scenario (flag as documented gap)

A contributor whose local node_modules/.git/hooks predates this PR (i.e., ran bun install before Husky was added, or has core.hooksPath pointed elsewhere) will not get the hook wired until their next bun install. More subtly, anyone who clones fresh but skips bun install before their first git push (e.g., pushing from a machine that hasn't run the JS toolchain at all — e.g. Rust-only edits) gets zero gating, silently. This is an accepted tradeoff of the local-hook approach (vs. server-side enforcement a GitHub Actions required check would have given), and it is not currently called out anywhere discoverable — not in the script's comments, not in package.json, not in CLAUDE.md. Recommend adding a one-line note either in scripts/test-gate.ts's header comment or CLAUDE.md's testing section stating explicitly: "this gate only activates after bun install; it is not a server-side enforcement backstop." Low cost, meaningfully closes the discoverability gap for future contributors reading the ADR/ mechanism later.

Consistency with repo standards

  • Bun-only tooling: confirmed — no npm/yarn/pnpm invocations anywhere in package.json's new script, .husky/pre-push, or scripts/test-gate.ts. All correct bun run invocations.
  • console.log in scripts/: test-gate.ts uses console.log/console.error directly. Checked the convention against several existing files in scripts/ (e.g. scripts/setup-git-hooks.ts, scripts/aichat.ts, scripts/container.ts, scripts/bulk-update-links.ts) — all use raw console.* freely; the createLogger/no-raw-console rule in CLAUDE.md applies to application/production code, not one-off dev tooling scripts. This is not a violation, consistent with existing repo convention.

Adjacent finding — two uncoordinated hook mechanisms (nit)

scripts/setup-git-hooks.ts already exists in this repo (predates this PR) and manually installs a pre-commit hook into .git/hooks/pre-commit via an opt-in bun run scripts/setup-git-hooks.ts invocation — unrelated to Husky, not wired to bun install, and targeting a different hook stage (pre-commit vs. this PR's pre-push). No functional collision since they target different hooks, but the repo now has two different, uncoordinated git-hook installation mechanisms (one manual/opt-in via a custom script, one automatic via Husky's prepare). Not a blocker for this PR — pre-existing script, out of scope — but worth a follow-up to either fold pre-commit's quality-fix behavior into Husky too, or delete the redundant manual installer, so there's one hook mechanism going forward.


Triage Matrix

Critical / Blocker: None found. The hook wiring, exit-code propagation, and env-var plumbing are all correct and verified by tracing the actual code paths.

Improvement (non-blocking):

  1. Hardcoded target/debug/nodespaced path won't resolve on Windows (nodespaced.exe) — fine today given no active Windows contributors, but worth a guard/comment if that changes.
  2. The "gate only activates after bun install" limitation isn't documented anywhere discoverable (script header, CLAUDE.md) — add one line.
  3. Two independent, uncoordinated git-hook installation mechanisms now exist (scripts/setup-git-hooks.ts pre-commit vs. Husky pre-push) — consider consolidating in a follow-up.

Nit: None beyond the above.

Reviewer Assessment

No correctness, security, or standards violations found. The two Improvement items above are worth a fast follow-up but are not blocking.

Note: GitHub does not permit the authenticated account to formally approve its own PR (this repo has no second collaborator account), so no formal "Approved" review state is recorded here — this comment reflects the reviewer's assessment only. The merge decision rests with the repo owner.

@malibio malibio left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review decision: APPROVE (recorded as comment — GitHub blocks self-approval on this account). Reviewed the hook mechanism (Husky wiring, exit-code propagation, NODESPACED_BINARY plumbing) in detail; all correct, no blockers found. Full write-up posted above. A couple of non-blocking Improvement items noted there (Windows path portability, gate-only-after-bun-install discoverability, two uncoordinated hook mechanisms).

… script

- scripts/test-gate.ts: resolve nodespaced.exe on Windows instead of
  hardcoding the Unix binary name
- scripts/test-gate.ts: document that the gate only activates after
  bun install (Husky's prepare script wires it in) — it is not a
  server-side enforcement backstop
- Remove scripts/setup-git-hooks.ts: it wrote directly to .git/hooks/
  pre-commit, which is now dead code since Husky's prepare script points
  core.hooksPath at .husky/ instead — the old script would silently have
  no effect once Husky is installed

Skipped: consolidating this pre-push gate with a resurrected pre-commit
quality:fix hook is out of scope for this PR — quality:fix already runs
before every PR per CLAUDE.md's stated workflow, and adding a pre-commit
hook wasn't part of issue #1495.

Co-Authored-By: Claude <[email protected]>
@malibio

malibio commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed review feedback

  • ✅ Windows path handling — scripts/test-gate.ts now resolves nodespaced.exe on win32, not just the Unix binary name.
  • ✅ Undocumented silent-no-gate limitation — added a header comment in scripts/test-gate.ts stating explicitly that the gate only activates after bun install (Husky's prepare script wires it in) and is not a server-side enforcement backstop.
  • ✅ Dead hook script removed — deleted scripts/setup-git-hooks.ts. It wrote directly to .git/hooks/pre-commit, which becomes dead code once Husky's prepare script points core.hooksPath at .husky/ — the manual installer would silently do nothing once this PR lands. Unreferenced anywhere (no package.json script, no docs), so safe to remove outright rather than try to reconcile two hook mechanisms.
  • ⏭️ Skipped: folding a resurrected pre-commit quality:fix hook into Husky. Out of scope for this PR — quality:fix is already a mandatory manual step before every PR per CLAUDE.md, and adding a new pre-commit hook wasn't part of issue No CI runs any test — add a PR test-gating workflow #1495's ask.

Also corrected the earlier review comment above: it originally stated "Review decision: APPROVE" after gh pr review --approve failed with GitHub's self-approval protection (author and reviewing account are the same identity on this repo). Edited it to remove that language — GitHub does not have a recorded "Approved" state on this PR, only this comment's findings. The merge decision is the repo owner's call.

Re-Review Decision

Decision: NO RE-REVIEW NEEDED

Rationale: All changes are small, low-risk, and mechanical — a platform-name branch, a comment addition, and removing an unreferenced, now-dead script. No new logic, no architectural change, nothing that alters the verified hook wiring or exit-code propagation the original review confirmed. Verified locally: bun run scripts/test-gate.ts still runs and passes end-to-end (test:all + e2e) after these changes.

@malibio
malibio merged commit fec5ab2 into main Jul 6, 2026
@malibio
malibio deleted the worktree-issue-1495-ci-test-gate branch July 6, 2026 16:31
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.

No CI runs any test — add a PR test-gating workflow

1 participant