Skip to content

v0.10.0

Choose a tag to compare

@github-actions github-actions released this 26 Oct 17:53

Release v0.10.0

📦 NPM packages

🐳 Docker image

docker pull ms2data/malloy-publisher:0.10.0
docker pull ms2data/malloy-publisher:latest

ℹ️ Details

  • Release branch: release/v0.10.0
  • Triggered by: @housejester

Malloy 0.0.436: time-zone reads, refinements that keep their ordering, and booleans on SQL Server

Publisher now builds on @malloydata/* 0.0.436, up from 0.0.435. The changes that reach a running server:

  • A query that sets a time zone reads dates and times in that zone throughout (malloydata/malloy#3145). Extraction, truncation, calendar offsets and casts to a date convert the instant to the query zone's clock first, on every dialect. Three results can change: a cast between timestamp and timestamptz keeps the instant instead of consulting the zone; truncating to the hour in a zone with a half-hour offset reads that zone's clock; and a filter on a date column, in a zone east of UTC, reads its day boundaries in that zone.
  • A refinement keeps the view's written order_by (malloydata/malloy#3136). A refinement that set only a limit dropped the view's ordering, and a view refined by name lost its ordering to the next inline refinement. Both now keep it, so rows from such a query can come back in a different order.
  • On SQL Server, a boolean is a condition and never a value (malloydata/malloy#3147). A boolean used where SQL Server needs a value (a result column, a group_by, a function argument, a cast, = or != against another boolean) is a compile error at that expression, naming what to write instead, such as pick 'yes' when is_small else 'no'. select: * leaves a boolean field out with a warning. A filter that compiles to a constant, such as in over an empty given, now runs on SQL Server.
  • A SQL Server datetimeoffset column is a timestamptz (malloydata/malloy#3138), read at UTC or in the query's time zone rather than at the offset it was written with.
  • Importing a persisted source without the given its SQL reads is a compile error (malloydata/malloy#3173). When a model imports a #@ persist source whose SQL reads a given with no default, and the model does not surface that given, it fails to compile with unsatisfied-given-in-persist-source. Import the given alongside the source. Publisher refuses to build a persisted source whose SQL reads a given, so no built table is affected.

A where: across a join to a query source or composite is served when untouched and refused when rebound

A package source whose where: read a field joined from a query source (for example source: pipeline_now is deals extend { where: is_open } where is_open is deal_first_close.close_type is null and deal_first_close is duckdb.sql(...) -> { ... }) was refused with 403 Access denied for source "pipeline_now", even when nothing had been modified. Malloy names a query source afresh on every compile, so the row-security binding check could not match the served source against the package's own compile of the same file. It now compares a query source by what it queries, so the same shapes serve whether the query source is joined directly, built on another query source, declared with extend: { join_one: ... } inside its own query, built on a parameterized source, or a composite member, and whether the where: was inherited across files or not.

A where: that reads a field through a joined composite whose members are plain sources (join_one: cmp where cmp is compose(a, b)) was refused too, and now serves when nothing was modified. Re-joining that alias to a different composite, to a composite in another member order, to one of its members directly, or with another join type is refused. A query source whose base is an inline extend { where: ... } (directly, joined into another source, or through a named query) serves when untouched and is refused when rebound. That holds over a table or compose base (named, or written inline in the query source), with several where: conditions or chained where:s, when the source is selectively imported (import { s } from "mid.malloy") from the file that built it, and for the caller's own ad-hoc where: on a field the caller defines.

The same check now looks where it did not: inside a query source's base, and inside a join a query stage adds (run: x -> { extend: { join_one: d is ... } ... }, a nest's or a view's stage, a query source's own stages). A where: there that was written against one field but now reads a different one, because rename: or except: freed up its name and a later dimension: reused it, used to answer with the wrong rows and is now refused with the same 403. Direct use of such a source was already refused. /compile now applies the same inherited-where: check as a query, so it refuses a misbound source instead of reporting it clean; a row-level gate is checked only when a query runs. Files whose names need URL encoding (spaces, [, ~) are matched correctly.

An inline where: may read a field the same chain defined before it (extend { dimension: z is ...; where: z }, or except: then a redefinition then the where:), including through a join the chain added with on; it serves when every field it reads was defined before the where: and is refused when any of them is rebound afterwards. That also refuses the restore chain (rebind, where:, except:, redefine back) and a rebind in the same statement as the where:, but only for run targets, a query source's base, and a named query. A plain declared source: s is X extend { where: ... } { rebind } is still served, and so are the same shapes reached through a joined source or a stage join. A rebind written entirely inside one query source over an anonymous base (duckdb.sql(...), duckdb.table(...)) is served too, as it is on main and through a named query: the base is the query's own text, so nothing earlier exists to compare it with. A where: written before the dimension: it reads, in one block (X extend { where: z; dimension: z is ... }), is refused over a named base, because the compiled source records no block boundary and cannot tell it from a restore; over an anonymous base it serves. A rebind reached through a field the base itself defines is still refused.

Still refused with 403, because the check cannot prove them bound:

  • a source derived in a different package file from the model being queried, where the where: was declared in a file outside the package (direct use, a same-file extend, a caller extend and a same-file query source all serve);
  • a composite member that filters its own rows with a where:;
  • a row-level gate or #(filter) that reads a field through a joined composite, and a caller join of a gated source whose gate does: the member Malloy resolves depends on the caller's query, so the gate cannot be shown to bind to the member it was written for;
  • an import whose path differs from the file's real name only by letter case;
  • a query source over a named base, selectively imported (import { s } from ...) from a file outside the package.

If a package that queried through one of these shapes starts returning 403, look for a source derived with rename:/except: followed by a redefinition of the name its inherited where: reads, or a named base extended with { where: z; dimension: z is ... } in one block (move the where: after the dimension:).

A where: through a composite is evaluated against the member Malloy picks for the query (the first member holding every field used), so a composite's members must hold the same rows; that is Malloy's behaviour, not a rebinding the check can see.

What's Changed

  • chore(release): 0.9.16 by @kylenesbit in #1460
  • fix(builder): scroll a sized text tile's prose as the reader does, and round a text tile's placement up by @kylenesbit in #1459
  • feat(runtime): infer environment/package under /apps/// too by @girishjeswani in #1462
  • feat(sdk): commit text, number, date and slider givens once typing or dragging settles, and keep every echo of a report in flight from moving the anchor by @Sha-Bang in #1463
  • chore(deps): clear fixable Trivy findings and remove dead dependencies and code by @Sha-Bang in #1468
  • fix(server): read a package data file whose name has a space by @jswir in #1445
  • fix(server): release a query's concurrency slot when the handler ends the response, not only on finish/close (Bun 1.3.13 leaked one per abandoned query) by @sagarswamirao in #1470
  • fix(server): serve a where: across a query-source join, and prove an inline where:'s base by location and definition by @Sha-Bang in #1464
  • chore(deps): upgrade @malloydata/* to 0.0.436 by @housejester in #1475

Full Changelog: v0.9.16...v0.10.0