Skip to content

Normalize the routing line in Symfony missing-route snapshots - #4555

Open
Leiyks wants to merge 2 commits into
masterfrom
dd/alexandre.rulleau/symfony-routing-snapshots-l77-1125
Open

Leiyks wants to merge 2 commits into
masterfrom
dd/alexandre.rulleau/symfony-routing-snapshots-l77-1125

Conversation

@Leiyks

@Leiyks Leiyks commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Description

The test_web_symfony_73 and test_web_symfony_latest suites run composer update, so they pick up the newest symfony/routing. Release v7.4.24 (2026-11-24) changed Matcher/Dumper/CompiledUrlMatcherTrait.php (a new comment line in the redirect path) and the ResourceNotFoundException for "/does_not_exist/" is now thrown from line 77 instead of 76 (same in v8.1.12, used by the Latest suite).

testScenarioGetToMissingRoute then failed on every PHP version and SAPI, on every branch including master, with a single mismatch on meta.error.message (:76 expected, :77 got).

This is a recurrence of #4402, which handled the previous shift (:70 -> :76) after symfony/routing v7.4.22 / v8.1.10. This PR first bumped the expected line to 77 the same way, but as the Bits Code Review comment pointed out, that only works for checkouts that install the new release: a checkout that reuses an older routing install (the Make targets skip Composer while the lock marker is newer than composer.json) still throws from line 76, and the next routing release will move it again. So instead of bumping the line, the line number is no longer compared:

  • tests/Common/SnapshotTestTrait.php: tracesFromWebRequestSnapshot() and stopAndCompareSnapshotSession() take an optional $regexPlaceholders (placeholder name => regex) and pass it to the test agent's regex_placeholders snapshot parameter, the same mechanism that already gives us {path}. The test agent replaces the matches in the received traces with {name}. Existing callers are unchanged.
  • Symfony V7_3 and Latest CommonScenariosTest::testScenarioGetToMissingRoute pass line => (?<=CompiledUrlMatcherTrait\.php:)\d+.
  • Both snapshots now expect CompiledUrlMatcherTrait.php:{line}. The rest of error.message (exception, message and file) is still compared; error.stack was already ignored.

Checked locally:

  • composer update --dry-run with both suites' composer.json resolves symfony/routing v7.4.24 (Version_7_3) and v8.1.12 (Latest); the throw is on line 76 in v7.4.22, v7.4.23, v8.1.10 and v8.1.11, and on line 77 in v7.4.24 and v8.1.12.
  • Ran the real SnapshotTestTrait against the CI test agent image (ddapm-test-agent v1.67.0, CI's SNAPSHOT_REGEX_PLACEHOLDERS, SNAPSHOT_CI=1), posting the snapshot traces with a chosen throw line:
    • With this change, both suites pass with line 76, 77 and 1234.
    • A different exception message still fails (meta mismatch on error.message), and so does calling without the placeholder.
    • With master's trait and the :77 snapshots (previous state of this PR), line 76 fails on both suites, which is the case the review comment describes.
  • The full Symfony web suites were not run locally; CI on this PR is the end-to-end check.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

🤖 Generated with Claude Code (https://claude.com/claude-code)


PR by Bits - View session in Datadog • Open in Slack

Comment @DataDog to request changes

The test_web_symfony_73 and test_web_symfony_latest suites run
`composer update`, so they pick up the newest symfony/routing. Release
v7.4.24 (2026-11-24) changed Matcher/Dumper/CompiledUrlMatcherTrait.php
and the ResourceNotFoundException for "/does_not_exist/" is now thrown
from line 77 instead of 76 (same in v8.1.12, used by the Latest suite).

testScenarioGetToMissingRoute then failed on every PHP version and SAPI
with a single mismatch on meta.error.message (:76 expected, :77 got).
Update the expected line in both snapshots. error.stack is already in
the ignored fields, so no other change is needed.

This is a recurrence of #4402, which handled the previous shift
(:70 -> :76) after symfony/routing v7.4.22 / v8.1.10.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Leiyks <55387832+Leiyks@users.noreply.github.com>
@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

View session in Datadog

Bits Code status: ✅ Done

CI Auto-fix: Disabled | Enable

Comment @DataDog to request changes

@Leiyks
Leiyks requested review from a team as code owners November 25, 2026 11:49
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-25T11:50:18.273263Z 19d336d PR opened
🔒 Security Review ✅ Completed 2026-11-25T11:52:20.686440Z 19d336d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Snapshots difference summary

The following differences have been observed in committed snapshots. It is meant to help the reviewer.
The diff is simplistic, so please check some files anyway while we improve it.

If you need to update snapshots, please refer to CONTRIBUTING.md

1 occurrences of :

- "error.message": "Thrown Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException: No routes found for \"/does_not_exist/\". in {path}/tests/Frameworks/Symfony/Latest/vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherTrait.php:76"
+ "error.message": "Thrown Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException: No routes found for \"/does_not_exist/\". in {path}/tests/Frameworks/Symfony/Latest/vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherTrait.php:{line}"

1 occurrences of :

- "error.message": "Thrown Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException: No routes found for \"/does_not_exist/\". in {path}/tests/Frameworks/Symfony/Version_7_3/vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherTrait.php:76"
+ "error.message": "Thrown Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException: No routes found for \"/does_not_exist/\". in {path}/tests/Frameworks/Symfony/Version_7_3/vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherTrait.php:{line}"

@datadog-prod-us1-4

datadog-prod-us1-4 Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

🎯 Code Coverage (details)
• Patch Coverage: 100.00%
• Overall Coverage: 80.91% (+0.00%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: a595648 | Docs | View more details | Give us feedback!

@datadog-prod-us1-4 datadog-prod-us1-4 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: FAIL

Both Symfony missing-route tests now fail when Make reuses a routing installation that still throws from line 76.

Open Bits AI session

🤖 Bits Code Review · Commit 19d336d

Address the Bits Code Review comment on #4555: bumping the expected line
to 77 only works for checkouts that pick up symfony/routing v7.4.24 /
v8.1.12. A checkout that reuses an older install (the Make targets skip
Composer while the lock marker is newer than composer.json) still throws
from line 76, and the next routing release will move it again.

Let tracesFromWebRequestSnapshot() pass per-test regex placeholders to
the test agent (its `regex_placeholders` snapshot parameter, the same
mechanism behind {path}), and have both Symfony missing-route tests
replace the CompiledUrlMatcherTrait.php line with {line}. The rest of
error.message, including the file, is still compared.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Leiyks <55387832+Leiyks@users.noreply.github.com>
@Leiyks Leiyks changed the title Update Symfony missing-route snapshots for symfony/routing 7.4.24 Normalize the routing line in Symfony missing-route snapshots Nov 25, 2026

@datadog-prod-us1-4 datadog-prod-us1-4 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bits Code Review: PASS

More details

The PR now normalizes Symfony exception line numbers with a scoped regex placeholder in both missing-route snapshots, passed through an optional shared-helper argument. This addresses recurring failures when routing releases move the throw statement. No findings remain open after the incremental static review. The Symfony suites were not run.

Was this helpful? React 👍 or 👎

Open Bits AI session

🤖 Bits Code Review · Commit a595648

@Leiyks
Leiyks enabled auto-merge (squash) November 25, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants