Repository navigation
feat(cli): check warns when text leaves the 9:16 social safe areas - #7680
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
There was a problem hiding this comment.
Requesting changes at d201a5a4 for one blocker: CI's Fallow audit job fails because of this change. The feature itself looks right.
Blocker
- Fallow reports two new complexity findings in functions this PR grows. Recent merged PRs (#7663, #7659) pass this gate.
checkPipeline.ts:473collectGeometryAt: cognitive complexity 17, threshold 15. The newrequest.blocksbranch pushes it over.checkPipeline.ts:584collectGridSamples: CRAP score 43.1, threshold 30. The newgeometryEnabledandsafeZonesconditions push it over.- Fallow also flags
layoutAudit.ts:343applyPersistenceTierat 31.6. This PR only adds a union member to that file, so it may clear once the other two do. - Suggested fix: move each candidate's findings into a helper such as
geometryFindings(candidate, request, …), and buildSampleSets.safeZonesin its own function.
What I checked
- At this head on Linux,
check.test.tsandlayout-audit.browser.test.tspass: 417 of 417. - The three breaks listed in the body each fail exactly the test named for them (1 failed, 416 passed):
- TikTok using only its first band
- caption stages skipped again
- safe-zone warnings counted toward
--strict
- Other CI at this head is green: Typecheck, Build, Test, regression, Windows render verification, preview-regression, Docs, CodeQL, Player perf, PR captures.
- The table math matches the body. Shorts' clear area ends at x 888 and y 1248, which is 1080−192 and 1920−672. The caption band and frame checks only read
kind === "text"andkind === "media"candidates, soblockcandidates can't reach them. Grouping keys on selector and code, so a caption stage whose text changes still yields one finding.
Non-blocking
strictWarningCountsubtracts safe-zone warnings counted after themaxIssuescap (80). Findings are sorted by severity, then time. If there are more than 80 layout findings, early safe-zone warnings can push real warnings past the cap, and--strictthen passes. That is most likely with--no-collapse-static. Counting safe-zone warnings before truncation would close this.
|
Fixed at c320c8d:
Tests on Linux: |
There was a problem hiding this comment.
Requesting changes at c320c8d2. The required Test check fails because of this change. Both earlier points are fixed.
Blocker
- In CI run 43538992900, test #501 "the entry skill's safe boxes equal the preview's" fails at
scripts/creator-editing-recipes.test.mjs:62. The "Test (support)" shard fails, and the required "Test" job fails with it.- The test reads
packages/studio/src/utils/previewSafeMargins.tsand regex-matchesACTION_SAFE_PERCENT = (\d+)andTITLE_SAFE_PERCENT = (\d+). That file now only re-exports the constants from@hyperframes/core/safe-areas, so both matches come backundefinedand the test asserts/undefined% action-safe/against the entry skill. - Fix: point the test at
packages/core/src/safeAreas.ts, which is now where the values live, and runnode --test scripts/creator-editing-recipes.test.mjs.
- The test reads
Fixed since my last review
- Fallow:
collectGeometryAtis now a flat map, and the sample sets are built inbuildSampleSets. The CI run no longer has a Fallow failure. --max-issues:limitLayoutIssuessorts guidance findings after defects of the same severity. The new test "never lets a safe-zone warning push a defect warning past --max-issues" fails when I take that sort out (1 failed, 418 passed).--safe-zone standard: "checks title-safe margins on any frame when asked for standard" fails whenstandardis limited to 9:16 frames again. The earlier--strictbreak still fails only "warns once…".- Locally at this head,
check.test.tsandlayout-audit.browser.test.tspass 419/419. CorelightEntries.test.ts, which now includes./safe-areas, passes 4/4. StudiopreviewSafeMargins.test.tspasses 2/2.
Note on PR captures
- The
pull_requestrun of "Studio and player captures" (43538992684) failed. It read the body from before## No visible changewas added, and re-running it reuses that same old body. - I started a
workflow_dispatchrun on the branch, which reads the current body. It passed (43540461596). The gate script also passes locally against the current body.
|
Fixed at e585f25. On Linux, No other file reads those constants by path. A grep for The "Studio: edit accuracy" red at c320c8d came from run 43538795881, which was cancelled when a newer run on the same head replaced it. |
There was a problem hiding this comment.
Approve at e585f25f.
- The only change since
c320c8d2is the one-line path fix inscripts/creator-editing-recipes.test.mjs. The entry-skill safe-box test now readspackages/core/src/safeAreas.ts. - Locally, with
node --import tsx --test scripts/creator-editing-recipes.test.mjs: the new head passes 8/8. With the old path restored, only "the entry skill's safe boxes equal the preview's" fails (7 passed, 1 failed). - Every Actions run at this head is green. That includes CI, where the Test (support) shard and Fallow both pass, plus PR captures on the current body, regression, Windows render verification, preview-regression, Docs, CodeQL and Player perf.
- The rest of the PR is unchanged from what I checked at
c320c8d2: 419/419 CLI tests, and the--max-issues,standardand--strictbreaks each fail only their named test.
What
hyperframes checknow tells you which visible text, captions included, sits outside the TikTok, Instagram Reels and YouTube Shorts safe areas on a 9:16 composition. Each finding names the element, the first time it was seen and the edge it crosses.outside_safe_zonewarnings. They never fail the check,--strictincluded.--safe-zone tiktok|reels|shortschecks one platform only.--safe-zone offturns the check off.--safe-zone standardchecks the title-safe margins (10% in from each edge, the preview's Standard margins) on any aspect ratio. It's opt-in only: the 9:16 default stays the three platforms.standardis asked for.data-layout-allow-safe-zoneopts out an element and everything inside it, the same waydata-layout-allow-caption-zoneworks.Why
An agent making a vertical video can't see where the platform buttons and caption will cover it. A preview can draw these areas, but
checkcouldn't report them, so a caption under the buttons passed every check.Related work
None.
How
@hyperframes/core/safe-areas(packages/core/src/safeAreas.ts) owns the areas, so there is one copy of the data:SOCIAL_SAFE_AREAS: each clear area as a list of horizontal bands in that platform's reference frame, scaled to the composition. TikTok has two bands, for its stepped right edge beside the action buttons.packages/studio/src/utils/previewSafeMargins.ts, which now re-exports them, so the preview andcheckread the same numbers.packages/cli/src/utils/safeZones.tskeeps only the geometry: which edges of an area a box crosses, and which areas apply to a frame. The social areas apply only to 9:16;standardapplies to any frame.--caption-zonepath: same geometry collector, same sampling, same finding plumbing. There is no second pipeline. A newblocksrequest makes the collector return one text box per reading block, so a headline split into word spans is one finding. A caption stage (.caption-layer,#caption-stage,[data-composition-id="captions"]) counts as one block. That collector skips caption stages today, because captions belong in the caption band, but for safe zones captions are the main thing to check, soblocksincludes them. The existing text and media candidates are unchanged.--strictsubtracts safe-zone warnings the same way it already subtracts craft warnings. These areas are platform guidance, not defects.isGuidanceIssueinlayoutAudit.tsis the one place that says so.--max-issuestruncates, guidance ranks after defect warnings of the same severity. So a safe-zone warning can never push a real warning out of the report, which would otherwise let--strictpass.collectGeometryAtare oneflatMap, and the sample sets are built in their ownbuildSampleSets.applyPersistenceTier's held promotions move intoheldPromotion, with the same behaviour;layoutAudit.test.tspasses unchanged.Test plan
fails without the fix:
packages/cli/src/commands/check.test.ts"social safe zones" covers these cases:--strictstill passes.--max-issues 1 --strict, a caption-band warning is kept over earlier safe-zone warnings, and the check fails.packages/cli/src/commands/layout-audit.browser.test.ts"groups text into reading blocks, caption layers included, for the safe-zone check" checks that word spans join into one block, that the caption layer is one block and that opted-out text is dropped.Each test was checked against a break on Linux, and each break turned exactly that one test red and left the rest passing:
--strictfailed "warns once…".standardlimited to 9:16 frames failed "checks title-safe margins on any frame…".standardnot accepted by the parser failed "parses --safe-zone".check.test.ts+layout-audit.browser.test.ts+layoutAudit.test.tson Linux: exit 0, 461 passed.bunx fallow audit --base origin/main: exit 0, dead code 0, complexity 0, duplication 0. CorelightEntries.test.ts, with./safe-areasadded to the entries that must load none of the parsers: exit 0, 4 passed. StudiopreviewSafeMargins.test.ts, now reading the constants through core: exit 0, 2 passed. oxlint and oxfmt are clean on the changed files. tsc shows only errors from packages not built in that checkout (@hyperframes/inspector/live,core/audio-fx-runtime), none in the changed files. CI runs the full type check.Real run of the CLI from source on Linux, on a 1080x1920 fixture with these elements:
@handleat the bottom markeddata-layout-allow-safe-zone.Commands used:
check --no-contrast --no-craft --no-cache, the same with--safe-zone standard, the same with--strict --json, and--safe-zone instagram.Default (exit 0):
--safe-zone standard(exit 0): the caption sits inside the 10% margins, and the badge does not.--strict --json(exit 0):"ok": true, "strict": true, with both warnings inlayout.findings(codeoutside_safe_zone,time,rect,times).--safe-zone instagram(exit 2):✗ Check failed: Invalid --safe-zone; use tiktok, reels, shorts, standard or off.An earlier run with
--safe-zone offprintedLayout ◇ 0 issues across 9 sample(s).No visible change
packages/studio/src/utils/previewSafeMargins.tsnow re-exports the same four values from@hyperframes/core/safe-areas. They're the same numbers, so the preview guides draw exactly as before.Not checked: a real caption component from the registry, and right-to-left text.