Repository navigation
ci(clearcore): cache the vendor core instead of re-fetching teknic.com per run - #1942
Merged
Merged
Conversation
…m per run The 2026-11-07 push run failed `Build Teknic ClearCore (SAME53)` before any compilation: `failed to download https://www.teknic.com/files/downloads/ ClearCore-1.7.4.zip ... (gave up after 5 attempts at byte offset 0)`. The downloader already retries 5x over ~110 s (#1463 raised that budget after a release gate lost the same fetch), and the URL answers 200 from a normal host, so the host is not down -- teknic.com is a single vendor origin behind Sucuri with no CDN and it intermittently refuses a runner. `check-windows.yml` already carries that 32 MB installed core between runs for exactly this reason; the per-board matrix, which is what gates a merge, did not. `template_build.yml` gains an optional package cache: when a board sets `package-cache-path`, one installed vendor package is restored before the build and saved after it, keyed on a file that pins that package's URL and checksum (`hashFiles(inputs.package-cache-hash-files)`), with no `restore-keys` fallback so a repinned package can never restore the previous archive under the new name. The opt-in is SOT data, not hand-written YAML: per-board workflows are regenerated from `ci/board_families.json`, which now carries a `package_cache {path, hash_files, note}` record for clearcore and renders the note as comments. The renderer fails closed on a half record or a path outside `~/.fbuild/`. Verification (real output): `ci.test_fractional_workflows` 25 tests OK, the whole drift registry 459 tests OK, `ruff check` and `ci/check_python_complexity.py` clean, `ci/render_workflows.py --check` rc 0 after regenerating exactly one workflow. RED proofs: dropping `hash_files` from the SOT record fails the render ("package_cache lacks ['hash_files']") and errors the test; dropping the pinning hash from the restore/save key fails the test; a caller-side half pair fails the test; reverting the regenerated board workflow fails `--check`. The restored tree is only accepted when it sits at `{cache_root}/platforms/<stem>/<hash>/<version>` with `.install_complete`, which is what `PackageBase::staged_install_impl` checks before it skips the download.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
The first commit wired the per-board workflow only, and CI proved that insufficient: on PR #1942 `Restore board package cache` came up `skipped` in `Teknic ClearCore (SAME53) / build`. Pull requests and merge-queue entries do not run `build-clearcore.yml` -- they run the `pr_boards`/`boards` MATRIX, which calls `template_build.yml` with an explicit `with:` list built from matrix values. A cache configured only on the per-board workflow is invisible to the jobs that actually gate a merge. So the opt-in now rides the matrix: `package_cache_fields()` (one helper, used by `ci-full`/`ci-test` matrix entries and by `select_boards.matrix_entries`), forwarded from `matrix.package_cache_path` and `matrix.package_cache_hash_files` in all three matrix jobs. Boards without a record get empty strings, which keeps `inputs.package-cache-path != ''` false and the steps skipped. `validate_package_cache()` is now its own function (the combined `validate_source_paths` crossed the C901 limit) and additionally fails closed when two aliases of one build disagree about the pair -- `execution_boards` runs that build once, so a disagreement would silently drop the cache for half the aliases. Verification: regenerated ci-minimal/ci-test/ci-full show the new matrix keys and forwarding lines; the whole drift registry is 461 tests OK (`test_fractional_workflows` asserts every matrix job forwards the pair and that ci-full's include carries it; `test_select_boards` asserts the selection matrix carries the SOT record and an empty pair for every other board); `ruff check` + `ci/check_python_complexity.py` clean; `ci/render_workflows.py --check` rc 0. RED proofs: deleting the forwarding lines from ci-minimal fails `test_fractional_workflows`; deleting `**package_cache_fields(b)` from the selection matrix fails `test_select_boards`.
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.
Why
Build Teknic ClearCore (SAME53)went red on the 2026-11-07 push run (9928f7cc) before any compilation:HTTP/2 200, 11,167,324 bytes from a normal host (Sucuri proxy,x-sucuri-cache: HIT) — the host is not down.check-windows.ymlalready carries the same 32 MB installed core between runs for exactly this reason. The per-board matrix — the thing that gates a merge — did not.What
template_build.ymlgains an optional package cache:package-cache-path~/.fbuild/prod/cache/platforms/www-ClearCore-1.7.4package-cache-hash-filesalways(), main only,cache-hit != 'true'), norestore-keys— a fallback would restore a different vendor archive under the pinned name.The opt-in is SOT data, not hand-written YAML: per-board workflows are regenerated from
ci/board_families.json, so the record isand
render_package_cache_block()renders the note as comments so the generated workflow explains itself. The renderer fails closed on a half record or a path outside~/.fbuild/.Why the restored tree is enough
PackageBase::staged_install_implreturns the install path as soon as it exists (no archive, no index row needed for the read path), and the tree on disk isplatforms/www-ClearCore-1.7.4/94c1b42a3c09f4af/1.7.4/with.install_complete— that is the directory CI must cache, and the key follows the file that pins the URL + sha256, so a repin downloads instead of restoring the old archive.Verification (real output)
ci.test_fractional_workflows: 25 tests OK (two new:test_board_workflows_pass_only_declared_template_inputs,test_vendor_package_cache_is_opted_in_whole)ci-workflow-drift.yml's full module list): Ran 459 tests — OKuv run ruff check ci/test_fractional_workflows.py ci/render_workflows.py→ clean;ci/check_python_complexity.py→ cleanuv run python ci/render_workflows.py→updated 1 workflow(s): build-clearcore.yml;--check→ rc 0RED proofs (each mutation, then restored green):
hash_filesfrom the SOT recordbuild-clearcore.yml: package_cache lacks ['hash_files']rc 1; test errorshashFiles(...)from the restore/save keypackage-cache-pathbuild-clearcore.yml sets half the package-cache pairrender_workflows.py --checkfailsNew-guard direction: a caller that passes an undeclared template input (or omits a required one) now fails a test instead of only failing at run startup on GitHub.