Skip to content

Refactor network README.md generation to use single template and improve robustness #877

@coderabbitai

Description

@coderabbitai

Background

Currently, network README.md files are generated from individual .gtpl template files (e.g., chains/dendrite-2/README.md.gtpl). During code review, we identified that these templates have potential robustness issues when accessing nested fields without proper guards, which can cause template rendering errors.

Proposed Changes

1. Refactor to Single Template

  • Consolidate the generation of network README.md files to rely on a single, reusable template
  • Reduce code duplication across multiple chain-specific template files
  • Improve maintainability by having a central template to update

2. Improve Template Robustness

  • Add proper guards when accessing nested fields like userInfo.keybase.picture_url and userInfo.keybase.username
  • Implement safe fallbacks when fields are missing (e.g., omit images/links or render placeholders)
  • Ensure templates don't error when datasource fields are absent or have unexpected structure

3. Specific Areas to Address

  • Genesis validators table generation with keybase identity handling
  • Website URL processing and validation
  • Safe extraction of gentx messages from genesis data

Context

This issue originated from PR #875 during the review of chains/dendrite-2/README.md.gtpl where template robustness concerns were identified.

References:

Acceptance Criteria

  • Single template file handles all network README.md generation
  • Template includes proper guards for all nested field access
  • Template gracefully handles missing or malformed datasource data
  • Existing README.md files continue to render correctly
  • Documentation updated to reflect new template structure

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

📆 To do

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions