Repository navigation
Add the BXL formula Specs on Pret UI - #829
Conversation
Expression and Formula fields, the Evaluate Expression command, the bxl-input helper and the Formula Sandbox example, with their Specs. The command fetches its subject by id, and the helper reads the subject's links by their stored id, since links may not have loaded outside a render. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Formula's status is a StatePill, the sandbox's inputs are a KeyValue, and the styles read contract tokens without fallbacks, with -ink tokens for error and success text. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Staging Submissions PreviewThis PR's content is pushed to the staging submissions realm: https://realms-staging.stack.cards/submissions/ Changed folders:
Updated at 2026-10-12 06:46:00 UTC for commit |
NumberField's standard display rounds to whole numbers unless decimals are configured, so the 0.15 rate read as 0. The rate field now shows two decimals, and the example formula applies it as tax: ROUND(IF(Recurring, Amount * 12, Amount) * (1 + Rate), 2) = 3450. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
lucaslyl
left a comment
There was a problem hiding this comment.
[Claude Code 🤖] Scope: read the full diff (9 files) against the checked-out head, traced cardToBxlInput, the link helpers and evaluateBxlSafe/prepareBxlSafe in the bxl package, and ran Burcu's UI review procedure (steps 0 to 9) over the added .gts templates and <style scoped> blocks. Contrast was judged by token pairing only (--destructive-ink, --success-ink, --muted-foreground on the card surface), not measured. Nothing was rendered or executed, so the evaluation results (including the sandbox's 3450), the live link behavior and both themes are unverified.
Bottom line: safe to approve. No blocking issues; the open items are non-blocking.
Open items (all non-blocking):
- Nested links take a different path from the documented
{ id }shape (inline onutils/bxl-input.ts). - Deprecated
--boxel-sp-xxstoken name (inline onexpression-field.gts). - Repeated provider declarations and rem literals off the type ladder (inline on
formula-sandbox.gts). - Hand-rolled fitted view where
FittedCardapplies (inline onformula-sandbox.gts). - Two copies of the evaluate-and-wrap logic (inline on the command).
Red check: Lint fails only on TS2307 Cannot find module '@cardstack/bxl' in evaluate-expression-command.gts and expression-field.gts. That is the dependency this PR's Merges after: line waits on; the paired platform PR is open, targets main, and names this PR back under Merges before:. Ignore it until that PR merges, then re-run Lint; any other lint error would show alongside it, and ESLint and template lint both passed.
Pre-existing in the touched files (optional follow-ups): every file is new, so none. Optional: 24 of the 42 catalog fields have no co-located .test.gts, so this is not a blocker, but the link-id handling in bxl-input, the depth cutoff and the ok: false paths of the command are the logic a render test or command test would pin.
Read nested links by stored id, delegate the command to ExpressionField, use FittedCard for the sandbox's fitted view, and move literal sizes and deprecated spacing onto tokens. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…log-type-check # Conflicts: # utils/linked-id.ts
Important
Merge order: cardstack/boxel#6627, then this.
Merge cardstack/boxel#6627 first, then this right after. Until it lands, the catalog type-check can't resolve
@cardstack/bxl.Merges after: cardstack/boxel#6627
Background and Goal
The BXL formula blocks move from the matrix realm into the catalog on Pret UI (CS-13687). They were left out of the shared fields and tools wave because they import
@cardstack/bxl, which the catalog type-check resolves only once cardstack/boxel#6627 adds the dependency.fields/expression/) holds a BXL expression as data; Formula (fields/formula/) pairs a reader's label with an Expression and evaluates it against the owning card.commands/) evaluates an expression against a card and returns the result as JSON.utils/bxl-input.tsbuilds the expression's input from a card.fields/formula/example/), whose instance evaluatesROUND(IF(Recurring, Amount * 12, Amount) * (1 + Rate), 2)to 3450 (250 a month, recurring, with 15% tax).The first commit is the move and the second is the Pret UI pass.
Key decisions and non-obvious mechanics
bxl-inputreads the subject's own links by their stored id, so a link that hasn't loaded still reaches the expression as{ id }rather thannull.-inktokens for error and success text.<code>block; Pret Token is sized for short identifiers, not a formula.🤖 Generated with Claude Code