-
Notifications
You must be signed in to change notification settings - Fork 0
T-010: Add fleet-contextual README #2
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| # Bytecode / Python | ||
| __pycache__/ | ||
| *.py[cod] | ||
| *$py.class | ||
| *.so | ||
|
|
||
| # Distribution / packaging | ||
| dist/ | ||
| build/ | ||
| *.egg-info/ | ||
| *.egg | ||
|
|
||
| # Virtual environments | ||
| venv/ | ||
| .venv/ | ||
| env/ | ||
|
|
||
| # IDE | ||
| .idea/ | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # Testing | ||
| .pytest_cache/ | ||
| .coverage | ||
| htmlcov/ | ||
|
|
||
| # OS | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Fleet health checks (keep directory, ignore contents) | ||
| for-fleet/ |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,73 @@ | ||||||
| # flux-coverage | ||||||
|
|
||||||
| FLUX coverage analyzer — instruction, branch, path, and register coverage | ||||||
| > Bytecode coverage analyzer measuring instruction, branch, path, and register coverage for FLUX programs. | ||||||
|
|
||||||
| 8 tests passing. | ||||||
| ## What This Is | ||||||
|
|
||||||
| `flux-coverage` is a Python module that **measures how much of a FLUX bytecode program was actually executed** — it tracks which instruction addresses were hit, which branches were taken/not-taken, how many unique execution paths occurred, and which registers were used. | ||||||
|
|
||||||
| ## Role in the FLUX Ecosystem | ||||||
|
|
||||||
| Coverage ensures comprehensive testing of agent programs: | ||||||
|
|
||||||
| - **`flux-timeline`** shows execution order; coverage shows breadth | ||||||
| - **`flux-profiler`** measures frequency; coverage measures completeness | ||||||
| - **`flux-debugger`** helps find bugs; coverage finds untested code | ||||||
| - **`flux-signatures`** detects patterns; coverage verifies they're all exercised | ||||||
| - **`flux-decompiler`** shows all instructions; coverage shows which ran | ||||||
|
|
||||||
| ## Key Features | ||||||
|
|
||||||
| | Feature | Description | | ||||||
| |---------|-------------| | ||||||
| | **Instruction Coverage** | Percentage of instructions that were executed | | ||||||
| | **Branch Coverage** | Both-way coverage (taken AND not-taken) for conditional branches | | ||||||
| | **Path Tracking** | Count of unique execution paths through the program | | ||||||
| | **Register Coverage** | Which registers were read/written during execution | | ||||||
| | **Markdown Reports** | Formatted coverage report table | | ||||||
| | **Multiple Run Support** | Create fresh collector per test input for differential coverage | | ||||||
| | **Factorial Validation** | Known-answer tests (e.g., 6! = 720) verify both correctness and coverage | | ||||||
|
|
||||||
| ## Quick Start | ||||||
|
|
||||||
| ```python | ||||||
| from flux_coverage import CoverageCollector | ||||||
|
|
||||||
| # Analyze coverage of a factorial program | ||||||
| bytecode = [0x18, 0, 6, 0x18, 1, 1, 0x22, 1, 1, 0, 0x09, 0, 0x3D, 0, -6, 0, 0x00] | ||||||
|
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. 🟡 README Quick Start bytecode contains The Quick Start example on line 37 uses
Suggested change
Was this helpful? React with 👍 or 👎 to provide feedback. Debug |
||||||
| collector = CoverageCollector(bytecode) | ||||||
|
|
||||||
| regs, report = collector.run() | ||||||
|
|
||||||
| print(f"Instruction coverage: {report.instruction_pct:.1f}%") | ||||||
| print(f"Branch coverage: {report.branch_pct:.1f}%") | ||||||
| print(f"Register coverage: {report.register_pct:.1f}%") | ||||||
| print(f"Unique paths: {report.unique_paths}") | ||||||
|
|
||||||
| # Generate report | ||||||
| print(report.to_markdown()) | ||||||
|
|
||||||
| # Test with different inputs for differential coverage | ||||||
| collector2 = CoverageCollector(bytecode) | ||||||
| _, report2 = collector2.run(initial_regs={0: 1}) # n=1 instead of n=6 | ||||||
|
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. 🟡 README differential coverage example is ineffective — Line 52 shows Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. Debug |
||||||
| ``` | ||||||
|
|
||||||
| ## Running Tests | ||||||
|
|
||||||
| ```bash | ||||||
| python -m pytest tests/ -v | ||||||
| # or | ||||||
| python coverage.py | ||||||
| ``` | ||||||
|
|
||||||
| ## Related Fleet Repos | ||||||
|
|
||||||
| - [`flux-timeline`](https://github.com/SuperInstance/flux-timeline) — Execution tracing | ||||||
| - [`flux-profiler`](https://github.com/SuperInstance/flux-profiler) — Performance profiling | ||||||
| - [`flux-debugger`](https://github.com/SuperInstance/flux-debugger) — Step debugger | ||||||
| - [`flux-signatures`](https://github.com/SuperInstance/flux-signatures) — Pattern detection | ||||||
| - [`flux-decompiler`](https://github.com/SuperInstance/flux-decompiler) — Bytecode decompilation | ||||||
|
|
||||||
| ## License | ||||||
|
|
||||||
| Part of the [SuperInstance](https://github.com/SuperInstance) FLUX fleet. | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| """Pytest configuration for flux-coverage.""" | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| # Ensure the repo root is on sys.path so `import coverage` works | ||
| sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 README Quick Start imports non-existent module
flux_coverageThe Quick Start example imports
from flux_coverage import CoverageCollector, but the actual module file iscoverage.py, notflux_coverage.py. There is noflux_coveragemodule, package, or installed distribution in the repository. The test suite (tests/test_coverage.py:4) correctly importsfrom coverage import CoverageCollector. Copying the README example would raiseModuleNotFoundError.Was this helpful? React with 👍 or 👎 to provide feedback.
Debug
Playground