Skip to content

Add CI test-gating workflow (closes #1495) - #1570

Merged
mstomar125 merged 3 commits into
NodeSpaceAI:mainfrom
mstomar125:feat/ci-test-gating
Jul 7, 2026
Merged

mstomar125 merged 3 commits into
NodeSpaceAI:mainfrom
mstomar125:feat/ci-test-gating

Conversation

@mstomar125

Copy link
Copy Markdown
Contributor

Closes #1495.

Problem

The only workflow is release.yml (build + sign, on release/dispatch) — it runs zero tests. scripts/test-gate.ts runs the full pyramid on pre-push, but that hook only exists on a machine that ran bun install, and any push can bypass it with --no-verify. So nothing runs the suite server-side and a regression can merge green.

Change

Add .github/workflows/ci.yml, triggered on every pull_request and on push to main, mirroring the scripts/test-gate.ts (ADR-047) sequence:

  • unit job — bun run test:all (frontend + skill + Rust cargo test --lib -p nodespace-core).
  • e2e job — cargo build --bin nodespaced, then bun run test:e2e (real headless daemon + dev-proxy via NODESPACED_BINARY), then cargo test -p nodespace-app (Tauri-seam integration, ADR-048, via NODESPACED_TEST_BIN).

Runner/toolchain/protobuf setup mirrors release.yml (macos-latest, dtolnay/rust-toolchain@stable, swatinem/rust-cache@v2, oven-sh/[email protected], brew install protobuf, svelte-kit sync). release.yml stays scoped to release/signing only.

Acceptance criteria

  • ci.yml runs test:all + test:e2e on every pull_request and push — plus the daemon build and the Tauri-seam tests, matching the full local gate
  • The e2e job runs headless in CI (no display) via the existing harness (NODESPACED_HEADLESS=1 is set by the harness; the e2e path is HTTP-based, no webview)
  • Release/signing remains a separate workflow (release.yml untouched)
  • Make the unit + e2e jobs required status checks — branch-protection admin setting, to be flipped once this workflow is green on its own PR (I cannot set branch protection)

Validation

This is a CI-config change; the authoritative validation is this workflow running on this PR. Watching the run now — will iterate here if any job fails before asking for the required-check flip.

Notes / follow-ups

  • Jobs run on macos-latest to match the local gate + release.yml exactly (lowest risk of the gate itself breaking). Moving unit to ubuntu-latest to cut runner cost is a possible follow-up once green.
  • ADR-047 currently describes the local pre-push gate; a docs follow-up in nodespace-docs should note the server-side enforcement this adds.

release.yml only builds/signs on release — no workflow runs tests on a PR,
so regressions can merge green. scripts/test-gate.ts enforces the full test
pyramid locally on pre-push, but that hook only exists after bun install and
any push can bypass it with --no-verify.

Add ci.yml running the same sequence server-side on every pull_request and on
pushes to main:
  - unit job: bun run test:all (frontend + skill + Rust)
  - e2e job:  cargo build --bin nodespaced, then bun run test:e2e (headless
              daemon + dev-proxy) and cargo test -p nodespace-app (Tauri-seam,
              ADR-048)
Mirrors release.yml's runner/toolchain/protobuf setup. release.yml stays
scoped to release/signing only. Governed by ADR-047.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE (pending the e2e job going green — the unit job already passed on this PR).

This closes a real, long-standing gap: until now the only workflow was release.yml (build/sign, zero tests), so every PR merged with no server-side test run — the statusCheckRollup was empty on every PR I've reviewed for weeks. This adds .github/workflows/ci.yml running the full test-gate pyramid on every pull_request + push to main.

Verified:

  • Complements, not duplicates, No CI runs any test — add a PR test-gating workflow #1544. No CI runs any test — add a PR test-gating workflow #1544 (merged) added the local pre-push hook (scripts/test-gate.ts, .husky/pre-push) — bypassable with --no-verify and only present after bun install. This runs the same sequence server-side so it can't be bypassed. No file conflict (ci.yml was absent on main).
  • Safe workflow trigger: uses pull_request (not pull_request_target) and references no secrets, so a fork PR can't exfiltrate anything — the correct choice. concurrency with cancel-in-progress is set; deps pinned (--frozen-lockfile, pinned bun, rust-cache).
  • It actually works: the unit job ("test:all") completed green on this very PR, so actions/checkout@v7 + the toolchain resolve.

Nits (non-blocking):

  • No explicit permissions: block — add permissions: contents: read for least-privilege (the default token grant is broader than this read-only gate needs).
  • No timeout-minutes on the jobs — a hung test would ride the 6h default; a ~30–45m cap would fail faster.
  • The two jobs duplicate the full setup (checkout/rust/protobuf/bun/install/sync) — a composite action or a needs-shared build would cut macOS-runner minutes, but not required.

Note (core = re-review before merge): I'm not merging this — it needs the second review pass and the e2e job to finish green first.

cargo test -p nodespace-app trips the Tauri externalBin build-script check —
it needs binaries/nodespaced-<triple> and binaries/nodespace-<triple> staged
(binaries/ is gitignored, absent in CI). That staging is the ADR-048 Tauri-seam
companion's concern; scope this gate to its acceptance (test:all + test:e2e),
both green in CI.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

Pushed a fix. The first run showed unit (test:all) ✅ / e2e ❌ — but only the last step, cargo test -p nodespace-app, failed, on the Tauri externalBin build-script check:

```
resource path binaries/nodespaced-aarch64-apple-darwin doesn't exist
```

tauri.conf.json declares externalBin: ["binaries/nodespaced", "binaries/nodespace"], and binaries/ is gitignored → absent on a fresh CI checkout. test:all and test:e2e (the acceptance for #1495) both passed.

Scoped this PR to test:all + test:e2e and deferred the Tauri-seam step (sidecar staging) to #1571 (ADR-048 companion). Re-running CI now — expecting both jobs green.

src/tests/performance/architecture-benchmarks.test.ts asserts hard timing
thresholds (e.g. 100 indent/outdent <25ms). On shared CI runners these vary
run-to-run — a first run passed, a rerun failed at 34ms — so they can't back a
required PR check. Exclude src/tests/performance/** from the default vitest run
when process.env.CI is set. They still run locally via bun run test and
deliberately via bun run test:perf.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@mstomar125

Copy link
Copy Markdown
Contributor Author

Second iteration: the scoped run then flipped — test:e2e ✅ / test:all ❌, but the only failures were two wall-clock performance benchmarks in src/tests/performance/architecture-benchmarks.test.ts (100 indent/outdent <25ms came back at 34ms on the shared runner; it had passed on the faster first run). Hard timing thresholds are inherently nondeterministic on CI runners and can't back a required check — and the repo already has a dedicated bun run test:perf for deliberate perf validation.

Fix: exclude src/tests/performance/** from the default vitest run when process.env.CI is set (GitHub Actions sets CI=true). They still run locally via bun run test and via test:perf. Verified locally: perf file is excluded under CI=true, present without it. Re-running CI — expecting both jobs green.

@mstomar125

Copy link
Copy Markdown
Contributor Author

APPROVE (re-review @ ffbb793a) — the two scope changes since d76d951c are both sound:

  • Perf benchmarks excluded under CI (packages/desktop-app/vitest.config.ts: ...(process.env.CI ? ['src/tests/performance/**'] : [])). Wall-clock threshold assertions (<25ms) are inherently flaky on shared runners and have no place in a required gate; keeping them local + explicit test:perf is the right split. CI is auto-set by Actions, so the scoping is correct.
  • Tauri-seam step (cargo test -p nodespace-app, ADR-048) removed from the e2e job, with a comment that it needs the externalBin sidecars staged before the app crate's build script and is tracked as a separate ADR-048 companion. Reasonable pragmatic descope — documented, so not a silent coverage gap.

One caveat to keep visible (not blocking): with that step gone, the gate now enforces test:all + headless-daemon test:e2e but not the Tauri-to-daemon seam that #1563 just added — so a seam regression could still merge green until the companion lands. Worth making sure that companion actually follows.

Both jobs are green on this PR. My earlier nits still stand and are cheap: add permissions: contents: read and a timeout-minutes per job. Otherwise good to go — this closes a real gap (no server-side test run on any PR until now).

@mstomar125
mstomar125 merged commit f8c9e1f into NodeSpaceAI:main Jul 7, 2026
2 checks passed
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