Fix backend defects, gate CI on lint/tests, tidy packaging + docs - #41
Merged
Conversation
Backend correctness:
- web/app.py: import hypotheses repo as hyp_repo — the legacy
/classic/sessions/{id} and .../hypotheses/{hid} routes referenced an
unimported name (F821) and 500'd with NameError. Drop unused datetime imports.
- web/react_api.py: anchor the background session task in a module-level set
with a done-callback (RUF006) so a live run can't be GC'd mid-flight.
- agents/generation.py, agents/reflection.py: raise ValueError("unsupported ...")
instead of NotImplementedError on the dead defensive branches so they read as
guards, not unfinished work.
Lint: ruff check . is now zero errors (was 23) — F401/F841/I001/UP037/B905/RUF001
across web/spa.py, webapp/*, scripts/build_bench_report.py. zip strict= chosen
per call site (False where slice pairing drops a leftover, True where row width
matches the column list).
CI: test.yml runs `ruff check .`; deploy-pages.yml installs deps + runs ruff +
pytest in the build job (which deploy needs) so a red suite blocks Pages deploy.
Packaging: pyproject version 1.0.0 (matches frontend), [project.urls],
classifiers, author Quang Bui.
Docs: git mv docs/superpowers -> docs/design (no code references).
Co-Authored-By: Claude Fable 5 <[email protected]>
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.
Release-prep pass on the backend: fix real defects, make lint gate CI, tidy packaging and docs. Minimal diffs, no logic refactors.
Code fixes
web/app.py(BLOCKER, F821 → HTTP 500): the legacy/classic/sessions/{id}and/classic/.../hypotheses/{hid}routes callhyp_repo.list_for_session(...)/hyp_repo.fetch(...)but the repo was never imported — every hit NameError'd (500).app.py:create_appis the Docker CMD /co-scientist serveentrypoint. Addedfrom ..storage.repos import hypotheses as hyp_repo; dropped the unuseddatetimeimports.web/react_api.py(RUF006): the live-spawn path didasyncio.create_task(_bg())without keeping a reference, so the event loop's weak ref let a running session be garbage-collected mid-flight. Anchored it in a module-levelset()withadd_done_callback(discard). Run logic unchanged.agents/generation.py,agents/reflection.py: the dead defensive branches now raise a neutralValueError("unsupported ...")instead ofNotImplementedError("... lands in a later milestone"), so they read as guards rather than unfinished work.Lint —
ruff check .now zero errors (was 23)F401 / F841 / I001 / UP037 / B905 / RUF001 across
web/spa.py,webapp/*,scripts/build_bench_report.py.zip(strict=)chosen per call site:Falsewhere slice-pairing ([::2]/[1::2]) intentionally drops a leftover,Truewhere the row width always matches the column list. RUF001 ambiguous−/×in bench-report strings replaced with ASCII.CI hardening
test.yml: added aruff check .step so lint gates.deploy-pages.yml: thebuildjob (whichdeployalreadyneeds) now installs deps + runsruff check .+pytestbefore building, so a red suite blocks the Pages deploy.Packaging (
pyproject.toml)version→1.0.0(matchesfrontend/package.json), added[project.urls]andclassifiers, author set to Quang Bui.Docs
git mv docs/superpowers → docs/design(no code references to update).Verification
ruff check .→ All checks passedpytest co_scientist/tests/unit -q→ 283 passedcreate_app()imports without NameError; both/classic/...routes render 200 against a seeded session + hypothesis (B1 proven end-to-end)pyproject.tomlparses with version 1.0.0🤖 Generated with Claude Code