Skip to content

test: key composition and facade records per item instead of shared totals - #37681

Merged
KiroCrewCaptain merged 2 commits into
mainfrom
crew/linuxflackyguard/merge-safe-composition
Nov 15, 2026
Merged

KiroCrewCaptain merged 2 commits into
mainfrom
crew/linuxflackyguard/merge-safe-composition

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The composition-contract and facade tests stay green on main when two pull requests that were each green on the same base both merge.

Many of these tests stored one shared number (a row count, a re-export count, a served-handler count, a whole-file total) beside or instead of a per-item record. Two PRs that each add one item rewrite that number to the same value, git merges the identical edit cleanly, and main holds one item more than the number says. The hottest line, _MCP_TABLE_ROWS with its digest on the next line, was re-pinned 33 times on main in 30 days.

Why it matters

A red main (or a conflict on one shared line) fails or blocks every open PR that touches the counted thing until someone re-pins it.

Not a goal

  • No product code changes; tests and one test fixture only.
  • No loosening: every record stays an exact comparison, now one line per item.
  • Frozen snapshots of one-time module splits (_BASE_ALL_SIZE with its digest, len(_BASE_PROJECT_IMPORTS) == 60) stay: no later change edits them.
  • test_context_composition_contract.py's golden outlines stay exact: each scenario's sha256 sits on its own line beside its outline, so two edits conflict rather than merge wrong.

What changed (motivation → approach → change)

Record Why it went red after a merge Change
test/test_dashboard_server_composition_contract_reach.py _MCP_TABLE_ROWS = 352 + _MCP_TABLE_DIGEST One count and one digest of the whole route table New fixture test/fixtures/dashboard_mcp_route_table.txt, one <method> <path> <handler> row per line in registration order, compared exactly; the failure prints the rows to write
Re-export and served-handler counts (len(reexports) == N, len({id(h) for h in served}) == N) in the messaging, files and agents contracts One shared count Sorted name tuples _PACKAGE_REEXPORTS / _SERVED_HANDLERS, one name per line; an id-count equals name-count check still catches two objects served under one name
Totals beside an exact record that already decides them: len(names) == len(set(names)) == N, len(lines) == N next to a digest, len(defined | moved) == N, len(_BASE_NAMES) == N, sum(missing_code) == 80 / == 37, sum(_CENSUS_HOMES.values()) == 12, len(on_disk) / len(owners) == N in 8 facade tests The total duplicates the record and is the one line two PRs both rewrite Deleted; the no-duplicate, disjointness and shape-digest checks stay. In the facade tests _OWNERS in the module under test is the record
len(routes) == 7 (crew-log routes), len(redacting) == 4 (agents) A count with no record beside it Exact sorted lists

Files: test/test_dashboard_server_composition_contract_reach.py, test/test_handlers_messaging_composition_contract.py, test/test_dashboard_files_composition_contract.py, test/test_dashboard_agents_composition_contract.py, test/test_hooks_composition_contract.py, test/test_slack_handler_composition_contract.py, test/test_crew_log_routes_facade.py, test/test__dispatch_facade.py, test/test_agent_discovery_parts_facade.py, test/test_mcp_dashboard_facade.py, test/test_members_parts_facade.py, test/test_skill_projection_facade.py, test/test_work_ledger_facade.py, test/test_members_handler_facade.py, test/test_work_ledger_handler_facade.py, and the new fixture.

