Skip to content

feat(ui): recommend catalog tags from a description - #2105

Merged
akijakya merged 2 commits into
mainfrom
feat/ai-catalog-ui-tag-recommender
Sep 7, 2026
Merged

akijakya merged 2 commits into
mainfrom
feat/ai-catalog-ui-tag-recommender

Conversation

@akijakya

@akijakya akijakya commented Sep 3, 2026 •

Copy link
Copy Markdown
Member

The AI Catalog's tag filter matched tag names as substrings, which only helps someone who already knows the OASF taxonomy. Typing what you actually want — "analyzing customer support tickets" — matched nothing, because no tag is named that, leaving you to guess at hundreds of hierarchical labels.

This adds a Suggest tags action next to the existing tag filter. It reinterprets the same text through the extractor (POST /v1/extract) and offers the matching skills and domains as selectable tags. Selecting one behaves exactly like selecting any other tag: filtering still goes through GET /v1/agents?filter=. Only tag discovery changes.

Screenshot

Typing a phrase, finding no substring matches, and getting taxonomy labels back instead:

Screenshot 2026-09-03 at 16 13 28

How it works

extractTaxonomy() posts the text to /v1/extract. suggestTagsFromExtraction() then intersects the returned classes against the GET /v1/tags list the typeahead already loads, and drops everything absent from it — a suggested tag no record carries is worse than no suggestion, since you take the advice and land on an empty catalog.

The intersect keys on kind + class name rather than reconstructing the whole oasf:*:skills:<name> tag id. ListCatalogTags writes * as the schema version today, and hard-coding that would make every suggestion silently vanish the day it emits a real version instead.

Extractor availability is discovered lazily from the first 503 rather than probed on mount, so a gateway with no extractor configured just hides the action instead of spending a model inference on every page load to find out.

Design decisions

Carried over from the issue, restated here for reviewers:

  • One search bar, not two. Both modes serve one intent — find a tag. Splitting the input by matching strategy exposes an implementation detail and forces an unsure user to pick an algorithm before knowing which works.
  • Suggestions are added below, not swapped in. Replacing the substring matches creates a hidden mode with no obvious way back. A labeled section avoids the mode entirely.
  • Explicit trigger, not per-keystroke. Extraction is model inference and half-typed words are semantically meaningless.
  • Skills and domains only. Keywords come back from /v1/extract but have no OASF class behind them, so there is no tag to select. They are dropped in api.ts, not in the component, so they cannot reach the UI at all.

Two calls beyond what the issue specified:

  • A suggestion already visible in the substring list above is filtered out, so the same tag never renders two checkboxes.
  • Editing the input clears stale suggestions — a section labeled "from your description" is misleading once the description has changed.

Notes for reviewers

The tag section moved into its own component. FilterSidebar.svelte was already 261 lines covering three unrelated filter groups plus media-type tree recursion; adding the async suggest state to it would have made the whole thing harder to read. TagFilterSection.svelte owns the tag search, suggestions, and loading state, and calls the same handleTag callback the checkboxes already used.

vitest is new to this package. The UI had no test runner. The mapping and intersect rules are the part of this change most likely to break silently on a server-side format change, so they are covered: 15 cases over kind/name matching, the drop-if-not-in-/v1/tags rule, skill-vs-domain name collisions, dedup, ordering, versioned vs wildcard tag ids, annotation ids ignored, keywords ignored, and the 503 → ExtractorUnavailableError split. Runs via npm test or task ui:test.

Suggestions can legitimately come back empty, and the UI says so rather than falling silent. extractor.DefaultTiers is 2, so /v1/extract returns a shortlist rather than the whole taxonomy; on a sparse registry the intersect can be empty. Deliberately not widening tiers here — ensureVersionCoverage in oasf-sdk already tops the result up past the requested ceiling so every in-scope OASF version is represented, and /v1/extract (unlike search) returns those entries. Worth revisiting only if empty suggestions turn out to be a real complaint.

A tag can still filter to zero results, though this PR neither introduces nor widens it. ListCatalogTags derives tags from every record, while GetCatalogEntries additionally requires a known catalog module and skips records it cannot project — so a tag whose only carriers have no catalog projection passes the intersect and yields nothing. The same is already true of any tag checked by hand, and suggestions are a strict subset of that list. The proper fix is the record count on CatalogTag the issue tracks separately; that count needs to be computed over the catalog-projectable universe, not over all records, or it will reproduce the mismatch with a number attached.

npm run lint fails on this branch, and did before it too. eslint has no eslint.config.js at all and errors out immediately; prettier has no config, so it wants double quotes and spaces against a codebase using single quotes and tabs, and cannot parse .svelte despite prettier-plugin-svelte being a devDependency. Adding a matching .prettierrc still flagged 18 of ~20 files, so a passing lint means reformatting the whole UI — out of scope here. CI does not run this target, only the static-build freshness check, which is presumably why it went unnoticed. Worth its own issue.

