Skip to content

skills list and search JSON carry experimental, rules and stale - #8139

Open
simonfaltum wants to merge 36 commits into
mainfrom
skills/kjson-skills-list-and-search-json-carry-experi
Open

simonfaltum wants to merge 36 commits into
mainfrom
skills/kjson-skills-list-and-search-json-carry-experi

Conversation

@simonfaltum

@simonfaltum simonfaltum commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

skills list --output json and skills search --output json now print one envelope and one per-skill shape, both built from one type in cmd/skills/json.go. Each skill says whether it is experimental, and the envelope carries the catalog rules and whether the catalog is stale.

Changes

  • Each skill has experimental, which is true only for experimental skills.
  • The envelope has rules: the catalog rules, trimmed as skills list prints them. skills search carries them too, so both commands share one envelope.
  • The envelope has stale and fetched_at, so a stale catalog says so in JSON. fetched_at is left out when the source does not know it.
  • skills search prints the stale-catalog line on stderr through Print the stale-catalog line from skills search #8137, which is on main. This branch merges main and keeps only that copy.

Why

Reviewers asked that skills list --output json show which skills are experimental and include the rules that the text output prints. skills search uses the same envelope, so both change together.

Decisions to review

  • skills search --output json carries rules, although search's text output does not print them. The envelope is shared, so one parser reads both commands.
  • The source label goes through filepath.ToSlash in both commands as a guard. skills.Resolve already converts the path, so no current source changes its output on Windows.
  • stale and fetched_at are in the envelope before any source sets them. The only source skills.Resolve returns never sets Stale, and it sets FetchedAt to the time of the call, so today stale is always false. The fields stay because the output contract needs them once a stale source is reachable, and the stale test covers that case.
  • fetched_at is omitted when unknown, rather than printed as the zero time.
  • The envelope's stale and fetched_at are set in the output type, not marshaled from libskills.Catalog, so the output does not change when the catalog's fields do.

Tests

  • TestRunListJSONStaleCatalogSaysStale covers "stale": true and fetched_at for skills list.
  • TestRunSearchStaleCatalogSaysStale runs runSearch on a stale catalog: the JSON has "stale": true and no fetched_at, and the provenance line is on stderr in both output modes.
  • Acceptance cmd/skills passes. The list and search goldens show experimental, rules and stale, and the list golden is regenerated for experimental. The disabled case still shows the group is absent when DATABRICKS_SKILLS_PREVIEW is unset.
  • Not tested: a stale catalog through acceptance, because the fixture source is never stale. Windows is not covered by the acceptance run here; CI runs it there.

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>
skills list and skills search print the same JSON envelope and per-skill
fields from one type. The envelope gains stale and fetched_at, so a stale
catalog says so in JSON, and rules, the text the text output prints above
the list. Each skill gains experimental.

Acceptance goldens for list and search are regenerated. The search release
fixture gains a RULES.md so search JSON shows rules.

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>
@github-actions

github-actions Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Regression test report ✅

Commit: 4724e1277 | Workflow run

Selected 2 changed tests (limit=20, 0 not selected)

2 tests: regression=2 unreleased=0 coverage=0 failing=0
test branch main (f504773) latest (v1.28.0)
TestAccept/cmd/skills/list ✅ ❌ ❌
TestAccept/cmd/skills/search ✅ ❌ ❌
TestAccept/cmd/skills/list: branch ✅ | main (f504773) ❌ | latest (v1.28.0) ❌

main (f504773):

