Skip to content

fix(cli): print every search result field in the text view - #6527

Merged
josephfarina merged 1 commit into
mainfrom
cli-spec/docs-search/search-result-projections
Sep 24, 2026
Merged

josephfarina merged 1 commit into
mainfrom
cli-spec/docs-search/search-result-projections

Conversation

@josephfarina

Copy link
Copy Markdown
Contributor

User impact

astryx search text output dropped two fields its --json results carry: title on doc results and kind (page or block) on template results. A reader of the text view could not tell a page template from a block, or see a doc topic's title, without switching to --json, even under --verbose. The --verbose help also misdescribed the flag ("include import paths and match reason"), although import paths always print and --verbose adds the score and the match reason.

After this change every result field prints under its JSON key, and --verbose says what it adds.

Problem and solution fit

  • Why does it occur? The command lists its text fields by hand, and the list was never updated when title and kind joined the result entries.
  • Why does it harm the task? The text view is a partial projection that silently drops public fields, so it cannot answer what the JSON answers.
  • Why does that matter? Every stable response field, nested entry fields included, must be present in the text projection a command provides, under its JSON name.

The fix adds the two fields to both text views (default and --verbose) in the entry's own field order, adds contract tests for the per-domain entry fields, and corrects the function and flag docs that describe them.

Expected behavior and authority

docs/specs/AST-017/spec.md (authority: current), FR13:

A stable CLI response contract includes fields inside discriminated data entries as well as the outer envelope. Every field is present in the canonical response type, contract tests, text projection where the command provides one, and complete consumer-facing schema documentation.

DEC-4: "Keep its canonical type, contract tests, applicable text output, and complete consumer documentation aligned in the same change."

docs/architecture/cli-surface.md (authority: current), INV4 and INV5: human output is a projection of the JSON, and text field names mirror JSON keys one to one.

Smallest restoration

  • clients/cli/commands/search.mjs: title and kind join the default and --verbose field lists; record() still skips fields a result does not carry.
  • api/search/search.doc.mjs: the search return description lists import, title, displayName and kind and the domains that carry them.
  • clients/cli/commands/search.doc.mjs: --verbose is described as "Also print each result's score and match reason", which is what it does.
  • No change to the JSON, the API, ranking, exit codes or error codes. Compatibility (spec:AST-017): text output is not a machine-readable schema; the change restores the documented projection (FR5). Patch.

Evidence

  • Reproduction before the change: astryx search theme --limit 60 --verbose shows no title: line for any doc result and no kind: line for any template result, while astryx --json search theme --limit 60 carries "title" on every doc result and "kind" on every template result.
  • Result after the change: each doc result prints title: <Title> and each template result prints kind: page or kind: block, in both views.
  • Representative unchanged path: component and hook records, the result heading, the empty-result message, and --json output are unchanged.
  • Regression test or other mutation-sensitive proof: clients/cli/commands/search.test.mjs ("prints every result field under its JSON key") compares the text views with the --json envelope for a query that reaches all four domains. It fails on main at title; removing only kind from the default view fails it at kind. api/search/search.test.mjs ("per-domain result fields") adds the missing contract test for import, title, displayName and kind.

Scope

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

pnpm exec vitest run packages/cli/api/search/search.test.mjs packages/cli/clients/cli/commands/search.test.mjs
pnpm -F @astryxdesign/cli exec tsc --project tsconfig.api-dts.json
pnpm check:cli-structure
pnpm -F @astryxdesign/cli readme:check
pnpm -F @astryxdesign/cli typecheck:json-api
ASTRYX_STRICT_LINT=1 pnpm exec eslint <changed files>
pnpm check:repo
pnpm exec vitest run packages/cli

All green: api-dts tsc exit 0, check:cli-structure, readme:check (tables unchanged), typecheck:json-api, strict ESLint (0 errors) and check:repo pass; the CLI suite is 270 files passed / 1 skipped, 4300 tests passed / 5 skipped (main: 4298 passed; the 2 added tests account for the difference).

The search text view never printed `title` on doc results or `kind` on
template results, although both are in every JSON result. Add them to both
views, add the missing per-domain contract test, and say what --verbose adds.
@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 24, 2026 7:22am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 24, 2026
@astracat-bot

astracat-bot Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Sep 24, 2026, 6:15 PM UTC

@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

Preview availability: Storybook and Sandbox were not published for this CI run.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

23 of 420 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Chat Full AI Chat probe light 42,708
Chat Empty State probe light 42,708
Chat Full AI Chat probe dark 41,786
Chat Empty State probe dark 41,786
Slider Default probe light 15,617
Slider Default probe dark 15,615
Chat With Attachments probe light 12,964
Chat With Attachments probe dark 12,114
InputGroup With Typeahead probe light 11,012
InputGroup With Typeahead probe dark 9,189
ComplexSelector Tree list with search probe light 6,245
TextArea Vertical Form Alignment probe light 5,634
ComplexSelector Tree list with search probe dark 5,602
TextArea Vertical Form Alignment probe dark 5,047
ComplexSelector Fruit ripeness selector neutral light 4,007
ComplexSelector Fruit ripeness selector neutral dark 3,825
ToggleButton Group Single probe dark 1,538
ToggleButton Group Single probe light 1,538
MediaTheme On Dark neutral dark 838
Banner Collapsible Content (Expanded) probe dark 92

and 3 more.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot 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.

This change restores the documented astryx search text view: doc results now print their title and template results print their kind (page or block) in both the plain and --verbose views, so text readers no longer need --json to tell a page template from a block or to see a doc topic's title. The --verbose help now correctly says the flag adds each result's score and match reason, and the search API description lists the per-domain fields (import, title, displayName, kind) alongside the shared ones.

The new contract tests compare the text views against the --json envelope across all four search domains and assert the per-domain fields at the API level; the CLI structure, generated README, and JSON-API type checks pass, and the patch changeset correctly treats this contract restoration as nonbreaking. JSON output, ranking, and exit behaviour are unchanged. No blocking findings.

[Automated review]

@josephfarina
josephfarina marked this pull request as ready for review September 24, 2026 20:38
@josephfarina
josephfarina merged commit 884f1d8 into main Sep 24, 2026
38 checks passed
@github-actions
github-actions Bot deleted the cli-spec/docs-search/search-result-projections branch September 25, 2026 06:24

This branch was successfully deployed

1 active deployment
Preview — a25e19ab Deployed Sep 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant