Skip to content

examples: add parallel research planner registry - #115

Merged
Shashankss1205 merged 2 commits into
CodeGraphContext:mainfrom
only-ouc:only-ouc/examples/plan-research
Sep 26, 2026
Merged

Shashankss1205 merged 2 commits into
CodeGraphContext:mainfrom
only-ouc:only-ouc/examples/plan-research

Conversation

@only-ouc

Copy link
Copy Markdown
Contributor

Summary

  • add a deterministic plan_research registry demonstrating fan-out, join, fork, and fan-in
  • enforce one distinct state-field write permission per investigative kind and deny page_oncall
  • document the registry in the README and governance cookbook
  • test the scripted CLI path, policy refusal, write boundaries, and topology trace

Testing

  • uv run pytest tests/test_plan_research.py -q
  • uv run pytest tests/test_readme.py tests/test_cookbook_governance.py -q
  • uv run pytest tests/test_cli.py -q -k plan
  • uv run pytest tests/test_planner_loop.py -q
  • uv run ruff check .

The full suite was also attempted on Windows; existing platform-dependent tests requiring symlink privileges, POSIX process semantics, or the Claude CLI fail in this environment.

Fixes #51

@Shashankss1205

Copy link
Copy Markdown
Collaborator

Apologies for the long silence on this — the delay is on us, not on your branch.

I re-ran CI and dug into what was actually failing. Your code is fine. The only failure is one assertion, on all three Python versions:

tests/test_deep_dive.py::test_the_quoted_selection_is_what_pytest_selects
AssertionError: update the **Verified this pass** paragraph in deep-dive.md:
it says 2,151 selected, this tree has 2,155

Your four new tests move the suite from 2,151 to 2,155, and docs/deep-dive.md quotes that figure as a verified number, so tests/test_deep_dive.py deliberately fails rather than letting the line go stale. It is guarding the docs, not judging your change.

The fix

One number, on line 257 of docs/deep-dive.md:

-**Verified this pass:** `pytest` → green, 2,151 selected and 13 deselected (the live ones);
+**Verified this pass:** `pytest` → green, 2,155 selected and 13 deselected (the live ones);

The deselected count stays at 13 — you added no live tests.

That should take the run green. Sorry you had to wait on a stale figure in a paragraph; that this can happen to a contributor is a problem with the guard's ergonomics rather than with anything you did, and I'm looking at making the figure re-derive itself instead of failing a newcomer's first PR.

Thanks for the contribution — a fan-out example is exactly what #51 asked for.

@Shashankss1205

Copy link
Copy Markdown
Collaborator

Following up on the ergonomics half of this, since it was our problem and not yours: #119 makes that figure refreshable with one command instead of a hand edit.

GRAPHARC_UPDATE_FIGURES=1 uv run pytest tests/test_deep_dive.py

Once it lands, a branch that adds tests — like this one — runs that and commits the result, and CONTRIBUTING.md says so where you'd actually look. The check itself stays strict in CI; what changes is that the failure now tells you what to run.

Your branch doesn't need to wait for it. The single-number edit in my earlier comment still takes this green today, and I'd rather review your example than have you rebase onto process changes.

Shashankss1205 added a commit that referenced this pull request Sep 25, 2026
The guard is right and stays strict: a number on the **Verified this pass**
line is re-derived by a test, or it does not belong on the line. What was
wrong was who paid for it. Every branch that adds or removes a test moves
the count, so this file failed that branch until someone hand-edited a
figure in a docs file they had no reason to know existed.

PR #115 is what that costs. An outside contributor's first change -- four
tests, the fan-out example #51 asked for -- sat red for a month on
`assert 2151 == 2155`, and nothing in the failure named a fix they could
run. The check did its job; the ergonomics did not.

`GRAPHARC_UPDATE_FIGURES=1 pytest tests/test_deep_dive.py` now rewrites the
line and skips the check that wrote it, so the next run is the one that
verifies. The failure message names that command, and CONTRIBUTING.md has a
section for the case, because a contributor reads the failure and the
contributing guide, not this file's docstring.

Strictness is unchanged where it counts. `_updating()` is false for unset,
empty, "0", "false" and "no", so a leftover `=0` in a shell profile cannot
disarm the guard, and CI sets nothing -- a stale figure still fails there.
That property has its own test, because a self-healing check in CI would
assert nothing at all.

The rewrite is a pure function over the line, tested without touching the
real document: only the capture group's span changes, so the comma grouping
and every surrounding word stay byte-identical. The version the paragraph
says is on PyPI is deliberately not rewritten -- whether a release is
published is not something this tree can re-derive, and a note claiming it
should be written by whoever released it.

