HOMELAB-2567: test(forgejo): make deployed vitest load typebox #83

Merged
pi-landing merged 1 commit from plane/HOMELAB-2567-typebox-tests into main 2026-11-03 06:59:37 +00:00
Owner

What

The deployed extension is a source drop with no node_modules. pi's loader supplies the bare typebox import of index.ts at runtime; vitest has no such loader, so every suite that reaches index.ts died at import while the suites that never import it still passed:

Error: Failed to load url typebox (resolved id: typebox) in .../forgejo/index.ts. Does the file exist?

RED before any change, byte-for-byte copy of the deployed tree (live checkout untouched):

shape result
deployed drop (13 files) 7 files failed to load / 6 passed, 180 tests
current main e2b6f6e (14 files) 8 files failed to load / 6 passed, 191 tests

Nothing is missing from package.json. typebox is a declared dependency (^1.1.24), the lockfile pins it (node_modules/typebox = 1.3.34), and npm ci in the deployed drop makes the whole suite green. What the deployed shape lacked is the install step CI already performs — that is why CI is green while the deployed copy cannot run the same suite.

Change

  • forgejo/scripts/test-in-deployed-shape.sh — supported runner for the deployed shape. Copies the package to a private 0700 temp dir (the source / live deployed checkout is never written to), npm ci --prefer-offline from the package's own lockfile, tsc --noEmit, vitest run with a JSON report, then asserts that every tests/**/*.test.ts on disk was collected and passed. A suite that cannot be imported is printed by name with its runtime error and the script exits non-zero. Fails closed when the shipped package-lock.json no longer satisfies the shipped package.json.
  • forgejo/TESTING.md — the two supported shapes (CI checkout, deployed drop), the exact failure text, and why neither a devDependencies move (typebox is a runtime import) nor a vitest resolve.alias to pi's copy (different module instance, hides the gap) is the fix. Package-local because docs/ does not exist in the deployed drop, and docs/forgejo.md belongs to #81.
  • forgejo/package.json — "test:deployed". npm test is unchanged, so CI's npm ci → npm run typecheck → npm test chain is intact.

Evidence

  • Deployed shape against the live ~/.pi/agent/extensions/forgejo: 13/13 files loaded and passed, 349/349 tests, pinned typebox 1.3.34; sha256 manifest of all 27 source files identical before/after (no node_modules created in the live tree).
  • Same runner on this branch (14 files): 14/14 files loaded and passed, 390/390 tests; --no-typecheck and default (typecheck included) both green.
  • CI shape unchanged: npm run typecheck clean, npm test 14/14 files, 390 tests.
  • Fail-closed probes: a suite importing a missing module → DID NOT LOAD ... Failed to load url missing-module-probe ..., exit 1; a package.json out of sync with the lock → npm ci refused the install, exit 1; bad args → exit 2.

No self-review, no verdict, no merge, no Done transition from the worker; no reviewer dispatched.

