Skip to content

fix(test): sync _BUILDER_MEMBERS with build_message thread_replies_text (restore test_builder_members_keep_their_kind_and_signature) - #16078

Closed
chenmingwei23 wants to merge 1 commit into
kirodotdev:mainfrom
chenmingwei23:fix/ctxcomp-builder-members-main
Closed

chenmingwei23 wants to merge 1 commit into
kirodotdev:mainfrom
chenmingwei23:fix/ctxcomp-builder-members-main

Conversation

@chenmingwei23

@chenmingwei23 chenmingwei23 commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: restore two main-side test breakages to green so every rebased PR stops inheriting them.

On current origin/main (cfb428485), these fail on rebased-PR CI (observed across the conductor's tracked PRs):

  • test/test_context_composition_contract.py::TestSurface::test_builder_members_keep_their_kind_and_signature on Backend Tests (3.12) shard 5 and Backend Tests (Windows) shard 5 (assertion at test_context_composition_contract.py:1629).
  • test/test_app_script_cron_sibling_import.py::TestACommandCronRunningBundleCode::test_the_call_site_leaves_the_bundle_readable on Backend Tests (Windows) (1).

Why it matters

Both are landed-on-main breakages that red hard contract/regression lanes on every PR that rebases onto main, blocking unrelated work until corrected.

Not a goal

Changing any production code. Both the build_message parameter and the Windows "no command cron" behavior are intended; only the stale/over-broad test expectations are corrected.

What changed (motivation → approach → change)

This PR fixes two independent main-side test breakages, both minimal:

1. test_builder_members_keep_their_kind_and_signature (3.12 / Windows shard 5). Root cause: PR #15761 (fix(slack): show a thread turn the replies posted since its last turn, 4e23df8e7) added a keyword-only parameter thread_replies_text: str | None = None to ContextBuilder.build_message — a real feature parameter, consumed by slack/handler.py and slack/transport_dispatch.py and read in context.py to fence thread-reply text. That PR did not update the _BUILDER_MEMBERS frozen snapshot in the contract test, so the recorded build_message signature lost sync with the live one. The new shape is intended, so the fix updates the contract (test snapshot), not the code: the build_message entry in _BUILDER_MEMBERS now includes thread_replies_text in the exact position the live keyword-only signature carries it (between exclude_last_n and folder_path). No other member drifted.

2. TestACommandCronRunningBundleCode::test_the_call_site_leaves_the_bundle_readable (Backend Tests (Windows) (1)). Root cause: the Windows CI traceback shows assert len(spawns) == 1 fails with seen == [] — wrap_argv is never reached. Command crons resolve a POSIX sh through _resolve_command_shell (never $PATH), which returns None on Windows (cmd.exe is not POSIX; Git-for-Windows's sh.exe is bash), so run_command_sandboxed refuses before wrap_argv. This is a test fix: rather than skip the case on Windows (which would loosen the cross-platform a-ratchet-may-only-tighten ratchet — the call-site mask invariant would stop being checked there), the test now forces the call site reachable on Windows. A _force_command_shell_on_windows helper monkeypatches _resolve_command_shell to hand back the interpreter and _command_argv to build a direct [sys.executable, run.py] argv (no sh -c, which Windows cannot run), so wrap_argv is reached and the bundle-readable invariant is still asserted on Windows. POSIX is untouched — the real shell resolves and the real sh -c argv is used. The script path has no such restriction and is unchanged.

Backwards compatibility

No runtime behavior change. Test-only edit; the production build_message signature is unchanged.

Tests

  • PYTHONPATH=src python -m pytest test/test_context_composition_contract.py → 123 passed (was 1 failed).
  • PYTHONPATH=src python -m pytest test/test_app_script_cron_sibling_import.py → 2 passed, 2 skipped on POSIX (the 2 skips are the OS-sandbox-backend cases; the command call-site case now runs on Windows too via the forced resolver).
  • black --check / isort --check-only / flake8 on both changed files: clean.

Manual verification

  • Contract test: reproduced the failure on cfb428485 with the worktree's own src on PYTHONPATH; the sole differing dict item was build_message and the sole delta was the missing thread_replies_text keyword-only parameter. Traced it to fix(slack): show a thread turn the replies since its last turn #15761 via git log -S; confirmed that commit did not touch the contract test.
  • Cron test: pulled the real Backend Tests (Windows) (1) job log — assert len(spawns) == 1 fails with seen == [], i.e. wrap_argv is never reached. Confirmed in cron_script.run_command_sandboxed that _resolve_command_shell() returns None on Windows and the function returns the _no_command_shell_message refusal before wrap_argv, so the command path cannot run on Windows by design.

Screenshots / video

N/A — test-only change, no UI.

Related Issues

Fixes the main-side breakage of test_builder_members_keep_their_kind_and_signature (introduced by #15761) and of TestACommandCronRunningBundleCode::test_the_call_site_leaves_the_bundle_readable on Windows (surfaced by the #13273 revert in #16072 that re-enabled the sibling-import regression test).

Pattern harvest

Rule candidate: a contract/regression test that asserts an exact runtime shape must be updated in the same PR that changes that shape — a ContextBuilder member signature change must update _BUILDER_MEMBERS in test_context_composition_contract.py. And when a cross-platform invariant test cannot reach its call site on one platform (a command cron finds no POSIX sh on Windows), make the call site reachable there (monkeypatch the resolver to run the bundle via sys.executable) rather than skip the case — a platform skip loosens the a-ratchet-may-only-tighten ratchet.

Checklist

Contribution License Agreement

By submitting this pull request, I confirm that my contribution is made under the terms of the project's Contribution License Agreement.

@chenmingwei23
chenmingwei23 requested a review from a team as a code owner October 2, 2026 06:33
@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: checking Automated validation is still running labels Oct 2, 2026
@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

GPT 5.6 Review (fork) — 🔴 changes requested (blocking)

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

Adjudication upheld 1 of 1 blocking finding(s); those must be resolved before merging.

BLOCKING -- test/test_app_script_cron_sibling_import.py:154 -- Class-level skip loosens the cross-platform ratchet
@_NO_COMMAND_CRON
Windows collection -> decorator skips both command-cron tests -> the call-site mask invariant is no longer checked.
Anchor: a-ratchet-may-only-tighten
Fix: Remove the class skip; patch _resolve_command_shell and _command_argv on Windows so the call-site test runs the bundle via sys.executable.
[BLOCK-MERGE] 961243d
[GPT-REVIEWED] 961243d

Adjudication (Opus 5) — is blocking on each finding proportionate?

MEDIUM — the skip is factually grounded (src/kiro_crew/cron_script.py:2489 returns None on Windows; src/kiro_crew/cron_script.py:2748-2750 refuses before any wrap_argv call), so no real Windows coverage is lost — but the anchored rule's own FLAG list names "a newly added skip / xfail ... in a file the diff otherwise only extends" (AUTOSDE.yaml:806-807), and its Allowed bucket (AUTOSDE.yaml:810-813) does not cover a platform skip.
Conditions confirmed: the diff's only other change to this file is the decorator's definition (/home/runner/work/_temp/authentic.patch:9-18), and the decorated class is TestACommandCronRunningBundleCode whose call-site test is the mask ratchet (test/test_app_script_cron_sibling_import.py:144-155).
Remedy cost is real but bounded — a Windows-only patch of _resolve_command_shell/_command_argv to simulate an unsupported path, or the rule's own prescribed alternative at AUTOSDE.yaml:815-816; either way blocking: true on a-ratchet-may-only-tighten (AUTOSDE.yaml:784) is authoritative and outranks this weighing.

[ADJUDICATION] 961243d total=1 uphold=1 downgrade=0
UPHOLD F1 test/test_app_script_cron_sibling_import.py:154 reason=autosde-blocking-rule
[GPT-ADJUDICATED] 961243d

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Fable 5, fork) — ✅ PASS

Design-level review of 961243de5c778692d7ec46ad263758517d7df17f 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.

Both fixes verified against the base tree: the live build_message signature carries thread_replies_text exactly where the updated snapshot places it, and cron_script.py's docstring names the Windows None return "unchanged and deliberate" — the skip aligns the test with a documented decision, and the refusal path keeps coverage in test_cron_script.py.

[DESIGN-REVIEWED] 961243d

Description read

[DESCRIPTION-READ] cb62becdf1c219b20e23fcfa3c92ca5b5b238451449b194451b669355d28835f

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 Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5 Review (fork) — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 961243d

… Windows command cron)

Two independent main-side (cfb4284) test breakages that red on every
rebased PR, both fixed minimally and test-only:

1. test_context_composition_contract.py::test_builder_members_keep_their_kind_and_signature
   (3.12 / Windows shard 5): kirodotdev#15761 added the keyword-only parameter
   thread_replies_text to ContextBuilder.build_message (a real feature param,
   used by slack/handler.py and slack/transport_dispatch.py) without updating
   the frozen _BUILDER_MEMBERS snapshot. The new signature is intended, so sync
   the snapshot.

2. test_app_script_cron_sibling_import.py::TestACommandCronRunningBundleCode
   ::test_the_call_site_leaves_the_bundle_readable (Backend Tests (Windows) (1)):
   the Windows CI traceback shows seen == [] — wrap_argv is never reached.
   Command crons do not run on Windows: run_command_sandboxed resolves a POSIX
   sh via _resolve_command_shell (never $PATH), finds none, and returns the
   _no_command_shell_message refusal before wrap_argv. Mark the command-cron
   subclass skipif(sys.platform == "win32"), matching the POSIX-only design.
   The script path is unchanged.
@iamwhatever

Copy link
Copy Markdown
Contributor

Thanks @chenmingwei23. Closing as superseded: #16083 (merged 2026-10-02) fixes the same two Windows-red tests in the same files, test_context_composition_contract.py via a compatible-addition tolerant signature pin, and test_app_script_cron_sibling_import.py via the product's own command-cron refusal probe. Its body notes the two PRs targeted the same red. Happy to reopen if you see a case #16083 misses.

@iamwhatever iamwhatever closed this Oct 2, 2026
@github-actions github-actions Bot removed the readiness: checking Automated validation is still running label Oct 2, 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.

2 participants