feat(ci): add deterministic PR convention checks#587
Conversation
…ng review feedback Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
|
Two new findings from this review run: (1) unguarded JSON.parse on package.json in validate-samples.mjs line 115 crashes instead of recording a violation; (2) content.match() in check-jsdoc-sync.mjs line 67 only indexes the first class per file, silently skipping services that have a helper class declared before them. Inline suggestions posted on both. |
Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
|
Two new findings this run (existing open threads on
|
… table Move the @track-prefix to oauth-scopes.md section mapping out of the script and into <!-- track: ... --> markers in the doc itself. Internal-only services are now derived from @internal tags in code rather than a maintained list. Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
…only Replace the marker-based prefix->section map with a pure presence check: a public @track method must be documented somewhere in oauth-scopes.md, matched by method name against rows already in the doc. No table, no doc annotations — only data that exists for its own reasons. Section placement stays review's job. Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
|
One new finding this run (the four existing open threads were skipped per dedupe policy): check-jsdoc-sync.mjs:99 — findIndex returns -1 when modelDoc is a proper prefix of serviceDoc (all model lines match but the service has extra trailing lines). Both modelLines[-1] and serviceLines[-1] are undefined, so the diagnostic message reads 'first difference: model: end, service: end' with no hint of what actually differs. Fix: fall back to modelLines.length as the index when findIndex returns -1, which points at the first extra line of the service doc. |
| const modelLines = modelDoc.split('\n'); | ||
| const serviceLines = serviceDoc.split('\n'); | ||
| const i = modelLines.findIndex((line, idx) => line !== serviceLines[idx]); | ||
| violations.push({ | ||
| key, | ||
| message: `JSDoc differs between ${model.modelName} and ${entry.className} - first difference:\n model: ${JSON.stringify(modelLines[i] ?? '<end>')}\n service: ${JSON.stringify(serviceLines[i] ?? '<end>')}`, | ||
| }); |
There was a problem hiding this comment.
findIndex returns -1 when modelDoc is a strict prefix of serviceDoc (all model lines match corresponding service lines but the service has extra trailing lines). In that case modelLines[-1] and serviceLines[-1] are both undefined, so the diagnostic prints model: '<end>', service: '<end>' — completely unhelpful.
| const modelLines = modelDoc.split('\n'); | |
| const serviceLines = serviceDoc.split('\n'); | |
| const i = modelLines.findIndex((line, idx) => line !== serviceLines[idx]); | |
| violations.push({ | |
| key, | |
| message: `JSDoc differs between ${model.modelName} and ${entry.className} - first difference:\n model: ${JSON.stringify(modelLines[i] ?? '<end>')}\n service: ${JSON.stringify(serviceLines[i] ?? '<end>')}`, | |
| }); | |
| const modelLines = modelDoc.split('\n'); | |
| const serviceLines = serviceDoc.split('\n'); | |
| const i = modelLines.findIndex((line, idx) => line !== serviceLines[idx]); | |
| const diffIdx = i === -1 ? modelLines.length : i; | |
| violations.push({ | |
| key, | |
| message: `JSDoc differs between ${model.modelName} and ${entry.className} - first difference:\n model: ${JSON.stringify(modelLines[diffIdx] ?? '<end>')}\n service: ${JSON.stringify(serviceLines[diffIdx] ?? '<end>')}`, | |
| }); |
When i === -1, diffIdx = modelLines.length points past the last model line, which lands on the first extra service line — the actual content that differs.
|
One new finding this run (existing open threads on old file names were skipped — those files no longer exist in the PR, replaced by the TypeScript-AST-based rewrites): check-jsdoc-consistency.mjs:88-94 — Same findIndex returns -1 bug that was flagged on the old check-jsdoc-sync.mjs. When modelDoc is a strict prefix of serviceDoc, all model lines match and findIndex returns -1, making modelLines[-1] and serviceLines[-1] both undefined. The diagnostic reads 'model: end, service: end' with no hint of what actually differs. Fix: fall back to modelLines.length as the index, which points at the first extra service line. |
|
Unresolved thread from this review run:
The prior thread on this file was resolved but the fix was not applied. The current code still reads: const i = modelLines.findIndex((line, idx) => line !== serviceLines[idx]);
violations.push({
key,
message: `... model: ${JSON.stringify(modelLines[i] ?? '<end>')} service: ${JSON.stringify(serviceLines[i] ?? '<end>')}`,
});When The fix is a one-liner: const i = modelLines.findIndex((line, idx) => line !== serviceLines[idx]);
const diffIdx = i === -1 ? modelLines.length : i;
// then use diffIdx instead of i in the message |
|
One thread unresolved this run: check-jsdoc-consistency.mjs:90 (PRRT_kwDOOpObr86PfyY2) — the Fix (same as the prior suggestion): const i = modelLines.findIndex((line, idx) => line !== serviceLines[idx]);
const diffIdx = i === -1 ? modelLines.length : i;
violations.push({
key,
message: `JSDoc differs between ${model.modelName} and ${entry.className} - first difference:\n model: ${JSON.stringify(modelLines[diffIdx] ?? '<end>')}\n service: ${JSON.stringify(serviceLines[diffIdx] ?? '<end>')}`,
});All other previously raised threads were verified as fixed in this revision. |
|
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |



Adds deterministic CI checks for recurring review feedback:
Source-aware checks use the TypeScript compiler API instead of regex-heavy parsing. The checks report all current violations; existing repo cleanup can happen in focused follow-up PRs.