Repository navigation
Green tests on a fresh clone, ruff config, CI, and audit fixes - #1
Merged
Merged
Conversation
Adds [tool.ruff] to pyproject (pyflakes, pycodestyle errors, bugbear, isort, pyupgrade; line length not enforced) and ruff to the dev extra. Everything in this commit is ruff --fix output plus two one-line manual fixes: a percent-format in train.py and a semicolon in a test. No behaviour changes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Before this, 16 tests failed and one errored on any clone that had not run the ~1 GB MaleCNS bootstrap, contradicting the README's claim that circuit tests skip themselves. Loaders hard-coded data/malecns-v1.0 relative to the package in four places with no way to redirect them. - notflyguy/paths.py: one data_root() resolver, honouring a new NOTFLYGUY_DATA_ROOT variable read at call time. connectome, motor_training, circuit, habitat, wiring_control, train and the DR bridge all go through it; their missing-data errors now name the override. - notflyguy/synthetic.py: writes a random circuit, catalog and summary in the measured file layout, flagged synthetic:true. The test session (tests/conftest.py) writes one and points NOTFLYGUY_DATA_ROOT at it when the measured circuit is absent, so the 29 formerly skipped or failing circuit tests now run everywhere. Also usable to start the dashboard without the download. - .github/workflows/ci.yml: ruff + pytest on 3.10/3.11/3.12 and a dashboard smoke boot against a synthetic circuit. - dr_adapter/dashboard.py: same-origin check on POST, matching the main server; /api/approve sends real game commands and had no CSRF defence. - habitat: validate the aliases payload (a bare string was iterated per character, marking nearly every message as addressed). - chatlog: NOTFLYGUY_ID_SALT was documented in a comment but never read. - test_server: the 503-without-habitat test now exercises the server. - python -m notflyguy starts the server. - README: install table, data root, synthetic stand-in, tests/lint/CI, environment variable reference. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Summary
On a fresh clone the suite was red: 16 failed, 1 error, 14 skipped out of 215, every one of them a missing
data/malecns-v1.0/*file, even though the README said circuit tests skip themselves. This PR makes the suite green without the ~1 GB MaleCNS download, adds lint configuration and GitHub Actions CI, and fixes a handful of real bugs found during the audit.What changed
NOTFLYGUY_DATA_ROOT(notflyguy/paths.py): a singledata_root()resolver, read at call time, replaces four hard-codeddata/malecns-v1.0paths (connectome,motor_training,circuit,habitat,wiring_control,train, DRfly_bridge). Missing-data errors now name the override.notflyguy/synthetic.py): writes a random graph, leg catalog and summary in exactly the measured file layout, flagged"synthetic": true. The test session writes one and pointsNOTFLYGUY_DATA_ROOTat it when the measured circuit is absent (tests/conftest.py), so the 29 formerly failing/skipped circuit tests run everywhere; if the real circuit is present it is used instead.python -m notflyguy.synthetic --root DIRalso lets you boot the dashboard without the download..github/workflows/ci.yml):ruff checkpluspyteston Python 3.10/3.11/3.12, then a smoke boot ofpython -m notflyguy.server --no-body --no-repliesagainst a synthetic circuit with a check on/api/state.pyproject.toml(F, E4/E7/E9, W, B, I, UP; line length not enforced; DR adapter keeps its one-statement-per-line style) andruffin thedevextra. First commit is purelyruff --fixoutput (import ordering, unused imports,collections.abcimports) plus two one-line manual fixes.dr_adapter/dashboard.pyhad no same-origin check onPOST;/api/approvesends a real game command. Added the sameOrigin/Hostcheck the main server already has, with tests.Habitat._ingest_group_messageiterated a bare-stringaliasespayload character by character, so"aliases": "notflyguy"marked almost every message as addressed. Now validated; regression test.NOTFLYGUY_ID_SALTwas documented in a comment but never read. Now honoured; test.tests/test_server.py::test_handler_returns_503_without_a_habitatasserted nothing about the server; it now exercises every endpoint.python -m notflyguystarts the server.How verified
Also ran the CI smoke step locally:
python -m notflyguy.synthetic --root …thenNOTFLYGUY_DATA_ROOT=… python -m notflyguy --no-body --no-replies --port 8766;/api/statereportscircuit_loaded: trueand/serves the dashboard. Python 3.12.15 (uv-managed; the system Python here is 3.14, outsiderequires-python).Risks / follow-ups
ConnectomeState(root=None)andmake_readout(root=None)now mean "resolve the default"; previously the default was aPathconstant.DEFAULT_ROOT/DEFAULT_CATALOG_ROOT/DEFAULT_CIRCUIT_ROOTare kept as names for existing callers.motor-circuit.jsoncan checksynthetic.NOTFLYGUY_ID_SALTis read once at import (so trainer, habitat and plugin agree); set it before starting the process.🤖 Generated with Claude Code