Testing

  • task ui:test — 15/15 pass
  • npm run check — 0 errors (one pre-existing a11y warning in DetailModal.svelte)
  • task ui:build — clean, and the committed server/gateway/static output matches a fresh build, which is what CI checks
  • Ran the dev server against a mock gateway to exercise both the populated and 503 paths

Closes #1908

@akijakya akijakya self-assigned this Sep 3, 2026
@akijakya
akijakya requested a review from a team as a code owner September 3, 2026 14:12
@github-actions github-actions Bot added the size/L Denotes a PR that changes 1000-1999 lines label Sep 3, 2026
@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI 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.

🟡 Changes recommended

Async loading races can leave suggestion loading stuck or compute results before catalog tags are available.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds extractor-backed catalog tag recommendations while preserving existing tag filtering.

Changes:

  • Adds taxonomy extraction, tag intersection, and suggestion UI.
  • Introduces Vitest coverage and test tasks.
  • Regenerates committed static UI assets.
File summaries
File Description
server/gateway/ui/vite.config.ts Configures Vitest.
server/gateway/ui/Taskfile.yml Adds UI test task.
server/gateway/ui/src/lib/types.ts Defines extraction and suggestion types.
server/gateway/ui/src/lib/components/TagFilterSection.svelte Implements tag search and suggestions.
server/gateway/ui/src/lib/components/FilterSidebar.svelte Integrates the new tag component.
server/gateway/ui/src/lib/api.ts Adds extraction and tag-mapping logic.
server/gateway/ui/src/lib/api.test.ts Tests extraction and mapping behavior.
server/gateway/ui/package.json Adds Vitest command and dependency.
server/gateway/ui/package-lock.json Locks Vitest dependencies.
server/gateway/static/index.html References rebuilt assets.
server/gateway/static/_app/immutable/nodes/3.gV4OOSVy.js Rebuilds the About route.
server/gateway/static/_app/immutable/nodes/2.D_54MLUH.js Removes the previous catalog bundle.
server/gateway/static/_app/immutable/nodes/2.BamhBAP1.js Adds the rebuilt catalog bundle.
server/gateway/static/_app/immutable/nodes/1.y-TS4hvm.js Adds rebuilt error route.
server/gateway/static/_app/immutable/nodes/1.CWgtiKwJ.js Removes previous error route.
server/gateway/static/_app/immutable/nodes/0.YAJeYxhr.js Adds rebuilt layout route.
server/gateway/static/_app/immutable/nodes/0.D1TABI0x.js Removes previous layout route.
server/gateway/static/_app/immutable/entry/start.RV-5dyY6.js Removes previous startup entry.
server/gateway/static/_app/immutable/entry/start.IuC63T2i.js Adds rebuilt startup entry.
server/gateway/static/_app/immutable/entry/app.Dnr0g9V_.js Removes previous application entry.
server/gateway/static/_app/immutable/entry/app.CKbpG_XR.js Adds rebuilt application entry.
server/gateway/static/_app/immutable/chunks/DsJNZJ3t.js Updates generated page-store imports.
server/gateway/static/_app/immutable/chunks/DPGp9GGy.js Updates generated badge imports.
server/gateway/static/_app/immutable/chunks/D5OVXhOq.js Removes previous stats-store chunk.
server/gateway/static/_app/immutable/chunks/C-S5hJo3.js Updates generated runtime code.
server/gateway/static/_app/immutable/chunks/BvFvB0xU.js Updates generated configuration store.
server/gateway/static/_app/immutable/chunks/BE3mKSrw.js Adds rebuilt stats-store chunk.
server/gateway/static/_app/immutable/assets/0.D-6N7bNh.css Removes previous stylesheet.
server/gateway/static/_app/immutable/assets/0.CAlm59r1.css Adds rebuilt suggestion styles.
Review details

Files not reviewed (7)

  • server/gateway/static/_app/immutable/assets/0.CAlm59r1.css: Generated file
  • server/gateway/static/_app/immutable/chunks/BE3mKSrw.js: Generated file
  • server/gateway/static/_app/immutable/entry/app.CKbpG_XR.js: Generated file
  • server/gateway/static/_app/immutable/nodes/0.YAJeYxhr.js: Generated file
  • server/gateway/static/_app/immutable/nodes/1.y-TS4hvm.js: Generated file
  • server/gateway/static/_app/immutable/nodes/2.BamhBAP1.js: Generated file
  • server/gateway/ui/package-lock.json: Generated file
  • Files reviewed: 23/30 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@akijakya
akijakya merged commit 4d7ae72 into main Sep 7, 2026
33 checks passed
@akijakya
akijakya deleted the feat/ai-catalog-ui-tag-recommender branch September 7, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Denotes a PR that changes 1000-1999 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: AI Catalog UI: recommend tags from a description (extractor-backed)

3 participants