Skip to content

test: record pid readers per file so two green PRs merge green - #37661

Merged
KiroCrewCaptain merged 2 commits into
mainfrom
crew/linuxflackyguard/pid-reader-per-file
Nov 15, 2026
Merged

KiroCrewCaptain merged 2 commits into
mainfrom
crew/linuxflackyguard/pid-reader-per-file

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The pid-reader ratchet stays green on main when two pull requests that each change pid readers in different files both merge.

test/test_pid_reader_ratchet.py recorded the whole tree in two numbers, _BASELINE_SITES = 143 and _BASELINE_OWNER_MARKED = 13. Two PRs that each mark one reader both rewrite 13 to 14; git merges the identical edit cleanly and main holds 15. That turned the Static Ratchet Gate red on main on 2026-11-08 20:17–21:57 PST (run 42561010120: 9 owner-marked pid reader(s) in src, recorded 8), fixed by the re-pin #33695.

Why it matters

The Static Ratchet Gate runs on every PR, so a red main here fails every open PR until someone re-pins the number.

Not a goal

  • No loosening: every count stays exact, and a new unmarked reader still fails.
  • No change to what the scanner counts (needles, owner marker, reflective reads, retired spellings).
  • test_kill_chokepoint_ratchet.py's single BYPASS_BASELINE is not changed here.
  • No workflow, ruleset or repository-setting change.

What changed (motivation → approach → change)

Cause: one shared number is the one line two PRs edit to the same value. Change: record the same counts one line per file.

  • _BASELINE is a {file: (counted, owner-marked)} table, measured on this base: 48 files, 143 counted, 13 owner-marked (the same totals as before).
  • The scan now also keeps owner-marked sites per file (Scan.owner_per_file).
  • Both exact tests compare per file. A failure prints the exact _BASELINE line to write for each drifted file (or "delete the line"), and a rise keeps the old "this change ADDS a reader" message.
  • New tests: the drift helper names each file and line; the table holds no (0, 0) entry (it would never go stale); the owner-marker fixture also checks the per-file pair.
  • docs/system-specs/modules/runtime-ownership.md describes the per-file record.

Two PRs that touch different files now edit different lines. Two PRs that touch the same file edit the same line and conflict, which is git doing the check. Residual: two PRs that move one file's entry to the same pair.

Backwards compatibility

Compatible: test and docs only; no product code changes.

Removes nothing: _BASELINE_SITES and _BASELINE_OWNER_MARKED are replaced by the per-file table holding the same totals, and no other file reads them (git grep on this base finds only this test and the spec updated here).

Tests

Two-branch merge simulation (scratch clone; branches A and B cut from one base, each adds one owner-marked _pid reader, A in session_pool.py and B in connections/mint_kas.py, and updates the record as the test asks; then git merge):

Base git merge owner-marked test
origin/main e58284e clean FAILED 15 owner-marked pid reader(s) in src, recorded 14
this branch clean passed

Negative control on this branch: an unmarked proc._pid added to session_pool.py without a table edit fails with this change ADDS a place that reads a runtime's pid and "session_pool.py": (10, 2), # was (9, 2).

Determinism: the file 3× serial (-n0) and once with -n 3 --dist load: 14 passed each time. Related backend set (scripts/run_scoped_tests.py): 20 passed.

Proof: not provable -- test-only change

Manual verification

N/A — test-only; the simulation above is the behavioral check.

Related Issues

Part of #37656

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@bolichen97
bolichen97 requested review from a team and KiroCrewCaptain as code owners November 15, 2026 18:34
@bolichen97
bolichen97 requested a review from CrysisDeu November 15, 2026 18:34
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 15, 2026
@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision 794f01353755b6df80cf1070a48515878da29210 ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Does not block merge.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 794f01353755b6df80cf1070a48515878da29210 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 794f01353755b6df80cf1070a48515878da29210 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

Nothing blocks: a test-only change that keeps every count exact and removes the shared total that let two green PRs merge into a red main.

Notes

  • A file split or move now shows up as drift in two table entries, even when the total is unchanged. This repo splits files often because of the line cap, so expect that churn. The failure message already prints the lines to write, which keeps it cheap.

