Skip to content

ApiExplorer: discover op-*.md and tag-*.md supplemental files - #3920

Merged
reakaleek merged 13 commits into
mainfrom
cursor/97903425
Aug 25, 2026
Merged

ApiExplorer: discover op-*.md and tag-*.md supplemental files#3920
reakaleek merged 13 commits into
mainfrom
cursor/97903425

Conversation

@reakaleek

Copy link
Copy Markdown
Member

Why

  • API Explorer needs naming-convention discovery so authors can add op-*.md and tag-*.md overlays, matching the CLI reference system (elastic/docs-eng-team#726).
  • Assembler preview builds skipped API pages, so reviewers could not see this work on docs-v3-preview.

What

  • Discover op-*.md and tag-*.md files under api/<key>/, match them to operations and tags, and keep unmatched or version-suffixed files as data for later issues.
  • Exclude those files from Markdown HTML output, watch them for reload, and turn on ASSEMBLER_API_EXPLORER for the preview environment.

Notes

  • Operation files match the spec operationId exactly. Tag files use the existing URL slug (spaces to hyphens, lowercased, underscores kept). This differs from the RFC hyphen rewrite, which would collide on names like foo.bar vs foo_bar.
  • Discovery does not merge overlay text into rendered HTML yet. That is elastic/docs-eng-team#728.
  • This repo stays skip: true in assembler config. The local Elasticsearch fixture in _docset.yml is for isolated docs-builder serve only.

Made with Cursor

reakaleek and others added 2 commits August 25, 2026 11:05
Authors need op-*.md and tag-*.md discovery before merge into rendered pages. Assembler previews also need the API Explorer flag so those pages appear on docs-v3-preview.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@reakaleek
reakaleek requested review from a team as code owners August 25, 2026 09:11
@reakaleek
reakaleek requested a review from technige August 25, 2026 09:11

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

Requesting changes because supplemental tag discovery currently misses inline operation tag names, which can incorrectly classify valid tag-*.md overlays as unmatched.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Comment thread src/Elastic.ApiExplorer/Supplemental/ApiSupplementalDiscovery.cs Outdated
reakaleek and others added 6 commits August 25, 2026 11:28
Co-authored-by: Cursor <cursoragent@cursor.com>
Assembler preview includes this repo's docs even when skip is true, so the local elasticsearch key collided with docs-content.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Assembler preview still builds this checkout, so the URL key cannot be elasticsearch.

Co-authored-by: Cursor <cursoragent@cursor.com>
The CloudFront version index keys specs by basename, and elasticsearch.json is the published name.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

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

Requesting changes: there are two behavior regressions to address before merge (nested child-name validation scope and API-regeneration staleness on .md edits).


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

continue;
}

if (ResolvedApiConfiguration.IsSupplementalFileName(childFile.Name))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This check uses childFile.Name, so it rejects any child whose basename starts with op- or tag-, including nested paths like guides/op-overview.md.

That creates a false validation error: nested children are not auto-discovered by supplemental discovery (which only scans top-level api/<key>/*.md), so these files are neither discoverable nor listable.

A concrete failure case is:

children:
  - file: guides/op-overview.md

This previously-valid child is now dropped with an error even though it does not collide with top-level supplemental discovery.

Could we limit this guard to top-level children (or otherwise align it with the actual discovery scope)?

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.

Fixed in 6e0b1d4 — The children: guard now rejects op-/tag- names only for files directly under api//, so nested pages such as guides/op-overview.md remain valid.

foreach (var childFile in apiConfig.Children)
foreach (var apiConfig in config.ApiConfigurations.Values)
{
foreach (var file in apiConfig.EnumerateApiMarkdownFiles())

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

CurrentApiMarkdownTimestamps() is only consulted from EnsureApiReferencesAsync(), but that method exits early when _apiReferencesStale is false.

For normal .md edit events, ReloadAsync(reloadConfiguration: false) returns early (because _cachedCrossLinks is already populated) and never flips _apiReferencesStale back to true. So edits to existing api/<key>/op-*.md / tag-*.md files typically won’t trigger API regeneration on the next /api request.

Concrete flow:

  1. Start serve and hit /api once (_apiReferencesStale becomes false).
  2. Edit an existing api/<key>/op-foo.md file.
  3. Next /api request returns before reaching this timestamp check.

Could we mark API refs stale for API-markdown edit events so this new change-detection path can run?

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.

Fixed in e708a5a — Content-only reloads now mark API refs stale, so the next /api request re-checks overlay markdown timestamps and regenerates when they changed.

reakaleek and others added 3 commits August 25, 2026 12:08
…ctions)

Co-authored-by: Cursor <cursoragent@cursor.com>
…ub-actions)

Co-authored-by: Cursor <cursoragent@cursor.com>
The version index has no elastic/docs-builder entry, so --strict failed. Look up elastic/elasticsearch-specification / elasticsearch.json like docs-content.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

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

Requesting changes: there is one merge-blocking regression in this revision that needs to be addressed before approval.

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • d31bhlox0wglh.cloudfront.net
  • elasticdocslinkindex.s3.useast2.amazonaws.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "d31bhlox0wglh.cloudfront.net"
    - "elasticdocslinkindex.s3.useast2.amazonaws.com"

See Network Configuration for more information.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Comment thread docs/_docset.yml Outdated

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

Requesting changes due to one regression: nested API children: markdown edits are not included in API markdown change detection, so /api can serve stale generated content after content-only reloads.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Comment thread src/tooling/docs-builder/Http/ReloadableGeneratorState.cs Outdated
reakaleek and others added 2 commits August 25, 2026 13:32
…by @github-actions)

Co-authored-by: Cursor <cursoragent@cursor.com>
Windows MockFileSystem collapses op-getAlertingHealth.md and op-getalertinghealth.md into one file. Keep ordinal matching and test casing with a single file.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

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

Approved.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

@reakaleek reakaleek self-assigned this Aug 25, 2026
@reakaleek
reakaleek merged commit ad26517 into main Aug 25, 2026
45 of 47 checks passed
@reakaleek
reakaleek deleted the cursor/97903425 branch August 25, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants