Skip to content

fix: skip frontend-app resolution when Playwright settings aren't configured - #627

Merged
jonathanong merged 1 commit into
mainfrom
fix/multi-app-graph-playwright-gate
Aug 4, 2026
Merged

fix: skip frontend-app resolution when Playwright settings aren't configured#627
jonathanong merged 1 commit into
mainfrom
fix/multi-app-graph-playwright-gate

Conversation

@jonathanong

Copy link
Copy Markdown
Owner

Summary

Follow-up to #626. While investigating a CodSpeed memory-regression flag on that PR (graph/all_domains_build, -23.27% memory efficiency), I traced the actual code path and found a real, if narrow, inefficiency introduced by that PR — not the confirmed cause of the CodSpeed number (see below), but worth fixing on its own merits.

no-mistakes graph's prepare_graph_config unconditionally called frontend_apps_or_default (full frontend-app resolution, including next.config.* root inference) whenever Playwright route/selector edges were requested — even for repositories that configure type: nextjs projects for reasons unrelated to Playwright and have zero tests.playwright.* configuration. In that shape, every per-app settings_from_loaded_v2 call collapses to the same app-agnostic settings_from_defaults fallback regardless of which app is named, so the resolved app set was silently discarded unused.

Worse than wasted work: if that unused app-resolution attempt hit an ambiguous root (two or more next.config.* files, no explicit root:), it failed the entire graph build for a repository that never touches Playwright at all.

Fix

Gates the per-app resolution behind has_v2_playwright_settings — the same check settings_from_loaded_v2 already uses internally to decide between the two branches — newly exposed as crate::playwright::config::has_v2_playwright_settings. When it's false, one bare-defaults Settings is built directly with zero app-resolution work, exactly matching pre-#624 behavior.

On the CodSpeed regression itself

Traced all three flagged benchmarks:

  • repeated_imports_from_one_file (TS-import resolver caching) and facts/imports_and_symbols (raw collect_ts_facts extraction) call into code fix: resolve frontend apps independently for multi-Next.js-app repositories #626 never touches at all — confirmed by reading both benchmarks' source and the benchmark_support module they depend on.
  • graph/all_domains_build does touch fix: resolve frontend apps independently for multi-Next.js-app repositories #626's code, but its fixture has an explicit root: (no inference scan) and — this PR's finding — was hitting the "resolved then discarded" path described above, not a scan-heavy one. The magnitude of the flagged 2.5MB delta seems too large to be explained by that alone, especially with two demonstrably-unrelated benchmarks flagged at similar magnitude.
  • The report itself notes: "No successful run was found on main (28578aa)... cce4566 was used instead as the comparison base." — i.e. it wasn't comparing against the actual PR base.

Net: the report is most likely dominated by that baseline mismatch, not by #626's code. This PR closes the one real gap found while checking.

Test plan

  • New fixture (type: nextjs project, no root:, two ambiguous next.config.* files, zero tests.playwright.*) proves prepare_graph_config now succeeds where it previously failed outright, since app resolution is skipped rather than attempted-and-failed.
  • cargo test -p no-mistakes --lib — 5189 passed, 0 failed.
  • cargo clippy -p no-mistakes --all-targets --all-features -- -D warnings — clean.
  • cargo llvm-cov — 99.11% lines / 99.04% functions, above the 99%/99% gate.
  • cargo fmt --check — clean.

https://claude.ai/code/session_01LqTgxthoZxVxKHJDDYnctU

…figured

no-mistakes graph unconditionally resolved the full frontend-app set
(frontend_apps_or_default, including root inference) whenever Playwright
edges were requested, even for repositories with type: nextjs projects
configured for unrelated reasons and zero tests.playwright.* signal. Every
per-app settings_from_loaded_v2 call in that case collapses to the same
app-agnostic settings_from_defaults fallback regardless of which app is
named, so the resolved app set was silently discarded unused — and worse,
an unresolvable app root (ambiguous next.config.* inference) failed the
whole graph build outright for repos that never touch Playwright at all.

