Skip to content

Persistence: givens are part of a table's key, and a builder gets a complete plan - #3173

Merged
mtoy-googly-moogly merged 7 commits into
mainfrom
persist-givens-binding
Oct 24, 2026
Merged

mtoy-googly-moogly merged 7 commits into
mainfrom
persist-givens-binding

Conversation

@mtoy-googly-moogly

Copy link
Copy Markdown
Collaborator

#3165 raised some issues; looking at the interactions between givens and persistence, it turned out there were more. This PR addresses:

  1. A better API for builders. runtime.getBuildTargets(model, {givens?, virtualMap?}) returns {connections, tagParseLog, unbuildable}: a persisted source whose SQL cannot be written is reported in unbuildable with the reason, and the rest of the model is planned. Each BuildTarget carries buildSQL(manifest), compiled under the same givens and virtualMap as its key, and readsGivens. PersistSource.getSQL() and makeBuildId() are deprecated for builders.
  2. Correct interaction of persistence and givens. The builder and the manifest lookup compile a table's key SQL with givens bound the same way, through one function. A table built for one value is never found by a query asking for another: that query misses and runs live, or fails under strict. Running getBuildTargets once per set of values builds the variants.
  3. New errors for uncomputable imported sources. Importing a persisted source whose SQL reads a given the importer does not surface, and that has no default, is a translate error at the import (unsatisfied-given-in-persist-source). A build with no value for a given reports runtime-persist-given-no-value, naming the given by this model's name for it.
  4. Docs and the sample builder follow: doc/persist/api.md, internal.md, the api, foundation, and lang CONTEXT files, and scripts/simple_builder.

Behaviour change for builders: a model that used to fail getBuildTargets outright now plans with fewer targets; a builder that relied on the throw reads unbuildable.

Replaces #3165. Resolves #3041.

…omplete plan

The builder and the manifest lookup compile a persisted source's key SQL
with givens bound the same way, through one function, so a table built for
one value is never found by a query asking for another. getBuildTargets
takes a build's givens and virtualMap over the Runtime's, reports a source
whose SQL cannot be written in `unbuildable` instead of failing the plan,
and each target produces its own build SQL under the options that keyed it.
Importing a persisted source that reads a given the importer cannot supply
is a translate error.
…s point, not explain

internal.md is reorganized around what has to stay true (one key both
sides, key SQL differs from executed SQL only by substitution, the walk's
path list, identity not leaking through derivation, canonical names,
digests computed not stored), then the design decisions, then a map of the
pieces with addresses in place of step-by-step walkthroughs. Both persist
docs name this directory and the code as the design of record. CONTEXT
entries and two JSDoc comments shrink to what the code cannot say; the
strict-miss message for a given-reading source says what to check.
@mtoy-googly-moogly
mtoy-googly-moogly merged commit a63c7e0 into main Oct 24, 2026
21 checks passed
@mtoy-googly-moogly
mtoy-googly-moogly deleted the persist-givens-binding branch October 24, 2026 18:12
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.

persist: a source depending on a supplied given fails with an error that names neither persistence nor the given

1 participant