Verified: 2156 selected, 13 deselected, ruff clean. Dogfooded -- the figure
in this commit was written by the mechanism it adds.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Shashankss1205
Shashankss1205 merged commit 9843132 into CodeGraphContext:main Sep 26, 2026
4 of 7 checks passed
Shashankss1205 added a commit that referenced this pull request Sep 26, 2026
2,214: the four tests the parallel research registry brought with it.

Pushed straight to main rather than through a pull request because #115's own
branch could not carry it. The figure has to equal the count *after* the merge,
and their branch was one commit of docs away from being green -- but writing to
a fork's branch needs a git push, and fetching that branch here is not
something this environment permits. So the choice was a briefly-red main or a
contributor waiting a second month on a number in a docs file. Their four tests
and the registry were green on every Python version; this line was the only
failure.

Written by GRAPHARC_UPDATE_FIGURES, which is what #119 added for exactly this.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Shashankss1205

Copy link
Copy Markdown
Collaborator

Merged — thank you, and sorry it took a month to get there.

To be straight about what happened, because none of it was your branch's fault:

  1. The run sitting here since August was waiting for maintainer approval. Fork pull requests need a click before their workflows run, and nobody clicked. I got that wrong earlier in this thread too — I said approval was not the blocker, having re-run the old run, which skips the gate. A new run needs it. That is the actual reason this sat.
  2. Once approved, the only failure on all three Python versions was tests/test_deep_dive.py — the selected-test figure, which your four tests move. Your registry and tests were green everywhere.

I brought your branch up to date with main and merged it. The figure had to equal the count after the merge, and I could not push that one line to your branch from here, so it went to main directly right behind your commit — main's head is green.

Since then the figure is refreshable with one command instead of a hand edit, which is #119, filed because this happened to you:

GRAPHARC_UPDATE_FIGURES=1 uv run pytest tests/test_deep_dive.py

CONTRIBUTING.md documents it now, under "If you added or removed a test".

Your registry does exactly what #51 asked for, verified on the merged code: 4-way fan-out from START, a 4-way join at correlate, a fork into test_hypothesis and estimate_impact, and a fan-in at write_report — 8 nodes, 13 edges, admitted. #51 is closed by this.

Shashankss1205 added a commit that referenced this pull request Sep 26, 2026
…#129)

Closes #103. #116 already covered most of what that issue asked for -- a weekly
resolve that ignores `uv.lock`, reporting to the issue tracker, not gating pull
requests. What it did not cover is the criterion's other half: importing every
subpackage from the *built wheel*.

The distinction is the one #101 was: `mcp>=1.2` resolved to 2.0.0 for anyone
installing fresh, `mcp.server.fastmcp` had gone, and `grapharc[mcp]` was broken
on arrival while every locked job stayed green. A suite run from the source tree
does not see a packaging break that only shows in an installed wheel -- a
subpackage dropped from the build, or an extra whose new major moves a module
the package imports at import time.

The walk moves out of `ci.yml`'s heredoc into `scripts/wheel_import_walk.py`,
because two jobs now need exactly this check and two copies would drift apart.
Same logic, two parameters: which checkout to compare against, and the prefix
the import must come from. `scripts/` holds no `grapharc` package, so running it
by path does not put the checkout on `sys.path` -- the property the old `cd /tmp`
was there for, kept and now asserted with a message rather than a bare
`assert`.

Verified by running it for real rather than reasoning about it, and it earned
its keep immediately: against the wheel then sitting in `dist/` it reported
`grapharc.examples.plan_research` missing -- correctly, because that wheel was
built before #115 merged. Rebuilt, it walks 132 modules clean.

Deliberately **not** done: putting a ceiling on the eight unbounded extras. The
issue asks for a decision on that and argues a bound should be "a ceiling with a
reason attached, not a reflex" -- so adding eight of them at once is the reflex
it warns against, and it would refuse users upgrades that are fine. Detection is
what this closes; the policy is left open.

Verified: 2214 selected, 13 deselected, ruff clean; the sdist's required-files
and secret-leak checks still pass with `scripts/` added.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Shashankss1205 added a commit that referenced this pull request Sep 26, 2026
#115 and #129 merged after the release commit. 0.1.8 is still unpublished and
untagged, so folding them into its notes is right for the same reason #124 and
#128 did it.

The research registry gets a full entry: it is a shipped module and it closes
the gap that the planner's headline capability -- decomposition -- was the one
with no runnable example, while the only registry in the box demonstrated
refusal. Credited to @only-ouc, whose pull request it is.

The drift job's wheel walk goes in the tooling paragraph beside the styling
gate: it changes nothing shipped, it changes what a break in shipped behaviour
would be caught by.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

examples: ship a decomposition registry — plan_incident shows refusal, nothing shows fan-out

2 participants