Gates the per-app resolution behind the same has_v2_playwright_settings
check settings_from_loaded_v2 already uses internally, newly exposed from
playwright::config. When it's false, one bare-defaults Settings is built
directly, matching pre-#624 behavior with zero app-resolution work.

Found while investigating a CodSpeed memory-regression flag on #626; two of
the three flagged benchmarks (repeated_imports_from_one_file,
facts/imports_and_symbols) don't reach any code from that PR at all, so the
report is likely dominated by its own acknowledged baseline mismatch rather
than this specific gap — but the gap was real regardless and is worth
closing on its own principle-following merits (declare the complete
fact/relationship demand at the boundary before collecting it).
@chatgpt-codex-connector

This comment has been minimized.

@sourcery-ai

sourcery-ai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR gates Playwright-related frontend app resolution on actual Playwright configuration, and adds a regression test fixture to ensure graphs for Next.js projects without Playwright no longer fail or perform unnecessary work.

File-Level Changes

Change Details Files
Gate Playwright settings/app resolution on presence of v2 Playwright configuration and provide a default settings path when Playwright is unconfigured. crates/no-mistakes/src/codebase/dependencies/graph/files_config_prepared.rs
Expose and reuse a shared helper to detect v2 Playwright configuration across modules.
  • Add a public (crate-level) has_v2_playwright_settings function in playwright::config that proxies to the loader helper.
  • Re-export helpers::has_v2_playwright_settings from playwright::config::load and adjust visibility so it can be used by other modules.
crates/no-mistakes/src/playwright/config.rs
crates/no-mistakes/src/playwright/config/load.rs
crates/no-mistakes/src/playwright/config/load/helpers.rs
Add a regression test and fixture for Next.js projects without Playwright configuration to validate that graph preparation succeeds and skips app resolution.
  • Add a new unit test prepare_graph_config_skips_app_resolution_when_playwright_is_unconfigured that asserts has_v2_playwright_settings is false and that prepare_graph_config succeeds without app resolution.
  • Add a new test fixture representing a Next.js project with ambiguous roots (two next.config.ts files) and no Playwright configuration.
  • Ensure the prepared Playwright fact plan is still built from bare-defaults Settings in the unconfigured case.
crates/no-mistakes/src/codebase/dependencies/graph/tests/config_path_full_graph.rs
test-cases/codebase-analysis/graph-nextjs-project-without-playwright/fixture/.no-mistakes.yml
test-cases/codebase-analysis/graph-nextjs-project-without-playwright/fixture/a/next.config.ts
test-cases/codebase-analysis/graph-nextjs-project-without-playwright/fixture/b/next.config.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes

    • Improved Playwright configuration handling when no frontend checks are enabled.
    • Projects without Playwright configuration now use default settings instead of failing or producing no settings.
    • Preserved app-specific settings when configured per-app Playwright projects are enabled.
  • Tests

    • Added regression coverage for Next.js projects without Playwright configuration.
    • Added test fixtures to validate successful graph preparation and default Playwright planning.

Walkthrough

Playwright graph preparation now skips frontend-app resolution when checks are disabled. When checks are enabled without v2 settings, it creates one default app-agnostic settings entry. A regression test covers an unconfigured Next.js project.

Changes

Playwright graph preparation

