Repository navigation
ci(test-scope): read the trusted classifier in one GraphQL query, not a REST call per file - #9180
Conversation
… a REST call per file
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size SummaryNo component packages changed. Published Package SizeNo published package changed size (11 measured). Download is the gzip tarball npm fetches; unpacked is what lands in Accessibility AuditStatus: Accessibility did not run on this pull request; add Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
Recommending approval. Reading the trusted classifier in one GraphQL query keeps the same base-commit files and the same fail-closed fallback that spec:AST-030 FR3 and FR4 require, and the step's inputs, outputs and required checks are unchanged. The new tests cover the single query, a failed query and a truncated file, and this head's own CI decided scope through the real query without a warning. No changes are needed.
[Automated review]
There was a problem hiding this comment.
Changes requested: the GraphQL read keeps the trusted base-commit classifier and the fail-closed fallback intact, but one existing contract test still pins the old REST call. .github/scripts/spec-owner-workflow.test.mjs:44 expects ref: pr.base.sha in the scope action and now fails in test-node; switching it to the `${pr.base.sha}:${file}` assertion that ci-tooling-routing.test.mjs already uses should clear it. The build-storybook failure comes from main's newer workflow and should clear once main is merged.
[Automated review]
| // both dependencies from the PR's base commit. | ||
| expect(scopeAction).toContain('ref: pr.base.sha'); | ||
| // both dependencies from the PR's base commit, in one GraphQL query. | ||
| expect(scopeAction).toContain('`${pr.base.sha}:${file}`'); |
There was a problem hiding this comment.
.github/scripts/spec-owner-workflow.test.mjs:44 makes the same check with the old string, expect(action).toContain('ref: pr.base.sha'), and it now fails in test-node (1/4). It needs this same update.
There was a problem hiding this comment.
Recommending approval. Reading the trusted classifier in one GraphQL query keeps the same base-commit files and the fail-closed fallback that spec:AST-030 FR3 and FR4 require, and the step's inputs, outputs and required checks are unchanged. The contract test in spec-owner-workflow.test.mjs that pinned the old REST call now asserts the base-SHA expression and passes, and the new cases cover the single query, a failed query and a truncated file. No further changes are needed.
[Automated review]
Maintainer impact
change-scope.cjs,knowledge-paths.cjs,component-packages.cjs, andcomponent-audit-scope.cjsfor audit jobs), the trust model (a pull request cannot loosen its own classification), and fail-closed behavior: a missing, unreadable or truncated file, or a failed query, still puts everything in scope.Intended invariant
spec:AST-030FR3–FR4: classification uses trusted base policy, and uncertainty fails closed. Neither requirement changes; only the transport changes.Change
.github/actions/test-scope/action.yml: one aliased GraphQL query (object(expression: "<base sha>:<path>") { ... on Blob { text isTruncated } }) replaces the per-filerepos.getContentloop. A null, non-text or truncated blob throws into the existing "everything is in scope" path.test-scope-action.test.mjs: the stub serves the policy through GraphQL, and new cases cover one query with no REST call, a failed query, and a truncated file.Evidence
test-scope-action.test.mjs: 28 pass, including the existing missing-classifier and missing-audit-classifier cases, which still fall back to everything in scope.change-scope.cjsbyte-for-byte (10,200 bytes, not truncated) andnullfor a missing path.Scope
Testing
pnpm exec vitest run .github/scripts/test-scope-action.test.mjs