acceptance_test.go:1402: Diff:
        --- cmd/skills/list/output.txt
        +++ /tmp/TestAcceptcmdskillslist4208156235/002/output.txt
        @@ -24,15 +24,11 @@
         {
           "source": "[TESTROOT]/cmd/skills/release",
           "release_version": "0.0.1",
        -  "stale": false,
        -  "fetched_at": "[TIMESTAMP]",
        -  "rules": "Pick the skill whose description matches the task.\nRead the skill before you act on it.",
           "skills": [
             {
               "name": "-foo",
               "description": "A skill whose name starts with a hyphen.",
               "version": "0.0.1",
        -      "experimental": false,
               "files": [
                 "SKILL.md"
               ],
        @@ -44,7 +35,6 @@
               "name": "demo-skill",
               "description": "A skill for tests.",
               "version": "0.0.1",
        -      "experimental": false,
               "files": [
                 "SKILL.md"
               ],
        @@ -57,7 +47,6 @@
               "name": "future-skill",
               "description": "A skill that needs a newer CLI.",
               "version": "0.0.1",
        -      "experimental": false,
               "files": [
                 "SKILL.md"
               ],
        @@ -67,7 +56,6 @@
               "name": "guide-skill",
               "description": "A skill with a supporting file.",
               "version": "0.0.1",
        -      "experimental": false,
               "files": [
                 "SKILL.md",
                 "references/guide.md",
        @@ -82,15 +70,11 @@
         {
           "source": "[TESTROOT]/cmd/skills/release",
           "release_version": "0.0.1",
        -  "stale": false,
        -  "fetched_at": "[TIMESTAMP]",
        -  "rules": "Pick the skill whose description matches the task.\nRead the skill before you act on it.",
           "skills": [
             {
               "name": "-foo",
               "description": "A skill whose name starts with a hyphen.",
               "version": "0.0.1",
        -      "experimental": false,
               "files": [
                 "SKILL.md"
               ],
        @@ -102,7 +81,6 @@
               "name": "demo-skill",
               "description": "A skill for tests.",
               "version": "0.0.1",
        -      "experimental": false,
               "files": [
                 "SKILL.md"
               ],
        @@ -115,7 +93,6 @@
               "name": "future-skill",
               "description": "A skill that needs a newer CLI.",
               "version": "0.0.1",
        -      "experimental": false,
               "files": [
                 "SKILL.md"
               ],
        @@ -125,7 +102,6 @@
               "name": "guide-skill",
               "description": "A skill with a supporting file.",
               "version": "0.0.1",
        -      "experimental": false,
               "files": [
                 "SKILL.md",
                 "references/guide.md",
        @@ -137,7 +113,6 @@
               "name": "preview-skill",
               "description": "An experimental skill for tests.",
               "version": "0.0.2",
        -      "experimental": true,
               "files": [
                 "SKILL.md"
               ],

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- cmd/skills/list/output.txt
        +++ /tmp/TestAcceptcmdskillslist4099258791/002/output.txt
        @@ -1,147 +1,5 @@
         
         >>> [CLI] skills list
        -Pick the skill whose description matches the task.
        -Read the skill before you act on it.
        +Error: unknown command "skills" for "databricks"
         
        --foo: A skill whose name starts with a hyphen.
        -demo-skill: A skill for tests.
        -future-skill: A skill that needs a newer CLI.
        -guide-skill: A skill with a supporting file.
        -To read a skill, run: databricks skills read <name>
        -
        ->>> [CLI] skills list --experimental
        -Pick the skill whose description matches the task.
        -Read the skill before you act on it.
        -
        --foo: A skill whose name starts with a hyphen.
        -demo-skill: A skill for tests.
        -future-skill: A skill that needs a newer CLI.
        -guide-skill: A skill with a supporting file.
        -preview-skill: An experimental skill for tests.
        -To read a skill, run: databricks skills read <name>
        -
        ->>> [CLI] skills list --output json
        -{
        -  "source": "[TESTROOT]/cmd/skills/release",
        -  "release_version": "0.0.1",
        -  "stale": false,
        -  "fetched_at": "[TIMESTAMP]",
        -  "rules": "Pick the skill whose description matches the task.\nRead the skill before you act on it.",
        -  "skills": [
        -    {
        -      "name": "-foo",
        -      "description": "A skill whose name starts with a hyphen.",
        -      "version": "0.0.1",
        -      "experimental": false,
        -      "files": [
        -        "SKILL.md"
        -      ],
        -      "commands": [
        -        "jobs"
        -      ]
        -    },
        -    {
        -      "name": "demo-skill",
        -      "description": "A skill for tests.",
        -      "version": "0.0.1",
        -      "experimental": false,
        -      "files": [
        -        "SKILL.md"
        -      ],
        -      "commands": [
        -        "fs",
        -        "air"
        -      ]
        -    },
        -    {
        -      "name": "future-skill",
        -      "description": "A skill that needs a newer CLI.",
        -      "version": "0.0.1",
        -      "experimental": false,
        -      "files": [
        -        "SKILL.md"
        -      ],
        -      "commands": []
        -    },
        -    {
        -      "name": "guide-skill",
        -      "description": "A skill with a supporting file.",
        -      "version": "0.0.1",
        -      "experimental": false,
        -      "files": [
        -        "SKILL.md",
        -        "references/guide.md",
        -        "-notes.md"
        -      ],
        -      "commands": []
        -    }
        -  ]
        -}
        -
        ->>> [CLI] skills list --output json --experimental
        -{
        -  "source": "[TESTROOT]/cmd/skills/release",
        -  "release_version": "0.0.1",
        -  "stale": false,
        -  "fetched_at": "[TIMESTAMP]",
        -  "rules": "Pick the skill whose description matches the task.\nRead the skill before you act on it.",
        -  "skills": [
        -    {
        -      "name": "-foo",
        -      "description": "A skill whose name starts with a hyphen.",
        -      "version": "0.0.1",
        -      "experimental": false,
        -      "files": [
        -        "SKILL.md"
        -      ],
        -      "commands": [
        -        "jobs"
        -      ]
        -    },
        -    {
        -      "name": "demo-skill",
        -      "description": "A skill for tests.",
        -      "version": "0.0.1",
        -      "experimental": false,
        -      "files": [
        -        "SKILL.md"
        -      ],
        -      "commands": [
        -        "fs",
        -        "air"
        -      ]
        -    },
        -    {
        -      "name": "future-skill",
        -      "description": "A skill that needs a newer CLI.",
        -      "version": "0.0.1",
        -      "experimental": false,
        -      "files": [
        -        "SKILL.md"
        -      ],
        -      "commands": []
        -    },
        -    {
        -      "name": "guide-skill",
        -      "description": "A skill with a supporting file.",
        -      "version": "0.0.1",
        -      "experimental": false,
        -      "files": [
        -        "SKILL.md",
        -        "references/guide.md",
        -        "-notes.md"
        -      ],
        -      "commands": []
        -    },
        -    {
        -      "name": "preview-skill",
        -      "description": "An experimental skill for tests.",
        -      "version": "0.0.2",
        -      "experimental": true,
        -      "files": [
        -        "SKILL.md"
        -      ],
        -      "commands": []
        -    }
        -  ]
        -}
        +Exit code: 1
TestAccept/cmd/skills/search: branch ✅ | main (f504773) ❌ | latest (v1.28.0) ❌

main (f504773):

acceptance_test.go:1402: Diff:
        --- cmd/skills/search/output.txt
        +++ /tmp/TestAcceptcmdskillssearch2948187424/002/output.txt
        @@ -19,15 +19,11 @@
         {
           "source": "[TESTROOT]/cmd/skills/search/release",
           "release_version": "0.0.1",
        -  "stale": false,
        -  "fetched_at": "[TIMESTAMP]",
        -  "rules": "Pick the skill whose description matches the task.\nRead the skill before you act on it.",
           "skills": [
             {
               "name": "pipeline-guide",
               "description": "Build and debug data pipelines.",
               "version": "0.0.1",
        -      "experimental": false,
               "files": [
                 "SKILL.md"
               ],
        @@ -42,15 +33,11 @@
         {
           "source": "[TESTROOT]/cmd/skills/search/release",
           "release_version": "0.0.1",
        -  "stale": false,
        -  "fetched_at": "[TIMESTAMP]",
        -  "rules": "Pick the skill whose description matches the task.\nRead the skill before you act on it.",
           "skills": [
             {
               "name": "demo-skill",
               "description": "A skill for tests.",
               "version": "0.0.1",
        -      "experimental": false,
               "files": [
                 "SKILL.md"
               ],
        @@ -63,9 +45,6 @@
         {
           "source": "[TESTROOT]/cmd/skills/search/release",
           "release_version": "0.0.1",
        -  "stale": false,
        -  "fetched_at": "[TIMESTAMP]",
        -  "rules": "Pick the skill whose description matches the task.\nRead the skill before you act on it.",
           "skills": []
         }
         
        @@ -84,15 +63,11 @@
         {
           "source": "[TESTROOT]/cmd/skills/search/experimental-release",
           "release_version": "0.0.1",
        -  "stale": false,
        -  "fetched_at": "[TIMESTAMP]",
        -  "rules": "",
           "skills": [
             {
               "name": "pipeline-bare",
               "description": "",
               "version": "0.0.1",
        -      "experimental": true,
               "files": [
                 "SKILL.md"
               ],
        @@ -104,7 +74,6 @@
               "name": "pipeline-lab",
               "description": "An experimental pipeline skill.",
               "version": "0.0.1",
        -      "experimental": true,
               "files": [
                 "SKILL.md"
               ],
        
FAIL

latest (v1.28.0):

acceptance_test.go:1402: Diff:
        --- cmd/skills/search/output.txt
        +++ /tmp/TestAcceptcmdskillssearch1525544457/002/output.txt
        @@ -1,116 +1,5 @@
         
         >>> [CLI] skills search pipelines
        -pipeline-guide: Build and debug data pipelines.
        -To read a skill, run: databricks skills read <name>
        +Error: unknown command "skills" for "databricks"
         
        ->>> [CLI] skills search PIPELINES
        -pipeline-guide: Build and debug data pipelines.
        -To read a skill, run: databricks skills read <name>
        -
        ->>> [CLI] skills search skill pipelines
        -demo-skill: A skill for tests.
        -pipeline-guide: Build and debug data pipelines.
        -To read a skill, run: databricks skills read <name>
        -
        ->>> [CLI] skills search nothing-here
        -No skill matches. Run databricks skills list to see every skill.
        -
        ->>> [CLI] skills search --output json pipelines
        -{
        -  "source": "[TESTROOT]/cmd/skills/search/release",
        -  "release_version": "0.0.1",
        -  "stale": false,
        -  "fetched_at": "[TIMESTAMP]",
        -  "rules": "Pick the skill whose description matches the task.\nRead the skill before you act on it.",
        -  "skills": [
        -    {
        -      "name": "pipeline-guide",
        -      "description": "Build and debug data pipelines.",
        -      "version": "0.0.1",
        -      "experimental": false,
        -      "files": [
        -        "SKILL.md"
        -      ],
        -      "commands": [
        -        "pipelines"
        -      ]
        -    }
        -  ]
        -}
        -
        ->>> [CLI] skills search --output json demo
        -{
        -  "source": "[TESTROOT]/cmd/skills/search/release",
        -  "release_version": "0.0.1",
        -  "stale": false,
        -  "fetched_at": "[TIMESTAMP]",
        -  "rules": "Pick the skill whose description matches the task.\nRead the skill before you act on it.",
        -  "skills": [
        -    {
        -      "name": "demo-skill",
        -      "description": "A skill for tests.",
        -      "version": "0.0.1",
        -      "experimental": false,
        -      "files": [
        -        "SKILL.md"
        -      ],
        -      "commands": []
        -    }
        -  ]
        -}
        -
        ->>> [CLI] skills search --output json nothing-here
        -{
        -  "source": "[TESTROOT]/cmd/skills/search/release",
        -  "release_version": "0.0.1",
        -  "stale": false,
        -  "fetched_at": "[TIMESTAMP]",
        -  "rules": "Pick the skill whose description matches the task.\nRead the skill before you act on it.",
        -  "skills": []
        -}
        -
        ->>> [CLI] skills search  
        -Error: search words must not be blank
        -
        ->>> [CLI] skills search pipelines
        -No skill matches. Run databricks skills list to see every skill.
        -
        ->>> [CLI] skills search --experimental pipelines
        -pipeline-bare
        -pipeline-lab: An experimental pipeline skill.
        -To read a skill, run: databricks skills read <name>
        -
        ->>> [CLI] skills search --experimental --output json pipelines
        -{
        -  "source": "[TESTROOT]/cmd/skills/search/experimental-release",
        -  "release_version": "0.0.1",
        -  "stale": false,
        -  "fetched_at": "[TIMESTAMP]",
        -  "rules": "",
        -  "skills": [
        -    {
        -      "name": "pipeline-bare",
        -      "description": "",
        -      "version": "0.0.1",
        -      "experimental": true,
        -      "files": [
        -        "SKILL.md"
        -      ],
        -      "commands": [
        -        "pipelines"
        -      ]
        -    },
        -    {
        -      "name": "pipeline-lab",
        -      "description": "An experimental pipeline skill.",
        -      "version": "0.0.1",
        -      "experimental": true,
        -      "files": [
        -        "SKILL.md"
        -      ],
        -      "commands": [
        -        "pipelines"
        -      ]
        -    }
        -  ]
        -}
        +Exit code: 1
        
FAIL

Take the list branch's tip (126f116) so the search command has the list
branch's behaviour. Keep the shared catalogJSON envelope in cmd/skills/json.go
for search, and drop the search-only JSON type the list branch added.

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: 4724e12

Run: 46405879071

Env 💚​RECOVERED ✅​pass 🙈​skip Time
💚​ aws linux-2core-8gb 1 172 12 2:32
💚​ aws-windows-latest-4core-16gb 1 172 12 3:13
💚​ azure linux-2core-8gb 1 171 12 2:31
💚​ azure-windows-latest-4core-16gb 1 171 12 3:07
💚​ gcp linux-2core-8gb 1 172 12 2:34
💚​ gcp-windows-latest-4core-16gb 1 172 12 3:04
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
3:11 aws-windows-latest-4core-16gb TestAccept
3:05 azure-windows-latest-4core-16gb TestAccept
3:02 gcp-windows-latest-4core-16gb TestAccept

@simonfaltum
simonfaltum marked this pull request as ready for review November 27, 2026 19:00
@simonfaltum
simonfaltum requested a review from a team as a code owner November 27, 2026 19:00

@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 f59abe1. Each finding was verified against the code.

No blocking issues found. 5 non-blocking comment(s) and 1 question(s) below.

This PR moves skills list and skills search JSON onto one shared catalogJSON type, and adds experimental per skill and stale, fetched_at and rules to the envelope. The output change itself looks correct and the goldens follow from it. What's left: search still prints no stale warning in text mode, search's JSON source changes on Windows without the description saying so, one doc comment is inaccurate, and two unit tests overlap with coverage that already exists.

Questions

  1. This PR merges listJSON and searchJSON into one type and, in the same change, adds four new output fields (experimental, stale, fetched_at, rules). Should the type merge, which the removed search.go comment already planned, land on its own, with the new fields in a follow-up, so the refactor and the output changes can be reviewed separately? (non-blocking)

Comment thread cmd/skills/search.go
Commands: copyList(s.Commands),
})
}
out := newCatalogJSON(catalog, matches)

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] With a stale catalog, skills list prints provenanceLine on stderr in both output modes (list.go:50-52). skills search only gets the stale field in JSON, so skills search jobs in text mode still says nothing. Should runSearch log provenanceLine(catalog) when catalog.Stale is set, the way runList does?

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 7da8a69. runSearch now logs the provenance line on stderr when the catalog is stale, as runList does, in both output modes. TestRunSearchStaleCatalogSaysStale checks both modes.

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.

The stale provenance line in skills search is the change in #8137. This pull request carries a copy of it, and whichever of the two merges second drops its own copy and keeps the other's runSearch shape.

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.

Main now has #8137, which prints this same stale line from runSearch. This branch merged main in 9b34277 and dropped its own copy, so runSearch keeps main's shape. The search JSON is unchanged, and the stale test still checks the line on stderr in both modes.

Comment thread cmd/skills/search.go
Commands: copyList(s.Commands),
})
}
out := newCatalogJSON(catalog, matches)

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] Search used to print catalog.Label as is. newCatalogJSON applies filepath.ToSlash, so on Windows a local source C:\skills\release now prints as "source": "C:/skills/release" in skills search --output json. That matches list, but it's a user-visible change that no golden can show and the description doesn't mention. Can you add it to the description, or split it out with the type merge?

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.

Kept filepath.ToSlash in both commands, so the envelope is one shape. Search text never printed the source, so only skills search --output json on Windows changes, and it now matches skills list. The PR description lists it under decisions to review. Acceptance runs on Linux, so no golden shows the Windows form.

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.

Correction to my earlier reply: skills.Resolve already applies filepath.ToSlash, so no current source changes on Windows. The call stays as a guard, and the description is corrected.

Comment thread cmd/skills/json_test.go Outdated
func TestSearchJSONStaleCatalogSaysStale(t *testing.T) {
catalog := &libskills.Catalog{Label: "bundled", Version: "1.2.3", Stale: true, Skills: searchCatalog}

out, err := json.Marshal(newCatalogJSON(catalog, matchSkills(searchCatalog, []string{"jobs"})))

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] This calls newCatalogJSON directly, so it would still pass if runSearch stopped using the shared constructor. For stale, it checks the same thing as TestRunListJSONStaleCatalogSaysStale. The only new thing it checks is that fetched_at is left out when the fetch time is zero. Should it be renamed to say that, or dropped?

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.

Dropped the constructor test. TestRunSearchStaleCatalogSaysStale replaces it and calls runSearch, so it fails if search stops using the shared constructor. It also covers the zero fetch time: fetched_at is left out, and the test name and comment say so.

Comment thread cmd/skills/json_test.go Outdated
return cmd, &stdout
}

func TestRunListJSONMarksExperimentalAndCarriesRules(t *testing.T) {

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 regenerated acceptance/cmd/skills/list/output.txt already shows experimental false and true, "stale": false, and rules equal to the text printed above the list. .agents/rules/testing.md says not to add a unit test that only duplicates acceptance coverage. Can this one go and the stale-catalog test stay, since acceptance can't produce a stale catalog?

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.

Dropped TestRunListJSONMarksExperimentalAndCarriesRules. The list golden already covers experimental for both values and rules equal to the text output, so the test only duplicated acceptance coverage. Kept the stale-catalog test, since acceptance cannot produce a stale catalog.

Comment thread cmd/skills/json.go Outdated

// newCatalogJSON returns the JSON output for the skills in list, which are the
// skills a command shows from catalog. Rules are the same text the text output
// prints above the list.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[nit] skills search uses this constructor too, but searchTemplate never prints rules, so "the same text the text output prints above the list" only holds for skills list. Maybe: "Rules are the catalog rules, trimmed as skills list prints them; skills search carries them too so both commands share one envelope."

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.

Reworded in 7da8a69, as suggested: the rules are the catalog rules, trimmed as skills list prints them, and skills search carries them too so both commands share one envelope.

… runSearch

runSearch takes a source, so its test runs the command rather than the
constructor. Text search prints the provenance line for a stale catalog,
as skills list does. The JSON envelope comment says the rules are the
ones skills list prints.

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
The skills list branch merged to main as a squash. Keep the shared catalog JSON envelope in json.go for skills list and search, and drop the list-only JSON type that the squash brought in.

Co-authored-by: Isaac <no-reply@databricks.com>
@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.

Thank you for this change. The catalogJSON merge is correct, and I found no defect in the code. CI passes on linux, windows and macos.

Risk: LOW. The change reaches only the JSON output of skills list and skills search, in the hidden skills group. That group is registered only when DATABRICKS_SKILLS_PREVIEW is set. The JSON change adds fields and removes none, and a revert is easy.

I did not approve yet, because one design question is open (inline on cmd/skills/json.go). review-oss-bot asked a similar question in #8139 (review), and it has no answer yet. The other comments are nits.

Comment thread cmd/skills/json.go
type catalogJSON struct {
Source string `json:"source"`
ReleaseVersion string `json:"release_version"`
Stale bool `json:"stale"`

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.

[Question] Can stale be true, or fetched_at differ from the current time, with the sources that skills.Resolve returns today? Resolve returns only an fsSource. fsSource.Catalog never sets Stale, and it sets FetchedAt to time.Now(). Only bundledSource sets Stale, and Resolve does not return it. Thus these two fields and the new stale line in skills search run only in unit tests.

Is it better to merge the type change alone now, and add stale and fetched_at with the change that makes a stale source reachable? The answer decides whether the JSON contract gets fields that no user can see change.

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.

Right for the sources skills.Resolve returns today: stale is always false, and fetched_at is the time of the call. I kept both fields in this PR rather than merging the type change alone. The ticket requires stale and provenance in the JSON output, with a test that a stale catalog shows "stale": true, and a type-only merge would not meet that. The description now says this under decisions to review.

Comment thread cmd/skills/json.go
// share one envelope.
func newCatalogJSON(catalog *libskills.Catalog, list []libskills.Skill) catalogJSON {
out := catalogJSON{
Source: filepath.ToSlash(catalog.Label),

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.

[nit] This filepath.ToSlash call has no effect. skills.Resolve already builds the label with filepath.ToSlash(dir). The other labels (the release URL and "bundled copy") have no backslashes. Thus skills search --output json on main already prints forward slashes on Windows.

Update the "Decisions to review" item in the PR description, because it describes a behavior change that does not occur. You can keep the call as a guard, or remove it.

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.

Confirmed: skills.Resolve already applies filepath.ToSlash, so the call in newCatalogJSON changes nothing for any current source. I kept it as a guard, so the envelope source is a slash path whatever the caller passes. The description said Windows output changes, which was wrong, and it is corrected.

Comment thread cmd/skills/json_test.go Outdated

// outputTestCmd returns a command whose output is in the given format, and the
// buffers that capture stdout and stderr.
func outputTestCmd(t *testing.T, output flags.Output) (*cobra.Command, *bytes.Buffer, *bytes.Buffer) {

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.

[nit] outputTestCmd does almost the same job as listTestCmd in cmd/skills/list_test.go. The doc comment says that it captures stdout, but it does not call cmd.SetOut. A later test that calls runList in text mode gets an empty stdout buffer, because runList writes to cmd.OutOrStdout().

Keep one helper that passes the same buffer to cmdio.NewIO and to cmd.SetOut.

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 98b6970. outputTestCmd is removed, and listTestCmd now sends cmdio output and cmd.SetOut to one stdout buffer. The JSON tests use it, and go test ./cmd/skills/... passes.

@@ -0,0 +1,3 @@
# The skill files are printed verbatim, so their line endings must stay \n on every OS.
# A Windows checkout would otherwise turn them into \r\n and change what `skills read` prints.

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.

[nit] This comment is a copy from acceptance/cmd/skills/release/.gitattributes, and it names skills read. The search script does not run skills read. The real reason is that RULES.md goes into the JSON rules field of the search golden, and strings.TrimSpace keeps an inner \r\n. Change the comment to give this reason.

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 98b6970. The comment now gives the real reason: the rules field is printed from RULES.md, and strings.TrimSpace keeps an inner CRLF, so a Windows checkout would change the golden. The copied skills read wording is gone.

simonfaltum and others added 3 commits November 28, 2026 23:48
The JSON tests had their own output helper that did not route command output
to the stdout buffer, so a text-mode test could not read what the command
wrote. listTestCmd now sends cmdio output and the command's own writes to
one buffer, and the JSON tests use it.

The search release .gitattributes comment now gives the real reason for the
eol rule: the rules field keeps an inner CRLF.

Co-authored-by: Isaac <no-reply@databricks.com>
skills list --output json now carries each skill's experimental flag, so the
list golden gains it. The search golden already had it.

Co-authored-by: Isaac <no-reply@databricks.com>
@simonfaltum
simonfaltum requested a review from denik November 29, 2026 09:28
Comment thread cmd/skills/json.go Outdated
Skills: make([]catalogJSONSkill, 0, len(list)),
}
if !catalog.FetchedAt.IsZero() {
out.FetchedAt = catalog.FetchedAt.Format(time.RFC3339)

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.

[nit] fsSource.Catalog sets FetchedAt to time.Now() (libs/skills/fs.go:42), and catalog.FetchedAt.Format(time.RFC3339) keeps the local offset. The same instant therefore prints as 2026-11-30T10:14:00-08:00 on one machine and …Z on another, which makes the machine-readable field depend on the host's TZ. Consider catalog.FetchedAt.UTC().Format(time.RFC3339) in newCatalogJSON, and in provenanceLine too if you want both outputs to match.

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 4724e12. newCatalogJSON and provenanceLine now format fetched_at in UTC, so the value does not depend on the host's time zone.

Comment thread cmd/skills/json_test.go Outdated
// A stale catalog gets the provenance line in both output modes, as skills list
// prints it. The JSON says "stale": true and leaves out fetched_at, because a
// bundled copy has no fetch time.
func TestRunSearchStaleCatalogSaysStale(t *testing.T) {

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.

[nit] Since #8137 landed on main, search_test.go already has TestRunSearchStaleCatalogPrintsProvenanceOnStderr, which checks the exact stale line on stderr in text mode. The text-mode half of TestRunSearchStaleCatalogSaysStale (json_test.go:40-42) repeats that check more loosely. Main also brought searchTestCmd, which now does the same job as the reworked listTestCmd, so there are two helpers again (the earlier "keep one helper" thread). Consider keeping only the JSON half of the new test, and switching search_test.go to listTestCmd or deleting searchTestCmd.

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 4724e12. The new test is now JSON only (TestRunSearchJSONStaleCatalogSaysStale), and the text-mode stale line stays covered by the test in search_test.go. searchTestCmd is deleted and search_test.go uses listTestCmd, so there is one helper.

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.

4 participants