Skip to content

fix(cq): send a complete definition when pausing a continuous query - #92

Merged
xe-nvdk merged 1 commit into
mainfrom
fix/cq-pause-full-definition
Oct 4, 2026
Merged

xe-nvdk merged 1 commit into
mainfrom
fix/cq-pause-full-definition

Conversation

@xe-nvdk

@xe-nvdk xe-nvdk commented Oct 2, 2026

Copy link
Copy Markdown
Member

Fixes #91. Draft on purpose — holding until Basekick-Labs/arc#1023 decides whether Arc keeps strict full-replace semantics on PUT or grows a merge route for a single field. This fix is correct under either outcome (a complete definition is always accepted), so it is ready whenever that lands; ships with Arc 26.09.3.

The break

PUT /api/v1/continuous_queries/:id replaces the stored definition — Arc writes every column from the body. The pause toggle sent one field:

await client.updateContinuousQuery(query.id, { is_active: !query.is_active });

Against current Arc that is 400 database is required (Basekick-Labs/arc#993; Basekick-Labs/arc#1022 adds name, both measurements, query and interval to the required set), surfaced to the user as a toast. Before #993 it was worse than an error: the PUT succeeded and blanked the name, both measurements, the query and the interval of the query being paused.

The toggle now sends the definition the component already holds with is_active flipped, through a new continuousQueryDefinition helper in arcClient.ts — one place that knows what a complete body is, rather than the knowledge living in each call site. updateContinuousQuery now takes a full CreateContinuousQuery instead of Partial<CreateContinuousQuery>, so a sparse caller fails to compile rather than at runtime.

One data-integrity fix alongside it

tag_columns was missing from both interfaces, and the edit form never sent it. Since Arc overwrites the column from the body, saving an edit dropped it — losing the metadata compaction uses to dedup that query's output (Basekick-Labs/arc#521). The type now declares it, the edit path carries the stored value through, and the helper includes it. Not exposed in the form; that would be a feature, and the point here is only to stop silently discarding it.

Test plan

  • npm test — 233 pass, 4 new covering the helper: every required field present, the overwritten-but-not-required fields preserved, a flipped is_active not losing the rest, and optional fields omitted rather than sent as null
  • npm run check — 0 errors; the 10 warnings are pre-existing a11y ones in other files, none in the files touched here
  • Verified against a local Arc build carrying arc#1022: the exact body the fixed toggle sends returns 200 with the definition intact (db1 cpu -> cpu_1h, is_active flipped). The old one-field body returns 400.

Also affects

arc-cloud ships the same component pair, with the same two bugs — a matching PR is up there.

PUT /api/v1/continuous_queries/:id replaces the stored definition: Arc writes
every column from the body, so a field the body omits is stored blank or
zeroed. toggleQueryActive sent { is_active } alone, which Arc now refuses
outright with "database is required" (Basekick-Labs/arc#993, and #1022 adds
the other five required fields) — before that it quietly blanked the name,
both measurements, the query and the interval of the query being paused.

The toggle now sends the definition the component already holds with is_active
flipped, via continuousQueryDefinition in arcClient, so one place knows what a
complete body is. updateContinuousQuery takes a full CreateContinuousQuery
rather than a Partial, so a sparse caller fails to compile instead of at
runtime.

Also carries tag_columns: Arc returns and overwrites it, the type did not
declare it and the edit form did not send it, so saving an edit dropped the
metadata compaction uses to dedup that query's output (arc#521).
@xe-nvdk
xe-nvdk marked this pull request as ready for review October 4, 2026 16:50
@xe-nvdk
xe-nvdk merged commit 7acaf51 into main Oct 4, 2026
3 checks passed
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.

Pausing a continuous query sends a partial PUT, which Arc now refuses

1 participant