Repository navigation
fix(check): fail the run and keep evidence when teardown leaves processes behind - #1672
Conversation
A check could report success while its teardown failed: endGroup only printed a process group that outlived SIGKILL, the herdr session stops ignored their exit status, and cleanup swallowed exceptions before removing the isolated directory. - endGroup returns an outcome (gone, surviving or error, the pgid, the signals tried and the cause). Only ESRCH proves the group empty; EPERM counts as a process still there. TERM, then KILL, keep their grace. Narrow kill/clock/wait seams make the escalation testable. - Teardown stops every live herdr session (one whose socket is gone was already stopped; herdr answers its stop with exit 1), checks each stop's error, signal and status, and keeps going after a failure. It removes the implicit isolation directory only when nothing failed, process groups included; otherwise it keeps the directory and prints its absolute path. - The report lists teardown failures in errors and the kept directory in evidence.retained. A passing run then exits 1 with status failure. An interrupted run keeps 130/143 and interrupted, never verified. Failures on the signal and output-drain paths settle instead of becoming unhandled rejections. CHECK_DIR stays the caller's, and output claims are still released at exit, after the final report. - docs/development.md describes the kept directory. Checked with bun run check fast and bun test ./scripts/check.test.ts ./scripts/check-report.test.ts. The new tests cover a leaderless group, SIGKILL that cannot empty a group, EPERM, a cleanup exception, a zero-exit command whose teardown fails, and SIGTERM/SIGINT keeping 143/130 with the kept directory. The CLI fixtures use a herdr stand-in. An isolated check run against real herdr still passes and removes its directory when one session is left running and another is already stopped. No inherited-environment policy, runner routing or workflow changes.
A command that exited 0 with its output closed could leave a process running in its group: the run forgot the group, passed and removed its isolated directory. Every step's process group is now tracked until it is proved empty, ended when the step ends (closed output or not, the concurrent unit tests included) and swept again before the teardown. An interrupt whose step group could not be stopped waited for that step forever. The run now records the failure, keeps its isolated state and exits 130/143 without waiting for a step it could not stop. Bound each lifecycle step of the leaderless-group test so a stall fails with where it stopped, and size the CLI fixture deadlines for a loaded PC.
Carry main's Ovis environment names into the teardown fixtures and wait for the leaderless descendant's signal handler before testing it. Drive surviving groups and permission failures through the CLI seam so successful commands cannot hide teardown failures, and cap interrupted output draining.
Probe failed session stops before retaining evidence: refused or missing sockets prove the isolated server is gone. Await probes before state removal. Exercise escaped stdout and overlapping SIGINT cleanup through deterministic seams, share pending group termination, and print drain failures. Restore the unrelated source-identity test timeout and assert grace bounds rather than poll arithmetic.
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Summary
Merge Risk: ⚪ Minimal · up to
|
Review of #1672: the descendant waited on the stdin it inherits and sometimes exited on its own (8 failures in 410 runs, 'did not reach SIGTERM ... ENOENT'), which would turn Fast checks red. It now stays alive on a timer and SIGUSR1 releases it: 150 runs, 0 failures. The source-identity test gets its 180 s timeout back: it starts three nested runs, each allowed 30 s plus a slot wait, so bun's 5 s default fails it locally (CI passes --timeout 60000).
|
CodeRabbit reviewed this PR (no actionable comments). A code-review agent also reviewed it three times before the merge; findings and how each was resolved: Round 1 (APPROVE, 2 should-fix + 4 notes), fixed in 6879ca0
Round 2 (REQUEST_CHANGES), fixed in 979f8be
Round 3: APPROVE. The diff is only those two test changes; the reviewer saw 150/150 leaderless runs pass. Left as a follow-up (low priority). After a spawn "error" event, the step's process group stays tracked until the final cleanup ( Evidence from this PR's own CI: the Fast checks and Integration tests reports ( |
….*.ts (#1673) First PR of the i18n split: the strings that only the Settings dialog's files use move out of the three big dictionaries into `src/lib/i18n/settings.{ko,ja,zh}.ts`. `t()`, the English keys, every translation, placeholders, the English fallback and all call sites stay the same. ## What changes - **Moved:** 281 keys in each language. The entry lines are cut byte for byte from `src/lib/i18n.{ko,ja,zh}.ts` and keep the order they had in each language's file. A key moves only when every file that uses it is a Settings file: `components/SettingsDialog.tsx` (with `THEME_NAMES`), `components/KeyBarSettings.tsx`, `components/SettingsControls.tsx`, `components/TelemetryControls.tsx` and `lib/paletteSettings.ts`. A key another feature also uses stays in the base file, for example "Settings" (also used in CommandPalette and MachineSidebar) and "Pin/Unpin agent" (AgentSidebar). The `// ---- <area> ----` sections are not used to decide ownership: the 281 keys come from 12 different sections. - **Composition:** each base file renames its object to `BASE` and exports `KO_PARTS` / `JA_PARTS` / `ZH_PARTS` (`{ base, settings }`). `KO` / `JA` / `ZH` are built from those parts with `Object.assign` and keep their names and paths, so `src/lib/i18n.ts` and the three scripts that import them by path are untouched. The first sentence of each base header now says what the base file holds. - **`src/lib/i18n.test.ts`:** - The scan for `t()` calls now skips `lib/i18n/`. The old file-name regex does not match the part files, and a dictionary header contains `t("…")`. - New "dictionary parts" tests fail when a key is in two parts, since a spread silently keeps only the last copy. They report the key and both part names, and also check that the composed size equals the sum of the parts. - They also fail when the three languages keep a key in different parts, or when a part file passes 400 lines. - **`CONTRIBUTING.md`:** the UI text rule now says where a feature's new strings go. A string only one feature's files use goes in that feature's `src/lib/i18n/` files when it has them; any other string, or one a second feature starts using, goes in the base files. This is not a move-only PR: alongside the moved lines it adds the composition, the tests and the docs rule. The following split PRs (terminal, composer, chat, …; one at a time) will contain only moved lines, one import and one parts entry per feature, and the part file header. ## Key list I regenerated the list on this branch's base, `dc70d60a`, with the ownership script from the split plan. That script collects keys the same way as `i18n.test.ts`: `t()`/`tt()` literals plus the 13 label maps, recorded per file. The list is identical to the plan's list from `8b5aaba2`, with no difference. Main moved only by #1672, which touches no i18n file. ## Checks - **Same dictionaries:** the composed `KO`, `JA` and `ZH` (every key and value) dumped as sorted JSON on `dc70d60a` and on this branch are byte-identical (`EQUIVALENT`). - **Only moved lines plus the composition:** `git diff --color-moved=plain origin/main...HEAD` over the six dictionary files shows every entry line as moved. The 72 non-moved `+`/`-` lines, 24 per language, are: - the import and a blank line; - the 1-line header sentence, rewrapped to 3 lines; - `export const KO … = {` → `const BASE … = {`; - the 8-line parts block and composition; - the part file's 6-line header, its `export const` line and its closing `};`. - **Same keys moved:** the keys of `SETTINGS_KO`, `SETTINGS_JA` and `SETTINGS_ZH` each equal the 281-key list (`SAME-KEYS` for ko, ja and zh). The scan still finds all 1,389 keys, the same count as main. - **Part sizes:** each part file is 289 lines. `i18n.ko.ts` goes from 1,449 to 1,180 lines, `i18n.ja.ts` from 1,451 to 1,182 and `i18n.zh.ts` from 1,453 to 1,184. - `HERDR_TEST_MODE=unit bun test src/lib/i18n.test.ts`: 21 pass, 0 fail. The missing, unused, placeholder and untranslated tests still run on the composed dictionaries. - Before opening, the new tests were run against two deliberate breakages in a throwaway copy. A base key added to `SETTINGS_KO` fails with `Settings (base, settings)`. One key moved back to the ja base fails the placement test. - `bun run typecheck`: passes. Both tsconfigs compile, including the three browser scripts that import `KO`/`JA`/`ZH`. - `bun run check fast`: passes. Nothing drops out of a check's scope: no test file moves, `scripts/ci-tests.ts` finds tests with a recursive glob, and `src/conventions.test.ts` scans `src/**/*.{ts,tsx}`, which includes `src/lib/i18n/`. ## Overlap with open PRs #1639, #1598 and #1427 also edit `src/lib/i18n.{ko,ja,zh}.ts`. None of them changes any of the moved lines; all three only add keys. If one of them merges first, this branch is rebased, the key list is regenerated, and any new Settings-only key moves into the part. If this PR merges first, a new Settings-only key goes in `settings.*.ts` under the new CONTRIBUTING rule. #1639 adds strings to `SettingsDialog.tsx`, so its keys are the likely case. No changelog fragment: users see no change.
….*.ts (#1674) Second PR of the i18n split (#2 in the split plan, after the Settings pilot #1673). The strings that only the terminal's files use move out of the three base dictionaries into `src/lib/i18n/terminal.{ko,ja,zh}.ts`. `t()`, the English keys, every translation, placeholders, the English fallback and all call sites stay the same. ## What changes - **Moved:** 113 keys in each language, byte for byte, in the order each language's file had them. A key moves only when every file that uses it is a terminal file: `components/PaneTerminal.tsx`, `components/PaneCanvas.tsx`, `components/KeyBar.tsx` (with its `ARROWS` and `KEY_SPOKEN_NAMES` label maps), `components/FindBar.tsx`, `components/TerminalViewportTools.tsx`, `components/SplitDropPreview.tsx`, `components/TabStrip.tsx`, `lib/terminalLabel.ts` and `lib/tabName.ts`. Keys these files share with another feature stay in the base files. - **Composition:** each base file gains one import and one `KO_PARTS` / `JA_PARTS` / `ZH_PARTS` entry (`terminal: TERMINAL_KO`, …). Nothing else in the base files changes. - No test, docs or CONTRIBUTING change: the pilot's tests already cover every part, and CONTRIBUTING already says where a feature's strings go. ## Key list I regenerated the list with the split plan's ownership script on this branch's base, `a717621f`. That script collects keys the same way as `i18n.test.ts`: `t()`/`tt()` literals plus the 13 label maps, recorded per file. It finds 113 terminal keys, identical to the plan's list from `8b5aaba2`, with no key added or removed. Since then main gained only #1672 (no i18n change) and the pilot #1673 (which moved only Settings-only keys). ## Checks - **Same dictionaries:** the composed `KO`, `JA` and `ZH` (every key and value) dumped as sorted JSON on `a717621f` and on this branch are byte-identical (`EQUIVALENT`). - **`--color-moved` summary:** `git diff --color-moved=plain origin/main...HEAD` over the base and part files shows all 339 removed entry lines (113 × 3) as moved. The only non-moved lines are 33 added lines, 11 per language: - the import; - the parts entry; - the part file's 7-line header, its `export const` line and its closing `};`. No line is removed other than moved entries. - **Same keys moved:** the keys of `TERMINAL_KO`, `TERMINAL_JA` and `TERMINAL_ZH` each equal the 113-key list (`SAME-KEYS` for ko, ja and zh). The scan still finds all 1,389 keys, the same count as main. - **Part sizes:** each part file is 122 lines, under the 400-line cap. `i18n.ko.ts` goes from 1,180 to 1,069 lines, `i18n.ja.ts` from 1,182 to 1,071 and `i18n.zh.ts` from 1,184 to 1,073. - `HERDR_TEST_MODE=unit bun test src/lib/i18n.test.ts`: 21 pass, 0 fail. This covers missing, unused, placeholder and untranslated entries, a key in two parts, and different placement across languages. - `bun run typecheck`: passes. - `bun run check fast`: passes (unit 6127 pass, 0 fail, 12 skip; workflow syntax, generated types/themes, typecheck and build ok). This PR contains only moved lines, one import and one parts entry per language, and the part file header. It should qualify for the move-only merge path if the parts entry and header are counted as part of the move. ## Note After this move the `// ---- key bar ----` section comment in each base file has no entries left: its keys went to Settings (#1673) and here. The comment is left in place to keep this diff move-only; the last split PR can drop empty section comments. No changelog fragment: users see no change.
Closes #1612.
Change
bun run checkused to log a teardown problem and still report success: a process group that survived KILL, or an isolated herdr session that would not stop. It also deleted the temporary isolation directory, so the evidence was gone. On the self-hosted CI PC this let stray servers pile up unseen; one such leftover isherdr --session check-6e16b1, alive for 16 hours from another worktree's run.scripts/check.tsreport.errors, and a run whose tests pass but whose teardown fails exits 1. The implicit isolation directory is then kept and its absolute path printed. A caller-namedCHECK_DIRbehaves as before.Elsewhere
scripts/check-report.ts: records teardown errors.docs/development.md: says where kept evidence goes.scripts/check.test.ts,scripts/check-report.test.ts): they use injectable seams for signals, probes and the clock, with no fixed sleeps. They cover:Review
The branch was started in an earlier session (2 commits). An independent review then found three problems:
This PR rebases those commits onto main and fixes all three. A code-review agent then reviewed the whole branch: APPROVE, with two should-fix items and four notes, all fixed in 6879ca0:
Validation
HERDR_TEST_MODE=unit bun test scripts/check.test.ts scripts/check-report.test.ts --rerun-each 10: 520 pass, 0 fail.bun run check fast: exit 0 (6,122 pass, 0 fail).check runstarted its isolated servercheck-3c8fedand left noherdr --sessionprocess behind. The /proc snapshots before and after list none started from the worktree, and the final group probe returned ESRCH.interrupted, the group and EPERM named, the directory kept.Not changed:
.github/workflows/*, runner labels,CHECK_MAX_RUNS. Linux only was exercised locally; this PR's CI covers the native Windows install.No changelog fragment: CI and contributor tooling only.