Skip to content

Portfolio upgrade: real pytest suite, CI, ruff, README + ROI calibration - #2

Merged
CJud25 merged 10 commits into
mainfrom
portfolio-upgrade
Jul 6, 2026
Merged

CJud25 merged 10 commits into
mainfrom
portfolio-upgrade

Conversation

@CJud25

@CJud25 CJud25 commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Portfolio upgrade — OpsPilot Command Center

Gap-closing packaging pass on portfolio-upgrade (10 commits). Synthetic-data warnings preserved.

Added / changed

  • Converted the check scripts to a real pytest suite — pytest now collects 20 tests (was 0); assertion parity 64 asserts ≥ 50 original _check sites (26/24/14)
  • CI → pytest + ruff (+ requirements-dev.txt), ruff config
  • README status line + fixed literal 3-command quickstart + corrected data-generation determinism wording (Windows CRLF vs committed LF)
  • docs/calibration.md — the real-world inputs the ROI model would need before trusting a live number
  • Captured live-app screenshots + docs/case-study.md

Verified (fresh-clone gate): pytest 20 passed · ruff clean · 3 backward-compat wrappers pass · app boots (HTTP 200). Coverage 75% of modules/+automations/. Cold red-team: strong-hire, zero P0/P1.

Suggest squash-merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Qb78i479rDNVjMqT3hrygU

CJud25 and others added 10 commits July 5, 2026 18:39
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
@CJud25
CJud25 merged commit b6a7aa1 into main Jul 6, 2026
2 checks passed
@CJud25
CJud25 deleted the portfolio-upgrade branch July 6, 2026 02:07
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.

1 participant