← Back to Pull requests

docs: update the reference generation script #1442

Closed
evanorti closed this pull request without merging on Nov 17, 2026 15:22 UTC
View on GitHub
evanorti evanorti commented on Sep 04, 2026 17:03 UTC
Author

Follow-up to #1440. This fixes the docs generator. The generator reads validation rules to decide required-ness, enum values, and the attestor/signer tables — when it can't read how errors are built it harvests nothing.

  • Refuse when Validate() builds errors the scraper doesn't read

  • Recognise any receiver name, not just c

  • Test that any struct with Validate() yields a rule, or is listed as ruleless

  • Re-anchor two mutation tests that had silently stopped running

  • Regenerate 6-cli-commands.md, stale on main

  • Repoint four citations whose line numbers moved

  • AGENTS.md notes in cli/ and proto/; ignore __pycache__
  • Diff: 178 lines (+164 / -14) across 7 files Reviewer: dhfang Review duration: 106458m
    All Vouch review confidence checks passed
    Residual risk 0.07 = Change Risk (0.43) × (1 − Review Confidence (0.84)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 178 lines diff across 7 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.73 · 5 substantive comment(s)
    0.73
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 50%
    84%
    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.310
    Real PR Conversation Timeline
    7 items
    greptile-apps[bot] greptile-apps[bot] commented on Sep 04, 2026 17:07 UTC
    Bot

    <h3>Greptile Summary</h3>

    This follow-up hardens the documentation reference generator against silently omitted Go validation rules and repairs stale generator tests and documentation.

  • Supports arbitrary and pointer receiver forms for Validate.

  • Refuses unknown error constructors and validation helpers.

  • Requires every discovered validator to produce rules or be explicitly classified as ruleless.

  • Re-anchors end-to-end mutations and refreshes generated documentation and contributor guidance.
  • <h3>Confidence Score: 5/5</h3>

    The PR appears safe to merge because the follow-up fixes validator discovery and adds safeguards against silent reference-generation drift without introducing a new actionable failure.

    No new blocking or non-blocking findings remain. The helper-validation and pointer-receiver threads were manually resolved without explanatory replies; the current pointer-receiver implementation is covered by a matching declaration check, while the helper concern is not reposted because it belongs to its resolved existing thread.

    <h3>Important Files Changed</h3>

    | Filename | Overview |
    |----------|----------|
    | docs/6-ibc-cli/tools/refgen.py | Expands validator discovery and adds explicit refusal paths for validation constructs the scraper cannot interpret. |
    | docs/6-ibc-cli/tools/test-refgen.py | Adds coverage ensuring declared validators are discovered and either yield field rules or are explicitly ruleless. |
    | docs/6-ibc-cli/tools/test-refgen-e2e.py | Re-anchors struct-discovery mutations so the end-to-end cases modify the current source layout reliably. |
    | docs/6-ibc-cli/6-cli-commands.md | Refreshes the generated description for the configuration validation command. |
    | cli/AGENTS.md | Documents generated-reference maintenance for CLI contributors. |
    | proto/AGENTS.md | Adds generated-reference maintenance guidance for protobuf contributors. |

    <!-- greptile_other_comments_section -->

    <sub>Reviews (2): Last reviewed commit: "docs: follow delegated validators and po..." | Re-trigger Greptile</sub>

    greptile-apps[bot] greptile-apps[bot] commented on code on Sep 04, 2026 17:07 UTC
    Code Review
    docs/6-ibc-cli/tools/refgen.py:1
    @@ -734,12 +734,43 @@ def parse_go_config():
             for e in re.finditer(r'errPathIndexf\(\w+,\s*"([^"]+)"((?:,\s*[\w.]+)*)', tail):
                 msgs.append((f".[] {e.group(1)}",
                              [a.strip() for a in e.group(2).split(",") if a.strip()]))
    +        unknown = {c for c in re.findall(r'\b((?:errors|fmt)\.\w+|errPath\w*)\(', tail)
    +                   if c not in KNOWN_ERR_CTORS}
    +        if unknown:
    +            raise SourceError(
    +                f"{recv}.Validate() builds errors with {', '.join(sorted(unknown))}, "
    +                "which this scraper does not read. Validation rules drive the "
    +                "required column, enum values, and the discriminators, so an unread "
    +                "constructor silently empties all three. Teach parse_go_config() to "
    +                "read it, or add it to KNOWN_ERR_CTORS if it carries no field rule.")

    <a href="#"><img alt="P1" src="https://greptile-static-assets.s3.amazonaws.com/badges/p1.svg?v=9" align="top"></a> Helper validations remain invisible

    The new refusal only examines calls named errors., fmt., or errPath*, so validation delegated to ordinary helpers remains unread. For example, EVMChainConfig.Validate yields recognized rpc and ws rules before calling c.validateICS26Router(), whose required and address checks are outside the scraped method body. Since this validator already yields some rules, the new non-empty assertion also passes. As a result, helper-backed validation changes can still leave requiredness, constraints, and fingerprints stale without making reference generation refuse.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

    greptile-apps[bot] greptile-apps[bot] commented on code on Sep 04, 2026 17:07 UTC
    Code Review
    docs/6-ibc-cli/tools/refgen.py:1
    @@ -721,7 +721,7 @@ def parse_go_config():
                 defaults[(current, m.group(1))] = value
     
         # validation rules: every error string a struct's Validate can return
    -    for m in re.finditer(r"func \(c (\w+)\) Validate\([^)]*\) error \{", src):
    +    for m in re.finditer(r"func \((?:\w+ )?(\w+)\) Validate\([^)]*\) error \{", src):

    <a href="#"><img alt="P2" src="https://greptile-static-assets.s3.amazonaws.com/badges/p2.svg?v=9" align="top"></a> Pointer validators are skipped

    The broadened receiver regex still cannot match pointer receivers such as func (c *Config) Validate() error. Pointer receivers are already used in the config package, so a validator could realistically adopt this form. It would then disappear from validations, and the new test would not notice because it checks only the validators returned by the parser. This could again leave generated validation details incomplete while checks pass.

    evanorti evanorti commented on Sep 04, 2026 17:15 UTC
    Author

    @greptileai review again

    greptile-apps[bot] greptile-apps[bot] commented on Sep 04, 2026 17:17 UTC
    Bot

    Want your agent to iterate on Greptile's feedback? Try greploops.

    dhfang dhfang approved these changes on Sep 11, 2026 23:47 UTC
    Approved Reviewer

    I'm going to approve this for now, but I think the doc gen strategy is incredibly brittle as it relies on parsing specific keywords out of the config. They depend on implementation details like helper function names that are likely to change frequently and at any time, which creates additional burden on developers to update this doc gen script. If this becomes a burden we'll need to revisit this strategy or consider removing these doc gen scripts entirely.

    Reviewers
    Assignees
    evanorti evanorti
    Labels
    risk: low confidence: 84.4% 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: 42.8% (MEDIUM) · Higher = larger blast radius
    42.8%
    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: 84.4% · Lower = rushed or shallow review
    84.4%
    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: 6.7% · Safe to merge
    6.7%
    Repository