Skip to content

Print the stale-catalog line from skills search - #8137

Merged
simonfaltum merged 33 commits into
mainfrom
skills/kstale-skills-search-prints-the-stale-catalog-l
Nov 28, 2026
Merged

simonfaltum merged 33 commits into
mainfrom
skills/kstale-skills-search-prints-the-stale-catalog-l

Conversation

@simonfaltum

@simonfaltum simonfaltum commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

skills search ignored the stale flag on the catalog, so results from an out-of-date cache looked fresh. It now prints the same stderr line that skills list prints. #8103 (skills list) is merged, so this pull request is a direct change on main.

Changes

  • skills search writes the stale-catalog line on stderr when the catalog is stale. It calls the existing provenanceLine helper, so the text is not copied.
  • Stdout is unchanged, and a fresh catalog prints nothing extra.
  • runSearch takes the source, as runList does, and the command resolves it. A blank word is still rejected before the source is resolved.
  • The command stays behind DATABRICKS_SKILLS_PREVIEW, so there is no changelog entry.

Why

skills list and skills read warn when the catalog could not be refreshed. skills search did not, so its matches could be out of date with no sign of it.

Decisions to review

  • Search prints the skills list wording ("the list may be out of date") rather than a new line. The ticket keeps the stale line's text out of scope, and Share one provenance line between skills read and skills list #8136 changes the wording for list and read together. Search picks that up through the same helper, so no change is needed here.

Tests

  • TestRunSearchStaleCatalogPrintsProvenanceOnStderr covers the literal line on stderr and the unchanged matches on stdout.
  • TestRunSearchFreshCatalogPrintsNothingExtra covers a fresh catalog, which writes nothing to stderr.
  • go test ./cmd/skills/... and go test ./acceptance -run 'TestAccept/cmd/skills' pass, with no golden changed. ./task fmt-q lint-q passes.

This pull request and its description were written by Isaac.

simonfaltum and others added 29 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>
Register the hidden skills command group only when DATABRICKS_SKILLS_PREVIEW
is set. Its five subcommands are stubs that report they are not implemented
yet. Add guards for the feature and for its hints switch, DATABRICKS_SKILLS_HINTS,
and a resolver for the folder in DATABRICKS_SKILLS_DIR, with an acceptance
fixture release that later changes reuse.

With the variable unset, the command group is not registered and nothing
else changes.

Co-authored-by: Isaac <no-reply@databricks.com>
The text output shows the catalog rules, one line per skill and a line on
how to read a skill. Descriptions are cut at a word boundary to the widest
width that keeps the output under a fixed budget, and only names are printed
when the names alone do not fit. The JSON output carries the full catalog.
Experimental skills are listed only with --experimental. A stale catalog
prints a provenance line on stderr.

The shared release fixture gains a catalog rules file and an experimental
skill.

Co-authored-by: Isaac <no-reply@databricks.com>
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>
Keep the path helper unexported since only libs/skills calls it, reject a
catalog_rules path that cleans to a directory, and test a missing rules
file. Drop the min_cli_version field, which is not in the skill interface
the package needs yet.

Co-authored-by: Isaac <no-reply@databricks.com>
Skill now has MinCLIVer, read from the manifest's min_cli_version, so a
caller can apply the same rule install uses. The fixture covers it.

Co-authored-by: Isaac <no-reply@databricks.com>
Register the hidden skills command group only when DATABRICKS_SKILLS_PREVIEW
is set. Its five subcommands are stubs that report they are not implemented
yet. Add guards for the feature and for its hints switch, DATABRICKS_SKILLS_HINTS,
and a resolver for the folder in DATABRICKS_SKILLS_DIR, with an acceptance
fixture release that later changes reuse.

With the variable unset, the command group is not registered and nothing
else changes.

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

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

Check the skills group in the root command uniqueness test, even though it
is registered only behind DATABRICKS_SKILLS_PREVIEW. Clear both guard
variables in the guard tests so an exported value does not leak in.
LocalCatalog calls Resolve first and maps ErrNoSource to no catalog.
Route the acceptance help check to LOG.help.

Co-authored-by: Isaac <no-reply@databricks.com>
Text output shows the catalog rules, then one line per skill with its
description cut to fit a fixed budget, then how to read a skill. JSON
output carries the full catalog with empty lists as []. Experimental
skills are listed only with --experimental.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Stop the description search at the narrowest width that keeps the first
word of every description, so no line is left as "name: ...". Print the
"left out" hint only when a description is actually left out. Render the
JSON through cmdio.Render like other commands, and drop the unit test that
duplicated the acceptance output. The list keeps the order the source
serves, which is sorted by name.