## What The deployed extension is a **source drop with no `node_modules`**. pi's loader supplies the bare `typebox` import of `index.ts` at runtime; vitest has no such loader, so every suite that reaches `index.ts` died at import while the suites that never import it still passed: ``` Error: Failed to load url typebox (resolved id: typebox) in .../forgejo/index.ts. Does the file exist? ``` RED before any change, byte-for-byte copy of the deployed tree (live checkout untouched): | shape | result | |-------|--------| | deployed drop (13 files) | **7 files failed to load / 6 passed, 180 tests** | | current main `e2b6f6e` (14 files) | **8 files failed to load / 6 passed, 191 tests** | **Nothing is missing from `package.json`.** `typebox` is a declared `dependency` (`^1.1.24`), the lockfile pins it (`node_modules/typebox` = 1.3.34), and `npm ci` in the deployed drop makes the whole suite green. What the deployed shape lacked is the **install step CI already performs** — that is why CI is green while the deployed copy cannot run the same suite. ## Change - `forgejo/scripts/test-in-deployed-shape.sh` — supported runner for the deployed shape. Copies the package to a private `0700` temp dir (**the source / live deployed checkout is never written to**), `npm ci --prefer-offline` from the package's own lockfile, `tsc --noEmit`, `vitest run` with a JSON report, then asserts that **every** `tests/**/*.test.ts` on disk was collected and passed. A suite that cannot be imported is printed by name with its runtime error and the script exits non-zero. Fails closed when the shipped `package-lock.json` no longer satisfies the shipped `package.json`. - `forgejo/TESTING.md` — the two supported shapes (CI checkout, deployed drop), the exact failure text, and why neither a `devDependencies` move (typebox is a runtime import) nor a vitest `resolve.alias` to pi's copy (different module instance, hides the gap) is the fix. Package-local because `docs/` does not exist in the deployed drop, and `docs/forgejo.md` belongs to #81. - `forgejo/package.json` — `"test:deployed"`. **`npm test` is unchanged**, so CI's `npm ci` → `npm run typecheck` → `npm test` chain is intact. ## Evidence - Deployed shape against the **live** `~/.pi/agent/extensions/forgejo`: `13/13 files loaded and passed, 349/349 tests`, pinned `typebox` 1.3.34; sha256 manifest of all 27 source files identical before/after (no `node_modules` created in the live tree). - Same runner on this branch (14 files): `14/14 files loaded and passed, 390/390 tests`; `--no-typecheck` and default (typecheck included) both green. - CI shape unchanged: `npm run typecheck` clean, `npm test` `14/14 files, 390 tests`. - Fail-closed probes: a suite importing a missing module → `DID NOT LOAD ... Failed to load url missing-module-probe ...`, exit 1; a `package.json` out of sync with the lock → `npm ci refused the install`, exit 1; bad args → exit 2. No self-review, no verdict, no merge, no Done transition from the worker; no reviewer dispatched.
HOMELAB-2567: test(forgejo): run the suite in the deployed shape
Some checks failed
CI / pr-title (pull_request) Successful in 3s
CI / forgejo-ci (pull_request) Successful in 1m14s
CI / ask-user-question (pull_request) Successful in 1m17s
CI / skill-args (pull_request) Successful in 1m27s
CI / refocus (pull_request) Successful in 1m13s
CI / mcp-bridge (pull_request) Successful in 34s
CI / nats-intercom (pull_request) Successful in 33s
CI / todo (pull_request) Successful in 1m47s
CI / pi-otel-telemetry (pull_request) Successful in 2m9s
CI / pi-friction (pull_request) Successful in 45s
CI / redact (pull_request) Successful in 59s
CI / plane (pull_request) Successful in 2m44s
CI / forgejo (pull_request) Successful in 2m49s
CI / pi-swarm-suite (pull_request) Failing after 4m57s
a0be6e1f76
The deployed extension is a source drop with no node_modules: pi's loader
supplies the bare `typebox` import of index.ts at runtime, vitest has no such
loader, so every suite that reaches index.ts died at import with "Failed to
load url typebox" while the suites that never import it still passed. On the
deployed revision that hid 7 test files behind 180 passing tests; on current
main it is 8 files behind 191.

Nothing is missing from package.json -- typebox is a declared dependency and
the lockfile pins it, and `npm ci` in the deployed drop makes the whole suite
green (13/13 files, 349 tests). What the deployed shape lacked was the install
step CI already performs.

- forgejo/scripts/test-in-deployed-shape.sh: copies the package to a private
  0700 temp dir (the live checkout is never written to), runs `npm ci` from
  the package's own lockfile, typecheck, vitest, then asserts every
  tests/**/*.test.ts was collected and passed, naming any suite that did not
  load. Fails closed on a lockfile that no longer satisfies package.json.
- forgejo/TESTING.md: the two supported shapes (CI checkout, deployed drop),
  the exact failure, and why neither a devDependency move nor a vitest alias
  to pi's copy is the fix. Package-local so it travels with the deployed drop.
- forgejo/package.json: `test:deployed` runs the above. `npm test` (CI) is
  unchanged, so the workflow's `npm ci` -> typecheck -> test chain is intact.
aaron force-pushed plane/HOMELAB-2567-typebox-tests from a0be6e1f76
Some checks failed
CI / pr-title (pull_request) Successful in 3s
CI / forgejo-ci (pull_request) Successful in 1m14s
CI / ask-user-question (pull_request) Successful in 1m17s
CI / skill-args (pull_request) Successful in 1m27s
CI / refocus (pull_request) Successful in 1m13s
CI / mcp-bridge (pull_request) Successful in 34s
CI / nats-intercom (pull_request) Successful in 33s
CI / todo (pull_request) Successful in 1m47s
CI / pi-otel-telemetry (pull_request) Successful in 2m9s
CI / pi-friction (pull_request) Successful in 45s
CI / redact (pull_request) Successful in 59s
CI / plane (pull_request) Successful in 2m44s
CI / forgejo (pull_request) Successful in 2m49s
CI / pi-swarm-suite (pull_request) Failing after 4m57s
to ba9e115906
All checks were successful
CI / pr-title (pull_request) Successful in 1s
CI / mcp-bridge (pull_request) Successful in 25s
CI / nats-intercom (pull_request) Successful in 26s
CI / skill-args (pull_request) Successful in 48s
CI / forgejo-ci (pull_request) Successful in 52s
CI / ask-user-question (pull_request) Successful in 49s
CI / pi-friction (pull_request) Successful in 38s
CI / redact (pull_request) Successful in 39s
CI / pi-otel-telemetry (pull_request) Successful in 1m1s
CI / todo (pull_request) Successful in 1m5s
CI / refocus (pull_request) Successful in 1m8s
CI / plane (pull_request) Successful in 1m24s
CI / forgejo (pull_request) Successful in 1m36s
CI / pi-swarm-suite (pull_request) Successful in 4m8s
2026-11-03 05:50:21 +00:00
Compare
ld-reviewer approved these changes 2026-11-03 06:06:14 +00:00
Dismissed
ld-reviewer left a comment
Collaborator

