Skip to content

Conversation

@akegaviar
Copy link
Member

@akegaviar akegaviar commented Aug 21, 2025

Following the new standard https://agents.md/

Summary by CodeRabbit

  • Documentation
    • Added comprehensive agent workflow guidelines covering testing, dependency management, code style, type hints, and quality checks.
    • Includes testing recommendations, environment and credential handling, and project structure/best practices for adding metrics and unit tests.
    • No user-facing functional changes.

@akegaviar akegaviar requested a review from smypmsa August 21, 2025 01:13
@vercel
Copy link

vercel bot commented Aug 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
chainstack-rpc-dashboard-germany Canceled Canceled Aug 21, 2025 0:00am
chainstack-rpc-dashboard-japan Ready Ready Preview Comment Aug 21, 2025 0:00am
chainstack-rpc-dashboard-singapore Ready Ready Preview Comment Aug 21, 2025 0:00am
chainstack-rpc-dashboard-us-west Canceled Canceled Aug 21, 2025 0:00am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 21, 2025

Walkthrough

A new documentation file, AGENTS.md, was added providing agent-workflow guidelines for the Python Vercel Functions app that monitors RPC node response times, covering testing, dependencies, coding conventions, quality checks, testing practices, project structure, and environment variable handling.

Changes

Cohort / File(s) Summary
Documentation
AGENTS.md
Added agent-workflow guidelines: required tests to run (test_api_read.py, test_api_write.py, test_update_state.py), do not deploy during agent sessions, use .env.local for local testing; update requirements.txt and ensure Python 3.9+; follow PEP 8, require type hints, use Google-style docstrings, keep cyclomatic complexity <10 (Ruff), prefer composition for metrics; run black, ruff, mypy locally (ruff autofix); test new metrics with specified scripts and mock external calls; maintain /api, /common, /metrics, /tests structure; never commit credentials and configure production via Vercel; set VERCEL_ENV=development to add a dev prefix to metrics.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

I nibble notes and polish lines,
A rabbit's guide to cleaner signs.
Ruff and Black keep cadence neat,
Tests await my tiny feet.
No secrets shared, just hops and cheer—deploy with care, my dear. 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch add-agents-md

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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.

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: 3

🧹 Nitpick comments (8)
AGENTS.md (8)

3-3: Generalize the agent example and add a link to the Agents.md standard

"Codex CLI" is specific and may age quickly. Suggest making the example generic and linking the canonical spec for discoverability.

-This repository contains a Python-based Vercel Functions application for monitoring RPC node response times. When working on the project interactively with an agent (e.g. the Codex CLI) please follow the guidelines below to ensure smooth development and testing.
+This repository contains a Python-based Vercel Functions application for monitoring RPC node response times. When working on the project interactively with an agent (e.g., an AI coding agent or CLI), please follow the guidelines below to ensure smooth development and testing. See the AGENTS.md standard for background: https://agents.md/

7-10: Clarify test script invocation paths and tighten the wording

  • Use consistent paths for test scripts (here you later use python tests/...).
  • Style: prefer “outside the interactive workflow” over “outside of”.
  • Minor punctuation fix after “e.g.”
-* **Always use the test scripts** (`test_api_read.py`, `test_api_write.py`, `test_update_state.py`) for local testing and development.
-* **Do _not_ deploy to Vercel during the agent session** unless explicitly requested. Deployments should be handled outside of the interactive workflow to avoid disrupting production services.
+* **Always use the test scripts** (`tests/test_api_read.py`, `tests/test_api_write.py`, `tests/test_update_state.py`) for local testing and development.
+* **Do _not_ deploy to Vercel during the agent session** unless explicitly requested. Deployments should be handled outside the interactive workflow to avoid disrupting production services.
 * **Create a `.env.local` file** with the necessary environment variables before testing locally.

15-17: Pinning and runtime clarity for Python compatibility

