Skip to content

Fill the bundled skills snapshot in release builds - #8200

Draft
simonfaltum wants to merge 15 commits into
mainfrom
skills/s2bnow-fill-the-bundled-skills-snapshot-in-rele
Draft

simonfaltum wants to merge 15 commits into
mainfrom
skills/s2bnow-fill-the-bundled-skills-snapshot-in-rele

Conversation

@simonfaltum

@simonfaltum simonfaltum commented Nov 30, 2026 •

Copy link
Copy Markdown
Member

Release binaries carry an empty bundled skills snapshot today. This pull request fills it from the latest skills release when GoReleaser builds a release, so a released binary can serve the bundled skills. #8199 has landed, so the binary serves the bundled skills once this pull request fills the snapshot. It replaces #8075, which carries the same work without the fixes below and which the owner closes by hand.

Changes

  • internal/build/skillssnapshot downloads the latest skills release (or -ref <tag>), checks the manifest paths, and replaces libs/skills/snapshot only after the release lists at least one skill and after every file is in place and the staged manifest and rules read back through the bundled source. A failed swap restores the old snapshot.
  • A before hook in .goreleaser.yaml runs it. Development builds do not, and GoReleaser snapshot builds (main CI) pass -skip, so they keep the empty placeholder and a clean git status and need no token.
  • The hook runs only when the checked-out tree has internal/build/skillssnapshot. The release workflow builds older tags with the current .goreleaser.yaml, so rebuilding an older tag skips the fill and ships the empty snapshot as that release did.
  • Review fixes carried over from Fill the bundled skills snapshot when release binaries are built #8075:
    • Files whose names start with . or _ are bundled (the embed uses all:) instead of failing the build.
    • The latest-release lookup sends GITHUB_TOKEN as a bearer token when set, through a new skills.FetchLatestSkillsReleaseRefWithToken. The CLI itself still calls it without a token.
    • The tool uses the shared skills.HTTPClient, FetchConcurrency, MaxFetchBodySize, NewHTTPFetchError and EscapeFilePath.

The bundled release's skill names now appear in the User-Agent skill/<name> pairs of release binaries. No .nextchanges fragment is added; maintainers, is one wanted for that User-Agent change?

Binary size: a build with the snapshot filled (skills release v0.2.56) is 3,559,424 bytes (about 3.4 MiB) larger than one with the placeholder (61,874,439 vs 58,315,015 bytes, linux amd64, -s -w). The owner accepted this growth.

Decisions to review

  • The fill takes the newest skills release, not the version the CLI is pinned to; this is deliberate (owner decision), so a rebuilt tag may bundle a newer release than the original build did.
  • The staged tree is rejected before the swap when go:embed would drop part of it (a go.mod in any directory, names that fail module.CheckFilePath, .git/.hg/.svn/.bzr elements), because the readback reads the folder directly and would otherwise pass while the binary lacks the files.
  • A failed fill fails the release build, so a release never ships a partial snapshot. Snapshot builds skip instead, so main CI cannot break on a rate limit or a missing token.
  • The skip for a tree without the fill package is a shell check in .goreleaser.yaml, because go run of a missing package would otherwise fail the old-tag rebuild.

Tests

  • go test ./internal/build/skillssnapshot/ ./libs/skills/ covers bundling and reading back _- and .-prefixed files, a # in a file name, the bearer header with and without a token, a rate-limited lookup leaving the snapshot untouched, a failed download, unsafe manifests, and a release listing examples/go.mod or another path go:embed drops failing with the snapshot untouched, a release without skills leaving the snapshot untouched.
  • Ran the tool against the latest release with a token, built the binary, and restored the placeholder. -skip leaves git status clean, and TestRunSkipMakesNoRequestAndKeepsSnapshot proves a skipped run makes no HTTP request and leaves the snapshot untouched. The skip check for a tree without the package was run in an empty directory. GoReleaser itself was not run here.
  • ./task fmt-q lint-q and go test ./acceptance -run 'TestAccept/cmd/skills' pass.

This pull request and its description were written by Isaac.

