Repository navigation
fix(richEditor): TextBoxBlock's wisdomStyle checkbox never renders - #996
Conversation
`TextBoxBlock`'s `wisdomStyle` condition tested `siblingData.position`. That is the legacy EditorJS name, which survives only inside `importData`; the block's own radio is `imagePosition`. The condition was therefore always false, so the "Ancient Wisdom" checkbox never rendered and the WeMeditate importer was its only writer — 123 rows nobody could edit. The condition now reads `imagePosition !== 'overlay'`. That is the consumer's own behaviour rather than a judgement: WeMeditateWeb's `blockConverters` reaches `OrnateTextBox` on the side layouts only. The `Boolean(...)` presence guard is gone with the rename — `imagePosition` is required and defaults to `left`, so there is no absent state, and the guard would have hidden the checkbox on a block whose radio the editor had not touched. No migration: the column exists and holds the importer's values. `tests/unit/textbox-block-conditions.spec.ts` pins the condition for all three radio values plus the untouched state, and adds the general form of the defect — every condition in the block reads only sibling fields the block declares, which is what no behavioural case can state. Watched red on the restored defect: three behavioural cases and the closed-list guard. Closes #989. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RyquXk8Du24SSXCtVZFXM6
…hared `flattenTopLevelFields` already hoists a `row`'s children and drops UI fields, so the hand-rolled walk was a fourth copy of a tree walk this repo keeps re-deriving. It also handles `tabs`, which the hand-rolled version silently returned nothing for. It types the result as though it kept presentational fields, so the `'name' in field` narrowing is what makes `name` a string — `pnpm typecheck:tests` fails without it. Per /simplify. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RyquXk8Du24SSXCtVZFXM6
`src/fields/index.ts` already records why `jsonField` is not re-exported from that barrel: importing through it drags `translationsField`, and the Lexical editor with it, into every light module. `TextBoxBlock` and `LayoutBlock` took `mediaField` through the barrel anyway, so both carried that graph. `mediaField` itself imports two types and nothing else. Measured on the new spec, which imports `TextBoxBlock`: module import falls from 1.61s to 0.25s. Every other importer of either block, the admin bundle included, stops paying it too. `TableOfContentsBlock` already used the deep path, so no barrel import is left in `src/lib/richEditor/blocks/`. Per /simplify. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RyquXk8Du24SSXCtVZFXM6
… types Four cleanups from the review pass, none behavioural: `payload` exports `Condition`, so the hand-rolled `NonNullable<NonNullable<…>>` alias and the `Field` import it needed are gone. A throwing guard replaces the two `expect`s inside `conditionFor`, which did not narrow and so forced two non-null assertions — and one of them ran at describe-collection time, where this repo records that a failure reads as "the spec doesn't parse" (`tests/AGENTS.md`). The closed-list `it.each` now carries each condition through instead of mapping to a name and looking it up again. And `shows` passes `path: []` rather than naming one field, since no condition here reads it. Per /simplify. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RyquXk8Du24SSXCtVZFXM6
…s too Two holes the review pass found, both of which let the #989 class through. `siblingData['postion']` matched nothing, so the per-case filter was empty and passed with nothing to check — the exact defect the guard exists to refuse. `siblingReads` now reads both spellings, and the typo reddens. The anti-vacuity assertion was `read.length > 0` per case, which would have gone red on a correct future condition reading `data` or `blockData` instead. The pinned map replaces it: a condition rewritten into an unreadable spelling fails there, and one reading another namespace is added as `[]` rather than failing. Per /code-review high. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RyquXk8Du24SSXCtVZFXM6
sydevs-bot
left a comment
There was a problem hiding this comment.
1 question for the reviewer, one per thread.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
The condition fix is right, and the consumer proves it rather than asserting it: WeMeditateWeb reaches OrnateTextBox only off the non-overlay branch. The ⚠ clause #989 asked to remove is removed. The open right-image question is well-posed and measured.
Two parts are bigger than the problem. The spec spends ~40 of its 95 lines on a one-block version of a guard the body routes elsewhere and did not file. The mediaField move rewrites two call sites of a barrel whose single bad export is untouched.
perf(richEditor) also overclaims. Both production consumers of these blocks (src/collections/Pages/Pages.ts:8, Lessons.ts:5) import fullRichTextEditor, so lexical is in that graph either way. The measured 1.61s→0.25s is the new spec's own import, as the Detail block says.
Findings
should-fix— the closed-list guard covers one block and stands in for unfiled work ·tests/unit/textbox-block-conditions.spec.ts:64should-fix— deletesrc/fields/index.ts:38instead of rewriting call sites ·src/lib/richEditor/blocks/TextBoxBlock.ts:3
What was checked
- #989 against the diff: all four acceptance criteria met.
- Consumer side: WeMeditateWeb
blockConverters.tsx:96-165,blockConverters.test.tsx:64,72,lib/content-blocks.ts:32-44.OrnateTextBoxtakes noalign, so the question thread's premise holds. TextBoxBlock.tswhole: the new condition matches its two=== 'overlay'siblings.- Barrel graph:
src/fields/index.ts,translationsField.ts:14,mediaField.ts:1.from '@/fields'has 30 sites, 7 takingmediaField;buildTranslationTabshas 3, all deep-path. No barrel import left undersrc/lib/richEditor/blocks/. - Both
## Previewlinks answer 404Application not found, as PR #995's do, so neither was read.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
`src/fields/index.ts` re-exported `buildTranslationTabs`, which imports `basicRichTextEditor` — the one path by which `@/fields` reached the Lexical editor. Its three call sites all use `@/fields/translationsField` already, so nothing read it there but one integration spec, now on the deep path too. That makes the barrel safe for the seven collections still taking `mediaField` from it (Lessons, Videos, Meditations, AppCards, Authors, Lectures, Albums), so the two blocks go back to `@/fields` rather than carrying a private path each. Walked both graphs: `@/fields` reaches 25 modules and no editor module; the block reaches 26 through the barrel and still none. The note left in place of the export mirrors the one `jsonField` already carries, for the same reason. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016D7U1jhFpDmwmNbBd39DrD
The first describe already covers what #989 asked for: restoring `Boolean(siblingData?.position) && siblingData?.position !== 'overlay'` turns 3 of its 4 cases red, the overlay case among them. Watched, then restored. The closed-list half asserted the same defect class by regex over `condition.toString()`, for one block, pinning a map of all five of its conditions. That is a repo-wide guard with a one-block reach, and it had to be edited by hand whenever a condition in this block changed spelling. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016D7U1jhFpDmwmNbBd39DrD
`@/fields` no longer re-exports `buildTranslationTabs`, and all three translations globals already import it from `@/fields/translationsField`. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_016D7U1jhFpDmwmNbBd39DrD
|
Both critic threads adopted, and
Still waiting on you: the right-image question. Body refreshed — the Flow section, the test numbers, and the claim that the guard was already filed. Lean gate green on the merged branch: 2646 unit tests, 204 files. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
#1007 moved the per-block field notes out of `src/collections/AGENTS.md` into `src/lib/richEditor/blocks/AGENTS.md`, keeping only the `⚠` bullet reporting #989. This branch fixes #989, so that bullet is now false in both files it landed in: the condition reads `imagePosition`, and the checkbox renders. Took main's structure — the block table stays moved, not restored — and dropped the stale warning. `blocks/AGENTS.md` keeps the field note in the shape of its `textColor` twin, with the #989 breadcrumb and the reason `position` is the wrong name. #994's new `perf-figures-pinned` spec then went red on a conflict no textual hunk shows: it pins `tests/PERF.md`'s spec count to the files on disk, and this branch adds the 205th. PERF.md records the current tree's counts by its own rule, so it and the four consumer docs move together, as that spec requires. Lean gate green: lint, typecheck, typecheck:tests, 2657 tests across 205 files. `tests/int/translations-field.int.spec.ts` 26 passed. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMsfQPCwjEaRYV2sLpaeP9
|
Merged
Gate green: 2657 tests across 205 files. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
#912 landed the CSV class import, adding 11 unit spec files and 126 cases. Every conflict is the same fact stated in four places: the unit lane's file and test counts, which `perf-figures-pinned` pins to the files on disk and to each consumer doc. Neither side's number is right after the merge. Took main's wording and wrote the measured count for the merged tree — 216 files, 2787 tests. PERF.md's 77.9 s lane median stays, since its own rule records the slowest measurement, and this container ran 48.6 s. No code hunk conflicted. Checked the one semantic risk: #912 adds no importer of `buildTranslationTabs` from the `@/fields` barrel this branch stops exporting it from, and it leaves `src/lib/richEditor/blocks/` alone. Lean gate green: lint, typecheck, typecheck:tests, 2787 tests across 216 files, 84 s. `tests/int/translations-field.int.spec.ts` 26 passed. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TusuAQvEkkc5Ejff874yah
|
Merged All four conflicts were one fact in four places: the unit lane's file and test counts, which No code hunk conflicted. The one semantic risk was checked rather than assumed: #912 adds no importer of Lean gate green on the merge — lint, typecheck, typecheck:tests, 2787 tests across 216 files, 84 s. 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
#1008 added the 217th unit spec on `main`, so `perf-figures-pinned` went red on the merge: PERF.md still recorded 216 files / 2787 tests. No hunk conflicted — the counts are a fact about the merged tree, which neither side could state. Measured on the merged branch: 217 files, 2792 tests. PERF.md and its four consumer docs move together, as that spec requires. The 77.9 s lane median stays — it records the slowest measurement, and this container ran 40.3 s. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011G1Sr7nRy5nFcMNQgZ7kkk
|
Merged Answered — the right-image question → C. Nothing changes here, so the built condition stands: the checkbox shows for Body refreshed: Test results, the new Counts section, and the reviewer notes. @Ardnived — your approval is recorded against 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
#996 landed the same stale-lane-count fix this branch carried, and recounted its own spec on top. Resolved to its figures, plus the six cases this branch adds: 217 files, 2798 tests. Co-authored-by: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_0189yxkD72nKy2V6RUr2jhQS
All four conflicts are the tier figures again, one line each: `main` moved to 217 / 2792 while this branch carried 216 / 2786. Took `main`'s text and wrote the merged tree's own 218 / 2795 into all five places, which is what perf-figures-pinned.spec.ts holds together. `KNOWN_UNDECLARED` is gone, not re-stated. #996 merged as 74e545b, so `wisdomStyle` now reads `imagePosition`, and the entry no longer named an offender — a dead allowlist line silences the next real one. The guard passes with no entry at all, which is what the open thread predicted. Lean gate green: 218 files / 2795 tests, 49 s for the lane, 112 s for the gate. PERF.md records that session rather than replacing a row. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Qd4PYdsMMP2p5eRKU87dUv
#996 landed while this branch was open. All four conflicts were the same shape: this branch's prettier-formatted markdown against main's unpadded text, with both sides rewriting the same unit-lane figures. Every hunk takes main's figures in this branch's formatting, and keeps this branch's own addition — the `pnpm format:check` bullet in AGENTS.md. Both sides' figures were right for their own tree. This branch measured 216 files / 2788 tests; #996 then added one unit spec carrying four cases, so main's 217 / 2792 is the merged tree's count. tests/unit holds 217 spec files on disk, which is the invariant perf-figures-pinned checks against, and the lane reports 2792 tests. #996's own files needed no reformatting — the first merge on this branch where an arrival from main was already prettier-clean. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_012vGiwpTrrf9p4Xr8oRaRyq
#996 landed `tests/unit/textbox-block-conditions.spec.ts` on `main` and re-counted the unit lane with it. This branch carried #1009's re-count of the same four docs, so both sides rewrote one line in each. Took `main`'s figures — 217 files / 2792 tests — in all four. The counts are a fact about the merged tree, and this branch adds no unit spec, so `main`'s number already includes everything either side contributes. Measured on the merge: 217 files, 2792 tests, which is what `perf-figures-pinned` reads. Nothing else overlapped. `main` dropped `buildTranslationTabs` from the `@/fields` barrel; `AppCards.ts` takes `mediaField`, `scheduleFields` and `urlField` from it, none of them affected. No migration landed on `main` since the merge base, so the snapshot parent is unchanged. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01AWC3mSf6HECsDNvRiGBmjN
Four conflicts, all one figure: the unit lane's pinned file and test counts. #996 re-pinned them for the one spec it added, this branch for the two it adds, so neither side's number describes the merged tree. Recounted off the merged tree instead of taking a side: 219 spec files on disk, 2829 cases in the lane. `perf-figures-pinned.spec.ts` holds PERF.md against the tree and the three consumer docs against PERF.md, so all four files carry the same pair. No timing was re-measured — the lane ran 50 s here, inside the 47-78 s spread already recorded, so the quoted 78 s stands. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_0147tSnnXypdirnAAbr7BcYc
`main` added `transcribeUrl` (#1011) to the same locale-URL inventory this branch removes `submissionActionUrl` from, and #996 re-measured the unit lane. Both sides' intent is kept. - `docs/rules/access.md`: main's two `MeditationTranscript` rows stay, the `SubmissionReview/urls.ts` row goes with the endpoint this branch deletes. The "build the URL in a pure module" list keeps `transcribeUrl` and the spec-pins clause, minus `submissionActionUrl`. - `tests/unit/admin-locale-urls.spec.ts`: main's `transcribeUrl` cases stay, the `submissionActionUrl` block is gone, so the docblock counts four sites and three pinned here. - `tests/PERF.md`, `docs/rules/testing-reqs.md`, `tests/AGENTS.md`: the merged tree measures 224 files / 2886 tests, not either side's figure. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011e9ab9kznCHJEC3dgtLvjD
Summary
wisdomStyle's condition readsiblingData.position, which this block never had./admin, and only the importer wrote it.@/fieldsbarrel re-exported the one field module that imports Lexical.Change outline
Behaviour — the condition
imagePositionis the block's own radio;positionis the legacy EditorJS name that survives only insideimportData.The presence guard does not survive the rename:
imagePositionisrequiredwithdefaultValue: 'left', so there is no absent state, and keeping it would hide the checkbox on a block whose radio had not been touched.Flow — the barrel's one bad export
Its three real call sites — the three translations globals — already used
@/fields/translationsField. The only other reader wastests/int/translations-field.int.spec.ts, now on the deep path too.That fixes the cause rather than two call sites, so the seven collections still taking
mediaFieldfrom the barrel stop carrying the editor graph: Lessons, Videos, Meditations, AppCards, Authors, Lectures, Albums. Both blocks go back to@/fields, and the diff no longer touches either.Walked both graphs with the aliases resolved:
@/fieldsreaches 25 modules and no editor module, andTextBoxBlockthrough the barrel reaches 26, still none. This is graph hygiene, not a measured speed win — both production consumers of these blocks (src/collections/Pages/Pages.ts:8,Lessons.ts:5) importfullRichTextEditor, so the editor is in that graph either way.Tests
One
describe, four cases: the checkbox shows forleftandright, hides foroverlay, and shows before the radio is touched. The closed-list half of the spec is gone — it asserted the same defect class by regex overcondition.toString()for one block, and pinned a map that had to be hand-edited whenever a condition in this block changed spelling. #1003 carries the repo-wide form.Counts — PERF.md after the base merge
#1008 put the 217th unit spec on
main, andperf-figures-pinnedholds PERF.md to what is on disk. No hunk conflicted: the counts are a fact about the merged tree, which neither side could state. Measured on the merge — 217 files, 2792 tests. PERF.md and its four consumer docs move together, as that spec requires. The 77.9 s lane median stays: it records the slowest measurement, and this container ran 40.3 s.Preview
The preview carries no content, so the checkbox is reached by adding a block rather than opening a seeded row.
wisdomStyle: trueblock render it tickedpreviewUrl.seedis unset for this repo, so nothing was seeded. The editor link above needs no data; the list link is empty until someone creates a page.Test results
pnpm lint,pnpm typecheck,pnpm typecheck:tests, 2792 unit tests across 217 files, 68 s — on the branch withorigin/mainmerged intests/unit/textbox-block-conditions.spec.ts4 passed,tests/unit/perf-figures-pinned.spec.ts11 passedtests/int/translations-field.int.spec.tsis an import-path change only, type-checked bypnpm typecheck:tests; CI runs itThe spec was watched red again after the closed-list half was dropped: restoring the original
Boolean(siblingData?.position) && …condition turns 3 of its 4 cases red, theoverlaycase among them.Manual verification
The first three acceptance criteria are
/adminbehaviour no unit spec reaches.Notes for reviewer
The open question is answered: C (Ardnived, 2026-10-21). Nothing here changes — the built condition shows the checkbox for
leftandright. GivingOrnateTextBoxanalignprop, so Right Image renders right, is sydevs/WeMeditateWeb#193, which carries one open question on how far the ornament mirrors. The measurement that ruled out restricting the checkbox toleftstands: 122 of the 123background: 'ornate'rows inseeds/wemeditate/data.jsoncarry legacyposition: right, whichseeds/lib/lexicalConverter.ts:435,447maps toimagePosition: 'right'withwisdomStyle: true.Routed elsewhere, not fixed here:
admin.conditionsites found no second instance, so nothing else is defective today.src/payload-types.tsis stale against its own generator onmain— one cosmetic hunk, which thepayload-types-gen.mjshook reproduced on every edit here. Already fix(build): pnpm lint rewrites payload-types.ts after prettier 3.9.10 #992; kept out of this diff.Detail
Why the condition is a fact, not a judgement. WeMeditateWeb's
blockConverters.tsxroutesimagePosition === 'overlay'toContentOverlayand only then reachesfields.wisdomStyle ? <OrnateTextBox …>on the side layouts, withblockConverters.test.tsxpinning "overlay takes precedence over wisdomStyle".Why
blockDatais out of the guard's scope.LayoutBlockreads(blockData as { style?: string })?.style, which names the enclosing block rather than a sibling — correct, and invisible to a sibling check. #1003 carries that rule.Dismissed findings. A review lens proposed collapsing the three
wisdomStylecases into oneit.eachtable; kept separate because two carry the reasoning for dropping the presence guard. Another proposed promoting the condition-args shim intotests/utils/; left alone — it serves one spec.History.
aeb3057moved the two blocks onto@/fields/mediaFieldand claimed a speed win from it;70809a1deletes the barrel's bad export instead and returns both call sites. The 1.61s → 0.25s figure in that commit message was the spec's own module import, not a production cost — see the graph counts above.Closes #989
🤖 Generated with Claude Code
https://claude.ai/code/session_016D7U1jhFpDmwmNbBd39DrD