← Back to Pull requests

ci: regenerate stale derived files with one command (npm run generate) #9673

Open
unknown opened this pull request with 454 lines diff across 5 files
View on GitHub
unknown unknown commented on Oct 25, 2026 13:20 UTC
Author

Why

Stale generated files cause over half of CI test failures: 484 occurrences on 130 branches over five weeks, from tests such as public-product-facts, ai-search-product-facts, docs-stats-, product-catalog-freshness and llms-txt-mcp-tools. More than 20 generators write these files, and nothing runs them all, so each failure meant working out which generator the test wanted.

What

  • npm run generate (scripts/generate-derived.mjs) runs every generator's --check in dependency order and rewrites only the stale ones. It repeats until every check passes, up to 3 passes. Generators that stamp today's date or rebuild PDFs leave current files alone. npm run generate:check reports without writing and prints each failing check's output.

  • Pre-push hook: when the check fails, the hook regenerates the files and stops the push so the result can be committed.

  • CI: the always-on docs-stats job runs generate:check. It replaces that job's three single-generator checks: source attribution, teasers and the entitlement crosswalk. Docs-only PRs skip unit, so they now also get the product facts, llms and AI search checks.

  • Coverage test: tests/generate-derived.test.mjs fails when a new :check generator is neither in the list nor explicitly excluded.

  • Docs: a "Derived Files" section in CONTRIBUTING.md and a row in the AGENTS.md code-and-check table.
  • Not covered, as listed in the script header:

  • make generate: proto output, which already has its own hook and CI flow.

  • App translations and internal links, which need API keys.

  • The sitemap and docs page dates, which follow main's commit dates and are refreshed on a schedule and at build time.
  • Verification

  • Clean main: generate:check passes in about 9s and generate changes nothing.

  • Replay of real commits: for 11 recent commits on main that updated generated files, I rolled those files back to the parent and ran npm run generate.

  • - Four came out byte-identical to what the author committed.
    - Five differed only in the "reconciled: <date>" stamp, which the generator sets to today.
    - Two left differences only in hand-written prose that the rollback had also reverted. On one of them (#9622), product facts failed loudly because the prose it patches was gone. No commit showed a generator defect.
  • Failing tests fixed: on three of those commits, the top stale-artifact tests failed (1, 2 and 4 failures) with the files rolled back.

  • - After npm run generate, all tests passed on the first two.
    - The third (#9438) kept 2 failures, coming from a hand-written CII paragraph in llms.txt that the rollback had reverted.
  • Hook step: on that same rolled-back state, it regenerated product facts, inventory facts, AI search and notices, and a second check was clean.

  • Coverage test: passes, and fails when a step is removed from the list.

  • Other tests: 830 tests that read test.yml or the pre-push hook pass. docs:check and biome pass.
  • <!-- This is an auto-generated comment: release notes by coderabbit.ai -->

    <!-- coderabbit-ai-generated:v1 -->

    Summary by CodeRabbit

    Developer Tools
    Added commands to check or regenerate committed derived files.
    The pre-push check now regenerates stale files and stops the push so changes can be reviewed and committed.
    CI now checks generated-file freshness, with the zh-TW check handled separately.
    Documentation
    Added contributor guidance on regenerating derived files and checking them before committing.

    <!-- end of auto-generated comment: release notes by coderabbit.ai -->

    Diff: 454 lines (+340 / -114) across 5 files Reviewer: greptile-apps[bot] Review duration: 8m
    All Vouch review confidence checks passed
    Residual risk 0.30 = Change Risk (0.50) × (1 − Review Confidence (0.41)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 454 lines diff across 5 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 77% · Reviewer familiarity: 35%
    41%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.366
    Shallow Review Depth shallow_review_depth
    0.344
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #9673"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 41.2% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 50.5% (MEDIUM) · Higher = larger blast radius
    50.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 41.2% · Lower = rushed or shallow review
    41.2%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 29.7% · Safe to merge
    29.7%