ci: skip doc-check when no changed path has a documentation surface (#29364)
doc-check started a review chat on every non-draft pull request. A review loads the full skill context, the content guidelines, and the cumulative diff before it can conclude anything, so a dependency bump or a test-only change paid that cost only for the skill's own "what not to comment on" list to produce silence. With the wait raised to 40 minutes in #29363, such a run can also hold a runner idle for most of that. This classifies the changed paths first and skips the review when every changed file is in a class with no user-facing documentation surface. Comparing the match count against the total is what makes it "every file", so a diff that mixes a test file with a CLI flag still gets a full review. CI that builds, deploys, previews, or reviews the docs is carved back out of the `.github` skip, because a change there can change the docs themselves. The `doc-check` label and a manual dispatch bypass the skip entirely, so a review stays forceable from the pull request. Tier-2 and tier-3 priors move into `path-priors.md`, loaded only when the pre-filter is inconclusive, so they cost nothing on a skipped run. ## Verification Dry-ran the filter list against real and synthetic file lists with the same globber the action uses. | Pull request | Files | Outcome | |---|---|---| | #29309 restart action | 5 | REVIEW, 3 files outside the skip classes | | #29363 doc-check timeout | 1 | REVIEW, `ci_docs` carve-out fires | | #29306 Mermaid diagrams | 5 | REVIEW, 2 files outside the skip classes | | `go.mod` + `go.sum` | 2 | SKIP | | Go test + React test | 2 | SKIP | | `site/src/index.css` | 1 | SKIP | | `cli/server.go` + its test | 2 | REVIEW | | Regenerated CLI docs + `cli/list.go` | 2 | REVIEW | | `.github/workflows/release.yaml` | 1 | SKIP | `make pre-commit` passes, including `lint/actions/actionlint`. <details> <summary>Why the patterns use the <code>**/*</code> form</summary> The globber treats a `**` glued to a suffix inconsistently. Verified against picomatch with `dot: true`: | Pattern | `coderd/database/db_test.go` | `foo_test.go` | |---|---|---| | `**_test.go` | no match | match | | `**/*_test.go` | match | match | `**.test.ts` happens to match at any depth, but `**_test.go` only matches the repo root, so a nested Go test would have leaked through and started a review. Every pattern in the filter uses `**/*` instead, which behaves the same at every depth including the root. `.github/workflows/ci.yaml` carries a related note about the same class of bug in a different action's globber. </details> <details> <summary>Implementation plan and decision log</summary> Part of a broader restructure of the doc-check skill. The audit found five defects: no path pre-filter, no commit scoping, duplicated rules, no likelihood model, and no destination for adjacent docs-gap ideas. This PR addresses the first, which is the largest token win and the lowest risk. The remainder is tracked separately. **Rejected: `paths-ignore` on the `pull_request` trigger.** It does express "all changed files match" for free, which was the initial plan. But it applies to the trigger as a whole, including `labeled` and `ready_for_review`, so a `doc-check` label on a CSS-only pull request would have been filtered out too and the manual override would have silently died. A job-level filter step costs about 20 seconds of runner time and keeps the override working, so the filter lives in the job and the trigger is untouched. **Rejected: negation patterns for the docs-affecting CI carve-out.** `!`-prefixed patterns inside the `nodocs` filter would have made the result depend on pattern order. A separate `ci_docs` filter that must be empty is explicit and reads as what it means. **Deliberately not skipped: `coderd/database/migrations/`.** A migration alone has no user surface, but migrations usually ship next to an API change, and the all-files-must-match rule already handles that case. Left to the agent rather than hardcoded either way. **Known limitation.** A user-facing default change can hide inside an otherwise-skippable path. The all-files-must-match rule plus the label override is the mitigation; a path-only gate cannot close this completely. **Follow-ups this does not do.** Commit-scoped incremental reviews, a `concurrency` block, splitting `SKILL.md` and deleting the rules it restates from the content guidelines, run-outcome reporting so silence and failure are distinguishable, and routing adjacent docs-gap ideas into Linear. </details> DOCS-920 > Generated by Coder Agents on behalf of @nickvigilante.
This commit is contained in:
1 parent
88137fc91a
commit
5699a5cf04
3 files changed
+183
-6
No files matched your search
@@ -25,10 +25,13 @@ writing them.
|
||||
- For local changes: `git diff main` or `git diff --staged`
|
||||
- For a branch: `git diff main...<branch>`
|
||||
|
||||
2. **Triage the diff.** Walk the
|
||||
2. **Triage the diff.** Check the changed paths against
|
||||
[`path-priors.md`](./path-priors.md) for what they predict, then walk the
|
||||
[quick decision checklist](../../../docs/.style/content-guidelines.md#quick-decision-checklist)
|
||||
in the content guidelines. Most non-user-facing diffs route out of
|
||||
the docs entirely; see [What not to comment on](#what-not-to-comment-on).
|
||||
A prior sets the starting assumption, not the verdict: verify it against
|
||||
the diff either way.
|
||||
|
||||
3. **Understand the scope.** Consider what changed:
|
||||
- Is this user-facing or internal?
|
||||
@@ -194,7 +197,11 @@ find this comment.
|
||||
## What not to comment on
|
||||
|
||||
Do not produce sticky-comment suggestions for these classes of change.
|
||||
They have no user-visible documentation surface.
|
||||
They have no user-visible documentation surface. When every changed file
|
||||
falls in one of these classes, CI skips the review before this skill
|
||||
runs, so a diff in front of you has already passed that gate or a
|
||||
maintainer forced the review with the `doc-check` label. See
|
||||
[`path-priors.md`](./path-priors.md).
|
||||
|
||||
- **Auto-generated CLI docs** under `docs/reference/cli/`. These are
|
||||
generated from Go code under `cli/`; suggest edits to the CLI
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
# Path priors
|
||||
|
||||
What the changed paths predict about whether a change needs docs. A prior sets
|
||||
the starting assumption and the burden of proof; it never replaces the evidence
|
||||
discipline in [`SKILL.md`](./SKILL.md). Verify against the diff either way.
|
||||
|
||||
Three classes. The first is decided before this skill runs.
|
||||
|
||||
## Decided in CI: no documentation surface
|
||||
|
||||
Tests and stories, generated output, dependency and toolchain manifests, build
|
||||
and lint plumbing, styling, internal environments, vendored trees. When *every*
|
||||
changed file is in this class, `.github/workflows/doc-check.yaml` skips the
|
||||
review and no chat starts, so you will not see these diffs.
|
||||
|
||||
Two consequences:
|
||||
|
||||
- A mixed diff still reaches you. One qualifying file is enough to start a
|
||||
review, so do not assume every file in front of you has a documentation
|
||||
surface.
|
||||
- The skip is overridable. A maintainer can force a review with the `doc-check`
|
||||
label, which means you can be handed a diff the skip would otherwise have
|
||||
dropped. Review it on its merits.
|
||||
|
||||
The authoritative list is the `nodocs` filter in that workflow. Docs-affecting
|
||||
CI is carved back out of it, because a change to how the docs build, deploy,
|
||||
preview, or get reviewed can change the docs themselves.
|
||||
|
||||
## Strong prior: absent docs is the finding
|
||||
|
||||
These paths add or change a surface a user configures, types, calls, or lands
|
||||
on. Missing documentation here is a gap, not a judgment call. Start from
|
||||
"this needs docs" and look for the page that proves otherwise.
|
||||
|
||||
| Change | Why it earns docs |
|
||||
|---|---|
|
||||
| New or changed `cli/` command or flag | Appears in `--help`, so it is user-facing by default |
|
||||
| New or changed public `codersdk/` field or endpoint | The API is a first-class user surface |
|
||||
| New `coderd/apidoc/` endpoint | Same, and the path must be documented in full |
|
||||
| New or changed deployment option or `CODER_*` environment variable | Configuration is product surface area |
|
||||
| New `site/src/pages/` route | A new navigable page is net-new surface |
|
||||
| New licensed `enterprise/` feature, or a new Premium gate | Needs the page plus both Premium markers |
|
||||
| A changed setup, enablement, or migration procedure | The steps a user follows are the documentation |
|
||||
| Renamed or deprecated product or feature name | The glossary and every referring page drift otherwise |
|
||||
|
||||
Two cautions that survive a strong prior:
|
||||
|
||||
- An auto-generated reference page regenerating is not documentation. A new flag
|
||||
landing in `docs/reference/cli/` still leaves a conceptual guide gap.
|
||||
- A surface that is not visible by default, including anything behind an unsafe
|
||||
experiment, has not reached the bar yet.
|
||||
|
||||
## No prior: decide from the diff
|
||||
|
||||
Everything unlisted, including component-level frontend changes,
|
||||
`coderd/` handler behavior, provisioner changes, and database migrations. A
|
||||
migration alone has no user surface, but it often ships next to an API change,
|
||||
and the mixed-diff rule above means you will see that change too.
|
||||
|
||||
Here the path tells you nothing and the evidence discipline decides. This is
|
||||
also where the near-miss lives: a page enumerates a sibling surface rather than
|
||||
the one that changed. Resolve it under the finding bar in `SKILL.md`, and prefer
|
||||
naming no page over naming the nearest one.
|
||||
@@ -74,8 +74,115 @@ jobs:
|
||||
echo "skip=false" >> "${GITHUB_OUTPUT}"
|
||||
fi
|
||||
|
||||
- name: Determine PR Context
|
||||
# A review costs the full skill context before it can conclude anything,
|
||||
# so decide here instead of in the model when no changed file can have a
|
||||
# documentation surface. Path classes live in
|
||||
# .claude/skills/doc-check/path-priors.md; keep the two in sync.
|
||||
- name: Classify changed paths
|
||||
if: steps.check-secrets.outputs.skip != 'true' && github.event_name == 'pull_request'
|
||||
id: filter
|
||||
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
|
||||
with:
|
||||
filters: |
|
||||
all:
|
||||
- "**"
|
||||
nodocs:
|
||||
# Extension patterns use the `**/*` form, not `**`. The globber
|
||||
# treats a `**` glued to a suffix inconsistently: `**.test.ts`
|
||||
# matches at any depth, but `**_test.go` only matches the repo
|
||||
# root. `**/*` behaves the same at every depth, including the
|
||||
# root, so every pattern here uses it.
|
||||
# Tests, stories, and fixtures.
|
||||
- "**/*_test.go"
|
||||
- "**/*.test.ts"
|
||||
- "**/*.test.tsx"
|
||||
- "**/*.stories.tsx"
|
||||
- "**/testdata/**"
|
||||
# Generated output. Changes belong in the generator.
|
||||
- "docs/reference/cli/**"
|
||||
- "site/src/api/typesGenerated.ts"
|
||||
- "**/*.pb.go"
|
||||
- "**/*.golden"
|
||||
- "coderd/apidoc/swagger.json"
|
||||
- "coderd/apidoc/docs.go"
|
||||
# Dependency and toolchain manifests.
|
||||
- "go.mod"
|
||||
- "go.sum"
|
||||
- "package.json"
|
||||
- "pnpm-lock.yaml"
|
||||
- "site/package.json"
|
||||
- "site/pnpm-lock.yaml"
|
||||
- "**/mise.toml"
|
||||
# Build, lint, and CI plumbing. Docs-affecting CI is carved back
|
||||
# out by the ci_docs filter below.
|
||||
- ".github/**"
|
||||
- "Makefile"
|
||||
- ".golangci.yaml"
|
||||
- ".editorconfig"
|
||||
- ".gitattributes"
|
||||
- ".gitignore"
|
||||
- "**/biome.jsonc"
|
||||
- "**/.markdownlint.jsonc"
|
||||
- "**/.markdownlint-cli2.jsonc"
|
||||
# Styling only. A restyle changes no documented behavior.
|
||||
- "**/*.css"
|
||||
- "site/components.json"
|
||||
# Internal environments and vendored trees.
|
||||
- "dogfood/**"
|
||||
- "**/vendor/**"
|
||||
ci_docs:
|
||||
# CI that builds, deploys, previews, or reviews the docs. A change
|
||||
# here can change the docs themselves, so it earns a review even
|
||||
# though it sits under .github.
|
||||
- ".github/workflows/ci.yaml"
|
||||
- ".github/workflows/doc-check.yaml"
|
||||
- ".github/workflows/deploy-docs.yaml"
|
||||
- ".github/workflows/docs-preview.yaml"
|
||||
- ".github/workflows/audit-docs-paths.yaml"
|
||||
- ".github/workflows/weekly-docs.yaml"
|
||||
- ".github/workflows/test-deploy-docs-diff.sh"
|
||||
- ".github/workflows/test-deploy-docs-release.sh"
|
||||
- ".github/workflows/test-docs-preview-mapper.sh"
|
||||
|
||||
- name: Decide whether to review
|
||||
if: steps.check-secrets.outputs.skip != 'true'
|
||||
id: check-paths
|
||||
env:
|
||||
# The doc-check label and a manual dispatch always force a review, so
|
||||
# any skip below stays overridable from the pull request.
|
||||
FORCED: ${{ github.event_name == 'workflow_dispatch' || github.event.label.name == 'doc-check' }}
|
||||
ALL_COUNT: ${{ steps.filter.outputs.all_count }}
|
||||
NODOCS_COUNT: ${{ steps.filter.outputs.nodocs_count }}
|
||||
CI_DOCS_COUNT: ${{ steps.filter.outputs.ci_docs_count }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
if [[ "${FORCED}" == "true" ]]; then
|
||||
echo "skip=false" >> "${GITHUB_OUTPUT}"
|
||||
echo "Review forced by label or manual dispatch; path classes ignored."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Comparing against all_count is what makes this "every changed file".
|
||||
# A pull request that mixes a test file with a CLI flag still gets a
|
||||
# full review, because the counts differ.
|
||||
if [[ -n "${ALL_COUNT}" && "${ALL_COUNT}" != "0" &&
|
||||
"${NODOCS_COUNT}" == "${ALL_COUNT}" && "${CI_DOCS_COUNT}" == "0" ]]; then
|
||||
echo "skip=true" >> "${GITHUB_OUTPUT}"
|
||||
echo "All ${ALL_COUNT} changed file(s) are in path classes with no documentation surface."
|
||||
{
|
||||
echo "### Documentation check skipped"
|
||||
echo ""
|
||||
echo "All ${ALL_COUNT} changed file(s) are in path classes with no documentation surface, so no review ran."
|
||||
echo ""
|
||||
echo "Add the \`doc-check\` label to review anyway."
|
||||
} >> "${GITHUB_STEP_SUMMARY}"
|
||||
else
|
||||
echo "skip=false" >> "${GITHUB_OUTPUT}"
|
||||
fi
|
||||
|
||||
- name: Determine PR Context
|
||||
if: steps.check-secrets.outputs.skip != 'true' && steps.check-paths.outputs.skip != 'true'
|
||||
id: determine-context
|
||||
env:
|
||||
GITHUB_EVENT_NAME: ${{ github.event_name }}
|
||||
@@ -132,7 +239,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Check the review workspace is usable
|
||||
if: steps.check-secrets.outputs.skip != 'true'
|
||||
if: steps.check-secrets.outputs.skip != 'true' && steps.check-paths.outputs.skip != 'true'
|
||||
id: check-workspace
|
||||
env:
|
||||
CODER_URL: ${{ secrets.DOC_CHECK_CODER_URL }}
|
||||
@@ -172,7 +279,7 @@ jobs:
|
||||
echo "Workspace state is usable."
|
||||
|
||||
- name: Build chat prompt
|
||||
if: steps.check-secrets.outputs.skip != 'true'
|
||||
if: steps.check-secrets.outputs.skip != 'true' && steps.check-paths.outputs.skip != 'true'
|
||||
id: extract-context
|
||||
env:
|
||||
PR_NUMBER: ${{ steps.determine-context.outputs.pr_number }}
|
||||
@@ -240,7 +347,7 @@ jobs:
|
||||
} >> "${GITHUB_OUTPUT}"
|
||||
|
||||
- name: Run doc-check via Coder Agent Chat
|
||||
if: steps.check-secrets.outputs.skip != 'true'
|
||||
if: steps.check-secrets.outputs.skip != 'true' && steps.check-paths.outputs.skip != 'true'
|
||||
uses: coder/agents-chat-action@3e20636f47ed88d1486b767ade8cb1e13a1effa7 # v0.5.0
|
||||
with:
|
||||
coder-url: ${{ secrets.DOC_CHECK_CODER_URL }}
|
||||
|
||||
Reference in new issue
Block a user