Skip to content

test(lifecycle): output oracle joins a path's space-led fold tail (macOS codex red) - #4366

Merged
Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
p2-oracle-fold-tail
Nov 20, 2026
Merged

Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
p2-oracle-fold-tail

Conversation

@danielmeppiel

@danielmeppiel Daniel Meppiel (danielmeppiel) commented Nov 20, 2026 •

Copy link
Copy Markdown
Collaborator

Description

test_oci_mcp_install_lifecycle_is_cross_adapter_and_idempotent[codex] fails on macOS (main run 44753470995, a2aa8d1fc2) with I9: stdout repeats a diagnostic: '[+] <tmp path>'.

Cause: the macOS pytest tmp path is 160 characters, so Rich folds it into two full-width rows. The next word ( (local)) then wraps onto a new row with the space it broke at. The output oracle's wrap joiner (_logical_lines in tests/utils/lifecycle_evidence.py) refused space-led continuations, so the indented [+] <path> (local) line shrank to [+] <path>. It then compared equal to the earlier validation line [+] <path>. On Linux the path is short, so nothing wraps and the two lines differ.

Fix (test harness only): when the previous raw row fills the wrap width and the next row starts with exactly one space, drop that space so the row joins back as a continuation. Real duplicate diagnostics are still reported.

This does not depend on codex, the codex binary, or the #4264 codex-pin stopgap. It depends only on the tmp path length.

Issue and approved scope

Issue: Refs #4115

Human scope-approval comment: the Stream P lead assigned this main-red fix under #4115 (wider PR checks and CI).

Does this PR complete the issue, or what remains? No. It removes one macOS main red; #4115 continues.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Maintenance / refactor

Testing

  • Tested locally

  • All existing tests pass

  • Added tests for new functionality (if applicable)

  • Red before: uv run --frozen pytest -n 0 tests/unit/scripts/test_lifecycle_evidence.py::test_output_oracle_joins_the_space_led_tail_of_a_path_folded_at_full_width failed with the oracle change stashed.

  • Green after: uv run --frozen pytest -n 0 tests/unit/scripts/test_lifecycle_evidence.py passed (207 passed).

  • Linux repro of the macOS shape: APM_E2E_TESTS=1 uv run --frozen pytest -n 0 --basetemp=/tmp/<87 chars> "tests/integration/test_oci_mcp_lifecycle_contract.py::test_oci_mcp_install_lifecycle_is_cross_adapter_and_idempotent" failed on main with the same I9 message and passes with the fix (3 passed).

  • uvx [email protected] check and format --check on the changed files passed.

Changelog

  • One line in one section under ## [Unreleased] in CHANGELOG.md
  • N/A -- internal-only change (CI, tests, refactor).

Spec conformance (OpenAPM v0.1)

  • N/A -- this PR does not change OpenAPM-observable behaviour.

Blast radius

Scope

Method. The hook in check_cli_output evaluated every APM command result twice: once with main's joiner, once with the combined #4366 + #4368 joiner. It logged every command whose violation list differed.

Flips: exactly 1 command, 1 node

PR Node Before (main joiner) After Violation
#4368 alone tests/integration/test_mixed_case_materialization_lifecycle.py::test_mixed_case_links_survive_install_update_audit_and_uninstall, command apm install --target copilot,cursor --no-policy --parallel-downloads 0 --verbose FAILED: known cell install-verbose-diagnostics-repeat (#4334) did not fail PASSED: the strict #4334 cell owns the new violation I9: stdout repeats a line: 'Package target restriction: [copilot, cursor]; effective targets: [copilot, cursor]'
#4366 alone none - - -
Both combined same single node as #4368 alone - - -

Attribution. The flipped line wraps after a 76-character row that ends in the space Rich broke at. Only #4368's rule (a plain line joins where it broke at a space) joins it. #4366's rule needs a 79-80 character row followed by a single-space-led row, so it cannot fire here. No other command changed in the combined scan.

Accounting

…th in the output oracle

On macOS the pytest tmp path is long enough that Rich folds it into
full-width rows, and the word after it (" (local)") wraps with the space
it broke at. The I9 joiner refused space-led continuations, so the
indented "  [+] <path> (local)" line collapsed to "[+] <path>" and
compared equal to the validation line, failing
test_oci_mcp_install_lifecycle_is_cross_adapter_and_idempotent[codex]
on macOS (run 44753470995). Reproduced on Linux with a 92-char --basetemp.

Refs #4115

Co-authored-by: copilot-swe-agent[bot] <[email protected]>

Copilot AI 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.

🟡 Changes recommended

The line-folding logic alters unjoined rows and merges independent lines, causing repeated output to go undetected.

2 open issues
What changed in this PR

This test-harness change addresses a macOS lifecycle false positive caused by Rich wrapping long temporary paths. It supports the CI reliability work in #4115 without changing APM runtime behavior.

Changes:

  • Allows single-space-led continuations after full-width output rows.
  • Adds a regression test distinguishing wrapped validation output from installation output ending in (local).
File Description
tests/​utils/​lifecycle_evidence.py Adjusts continuation handling in the lifecycle output oracle.
tests/​unit/​scripts/​test_lifecycle_evidence.py Adds coverage for a wrapped 160-character path and its space-led tail.

Review effort: Balanced

Comment thread tests/utils/lifecycle_evidence.py Outdated
Comment on lines +708 to +709
if len(previous_raw) >= _WRAP_WIDTH and re.match(r" \S", line):
line = line[1:]
Comment thread tests/utils/lifecycle_evidence.py Outdated
Comment on lines +708 to +709
if len(previous_raw) >= _WRAP_WIDTH and re.match(r" \S", line):
line = line[1:]
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
The _logical_lines joiner agreed with Stream P (#4366, #4368): a row is a console wrap when it breaks at a space or fills the 79-80 column width; a longer row is unwrapped output (RA-010); a full-width fold keeps the space it broke at; a plain line joins only after a break at a space. Red/green unit cases for the unwrapped-long-line rule and for failed-check details on stderr.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
… via check_cli_output (AQ003)

Matches the 80-column predicate agreed in #4143: a longer row is unwrapped output, never a wrap.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 2f8f682 into main Nov 20, 2026
30 of 33 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the p2-oracle-fold-tail branch November 20, 2026 15:44
Daniel Meppiel (danielmeppiel) added a commit that referenced this pull request Nov 20, 2026
_logical_lines keeps the wrap rule agreed with Stream P: a row wraps when it breaks at a space or fills the 79-80 column width; a longer row is unwrapped output (RA-010); #4366 fold-tail and #4368 plain-wrap cases pass.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
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