feat: add shared agent graph registry - #72
Conversation
…agent runs Several `tablassert agent` processes pointed at the same `--state-dir` can now run in parallel (over DISJOINT pmc sets) and each successful build self-registers into ONE global Graph config that `tablassert build-kg -f <state-dir>/graph.yaml` builds as a whole. - New `tablassert.graph_registry`: `register_build` upserts the best config by pmc-id basename stem (re-runs replace) and `rebuild_graph` reconstructs `tables` from `state.json` (MAPPED / BUILT_UNMEASURED records with an existing best config, sorted by pmc id, pruning stale entries). Both serialize on an exclusive `fcntl.flock` on the `graph.yaml.lock` sidecar around the read-modify-write and persist atomically (tmp file + `os.replace`, the same pattern as `save_state`). A corrupt registry (YAML error, not a mapping, or failing `Graph.model_validate`) is quarantined to `graph.yaml.corrupt-<UTC timestamp>` and rebuilt fresh, so unattended parallel runs self-heal. Fullmap is first-wins (existing value kept + warned on mismatch); entries are absolute paths so `build-kg` works from any CWD. Stdlib only — no new dependencies. - Supervisor wiring: MAPPED and BUILT_UNMEASURED builds register after the status decision; registration is wrapped so it can NEVER flip a successful status (log + note, keep the status). SKIPPED never registers; a re-run that skips an already-MAPPED pmc keeps its entry (resume skips terminal records). `best_config_path` is now persisted absolute so cross-CWD rebuilds never silently prune. - New `tablassert rebuild-agent-graph` command (`--state-dir`/`-sd` default `.tablassert/agent`, required `--fullmap`/`-f`) that rebuilds the registry from the checkpoint and prints the path + entry count; it also tolerates a corrupt `state.json`. - Docs: parallel-agents section + workspace rows in docs/agent.md, command reference in docs/cli.md, and the docs-coverage guardrail mapping updated. - Tests: registry semantics, quarantine, fullmap first-wins, a true 10-process concurrency test, cross-CWD rebuild, supervisor wiring (register / not-register / failure-keeps-status), and CLI parsing + forwarding.
|
Warning Review limit reached
Next review available in: 33 seconds You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Adds a concurrency-safe shared
<state-dir>/graph.yamlregistry so paralleltablassert agentruns can upsert successful PMC configs and then build one aggregate graph withtablassert build-kg -f <state-dir>/graph.yaml.Shared Registry
src/tablassert/graph_registry.pywithregister_buildandrebuild_graph.graph.yaml.lockflock, writes via tmp file +os.replace, and uses absolute table config paths sobuild-kgworks from any CWD.graph.yaml.corrupt-<UTC timestamp>and rebuilds fresh instead of wedging unattended runs.fullmapvalue and logs a warning on mismatches.Agent + CLI
run_supervisornow registersMAPPEDandBUILT_UNMEASUREDbuilds, neverSKIPPED; registry failures are logged/noted without flipping a successful status.tablassert rebuild-agent-graph --state-dir ... --fullmap ...to reconstruct/prune the registry fromstate.json.Docs + Tests
docs/agent.mdanddocs/cli.md.Design
graph.yamlupdates are cross-process safe, butstate.jsonremains per-process read-modify state; users should fan out disjoint PMC sets when sharing--state-dir.Testing
uv run ruff check .→ passeduv run ruff format --check .→69 files already formatteduv run pyright→0 errors, 0 warnings, 0 informationsuv run pytest→801 passed, 2026 warningsuv run pytest tests/test_docs_cli_coverage.py -q→6 passed