Skip to content

fix(plugins): default AML field references to the new r() syntax#20

Merged
datbth merged 3 commits into
mainfrom
fix-field-ref-syntax
Jun 19, 2026
Merged

fix(plugins): default AML field references to the new r() syntax#20
datbth merged 3 commits into
mainfrom
fix-field-ref-syntax

Conversation

@khaito241

@khaito241 khaito241 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Problem

When asked to build a dashboard FilterBlock/VizBlock, the skill agent emitted the old field-reference syntax ref('model', 'field') instead of the new r(model.field) syntax (https://docs.holistics.io/release-notes/2025-08-field-ref-validation). ref() still works, but new code should use r(), which the AML compiler statically typechecks.

In references/aml/type_definitions/data_model.aml, Func ref(model_name, field_name) had a full, copyable signature while Func r() {} was an empty stub — so when the agent traced the type defs (FieldFilterSource.field: FieldRef → a defined function), it copied ref(). The dataset example also used ref('...') in its permission blocks, reinforcing it.

Changes

All edits are made in the holistics-common source and propagated to holistics-development / holistics-reporting via pnpm sync-links (those references/ dirs are linked copies — hence the 3× file count).

  • data_model.amlr() is now the documented, canonical builder; ref() is marked legacy. Added a field-kind taxonomy comment covering how to reference each:
    • model dimension/measure → r(model.field)
    • dataset metric → r(dataset.metric)
    • dataset dimension → r(dataset, model.dimension)
    • adhoc calculation (defined in a viz) → bare string 'name', not r()
  • dataset.aml — one-line pointers on Type Metric / Type DatasetDimension identifying them as dataset fields and pointing to Func r() for reference syntax.
    • demo_ecommerce.dataset.aml — converted the 3 permission examples from ref('...', '...') to r(...).
    • car_retails.page.aml — added a FilterBlock (the exact construct the agent got wrong) plus a DataTable that demonstrates every reference form (model field, dataset metric, dataset dimension two-arg, and adhoc-calc-as-string), with inline comments.

Verification

  • grep -rn "ref('" plugins/ | grep -v "rel_config\|relationship(" → no matches.
  • All three plugins' copies are byte-identical (synced from holistics-common).

@khaito241 khaito241 requested a review from datbth as a code owner June 19, 2026 04:20
@datbth datbth force-pushed the fix-field-ref-syntax branch from 534c551 to 12b364d Compare June 19, 2026 04:36
khaito241 and others added 3 commits June 19, 2026 11:37
instruct AI to use the new field ref syntax

add update r() for reporting skills

Update FieldRef documentation to promote new r() syntax over ref()

add more details on the field ref in dataset field and model field

update notes on adhoc metric and dataset field reference
@datbth datbth force-pushed the fix-field-ref-syntax branch from 12b364d to 8f5cb2a Compare June 19, 2026 04:39
@datbth datbth merged commit 112620d into main Jun 19, 2026
3 checks passed
@datbth datbth deleted the fix-field-ref-syntax branch June 19, 2026 04:40
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.

2 participants