simonfaltum and others added 9 commits November 25, 2026 18:43
Skill sources need the manifest type and its path checks, and the
libs-no-aitools lint rule keeps shared libs from importing the installer.
Move Manifest, SkillMeta, NormalizeManifest, CheckManifestPaths, EscapesDir
and ErrUnsafeManifestPath down into libs/skills; the installer uses them
from there through aliases. Add the Skill and Catalog types, the Source
interface, sentinel errors, and NewFSSource over any fs.FS laid out like a
skills release. The manifest accepts optional per-skill commands and a
top-level catalog_rules file.

Co-authored-by: Isaac <no-reply@databricks.com>
The installer and libs/skills both reserve .state.json. Define the name once in
libs/skills and have the installer use it.

Co-authored-by: Isaac <no-reply@databricks.com>
The Windows CI checkout turns the LF fixtures into CRLF, so the exact
content assertions failed. Normalize line endings before comparing.

Co-authored-by: Isaac <no-reply@databricks.com>
Clean catalog_rules before reading it, expose min_cli_version on Skill,
document the Catalog fields and the release-relative paths the manifest
may name.

Co-authored-by: Isaac <no-reply@databricks.com>
The skills commands fall back to a snapshot compiled into the binary when
the published release cannot be reached and nothing is cached. The repo
holds only an empty placeholder manifest; release builds fill the snapshot.

NewBundledSource reads the snapshot through the file-system source, labelled
as the bundled copy. An empty snapshot reports ErrSourceUnreachable, so
development builds behave as if there were no bundled copy. Nothing calls
it yet, so behaviour is unchanged.

Co-authored-by: Isaac <no-reply@databricks.com>
Release binaries should carry the skills release that is current when they
are built, without committing skill files. A new command,
internal/build/skillssnapshot, fills libs/skills/snapshot from the latest
skills release, or from the tag given with -ref. The GoReleaser before hooks
run it before the binaries compile, so every release build fills the
snapshot, and development builds do not.

The command reads the manifest with the same path checks every source applies
(skills.CheckManifest, now shared by the manifest reader), and refuses a file
that go:embed would skip. It stages the release beside the snapshot and
replaces the snapshot only when every file is in place and the staged release
reads back through the file-system source, so a failed download fails the
release build and leaves the snapshot as it was.

Nothing reads the bundled snapshot yet, so command behaviour is unchanged.

Co-authored-by: Isaac <no-reply@databricks.com>
Take main's squashed skills source and fetch code, and keep this branch's
own change on top: the release lookup and base URL come from libs/skills,
and the manifest checks are one exported CheckManifest that the source and
the snapshot command both run.

Co-authored-by: Isaac <no-reply@databricks.com>
Bundle files starting with '.' or '_', skip the hook when the fill package is
absent or on snapshot builds, authenticate the latest-release lookup with
GITHUB_TOKEN, use the shared skills fetch helpers and escape URL path segments.

Co-authored-by: Isaac <no-reply@databricks.com>
@eng-dev-ecosystem-bot

eng-dev-ecosystem-bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: 8138a3a

Run: 46454086943

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 88 6 1:47
💚​ aws-windows-latest-4core-16gb 1 88 6 2:56
💚​ azure linux-2core-8gb 1 88 6 1:50
💚​ azure-windows-latest-4core-16gb 1 88 6 2:35
💚​ gcp linux-2core-8gb 1 88 6 1:52
💚​ gcp-windows-latest-4core-16gb 1 88 6 2:42
Test Name aws linux-2core-8gb aws-windows-latest-4core-16gb azure linux-2core-8gb azure-windows-latest-4core-16gb gcp linux-2core-8gb gcp-windows-latest-4core-16gb
💚​ TestAccept 💚​R 💚​R 💚​R 💚​R 💚​R 💚​R
Top 3 slowest tests (at least 2 minutes):
duration env testname
2:54 aws-windows-latest-4core-16gb TestAccept
2:41 gcp-windows-latest-4core-16gb TestAccept
2:34 azure-windows-latest-4core-16gb TestAccept

simonfaltum and others added 6 commits November 30, 2026 13:23
Move the skip decision into run so a test proves a skipped run makes no
request and leaves the snapshot alone. Rename the old snapshot aside while
swapping so a failed rename restores it, and make the staged folder 0755.
Fix comments that overstated what is checked and read back.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
go:embed skips a directory that holds a go.mod and names that are not valid
module file paths, but the readback uses os.DirFS, so such a release passed
and shipped a catalog listing files the binary lacks.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants