Repository navigation
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
2e8d135 to
f71be6d
Compare
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Visual Regression46 of 504 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 26 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
f71be6d to
1eef287
Compare
1a2db6e to
0909b88
Compare
0909b88 to
76689af
Compare
76689af to
ff5c6b2
Compare
5380aa3 to
3daa75a
Compare
There was a problem hiding this comment.
Changes requested: the per-commit iOS screenshot pipeline works (this pull request's CI run uploaded all 38 light and dark frames), but the test's emptiness check can never fail. ScreenshotTests.swift:160 only requires the PNG to be larger than 1×1, and every capture is at least 720×64 pixels because of the fixed 360-point width and the 16-point ground padding, so a component that renders blank still passes while the README says each state must draw a non-empty image. Please make the check look at pixels (for example, require at least one pixel that differs from color-background-body) or drop that promise, and consider describing the captures as key states at the default text size in the README tree entry, since AST-093 FR5 also asks for the largest text size.
[Automated review]
| for (scheme, name) in [(ColorScheme.light, "light"), (.dark, "dark")] { | ||
| let data = try #require(png(of: capture, scheme: scheme), "\(capture.component) \(capture.state) \(name) drew nothing") | ||
| let image = try #require(UIImage(data: data)) | ||
| #expect(image.size.width > 1 && image.size.height > 1, "\(capture.component) \(capture.state) \(name) is empty") |
There was a problem hiding this comment.
This check can't fail: every capture is 360 pt wide and Ground pads its content by 16 pt on each side, so the PNG is always at least 720×64 px, and a state that draws only the page ground still passes. To back the README's "each state must draw a non-empty image", require at least one pixel that differs from the color-background-body ground (the Pixels.contains(where:) pattern in Tests/AstryxTests/Pixels.swift), or drop that promise.
| ## Screenshots | ||
|
|
||
| `Tests/AstryxScreenshotTests/` draws every component in its key states, in | ||
| light and dark, on the iOS Simulator; each state must draw a non-empty image. |
There was a problem hiding this comment.
The test doesn't enforce this today (see the size check in ScreenshotTests.swift, line 160): either make that check look at pixels or drop "each state must draw a non-empty image".
| │ └── Generated/ # generated; do not edit | ||
| ├── Tests/ | ||
| │ ├── AstryxTests/ | ||
| │ ├── AstryxScreenshotTests/ # draws every component state on the iOS Simulator |
There was a problem hiding this comment.
The target draws key states at the default text size (no capture sets dynamicTypeSize, and TextInput's .sm and .lg are never drawn), while AST-093 FR5 asks for every state at the largest text size too. "key states", as line 144 says, would avoid reading this artifact as FR5-complete.
3daa75a to
8455492
Compare
8455492 to
1cec31f
Compare
There was a problem hiding this comment.
Changes requested: the per-commit iOS screenshot artifact works (the pull request's CI run uploaded all 42 light and dark frames), but the test's emptiness check still cannot fail. ScreenshotTests.swift:249 only requires the decoded PNG to be larger than 1×1 pixel, while every capture is 720 pixels wide and at least 2 pixels tall by construction (64 with the ground padding), so a component that renders blank still passes even though README line 188 says each state must draw a non-empty image. Please make the check look at pixels (for example, require at least one pixel that differs from color-background-body, as Tests/AstryxTests/Pixels.swift does) or drop that promise, and describe the target as drawing key states on README line 39, since AST-093 FR5 also asks for every state at the largest text size.
[Automated review]
| for (scheme, name) in [(ColorScheme.light, "light"), (.dark, "dark")] { | ||
| let data = try #require(png(of: capture, scheme: scheme), "\(capture.component) \(capture.state) \(name) drew nothing") | ||
| let image = try #require(UIImage(data: data)) | ||
| #expect(image.size.width > 1 && image.size.height > 1, "\(capture.component) \(capture.state) \(name) is empty") |
There was a problem hiding this comment.
This check can't fail: every capture is 360 pt wide and hosted() clamps the height to at least 1 pt (line 169), so at format.scale = 2 the decoded PNG is never under 720×2 px (720×64 with Ground's padding), whatever the component draws. To back the README's "each state must draw a non-empty image" (README line 188), require at least one pixel that differs from the color-background-body ground (the Pixels.contains(where:) / close(_:_:within:) pattern in Tests/AstryxTests/Pixels.swift), or drop that promise.
1cec31f to
f760260
Compare
There was a problem hiding this comment.
Changes requested: the per-commit iOS screenshot artifact works (this head's CI run uploaded all 42 light and dark frames), but the test's emptiness check still cannot fail. ScreenshotTests.swift:249 only requires the decoded PNG to be larger than 1×1 pixel, while every capture is 720 pixels wide and at least 2 pixels tall by construction (64 with the ground padding), so a component that renders blank still passes even though README line 192 says each state must draw a non-empty image. Please make the check look at pixels (for example, require at least one pixel that differs from the color-background-body ground, as Tests/AstryxTests/Pixels.swift does) or drop that promise, and describe the target as drawing key states on README line 39, since AST-093 FR5 also asks for every state at the largest text size.
[Automated review]
| for (scheme, name) in [(ColorScheme.light, "light"), (.dark, "dark")] { | ||
| let data = try #require(png(of: capture, scheme: scheme), "\(capture.component) \(capture.state) \(name) drew nothing") | ||
| let image = try #require(UIImage(data: data)) | ||
| #expect(image.size.width > 1 && image.size.height > 1, "\(capture.component) \(capture.state) \(name) is empty") |
There was a problem hiding this comment.
This check can't fail: every capture is 360 pt wide (line 32) and hosted() clamps the height to at least 1 pt (line 169), so at format.scale = 2 the decoded PNG is never under 720×2 px (720×64 with Ground's padding), whatever the component draws. To back the README's "each state must draw a non-empty image" (README line 192), require at least one pixel that differs from the color-background-body ground beyond a small tolerance (the contains(where:) / close(_:_:within:) comparison in Tests/AstryxTests/Pixels.swift, applied to this image), or drop that promise.
Maintainer impact
Nothing draws the native SwiftUI components to images. Without building an app, nobody can see a native component's states, or compare them with the web components of the same commit.
Intended invariant
AST-093 FR5: native component changes ship with captures of every state, light and dark. Every pull request that changes native Swift produces those captures from a real iOS Simulator, named by the head commit so they line up with the web screenshots of the same commit.
Change
packages/native/apple/Tests/AstryxScreenshotTests/(new test target, depends only on theAstryxproduct) draws every component in its key states, in light and dark, through a hosting controller in a shown window. Card is also drawn with Increase Contrast on and at the largest text size, both applied as traits. A test checks that both settings reach the drawn view.ImageRendererleaves UIKit-backed views such as text fields empty, so the test doesn't use it. Each state must draw a non-empty image. WhenASTRYX_SCREENSHOT_DIRis set, each image is also written as<Component>/<state>-<light|dark>.png..github/scripts/native-swift.sh: whenASTRYX_SCREENSHOT_DIRis set, it is passed to each package's iOS Simulator tests as<dir>/<package>(xcodebuild forwardsTEST_RUNNER_*)..github/workflows/ci.yml:test-native-swiftsets the directory and uploads it asnative-screenshots-<head sha>(30 days), only when native Swift changed.ci-native-swift.test.mjspins the variable and the artifact name.apple/README.mdgets a Screenshots section.Page templates are a separate package, so they are not captured here.
Evidence
test-native-swiftrun uploadsnative-screenshots-<head sha>with one PNG per state (Button, TextInput, Text, Heading, Card, and Banner states, light and dark, plus Card with Increase Contrast and at the largest text size). At 1cec31f it produced 42 PNGs (21 states, light and dark), each checked by eye. The Increase Contrast capture matches the default until the components honor that setting.Scope
Testing
pnpm vitest run --project node .github/scripts/ci-native-swift.test.mjs: 6 tests pass.test-native-swiftjob.