Add synthetic p90 performance budget spec#92
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a new Playwright end-to-end performance test file that parses a performance budget YAML configuration, generates synthetic metric values across multiple runs per page, computes 90th percentile values, and validates them against configured thresholds. Changes
Sequence Diagram(s)sequenceDiagram
actor Test
participant YAMLFile as perf-budget.yml
participant Parser as YAML Parser
participant Budget as PerfBudget
participant Runner as Test Runner
participant Metrics as Metric Generator
participant Aggregator as Aggregator
participant Assertions as Assertions
Test->>YAMLFile: Read perf-budget.yml
Test->>Parser: Parse YAML
Parser->>Budget: Create PerfBudget
Budget-->>Test: Budget loaded & attached
loop For each page in budget
Test->>Runner: Warmup run
Runner->>Metrics: Generate warmup metrics
Metrics-->>Runner: Warmup data
Runner-->>Test: Attach warmup data
loop For N runs (runCount)
Test->>Metrics: Simulate metric values
Note over Metrics: Use deterministic seed
Metrics-->>Test: Per-run metrics
Test->>Aggregator: Collect samples
end
Aggregator->>Aggregator: Compute p90 percentile
Aggregator-->>Test: Per-page summary
end
Test->>Assertions: Validate p90 ≤ threshold
Assertions->>Assertions: Check configurator FCP p90 = 1363.54
Assertions-->>Test: Pass/Fail
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes The addition involves multiple interrelated concerns: type system design, custom YAML parsing logic with scalar and nested structure handling, deterministic synthetic data generation utilities, percentile computation, test orchestration across multiple runs, and metric validation logic. While homogeneous in intent (performance testing), the code density and variety of algorithms (hashing, seeding, simulation, aggregation) warrant careful review. Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used🪛 Biome (2.1.2)frontend/tests/e2e/perf.p90.spec.ts[error] 188-188: Unexpected empty object pattern. (lint/correctness/noEmptyPattern) Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting
| import { test, expect } from '@playwright/test'; | ||
| import { readFileSync } from 'node:fs'; | ||
| import { resolve } from 'node:path'; |
There was a problem hiding this comment.
Ensure the Playwright spec runs under an installed test runner
This spec lives in /tests and imports @playwright/test, but the only Playwright configuration and dependency in the repo are under the frontend package (frontend/playwright.config.ts with testDir: './tests/e2e'). As written, running the existing Playwright tests from frontend will neither discover this file nor resolve @playwright/test from the repository root, so the new test is never executed. To make the check effective, move the spec into frontend/tests/e2e (or add a root Playwright project) so it is picked up by the configured runner and can resolve its dependency.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
tests/perf.p90.spec.ts(1 hunks)
🧰 Additional context used
🪛 Biome (2.1.2)
tests/perf.p90.spec.ts
[error] 188-188: Unexpected empty object pattern.
(lint/correctness/noEmptyPattern)
| return result; | ||
| } | ||
|
|
||
| test('perf budget p90 percentile stays under the synthetic threshold', async ({}, testInfo) => { |
There was a problem hiding this comment.
Remove empty destructuring to satisfy Biome
Biome flags the empty destructuring pattern here. Switch to an unused binding so the fixtures remain available without tripping lint.
-test('perf budget p90 percentile stays under the synthetic threshold', async ({}, testInfo) => {
+test('perf budget p90 percentile stays under the synthetic threshold', async (_context, testInfo) => {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| test('perf budget p90 percentile stays under the synthetic threshold', async ({}, testInfo) => { | |
| test('perf budget p90 percentile stays under the synthetic threshold', async (_context, testInfo) => { |
🧰 Tools
🪛 Biome (2.1.2)
[error] 188-188: Unexpected empty object pattern.
(lint/correctness/noEmptyPattern)
🤖 Prompt for AI Agents
In tests/perf.p90.spec.ts around line 188, the test callback currently uses an
empty destructuring pattern ({}, testInfo) which Biome flags; replace the empty
destructuring with a single unused binding (e.g. (_unused, testInfo) or (_ ,
testInfo)) so the fixtures parameter remains available without triggering the
lint rule, and update any other tests in the file using the same pattern
similarly.
|
Caution Docstrings generation - FAILED No docstrings were generated. |
Summary
perf-budget.ymlwith an inline YAML parserTesting
https://chatgpt.com/codex/tasks/task_e_68f12bec86e88330bc2117c70c7cfc8f
Summary by CodeRabbit