Repository navigation
Portfolio upgrade: real pytest suite, CI, ruff, README + ROI calibration - #2
Merged
Merged
Conversation
The three files under tests/ were def main() scripts using a helper _check(label, cond); `pytest` collected zero tests from them. Port every _check into real `def test_*` functions with `assert cond, label`, preserving exact semantics (score bounds, cross-domain comparability, absolute-vs-min-max stability, volume sensitivity, ROI contract keys, idempotency, dry-run, action caps, path-traversal defense, CSV formula-injection guard). - tests/test_smoke.py: new pytest module (26 asserts); tests/smoke.py kept as a thin backward-compat wrapper that calls its main(). - tests/test_ranker.py: rewritten as pytest (24 asserts) + thin main() wrapper. - tests/test_automation.py: rewritten as pytest (14 asserts) + thin main() wrapper. Loop-based checks in the originals are unrolled into explicit asserts, so the pytest suites assert at least as many conditions as the originals (originals runtime 25/24/14; pytest 26/24/14). `py -m pytest -q` now collects 20 tests and passes; each script still runs directly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qb78i479rDNVjMqT3hrygU
Replace the three direct `python tests/<script>.py` steps with a single `python -m pytest -q` step (the ported suites cover the same paths, including the end-to-end data-generation run) and add a `ruff check .` lint step. Install the new dev tooling via requirements-dev.txt (pytest, pytest-cov, ruff). The py_compile step is kept. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qb78i479rDNVjMqT3hrygU
Add a minimal [tool.ruff] to pyproject.toml (line-length 100, E501 ignored, and a per-file E402 ignore for tests/ which must extend sys.path before importing local packages), plus a testpaths pytest setting. With the per-file ignore in place, drop the now-redundant inline `# noqa: E402` from the test modules and remove an unused `classification` import in test_ranker.py. Suppress the single pre-existing E741 (ambiguous `l`) in data_generator.py with a scoped inline noqa rather than renaming (no behavior change). `py -m ruff check .` is clean. Measured coverage (py -m pytest --cov=modules --cov=automations): 75% total. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qb78i479rDNVjMqT3hrygU
Add .coverage, htmlcov/, .pytest_cache/, and .ruff_cache/ to .gitignore so a local test/coverage run leaves the working tree clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qb78i479rDNVjMqT3hrygU
…DME top fold Additively surface, right under the hero image, a measured status line (20 pytest tests, 75% line coverage of the analytics + automation modules, green in CI on 3.12/3.13) and a "Run it in 3 commands" quickstart. Update the Run the Tests section to lead with `python -m pytest` (the source files still run directly as scripts). The operating-model tagline, synthetic-data warning, and hero image are unchanged; every ROI reference remains labeled illustrative. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qb78i479rDNVjMqT3hrygU
Add docs/calibration.md: a field-by-field checklist of the exact real-world inputs and historical baselines each ROI / mission-impact model consumes (loaded labor rates, measured handle times, ticket timestamps, volume baselines, coverage from a pilot, real build/maintenance costs) plus the shared scoring assumptions (per-candidate save rates, 0.35 coverage, curve knees) that must be measured before any figure is trusted for a budget decision. Link it from the README Disclaimer and from the two in-app ROI validation captions. All existing illustrative/synthetic and "validate against real data" language is preserved; these changes only add the calibration pointer. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qb78i479rDNVjMqT3hrygU
Adds a Screens section with the OpsPilot Command Center executive overview (cross-domain KPI tiles, two-domain selector) and the ROI & Business Case page. Captured headless at 1440x900. All figures illustrative/synthetic. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qb78i479rDNVjMqT3hrygU
…inism wording Phase-2 cold-clone gate surfaced two README-accuracy defects: - 3-command quickstart installed only requirements.txt, so `python -m pytest -q` (command 3) failed with ModuleNotFoundError; step 1 now installs both files. - "byte for byte" reproduction was imprecise on Windows (generator writes CRLF, committed CSVs are LF via .gitattributes). Reworded to the verifiable claim: content is identical (git diff shows no change / re-commit is a no-op), while `git status` may show CRLF-modified files on Windows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qb78i479rDNVjMqT3hrygU
The 75% coverage sentence implied the whole UI layer is excluded, but modules/ui_components.py is in the --cov=modules denominator at 0%. Reworded to state the UI *entrypoint* app.py is excluded and ui_components.py is counted at 0%, which keeps the figure conservative, not inflated. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Qb78i479rDNVjMqT3hrygU
…act/Limitations/Next Build)
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Portfolio upgrade — OpsPilot Command Center
Gap-closing packaging pass on
portfolio-upgrade(10 commits). Synthetic-data warnings preserved.Added / changed
pytestnow collects 20 tests (was 0); assertion parity 64 asserts ≥ 50 original_checksites (26/24/14)pytest+ruff(+requirements-dev.txt), ruff configdocs/calibration.md— the real-world inputs the ROI model would need before trusting a live numberdocs/case-study.mdVerified (fresh-clone gate):
pytest20 passed ·ruffclean · 3 backward-compat wrappers pass · app boots (HTTP 200). Coverage 75% ofmodules/+automations/. Cold red-team: strong-hire, zero P0/P1.Suggest squash-merge.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Qb78i479rDNVjMqT3hrygU