Layer / File(s) Summary
Expose Playwright configuration detection
crates/no-mistakes/src/playwright/config.rs, crates/no-mistakes/src/playwright/config/load.rs, crates/no-mistakes/src/playwright/config/load/helpers.rs
The has_v2_playwright_settings helper is available across the crate.
Select graph Playwright settings
crates/no-mistakes/src/codebase/dependencies/graph/files_config_prepared.rs
Preparation returns no settings when route and selector checks are disabled. Otherwise, it preserves configured v2 settings or creates one default entry without a frontend app.
Validate unconfigured Next.js preparation
crates/no-mistakes/src/codebase/dependencies/graph/tests/config_path_full_graph.rs, test-cases/codebase-analysis/graph-nextjs-project-without-playwright/fixture/*
The regression test covers an unresolvable Next.js project without Playwright configuration and verifies the default Playwright fact plan.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: skipping frontend-app resolution when Playwright settings are absent.
Description check ✅ Passed The description directly explains the inefficiency, the fix, the regression fixture, and the validation results.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
crates/no-mistakes/src/codebase/dependencies/graph/tests/config_path_full_graph.rs (1)

325-337: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Shorten the test invariant comment.

Keep the fixture rationale, but reduce this 13-line doc comment to the invariant under test. The implementation details and review-history wording duplicate the test body and make the fixture harder to scan.

Use two short comments such as:

// This fixture has ambiguous Next.js roots but no Playwright configuration.
// Graph preparation must skip app resolution and still build a default fact plan.

As per coding guidelines, “Add short comments to intentionally counterintuitive fixtures or tests to preserve the invariant they protect.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@crates/no-mistakes/src/codebase/dependencies/graph/tests/config_path_full_graph.rs`
around lines 325 - 337, Shorten the doc comment above the ambiguous Next.js
fixture to two concise lines stating that it has no Playwright configuration and
that graph preparation must skip app resolution while building the default fact
plan. Remove implementation details, function references, and review-history
discussion while preserving the fixture rationale and invariant.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@crates/no-mistakes/src/codebase/dependencies/graph/tests/config_path_full_graph.rs`:
- Around line 325-337: Shorten the doc comment above the ambiguous Next.js
fixture to two concise lines stating that it has no Playwright configuration and
that graph preparation must skip app resolution while building the default fact
plan. Remove implementation details, function references, and review-history
discussion while preserving the fixture rationale and invariant.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1e780371-40fa-428b-9c19-ebda4c2c2422

📥 Commits

Reviewing files that changed from the base of the PR and between 121fbfc and 2b2f1cf.

📒 Files selected for processing (8)
  • crates/no-mistakes/src/codebase/dependencies/graph/files_config_prepared.rs
  • crates/no-mistakes/src/codebase/dependencies/graph/tests/config_path_full_graph.rs
  • crates/no-mistakes/src/playwright/config.rs
  • crates/no-mistakes/src/playwright/config/load.rs
  • crates/no-mistakes/src/playwright/config/load/helpers.rs
  • test-cases/codebase-analysis/graph-nextjs-project-without-playwright/fixture/.no-mistakes.yml
  • test-cases/codebase-analysis/graph-nextjs-project-without-playwright/fixture/a/next.config.ts
  • test-cases/codebase-analysis/graph-nextjs-project-without-playwright/fixture/b/next.config.ts

@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 99.24%. Comparing base (121fbfc) to head (2b2f1cf).

Files with missing lines Patch % Lines
...debase/dependencies/graph/files_config_prepared.rs 90.90% 1 Missing ⚠️

❌ Your patch check has failed because the patch coverage (93.33%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #627      +/-   ##
==========================================
- Coverage   99.24%   99.24%   -0.01%     
==========================================
  Files        1277     1277              
  Lines      100527   100539      +12     
==========================================
+ Hits        99772    99780       +8     
- Misses        755      759       +4     
Flag Coverage Δ
javascript 99.67% <ø> (ø)
rust 99.23% <93.33%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jonathanong
jonathanong enabled auto-merge (squash) August 4, 2026 21:56
@jonathanong
jonathanong merged commit e51709e into main Aug 4, 2026
19 of 20 checks passed
@jonathanong
jonathanong deleted the fix/multi-app-graph-playwright-gate branch August 4, 2026 21:58
@codspeed-hq

codspeed-hq Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 54 untouched benchmarks
⏩ 4 skipped benchmarks1


Comparing fix/multi-app-graph-playwright-gate (2b2f1cf) with main (121fbfc)

Open in CodSpeed

Footnotes

  1. 4 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

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.

1 participant