Config loading, doctor diagnostics, JSON output, comprehensive tests + docs - #4
Open
cognis-digital wants to merge 2 commits into
Open
Config loading, doctor diagnostics, JSON output, comprehensive tests + docs#4cognis-digital wants to merge 2 commits into
cognis-digital wants to merge 2 commits into
Conversation
… docs Tests & CI: - Add 97 new tests across models, config, download, serve, harness, memory, connect mapping, doctor, livesearch, and the CLI (102 total, all green). - CI now runs error-level lint (ruff pyflakes/syntax) and a test matrix over Python 3.10-3.13 plus macOS/Windows; PYTHONUTF8 set for the test job. Features: - fleet.config: load slot overrides from fleet.yaml (PyYAML when present, else a dependency-free parser), making the documented override real; every subcommand now threads overrides through resolve/pull/up/status/run/agent. - fleet doctor: read-only environment diagnostics (python, llama-server, disk, slot/port state) with a --json report and exit code. - fleet models --json and fleet status --json for pipelines. Docs: - README overhaul: Diagnose, Configuration (env var table), JSON output, FAQ, refreshed help/doctor example blocks. - New docs/ARCHITECTURE.md, docs/USAGE.md, and ROADMAP.md. Refactor & hygiene: - Docstrings/typing on resolve(); remove dead import/var in download.py/serve.py. - Add .gitignore and untrack committed __pycache__ bytecode. Backward-compatible: additive only; no existing command, entry point, or default behavior changed.
| monkeypatch.setattr(livesearch, "_get", lambda url: RSS_SAMPLE.encode()) | ||
| rc = livesearch._cli(["--feed", "http://x"]) | ||
| assert rc == 0 | ||
| assert "example.com" in capsys.readouterr().out |
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.
Motivation
uncensored-fleetshipped a clean CLI and harness, but three gaps limited real-world use:fleet.yaml, yet the loader for that file did notexist —
resolve()only ever returned the built-in defaults, so the documented config was inert.llama-server, a full disk, or the wrong Python.loop, the feed ingester) was unverified, and CI ran a single Python on one OS with no lint.
This PR closes all three, adds machine-readable output, and brings the docs up to the actual code —
additively, with no change to any existing command, entry point, or default behavior.
What changed
Tests & CI
test_models.py— registry invariants, unique ports, deep-copy isolation, override merge, conflict symmetry.test_config.py— scalar coercion, the minimal YAML parser,fleet.yaml→resolve()wiring,$FLEET_CONFIG.test_download.py—model_path, the 3-tier fallback chain (lib → cli → direct), skip-existing, mmproj fetch, direct-URL shape, all-fail error path.test_serve.py— state round-trip, status rows, teardown (single/all/dead-PID), launch guards (missing binary, missing model), PID recording, VRAM-conflict eviction.test_harness.py— tool exec (read/write/bash/unknown/error/truncation), the OpenAI wire shape + port override, and the agent loop (FINAL / TOOL-then-FINAL / plain / max-steps / recall).test_memory.py— sqlite fallback remember/recall, ordering, limits, engram-absent path.test_connect_map.py—map_recorddefaults/passthrough/stripping (no optional deps needed).test_doctor.py— each check plus the aggregate report and renderer.test_livesearch.py— URL building, RFC-822/ISO-8601 date parsing, RSS/Atom parsing, DDG redirect extraction,harvestde-dupe/recency, CLI modes.test_cli.py— dispatch for every subcommand,--json, override threading, exit codes..github/workflows/ci.yml): alintjob (ruff, error-levelE9,F— pyflakes + syntax, no style churn) gates atestmatrix across Python 3.10/3.11/3.12/3.13 on Ubuntu plus a macOS and a Windows runner;PYTHONUTF8=1for the test job.pyproject.toml:ruff>=0.5added to thedevextra;[tool.ruff],[tool.ruff.lint](selectE9,F), and[tool.pytest.ini_options]configured.Features
fleet/config.py— realfleet.yamloverrides.load_overrides()reads the documentedslots:mapping and returns a dict suitable forresolve(). Uses PyYAML when installed, else asmall dependency-free parser for the documented subset (with int/float/bool/null coercion).
Honors
$FLEET_CONFIG. With no file present it returns{}, so the configured path is identicalto the previous default path. The CLI now threads overrides through
resolve,pull,up,status,run, andagent(the underlying functions already accepted anoverridesargument —they just were never fed one).
fleet/doctor.py—fleet doctor. Read-only, side-effect-free diagnostics: Python version(hard check),
llama-serveron PATH, free disk on the models volume, and which slots aredownloaded / serving (soft advisories).
fleet doctor --jsonemits a structured report and thecommand exits non-zero only on a hard failure.
fleet models --jsonandfleet status --jsonforjq/dashboards.Docs
output, and FAQ sections; refreshed embedded
--helpand added adoctorexample block;Contents nav + deep-doc links updated.
docs/ARCHITECTURE.md(component map, data flows, design principles),docs/USAGE.md(task-oriented CLI + Python API tour),ROADMAP.md(near/mid/long-term).examples/help.txtregenerated to includedoctor.Refactor & hygiene
models.resolve()(no behavior change).sysimport (download.py) and an unusedstlocal (serve.py)..gitignoreand untracked the committed__pycache__bytecode (build artifacts only —no source or functionality removed).
Test results
Run locally:
pip install -e ".[dev]" PYTHONUTF8=1 python -m pytest -q ruff check --select E9,F fleet livesearch.py testsNew usage examples
Backward compatibility
Additive only. No existing subcommand, flag, entry point (
fleet,uncensored-fleet-emit), ordefault behavior was removed or changed.
resolve()with no arguments still returns the built-indefaults; a repo without a
fleet.yamlbehaves exactly as before. New flags (--json) and the newdoctorcommand are strictly additive.Checklist
pip install -e .verified.