Skip to content

test(lifecycle): output oracle joins a plain line Rich wrapped at a space (#4334 cell red) - #4368

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

Daniel Meppiel (danielmeppiel) merged 2 commits into
mainfrom
p2-oracle-plain-wrap

Conversation

@danielmeppiel

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

Copy link
Copy Markdown
Collaborator

Description

test_mixed_case_links_survive_install_update_audit_and_uninstall is red on main (run 44753470995 on a2aa8d1fc2, macOS arm64 and x86_64) and on #4258. It fails with I9: known cell install-verbose-diagnostics-repeat (#4334) did not fail. It also fails on Linux with -n 0, so it is deterministic, not platform-specific.

Cause: the #4334 line Package target restriction: [copilot, cursor]; effective targets: [copilot, cursor] is 82 characters. Rich wraps it at a space, so stdout holds ...[copilot, \ncursor] twice.

  • The STRICT cell's output regex matches the repeated first row, so the cell applies.
  • The I9 wrap joiner (_logical_lines in tests/utils/lifecycle_evidence.py) rejoined a continuation only after a status-prefixed line. This line is plain, so the two copies were never equal adjacent lines.
  • The oracle therefore missed the repeat, and the cell reported "did not fail".

The product defect (#4334) is still present; the oracle just could not see it in wrapped output.

Fix (test harness only): a plain line also joins its continuation when the broken row ended with the space Rich broke at. Rows that fill the width with no trailing space still need a status prefix, so long unwrapped log lines on stderr (the #4332 shape) stay apart and their repeats are still reported. The new unit test covers both directions.

Sibling: #4366 fixes the other macOS red in the same function. The two PRs touch separate hunks and merge cleanly together (checked with git merge-tree).

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 main red; #4115 continues. #4334 (the product defect) stays open, and its cell stays strict.

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: pytest -n 0 tests/unit/scripts/test_lifecycle_evidence.py::test_output_oracle_joins_a_plain_line_wrapped_at_a_space failed with the oracle change stashed (assert [] == ["stdout repeats a line: 'Package target restriction: ...'"]).

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

  • On main, APM_E2E_TESTS=1 pytest -n 0 tests/integration/test_mixed_case_materialization_lifecycle.py failed with the apm install --verbose repeats target-restriction and perf diagnostic lines #4334 "did not fail" message. With the fix, that module plus tests/integration/test_oci_mcp_lifecycle_contract.py passed (5 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

…pace

The I9 wrap joiner rejoined a continuation only after a status-prefixed
line. The #4334 "Package target restriction: ..." line is plain and
82 characters wide, so Rich breaks it at a space; its two copies were
no longer equal adjacent lines and the oracle missed the repeat. The
STRICT #4334 cell then reported "did not fail" and turned
test_mixed_case_links_survive_install_update_audit_and_uninstall red
(main run 44753470995, #4258). A plain line now joins where the broken
row ended in the space Rich broke at; width-filled rows still need a
status prefix, so long unwrapped log lines (the #4332 shape) stay apart.

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.

🟢 Approval recommended

No active review issues are identified for the test-harness change that detects repeated diagnostics split by Rich wrapping.

No open issues 🎉

What changed in this PR

This test-harness-only fix lets the lifecycle output oracle detect repeated plain diagnostics split by Rich wrapping. It addresses the false “known cell did not fail” result for #4334 without fixing or masking the underlying product defect.

Changes:

  • Join plain-line continuations when the preceding row ends with a space.
  • Add regression coverage for wrapped duplicate diagnostics and preserve detection of repeated long, unwrapped stderr lines.
File Description
tests/​utils/​lifecycle_evidence.py Extends logical-line reconstruction to handle plain diagnostics wrapped at a space.
tests/​unit/​scripts/​test_lifecycle_evidence.py Tests wrapped duplicate detection and preservation of unwrapped log repeats.

Review effort: Balanced

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]>
@danielmeppiel
Daniel Meppiel (danielmeppiel) merged commit 12015df into main Nov 20, 2026
31 of 34 checks passed
@danielmeppiel
Daniel Meppiel (danielmeppiel) deleted the p2-oracle-plain-wrap branch November 20, 2026 15:45
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