fix(liturgy): fail honestly for unreviewed morpheme arrows - #161
Conversation
Context: Multi-token witness alignments were distributed across source morphemes by English token order, making unauthored semantic claims. Changes: Add reviewed word, surface, and layered target contracts; resolve absent targets to the whole word; isolate and test DOM alignment geometry. Impact: Unreviewed arrows now fail honestly to word precision, including alternate-script layered targets. Tests: 8 focused resolver and geometry regressions; typecheck and affected liturgy suites pass. Docs: Convention and ADR follow in the stacked curation change. ADR: LITURGY-001
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
anantham
left a comment
There was a problem hiding this comment.
Claude/Anthropic adversarial review
Exact reviewed head: 6edceaadddc7c69b8eb7bab50c1aea002e2a5f3c
Provider run: 276c7dfb-354d-4771-b401-a8d8f91094ca
Blocking findings
-
P2 — pooled witness cleanup leaves stale fine-grained targets.
data/liturgy/resolve.ts:44-48stripsalignToandmorphemeAlignTo, but not the paralleltokenAlignTo. A pooled cross-community witness can therefore retain targets that no longer describe the selected line. Add aresolve-community-chantregression that proves all alignment layers are removed or reconciled together. -
P2 — the new alignment contracts are not validated at this head.
tokenAlignToandWordAnalysislack enforced length parity, target-morpheme bounds, analysis-unit ID validation,surfaceMorphemeIndicesvalidation, and ID character/uniqueness checks. In particular, whitespace in IDs can be split when serialized intodata-analysis-unit-ids, producing a mis-anchor. The stacked follow-up PRs may mitigate this, but PR #161 alone exposes the incomplete contract. -
P2 — provenance status is computed but not made legible. Reviewed, unreviewed, and needs-review metadata are rendered without a meaningful visual distinction. The analysis tooltip can describe a surface morpheme while the geometry anchor represents a hidden analysis unit, which makes epistemic status and target identity ambiguous to readers.
Non-blocking findings
-
P3 — combined geometry can point at an unclaimed visual slice. A union bounding box over non-contiguous or wrapped analysis units can place the anchor over the gap rather than over a claimed token.
-
P3 — the Pali re-anchoring step appears inert or misleading. Its current behavior should either be demonstrated by a failing-then-passing test or removed/simplified.
-
P3 — geometry tests bypass the component boundary. The tests hand-write DOM instead of proving that the renderer emits the expected attributes and the anchor layer consumes them correctly. Add a component-to-geometry bridge regression.
-
P3 — generator modes do not reconcile the new field. Pipeline paths for
alignmentMode: noneand inferred alignment do not clearly clear or rebuildtokenAlignTo, risking stale generated evidence.
Residual uncertainty
The review was limited to the exact #161 diff and relevant call paths. It did not treat stacked PR #162 or #163 as already merged, and it did not independently establish philological correctness of the sacred-text segmentation.
VERDICT: REVISE
Context: reviewed fine-grained targets could survive after their witness word alignment was stripped or regenerated, and PR #161 did not yet enforce its full structural contract. Changes: clear dependent targets at pooling and generator boundaries; validate authored word, morpheme, token, and layered-analysis identities and bounds; add focused negative and lifecycle tests. Impact: malformed or stale semantic targets now fail honestly while reviewed preserve-mode data remains intact. Tests: affected suite 7,195 passed and 340 skipped; TypeScript and production build/security scan pass. Docs: amend LITURGY-001 with implemented semantic-target lifecycle. Fixes: PR #161 adversarial-review contract findings ADR: LITURGY-001
Context: authored analysis status was invisible, combined anchors could land in unclaimed gaps, and renderer tests bypassed the live DOM contract. Changes: present cautious status through literal tooltips and underline styles; anchor multi-slice analysis on a real claimed element; remove the inert re-anchor pass; add a real renderer-to-geometry bridge test. Impact: readers can distinguish evidence status and alignment lines no longer imply unsupported source positions. Tests: renderer and geometry tests 7/7 after final cleanup; affected suite 7,195 passed and 340 skipped; TypeScript and build/security scan pass. Docs: adopt the fail-honest semantic-alignment convention and record the completed work. Fixes: PR #161 adversarial-review presentation and geometry findings
# Conflicts: # services/liturgy/validation.ts # tests/services/liturgy/semanticAlignmentValidation.test.ts
anantham
left a comment
There was a problem hiding this comment.
Independent Gemini adversarial review
Evidence inspected included the exact diff plus the renderer geometry, target resolver, pooled-witness lifecycle, generator pipeline, validator, types, and focused tests.
P1 — coarse n-to-one geometry
Gemini reported that removing positional fanning makes several coarse English tokens share the same source-word center. It asked for a falsifiable renderer/geometry check because multiple coarse targets now have identical source coordinates.
P2 — missing negative validator test
services/liturgy/validation.ts emits fine_target_word_not_found, but no test fails if that guard is removed. Add a negative fixture whose fine target names a Pali position without a corresponding WordGloss.
P3 — explicit null versus legacy precedence
The type contract says tokenAlignTo takes precedence and null degrades to the whole word, but resolveAlignmentTargets currently falls through from explicit null to morphemeAlignTo. A curator cannot explicitly suppress stale legacy precision as documented.
Residual uncertainty stated by Gemini: none; it reported inspecting the complete exact-base-to-head diff.
VERDICT: REVISE
Context: Gemini found an untested missing-word validator path and an explicit-null target that incorrectly fell through to stale legacy precision; it also challenged coarse n-to-one geometry. Changes: make tokenAlignTo the complete witness target contract when present; align validation; add missing-word/null/legacy negative tests; prove coarse connectors share one truthful source but retain distinct English paths. Impact: curators can explicitly suppress legacy precision without fabricated arrows, and the deliberate fail-honest fan is regression-tested. Tests: 7,182 passed and 327 skipped across the affected liturgy gate; focused 21/21; TypeScript and ESLint pass. Docs: clarify authoritative target precedence and truthful coarse fan geometry. Fixes: Gemini exact-head review 5018671866 on PR #161
# Conflicts: # docs/WORKLOG.md
# Conflicts: # docs/WORKLOG.md # tests/services/liturgy/semanticAlignmentValidation.test.ts
Context: Gemini reproduced a semantic overclaim where identical multi-slice analysis targets selected different source slices by English-token proximity. Changes: Anchor repeated analysis targets to the first claimed surface slice in authored order and add the two-token geometry regression plus convention/worklog evidence. Impact: Identical semantic targets now share one truthful source origin while their English endpoints remain distinct. Tests: 22 focused cases; typecheck; focused ESLint; git diff --check. Docs: SEMANTIC-ALIGNMENT-CONVENTION.md and WORKLOG.md. ADR: LITURGY-001 contract unchanged.
anantham
left a comment
There was a problem hiding this comment.
Independent Gemini adversarial review
Provider: Google via agy
Model: gemini-3.1-pro-low
Run: 460024ac-1708-4c35-8968-cfc6fc10e3e2
Exact reviewed head: e6f93c5ace33cb90fbe5da90ee04a69fa7342faa
Findings
- P1: The reviewer reported that an intentionally unaligned English token could produce
fine_target_word_not_foundinstead offine_target_without_word_alignment. - P2: The reviewer reported that the missing-target diagnostic path omitted
tokenAlignToand the English-token index. - P3: The reviewer reported missing acceptance coverage for complete valid
tokenAlignToarrays and coarse{ kind: 'word' }targets.
Repository-side disposition is required for all three findings before a new exact-head approval can count. This receipt records the external reviewer verdict without asserting that its cited path exists.
VERDICT: REVISE
Context: A completed Gemini review cited absent validator defects and overlooked existing acceptance coverage. Changes: Assert the exact unaligned-token diagnostic path and prove reviewed whole-word targets need no fine WordGloss metadata; record finding dispositions. Impact: Production behavior is unchanged while future reviews can falsify both claims directly. Tests: 21 focused cases; typecheck; focused ESLint; git diff --check. Docs: WORKLOG.md. ADR: LITURGY-001 contract unchanged.
anantham
left a comment
There was a problem hiding this comment.
Independent Gemini adversarial review
Provider: Google via agy
Model: gemini-3.1-pro-low
Run: c341532e-b4c6-41b4-b263-4aedabf75de0
Exact reviewed head: e1159c83c7bf73e1107d7af0ac33fef61ea39b64
Findings
- P3:
services/liturgy/validation.tsemitsfine_target_without_word_alignmentfor a legacymorphemeAlignTotarget but hardcodes the path towitness.tokenAlignTo.<index>, a field absent in that case. - P3:
tests/services/liturgy/semanticAlignmentValidation.test.tsdoes not cover an unaligned legacy morpheme target and therefore misses the diagnostic-path defect.
VERDICT: REVISE
Context: Gemini found that legacy fine targets on unaligned tokens were reported against the absent tokenAlignTo field. Changes: Select the diagnostic path from the active precision source and add the legacy-only regression. Impact: Detection is unchanged; diagnostics now identify the exact authored field. Tests: 16 focused cases; typecheck; focused ESLint; git diff --check. Docs: WORKLOG.md. ADR: LITURGY-001 contract unchanged.
anantham
left a comment
There was a problem hiding this comment.
Independent Gemini adversarial review
Provider: Google via agy
Model: gemini-3.1-pro-low
Run: c9c74cab-becd-44d2-ab40-288c52ea1890
Exact reviewed head: 5b42370df135e2e8b041360286a0d54b2e6c37f5
Actionable findings
- P3: Direct negative tests are missing for
analysis_requires_surface_morphemes,analysis_units_missing, andanalysis_surface_target_missing. - P3: Multiple invalid
surfaceMorphemeIndicesemit the same collection path rather than paths identifying their individual array positions.
Gemini ended the response with VERDICT: APPROVE, despite listing these actionable findings. This receipt preserves that output and is deliberately not treated as an eligible approval until both findings are closed and a fresh consistent review completes.
VERDICT: APPROVE
Context: Gemini identified untested analysis invariants and duplicate paths for multiple invalid surface references. Changes: Add direct negative coverage and include each surface-array position in its diagnostic path. Impact: Invalid analysis remains rejected with more actionable per-entry evidence. Tests: 13 validator cases; typecheck; focused ESLint; git diff --check. Docs: WORKLOG.md. ADR: LITURGY-001 contract unchanged.
anantham
left a comment
There was a problem hiding this comment.
Independent Gemini adversarial review
Provider: Google via agy
Model: gemini-3.7-flash-high
Run: 9c9460f6-05ad-4b67-ab52-d76d26945d0e
Exact reviewed head: d553f2dec5bb8d644677380cd1d274646ea317c4
Gemini inspected the complete base-to-head diff, relevant call sites, tests, and documentation. It verified closure of the multi-slice anchor, current/legacy diagnostic-path, structural-invariant, and indexed-surface-path findings. It found no remaining actionable P1, P2, or P3 issue across semantic correctness, fail-honest validation and geometry, security, regressions, or test coverage.
Actionable findings: None.
VERDICT: APPROVE
…l-honest-renderer # Conflicts: # docs/WORKLOG.md
…l-honest-renderer # Conflicts: # docs/WORKLOG.md
|
Main refresh 43 selected renderer/validator/resolver/pipeline tests pass on Node 24.19.0, with TypeScript and exact-main integrity clean. The integrated audit child also passes 7,237 corpus/alignment tests (340 existing skips) across 14 files. All five fresh CI jobs and Vercel pass at this merge head, run No semantic data curation was added. #163's human/domain acceptance remains separate. |
Summary
Unreviewed English-to-source alignments resolve to the whole source word instead of inventing morpheme-level arrows from token order. Reviewed word, surface and layered targets remain explicit, with visible provenance status and validated identities.
Changes
Validation and review
43 focused tests pass on Node 24.19.0; types and exact-main integrity pass. All five fresh CI jobs and Vercel succeed at
688005bin run34042179835.All liturgy application/data/test files are identical to independently approved
d553f2d(Gemini review5019337359, run9c9460f6-05ad-4b67-ab52-d76d26945d0e). This main-targeted refresh includes the merged reader/chapter stack with worklog-only conflict resolutions.The audit follows in #162. #163's sacred-text curation requires separate human/domain acceptance.