Co-authored-by: Isaac <no-reply@databricks.com>
Takes main's version of the skills command group (c2) and keeps this
branch's list implementation, its fixtures and the experimental preview
skill in the release fixture.

Co-authored-by: Isaac <no-reply@databricks.com>
Keep the skills list fixtures on top of the merged release fixture:
the enabled script no longer stubs list, the release manifest keeps the
experimental preview skill next to the read fixtures, and the resolve
test counts the whole catalog.

Co-authored-by: Isaac <no-reply@databricks.com>
skills list now runs, so the test's skills list call fails with the
no-source error instead of the not-implemented stub message. The test
only checks that no hint is printed, so update the comment and golden.

Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
Drop the enabled script's stubs for list-files and read-file, which are
implemented now, and remove the unused notImplemented helper. Regenerate
the list golden for the release fixture's demo-skill commands.

Co-authored-by: Isaac <no-reply@databricks.com>
- Cut each description at a word boundary. A skill whose description has no
  boundary within the width is listed by name alone, so one long description
  does not drop the rest of the catalog.
- Collapse whitespace in text output so every skill takes one line.
- Print the provenance line through cmdio.LogString, and leave out the fetch
  time when it is unknown, as for a bundled copy.
- Use forward slashes in the JSON source label, as skills search does.
- Hint at --experimental when every skill is experimental.
- Drop the acceptance test.toml that repeats the parent's settings.

Co-authored-by: Isaac <no-reply@databricks.com>
The text length is not monotonic in width: a wider width can drop the
search hint, so a binary search could settle on a narrower width than
one that fits. Try each width from the widest down instead, and add a
test whose widths 35 to 37 are over the budget and 38 fits.

Co-authored-by: Isaac <no-reply@databricks.com>
When the names alone do not fit the budget, no description width can fit
either, so return the names-only text without trying each width. The early
return only applies when the names do not fit even with the search hint,
since a wider width can leave that hint out.

Change the widest-width test data so that a binary search settles on a
narrower width whose output differs. The old search passed this test by
landing on a width whose output matched the widest fitting one.

Co-authored-by: Isaac <no-reply@databricks.com>
When the catalog comes from a stale cache, skills list and skills read
say on stderr that the list may be out of date. skills search ignored
catalog.Stale, so its results looked fresh. It now writes the same line
through the shared provenanceLine helper. Stdout is unchanged.

runSearch takes the source as skills list does, so the tests can feed
a stale and a fresh catalog.

Co-authored-by: Isaac <no-reply@databricks.com>
Keep both sides of the merge. The shared acceptance release gains a
hyphen-prefixed file for guide-skill, so the list golden is regenerated
for the file list it prints.

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

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

Copy link
Copy Markdown
Collaborator

✅ Integration test report

Commit: d79ddb0

Run: 46058431842

Env ✅​pass 🙈​skip Time
✅​ aws linux-2core-8gb 174 17 4:39
✅​ aws-windows-latest-4core-16gb 174 17 3:30
✅​ azure linux-2core-8gb 173 17 3:59
✅​ azure-windows-latest-4core-16gb 173 17 3:54
✅​ gcp linux-2core-8gb 174 17 3:36
✅​ gcp-windows-latest-4core-16gb 174 17 3:53
Top 6 slowest tests (at least 2 minutes):
duration env testname
3:55 azure linux-2core-8gb TestAccept
3:52 azure-windows-latest-4core-16gb TestAccept
3:51 gcp-windows-latest-4core-16gb TestAccept
3:28 aws-windows-latest-4core-16gb TestAccept
3:22 gcp linux-2core-8gb TestAccept
3:19 aws linux-2core-8gb TestAccept

simonfaltum and others added 2 commits November 27, 2026 18:24
Co-authored-by: Isaac <no-reply@databricks.com>
The test hard-coded the provenance wording. Compare stderr with
provenanceLine(catalog) instead, so the test follows the helper when
its wording changes.

Co-authored-by: Isaac <no-reply@databricks.com>
@simonfaltum
simonfaltum marked this pull request as ready for review November 27, 2026 19:12
@simonfaltum
simonfaltum requested a review from a team as a code owner November 27, 2026 19:12

@review-oss-bot review-oss-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review at 8174adb. Each finding was verified against the code.

No blocking issues found. 2 non-blocking comment(s) below.

