Skip to content

ci: add comment coverage gate for reference.conf#6805

Closed
bladehan1 wants to merge 1 commit into
tronprotocol:release_v4.8.2from
bladehan1:feat/ci_reference_comment
Closed

ci: add comment coverage gate for reference.conf#6805
bladehan1 wants to merge 1 commit into
tronprotocol:release_v4.8.2from
bladehan1:feat/ci_reference_comment

Conversation

@bladehan1

Copy link
Copy Markdown
Collaborator

What does this PR do?

Adds a CI comment-coverage gate for reference.conf and documents all previously undocumented configuration keys.

  1. New script .github/scripts/check_reference_comments.py — a zero-dependency, line-oriented Python 3 script that enforces every non-genesis.block key in reference.conf carries either an inline (# / //) comment or a comment on the immediately preceding line. Array-element keys are deduplicated (only the first occurrence is checked). Fails with ::error GHA annotations listing every offending line N: key.

  2. CI step in .github/workflows/pr-check.yml — runs the new gate directly after the existing check_reference_conf.py (key-format / port-uniqueness) step, so future PRs that add undocumented keys are blocked automatically.

  3. reference.conf annotations — all previously undocumented keys now carry inline comments. The committee block includes the /wallet/getchainparameters API key name and ProposalType ID (verified against both the live mainnet API and ProposalUtil.ProposalType enum) for every governance parameter.

Why are these changes required?

reference.conf is the primary configuration reference for node operators. Before this change, the majority of keys had no explanation, forcing operators to read source code to understand parameters. There was also no CI enforcement, so new keys could be merged without documentation.

This PR has been tested by:

  • Manual Testing: python3 .github/scripts/check_reference_comments.py common/src/main/resources/reference.conf returns OK (exit 0)
  • Manual Testing: existing check_reference_conf.py (pyhocon-based key-format gate) still passes after the reference.conf changes
  • Committee block comments verified against live mainnet /wallet/getchainparameters API and ProposalUtil.ProposalType enum

Follow up

  • The two scripts share utility functions (strip_quoted, strip_comments, stack-frame tracking). A follow-up PR could extract a shared hocon_scan.py helper to avoid drift.

Extra details

  • genesis.block keys are exempt from the comment requirement (private-chain operators customise these freely).
  • Three keys — pBFTExpireNum, allowReceiptsMerkleRoot, allowNewRewardAlgorithm — have no ProposalType entry (private-chain / deprecated governance); their comments reflect this without a #N ID.
  • HOCON comments are fully transparent to both Typesafe Config and pyhocon; no runtime behaviour is affected.

Add check_reference_comments.py, a line-oriented Python script that
enforces every non-genesis.block key in reference.conf carries an
inline or immediately-preceding comment. Wire it into pr-check.yml
as a new CI step directly after the existing key-format gate.

Annotate all previously undocumented keys in reference.conf with
inline # / // comments. The committee block now includes the
/wallet/getchainparameters API key name and ProposalType ID for
each governance parameter.
@bladehan1 bladehan1 closed this Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant