Correct the switch-hover record, keep foreign links out of the parity rewrite, and quieten the switch reset
The record of the switch hover control in the commit before this one is wrong, and this body corrects it. With the two [rst-switch]:hover rules cut from a scratch tokens.css, two preservation drives ported in that commit go red: TestTheKnobIsLitAndTheTrackSheenFollowsIt (no 40px sheen on the hovered on track, in all three legs) and TestTheTrackSitsInAndTheKnobLiftsOnHover (day's knob does not lift). The parity drive goes red too. The matrix, TestEveryThemeRendersAsItDidExceptDay, stays green by its stated design: it leaves day out, and day is the only theme that declares the depth tokens those rules read. That is not a blind spot in SEED's coverage, as the earlier body and report said; the switch drives cover the rule, and the matrix is already passing for that mutation. A mutation the matrix can see, plain's --rst-shadow-knob set to a red ring in a scratch copy, turns its plain pair red on the switch cells. Four small changes beside the record. The parity drive's comment says a still photograph cannot see what shell.css holds, the phone-width view transitions pageShot skips before every shot. parityLinks leaves a URL with a scheme or a host as it is, states its contract in its comment, and its test covers the foreign and root links; the test has had its red runs on assertions, an identity rewrite and the guard removed, in a scratch copy. driveSwitchDrag's reset runs on a context of its own and reports only when the leg is not already failed, so a timed-out leg is not red twice. Every control in this round ran in a scratch copy of the tree, never in the shared worktree's css/ or js/.
Human
Prompt
Task 8 fix round 1: re-run the switch-hover control in a scratch copy and record which tests go red, show the matrix red under a mutation it can see, correct the report and commit body, note the view-transition limit in the parity doc comment, give TestParityLinksAreRewritten a red run on an assertion, write down and test the rewrite limits, stop the switch-leg reset reporting twice, and run every control in a scratch copy only.
From this commit's own message. The prompt ledger has no entries for it — which is what a squashed, rebased or amended commit looks like, and what every commit looks like in a repo without a ledger.
Summary
check/parity_browser_test.go: the file comment says a still shot cannot see shell.css view transitions; check/parity_test.go: parityLinks leaves a URL with a scheme or host alone, states its contract, and its test covers foreign and root links (red first on assertions in a scratch copy); check/switch_browser_test.go: driveSwitchDrag resets on its own context and reports only on a green leg. The commit body corrects e6a1567 record of the switch hover control.
Agent notes
Switch hover rules cut: TestTheKnobIsLitAndTheTrackSheenFollowsIt and TestTheTrackSitsInAndTheKnobLiftsOnHover go red, the matrix stays green by design (it leaves day out), the parity drive goes red. plain --rst-shadow-knob mutated: the matrix plain pair goes red on the switch cells. Shards 77/80/81s wall, make ci exit 0 in 252s. Report section "Fix round 1" in task-8-report.md.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
3 files changed,
+38
−2
check/parity_browser_test.go+5 −0check/parity_test.go+22 −0check/switch_browser_test.go+11 −2
CI passed — run details
CI log
=== gofmt === === no-rastrillo === go test -run '^(TestFiestaNeverImportsRastrillo|TestThePublicPackagesLinkNoBrowser)$' -count=1 . ok amadan.net/rastrillo/fiesta 0.077s === suite === --- shard 0 of 8 --- ==> shard 0 of 8: make root go build ./... go vet ./... FIESTA_TEST_REQUIRE_NODE=1 go test -count=1 ./... ok amadan.net/rastrillo/fiesta 0.311s ok amadan.net/rastrillo/fiesta/check 2.483s ok amadan.net/rastrillo/fiesta/example 0.055s ok amadan.net/rastrillo/fiesta/internal/axe 0.003s ? amadan.net/rastrillo/fiesta/internal/harness [no test files] ok amadan.net/rastrillo/fiesta/internal/markup 0.003s ok amadan.net/rastrillo/fiesta/internal/nodetest 0.287s --- shard 1 of 8 --- ==> shard 1 of 8: make staticcheck go run honnef.co/go/tools/cmd/staticcheck@v0.8.2 -tags browser ./... --- shard 2 of 8 --- ==> shard 2 of 8: make govulncheck go run golang.org/x/vuln/cmd/govulncheck@v1.8.0 ./... === Symbol Results === No vulnerabilities found. Your code is affected by 0 vulnerabilities. This scan also found 0 vulnerabilities in packages you import and 5 vulnerabilities in modules you require, but your code doesn't appear to call these vulnerabilities. Use '-show verbose' for more details. --- shard 3 of 8 --- ==> shard 3 of 8: make gitleaks go run github.com/zricethezav/gitleaks/v8@v8.30.1 git --no-banner --redact --log-opts='--full-history --diff-filter=tuxdb HEAD' . [90m10:55AM[0m [32mINF[0m [1mUnknown SCM platform. Use --platform to include links in findings.[0m [36mhost=[0mamadan.net [90m10:55AM[0m [32mINF[0m [1m1 commits scanned.[0m [90m10:55AM[0m [32mINF[0m [1mscanned ~3505980 bytes (3.51 MB) in 2.29s[0m [90m10:55AM[0m [32mINF[0m [1mno leaks found[0m --- shard 4 of 8 --- ==> shard 4 of 8: make browser.internal.harness ./hack/gotest.sh browser 'internal.harness' gotest: on DOCS-T1, driving the harness's own choice (/usr/bin/chromium) ok amadan.net/rastrillo/fiesta/internal/harness 8.306s --- shard 5 of 8 --- ==> shard 5 of 8: make browser.check~1of3 ./hack/gotest.sh browser 'check~1of3' gotest: on DOCS-T1, driving the harness's own choice (/usr/bin/chromium) gotest: slice 1 of 3 of ./check/ runs 45 of 142 tests ok amadan.net/rastrillo/fiesta/check 74.295s --- shard 6 of 8 --- ==> shard 6 of 8: make browser.check~2of3 ./hack/gotest.sh browser 'check~2of3' gotest: on DOCS-T1, driving the harness's own choice (/usr/bin/chromium) gotest: slice 2 of 3 of ./check/ runs 47 of 142 tests ok amadan.net/rastrillo/fiesta/check 83.897s --- shard 7 of 8 --- ==> shard 7 of 8: make browser.check~3of3 ./hack/gotest.sh browser 'check~3of3' gotest: on DOCS-T1, driving the harness's own choice (/usr/bin/chromium) gotest: slice 3 of 3 of ./check/ runs 50 of 142 tests ok amadan.net/rastrillo/fiesta/check 84.705s
diff --git a/check/parity_browser_test.go b/check/parity_browser_test.go| index ba21469..346534d 100644 |
| --- a/check/parity_browser_test.go |
| +++ b/check/parity_browser_test.go |
| @@ -25,6 +25,11 @@ import ( |
| // for byte the same, which TestTheSourceIsTheSyncedBaseline holds, it |
| // passes by construction; it is here for the day css/ starts to move, |
| // when it says which theme, which cell and which page moved with it. |
| +// What a still photograph cannot see is shell.css's own content: the |
| +// phone-width cross-document view transitions, which pageShot skips |
| +// before every shot. The drive holds shell.css to what it paints on a |
| +// settled page, which today is nothing; the slide itself is not under |
| +// this gate. |
| // |
| // parityRig is legacyRig's shape for a whole asset set: two copies of |
| // the same documents at /old/<name> and /new/<name>, each beside its |
diff --git a/check/parity_test.go b/check/parity_test.go| index 1e87803..52314b4 100644 |
| --- a/check/parity_test.go |
| +++ b/check/parity_test.go |
| @@ -1,6 +1,7 @@ |
| package check |
| import ( |
| + "net/url" |
| "path" |
| "regexp" |
| "strings" |
| @@ -14,10 +15,22 @@ import ( |
| // fixture's /tokens.css, /theme.css and /<file>.js the same. Only the |
| // stylesheet links and script tags are touched: an anchor in the body |
| // is the page's own, and stays. |
| +// |
| +// Its contract is the tree's own links. A path, relative or from the |
| +// root, is flattened to its last segment, and a path with a /themes/ |
| +// segment is the theme, whichever theme it names. A URL with a scheme |
| +// or a host (https://fonts.example/x.css, //cdn.example/y.js) is left |
| +// as it is: the rig has nothing to serve for it, and a layout that |
| +// gains one wants it fetched from where it points. Two files that |
| +// share a base name under different directories would collide; the |
| +// tree has none. |
| func parityLinks(doc string) string { |
| return assetLink.ReplaceAllStringFunc(doc, func(tag string) string { |
| return assetURL.ReplaceAllStringFunc(tag, func(attr string) string { |
| m := assetURL.FindStringSubmatch(attr) |
| + if u, err := url.Parse(m[2]); err != nil || u.Scheme != "" || u.Host != "" { |
| + return attr |
| + } |
| name := path.Base(m[2]) |
| if strings.Contains(m[2], "/themes/") { |
| name = "theme.css" |
| @@ -81,6 +94,15 @@ func TestParityLinksAreRewritten(t *testing.T) { |
| if strip(doc) == doc { |
| t.Fatal("the control stripped nothing; assetLink matches no link in the layout") |
| } |
| + |
| + // The limits: a URL with a scheme or a host is not the rig's to |
| + // serve and stays as written, beside the tree's own links, which |
| + // still flatten; and the depth fixture's root paths flatten too. |
| + const foreign = `<link rel="stylesheet" href="https://fonts.example/face.css"><script defer src="//cdn.example/lib.js"></script>` |
| + mixed := `<head>` + foreign + `<link rel="stylesheet" href="../../css/themes/signal.css"><script defer src="/fiesta.js"></script></head>` |
| + if got, want := parityLinks(mixed), `<head>`+foreign+`<link rel="stylesheet" href="theme.css"><script defer src="fiesta.js"></script></head>`; got != want { |
| + t.Errorf("the rewrite of foreign and root links:\n got %s\n want %s", got, want) |
| + } |
| } |
| // assetLink is a stylesheet link or a script tag, the tags parityLinks |
diff --git a/check/switch_browser_test.go b/check/switch_browser_test.go| index 868f604..275be4f 100644 |
| --- a/check/switch_browser_test.go |
| +++ b/check/switch_browser_test.go |
| @@ -97,7 +97,10 @@ var switchDragPages = func() map[string]string { |
| // rig that serves switchDragPages: LTR, RTL and LTR under reduced |
| // motion, each a subtest on the one browser. A leg leaves the browser |
| // as it found it, touch emulation off and the emulated media cleared, |
| -// so the next leg's mouse drags read the page the leg before read. |
| +// so the next leg's mouse drags read the page the leg before read. The |
| +// reset runs on a context of its own, so a leg that timed out does not |
| +// fail a second time on its reset, and a leg already red says nothing |
| +// more; only a green leg whose reset fails reports it. |
| func driveSwitchDrag(t *testing.T, rig *harness.Rig) { |
| t.Helper() |
| for _, leg := range []struct { |
| @@ -107,7 +110,13 @@ func driveSwitchDrag(t *testing.T, rig *harness.Rig) { |
| t.Run(leg.name, func(t *testing.T) { |
| ctx, cancel := context.WithTimeout(rig.Context(), 60*time.Second) |
| defer cancel() |
| - defer mustRun(t, ctx, emulation.SetTouchEmulationEnabled(false), emulation.SetEmulatedMedia()) |
| + defer func() { |
| + rctx, rcancel := context.WithTimeout(rig.Context(), 10*time.Second) |
| + defer rcancel() |
| + if err := chromedp.Run(rctx, emulation.SetTouchEmulationEnabled(false), emulation.SetEmulatedMedia()); err != nil && !t.Failed() { |
| + t.Errorf("resetting the browser after the leg: %v", err) |
| + } |
| + }() |
| if leg.reduce { |
| mustRun(t, ctx, emulation.SetEmulatedMedia().WithFeatures([]*emulation.MediaFeature{{Name: "prefers-reduced-motion", Value: "reduce"}})) |
| } |