Skip to content

Conversation

@dohernandez
Copy link
Member

@dohernandez dohernandez commented Aug 1, 2025

Description

This PR updates the configuration sanitization logic in the documentation sync workflow to preserve the admin section while only removing the dev section from the GenLayer node configuration files. Previously, both admin and dev sections were being removed during the documentation sync process.

The change includes:

  • Modified sanitize-config.py to only target and remove dev: sections
  • Added comprehensive test suite test_sanitize_config.py to verify the sanitization behavior
  • Updated workflow comments and debug messages to reflect the new behavior

Summary by CodeRabbit

  • New Features

    • Introduced a pull request template to guide contributors on formatting titles and descriptions according to Conventional Commits.
    • Added a standalone test script to verify configuration file sanitization.
  • Documentation

    • Updated script documentation and comments to reflect changes in configuration sanitization.
  • Chores

    • Modified workflow to only remove and check for the dev section in configuration files, leaving the admin section unaffected.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 1, 2025

Walkthrough

This change updates the configuration sanitization logic across scripts and workflows to only remove the node.dev section, no longer affecting the node.admin section. It introduces a new test for the sanitization script, adjusts workflow checks accordingly, and adds a pull request template guiding contributors on commit message conventions.

Changes

Cohort / File(s) Change Summary
Sanitization Script Update
.github/scripts/sanitize-config.py
Updated logic and comments to only remove the node.dev section from configuration files, no longer removing node.admin.
Sanitization Script Test
.github/scripts/test_sanitize_config.py
Introduced a new standalone test script to verify that only the node.dev section is removed by the sanitization script, leaving other sections intact.
Workflow Adjustment
.github/workflows/sync-docs-from-node.yml
Modified workflow steps so that only the node.dev section is removed and checked for, updating error and reporting logic to ignore the node.admin section.
Pull Request Template Addition
.github/pull_request_template.md
Added a new pull request template instructing contributors to use Conventional Commits for PR titles and providing structured guidance for PR descriptions.

Sequence Diagram(s)

sequenceDiagram
    participant Workflow
    participant Script
    participant ConfigFile

    Workflow->>Script: Run sanitize-config.py on config.yaml
    Script->>ConfigFile: Read config.yaml
    Script->>ConfigFile: Remove node.dev section
    Script->>ConfigFile: Write sanitized config.yaml
    Workflow->>ConfigFile: Check for presence of node.dev (error if found)
    Workflow->>ConfigFile: Optionally report presence of node.admin (no error)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

A bunny with nimble paws and nose,
Hopped through configs, where dev once grows.
Now only dev is swept away,
While admin is allowed to stay.
With tests and templates, neat and tight—
This rabbit’s work is pure delight! 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/automate-config

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@netlify
Copy link

netlify bot commented Aug 1, 2025

Deploy Preview for genlayer-docs ready!

Name Link
🔨 Latest commit c509e4e
🔍 Latest deploy log https://app.netlify.com/projects/genlayer-docs/deploys/688c88939506040008ee3a23
😎 Deploy Preview https://deploy-preview-270--genlayer-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

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

5-5: Remove unused import.

The sys import is not used in this test script.

-import sys
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6320e5f and c509e4e.

