Repository navigation
test(visual): consume the automatic fit before resizing the requirement capture - #40
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…nt capture The narrow requirement captures resized the page while the diagram's one-shot automatic fit could still be pending. A fit that ran after the resize used the narrow canvas, and although the zoom normalization restores the scale, the pan keeps a different sub-pixel remainder that the integer middle-button drag in centerRequirementCard cannot remove, shifting the whole diagram. Round-trip the editor mode at the initial size so the fit's completion is observable before the viewport changes. Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration
Bot
requested review from
HuiJun and
rororowyourboat
as code owners
November 14, 2026 09:08
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Test-only. Removes the capture race behind the intermittent
requirement hierarchy and declared satisfaction in {light,dark} at 768failures (requirements-{light,dark}-768.png, ~1,800–1,900 px, the whole requirement diagram shifted by a fraction of a pixel). No application code, baseline PNG or diff threshold changes.Cause. The diagram fits itself once, two animation frames after its nodes are measured (
FitOnReadyinDiagram.tsx), at whatever size the canvas has at that moment. The scenario only waited for the requirement card to be visible and then calledpage.setViewportSize({ width: 768 }). Usually the fit had already run on the 1440 px layout; occasionally the resize won, the pending fit was rescheduled and ran on the narrow canvas instead:zoomRequirementForReadingcenterRequirementCard0.392665 @ 37.288, 169.0730.803755 @ -204.25, 41.424-295.25, -228.5760.207714 @ 19.5074, 195.4840.803755 @ -693.548, -78.6014-295.548, -228.601zoomRequirementForReadingnormalizes the scale through the maximum-zoom endpoint, but not the pan.centerRequirementCardthen pans with a real middle-button drag, which moves by whole pixels, so the different sub-pixel remainder (.25vs.548) survives into the screenshot. The drag helper itself is deterministic; its input was not.Fix.
consumeRequirementAutomaticFit(tests/e2e/requirements-support.ts) runs before the resize. The pending fit is not observable on its own (it lands on the same camera React Flow's initialfitViewalready produced), so the helper round-trips the editor mode with the visible Split and Diagram buttons: each mode change re-arms the fit, Split must move the camera away from the full-canvas fit and Diagram must bring it back to exactly that camera. Once that retrying assertion holds, the one-shot fit has run at the 1440 px layout and the later resize cannot refit. The comment onzoomRequirementForReadingthat claimed independence from the initial fit is corrected to scale-only.PR #39 should be re-run after this lands; its remaining
requirements-dark-768.pngfailure is this race.Evidence
Node 26.3.1, Playwright's bundled Chromium, production build with the real pinned engines, Linux.
develop):npm run test:e2e -- --project=visual --grep 'requirement hierarchy' --repeat-each=5and a second run with--repeat-each=6of the 768 pair: 7 of 22 narrow captures took the late-fit path (1,814 px dark / 1,900 px light against the baseline); the camera log above is from those runs.--grep 'requirement hierarchy' --repeat-each=6,--grep 'requirement hierarchy.*768' --repeat-each=15, and the whole visual project with--repeat-each=3): every one is on the baseline camera, and therequirements-overview-*captures taken after the mode round trip are unchanged from before the fix. In the whole-project run each of the 89 scenarios gave the same result in all three repeats.Validaterun on this PR: 17 critical scenarios and all 89 visual comparisons passed against the checked-in baselines.npm run check: passed (formatting, architecture, typecheck, unit and script tests).Local limitation: this machine's glyph antialiasing differs from the baseline runner by a constant 14 px (28 px for the light overview) of isolated text pixels in every requirement capture, before and after the change, so local runs establish the camera and capture-to-capture stability, not an exact baseline match. The hosted visual run on this PR is the exact comparison.
Compatibility
None. Tests only; no source/model/view, saved-format, dependency or engine-profile effect.