This PR makes skills search print the stale-catalog line on stderr, and it now takes the source as a parameter so tests can inject a fake. The behavior change works, but the description says search now prints the same line as skills list and skills read, and the code doesn't do that. Search reuses the list wording and read has its own variant. There's also a test that checks the helper against itself.

Comment thread cmd/skills/search.go
return err
}
if catalog.Stale {
cmdio.LogString(ctx, provenanceLine(catalog))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] provenanceLine (list.go:82) ends with "so the list may be out of date", so a stale skills search jobs prints that sentence above search matches. skills read builds its line with a separate readProvenance (read.go:139). That one says "content", skips filepath.ToSlash and prints the zero FetchedAt for a bundled catalog. The three commands now print two different lines, which is not what the description claims. Can provenanceLine and readProvenance become one helper with neutral wording, or a noun parameter, used by list.go:51, read.go:58 and here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change in this pull request. Search calls the same provenanceLine that skills list calls, so there is one helper, as the ticket asks. The ticket also keeps the wording of the stale line out of scope, so this pull request does not reword it.

The shared neutral wording and the skills read change are in #8136, which makes read and list use one helper with "the skills may be out of date". Search picks that up through the same helper when #8136 lands, with no edit here. Until then read says "the content may be out of date", which is the one difference you are pointing at.

Comment thread cmd/skills/search_test.go Outdated

cmd, stdout, stderr := searchTestCmd(t)
require.NoError(t, runSearch(cmd, listFakeSource{catalog}, []string{"jobs"}, false))
assert.Equal(t, provenanceLine(catalog)+"\n", stderr.String())

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] The expected stderr comes from provenanceLine(catalog), the same helper runSearch calls. If that wording or the fetch-time format changes, this test still passes, so it doesn't pin the line users see. Can you assert the literal string instead, e.g. Skills come from cached (release 1.2.3, fetched 2026-11-01T00:00:00Z). ...?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 6012166. The test now asserts the literal line, Skills come from cached (release 1.2.3, fetched 2026-11-01T00:00:00Z). The source could not be refreshed, so the list may be out of date., so a change to the wording or the fetch-time format fails it. The same stderr line is also checked in list_test.go, as before.

The stale test built its expected stderr from provenanceLine, so a change to
the wording would still pass. Assert the literal line that users see.

Co-authored-by: Isaac <no-reply@databricks.com>
Base automatically changed from skills/k1-skills-list-prints-the-catalog to main November 27, 2026 19:26
@simonfaltum
simonfaltum requested a review from rclarey November 28, 2026 09:02

@rugpanov rugpanov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is correct. skills search now prints the stale-catalog line on stderr, as skills list does, and stdout and JSON output do not change.

Risk: LOW. The change adds one stderr line to the hidden, preview-gated skills search command. Today Resolve returns only a directory source that is never stale, so the new branch cannot fire in a real run. The change has unit tests, no data or security effect, and is easy to revert.

[nit] PR description: .agents/skills/pr-checklist/SKILL.md asks for the headings of .github/PULL_REQUEST_TEMPLATE.md only, with no new sections. Move the text of ## Decisions to review into ## Why. The same rule asks for an italic AI-disclosure line, so wrap the last line in _..._.

Comment thread cmd/skills/search_test.go
cmd, stdout, stderr := searchTestCmd(t)
require.NoError(t, runSearch(cmd, listFakeSource{catalog}, []string{"jobs"}, false))
assert.Equal(t, "Skills come from cached (release 1.2.3, fetched 2026-11-01T00:00:00Z). "+
"The source could not be refreshed, so the list may be out of date.\n", stderr.String())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nice to have] This assert has the literal text "so the list may be out of date". The open PR #8136 changes provenanceLine to say "so the skills may be out of date", and it does not change this file. Git sees no conflict, but the PR that merges second fails this test in the merge queue. Update the literal in the PR that merges second, or rebase #8136 on this PR and change this line there.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change in this pull request. The literal here, "so the list may be out of date", matches what this branch and main print for skills list and skills search. #8136 changes that wording in the shared helper and in its own read and list tests. Whichever of #8136 and this pull request merges second updates this one assertion as part of that merge, so the merged tree stays green. Until then this branch matches main, and go test ./cmd/skills/... passes at d79ddb0.

@simonfaltum
simonfaltum added this pull request to the merge queue Nov 28, 2026
Merged via the queue into main with commit 5cdaeb8 Nov 28, 2026
27 checks passed
@simonfaltum
simonfaltum deleted the skills/kstale-skills-search-prints-the-stale-catalog-l branch November 28, 2026 23:56
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.

3 participants