Skip to content

Commit 2288afd

Browse files
committed
chore(docs): add governance pilot fixtures to exercise lint rules
Fixture PR to verify each docs governance check family end-to-end: front matter, markdown structure, sidebar orphan, link gate, SEO/GEO, SQL function doc quality, feature doc quality, and i18n/version sync. Locally triggers 31 distinct rules, including the blocking changed-only internal link gate (link-missing-target and link-missing-anchor). Fixtures live under docs/_governance-pilot/ plus one SQL function fixture under docs/sql-manual/sql-functions/... A single-line fixture edit is added to an existing zh-CN FAQ to exercise i18n-sync-source-counterpart; that line is a marked HTML comment. Not intended to merge as-is; the author will review before pushing. fix(ci): post docs AI review comment via REST to avoid GraphQL permission The first-time comment path used gh pr comment, which internally issues the GraphQL addComment mutation and requires pull-requests: write. The job only grants pull-requests: read (plus issues: write for the existing update path), so the first comment failed with "Resource not accessible by integration (addComment)". Replace gh pr comment with gh api POST against the issues/{number}/comments REST endpoint, which accepts the issues: write scope the job already grants, and mirrors the PATCH path used when a previous comment exists. fix(ci): split Docs AI Review comment into workflow_run workflow Pull requests from forks run pull_request workflows with a read-only GITHUB_TOKEN regardless of declared permissions, so the inline comment step could never post on fork PRs and returned 403 on both GraphQL and REST comment endpoints. Split the flow following the GitHub workflow_run pattern: - docs-ai-review.yml (pull_request trigger) now only prepares the packet and uploads it as an artifact, together with a pr-metadata JSON describing the PR number, head SHA, base SHA and trigger name. It no longer tries to comment. - docs-ai-review-comment.yml (workflow_run trigger on the first workflow) downloads the artifact from the completed run, parses the metadata, and upserts the advisory comment via REST. Because workflow_run runs in the base-repo context, its GITHUB_TOKEN honors the declared issues: write permission even for fork-originated PRs. The comment workflow does not check out or execute any code from the fork. It only consumes the prebuilt packet and metadata JSON, which avoids the security footgun usually associated with giving write permissions to fork-triggered runs.
1 parent 9f5aa55 commit 2288afd

11 files changed