You ask to verify Python 3.9+ compatibility. Two clarifications improve reliability:

  • Explicitly state the supported runtime(s) and where that is configured (e.g., vercel.json, runtime.txt, .python-version).
  • Prefer pinned versions in requirements.txt (already implied) and consider documenting a lock workflow if used (pip-tools/uv).
 1. Update `requirements.txt` with the new package and version.
 2. Reinstall dependencies in your virtual environment with `pip install -r requirements.txt`.
-3. Verify compatibility with Python 3.9+ as specified in the project.
+3. Verify compatibility with Python 3.9+ as specified in the project.
+4. Ensure the Vercel Python runtime matches the supported version(s) (e.g., set in `vercel.json`, `runtime.txt`, or `.python-version`) to avoid environment drift.

21-26: Clarify how cyclomatic complexity is enforced

Ruff enforces McCabe complexity via rule C901 if enabled. Calling that out reduces ambiguity and helps contributors self-check.

-* Keep cyclomatic complexity below 10 (enforced by Ruff).
+* Keep cyclomatic complexity below 10 (Ruff C901).
+  - If not already configured, enable `C901` in `ruff.toml` and set `max-complexity = 10`.

31-37: Single formatter or clear order of operations

You run Black and Ruff. If Ruff is not used as a formatter, this is fine; otherwise, choose a single formatter to avoid churn. If keeping both, specify order (format → lint → type-check) and add an optional pre-commit hook to automate.

-| `black .`             | Format code to project standards                 |
-| `ruff check .`        | Run linting checks                               |
-| `ruff check . --fix`  | Auto-fix linting issues where possible           |
-| `mypy .`              | Run type checking                                |
+| `black .`             | Format code to project standards                 |
+| `ruff check .`        | Lint (use `ruff check . --fix` to auto-fix)      |
+| `mypy .`              | Type-check                                       |
+
+Optional: install and run `pre-commit` to enforce these locally:
+`pre-commit install && pre-commit run -a`

41-43: Fix unordered list style inconsistency (markdownlint MD004)

Earlier bullets use asterisks; these use dashes. Switch to asterisks for consistency. Also remove the trailing double space at Line 42.

-  - `python tests/test_api_read.py` for read metrics
-  - `python tests/test_api_write.py` for write metrics  
-  - `python tests/test_update_state.py` for state updates
+  * `python tests/test_api_read.py` for read metrics
+  * `python tests/test_api_write.py` for write metrics
+  * `python tests/test_update_state.py` for state updates

44-46: Concretize mocking guidance for external calls

If the project uses pytest, naming common libraries helps new contributors: responses/requests-mock for requests, pytest-httpx if using httpx.

-* Mock external API calls when writing unit tests.
+* Mock external API calls when writing unit tests (e.g., `responses` or `requests-mock` for `requests`, `pytest-httpx` for `httpx`).

56-63: Environment hygiene: ensure ignore rules and provide a sample file; tighten wording

  • Confirm .env.local and .env are git-ignored; provide a .env.local.example.
  • Prefer “Set” over “Use” for environment variable instruction.
  • Make explicit that production configuration lives in Vercel project settings.
 * Development: `.env.local` (git-ignored)
-* Production: Configured in Vercel dashboard
-* Use `VERCEL_ENV=development` to add dev prefix to metrics during testing
+* Production: Configure secrets in the Vercel project settings (never commit them)
+* Add `.env.local.example` with non-secret placeholders to help contributors get started
+* Set `VERCEL_ENV=development` to add a dev prefix to metrics during testing
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e473562 and b911dc9.

📒 Files selected for processing (1)
  • AGENTS.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
AGENTS.md

[style] ~8-~8: This phrase is redundant. Consider using “outside”.
Context: ...equested. Deployments should be handled outside of the interactive workflow to avoid disru...

(OUTSIDE_OF)


