Skip to content

Move build to getBuildTargets - #259

Merged
mtoy-googly-moogly merged 3 commits into
mainfrom
persist-build-targets
Aug 11, 2026
Merged

Move build to getBuildTargets#259
mtoy-googly-moogly merged 3 commits into
mainfrom
persist-build-targets

Conversation

@mtoy-googly-moogly

@mtoy-googly-moogly mtoy-googly-moogly commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

malloy-cli build moves to Runtime.getBuildTargets, the first checkbox on
malloydata/malloy#3029. That PR deprecated Model.getBuildPlan because it reports
sources while the manifest is keyed by table, and the two are not one to one — a
builder on it has to compute the BuildIDs, find the collisions, and order the walk
itself, and this one got parts of that wrong. Needs @malloydata 0.0.429, bumped here.

Getting tables instead of sources settles half of the identity question; the other half
is that buildFiles plans one file at a time, so a collision between two files is
invisible to any single BuildTargets. TableClaims closes that, in both directions.

Impact

  • Within a run, one BuildID builds one table and one table is built by one BuildID, and
    both directions are now errors naming every declaration site. Two names for one build
    used to let one win silently across files — the loser was reported "up to date". Two
    builds under one name still both ran, one overwriting the other, leaving two manifest
    entries aimed at a table holding only one of the two computations. Under strict: true
    that substitutes into queries rather than falling back to inline SQL.
  • The canonical table name from sqlValidateTableName is now computed once and used for
    both the CREATE TABLE and the manifest entry. They could previously diverge for
    DuckDB's file-path form, which Manifest.update would then reject — reported as a
    build failure after the table had already been created.
  • --refresh reports keys that matched no table, and accepts a renamed source under
    either its old or new name. A stale or mistyped key used to be a silent no-op behind a
    row of "up to date".
  • A planning failure is reported rather than read as "this file doesn't use
    persistence".

Update @malloydata packages to 0.0.429 and port `malloy-cli build` from the
deprecated `Model.getBuildPlan` to `Runtime.getBuildTargets`, which answers in
tables rather than sources.
A BuildID is one table, but buildFiles plans each file separately, so two
files whose sources compile to the same SQL under different name= values
never appear in one BuildTargets result. The second file found the first's
manifest entry, reported "up to date", and its own table was never built.
Track what each BuildID has been named for the whole run.
The claims map guarded only one direction: two names on one BuildID was an
error, but two BuildIDs under one name built both and let the second
overwrite the first, leaving two manifest entries aimed at a table holding
one of the two computations. TableClaims owns both directions and one
message.

Also: --refresh now reports keys that matched nothing and accepts a renamed
source under either name; the conflict message says how to get unstuck; and
the source-plus-extension test asserts the merged build line, which it has
to, since the manifest looked the same before this PR.
@mtoy-googly-moogly
mtoy-googly-moogly merged commit a864680 into main Aug 11, 2026
5 checks passed
@mtoy-googly-moogly
mtoy-googly-moogly deleted the persist-build-targets branch August 11, 2026 01:29
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