Skip to content

fix(assert): repair the no-perl snapshot placeholder fallback#823

Merged
Chemaclass merged 1 commit into
mainfrom
fix/snapshot-placeholder-fallback
Jul 16, 2026
Merged

fix(assert): repair the no-perl snapshot placeholder fallback#823
Chemaclass merged 1 commit into
mainfrom
fix/snapshot-placeholder-fallback

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

The new placeholder unit tests in #822 failed on Alpine (no perl) — correctly: the grep fallback of match_with_placeholder escaped regex metacharacters after substituting the placeholder with .*, escaping the wildcard itself, so fallback placeholders never worked.

💡 Changes

  • Build the fallback pattern exactly like the perl branch: placeholder → escape-proof token → escape metacharacters → token → .*. Verified locally with perl masked: literal match, metachar rejection, custom placeholder and mid-line placeholder all behave like the perl path.
  • Multi-line placeholders remain perl-only (grep is line-based); that unit test skips without perl and the limitation is documented.
  • Fixes the red Alpine jobs from test(snapshot): cover the placeholder matcher and normalization internals #822.

The Alpine CI runs of #822 caught the grep fallback of
snapshot::match_with_placeholder broken: it escaped regex metacharacters
AFTER substituting the placeholder with '.*', so the wildcard itself got
escaped and the pattern could never match — every placeholder assertion on a
perl-less system failed (or matched wrongly under busybox grep).

Build the pattern exactly like the perl branch instead: swap the placeholder
for an escape-proof token, escape the metacharacters, then expand the token
to '.*'. Multi-line placeholders remain perl-only (grep matches line-by-line);
the multi-line unit test now skips without perl and the fallback limitation is
documented inline.

Closes the red Alpine jobs introduced by #822.
@Chemaclass Chemaclass added the bug Something isn't working label Jul 16, 2026
@Chemaclass Chemaclass self-assigned this Jul 16, 2026
@Chemaclass
Chemaclass merged commit c117be6 into main Jul 16, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the fix/snapshot-placeholder-fallback branch July 16, 2026 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant