Skip to content

test(platform): use unallocatable listener pids - #12672

Merged
iamwhatever merged 1 commit into
kirodotdev:mainfrom
jeeshofone:test/12669-unallocatable-pid-mocks
Sep 26, 2026
Merged

iamwhatever merged 1 commit into
kirodotdev:mainfrom
jeeshofone:test/12669-unallocatable-pid-mocks

Conversation

@jeeshofone

@jeeshofone jeeshofone commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

test/test_platform_compat.py contains three fabricated Windows TCP-owner PIDs that a live process can own. The kirocrew.mock-pid-allocatable SAST rule correctly rejects them, reddening diff-aware scans for older-baseline PRs even though the test only exercises address filtering.

Why it matters

An allocatable mock PID can target an unrelated runner process if it reaches cleanup code, and the main-side violations also create false ownership of SAST failures on unrelated pull requests.

What changed (motivation → approach → change)

Replaced the three mocked TCP table PIDs and the exact-loopback expected value in test/test_platform_compat.py with three distinct literals above every supported platform's PID range. Distinct values preserve the assertion that only the IPv4 loopback row is selected while wildcard IPv4 and IPv6 rows are excluded.

Backwards compatibility

Compatible: production code is unchanged; only fabricated test data changes.

Tests

  • Exact listener-owner test plus mock-PID rule wiring: 12 passed.
  • Complete test/test_platform_compat.py: 452 passed, 27 platform skips (rebased head 2d9f62b2f on main 7b2da39c5).
  • Semgrep 1.78 proof: exact main file reports three mock-pid-allocatable findings; repaired file reports zero.
  • Targeted Black, isort, flake8, baseline-aware Black, and diff checks pass.

Manual verification

N/A — static-rule proof and platform compatibility tests cover the test-data correction.

Related Issues

Fixes #12669

Pattern harvest

Rule candidate: semgrep
Pattern: kirocrew.mock-pid-allocatable already detects fabricated test PIDs below 2**32; this change removes the three reported matches from test/test_platform_compat.py without claiming a repository-wide sweep.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (N/A — existing testing convention and Semgrep rule already specify the fix)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

@jeeshofone
jeeshofone requested review from a team and dwu96 September 22, 2026 01:02
@github-actions github-actions Bot added the fork Pull request from a fork (external contributor) label Sep 22, 2026
@jeeshofone

Copy link
Copy Markdown
Contributor Author

Intent: Make main comply with the existing mock-PID isolation rule while preserving the Windows TCP-owner test's exact-loopback versus wildcard discrimination.
Not a goal: Change production process ownership, listener probing, or signaling behavior.

Maintainers: please approve the fork workflows when convenient. GPT and Opus both verified exact head 4689140947d4b6469396d569772a41bda34875d1.

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — ✅ no blocking findings

Reviewed 2d9f62b2fbb6316f509efa972a77d26f9925e6e6 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 2d9f62b

@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review (fork) — ✅ no blocking findings

Reviewed 2d9f62b2fbb6316f509efa972a77d26f9925e6e6 via the fork AI-review pipeline; updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 2d9f62b

@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 Sep 22, 2026
@github-actions

github-actions Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 2d9f62b2fbb6316f509efa972a77d26f9925e6e6 via the fork AI-review pipeline — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] 2d9f62b

@jeeshofone

Copy link
Copy Markdown
Contributor Author

fixed — span=ccb546b96bf3

The PR body now scopes compliance to the three reported test/test_platform_compat.py matches and explicitly disclaims a repository-wide sweep.
self-added: no
mechanism: existing mock-pid Semgrep rule

@jeeshofone

Copy link
Copy Markdown
Contributor Author

rebutted — span=3ec4969f47f8

The distinct-unallocatable-literal shape is already used where this test needs row discrimination. Sweeping unrelated tests would change independent fixtures outside issue #12669's three reported matches.
self-added: no
mechanism: distinct unallocatable row identities

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Sep 22, 2026
@jeeshofone

Copy link
Copy Markdown
Contributor Author

The sole red is unrelated to this four-line Python test-data change: Electron's real-junction PowerShell/WMIC probe timed out while all 31 sibling tests passed. It is now tracked with a second occurrence and direct job evidence in #12685. No repush performed.

@jeeshofone

Copy link
Copy Markdown
Contributor Author

Maintainer action requested for rebased head 0b518b309920aa7aa38c4487dce99e3c4a58fe88: please approve the fork workflow runs when GitHub presents the banner. This rebase inherits merged #12819's CI-sized Windows real-junction WMI budget, which addresses the sole prior red. The PR's four-line test-data patch is range-diff identical; all 437 platform tests and the full static/type floor pass.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 23, 2026
@jeeshofone
jeeshofone force-pushed the test/12669-unallocatable-pid-mocks branch from 0b518b3 to d819bf0 Compare September 23, 2026 01:17
@jeeshofone

Copy link
Copy Markdown
Contributor Author

Maintainer action requested for healed-main head d819bf023d9552293ce49e52c7f6b4b41bc9a055: please approve the fork workflow runs when GitHub presents the banner. This rebase includes merged #12819's Windows WMI test budget and merged #12943's shard-7 ratchet fix. The four-line PR patch is range-diff identical; 437 platform tests, the previously failing main ratchet, and the full static/type floor pass.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 25, 2026
@jeeshofone
jeeshofone force-pushed the test/12669-unallocatable-pid-mocks branch from 7089b8f to 7351b3a Compare September 26, 2026 00:32
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 26, 2026
@jeeshofone
jeeshofone force-pushed the test/12669-unallocatable-pid-mocks branch from 7351b3a to f7f5450 Compare September 26, 2026 06:43
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 26, 2026
@jeeshofone
jeeshofone force-pushed the test/12669-unallocatable-pid-mocks branch from f7f5450 to 67088de Compare September 26, 2026 07:53
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 26, 2026
@jeeshofone
jeeshofone force-pushed the test/12669-unallocatable-pid-mocks branch from 67088de to 2d9f62b Compare September 26, 2026 15:37
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Sep 26, 2026

@cixuuz cixuuz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approve: test-only. Switches the fake listener PIDs to unallocatable large values (99_999_999_99x) so the platform-compat test can never collide with a real listener PID on the host. Logic and assertions unchanged; behavior-preserving. All lanes clean at this head.

@iamwhatever
iamwhatever enabled auto-merge (squash) September 26, 2026 22:51
@iamwhatever
iamwhatever merged commit 550b1bf into kirodotdev:main Sep 26, 2026
99 checks passed
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fork Pull request from a fork (external contributor)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SAST: main carries mock-pid-allocatable violations (test_platform_compat.py L3971-3993), reddening diff-aware scans on older-baseline PRs

3 participants