feat(#1512): remove abandoned generated documentation files#3383
feat(#1512): remove abandoned generated documentation files#3383fullsend-ai-coder[bot] wants to merge 1 commit into
Conversation
Add cleanup logic to the documentation generation process that removes stale generated .adoc files when their corresponding CLI commands, Rego builtins, or Tekton tasks are removed. Each documentation template now includes a generated-file marker comment at the top of each output file. The GenerateAsciidoc function collects all file paths written by the CLI, Rego, and Tekton generators, then scans the pages directory for .adoc files with the marker that were not produced in the current run. These stale files are removed automatically. Handwritten documentation files (which lack the marker) are never touched. The generator functions (GenerateCommandLineDocumentation, GenerateRegoReference, GenerateTektonDocumentation) now return the list of page file paths they wrote, enabling the cleanup logic in the parent GenerateAsciidoc function. Closes #1512
|
🤖 Finished Review · ✅ Success · Started 9:55 AM UTC · Completed 10:06 AM UTC |
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Review — approveClean implementation of stale generated-doc cleanup for #1512. The marker-based approach is sound: each template now embeds a Correctness
SecurityNo security findings. The code operates on a known local directory using safe Go standard library APIs ( Scope & coherenceThe PR precisely addresses issue #1512's request: "The document generation code should keep track of any abandoned components and remove the corresponding Asciidoc files." No scope creep — all changes serve the cleanup feature. The marker-based approach is a pragmatic choice that is safe by default (only deletes files it can positively identify as generated). Notes
Labels: PR modifies documentation generation tooling and generated docs |
| var generated []string | ||
| for _, b := range builtins { | ||
| docpath := filepath.Join(module, "pages", strings.ReplaceAll(b.Name, ".", "_")+".adoc") | ||
| f, err := os.Create(docpath) |
There was a problem hiding this comment.
[low] resource-leak
Pre-existing: defer f.Close() inside for loop in generateRegoReference keeps all file handles open until function return. Same pattern exists in tekton.go:95. Not introduced by this PR, but these functions are modified here.
Suggested fix: Extract the loop body into a helper function so defer scopes correctly per iteration, or replace defer f.Close() with explicit f.Close() after template execution.
Add cleanup logic to the documentation generation process that removes stale generated .adoc files when their corresponding CLI commands, Rego builtins, or Tekton tasks are removed.
Each documentation template now includes a generated-file marker comment at the top of each output file. The GenerateAsciidoc function collects all file paths written by the CLI, Rego, and Tekton generators, then scans the pages directory for .adoc files with the marker that were not produced in the current run. These stale files are removed automatically. Handwritten documentation files (which lack the marker) are never touched.
The generator functions (GenerateCommandLineDocumentation, GenerateRegoReference, GenerateTektonDocumentation) now return the list of page file paths they wrote, enabling the cleanup logic in the parent GenerateAsciidoc function.
Closes #1512
Post-script verification
agent/1512-abandoned-doc-removal)d134e495b18cf8493cfea8791e310b58f0320797..HEAD)