The rule is the one in docs/system-specs/common/testing-conventions.md § Merge-safe ratchets and counts (PR #37660).

Backwards compatibility

Compatible: test files and one test fixture only.

Removes nothing: every dropped total is implied by an exact record that stays or is replaced by one.

Tests

Two-branch merge simulation (scratch clone; A and B cut from one base, each adds one item at a different place and updates the record exactly as the test asks, then git merge):

Scenario origin/main this branch negative control (this branch, item added, record not updated)
MCP route table merge conflict clean merge, passed FAILED "the MCP route table changed…"
messaging re-exports clean merge, FAILED assert 55 == 54 passed FAILED, list diff
files served handlers clean merge, FAILED assert 39 == 38 passed FAILED
work_ledger owners clean merge, FAILED assert 9 == 8 passed FAILED when the module has no _OWNERS entry
files error-code rows clean merge, FAILED assert 82 == 81 passed FAILED, per-file row mismatch
crew_log routes clean merge, FAILED assert 9 == 8 passed FAILED
hooks facade defs clean merge, FAILED assert (14 + 82) == 95 passed FAILED, extra item in set

On this branch rebased onto current main: the 15 changed test files plus test/test_flake_pattern_ratchet.py and test/test_ratchet_scope.py, 670 passed; black, isort and flake8 clean.

Proof: not provable -- test-only change

Manual verification

N/A — tests 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 19:49
@bolichen97
bolichen97 requested a review from buluoray November 15, 2026 19:49
@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

UX Review (Opus 5.5) — ⏭️ skipped

Revision fd29fa028fb8e15a89b83cc3ea9408a2f342c49b 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

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision fd29fa028fb8e15a89b83cc3ea9408a2f342c49b 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

Design Review (Opus 5.5) — ✅ PASS

Design-level review of fd29fa028fb8e15a89b83cc3ea9408a2f342c49b — 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 swaps shared totals for exact per-item records. Two PRs that each add an item now either merge cleanly or conflict; neither leaves main red without a conflict.

Notes

  • The description says "_OWNERS in the module under test is the record" for the facade tests. The head commit adds _OWNER_MODULES tuples to the test files instead. The code is the better choice, so the description's table row is stale.

[DESIGN-REVIEWED] fd29fa0

Description read

[DESCRIPTION-READ] dcaaa021bb9119c3b734b028d9466b23f49b78034bac2c802d516cb23c778ce1

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 fd29fa028fb8e15a89b83cc3ea9408a2f342c49b — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] fd29fa0

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable fd29fa028fb8e15a89b83cc3ea9408a2f342c49b 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 fd29fa028fb8e15a89b83cc3ea9408a2f342c49b and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] fd29fa0

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

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 15, 2026
…otals

Two PRs that each add one route, re-export, owner module or error-code row
rewrote the same total line to the same new number, git merged both, and main
held one more than the record said. Store the MCP route table one row per line
in a fixture, list each package re-export, served handler and facade route by
name, and drop totals the exact records beside them already decide.
@bolichen97

Copy link
Copy Markdown
Contributor Author

Rebased: main moved in (d470c46 -> 4dec84c); one commit added kiro_crew.dashboard.handlers.members_app and re-pinned test/test_members_handler_facade.py's len(owners) == 7, the shared count this PR removes. Resolved by keeping the removal and adding members_app as its own line in _OWNER_MODULES. Re-ran the changed test files plus test_flake_pattern_ratchet.py on the new base: 622 passed. New head: fd29fa0.

@bolichen97
bolichen97 force-pushed the crew/linuxflackyguard/merge-safe-composition branch from d6926d5 to fd29fa0 Compare November 15, 2026 21:19
@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Nov 15, 2026
@KiroCrewCaptain

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider estimates a 7% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 813 lines, more than the 400 it may approve on its own.

Test-only change that swaps shared counts for exact per-item records. The MCP route table is now compared row by row against a new fixture. Re-export and served-handler counts become sorted name tuples, with a check that distinct handler objects equal distinct names. The facade owner counts become exact module tuples. Each deleted total is redundant with an exact record that stays: a literal written in the test, the shape digest, defined == set(_FACADE_DEFS), or the per-file error-code rows equalling the live scan. No product code is touched and CI is green on Linux and Windows.

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 fd29fa028f · 813 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@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.

Reviewed head fd29fa0. All 15 changed test files pass on this head, and they still pass after current main is merged in, with no conflict and clean lint. Removing a row from the new route table fixture makes the table test fail with a clear message, so the per-row comparison is not vacuous. Every shared total this PR removes is still fixed by an exact record that remains: the literal owner lists, the shape digests, the facade definition set, or the per-file error-code rows that must equal the live scan. Nothing blocks.

@KiroCrewCaptain
KiroCrewCaptain merged commit 59ce18f into main Nov 15, 2026
97 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the crew/linuxflackyguard/merge-safe-composition branch November 15, 2026 22:50
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 15, 2026
KiroCrewCaptain pushed a commit that referenced this pull request Nov 16, 2026
… give the shared-runtime test a real GitHub token

test_dashboard_files_composition_contract (#37681) forbids an owner's runtime import of kiro_crew.security.exfil; the facade exports refuses, as the sibling file_api owners import theirs. test_claude_shared_runtime (#37540) used ghp_ + 36 a's, which the rule table does not read as a credential because it checks GitHub's CRC32 suffix; build the token with base62_crc32 like the other redaction tests.
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