Skip to content

Commit a6b0600

Browse files
committed
fix(docs): don't flag delete-then-recreated trigger pages in check mode
1 parent c986794 commit a6b0600

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

scripts/generate-docs.ts

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,16 @@ let CHECK_ONLY = false
380380
const staleArtifacts: string[] = []
381381
const emittedByPath = new Map<string, string>()
382382

383+
/**
384+
* Deletion candidates recorded by cleanup in check mode. Judged at the end of
385+
* the run, not at cleanup time: generate mode deletes a non-canonical page and
386+
* lets the trigger pass recreate it in the same run, so a candidate that was
387+
* re-emitted this run is that delete-then-recreate dance — content drift (if
388+
* any) is already covered by the overlay comparison — while a candidate nothing
389+
* re-emitted is a genuinely stale page regeneration would remove.
390+
*/
391+
const wouldDeletePaths: string[] = []
392+
383393
/** Writes a generated artifact, or in check mode records its final content for the end-of-run comparison. */
384394
function emitGeneratedFile(filePath: string, content: string): void {
385395
if (CHECK_ONLY) {
@@ -3431,9 +3441,7 @@ function cleanupStaleToolDocs(validToolDocs: Set<string>): void {
34313441
}
34323442

34333443
if (CHECK_ONLY) {
3434-
staleArtifacts.push(
3435-
`${path.relative(rootDir, docPath)} (stale page — regeneration would delete it)`
3436-
)
3444+
wouldDeletePaths.push(docPath)
34373445
continue
34383446
}
34393447

@@ -4073,7 +4081,13 @@ if (import.meta.main) {
40734081
process.exit(1)
40744082
}
40754083
if (CHECK_ONLY) {
4076-
const stale = [...collectStaleEmissions(), ...staleArtifacts]
4084+
const genuinelyDeleted = wouldDeletePaths
4085+
.filter((docPath) => !emittedByPath.has(docPath))
4086+
.map(
4087+
(docPath) =>
4088+
`${path.relative(rootDir, docPath)} (stale page — regeneration would delete it)`
4089+
)
4090+
const stale = [...collectStaleEmissions(), ...staleArtifacts, ...genuinelyDeleted]
40774091
if (stale.length > 0) {
40784092
console.error(
40794093
`Generated integration docs are stale:\n- ${stale.join('\n- ')}\n` +

0 commit comments

Comments
 (0)