Repository navigation
fix(docs): hash the docs tree in every task that reads it - #3553
Merged
Merged
Conversation
Turbo keys a task's cache on its own workspace's files, and the root docs/ tree and READMEs belong to none, so a docs-only change replayed @tale/docs:test (and the docs build) from the cache: a broken page could pass CI. services/docs/turbo.json gives the docs test and build tasks the docs tree (the test also the root READMEs) and typecheck/lint the nav and redirect maps they import; tools/cli/turbo.json gives the CLI tests the install pages they parse. Both extend the root config, so everything else about those tasks is inherited. A guard in each suite asks `turbo --dry=json` whether every file the task reads is hashed.
The CLI workflow runs the unit suite on Windows and macOS too: spawn turbo through `bun x` and compare turbo's `/`-separated input keys.
A trailing blank line on the docs index, reverted in the next commit: CI on this commit must execute @tale/docs:test, not replay it.
This reverts commit f068e5f.
Contributor
Author
|
Docs-only probe result: on f068e5f, whose only change was a trailing blank line in |
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.
Problem
Found on #3517. That PR edited three pages under
docs/, and its Unit job replayed the docs tests from the Turbo cache (@tale/docs:test→cache hit, replaying logs 95a3803dc49254bd). Turbo builds a task's hash from the files in that task's own workspace. The rootdocs/tree and the rootREADME*.mdfiles are not in any workspace. So a change to them leaves every task hash unchanged, and a broken docs page can pass CI.The same gap affected every cached task that reads the docs tree:
@tale/docs#testwalk-content),docs/nav.json,docs/redirects.json, rootREADME*.md(readme.test.ts)@tale/docs#build(andtest:prerender, which depends on it)import.meta.glob, search index, prerender),nav.json,redirects.json@tale/docs#typecheck,@tale/docs#lint(type-aware)nav.jsonandredirects.json, imported bylib/content/nav.tsandlib/redirects.ts@tale/cli#testdocs/{en,de,fr}/self-hosted/install/cli-install.md(platform-docs.test.tsparses the JSON examples)services/platform/tests/manual/scripts/check-guide.tsandbun run lint:manualare not Turbo tasks, so they never replay from the cache. Neither readsdocs/.Change
services/docs/turbo.jsonandtools/cli/turbo.jsonare workspace configs that extend the root config ("extends": ["//"]). They add$TURBO_ROOT$/…globs to theinputsof the tasks listed above and keep$TURBO_DEFAULT$. Everything else is inherited from the root task definitions:dependsOn,outputsandenv. I tested a root-level@tale/docs#testentry first; it replaces the wholetestdefinition (the dry run showeddependsOn: []), so it would have been a second copy of that definition.services/docs/tests/turbo-inputs.test.tsrunsturbo run … --dry=jsonand asserts that every file each@tale/docstask reads is hashed: every pagewalkDocs()finds, the two JSON maps, and the READMEsreadme.test.tscompares. It also checks that the workspace's ownpackage.jsonis still hashed, so dropping$TURBO_DEFAULT$fails too.platform-docs.test.tsdoes the same for@tale/cli#testand the install pages it parses. Each guard lives in the workspace whoseturbo.jsonit checks, so editing that config changes the guard's own hash and re-runs it.README_PATTERNmoved intotests/lib/paths.ts, so the README test and the guard use the same pattern..agents/repo.md("A green check is not always a run") now names the fix and the guards, and says that the services' i18n tests reading thepackages/uicatalogs fall under thepackages/gap below.services/docs/tests/AGENTS.mdlists the new check.tests/manual/reference/automation.mdhas a row for it.Verification
services/docs/turbo.jsonremoved, all 4 docs cases fail ("@tale/docs#testreads 431 file(s) turbo does not hash…"). Withtools/cli/turbo.jsonremoved, the CLI case fails and lists the three install pages. Both pass with the change.turbo --dry=json) with the change:docs/en/index.mdchanges the hashes of docstest,buildandtest:prerender.cli-install.mdalso changes@tale/cli#test.nav.jsonalso changes docstypecheckandlint.README.de.mdchanges docstestonly.main, none of these edits changed any hash.bunx turbo run test --filter=@tale/docs --force: 35 files, 170 tests pass, including the guard. So running Turbo from inside a Turbo task works.bunx turbo run test --filter=@tale/cli --force -- src/lib/config/platform-docs.test.ts: 7 pass.tsc --noEmitinservices/docsandtools/cli,bun run knip:check,bun run lint:manual, and oxfmt (pre-commit).docs/en/index.md, and 598030f reverts it. In the Unit job for that probe commit (log),@tale/docs:testshowscache miss, executing d71f1eec9cd26f7dand runs all 35 test files. In the previous run the same task's hash was3a9b3258bc0605ee.@tale/cli:test(same hash38179d9656d9ff35),@tale/platform:test,@tale/web:testand@tale/ui:testreplayed from the cache, which is correct: that edit is not one of their inputs. The Build job's@tale/docs:buildalso showscache miss, executing. Before this change, fix(platform): re-target the pending review when the reviewer changes #3517's docs edits producedcache hit, replaying logsfor@tale/docs:test.Left open
packages/leaves every dependent workspace'stest,typecheckandlinthash unchanged, because none of those tasks depends on^…. A dry-run probe showed it: editingpackages/ui/src/i18n/locales.tsleft the hashes of@tale/web#test,@tale/platform#test/typecheck/lintand@tale/docs#testunchanged. The docs i18n test also readspackages/ui/src/i18n/messages..agents/repo.mdnow describes this gap. Fixing it means adding a transit-style^dependency to those tasks, which re-runs consumers' suites on every package edit. That CI-cost decision needs its own task.compose*.yml. They were not audited here.docs/**is not ine2e.yml'spaths. The Build workflow's Docs container test does run.