fix: only fault attachments whose payload failed to resolve by tylervick · Pull Request #438 · XCTestHTMLReport/XCTestHTMLReport · GitHub
Skip to content

fix: only fault attachments whose payload failed to resolve - #438

Merged
tylervick merged 1 commit into
mainfrom
tylervick/validate-no-payloadref-387
Aug 12, 2026
Merged

tylervick merged 1 commit into
mainfrom
tylervick/validate-no-payloadref-387

Conversation

@tylervick

@tylervick tylervick commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

Fixes #387.

Problem

Summary.validate() flagged every attachment whose content is RenderingContent.none. But an attachment with no payloadRef has no content by construction — Attachment.init never attempts an export when there is no payload to export. A bundle containing payload-less attachments would exit 3 reporting degradation that did not occur: a false positive on the exact mechanism 3.0 asks users to trust.

Per the 4.0 design spec's guiding rule, a fault means a genuine failure to read something that should be there. An attachment that structurally has no payload is not a failure to export it.

Fix

The per-attachment decision moves into Attachment.failedToResolve, which only reports failure when a payload existed (payloadId != nil) and resolving it produced no content. validate() now consults that predicate. Three files, +76/−2, no behavior change for any attachment that has a payload.

Tests (written first, watched fail)

None of the generated fixtures contains a payload-less attachment (verified by walking all three bundles' legacy object graphs: 13 attachments, all with payloadRef), so the reproduction builds Attachment through the production initializer from the same legacy JSON shape XCResultKit decodes out of a bundle:

  • testAttachmentWithoutPayloadRefIsNotAResolutionFailure — no payloadRef → must not fault. Failed before the fix (reproducing the issue), passes after.
  • testAttachmentWhosePayloadCannotBeExportedIsAResolutionFailure — payloadRef present but unexportable → must still fault. Passes before and after, pinning the true-positive path.

Full suite on freshly generated fixtures: 30 tests, 0 failures (1 skipped, pre-existing).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Improved attachment validation to distinguish between attachments with no payload and attachments whose referenced content cannot be resolved.
    • Prevented valid attachments without payloads from being incorrectly reported as unresolved.
    • Continued reporting unresolved payloads as deduplicated faults.
  • Tests

    • Added coverage for both valid no-payload attachments and failed payload resolution scenarios.

Summary.validate() flagged every attachment whose content is
RenderingContent.none. But an attachment with no payloadRef has no
content by construction (Attachment.init never attempts an export), so
a bundle containing payload-less attachments would exit 3 reporting
degradation that did not occur — a false positive on the exact
mechanism 3.0 asks users to trust.

Extract the per-attachment decision into Attachment.failedToResolve,
which only reports failure when a payload existed and produced no
content. The tests build Attachments through the production initializer
from the same legacy JSON shape XCResultKit decodes out of a bundle:
one with no payloadRef (must not fault — reproduced the bug before the
fix), one whose payload cannot be exported (must still fault).

Fixes #387

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown

@tylervick
tylervick merged commit 013ae6c into main Aug 12, 2026
8 checks passed
@tylervick
tylervick deleted the tylervick/validate-no-payloadref-387 branch August 12, 2026 21:52
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.

validate() false-positives on attachments with no payloadRef

1 participant