-
Notifications
You must be signed in to change notification settings - Fork 14
Add AGENTS.md #114
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
akegaviar
wants to merge
1
commit into
main
Choose a base branch
from
add-agents-md
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Add AGENTS.md #114
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# AGENTS Guidelines for This Repository | ||
|
||
This repository contains Chainbench, a blockchain infrastructure benchmarking tool built on Locust. When working on the project interactively with an agent (e.g. the Codex CLI) please follow the guidelines below for efficient development and testing. | ||
|
||
## 1. Use Headless Mode for Development Testing | ||
|
||
* **Always use headless mode** with short test durations during development. | ||
* **Start with minimal load** (few users, low spawn rate) to validate changes. | ||
* **Do _not_ run long-duration tests** during agent development sessions. | ||
* **Use `--autoquit`** flag to ensure tests terminate properly. | ||
|
||
Example test command: | ||
```bash | ||
poetry run chainbench start --profile evm.light --users 5 --workers 1 --test-time 30s --target https://test-node --headless --autoquit | ||
``` | ||
|
||
## 2. Keep Dependencies in Sync | ||
|
||
If you add or update dependencies: | ||
|
||
1. Use Poetry to manage dependencies: `poetry add <package>` or `poetry add --group dev <package>`. | ||
2. Run `poetry lock --no-update` to update the lock file. | ||
3. Install updated dependencies with `poetry install`. | ||
4. Verify compatibility with Python 3.10+ as specified in the project. | ||
|
||
## 3. Coding Conventions | ||
|
||
* Follow Black formatting (120 character line length). | ||
* Use isort for import sorting (Black-compatible profile). | ||
* Follow Flake8 linting rules (E203 ignored for Black compatibility). | ||
* Use type hints where appropriate. | ||
* Keep MyPy checks passing. | ||
|
||
## 4. Code Quality Checks | ||
|
||
Before completing any task, run these quality checks: | ||
|
||
| Command | Purpose | | ||
| ------------------------ | ------------------------------------------ | | ||
| `poetry run black .` | Format code to project standards | | ||
| `poetry run isort .` | Sort imports | | ||
| `poetry run flake8` | Run linting checks | | ||
| `poetry run mypy .` | Run type checking | | ||
|
||
Or use pre-commit hooks: | ||
```bash | ||
poetry run pre-commit run --all-files | ||
``` | ||
|
||
## 5. Testing Guidelines | ||
|
||
Test changes progressively: | ||
|
||
1. **Unit testing**: Test individual user classes and methods | ||
2. **Profile validation**: Verify profiles load correctly | ||
```bash | ||
poetry run chainbench list profiles | ||
``` | ||
3. **Short headless tests**: Run brief tests with minimal load | ||
4. **Method discovery**: Test endpoint compatibility | ||
```bash | ||
poetry run chainbench discover https://test-node --clients geth | ||
``` | ||
|
||
Comment on lines
+52
to
+64
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainConfirm discover/list subcommands and client flag names. Please verify that list profiles|methods|shapes and discover (with --clients geth) are the current subcommands and option names. 🏁 Script executed: #!/bin/bash
# Verify subcommands referenced by the doc
set -euo pipefail
echo "Look for 'list' subcommands:"
rg -nP -C2 --type=py '\blist\s+(profiles|methods|shapes)\b' || true
echo -e "\nLook for 'discover' command and client flag names:"
rg -nP -C2 --type=py '\bdiscover\b' || true
rg -nP -C2 --type=py '\b(--clients|--client|--node|--engine)s?\b' || true Length of output: 1730 Verify CLI subcommands and flags
🤖 Prompt for AI Agents
|
||
## 6. Profile Development | ||
|
||
When creating or modifying profiles: | ||
|
||
* Place custom profiles in appropriate subdirectories. | ||
* Follow existing profile structure and conventions. | ||
* Include docstrings explaining profile purpose. | ||
* Test with small data sizes first (`--size XS`). | ||
* Validate against multiple node types when applicable. | ||
|
||
## 7. Working with Test Data | ||
|
||
* Start with smallest data size (`--size XS`) for development. | ||
* Use `--use-latest-blocks` for nodes with limited history. | ||
* Consider using `--ref-url` for test data generation from a reference node. | ||
* Monitor memory usage with larger data sizes. | ||
|
||
## 8. Development Workflow | ||
|
||
1. Make changes to source code | ||
2. Run formatting: `poetry run black . && poetry run isort .` | ||
3. Run linting: `poetry run flake8` | ||
4. Run type checking: `poetry run mypy .` | ||
5. Test with minimal profile first | ||
6. Gradually increase complexity and load | ||
|
||
## 9. Useful Commands Recap | ||
|
||
| Command | Purpose | | ||
| ------------------------------------------------- | ------------------------------------- | | ||
| `poetry install` | Install all dependencies | | ||
| `poetry run chainbench --help` | Show all available commands | | ||
| `poetry run chainbench list methods` | List supported RPC methods | | ||
| `poetry run chainbench list profiles` | List available profiles | | ||
| `poetry run chainbench list shapes` | List load pattern shapes | | ||
| `poetry run chainbench discover <url>` | Discover available methods | | ||
|
||
## 10. Safety Reminders | ||
|
||
* **Test against test/dev nodes first** before production nodes. | ||
* **Monitor target node health** during benchmarks. | ||
* **Use appropriate rate limits** to avoid overwhelming nodes. | ||
* **Start with light profiles** before heavy ones. | ||
* **Keep test durations short** during development. | ||
|
||
--- | ||
|
||
Following these practices ensures reliable development, prevents overwhelming blockchain nodes, and maintains code quality. Always prioritize controlled testing and gradual load increases when benchmarking infrastructure. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.