Verdict: APPROVED

model: omniroute/deepseek-flash
head: ba9e115906

Independent general review of the entire diff against origin/main e2b6f6e (3 files, +289/-0:
forgejo/TESTING.md, forgejo/package.json +1 script, forgejo/scripts/test-in-deployed-shape.sh).
Nothing outside forgejo/; pi-swarm-suite byte-identical to base. No blocker open.

Root cause confirmed, not re-litigated: typebox is declared (^1.1.24) and lock-pinned (1.3.34); the
deployed drop simply has no node_modules, and the missing piece is the install step CI already performs.
Rejecting a devDependencies move and a resolve.alias to pi's copy is correct for the stated reasons.

Independently rerun against the live deployed tree (it was re-dropped at 05:59 today with main's 14 suites,
so the count differs from the worker's 13/349 — the deployed revision moved, not the finding):
npm ci: ok (added 401 packages), 14/14 files, 390/390 tests, exit 0. Live tree byte-identical after the
run: sha256 manifest of all 28 source files unchanged, node_modules listing/size/mtime unchanged (still
only .vite/.vitest-cache). No lockfile edit was needed — npm ci succeeding from the shipped lock is
the proof the lock still satisfies package.json.

Fail-closed behaviour probed independently, each on its own 0700 temp copy: a suite importing an absent
module gives exit 1 with DID NOT LOAD ... (the ticket's exact signature); a *.test.ts on disk that
vitest does not collect gives exit 1 1 of 15 test file(s) produced no result at all; a package.json out
of sync with the lock gives exit 1 npm ci refused the install; bad args/root exit 2. So a non-loading
suite cannot be silently skipped — disk file count is compared with the JSON report and zero-assertion
suites are named with their first error line.

npm test is unchanged (package.json gains only test:deployed; .forgejo/workflows/ci.yaml
untouched), and CI run #195 on this exact head is 14/14 green including forgejo and pr-title. Run #194
was red only in pi-swarm-suite on the identical tree; same job green in #191/#192/#193 and #195 with an
empty diff outside forgejo/ — classified as an owner-side flake and reported, not dismissed.

Two non-blocking nits (no fix required here): (1) the success line asserts loading and failures only, so a
suite whose tests are all it.skip reports ok: ... 390/391 tests and exit 0 — honest about loading, which
is this ticket's bug class, but nothing in forgejo/tests uses skip today and a future assertion on
skipped counts would harden it; (2) TESTING.md's npm run test:deployed "from a deployed drop" needs the
drop to ship scripts/, which the live drop does not have yet and the deploy sync is not in this repo —
the always-available checkout-plus-PACKAGE_ROOT path is documented too, so this is a redeploy-time note.

## Verdict: APPROVED model: omniroute/deepseek-flash head: ba9e115906aaf221a0578a9d8d7c75e2f647e898 Independent general review of the entire diff against `origin/main` `e2b6f6e` (3 files, +289/-0: `forgejo/TESTING.md`, `forgejo/package.json` +1 script, `forgejo/scripts/test-in-deployed-shape.sh`). Nothing outside `forgejo/`; `pi-swarm-suite` byte-identical to base. No blocker open. Root cause confirmed, not re-litigated: `typebox` is declared (`^1.1.24`) and lock-pinned (1.3.34); the deployed drop simply has no `node_modules`, and the missing piece is the install step CI already performs. Rejecting a `devDependencies` move and a `resolve.alias` to pi's copy is correct for the stated reasons. Independently rerun against the live deployed tree (it was re-dropped at 05:59 today with main's 14 suites, so the count differs from the worker's 13/349 — the deployed revision moved, not the finding): `npm ci: ok (added 401 packages)`, 14/14 files, 390/390 tests, exit 0. Live tree byte-identical after the run: sha256 manifest of all 28 source files unchanged, `node_modules` listing/size/mtime unchanged (still only `.vite`/`.vitest-cache`). No lockfile edit was needed — `npm ci` succeeding from the shipped lock is the proof the lock still satisfies `package.json`. Fail-closed behaviour probed independently, each on its own 0700 temp copy: a suite importing an absent module gives exit 1 with `DID NOT LOAD ...` (the ticket's exact signature); a `*.test.ts` on disk that vitest does not collect gives exit 1 `1 of 15 test file(s) produced no result at all`; a `package.json` out of sync with the lock gives exit 1 `npm ci refused the install`; bad args/root exit 2. So a non-loading suite cannot be silently skipped — disk file count is compared with the JSON report and zero-assertion suites are named with their first error line. `npm test` is unchanged (`package.json` gains only `test:deployed`; `.forgejo/workflows/ci.yaml` untouched), and CI run #195 on this exact head is 14/14 green including `forgejo` and `pr-title`. Run #194 was red only in `pi-swarm-suite` on the identical tree; same job green in #191/#192/#193 and #195 with an empty diff outside `forgejo/` — classified as an owner-side flake and reported, not dismissed. Two non-blocking nits (no fix required here): (1) the success line asserts loading and failures only, so a suite whose tests are all `it.skip` reports `ok: ... 390/391 tests` and exit 0 — honest about loading, which is this ticket's bug class, but nothing in `forgejo/tests` uses `skip` today and a future assertion on skipped counts would harden it; (2) TESTING.md's `npm run test:deployed` "from a deployed drop" needs the drop to ship `scripts/`, which the live drop does not have yet and the deploy sync is not in this repo — the always-available checkout-plus-`PACKAGE_ROOT` path is documented too, so this is a redeploy-time note.
ld-reviewer left a comment
Collaborator

Verdict: APPROVED

model: omniroute/k3.1-pro
head: ba9e115906

tier: premium

Independent premium review of the exact one-commit diff against base e2b6f6e42bf534e240e28b9bf6d860352e03252d: only forgejo/TESTING.md, one test:deployed script entry, and executable forgejo/scripts/test-in-deployed-shape.sh (+289/-0). No production code, dependency versions, lockfile, or CI workflow changed. Exact-head CI run #195 is green in all 14 jobs.

I ran the runner from the exact-head archive against a separate 0700 deployed-shape copy. With typecheck enabled it exited 0: npm ci succeeded from the shipped lock, all 14/14 files and 390/390 tests passed, and the pinned typebox was 1.3.34. The input copy's before/after SHA-256 manifest was byte-identical. An independent missing-local-import suite exited 1 and was explicitly named DID NOT LOAD (14/15 files), proving the target partial-green failure now fails closed. bash -n passed; ShellCheck produced only style diagnostics.

NIT-1 is confirmed but non-blocking: a fully it.skip suite exited 0 and the runner printed ok: 15/15 files loaded and passed, 390/391 tests. The file did load—the ticket's required assertion—and no current test uses skip/only, but a follow-up should reject or explicitly report skipped counts rather than calling every file "passed".

NIT-2 is also non-blocking: the live drop is still exactly the base commit, so its lack of the new script/doc is expected pre-merge state. Both are in the exact-head archive and the repository clone is the deployment unit; the checkout-script-plus-PACKAGE_ROOT path is independently usable. No blocker open. Detailed evidence: working-files/homelab-2518/HOMELAB-2567-review-kimi-final.md.

## Verdict: APPROVED model: omniroute/k3.1-pro head: ba9e115906aaf221a0578a9d8d7c75e2f647e898 tier: premium Independent premium review of the exact one-commit diff against base `e2b6f6e42bf534e240e28b9bf6d860352e03252d`: only `forgejo/TESTING.md`, one `test:deployed` script entry, and executable `forgejo/scripts/test-in-deployed-shape.sh` (+289/-0). No production code, dependency versions, lockfile, or CI workflow changed. Exact-head CI run #195 is green in all 14 jobs. I ran the runner from the exact-head archive against a separate 0700 deployed-shape copy. With typecheck enabled it exited 0: `npm ci` succeeded from the shipped lock, all **14/14 files and 390/390 tests passed**, and the pinned `typebox` was 1.3.34. The input copy's before/after SHA-256 manifest was byte-identical. An independent missing-local-import suite exited 1 and was explicitly named `DID NOT LOAD` (14/15 files), proving the target partial-green failure now fails closed. `bash -n` passed; ShellCheck produced only style diagnostics. NIT-1 is confirmed but non-blocking: a fully `it.skip` suite exited 0 and the runner printed `ok: 15/15 files loaded and passed, 390/391 tests`. The file did load—the ticket's required assertion—and no current test uses skip/only, but a follow-up should reject or explicitly report skipped counts rather than calling every file "passed". NIT-2 is also non-blocking: the live drop is still exactly the base commit, so its lack of the new script/doc is expected pre-merge state. Both are in the exact-head archive and the repository clone is the deployment unit; the checkout-script-plus-`PACKAGE_ROOT` path is independently usable. No blocker open. Detailed evidence: `working-files/homelab-2518/HOMELAB-2567-review-kimi-final.md`.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
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
Homelab/pi-extensions!83
No description provided.