Repository navigation
Share one provenance line between skills read and skills list - #8136
simonfaltum wants to merge 37 commits into
Conversation
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>
skills read had its own provenance line, which printed the zero fetch time for a bundled catalog. Both commands now use provenanceLine, which leaves out the fetched clause when the catalog has no fetch time. Each command package has a test for a bundled catalog. Co-authored-by: Isaac <no-reply@databricks.com>
"the list may be out of date" is wrong for skills read, which prints one skill. The shared line now says "the skills may be out of date" for both commands. 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>
✅ Integration test reportCommit: 2e75c65
Top 4 slowest tests (at least 2 minutes):
|
There was a problem hiding this comment.
Automated review at 5a7f9f5. Each finding was verified against the code.
No blocking issues found. 1 non-blocking comment(s) below.
This PR has skills read print its stale-catalog line through provenanceLine, the helper skills list already uses. The bundled case now leaves out the zero fetch time, and both commands use the same "the skills may be out of date" wording. The swap is correct and the new tests pin the exact line. One small gap remains: skills read now slash-normalises the label on stderr but still sends the raw label in its JSON source.
| } | ||
| if catalog.Stale { | ||
| cmdio.LogString(ctx, readProvenance(catalog)) | ||
| cmdio.LogString(ctx, provenanceLine(catalog)) |
There was a problem hiding this comment.
[nice to have] provenanceLine runs the label through filepath.ToSlash, but the JSON output a few lines down still sets Source: catalog.Label with no conversion (read.go:85). skills list normalises its JSON in newListJSON (list.go:204). On Windows with a path label such as C:\skills, skills read -o json would show C:/skills on stderr and C:\skills in source, and skills list -o json would show C:/skills for the same catalog. Can readOutput.Source use filepath.ToSlash(catalog.Label) as well?
There was a problem hiding this comment.
Done in 77c3fdd: skills read -o json now sets source to filepath.ToSlash(catalog.Label), the same as skills list. A new test, TestRunReadJSONSourceUsesSlashes, checks the JSON source. The conversion only changes the output on Windows, so the test proves the expected value on every platform but only fails without the fix on Windows.
…-list-share-one-pr
skills list already writes its source with forward slashes. skills read wrote the raw catalog label, so on Windows the same catalog showed different sources in the two commands. Test that the JSON source of skills read uses forward slashes. Co-authored-by: Isaac <no-reply@databricks.com>
Keep the shared provenance helper and its neutral wording from this branch in cmd/skills/list.go and list_test.go. Co-authored-by: Isaac <no-reply@databricks.com>
denik
left a comment
There was a problem hiding this comment.
🤖 Automated review of c467675 by Opus and Astra (two independent passes plus an advocate pass; Fable was unavailable this round); each finding verified against the code.
One blocking issue: the new wording breaks a skills search test that is now on main (inline). Apart from that, the change looks right. skills read and skills list now share the line and leave out the zero fetch time, and the JSON source matches skills list.
- Unrelated to this diff, but it fits the same rebase: on main,
skills search -o json(cmd/skills/search.go:69, from #8137) still setssourceto the rawcatalog.Label, so on Windows it disagrees withskills listandskills read. Usingfilepath.ToSlashthere as well would make all three agree.
| label, catalog.Version) | ||
| } | ||
| return fmt.Sprintf("Skills come from %s (release %s, fetched %s). The source could not be refreshed, so the list may be out of date.", | ||
| return fmt.Sprintf("Skills come from %s (release %s, fetched %s). The source could not be refreshed, so the skills may be out of date.", |
There was a problem hiding this comment.
🤖 Blocking This wording change fails a test that landed on main after this branch's last merge. #8137 made skills search print provenanceLine too, and its TestRunSearchStaleCatalogPrintsProvenanceOnStderr (cmd/skills/search_test.go:133-134 on main) still expects "so the list may be out of date". With this PR merged into current main (469c1b3), go test ./cmd/skills/ fails:
expected: "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"
actual : "Skills come from cached (release 1.2.3, fetched 2026-11-01T00:00:00Z). The source could not be refreshed, so the skills may be out of date.\n"
CI here is green only because the head's merge of main predates #8137, so the merge queue would reject it. Fix: merge main and change that expectation to "the skills may be out of date". The new wording works for search too.
There was a problem hiding this comment.
Fixed in c913f9d: merged current main and changed the assertion in TestRunSearchStaleCatalogPrintsProvenanceOnStderr (search_test.go) to "so the skills may be out of date". go test ./cmd/skills/... ./cmd/root/... and the cmd/skills acceptance tests pass on the new head.
Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
rugpanov
left a comment
There was a problem hiding this comment.
Review of the change at c913f9d.
The blocking point from the review of c467675 is fixed. c913f9df4 merges main and updates TestRunSearchStaleCatalogPrintsProvenanceOnStderr. Now the list, read and search tests all expect "so the skills may be out of date", and CI on this head is green.
The removal of readProvenance is a good cleanup: skills read now uses the same helper as skills list and skills search, and the bundled catalog no longer shows the zero fetch time.
One question and three nits stay open (inline). No finding blocks the merge.
Risk: LOW. The change touches only the hidden skills command group, which is registered only when DATABRICKS_SKILLS_PREVIEW is set, so default CLI users see no change. It changes one stderr sentence and a JSON source field that is a no-op today, and a plain revert rolls it back.
| "The source could not be refreshed, so the skills may be out of date.\n", stderr.String()) | ||
| } | ||
|
|
||
| func TestRunReadBundledCatalogOmitsFetchTime(t *testing.T) { |
There was a problem hiding this comment.
[Question] Did you coordinate this fix with #8115? That open PR removes catalog.FetchedAt = time.Time{} from libs/skills/bundled_source.go, so the bundled catalog gets a real fetch time. Today Resolve does not return the bundled source, so no shipped path gives a stale catalog with a zero fetch time. After #8115 merges, the IsZero branch in provenanceLine and the two "omits fetch time" tests cover only hand-built catalogs. The answer tells which layer owns this fix.
There was a problem hiding this comment.
Not coordinated beyond reading it. This PR owns the command-level behavior: provenanceLine must not print a zero time whatever the catalog source does, and skills read and skills list must share one line. If #8115 gives the bundled catalog a real fetch time, the IsZero branch stays as a guard for any source that has no fetch time (a hand-built or future catalog), and the tests that exercise it remain valid. So the two changes do not conflict, and nothing here has to wait for #8115.
| // provenanceLine says where a stale catalog came from, for `skills list` and | ||
| // `skills read` alike. A bundled copy has no fetch time, so the line leaves it | ||
| // out rather than print the zero time. |
There was a problem hiding this comment.
[nit] The new comment names the callers ("for skills list and skills read alike"). After the merge of main, runSearch in cmd/skills/search.go also calls provenanceLine, so the list of callers is incomplete. Keep the original sentence, which does not name callers. Optionally, move the helper to a shared file, for example cmd/skills/skills.go.
There was a problem hiding this comment.
Done in 483779b: restored the original sentence, which names no callers. I left the helper in list.go to keep the diff small.
| func TestRunReadBundledCatalogOmitsFetchTime(t *testing.T) { | ||
| src := fakeSource{ | ||
| catalog: &libskills.Catalog{ | ||
| Label: "bundled", |
There was a problem hiding this comment.
[nit] The test uses the label "bundled", but the real label is libskills.BundledLabel ("bundled copy"). Use libskills.BundledLabel here and in TestRunListBundledCatalogOmitsFetchTime (cmd/skills/list_test.go:222). Then the expected string shows the line that users see.
There was a problem hiding this comment.
Done in 483779b: TestRunReadBundledCatalogOmitsFetchTime now uses libskills.BundledLabel, and the expected string reads "Skills come from bundled copy (release 1.2.3)...". The list_test.go copy of this case is removed (see the other thread).
| assert.NotContains(t, stdout.String(), "Skills come from") | ||
| } | ||
|
|
||
| func TestRunListBundledCatalogOmitsFetchTime(t *testing.T) { |
There was a problem hiding this comment.
[nit] This test adds little to TestProvenanceLineOmitsUnknownFetchTime, which already checks the text for a zero fetch time. The new runRead test in read_test.go has value, because it covers the new call in runRead. Consider removing this runList test.
There was a problem hiding this comment.
Agreed, done in 483779b: removed TestRunListBundledCatalogOmitsFetchTime. TestProvenanceLineOmitsUnknownFetchTime covers the text, and the runRead test covers the new call site.
…st, drop duplicate list test Co-authored-by: Isaac <no-reply@databricks.com>
| Name: name, | ||
| Version: skill.Version, | ||
| Source: catalog.Label, | ||
| Source: filepath.ToSlash(catalog.Label), |
There was a problem hiding this comment.
[nice to have] Every catalog label is already forward-slashed where it is created: Resolve calls filepath.ToSlash(dir), the bundled label is a constant, and the release label is a URL. So filepath.ToSlash in read.go:86, list.go:84 and list.go:204 doesn't change any output today, and search.go:69 doesn't have it. Would you rather document Catalog.Label as always slash-separated in libs/skills and drop the per-command calls? If you keep them, search.go:69 should get one too, so all three commands match. Either way is fine with me; this is non-blocking.
There was a problem hiding this comment.
Keeping the calls for now, no code change. You are right that every label is slash-separated at creation today, so they change nothing on current paths. They keep the three outputs correct if a future source builds a label from a host path, and skills list already had them before this PR, so removing them is a separate cleanup. Documenting Catalog.Label as always slash-separated and dropping all per-command calls (and leaving search.go as is) would be a reasonable follow-up. I did not want to widen this PR for it.
`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. databricks#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 databricks#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. --------- Co-authored-by: Isaac <no-reply@databricks.com>
Co-authored-by: Isaac <no-reply@databricks.com>
skills readandskills listnow print the same provenance line for a bundled catalog, and that line leaves out the fetch time when the catalog has none.Changes
skills readusesprovenanceLine, the helperskills listalready uses, instead of its ownreadProvenance. The helper leaves out the fetched clause whenFetchedAtis zero.Skills come from <label> (release <version>). The source could not be refreshed, so the skills may be out of date.For a cached catalog, the fetch time is added in the same sentence. Before,skills readprintedfetched 0001-01-01T00:00:00Zfor a bundled catalog and said "the content may be out of date".skills read -o jsonwritessourcewith forward slashes, asskills list -o jsonalready does, so the two commands agree on Windows.DATABRICKS_SKILLS_PREVIEWis set, so nothing changes for users by default.Why
The bundled catalog has no fetch time.
provenanceLinealready handled that, butreadProvenanceprinted the zero time, so the two commands disagreed on the same catalog. One helper for both commands keeps the wording in one place. The wording is neutral becauseskills readshows one skill, so "the list" would be wrong there.Decisions to review
skills listprinted before. The alternative was to keep "the list", which reads wrongly inskills read.Tests
TestRunReadBundledCatalogOmitsFetchTime(cmd/skills/read_test.go) andTestRunListBundledCatalogOmitsFetchTime(cmd/skills/list_test.go) each check the exact stderr line for a bundled catalog.TestRunReadJSONSourceUsesSlashes(cmd/skills/read_test.go) checks the JSONsourceofskills read.TestRunReadStaleCatalogWritesProvenanceToStderrandTestProvenanceLineOmitsUnknownFetchTimeexpect the new wording.go test ./cmd/skills/...passes.go test ./acceptance -run 'TestAccept/cmd/skills'passes (8 cases), includingcmd/skills/disabled, which covers the guard-off behaviour. No acceptance golden prints the provenance line, so none changed../task --force fmt-q lint-qreports no issues.This pull request and its description were written by Isaac.