Lines changed: 183 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: "Fixture: feature doc missing sections"
3+
description: "This fixture is tagged as a feature doc but intentionally omits most required sections so that feature-doc-section-required fires for each one."
4+
doc_type: feature
5+
---
6+
7+
# Fixture: feature doc missing sections
8+
9+
## Random other section
10+
11+
Only an unrelated section is present. Overview, Quick Start,
12+
Parameters/Options, Examples, Error handling and Best practices are all
13+
missing on purpose.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
language: en
3+
---
4+
5+
# Fixture: frontmatter missing
6+
7+
This page intentionally omits both `title` and `description` front matter to
8+
trigger the frontmatter-title-required and frontmatter-description-required
9+
rules.
10+
11+
## Body
12+
13+
Some text to satisfy the body requirement.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: "Fixture: frontmatter type errors"
3+
description: "This fixture has frontmatter fields with the wrong types to trigger the frontmatter type rules in the docs governance lint."
4+
slug: 12345
5+
keywords: 42
6+
tags: "should-be-array"
7+
sidebar_position: "not-a-number"
8+
---
9+
10+
# Fixture: frontmatter type errors
11+
12+
Intentionally wrong types on `slug`, `keywords`, `tags`, `sidebar_position`.
13+
14+
## Body
15+
16+
Content body.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: "Fixture: i18n sync only English"
3+
description: "This fixture intentionally ships only the English current-version copy so the i18n-sync lint reports missing zh-CN, missing 4.x, and the Japanese candidate."
4+
---
5+
6+
# Fixture: i18n sync only English
7+
8+
This doc exists only in English `current`. The i18n sync lint should report:
9+
10+
- `i18n-sync-version-missing` for the 4.x counterpart
11+
- `i18n-sync-locale-missing` for the zh-CN counterpart
12+
- `i18n-sync-locale-candidate` for the Japanese candidate
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: "Fixture: broken links"
3+
description: "This fixture intentionally contains broken internal links and missing anchors to trigger the blocking changed-only link gate."
4+
---
5+
6+
# Fixture: broken links
7+
8+
## Missing internal file
9+
10+
See [this missing doc](./does-not-exist.md) which should trigger the
11+
internal-file-missing rule.
12+
13+
## Missing anchor in existing doc
14+
15+
See [missing anchor](../gettingStarted/what-is-apache-doris.md#this-anchor-does-not-exist)
16+
which should trigger the missing-anchor rule.
17+
18+
## Missing route
19+
20+
Also [this route](/docs/this-route-does-not-exist) should not resolve.
21+
22+
## External link (report-only today)
23+
24+
See the [example external link](https://this-domain-absolutely-does-not-exist-doris-governance.invalid/some-page).
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
title: "Fixture: markdown structure issues"
3+
description: "This fixture intentionally violates Markdown structure rules to trigger code fence, heading and CJK spacing lints."
4+
---
5+
6+
# First H1 heading
7+
8+
Some intro text in English. 这里是中文和English单词直接相连,没空格,应该触发 markdown-cjk-spacing 规则。例如 Doris3.0 这种写法也会触发。
9+
10+
#### Skipped from H1 to H4 to trigger heading increment rule
11+
12+
Body under an invalid heading jump.
13+
14+
##
15+
16+
Above heading is empty so it should trigger markdown-empty-heading.
17+
18+
# Second H1 which should not exist
19+
20+
This second H1 should trigger markdown-single-h1.
21+
22+
## Code fence without language
23+
24+
```
25+
SELECT * FROM tbl;
26+
```
27+
28+
## Code fence with language (control)
29+
30+
```sql
31+
SELECT 1;
32+
```
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: "Fixture SEO Duplicate Title"
3+
description: "Apache Doris documentation."
4+
---
5+
6+
# Fixture SEO duplicate title (a)
7+
8+
Intentionally a very short and generic description. This page shares its
9+
title with `seo-bad-b.md` to trigger the duplicate-title rule.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: "Fixture SEO Duplicate Title"
3+
description: "Docs."
4+
---
5+
6+
# Fixture SEO duplicate title (b)
7+
8+
Intentionally duplicate title + too-short generic description to exercise
9+
seo-title-duplicate, seo-description-length and seo-description-generic.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: "Fixture: sidebar orphan"
3+
description: "This fixture is a new doc that is intentionally not registered in sidebars.ts to trigger the sidebar orphan rule."
4+
---
5+
6+
# Fixture: sidebar orphan
7+
8+
This doc id is not added to `sidebars.ts`, so it should be reported as an
9+
orphan by the sidebar lint.
10+
11+
## Body
12+
13+
Nothing linkable here.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "doris_governance_fixture_bad"
3+
description: "Fixture SQL function documentation with intentionally broken structure to trigger the SQL function governance lint rules."
4+
---
5+
6+
# doris_governance_fixture_bad
7+
8+
## Syntax
9+
10+
```sql
11+
doris_governance_fixture_bad(expr)
12+
```
13+
14+
```python
15+
# extra code block in Syntax section to violate sql-function-syntax-sql-code-block
16+
print("bad")
17+
```
18+
19+
## Description
20+
21+
Intentionally placed after Syntax, violating sql-function-section-order.
22+
23+
## Parameters
24+
25+
Parameters are described as a bullet list to violate sql-function-parameters-table:
26+
27+
- `expr`: some expression.
28+
29+
## Return Value
30+
31+
Returns something useful.
32+
33+
## Example
34+
35+
```sql
36+
SELECT doris_governance_fixture_bad('x');
37+
```
38+
39+
No expected `text` output block is provided, so sql-function-example-output
40+
should fire here.

0 commit comments

Comments
 (0)