[grammar] ~44-~44: There might be a mistake here.
Context: ...` is properly configured before testing. * Mock external API calls when writing uni...

(QB_NEW_EN)


[grammar] ~60-~60: There might be a mistake here.
Context: ... Development: .env.local (git-ignored) * Production: Configured in Vercel dashboa...

(QB_NEW_EN)


[grammar] ~61-~61: There might be a mistake here.
Context: ...oduction: Configured in Vercel dashboard * Use VERCEL_ENV=development to add dev ...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)
AGENTS.md

41-41: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


42-42: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


43-43: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)

🔇 Additional comments (3)
AGENTS.md (3)

1-66: Strong addition: clear agent workflow and local-testing guardrails

Good structure, actionable steps, and alignment with a standardized AGENTS.md. The local-first guidance, explicit quality gates (black/ruff/mypy), and emphasis on not deploying during agent sessions will reduce production risk. Nice work.


38-46: Minor consistency: align earlier script references with this section

Earlier you list script names; here you show python tests/.... With the earlier change, these will align. Good to keep both places consistent.


24-24: McCabe complexity checks verified

The Ruff configuration in pyproject.toml already enables McCabe (C901) enforcement:

• File: pyproject.toml

[tool.ruff.mccabe]
max-complexity = 10

No further changes are needed.

@smypmsa smypmsa merged commit 17caa5c into master Aug 21, 2025
2 of 6 checks passed
@smypmsa smypmsa deleted the add-agents-md branch August 21, 2025 11:49
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: 1

♻️ Duplicate comments (2)
AGENTS.md (2)

15-18: Document runtime pinning (Vercel + CI) in addition to “Python 3.9+”

This avoids CI/deploy drift and aligns with tooling. This repeats a prior reviewer’s request but remains applicable.

 3. Verify compatibility with Python 3.9+ as specified in the project.
+
+Pin the runtime to avoid CI/CD and Vercel mismatches:
+
+- Add a `runtime.txt` at the repo root with:
+  ```
+  python-3.9
+  ```
+- Or add a `vercel.json`:
+  ```json
+  {
+    "functions": {
+      "api/**/*.py": {
+        "runtime": "python3.9"
+      }
+    }
+  }
+  ```
+- (Optional) Enforce packaging compatibility via `python_requires` (e.g., ">=3.9") in `setup.cfg`/`setup.py`.

60-63: Tighten env-var guidance, note .gitignore, and show VERCEL_ENV example

Improves grammar, ensures secrets aren’t committed, and gives a concrete local-testing command. The .gitignore recommendation mirrors an earlier review request.

-* Development: `.env.local` (git-ignored)
-* Production: Configured in Vercel dashboard
-* Metrics are automatically prefixed using the `METRIC_PREFIX` constant from `config/defaults.py` which reads `os.getenv("VERCEL_ENV")` (e.g., "dev_" for non-production and "" for production)
+* Development: Use `.env.local` (git-ignored).
+* Production: Configure variables in the Vercel dashboard.
+* Ensure `.env` and `.env.local` are listed in `.gitignore` (to prevent accidental commits).
+* Metrics are automatically prefixed using the `METRIC_PREFIX` constant from `config/defaults.py`, which reads `os.getenv("VERCEL_ENV")` (e.g., "dev_" for non-production and "" for production).
+
+For local testing, explicitly set the environment:
+
+```bash
+export VERCEL_ENV=development
+```

Outside this file, update the repo-level ignore list:

# .gitignore (repo root)
+# Environment files
+.env
+.env.local
🧹 Nitpick comments (3)
AGENTS.md (3)

1-3: Reference the AGENTS.md standard explicitly

Add a short line near the top so contributors know this doc follows the public standard mentioned in the PR description.

 # AGENTS Guidelines for This Repository
+
+This document follows the AGENTS.md standard: https://agents.md/
 
 This repository contains a Python-based Vercel Functions application for monitoring RPC node response times. When working on the project interactively with an agent (e.g. the Codex CLI) please follow the guidelines below to ensure smooth development and testing.

8-8: Minor wording fix: “outside of” → “outside”

Tiny readability/style improvement.

-* **Do _not_ deploy to Vercel during the agent session** unless explicitly requested. Deployments should be handled outside of the interactive workflow to avoid disrupting production services.
+* **Do _not_ deploy to Vercel during the agent session** unless explicitly requested. Deployments should be handled outside the interactive workflow to avoid disrupting production services.

41-43: Fix unordered list style to satisfy markdownlint (MD004) and remove trailing spaces

Use asterisks consistently like elsewhere in the doc.

-  - `python tests/test_api_read.py` for read metrics
-  - `python tests/test_api_write.py` for write metrics  
-  - `python tests/test_update_state.py` for state updates
+  * `python tests/test_api_read.py` for read metrics
+  * `python tests/test_api_write.py` for write metrics
+  * `python tests/test_update_state.py` for state updates
📜 Review details

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

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b911dc9 and bc61396.

📒 Files selected for processing (1)
  • AGENTS.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
AGENTS.md

[style] ~8-~8: This phrase is redundant. Consider using “outside”.
Context: ...equested. Deployments should be handled outside of the interactive workflow to avoid disru...

(OUTSIDE_OF)


[grammar] ~44-~44: There might be a mistake here.
Context: ...` is properly configured before testing. * Mock external API calls when writing uni...