📒 Files selected for processing (4)
  • .github/pull_request_template.md (1 hunks)
  • .github/scripts/sanitize-config.py (3 hunks)
  • .github/scripts/test_sanitize_config.py (1 hunks)
  • .github/workflows/sync-docs-from-node.yml (4 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: dohernandez
PR: genlayerlabs/genlayer-docs#257
File: .github/workflows/sync-docs-from-node.yml:0-0
Timestamp: 2025-07-26T13:26:45.588Z
Learning: In the sync-docs-from-node.yml workflow, the user prefers selective git staging with `git add content/validators pages/api-references pages/validators` rather than `git add -A` to avoid staging unintended changes, as these are the expected directories to be modified during the documentation sync process.
📚 Learning: applies to pages/validators/setup-guide.mdx : setup guide updates (pages/validators/setup-guide.mdx)...
Learnt from: CR
PR: genlayerlabs/genlayer-docs#0
File: CLAUDE.md:0-0
Timestamp: 2025-07-24T07:56:58.272Z
Learning: Applies to pages/validators/setup-guide.mdx : Setup Guide Updates (pages/validators/setup-guide.mdx): Update version references in download examples and version lists, update configuration examples with new contract addresses when applicable, enhance command documentation when new features are added to existing commands, update genesis block configuration in consensus section when network upgrades occur

Applied to files:

  • .github/scripts/sanitize-config.py
📚 Learning: in the sync-docs-from-node.yml workflow, the user prefers selective git staging with `git add conten...
Learnt from: dohernandez
PR: genlayerlabs/genlayer-docs#257
File: .github/workflows/sync-docs-from-node.yml:0-0
Timestamp: 2025-07-26T13:26:45.588Z
Learning: In the sync-docs-from-node.yml workflow, the user prefers selective git staging with `git add content/validators pages/api-references pages/validators` rather than `git add -A` to avoid staging unintended changes, as these are the expected directories to be modified during the documentation sync process.

Applied to files:

  • .github/workflows/sync-docs-from-node.yml
🪛 Ruff (0.12.2)
.github/scripts/test_sanitize_config.py

5-5: sys imported but unused

Remove unused import: sys

(F401)

🔇 Additional comments (10)
.github/pull_request_template.md (1)

1-27: LGTM! Excellent addition for standardizing contributions.

This PR template follows conventional commit standards and provides clear guidance for contributors. The examples and type definitions are comprehensive and will help maintain consistent PR titles across the repository.

.github/scripts/sanitize-config.py (3)

3-6: LGTM! Documentation correctly updated.

The docstring and comments accurately reflect the new behavior of removing only dev sections while preserving admin sections.


37-37: LGTM! Function documentation updated correctly.

The function docstring now accurately describes that only node.dev sections are removed.


52-90: LGTM! Logic correctly updated to target only dev sections.

The sanitization logic has been properly updated to:

  • Only search for dev: lines (Line 59)
  • Maintain the same validation logic to ensure it's under a node: section
  • Preserve all other sections including admin:

The implementation is consistent with the PR objectives.

.github/workflows/sync-docs-from-node.yml (4)

309-309: LGTM! Comment updated to reflect new sanitization scope.

The comment correctly describes that only node.dev sections are removed, aligning with the updated sanitization behavior.


346-346: LGTM! Verification check updated correctly.

The grep check now only looks for dev: sections, consistent with the new sanitization logic that preserves admin: sections.


432-432: LGTM! Admin section now reported without error.

The check for admin sections now reports their presence informatively rather than treating them as an error, which aligns with the updated behavior of preserving admin sections.


728-728: LGTM! Final verification updated correctly.

The final verification step now only checks for dev: sections as an error condition, properly reflecting the updated sanitization logic.

.github/scripts/test_sanitize_config.py (2)

8-14: LGTM! Dynamic import approach works well for testing.

The dynamic import using importlib.util is a clean approach for importing the sanitize_config function from the script file for testing.


16-95: Excellent comprehensive test coverage!

This test thoroughly validates the new sanitization behavior by:

  • Creating a realistic config with both admin and dev sections under node:
  • Verifying that only dev sections are removed while admin sections are preserved
  • Checking that other sections (rpc, ops, genvm) remain intact
  • Including proper cleanup with temporary file handling

The test cases cover all the key requirements from the PR objectives and provide confidence that the sanitization logic works correctly.

@dohernandez dohernandez merged commit 6e0fc05 into main Aug 2, 2025
6 of 7 checks passed
@dohernandez dohernandez deleted the fix/automate-config branch August 2, 2025 09:18
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.

2 participants