feat+fix(sutta-studio): ?phaseLimit=N + 3 bug fixes surfaced by DN22 pilot#55
Merged
Conversation
Trims phaseSkeleton to the first N phases when ?phaseLimit=N is in the URL. Lets us validate architecture cheaply on new suttas (DN22 etc) without paying full compile cost. Unset = all phases. Flow: parseSuttaRoute() in SuttaStudioApp.tsx parses param → passes to compileSuttaStudioPacket → compiler logs the cap + truncates phaseSkeleton before the phase loop. Use: http://localhost:5180/sutta/dn22?lang=en&author=sujato&phaseLimit=4 → compiles first 4 DN22 phases (~$0.08, ~3 min) instead of all ~50. Next: cost-aware preview-and-confirm UX (per user request) that pauses at phaseLimit, shows estimate for remaining phases, asks user to confirm before continuing. This commit ships the underlying mechanism; the UI layer is a follow-up.
Component types chapter as 'EnhancedChapter | null' but line 78 read
chapter.translationResult directly without optional chaining. Triggered
when navigating to /sutta/{uid} for a sutta not yet in IndexedDB — the
fallback renders briefly with chapter=null while the compile pipeline
warms up.
Reproducer: visit /sutta/dn22 fresh → TypeError 'Cannot read properties
of null (reading translationResult)' → blank page.
One-line fix: (chapter as any)?.translationResult — proper optional chain.
useLayoutEffect deps included leftPx, but the effect ALSO sets leftPx. Each set triggered a re-measurement of the (now-shifted) tooltip, which computed a different newLeftPx because the tooltip was no longer at its centered position. Cycle: measure → setLeftPx → re-measure → setLeftPx → ... Symptom: 'Maximum update depth exceeded' crash on the second phase's PaliWord rendering. Reproduced reliably on /sutta/dn22?phaseLimit=4 once phase-2 compiled and its tooltips tried to mount. Fix: drop leftPx from deps. We still read it inside the effect for change-detection (avoid redundant setState), but we don't trigger re-runs from its own changes. Verified by chain: deps now are only the inputs that should re-trigger clamp computation (text/facet/flipBelow).
…ass output Bug: prior truncation was scoped inside the 'chunkPhases fallback' branch, so when runSkeletonPass succeeded (the normal path on real suttas with LLM phase detection), no truncation fired. Symptom: ?phaseLimit=4 on DN22 still showed 'Phase 0/451 · 173m 48s' because all ~50 LLM-detected DN22 phases were retained (and 451 in the progress chip is likely a stale prior state from in-progress build). Fix: move truncation OUTSIDE the if-branch — applies after either path populates phaseSkeleton.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
anantham
added a commit
that referenced
this pull request
May 15, 2026
… find
Three durable artifacts capturing the high-marginal-value synthesis from
this context that a fresh agent couldn't cheaply re-derive:
1. RESEARCH_RESULTS.md — Verified 11 URLs from the deep-research prompt.
Headline find: edhamma/vism github repo has TEI XML Visuddhimagga with
a pre-parsed glossary (vism/gloss.tei, 116 KB). Phase 4 collapses from
6-10 hr to ~2 hr. Includes 6-step wiring plan + licensing caveat.
2. AMORTIZATION.md backlog updated:
- Visuddhimagga moved from NOT YET INVESTIGATED → VERIFIED via Eudoxos
- CPD, Pali Translation Project, HKU Papañcasūdanī, DharmaNexus/MITRA
all annotated with current status (verified live, parked, or watch)
3. HANDOVER.md replaced — full session capture including:
- 3 commits arc (GROUNDING + v12-b + DN22 pilot fixes + research)
- PR #55 open status with 4 unmerged bug fixes
- Smart-caching-across-suttas observation as Pending Thread #3
- Resume instructions ranking (A) verify DN22 → (C) persistent cache
→ (B) Phase 4 via Eudoxos
The next agent reading these three docs has everything needed to continue
without re-derivation. Mechanical follow-on work (persistent cache, Vism
extraction, Path B continuation) can be done with 0 context.
anantham
added a commit
that referenced
this pull request
May 16, 2026
Synthesized from JSONL after the model that did the work hit "Prompt is too long" trying to act on the final "yep go ahead" and /compact ran. Replaces 2026-05-14 handover (whose three Continue-Immediately threads — DN22 pilot, persistent segmentCache, GROUNDING Phase 4 — all merged 2026-05-15 via PRs #55/#56/#57). This session's work captured here: - 9 issues investigated + closed under the new §6a Verification Ladder - §6a Verification Ladder protocol itself (L1-L5 with hard gate) - InterleavedReader feature (issue #15 + #3 anomaly E) with L5 verification - 22 commits on feat/opus-issues-investigation, PR #60 opened (MERGEABLE) - Verbatim user-quote section preserved (JSONL is local-only) Immediate pending task: CI test gate PR (user authorized "yep go ahead" but model could not respond before compaction). Co-Authored-By: Claude Opus 4.7 (1M context) <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
DN22 pilot attempt surfaced one feature and 3 real bug fixes. All shipped here as one coherent unit.
What's in
The arc
User asked to validate the architecture amortization claim by piloting DN22.
Each visit surfaced a real bug at increasingly later compile stages:
These bugs would have surfaced for ANY new sutta. The pilot caught them cheaply.
Verification
After landing this PR + hard-refresh:
```
http://localhost:5180/sutta/dn22?lang=en&author=sujato&phaseLimit=4
```
Should show `Phase 0/4` (not 0/451), compile in ~3 min, cost ~$0.10.
Test plan
🤖 Generated with Claude Code