From 85aa9cc7fc0bddefdb247893884b3c315dbf2257 Mon Sep 17 00:00:00 2001 From: iam-truongtrungnghia <149591043+ttncode@users.noreply.github.com> Date: Sat, 21 Nov 2026 13:45:25 +0700 Subject: [PATCH 1/3] ci: run the unit tests on Node 22 node --test tests/ fails on Node 22 with "Cannot find module '.../tests'", so npm test ran no tests. Pass the quoted glob "tests/*.test.js", which Node 21+ expands itself on every shell, and move CI and release to Node 22. --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- .../brief.md | 25 +++ .../ledger.md | 4 + .../plan.md | 65 ++++++++ .../release.md | 21 +++ .../review.md | 44 ++++++ .../state.json | 146 ++++++++++++++++++ package.json | 2 +- 9 files changed, 308 insertions(+), 3 deletions(-) create mode 100644 .kiln/work/20261121-fix-test-command-so-runs-node/brief.md create mode 100644 .kiln/work/20261121-fix-test-command-so-runs-node/ledger.md create mode 100644 .kiln/work/20261121-fix-test-command-so-runs-node/plan.md create mode 100644 .kiln/work/20261121-fix-test-command-so-runs-node/release.md create mode 100644 .kiln/work/20261121-fix-test-command-so-runs-node/review.md create mode 100644 .kiln/work/20261121-fix-test-command-so-runs-node/state.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91be099..f154f13 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: npm - run: npm ci - name: Unit tests diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69070a2..0eae9fb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 cache: npm - run: npm ci - name: Refuse to release without the updater public key diff --git a/.kiln/work/20261121-fix-test-command-so-runs-node/brief.md b/.kiln/work/20261121-fix-test-command-so-runs-node/brief.md new file mode 100644 index 0000000..3876e8d --- /dev/null +++ b/.kiln/work/20261121-fix-test-command-so-runs-node/brief.md @@ -0,0 +1,25 @@ +# Brief — test command runs on Node 22; CI on Node 22 + +Follows spike 20261121-review-each-items-above-one-one, finding F4 (audit item 2). + +## What is asked +- Who: the maintainer and any contributor running the unit tests. +- What: `npm test` must run the unit suite on current Node; CI and release must run on Node 22. +- Success: `npm test` passes 214 of 214 on Node 22.17; workflows set `node-version: 22`. +- Constraint: nothing else changes. + +## What I found +- `package.json:7` is `node --test tests/`. On Node 22.17.1 it fails: `Cannot find module '/home/ttndev/workspace/personal/notelet/tests'`. +- `node --test "tests/*.test.js"` passes 214 of 214 on Node 22.17.1. Node 22 expands the quoted glob itself, so it does not depend on the shell (Windows CI uses pwsh/cmd for `npm test`). +- `.github/workflows/ci.yml:18` and `.github/workflows/release.yml:16` pin `node-version: 20`. +- Every test file is `tests/*.test.js`; `tests/dom.js` is a helper, not a test, and must not run as one. The glob excludes it. +- `test:e2e` names one file and is unaffected. + +## Still unknown +- None blocking. Node 20's end of life (April 2026) is from my knowledge, not checked. + +## Past learnings +- None: no learnings store (`.kiln/learnings/` does not exist), recall not run. + +## Design (bounded: two sentences) +Change the script to the quoted glob, and set both workflows to Node 22. No new file, no new dependency. diff --git a/.kiln/work/20261121-fix-test-command-so-runs-node/ledger.md b/.kiln/work/20261121-fix-test-command-so-runs-node/ledger.md new file mode 100644 index 0000000..08e6670 --- /dev/null +++ b/.kiln/work/20261121-fix-test-command-so-runs-node/ledger.md @@ -0,0 +1,4 @@ +Pre-flight: no shared interfaces +Task 1: Step 1 matched (Cannot find module .../tests). +Task 1: complete (tests: node --test "tests/*.test.js" -> exit 0; npm test -> 214 pass, 0 fail) +Ruling: recorded with --phase full, since the project has no fast phase (test_fast blank) - cost if wrong: none. diff --git a/.kiln/work/20261121-fix-test-command-so-runs-node/plan.md b/.kiln/work/20261121-fix-test-command-so-runs-node/plan.md new file mode 100644 index 0000000..481e54b --- /dev/null +++ b/.kiln/work/20261121-fix-test-command-so-runs-node/plan.md @@ -0,0 +1,65 @@ +# Test command on Node 22 — Implementation Plan + +> **For agentic workers:** REQUIRED SUB-SKILL: use kiln-implement to work this plan task by task. Steps use checkbox (`- [ ]`) syntax, and a checked box is a claim kiln re-checks rather than believes. + +**Goal:** `npm test` runs the unit suite on Node 22, and CI and release run on Node 22. + +**Architecture:** Replace the folder argument with a quoted glob that Node expands itself; bump `node-version` in both workflows. + +**Tech Stack:** Node `node:test`, GitHub Actions `actions/setup-node@v4`. + +**Spec:** `.kiln/work/20261121-fix-test-command-so-runs-node/brief.md` + +## Global Constraints + +- Test script: exactly `node --test "tests/*.test.js"` (JSON-escaped in package.json). +- Workflows: `node-version: 22`. +- No new dependency, no other file. + +## Risk flags + +- none + +## I/O & Edge-Case Matrix + +| Scenario | Input / State | Expected Output / Behavior | Error Handling | +|----------|---------------|----------------------------|----------------| +| Node 22 run | `npm test` on Node 22.17 | 214 tests, 214 pass | n/a | +| Helper file | `tests/dom.js` exists | not run as a test file (glob needs `.test.js`) | n/a | + +## Review Focus + +- Windows shell quoting: `npm test` runs through cmd.exe on the CI runner; the double quotes must reach Node so Node, not the shell, expands the glob. Covered by CI's "Unit tests" step on windows-2022; not runnable here. +- Node 20 locally: the glob form requires Node ≥ 21 for glob expansion; on Node 20 it would look for a file literally named `tests/*.test.js`. Acceptable because both workflows move to 22; noted for contributors. + +--- + +### Task 1: Test script and workflows + +**Files:** +- Modify: `package.json:7` +- Modify: `.github/workflows/ci.yml:18` +- Modify: `.github/workflows/release.yml:16` + +**Acceptance:** +- `npm test` passes 214 of 214 on Node 22.17. +- Both workflows set `node-version: 22`. + +**Verification:** `npm test` → `# pass 214` and `# fail 0`. +**Depends on:** none · **Size:** S + +**Interfaces:** +- Consumes: none +- Produces: none + +- [ ] **Step 1: Run the current command to see it fail** + +Run: `npm test` +Expected: FAIL with `Cannot find module '/home/ttndev/workspace/personal/notelet/tests'` + +- [ ] **Step 2: Set `"test": "node --test \"tests/*.test.js\""` in `package.json:7`; set `node-version: 22` in `.github/workflows/ci.yml:18` and `.github/workflows/release.yml:16`** + +- [ ] **Step 3: Run the command to see it pass** + +Run: `npm test` +Expected: `# tests 214`, `# pass 214`, `# fail 0` diff --git a/.kiln/work/20261121-fix-test-command-so-runs-node/release.md b/.kiln/work/20261121-fix-test-command-so-runs-node/release.md new file mode 100644 index 0000000..11a7b24 --- /dev/null +++ b/.kiln/work/20261121-fix-test-command-so-runs-node/release.md @@ -0,0 +1,21 @@ +# 20261121-fix-test-command-so-runs-node — test command on Node 22 + +## Change +- Fixed: `npm test` runs the unit suite on Node 22, and CI and release builds run on Node 22. Nothing changes for people using the app. + +## Before release +- [x] The change carries no migration and reads no new configuration value. (checked) +- [x] `kiln verify` ran the full unit suite (`npm test`'s new form): exit 0, 214 of 214 pass on Node 22.17.1. (checked) +- [ ] The CI "Unit tests" step on windows-2022 shows `# tests 214` on this pull request. (confirm) + +## Release steps +1. Merge the pull request once CI is green. +2. Nothing else: the release workflow picks up Node 22 at the next `v*` tag. + +## After release +- [ ] The next `v*` tag's Release run passes its `npm test` step on Node 22. (confirm) + +## Rollback +- Trigger: CI or the Release run fails on Node 22 in its install or unit-test step. +- Steps: `git revert` the merge commit, then open and merge that pull request. +- Time: one revert pull request. diff --git a/.kiln/work/20261121-fix-test-command-so-runs-node/review.md b/.kiln/work/20261121-fix-test-command-so-runs-node/review.md new file mode 100644 index 0000000..9c721c4 --- /dev/null +++ b/.kiln/work/20261121-fix-test-command-so-runs-node/review.md @@ -0,0 +1,44 @@ +# Review — 20261121-fix-test-command-so-runs-node + +lenses: reviewer reported, blind-hunter reported, edge-case-hunter reported, verification-gap reported, intent-alignment reported, code-review-specialist reported, security-auditor reported, test-engineer reported + +Scope — predicted 3 · actual 3 + +Rules: no rule is routed to this change, so there is no checklist. + +Bar: nothing lowers the bar. + +## Triage log + +| # | Reader(s) | Location | Finding | Verdict | Grade | Route | +|---|---|---|---|---|---|---| +| 1 | verification-gap, edge-case, blind, security, code-review, reviewer, test-engineer | package.json (no `engines`), README.md:141-146 | Nothing tells a contributor Node ≥ 21 is needed; on Node 20 `npm test` fails loudly with a "Could not find" error | real: Node 21+ expands the glob (doc/api/test.md); README names no Node version | Minor · Possible | note | +| 2 | edge-case, reviewer, code-review, test-engineer | package.json:7 | `tests/*.test.js` does not recurse; a future `tests/sub/x.test.js` would be skipped | real but no subfolder exists today (`tests/` has 24 `*.test.js` files and `dom.js`) | Minor · Unlikely | drop | +| 3 | test-engineer | package.json:7 | a glob that matches nothing exits 0 with 0 tests, so a moved `tests/` folder would pass CI | real: `node --test "nonexist/*.test.js"` exited 0 here | Minor · Unlikely | drop | +| 4 | intent, reviewer, code-review, test-engineer | package.json:7 on windows-2022 | cmd.exe quoting not run here | not a defect: Node's own docs recommend the double-quoted form; CI's "Unit tests" step shows `# tests 214` | Minor · Unlikely | note (Not checked) | +| 5 | blind | ci.yml:18, release.yml:16 | Node version copied in two workflows | pre-existing pattern, not introduced here | — | deferred | +| 6 | blind | PR body | the PR should say what broke | taken: the PR body states the Node 22 error | — | note (SHIP) | +| 7 | blind | CI e2e and `npx tauri build` | not exercised on Node 22 by this diff | real gap; CI runs both on the PR | Minor · Unlikely | note | +| 8 | blind, intent | .gitignore | the kiln line is in the tree but not in the diff | kiln setup, not this change; kept out of the change's paths | — | declined to judge | +| 9 | blind | changelog | no changelog entry | false: the repository has no changelog file (`git ls-files` finds none) | false | drop | +| 10 | security | release.yml, ci.yml | third-party actions pinned by tag; msedgedriver-tool unpinned | pre-existing, outside the diff | — | deferred | +| 11 | security, reviewer, code-review, test-engineer | repo root | empty sandbox placeholder dotfiles are untracked | not part of the change; SHIP stages named paths only | — | declined to judge | + +## Fixed + +None: no finding landed in a fix-now cell. + +## Rulings + +- Ruling: finding 1 (Node version note) is not added — the brief says nothing else changes, and the failure is loud, not silent — cost if wrong: a contributor on Node 20 reads one confusing error. + +## Deferred + +- Node version kept in two workflows; `actions/setup-node` can read `node-version-file` once `engines` or `.nvmrc` exists (finding 5). +- Pin third-party actions to commit SHAs, and `cargo install --git` msedgedriver-tool with `--rev` and `--locked` (finding 10). + +## Declined to judge + +- The `.gitignore` kiln line and `.kiln/`: kiln setup, not this change. +- Empty read-only dotfiles at the repo root (`.bashrc`, `.mcp.json`, `.claude/…`): sandbox placeholders, not the user's files. +- Node 20's end-of-life date: changes nothing about correctness. diff --git a/.kiln/work/20261121-fix-test-command-so-runs-node/state.json b/.kiln/work/20261121-fix-test-command-so-runs-node/state.json new file mode 100644 index 0000000..bdacfd4 --- /dev/null +++ b/.kiln/work/20261121-fix-test-command-so-runs-node/state.json @@ -0,0 +1,146 @@ +{ + "schema_version": 1, + "id": "20261121-fix-test-command-so-runs-node", + "follows": "20261121-review-each-items-above-one-one", + "status": "reviewed", + "session_id": "0b73138a-cf32-4ba7-ac23-30a61cd6d8d6", + "path": "bounded", + "type": "ci", + "auto": false, + "stage": "VERIFY", + "step": null, + "gates": { + "plan": { + "decision": "approved", + "artifact_sha": "d909bc3111c71124ff3a5217abc16094cc98272dcf17075ad395787c41caf8f4", + "answer": "ruled by auto mode, not by the user", + "by": "auto", + "at": "2026-11-21T06:41:22.042Z" + }, + "review": { + "decision": "approved", + "artifact_sha": "1fa7f61f2c61dcbac845a14ee0989d3280d305254ecd6b0aa77524302ed2852b", + "answer": "ruled by auto mode, not by the user", + "by": "auto", + "at": "2026-11-21T06:44:50.515Z" + } + }, + "predicted": [ + { + "path": "package.json" + }, + { + "path": ".github/workflows/ci.yml" + }, + { + "path": ".github/workflows/release.yml" + } + ], + "base": "10da06c82d4f1920b2252dcdac2559cc86786f8f", + "last_verified": "10da06c82d4f1920b2252dcdac2559cc86786f8f", + "dirty_at_open": [ + ".gitignore" + ], + "verify": [ + { + "id": "unit", + "cmd": "node --test \"tests/*.test.js\"", + "exit": 0, + "ms": 3598, + "range": "10da06c82d4f1920b2252dcdac2559cc86786f8f..10da06c82d4f1920b2252dcdac2559cc86786f8f", + "phase": "full", + "tree": "dfd84b0caf6f2e8dc57092c59b0489487d5042ef" + }, + { + "id": "unit", + "cmd": "node --test \"tests/*.test.js\"", + "exit": 0, + "ms": 5455, + "range": "10da06c82d4f1920b2252dcdac2559cc86786f8f..10da06c82d4f1920b2252dcdac2559cc86786f8f", + "phase": "full", + "tree": "65e3189a01c595dc7702427d08be04076745be4d" + }, + { + "id": "unit", + "cmd": "node --test \"tests/*.test.js\"", + "exit": 0, + "ms": 5474, + "range": "10da06c82d4f1920b2252dcdac2559cc86786f8f..10da06c82d4f1920b2252dcdac2559cc86786f8f", + "phase": "full", + "tree": "65e3189a01c595dc7702427d08be04076745be4d" + } + ], + "pass": 1, + "carry_over": [], + "displaced": [], + "rules": [ + { + "stage": "plan", + "files": [] + }, + { + "stage": "review", + "files": [] + } + ], + "knowledge": [], + "practices": [ + { + "stage": "investigate", + "ids": [] + }, + { + "stage": "plan", + "ids": [ + "planning-and-task-breakdown" + ] + }, + { + "stage": "implement", + "ids": [ + "incremental-implementation", + "test-driven-development", + "source-driven-development", + "ci-cd-and-automation" + ] + }, + { + "stage": "review", + "ids": [ + "reviewer", + "blind-hunter", + "edge-case-hunter", + "verification-gap", + "intent-alignment", + "code-review-specialist", + "security-auditor", + "test-engineer" + ] + }, + { + "stage": "ship", + "ids": [ + "git-workflow-and-versioning", + "shipping-and-launch" + ] + } + ], + "snapshots": [ + { + "name": "task/0", + "commits": { + ".": "320e798bf757f16f72d8f1f0841d0702a396719a" + }, + "at": "2026-11-21T06:41:22.082Z" + }, + { + "name": "task/1", + "commits": { + ".": "fc6c94f88f861e7a39033d4b5bb652b72e154aac" + }, + "at": "2026-11-21T06:42:14.921Z" + } + ], + "baseline": null, + "checklist": [] +} diff --git a/package.json b/package.json index c93a66b..39ec1ec 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "type": "module", "scripts": { - "test": "node --test tests/", + "test": "node --test \"tests/*.test.js\"", "tauri": "tauri", "test:e2e": "node --test tests-e2e/app.e2e.js" }, From f154efb473e033ec5d9c16e2ab99afca1b20e3ec Mon Sep 17 00:00:00 2001 From: iam-truongtrungnghia <149591043+ttncode@users.noreply.github.com> Date: Sat, 21 Nov 2026 13:50:39 +0700 Subject: [PATCH 2/3] chore: record the shipped work's pull request --- .../20261121-fix-test-command-so-runs-node/state.json | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.kiln/work/20261121-fix-test-command-so-runs-node/state.json b/.kiln/work/20261121-fix-test-command-so-runs-node/state.json index bdacfd4..e1690e2 100644 --- a/.kiln/work/20261121-fix-test-command-so-runs-node/state.json +++ b/.kiln/work/20261121-fix-test-command-so-runs-node/state.json @@ -2,7 +2,7 @@ "schema_version": 1, "id": "20261121-fix-test-command-so-runs-node", "follows": "20261121-review-each-items-above-one-one", - "status": "reviewed", + "status": "shipped", "session_id": "0b73138a-cf32-4ba7-ac23-30a61cd6d8d6", "path": "bounded", "type": "ci", @@ -142,5 +142,11 @@ } ], "baseline": null, - "checklist": [] + "checklist": [], + "opened": [ + "https://github.com/ttncode/notelet/pull/103" + ], + "branches": { + ".": "ci/20261121-fix-test-command-so-runs-node" + } } From 364dfd020a3ae245213092076f4815a53969ccc9 Mon Sep 17 00:00:00 2001 From: iam-truongtrungnghia <149591043+ttncode@users.noreply.github.com> Date: Sat, 21 Nov 2026 14:11:34 +0700 Subject: [PATCH 3/3] chore: drop a local path from the work record --- .kiln/work/20261121-fix-test-command-so-runs-node/brief.md | 2 +- .kiln/work/20261121-fix-test-command-so-runs-node/plan.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.kiln/work/20261121-fix-test-command-so-runs-node/brief.md b/.kiln/work/20261121-fix-test-command-so-runs-node/brief.md index 3876e8d..fd13441 100644 --- a/.kiln/work/20261121-fix-test-command-so-runs-node/brief.md +++ b/.kiln/work/20261121-fix-test-command-so-runs-node/brief.md @@ -9,7 +9,7 @@ Follows spike 20261121-review-each-items-above-one-one, finding F4 (audit item 2 - Constraint: nothing else changes. ## What I found -- `package.json:7` is `node --test tests/`. On Node 22.17.1 it fails: `Cannot find module '/home/ttndev/workspace/personal/notelet/tests'`. +- `package.json:7` is `node --test tests/`. On Node 22.17.1 it fails: `Cannot find module '/tests'`. - `node --test "tests/*.test.js"` passes 214 of 214 on Node 22.17.1. Node 22 expands the quoted glob itself, so it does not depend on the shell (Windows CI uses pwsh/cmd for `npm test`). - `.github/workflows/ci.yml:18` and `.github/workflows/release.yml:16` pin `node-version: 20`. - Every test file is `tests/*.test.js`; `tests/dom.js` is a helper, not a test, and must not run as one. The glob excludes it. diff --git a/.kiln/work/20261121-fix-test-command-so-runs-node/plan.md b/.kiln/work/20261121-fix-test-command-so-runs-node/plan.md index 481e54b..83b777d 100644 --- a/.kiln/work/20261121-fix-test-command-so-runs-node/plan.md +++ b/.kiln/work/20261121-fix-test-command-so-runs-node/plan.md @@ -55,7 +55,7 @@ - [ ] **Step 1: Run the current command to see it fail** Run: `npm test` -Expected: FAIL with `Cannot find module '/home/ttndev/workspace/personal/notelet/tests'` +Expected: FAIL with `Cannot find module '/tests'` - [ ] **Step 2: Set `"test": "node --test \"tests/*.test.js\""` in `package.json:7`; set `node-version: 22` in `.github/workflows/ci.yml:18` and `.github/workflows/release.yml:16`**