Skip to content

Add reusable c2pa-rs RC-preflight workflow; fix latent test bugs - #326

Merged
scouten-adobe merged 1 commit into
mainfrom
chore/rc-preflight-tooling
Sep 17, 2026
Merged

scouten-adobe merged 1 commit into
mainfrom
chore/rc-preflight-tooling

Conversation

@scouten-adobe

Copy link
Copy Markdown
Contributor

Summary

Split out of #325 per review feedback, so that PR can shrink down to just the 0.91.0-rc.1-specific validation. This PR contains everything from that work that's useful independent of any particular c2pa-rs release candidate.

  • Adds .github/workflows/test-c2pa-rs-source-build.yml: builds the native FFI library from an arbitrary c2pa-rs git ref instead of downloading a release asset. Needed for testing an RC that has no crates.io publish and no prebuilt GitHub release binaries. It's a no-op on ordinary PRs -- it only activates when a PR commits a target ref to c2pa-rs-preflight-ref.txt, at which point it reruns automatically on every push to that PR (so you get real CI signal while iterating on adaptation fixes, instead of having to remember to re-dispatch by hand). See the workflow's header comment for the full design, including why it's pull_request-only (no workflow_dispatch) -- CodeQL flagged the latter as a cache-poisoning vector, since a dispatch against the default branch gets cache-write access while the workflow executes an arbitrary, unvalidated external ref.
  • Fixes three latent bugs in tests/test_unit_tests.py found while probing 0.91.0-rc.1 with this tool, all verified to still pass against the currently-pinned release (0.90.22):
    • Four ingredient tests declared testPath2 (an actual JPEG fixture) as "image/png" when adding it as an ingredient -- harmless while add_ingredient() didn't validate bytes against the declared MIME type, but a bug regardless.
    • Several ingredient-archive tests built manifests with an empty or c2pa.placed-only actions list; added an explicit leading c2pa.created/c2pa.opened action (or reordered where one already existed) to match what a real C2PA manifest should look like.
    • test_swapped_builder_is_freed_exactly_once assumed a swapped builder handle's address always differs from the original -- that's an implementation detail of the native allocator, not a guarantee. Relaxed it to check the invariant that actually matters (freed exactly once).

Test plan

  • Full local test suite (444 tests) against the currently-pinned c2pa-rs 0.90.22: all pass
  • CI: unit tests, wheel builds, CodeQL

🤖 Generated with Claude Code

Adds .github/workflows/test-c2pa-rs-source-build.yml: a workflow that
builds the native FFI library from an arbitrary c2pa-rs git ref
(needed when testing a release candidate that has no crates.io
publish and no prebuilt GitHub release binaries) instead of
downloading a release asset. It's a no-op on ordinary PRs -- it only
activates when a PR commits a target ref to c2pa-rs-preflight-ref.txt,
at which point it reruns automatically on every push to that PR, same
as any other check.

Also fixes three latent test bugs found while probing c2pa-rs
0.91.0-rc.1 with this tool, all confirmed to still pass against the
currently-pinned release:

- Four ingredient tests declared testPath2 (an actual JPEG fixture) as
  "image/png" when adding it as an ingredient. Harmless while
  add_ingredient() didn't validate ingredient bytes against the
  declared MIME type, but still a bug in the test.
- Several ingredient-archive tests built manifests with an empty or
  c2pa.placed-only actions list. Added an explicit leading
  c2pa.created/c2pa.opened action (or reordered where one already
  existed) to match what a real C2PA manifest should look like.
- test_swapped_builder_is_freed_exactly_once asserted a swapped
  builder handle's address always differs from the original. That's
  an implementation detail of the native allocator, not a guarantee;
  relaxed it to check the invariant that actually matters (freed
  exactly once).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
scouten-adobe added a commit that referenced this pull request Sep 17, 2026
This is the entire diff this PR now carries on top of #326: pin the
preflight workflow at c2pa-rc-v0.91.0-rc.1 so it builds from that git
tag (no crates.io publish, no prebuilt GitHub release binaries for an
RC) and runs the full unit test suite against it.

CI is expected to show 8 failures per platform, all
'Valid' != 'Trusted' plus one SDK-version string mismatch: 0.91.0-rc.1
moves trust.trust_anchors/trust.trust_config under a new
trust.anchors[] array, and the currently-pinned c2pa-native-version.txt
release doesn't understand that schema. That's the actual, documented
incompatibility this PR exists to surface -- not a bug in the tooling.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@scouten-adobe
scouten-adobe merged commit 05dbc97 into main Sep 17, 2026
46 checks passed
@scouten-adobe
scouten-adobe deleted the chore/rc-preflight-tooling branch September 17, 2026 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants