Skip to content

fix(#89): recalc review fixes (#128) — notify reload, SSE shape, manifest-less root guard - #129

Merged
paddymul merged 2 commits into
mainfrom
fix/89-recalc-review-fixes
Jun 22, 2026
Merged

fix(#89): recalc review fixes (#128) — notify reload, SSE shape, manifest-less root guard#129
paddymul merged 2 commits into
mainfrom
fix/89-recalc-review-fixes

Conversation

@paddymul

Copy link
Copy Markdown
Contributor

The three review findings on PR #128 that missed its merge. #128 (reactive recalc,
stage 2/3) merged at c212a92; these follow-up fixes were committed only on the
local branch afterward, so they never reached main. This PR brings them on as a
focused, TDD-ordered pair — failing tests first, then the fix.

What lands

  • MCP-driven recalc now reaches the companion. /internal/notify handles
    kind="recalc": it invalidates the result/compare LRUs and reloads buckaroo
    sessions — the same cleanup /api/recalc and /api/reset already do — so a recalc
    driven from the MCP process doesn't leave the separate companion process serving
    stale state (caching: reset-to-revision doesn't invalidate the in-process cached_result_expr LRU — a warmed expensive entry then reads a pruned snapshot path and fails #80's cross-process gap).
  • One canonical recalc SSE shape. A shared _recalc_sse_event(remap, step)
    normalizer, used by both the in-process /api/recalc route and the cross-process
    /internal/notify republish, so the event a frontend sees can't depend on which
    surface emitted it. (The notify path previously republished the raw payload,
    burying remap under extra and dropping step.) The MCP _notify("recalc", …)
    now forwards the checkpoint step too.
  • Manifest-less root guard in recalc(). Drop roots whose entry dir has no
    manifest.json (a crashed mid-build leftover, or a caller typo) by gating on the
    manifest rather than the directory — the walk indexes manifest-keyed verdicts, so a
    dir-without-manifest root would KeyError the walk.

TDD

First commit (69a4bb4) is the three findings as failing tests; the fix commit
follows. The five tests fail on main's code and pass after the fix; pushed
test-first so the failure is visible on CI before the fix lands.

🤖 Generated with Claude Code

paddymul and others added 2 commits June 22, 2026 16:47
…ad, SSE shape, root guard

Three review findings on PR #128, failing-first:

- notify handler ignores kind="recalc": an MCP-driven recalc never reloads
  buckaroo sessions or invalidates the companion LRUs, unlike /api/recalc.
- recalc SSE event shape drifts: /api/recalc emits {kind,remap,step}; the
  cross-process notify path emits payload.model_dump() (remap under extra, no
  step). Pins a shared _recalc_sse_event normalizer + the MCP _notify forwarding
  the checkpoint step.
- recalc()'s root guard checks the entry DIRECTORY, but the walk indexes
  verdicts (manifest-keyed); a dir-without-manifest root KeyErrors the walk.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lc SSE shape, guard manifest-less roots (#128)

Three review findings on PR #128:

1. /internal/notify now handles kind="recalc" like project_reset — invalidate
   the result/compare LRUs and reload buckaroo sessions. An MCP-driven recalc
   (the primary path) arrives via _notify, so without this the companion kept
   serving stale viewer state that only the in-process /api/recalc route cleaned
   up (#80's communication-gap class).

2. Both recalc emitters publish through a single _recalc_sse_event(remap, step)
   helper, so the SSE event is the same {kind, remap, step} shape regardless of
   surface. The MCP _notify now forwards report.checkpoint_step too; the notify
   handler republishes normalized instead of the raw payload.model_dump() that
   buried remap under extra and dropped step.

3. recalc()'s root guard checks the manifest, not the directory. verdicts (and
   the cone) are keyed by manifest-bearing entries, so a dir-without-manifest
   root (a crashed mid-build leftover) used to enter the cone and KeyError the
   walk at verdicts[hash]; it is now dropped and the run reports clean.

Co-Authored-By: Claude Opus 4.8 (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.

1 participant