Skip to content

Add diagnostic logging to qmd_index.cjs for empty index debugging#22665

Merged
pelikhan merged 2 commits intomainfrom
copilot/add-logging-to-build-qmd-index
Mar 24, 2026
Merged

Add diagnostic logging to qmd_index.cjs for empty index debugging#22665
pelikhan merged 2 commits intomainfrom
copilot/add-logging-to-build-qmd-index

Conversation

Copy link
Contributor

Copilot AI commented Mar 24, 2026

The qmd index silently produced 0 indexed files with no actionable output to diagnose why — resolved paths, pattern values, and collection registration were all invisible.

Changes

  • Per-checkout diagnostics: logs raw path, resolved path (after ${ENV_VAR} expansion), and whether the resolved path exists on disk — immediately surfaces ${GITHUB_WORKSPACE} expansion failures or missing checkouts
  • Collection summary before indexing: logs each registered collection (name, path, pattern) before calling createStore — exposes malformed comma-joined patterns like docs/src/content/docs/**,.github/agents/**,.github/aw/**
  • Zero-file warning: emits core.warning with actionable hints when store.update() returns 0 files, covering the known failure modes: missing path, dotfile glob exclusion, unsupported comma-separated patterns, unresolved env vars

Example output on a misconfigured run:

Collection "gh-aw": path="${GITHUB_WORKSPACE}" -> "/home/runner/work/gh-aw/gh-aw" pattern="docs/src/content/docs/**,.github/agents/**,.github/aw/**"
Collection "gh-aw": path exists
Registering 1 collection(s): gh-aw
  [gh-aw] path="/home/runner/work/gh-aw/gh-aw" pattern="docs/src/content/docs/**,.github/agents/**,.github/aw/**"
Update complete: 0 indexed, 0 updated, 0 unchanged, 0 removed
Warning: No files were indexed. Possible causes:
  - The glob patterns do not match any files (check for dotfile exclusions in patterns starting with '.')
  - The pattern uses a comma-separated list that the qmd SDK does not support
  ...

@pelikhan pelikhan marked this pull request as ready for review March 24, 2026 11:45
Copilot AI review requested due to automatic review settings March 24, 2026 11:45
@pelikhan pelikhan merged commit b2db913 into main Mar 24, 2026
47 of 49 checks passed
@pelikhan pelikhan deleted the copilot/add-logging-to-build-qmd-index branch March 24, 2026 11:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds diagnostic logging to the qmd indexing action so misconfigured checkout paths and glob patterns are visible, and emits an actionable warning when indexing results in zero files.

Changes:

  • Log per-checkout raw vs resolved paths, plus an existence check on the resolved path.
  • Log a summary of registered collections (name/path/pattern) before creating the qmd store.
  • Warn via core.warning when store.update() results in zero indexed/updated/unchanged files.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
actions/setup/js/qmd_index.cjs Adds collection diagnostics (paths/patterns/existence), collection registration summary, and a zero-file warning after update.
.github/workflows/test-dispatcher.lock.yml Updates the aw_context input description in generated Safe Outputs tool metadata.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

const collectionNames = Object.keys(collections);
core.info(`Registering ${collectionNames.length} collection(s): ${collectionNames.join(", ")}`);
for (const [name, col] of Object.entries(collections)) {
core.info(` [${name}] path="${col.path}" pattern="${col.pattern || "(default)"}"`);
Copy link

Copilot AI Mar 24, 2026

Choose a reason for hiding this comment

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

The collection summary log uses col.pattern || "(default)", which will report "(default)" when col.pattern is the empty string (e.g., when checkout.patterns is an empty array and patterns.join(",") yields ""). That’s misleading for debugging and hides an actual misconfiguration (an empty pattern typically matches nothing). Consider logging the actual value (even if empty) and/or normalizing empty patterns back to the default (e.g., treat [] or "" as "**/*.md").

Suggested change
core.info(` [${name}] path="${col.path}" pattern="${col.pattern || "(default)"}"`);
const patternForLog = col.pattern === undefined ? "(default)" : col.pattern;
core.info(` [${name}] path="${col.path}" pattern="${patternForLog}"`);

Copilot uses AI. Check for mistakes.
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.

3 participants