Skip to content

Devana fixes - #9

Merged
bnomei merged 20 commits into
mainfrom
devana-fixes
Jun 29, 2026
Merged

bnomei merged 20 commits into
mainfrom
devana-fixes

Conversation

@bnomei

@bnomei bnomei commented Jun 27, 2026

Copy link
Copy Markdown
Owner

No description provided.

bnomei and others added 17 commits June 27, 2026 14:47
Pass fallbackLayout to the row LayoutPatternField so blurring an empty or
invalid layout draft normalizes back to the current layout instead of "",
which previously truncated multi-column rows to the first column on blur.

Resolves devana finding layout-blur-drops-columns.
…on-row-update)

LayoutPatternField unconditionally re-synced its draft from the value prop,
so same-row structural edits that change row.layout could wipe uncommitted
text. Add an isFocused ref and skip the sync effect while focused; clear it
on blur before committing so the committed value still syncs back.

Resolves devana finding layout-draft-lost-on-row-update.
…-value-mishandled)

A persisted layout value that is a single row object (instead of an array)
was silently treated as empty in admin and threw in normalizeLayoutRows on
render. Add a shared asLayoutRows helper that wraps a recognized singleton
row into a one-element array; route both admin asLayouts and render ingest
through the same isLayoutBuilderRow check. Non-row objects still map to [].

Resolves devana finding non-array-layout-value-mishandled.
…ovable)

The layout menu (incl. the remove option) was only built when layouts.length
> 1, so a single row could never be removed back to the empty [] state. Drop
the outer gate; move-up/down already self-gate by row position, so only the
remove option shows for a lone row.

Resolves devana finding last-layout-row-not-removable.
…ids-unstable)

normalizeRow fabricated layout-implied columns with randomId on every render,
so an unrelated parent re-render before the first save reassigned ids and
remounted their block editors (losing in-progress edits). Switch the factory
to deterministic layout-N-column-M ids, matching normalizeColumn and render's
normalizeLayoutRow. randomId stays for user-initiated add actions.

Resolves devana finding synthetic-column-ids-unstable.
…yout-row-null-throws)

normalizeLayoutRow read layout.columns directly, so a null/undefined/primitive
hole in the layouts array threw a TypeError and aborted the Astro render path
while the admin path tolerated it. Coerce the argument via isRecord before any
property access; holes now synthesize a default row, matching admin.

Resolves devana finding normalize-layout-row-null-throws.
…-row-span-gap)

isLayoutBuilderRow only inspected columns[0] for a span, so legacy rows
carrying span on a later column (with no top-level layout key) were
misclassified as non-layout even though normalizeLayoutRow accepts them. Scan
every column with an isRecord guard, which also makes the in-check safe on
primitive column entries.

Resolves devana finding is-layout-builder-row-span-gap.
…umn-blocks-mismatch)

A column whose blocks was a singleton object (not an array) was silently
emptied in admin and threw in render (package normalizeBlocks maps over it).
Add a shared asBlocksArray helper that wraps a recognized singleton block into
a one-element array; route both admin normalizeBlocks and render's
normalizeLayoutColumn through it. null/primitive blocks still map to [].

Resolves devana finding non-array-column-blocks-mismatch.
…ize-layout-column-null-throws)

normalizeLayoutColumn dereferenced column.id directly, so a null/primitive
hole in the columns array threw and aborted render while admin tolerated it.
Coerce the column via isRecord before any property access; holes now
synthesize a default column, matching admin.

Resolves devana finding normalize-layout-column-null-throws.
…g-false-wrap)

Per-span Math.round overflowed the 12-column grid for equal-width patterns
whose fractions sum to 1/1 (seven 1/7 rounded to 2 each = 14 > 12), wrapping
rows the README says should fit on one line. Add layoutGridSpans: for rows
summing to <=1/1 it distributes round(total*12) units via largest-remainder
(each >=1); rows summing to >1/1 keep per-span rounding so they still wrap.
Admin uses one rowGridSpans per row; helper is re-exported for frontends.

Resolves devana finding span-rounding-false-wrap.
…builder-row-primitive-throws)

The TypeError on 'span' in <primitive> was already eliminated by the
span-gap rewrite (isRecord guard per column). Add the exact counterexamples
({ columns: ["x"] }, [0], [true], ["a","b"]) as explicit non-throwing/false
assertions and mark the finding fixed.

Resolves devana finding is-layout-builder-row-primitive-throws.
…age-default-shadows-fallback)

bentoMessage short-circuited to the built-in en default the moment the default
locale appeared in the fallback chain, so a chain routing fr->en->de returned
"Grid" instead of the de override "Raster" — diverging from localizedString.
Remove the in-loop default-locale short-circuit; walk the full chain for user
overrides and resolve the built-in default only after the loop.

Resolves devana finding bento-message-default-shadows-fallback.
…-key-id-collision-state-bleed)

A stored id could equal a sibling's synthesized positional id (e.g. a row
id'd "layout-2" next to an id-less row at index 1 -> layout-2), producing
duplicate key={row.id}/key={column.id} values and bleeding per-instance editor
state across cards. Add a deterministic uniqueId pass in asLayouts: dedupe row
ids globally and column ids per row, deriving a stable id on collision. Stays
deterministic (not randomId) so ids remain stable across re-renders.

Resolves devana finding react-key-id-collision-state-bleed.
@bnomei bnomei self-assigned this Jun 27, 2026
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@bnomei, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 42 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d25215c9-d335-4316-a720-c0e9b48869a7

📥 Commits

Reviewing files that changed from the base of the PR and between 3b6cde2 and d6073f5.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (11)
  • README.md
  • package.json
  • src/admin-locale.ts
  • src/admin.tsx
  • src/i18n.ts
  • src/index.ts
  • src/layout.test.ts
  • src/layout.ts
  • src/render.ts
  • src/types.ts
  • test/admin-empty-layout.test.mjs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ac99170db3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/layout.ts Outdated
const fractions = spans.map(spanFraction);
const totalFraction = fractions.reduce((sum, fraction) => sum + fraction, 0);

if (totalFraction > 1) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat near-one span totals as a single grid line

For a valid full row like eleven 1/11 spans, JavaScript sums the fractions to 1.0000000000000002, so this strict > 1 check takes the overflow path and returns eleven 1-column widths instead of distributing the row across all 12 grid columns. That leaves an unused grid column in the admin preview and in frontend renderers using the new README helper; compare with an epsilon or exact rational total before deciding the row is wider than one line.

Useful? React with 👍 / 👎.

@bnomei
bnomei merged commit cf18ee7 into main Jun 29, 2026
1 check passed
@bnomei
bnomei deleted the devana-fixes branch June 29, 2026 15:24
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