rastrillo / fiesta Public

Task 3: copy.js, red then green open

On branch fiesta-1-1

Commits: 22c1878 (copy.js and its two strings), a7a1129 (link check resolves /1/ against the source build while unpublished), a7ded2f (published-only link check and make site-links-published).

Red against a stub, then green

The stub was a js/copy.js holding only its header comment, with fiesta.go listing it. Every run below failed by assertion, not by a build error.

  • TestEveryLanguageHasEveryKey: red with languageKeys extended before the tables, 24 lines like i18n/en.json: missing key copy-done. Green once the twelve tables had the keys.
  • TestCopyContract: red with "copy.js must test for navigator.clipboard.writeText, and return, before it listens for anything", "does not mention \"fiestaCopy\"", "does not carry fiestaPickLang" / "fiestaWord", and "should be its contract comment and a single IIFE". Green.
  • Each of these was red with "the Copy button is hidden=true shown=false once the page has loaded; copy.js should show it where there is a clipboard", then green: - TestCopyCopiesAndSaysSo - TestAClassSpelledSnippetCopies - TestASuccessThenAFailureEndsOnTheFailure - TestWritesThatSettleOutOfOrderEndOnTheLast (2 legs) - TestTheStatusIsALiveRegionBeforeItSpeaks (4 legs) - TestACopyThatFailsSelectsTheCode (2 legs) - TestCopyReadsTheTable - the snippet copy journey in TestTheReleaseScriptsDriveTheJourneys
  • TestCopyStaysHiddenWithoutAClipboard/no_clipboard_API: red with "copy.js did not run: window.fiestaCopy is not set". Green.
  • Gallery: red first on the render ("the release ships copy.js and Getting started has no row for it"), then on TestEveryProseKeyIsTranslated, TestNoEnglishProseReachesATranslatedPage and the drafts.json English check. Green once the row, the eleven drafts and drafts.json were in.
  • Green locally: - go test ./check ./internal/gallery . ./internal/build -count=1 - ./hack/gotest.sh browser check -run 'Copy|Snippet|Settle|LiveRegion|TheReleaseScriptsDriveTheJourneys|TheFixturePageLoadsEveryAsset' - TestASuccessThenAFailureEndsOnTheFailure, run separately because the plan's pattern misses it - the nine copy tests at -count=3, no flake

Two legs hold the markup, not the script, so they already passed against the stub. Each was turned red by a one-line mutation in a scratch copy:

  • TestCopyStaysHiddenWithoutAClipboard/scripts_off, with hidden dropped from the button: "with scripts off the Copy button is hidden=false shown=true; want it hidden".
  • TestTheStatusIsALiveRegionBeforeItSpeaks/in_the_tree_before_any_click, with hidden put on the status: "the snippet's status is not a status node in the accessibility tree".

Mutations of copy.js, and what caught them

| Mutation | Caught by | |---|---| | Announcement timer neither cancelled by a click nor checked when it fires | LiveRegion 50 ms leg (["" "Copied" "Copied"]) and pending leg ("said Copied … before the pending write settled") | | A click no longer restores the label | SuccessThenAFailure ("label reads Copied") | | A settlement acts whatever its request number | both OutOfOrder legs | | Status written at once, not 100 ms after settling | CopiesAndSaysSo ("spoke 2 ms after the click"), LiveRegion 50 ms and pending legs | | Label reset neither cancelled nor checked | CopiesAndSaysSo ("the label came back 1803 ms after the second click") | | Clipboard feature test removed | StaysHidden no-clipboard leg | | Button read in the class spelling only | CopiesAndSaysSo | | Status read in the attribute spelling only | AClassSpelledSnippetCopies | | Failure selects nothing | both FailsSelectsTheCode legs | | Done string taken from the English alone | CopyReadsTheTable (/ga, /ga-done) |

The site's link check

  • Red at 22c1878 with the old test: 36 lines, one per Getting started page, each https://fiesta.rastrillo.org/1/copy.js resolves to /1/copy.js, which the edge answers with a 404.
  • Green with a7a1129: while the source is ahead of releases/ (no releases/<Version>/, or one different from what build.Dist builds now), /1/ resolves against the source build. On a git archive of 95bd8cc, before copy.js, the source equals releases/1.0.0/ and /1/ resolves against it as before.
  • Control: a scratch page links /1/fiesta.css (published), /1/copy.js (source only) and /1/missing.js (neither). - Against 1.0.0, the last two fail. - Served as the release to come, only /1/missing.js fails. - unpublished is false for an equal release, true with one file changed, and true with no directory.
  • Mutations, each red in the control: - servingSource adding nothing - any /1/ link accepted - unpublished always false - unpublished always true
  • a7ded2f, published only: FIESTA_LINKS_PUBLISHED=1 drops the fallback. - Control: a source-only file absent from the published release fails in that mode. It was red first with the mode ignored: "with FIESTALINKSPUBLISHED=1 the check still fell back to the source build". - On the real site that mode fails with exactly the 36 /1/copy.js lines. That is expected until 1.1.0 is committed under releases/, so it is not in the suite. - make site-links-published runs that mode on a git archive export of SITE_REF, and refuses a ref whose check predates the mode (SITE_REF=95bd8cc).

Hub

  • a7a1129: 47/48 shards green. Shard 14 was TestEveryOneOhExampleRendersAsItDid2of4 (Task 2's 1.0 photo sweep) hitting its 300 s deadline; it took 38 s locally.
  • e2207ed, the tip, containing a7ded2f: CI passed, 48 shards.