Skip to content

Fix release docs automation#9071

Open
amyblais wants to merge 3 commits into
mattermost:masterfrom
amyblais:amyblais/update-docs-workflow
Open

Fix release docs automation#9071
amyblais wants to merge 3 commits into
mattermost:masterfrom
amyblais:amyblais/update-docs-workflow

Conversation

@amyblais

Copy link
Copy Markdown
Member

Summary

  • update_docs.py: parallelizes file processing with ThreadPoolExecutor (up to 5 workers), adds thread-safe tprint helper to prevent interleaved log lines, and updates log messages to use [filepath] prefix format
  • update-docs.yml: adds gh label create "release-docs" step before gh pr create so the label is created if absent (no-ops if it already exists)

Test plan

  • Trigger the Update Docs workflow and verify files are processed in parallel (log lines show multiple files in-flight)
  • Verify the release-docs label is created automatically on first run in a repo where it doesn't exist
  • Verify re-runs don't fail when the label already exists

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings June 25, 2026 16:15
@amyblais amyblais changed the title Update Docs Fix release docs automation Jun 25, 2026
@amyblais amyblais added the Work In Progress Not yet ready for review label Jun 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves the “Update Docs” automation by speeding up the docs-update script with parallel processing and making PR labeling more robust in the workflow.

Changes:

  • Parallelize per-file Claude update calls in .github/scripts/update_docs.py using ThreadPoolExecutor, and add a thread-safe logging helper.
  • Ensure the release-docs label exists before applying it in .github/workflows/update-docs.yml.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
.github/workflows/update-docs.yml Adds a pre-step to create/ensure the release-docs label before creating PRs.
.github/scripts/update_docs.py Runs file updates in parallel with thread-safe logging and updated log formatting.
Comments suppressed due to low confidence (1)

.github/scripts/update_docs.py:247

  • The comment above the "content-quality guards" says they "skip a version with a warning" but these checks now raise to abort processing. Update the comment so it matches the actual (fail-fast) behavior.
        # --- API response integrity checks (raise -> file marked as failed) ---
        # These guard against malformed or truncated API responses before we touch
        # the file. They are distinct from the content-quality guards below, which
        # are softer checks that skip a version with a warning rather than failing it.

Comment thread .github/scripts/update_docs.py Outdated
Comment thread .github/scripts/update_docs.py
Comment thread .github/scripts/update_docs.py Outdated
Comment thread .github/workflows/update-docs.yml Outdated
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@amyblais, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 49 minutes and 55 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 620aaa1d-8d45-4239-8425-4526768a1b72

📥 Commits

Reviewing files that changed from the base of the PR and between 3ce64ad and 395884f.

📒 Files selected for processing (1)
  • .github/scripts/update_docs.py
📝 Walkthrough

Walkthrough

The docs update script now caps multi-version runs, builds prompts with truncation and ESR context, validates Claude responses, and processes files in parallel. The workflow creates the release-docs label before checking for an existing pull request.

Changes

Docs update automation

Layer / File(s) Summary
Script setup and file routing
.github/scripts/update_docs.py
Updates the script header, required environment inputs, version/token limits, and mobile/desktop file lists, including Desktop ESR extras.
Prompt construction and update checks
.github/scripts/update_docs.py
Adds build_user_prompt(...), routes logging through tprint, truncates chained Claude output, and adds the 50% size check plus unchanged-output handling.
Parallel main execution
.github/scripts/update_docs.py
Switches main() to ThreadPoolExecutor, aggregates per-file results and errors, and prints a combined summary before exit.
Workflow PR label creation
.github/workflows/update-docs.yml
Creates the release-docs label before checking for an existing PR, with surrounding step spacing normalized.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the docs automation fixes in the workflow and update script.
Description check ✅ Passed The description matches the changeset and describes both the parallel doc update script and the label workflow update.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/scripts/update_docs.py (1)

208-211: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Align the docstring with the hard-fail behaviour.

Lines 209-210 still describe quality failures as skipped, but Lines 275-285 now raise RuntimeError.

♻️ Proposed docstring update
-    Version-level quality failures (empty response, too-short response) are logged
-    and skipped via continue -- they do not surface as a file-level status.
+    Version-level quality failures (empty response, too-short response) raise
+    RuntimeError so the caller marks the file as failed and prevents partial application.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/scripts/update_docs.py around lines 208 - 211, Update the docstring
for the status-returning logic in update_docs.py so it matches the current
hard-fail behavior. The current description still says version-level quality
failures are logged and skipped via continue, but the implementation now raises
RuntimeError for those cases; adjust the text near the function or helper that
returns "updated", "unchanged", or "not_found" to say quality failures surface
as exceptions while only non-fatal cases are skipped.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/scripts/update_docs.py:
- Around line 261-269: The truncated-file handling in update_docs.py is silently
slicing Claude’s returned head in the update flow, which can drop content before
the original tail is reattached. Update the logic around the truncated/updated
length check in the file-reconstruction path so it does not trim the head;
instead, treat an oversized head as a safe failure condition (or otherwise
preserve full content) before combining it with the tail, using the existing
update flow around MAX_SEND_CHARS and truncated.
- Around line 342-374: The missing-docs path is currently treated as a warning
via the results["not_found"] bucket in update_docs.py, which allows the workflow
to continue; change the control flow in the ThreadPoolExecutor result handling
so any file reported as not_found is treated as a hard failure and causes the
script to exit non-zero. Use the existing update_file / future.result()
aggregation and the final summary output to identify the missing-path case, then
add failure handling that surfaces the missing filepath(s) and stops PR
generation when required docs are absent.

---

Nitpick comments:
In @.github/scripts/update_docs.py:
- Around line 208-211: Update the docstring for the status-returning logic in
update_docs.py so it matches the current hard-fail behavior. The current
description still says version-level quality failures are logged and skipped via
continue, but the implementation now raises RuntimeError for those cases; adjust
the text near the function or helper that returns "updated", "unchanged", or
"not_found" to say quality failures surface as exceptions while only non-fatal
cases are skipped.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0ca8b06d-dfe5-44ba-a064-8973f9526f97

📥 Commits

Reviewing files that changed from the base of the PR and between 6e6ca68 and 155ccc1.

📒 Files selected for processing (2)
  • .github/scripts/update_docs.py
  • .github/workflows/update-docs.yml

Comment thread .github/scripts/update_docs.py Outdated
Comment thread .github/scripts/update_docs.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Work In Progress Not yet ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants