Skip to content

Beautiful, AI-native markdown IDE and LLM wiki

Drop prose locks from the sentinel signal-target tests (#5067)

Nick Gomez1f6f8a357885
diff --git a/lint-plugins/ok-rules/README.md b/lint-plugins/ok-rules/README.md
index d3280fc37..4ef884dfa 100644
--- a/lint-plugins/ok-rules/README.md
+++ b/lint-plugins/ok-rules/README.md
@@ -641,7 +641,7 @@ Rule: [`lint-plugins/ok-rules/rules/no-unconverted-git-pathspec.mjs`](rules/no-u
Owned-process signalling. `process.kill(target, signal)` — and the desktop test-support reaper seam `signalOwnedGroup` / `signalOwnedPids` / `reapOwnedTree` when no sender is injected (that seam is not on `main` yet — it lives on the unmerged `feat/ok-update-relaunch-substrate` branch, and the rule covers it ahead of time so the gate is in place the day it lands) — never receive a target that is (a) a literal `0`, `1` or `-1`, (b) a `?? <n>` / `|| <n>` fallback to a number, or (c) a parse of text — `Number(...)`, `parseInt(...)`, `parseFloat(...)`, or the `Number.` spellings of the latter two. A signal-`0` liveness probe (`process.kill(pid, 0)`) sends nothing and is exempt, whatever the target.
-**Why.** On POSIX, `kill(0, sig)` signals the caller's whole process group, `kill(-1, sig)` every process the user owns, and `kill(-pid, sig)` a group. On 2026-09-20 and 21 a desktop unit test killed every process on a developer's Mac three times, Terminal included: it called `signalOwnedGroup(1, 'SIGKILL')` to prove a guard refused it, a mutation loop had weakened the guard to `pid > 0`, and `process.kill(-1, …)` went through. The mutation loop was killed before its own revert step, so the mutant stayed on disk and every later run of the suite repeated the kill. The same sentinel shape was already live on `main`: `process.kill(pid ?? 0, 'SIGKILL')` in a test reaper, and `process.kill(Number(readFileSync(pidFile)), 'SIGKILL')` in a `finally` — an empty pidfile parses to `0`. Both shipped green: nothing in `pnpm lint` or `pnpm check` looked at what a kill was fed. Canonical prose: the "Never signal a pid you did not spawn" STOP rule in the workspace `AGENTS.md`, an internal guide the public mirror does not carry; this rule encodes its decidable subset and the two are kept in step by the fixture test.
+**Why.** On POSIX, `kill(0, sig)` signals the caller's whole process group, `kill(-1, sig)` every process the user owns, and `kill(-pid, sig)` a group. On 2026-09-20 and 21 a desktop unit test killed every process on a developer's Mac three times, Terminal included: it called `signalOwnedGroup(1, 'SIGKILL')` to prove a guard refused it, a mutation loop had weakened the guard to `pid > 0`, and `process.kill(-1, …)` went through. The mutation loop was killed before its own revert step, so the mutant stayed on disk and every later run of the suite repeated the kill. The same sentinel shape was already live on `main`: `process.kill(pid ?? 0, 'SIGKILL')` in a test reaper, and `process.kill(Number(readFileSync(pidFile)), 'SIGKILL')` in a `finally` — an empty pidfile parses to `0`. Both shipped green: nothing in `pnpm lint` or `pnpm check` looked at what a kill was fed. Canonical prose: the "Never signal a pid you did not spawn" STOP rule in the workspace `AGENTS.md`; this rule encodes its decidable subset.
**Sanctioned shapes.** Every shape in this list works on this head and needs no seam; only the injected sender below waits on one.
diff --git a/packages/server/src/lint-plugins/no-sentinel-signal-target.test.ts b/packages/server/src/lint-plugins/no-sentinel-signal-target.test.ts
index 416d87600..ddaa489f6 100644
--- a/packages/server/src/lint-plugins/no-sentinel-signal-target.test.ts
+++ b/packages/server/src/lint-plugins/no-sentinel-signal-target.test.ts
@@ -14,7 +14,6 @@ const REPO_ROOT = join(__dirname, '..', '..', '..', '..');
const RULE = 'no-sentinel-signal-target';
const FIXTURE_REL = `lint-plugins/ok-rules/__fixtures__/${RULE}.fixture.tsx`;
const README_REL = 'lint-plugins/ok-rules/README.md';
-const AGENTS_REL = 'AGENTS.md';
function lintFixture() {
const result = spawnSync('pnpm', oxlintFixtureArgs(FIXTURE_REL), {
@@ -46,7 +45,7 @@ describe('no-sentinel-signal-target oxlint rule', () => {
}
});
- test('the literal remedy sanctions a handle-derived pid negated for its group and names the detached precondition, in the diagnostic and the README alike', () => {
+ test('the literal remedy sanctions a handle-derived pid negated for its group and names the detached precondition', () => {
const literal = lintFixture().filter((d) =>
d.message.includes('Signal only a pid you spawned'),
);
@@ -55,11 +54,9 @@ describe('no-sentinel-signal-target oxlint rule', () => {
expect(fire.message).toContain('its pid taken from that handle');
expect(fire.message).toContain('negated for the group only if you spawned it detached');
}
- const readme = readFileSync(join(REPO_ROOT, README_REL), 'utf8');
- expect(readme).toContain('only if you spawned it detached');
});
- test('the parsed remedy names the handle you spawned and, for a pid you hold no handle for, its owner or a report, in the diagnostic and the README alike', () => {
+ test('the parsed remedy names the handle you spawned and, for a pid you hold no handle for, its owner or a report', () => {
const parsed = lintFixture().filter((d) =>
d.message.includes('Signal the `ChildProcess` you spawned'),
);
@@ -67,8 +64,6 @@ describe('no-sentinel-signal-target oxlint rule', () => {
for (const fire of parsed) {
expect(fire.message).toContain('stop that process through its owner, or report it');
}
- const readme = readFileSync(join(REPO_ROOT, README_REL), 'utf8');
- expect(readme).toContain('Stop that process through its owner, or report it');
});
test('every fire lands on a positive case and none on the negatives', () => {
@@ -88,13 +83,9 @@ describe('no-sentinel-signal-target oxlint rule', () => {
expect(readRuleScope(REPO_ROOT, RULE)).toEqual([]);
});
- test('the prose and the rule cite each other and the cited README heading exists', () => {
+ test('the README carries a heading for the rule, and the rule module exists', () => {
const readme = readFileSync(join(REPO_ROOT, README_REL), 'utf8');
expect(readme).toContain(`### \`${RULE}\``);
- expect(readme).toContain('Never signal a pid you did not spawn');
- const agents = readFileSync(join(REPO_ROOT, AGENTS_REL), 'utf8');
- expect(agents).toContain('Never signal a pid you did not spawn');
- expect(agents).toContain(`ok/${RULE}`);
expect(existsSync(join(REPO_ROOT, `lint-plugins/ok-rules/rules/${RULE}.mjs`))).toBe(true);
});
});