fix(spec,objectql,sharing,storage): state per-row vs record dispatch on the hook contract (#6966) #5531
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docs Drift Check | |
| # When a PR changes packages/** code, flag the hand-written docs that reference the | |
| # affected packages so they can be re-verified for implementation accuracy before the | |
| # drift lands on main. Advisory only — posts a PR comment, never fails the build. | |
| # The actual LLM audit is run on-demand / on a schedule via the `docs-accuracy-audit` | |
| # workflow, scoped to exactly the docs this check lists. | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| paths: | |
| - 'packages/**' | |
| # The mapper and this workflow, so a change to the guard runs the guard. Without | |
| # these, editing `affected-docs.mjs` was the one change its own self-test could | |
| # never see — a `packages/**`-only trigger means the tool is unguarded exactly | |
| # when it is being modified. A PR that touches only these gets the benign | |
| # "0 changed package(s) ✅" comment, which is the correct answer. | |
| - 'scripts/docs-audit/**' | |
| - '.github/workflows/docs-drift-check.yml' | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| docs-drift: | |
| name: Flag docs affected by code changes | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v7 | |
| with: | |
| node-version: '22' | |
| - name: Fetch base branch | |
| run: git fetch --no-tags origin "${{ github.base_ref }}" | |
| # The mapper excludes test files and package tooling scripts (neither can make | |
| # an implementation doc stale) and derives package roots from the filesystem. | |
| # Self-test first, so a regression that widened an exclusion into dropping real | |
| # implementation changes — or collapsed nested packages into their container | |
| # again (#4162) — fails loudly here instead of quietly skewing this comment. | |
| - name: Self-test the change → docs mapper | |
| run: node scripts/docs-audit/affected-docs.mjs --self-test | |
| - name: Compute affected docs | |
| id: affected | |
| run: | | |
| node scripts/docs-audit/affected-docs.mjs --json "origin/${{ github.base_ref }}" > affected.json | |
| cat affected.json | |
| - name: Comment on PR | |
| uses: actions/github-script@v9 | |
| with: | |
| script: | | |
| const fs = require('fs'); | |
| const data = JSON.parse(fs.readFileSync('affected.json', 'utf8')); | |
| const baseRef = context.payload.pull_request.base.ref; | |
| const docs = data.docs || []; | |
| const pkgs = (data.changedPackages || []).map(p => p.name || p.dir); | |
| const marker = '<!-- docs-drift-check -->'; | |
| // The release-owned rows are PARTITIONED OUT of the editable list, never | |
| // dropped (#6893, following the #4920 ruling). They keep getting audited — | |
| // `docs` above is still the full set the audit workflow is scoped to — but | |
| // listing them beside editable pages steers a reader who treats this comment | |
| // as a worklist into the one edit AGENTS.md forbids outright. So they get | |
| // their own section, carrying the instruction that makes them safe. | |
| const readOnly = data.releaseOwnedDocs || []; | |
| const editable = docs.filter(d => !readOnly.includes(d)); | |
| let body; | |
| if (docs.length === 0) { | |
| body = `${marker}\n### 📓 Docs Drift Check\nNo hand-written docs reference the ${pkgs.length} changed package(s). ✅`; | |
| } else { | |
| const detail = (data.detail || []).reduce((m, d) => (m[d.doc] = d.via, m), {}); | |
| const row = d => `- \`${d}\`${detail[d] ? ` _(via ${detail[d].join(', ')})_` : ''}`; | |
| body = [ | |
| marker, | |
| '### 📓 Docs Drift Check', | |
| `This PR changes **${pkgs.length}** package(s): ${pkgs.map(p => `\`${p}\``).join(', ')}.`, | |
| ]; | |
| if (editable.length) { | |
| body.push( | |
| '', | |
| `**${editable.length}** hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:`, | |
| '', | |
| editable.map(row).join('\n'), | |
| ); | |
| } | |
| if (readOnly.length) { | |
| body.push( | |
| '', | |
| `⛔ **${readOnly.length}** release-owned page(s) ${editable.length ? 'also ' : ''}reference the affected code. These are **read-only**:`, | |
| '', | |
| readOnly.map(row).join('\n'), | |
| '', | |
| '> `content/docs/releases/` is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release', | |
| '> notes are written centrally at release time, and a code PR that edits them is the exact PR', | |
| '> that guardrail exists to stop. They are still audited — read-only. If one of them is actually', | |
| '> wrong, **file an issue** or open a dedicated docs-only PR; do not edit it here.', | |
| ); | |
| } | |
| body.push( | |
| '', | |
| '> Advisory only. To re-verify, run the `docs-accuracy-audit` workflow scoped to these files:', | |
| '> `node scripts/docs-audit/affected-docs.mjs origin/' + baseRef + '` → pass the list as `args.docs`.', | |
| ); | |
| body = body.join('\n'); | |
| } | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find(c => c.body && c.body.includes(marker)); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: existing.id, body }); | |
| } else { | |
| await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, body }); | |
| } |