[DESIGN-REVIEWED] 794f013

Description read

[DESCRIPTION-READ] f94b6d504edad23233ced4ee78959d6f763aebe10c823185ff901314d71e5ed9

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 794f01353755b6df80cf1070a48515878da29210 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 794f013

Verdict parsed from the review's SHA-scoped output markers for commit 794f01353755b6df80cf1070a48515878da29210.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 794f01353755b6df80cf1070a48515878da29210 false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 794f01353755b6df80cf1070a48515878da29210 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 794f013

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 794f01353755b6df80cf1070a48515878da29210 false-positive: <reason, 20 to 500 characters>

@KiroCrewCaptain

KiroCrewCaptain commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: Approve

Why: the decider estimates a 6% chance that this change introduces a defect, within the 12% limit for approving on its own, and every check passes.

Test-only change replacing the two global pid-reader totals with a per-file (counted, owner-marked) table so concurrent PRs touching different files edit different lines. I summed the table by hand: 48 files, 143 counted, 13 owner-marked, the same as the old totals. Keys match the scanner's src/⁠kiro_crew-relative paths, and nothing else reads the removed constants. Checking each file exactly is strictly tighter than the old total. New tests cover the drift helper, reject (0,0) entries and check the per-file owner pair, and CI including the Static Ratchet Gate is green on this head.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 794f013537 · 208 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 15, 2026
@bolichen97
bolichen97 force-pushed the crew/linuxflackyguard/pid-reader-per-file branch from 9be09da to ac6e101 Compare November 15, 2026 19:09
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in 5 commits (e58284e -> 860a01b) touching docs/system-specs/modules/runtime-ownership.md and sibling module specs this PR also edits. Re-ran test/test_pid_reader_ratchet.py on the new base (14 passed). Also black-formatted test/test_pid_reader_ratchet.py, which failed Backend Lint on the previous head (9be09da). New head: ac6e101.

@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 15, 2026
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Nov 15, 2026
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in 6 commits (860a01b -> ace367b), one touching docs/system-specs/modules/ beside docs/system-specs/modules/app-kit-platform.md that this PR edits. Re-ran test/test_pid_reader_ratchet.py on the new base: 14 passed. New head: 81a5631.

@bolichen97
bolichen97 force-pushed the crew/linuxflackyguard/pid-reader-per-file branch from ac6e101 to 81a5631 Compare November 15, 2026 20:25
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 15, 2026
@bolichen97
bolichen97 force-pushed the crew/linuxflackyguard/pid-reader-per-file branch from 81a5631 to 794f013 Compare November 15, 2026 21:29
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in 6 commits (ace367b -> 4dec84c) touching docs/system-specs/modules/ beside the module specs this PR edits; rebased cleanly. Re-ran test/test_pid_reader_ratchet.py on the new base: 14 passed. New head: 794f013.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention labels Nov 15, 2026
@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 15, 2026 23:58

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. On this head, the review checked that the per-file _BASELINE table sums to 48 files, 143 counted and 13 owner-marked readers, which matches the old scalars. The head's test file passed (14 tests) against both the head src and current main src. A probe that adds an owner-marked reader fails the owner test and prints the exact line to write. No other code reads the removed constants.

Done well: per-file exact equality is strictly tighter than the old totals, so two green PRs that touch different files now edit different lines. The (0, 0) entry guard also keeps a dead line from going stale.

Optional:

  • Moving a reader from one file to another (for example, a file split under the line cap) now fails with the "ADDS a reader" text. When the counted total does not change, a "sites moved between files" message would be clearer.
  • The spec sentence "The kill-chokepoint baseline is one total" goes stale if #37682 lands, and the two PRs merge with no textual conflict. Whichever lands second should reword it.
  • The per-test column filters in the two exact tests have no committed test. A small pure helper plus one synthetic test would cover them.

@KiroCrewCaptain
KiroCrewCaptain merged commit ce18586 into main Nov 15, 2026
154 of 156 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the crew/linuxflackyguard/pid-reader-per-file branch November 15, 2026 23:59
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 15, 2026
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.

2 participants