(QB_NEW_EN)


[grammar] ~60-~60: There might be a mistake here.
Context: ... Development: .env.local (git-ignored) * Production: Configured in Vercel dashboa...

(QB_NEW_EN)


[grammar] ~61-~61: There might be a mistake here.
Context: ...oduction: Configured in Vercel dashboard * Metrics are automatically prefixed using...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)
AGENTS.md

41-41: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


42-42: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


43-43: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)

🔇 Additional comments (1)
AGENTS.md (1)

62-63: Nice: METRIC_PREFIX behavior is documented correctly

This resolves the previous feedback about environment-based metric prefixes.

Comment on lines +44 to +45
* Ensure `endpoints.json` is properly configured before testing.
* Mock external API calls when writing unit tests.
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Clarify where endpoints.json lives and/or provide a template

If contributors don’t know the expected path or schema, tests can fail unexpectedly. Please either document the canonical path (e.g., repo root vs tests/) and a minimal schema or include a sample file.

Run this to locate references and decide where to point the docs:


🏁 Script executed:

#!/bin/bash
# Find endpoints.json references and nearby context to confirm location/schema.
rg -n -C2 -i 'endpoints\.json' || true

# Also look for any example/template files in the repo.
fd -a 'endpoints*.json' -E '**/node_modules/**' -E '**/.venv/**'

Length of output: 1633


Clarify endpoints.json location and template in AGENTS.md

Please update AGENTS.md (around line 44) to explicitly state where endpoints.json should live and how to initialize it. For example:

  • Note that tests load the file from the repository root (Path(project_root) / "endpoints.json").
  • Remind contributors to copy the provided template:
    cp endpoints.json.example endpoints.json
  • Optionally, link to the full schema in README.md under “RPC Provider Configuration.”

Suggested replacement for line 44:

- * Ensure `endpoints.json` is properly configured before testing.
+ * Ensure `endpoints.json` (located at the project root) is configured—copy from `endpoints.json.example` and update your values (see README.md for full schema).

This will prevent unexpected test failures due to a missing or mislocated configuration file.

🧰 Tools
🪛 LanguageTool

[grammar] ~44-~44: There might be a mistake here.
Context: ...` is properly configured before testing. * Mock external API calls when writing uni...

(QB_NEW_EN)

🤖 Prompt for AI Agents
In AGENTS.md around lines 44-45, clarify where endpoints.json must live and how
to create it: state tests load Path(project_root)/"endpoints.json", instruct
contributors to initialize it from the template (e.g., copy
endpoints.json.example to endpoints.json), and add a note/link to the RPC
Provider Configuration schema in README.md; update the file with these three
explicit steps so tests won’t fail due to a missing or mislocated configuration
file.

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.

3 participants