Hey,
Let's try to complete the week 5 tasks.
Check the current state, plan out the tasks [based on priority and dependency], then start the execution.
You can be the orchestrator, and deligate the task to other models [haiku/sonet/opus] based on complexity and nature of the task.
Assistant
I'll start by checking the current state — the v1.1 cycle plan in docs/progress.md and any open Week 5 issues — then lay out a dependency-ordered plan before executing.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Three exploration agents are running. Meanwhile, let me pull the remaining issue details and check whether the local stack is up.
Assistant
While the explorers work, I'll verify the test baseline runs clean in the background.
Assistant
Baseline test run is going in the background. I'll wait for the exploration reports to come back before finalizing the execution details — the three agents are mapping the monitor engine, the authoring UI, and the results/connections surfaces now.
Assistant
Baseline re-running with infra up. Waiting on the three exploration agents now.
Assistant
scripts/test-backend.sh is the canonical runner — it loads .env and points tests at a dataq_test database. Running that as the true baseline.
Assistant
Baseline running via the canonical script. Still waiting on the three exploration agents before starting implementation.
Assistant
The backend map is in — and it surfaced something valuable: the repo has a purpose-built skill (.claude/skills/new-monitor-kind/SKILL.md) written specifically for adding the anomaly kind, and the monitor_baselines table already anticipates it (no new migration needed). CHECK_KINDS already admits "anomaly"; the work is code-only across the registry, run path, authoring gate, dry-run, and UI.
I'll start execution now with #568 (threshold-ordering validation) — it's small, upstream of #593's threshold semantics, and I have the full backend map for it. Delegating to a Sonnet implementer in an isolated worktree.
Assistant
Five implementation agents are now running in parallel, each in an isolated worktree with its own test database:
Task
Model
Branch
#568 threshold-ordering validation
Sonnet
fix/issue-568-threshold-ordering
#593 anomaly kind (backend)
Opus
feature/issue-593-anomaly-kind
#349 results fetch dedupe + shared presets
Sonnet
fix/issue-349-results-fetch-dedupe
#351 draft-connection test
Sonnet
feature/issue-351-draft-connection-test
#424 redaction header truth
Sonnet
fix/issue-424-redaction-header
Held back deliberately: #593 UI + #594 (stack on the #593 backend), #283 (would three-way-conflict with #568/#593 in check_service.py), #345 (shares RunDetail.tsx with #424). They launch as their dependencies merge.
For #593 I gave the Opus agent a full design brief: stateful registry entry reusing the monitor_baselines table (no migration — the table was designed for this), self-contained measurement (target_metric: row_count | freshness_age_hours reusing the existing statement builders), rolling-window z-score with optional day-of-week seasonality, baseline JSONB holding the observation window, per-check skip on cold start (a small, deliberate extension of the outcome→result mapping), and thresholds banding the z-score through the unchanged ADR-0016 path.
As each agent reports back, I'll review the diff, run the gate serially, push, open the PR, and spawn /code-review per the working agreements.
User
8. Existing tests for monitor kinds — files and fixture patterns
backend/tests/datasources/test_monitors.py (529 lines, pure unit tests, no DB) — the reference test shape for a scalar-and-registry-level monitor kind:
build_monitor_statement/SQL-rendering tests (_snowflake_sql helper compiles against snowdialect.SnowflakeDialect() to assert emitted SQL text) — identifier-quoting tests (mixed-case, reserved words, three-part names, injection rejection) are extensive (test_freshness_quotes_a_mixed_case_column, test_bad_identifiers_never_reach_the_emitted_sql, etc.).
Driver-boundary adversarial-type tests: test_freshness_accepts_a_date_column, test_freshness_naive_timestamp_assumed_utc, test_freshness_accepts_an_iso_string_scalar, test_freshness_accepts_an_iso_string_with_an_offset, test_freshness_refuses_an_unparseable_string — pattern to follow for an anomaly metric's driver-typed inputs (Decimal, NaN, etc. per the skill's §9 checklist).
backend/tests/services/test_schema_drift.py (567 lines) — the reference for a stateful kind's test shape: pure diff tests (test_diff_no_drift, test_diff_added_removed_and_type_changed, test_diff_ignore_columns_is_case_insensitive), per-datasource introspection tests (test_sql_introspection_*, test_file_introspection_*, ), and executor/baseline-store tests: , , , , (ON CONFLICT DO NOTHING race), , . This is the closest precedent set for 's baseline-store tests.
User
7. Dry-run preview handling by monitor kind
backend/app/services/dryrun_service.py:
dry_run_check(connection, *, kind, expectation_type, config, warn_threshold, fail_threshold, critical_threshold, target, secret_store) -> DryRunOutcome (lines 71-...): explicitly branches if kind == SCHEMA_DRIFT: return _dry_run_schema_drift(...) (line 97-100); if kind != _EXPECTATION_KIND: raise DryRunUnsupportedError(...) (line 101-105) — so any kind other than expectation/schema_drift is currently a 422 at dry-run time. This is where anomaly needs its own if kind == ANOMALY: return _dry_run_anomaly(...) branch (mirroring _dry_run_schema_drift at line 217-282, which validates config, introspects/queries live state, and returns a DryRunOutcome without persisting), or it must explicitly stay in the DryRunUnsupportedError fallthrough per the skill's DoD checklist ("unsupported kinds must raise DryRunUnsupportedError, not fall through").
DryRunOutcome dataclass (lines 63-68): status, metric_value, observed_value, expected_value — reuses severity.resolve_status so a preview matches a real run.
User
6. Per-kind check config validation
Structural (DB-free) validation:backend/app/datasources/monitors.py, validate_monitor_config(kind, config) -> None (dispatches to _strategy(kind).validate_config), each kind's _validate_<kind> function:
_validate_freshness (line ~275) → freshness_column(config) — validates the optional column key as a SQL identifier via _ident.
_validate_volume (line ~330) → _volume_bounds(config) — validates min_rows/max_rows as non-negative ints with min_rows <= max_rows.
_validate_schema_drift (line ~350) → validates optional ignore_columns as a list of identifiers.
An anomaly config (window size, sensitivity, target metric) would get its own _validate_anomaly(config: dict[str, Any]) -> None here, raising MonitorConfigError on bad shape, then registered as the validate_config field of its MonitorKindStrategy entry.
_V1_SUPPORTED_KINDS = {"expectation", *MONITOR_KINDS, COMPARISON_KIND} (line 72) — since MONITOR_KINDS currently = {freshness, volume, schema_drift}, anomaly is not yet authorable even though it's schema/CHECK-constraint-valid (module docstring lines 10-15 confirms this is deliberate: "schema_drift/anomaly remain schema-valid but refused"). Adding anomaly to MONITOR_KIND_REGISTRY in monitors.py automatically widens _V1_SUPPORTED_KINDS (it derives from MONITOR_KINDS).
validate_kind(kind) (line 136) — the general "kind is in _V1_SUPPORTED_KINDS" 422 gate.
validate_monitor_check(kind, config, *, expectation_type, connection_type, fail_threshold, critical_threshold) (lines 195-262) — the freshness/volume/schema_drift-shaped authoring validator: (1) datasource-capability gate via MONITOR_CAPABLE_TYPES (scalar) or SCHEMA_DRIFT_CAPABLE_TYPES (stateful, line 224-234 — selects the capability set by kind in STATEFUL_MONITOR_KINDS, so anomaly as a stateful kind would need its own frozenset here or reuse ); (2) must equal ; (3) config-shape via ; (4) kind-specific extra gates (freshness's column/threshold requirements at lines 251-262 — an kind would likely need an analogous "needs at least N historical points" or "needs a target metric configured" gate here).
User
5. skip status path (#297/#298)
RESULT_OPERATIONAL_STATUSES = ("skip", "error") (backend/app/db/models.py:48) — orthogonal to the four severity tiers (pass/warn/fail/critical), excluded from health-score N, no penalty weight.
skip is a run-level, not a per-monitor, concept in this codebase: it means "the whole run had nothing to evaluate" (e.g., a flat-file batch hasn't landed yet), not "this one monitor kind decided to skip itself." Persistence: backend/app/services/run_service.py:332-354, skip_run(session, *, run, checks, reason) -> Run — sets run.status = "running" → commits every check a Result(status="skip", observed_value={"reason": reason}) → run.status = "succeeded". The run still succeeds; only its results are all skip.
Called from exactly one place: backend/app/worker/tasks.py:165 — run_service.skip_run(session, run=run, checks=checks, reason="batch_not_found") (flat-file batch resolution failure).
Rendering: backend/app/services/run_service.py:426-447 computes per-run (has_error, has_skip) flags over "operational" statuses for run-list badges; worst_severity() (line 65-74) explicitly never ranks pass/skip/error.
For anomaly, if a per-check "not enough baseline history yet" case should map to skip rather than pass/error, note that today skip is only produced at the whole-run granularity via skip_run, never per-check inside _build_result/CheckOutcome. A per-check anomaly "insufficient history" case would need either (a) a new errored=False/special outcome path that _build_result maps to skip per-check (not currently supported — _build_result only derives error from outcome.errored and the four tiers from resolve_status), or (b) treat it as the schema_drift precedent does for "first run" — a passing "baseline captured" result rather than a skip. Tests referencing skip: backend/tests/integration/test_datasource_runs.py:218, backend/tests/services/test_run_service.py:541, backend/tests/worker/test_tasks.py:312, backend/tests/api/test_runs.py:386-389.
User
4. Historical metric_value series / results table schema
Result model:backend/app/db/models.py:696-726, table results.
Indexes (__table_args__, lines 698-701): Index("ix_results_run_id", "run_id"), Index("ix_results_check_id", "check_id") — no dedicated metric_value index; time-series queries join through Run.created_at.
Existing query for a check's historical metric series (the exact shape an anomaly baseline would build on internally, or query to compute its own rolling stats): backend/app/services/check_service.py:842-873, list_check_result_history(session, suite_id, check_id, *, limit=30) -> list[CheckResultPoint]:
rows reversed to chronological order. Surfaced via API at backend/app/api/v1/checks.py:336 (list_check_result_history endpoint). This pattern — join results → runs on run_id, filter check_id + suite_id, order by Run.created_at — is the query shape an anomaly monitor's baseline-refresh logic (or its own trend computation) should reuse rather than reinvent.
User
3. ADR 0016 severity thresholds → status banding
Where thresholds live: columns on Check (backend/app/db/models.py:513-515): warn_threshold, fail_threshold, critical_threshold — all Mapped[Decimal | None] = mapped_column(Numeric). NOT JSONB — plain nullable NUMERIC columns, one check = up to 3 thresholds, kind-agnostic (any kind can set them). Mirrored on CheckVersion (lines 611-613) for history snapshots.
extract_metric(outcome: CheckOutcome) -> Decimal | None — prefers outcome.metric_value (monitor kinds set this directly); else falls back to GX's unexpected_percent from sample_failures. Uses Decimal(str(raw)) for exactness; treats non-finite (NaN/inf) as "no metric."
derive_status(*, success, metric_value, warn_threshold, fail_threshold, critical_threshold) -> str — the pure banding function: metric_value >= critical_threshold → "critical", else >= fail_threshold → "fail", else >= warn_threshold → "warn", else "pass"; unset thresholds treated as +∞; no thresholds or no metric → binary pass/fail from success.
resolve_status(outcome, *, warn_threshold, fail_threshold, critical_threshold) -> tuple[status, metric] — the single entry point both run_service._build_result and dryrun_service call, so a dry-run preview can never disagree with what a real run would persist. outcome.errored=True short-circuits to ("error", None) — no tier, no metric.
For anomaly, the same thresholds field reuse applies: whatever scalar the anomaly strategy's outcome() sets as CheckOutcome.metric_value (e.g. a z-score, or a deviation-from-baseline percent — "higher = worse" per the repo's stated convention) gets banded by the same generic derive_status, no new severity code needed — this is explicitly the ADR 0016 design ("the model generalizes to v1.x freshness/volume monitors ... also 'higher = worse' scalars," docs/adr/0016-severity-derivation-semantics.md:39).
User
2. schema_drift (#592) baseline persistence shape (PR #876) — the shape #593 (anomaly) must reuse
Model:MonitorBaseline in backend/app/db/models.py:530-569, table monitor_baselines.
Columns:
id (UUID PK)
check_id — FK checks.id, ondelete="CASCADE", not null
kind — String(32), not null, denormalized from the check for queryability; check's own kind is the authority
baseline — JSONB, not null — kind-shaped payload; schema_drift stores {"columns": [{"name": ..., "type": ...}, ...]}. anomaly (#593) is explicitly documented (line 536) to reuse this exact shape for its "metric-baseline parameters" JSONB
captured_by — nullable FK users.id, ondelete="SET NULL"; NULL = run path captured it automatically (first run); non-NULL = manual re-baseline actor
created_at, updated_at (standard)
Constraints (__table_args__, lines 548-551):
UniqueConstraint("check_id", name="uq_monitor_baselines_check") — one CURRENT baseline per check; a re-baseline REPLACES the row (no history kept here — history lives in results).
_in_check("kind", CHECK_KINDS, "kind_valid") — CHECK constraint against the shared CHECK_KINDS vocabulary (which already admits "anomaly").
Migration:backend/app/alembic/versions/e2f3a4b5c6d7_add_monitor_baselines.py — creates the table exactly as above, with a frozen copy of CHECK_KINDS (line 40: _CHECK_KINDS = ("expectation", "freshness", "volume", "schema_drift", "anomaly", "comparison") — migrations never import live app code). Its docstring literally states: "Designed for TWO consumers: ... the W5 anomaly kind (#593) stores its metric baseline parameters in the same shape, so the payload is a kind-shaped JSONB — one persistence shape, no second table later." This confirms no new migration is needed for 's baseline storage — only a differently-shaped JSONB payload under the same table/columns.
MONITOR_KIND_REGISTRY: dict[str, MonitorKindStrategy] (dict literal, import-time only) — freshness/volume have a build_statement; schema_drift has build_statement=None (routes it to the stateful path instead of the scalar SQL path).
Derived tuples (also import-time, never mutated): MONITOR_KINDS, SCALAR_MONITOR_KINDS (kinds with build_statement is not None), STATEFUL_MONITOR_KINDS (kinds with build_statement is None).
Evaluation-function shape:
validate_config(kind, config) -> None — raises MonitorConfigError (DB-free structural gate, used both at authoring time and defensively at run time).
build_monitor_statement(kind, *, table, schema, catalog, config) -> Select[Any] — SQLAlchemy Core statement (never a raw SQL string, per #476 identifier-quoting discipline); raises if the kind has no scalar-SQL form.
monitor_outcome(kind, *, scalar, config, now) -> CheckOutcome — turns the scalar aggregate result into CheckOutcome (backend/app/datasources/base.py), which carries expectation_type, success, metric_value: float | None, observed_value, expected_value, sample_failures, errored, error_message.
monitor_expectation_type(kind) -> str — canonical "monitor:<kind>" string, single source of truth shared by run path, authoring, and frontend catalog.
Per-kind functions (the freshness/volume "reference shape" a new strategy should mirror):
Assistant
#568 came back clean with strong evidence (3068 backend / 689 frontend tests green, mutation-checked both directions). Let me review its diff before pushing.
Assistant
Backend diff is idiomatic and correctly scoped. Spot-checking the frontend rule wiring:
Assistant
Frontend mirrors the backend rule correctly with proper antd dependency wiring. Approving — pushing and opening the PR.
Assistant
#349 is done too. First, spawning the required /code-review on PR #1113, then reviewing #349's diff.
Assistant
PR #1113 is eligible. Launching the 5 parallel Sonnet reviewers (step 4):
Assistant
Posting the review comment (step 8), then fixing the finding in the same PR per working-agreement rule 5:
Assistant
Comment posted. Sending the fix back to the #568 agent (it has full context):
Assistant
While #568's fix lands, reviewing #349's diff:
Assistant
#349 is clean. Pushing and opening its PR:
Assistant
Now reviewing #424's diff before pushing:
Assistant
Now reviewing #351's diff:
Assistant
Now reviewing the #593 backend diff — the biggest and most important change of the week:
Assistant
The core engine is high quality. Spot-checking the registry entry and the per-check skip path:
Assistant
Now checking #1113's CI after its fixup, so the merge train can start:
Assistant
All 14 checks green on #1113. Squash-merging it, then verifying the issue state:
Assistant
Both eligible. Launching the 10 reviewers (5 per PR):
Assistant· <synthetic>
You've hit your session limit · resets 7:20pm (America/Vancouver)
User
continue...
Assistant
#1114 is fully green — merging it now, then dispatching all the fix/resume work in one go:
Assistant
All seven workstreams are now in flight simultaneously:
PR / task
State
#1113 (#568)
Merged, issue closed
#1114 (#349)
Merged, issue closed
#1115 (#424)
Agent applying 2 small review fixes (tracker catch-all under-report, stale comment)
#1116 (#351)
Agent resumed mid-fix (stale badge reset + optionalSecret seam); #1118 filed for the pre-existing secret-ref exposure
#1117 (#593 backend)
Agent applying 4 review fixes (baseline update race, frozen captured_at, dropped unparsed_value diagnostic, stale status comment)
#593 UI + #594 trend view
Both agents resumed on their stacked branches
#283 restore + #345 PDF
Fresh implementers launched off main
The #1117 review round was particularly productive — three independent reviewers converged on the baseline lost-update race and the dropped diagnostic payload, both real concurrency/consistency defects worth catching pre-merge. As agents report back I'll verify, push, merge the train in dependency order (#1115/#1116/#1117 → stacked UI/#594 → #283/#345), then do the batch close-out: progress.md W5 ticks, CLAUDE.md §5 ("anomaly" is no longer reserved) + §13 headline, and issue-state verification. One item stays deliberately open at the end: the anomaly kind's feature-matrix cells remain ⏳ until a live Snowflake/UC run verifies the driver-boundary path (the #953 lesson) — I'll surface that as the week's remaining action.
Assistant
#1115's fixes are in and pushed. Checking its CI to keep the merge train moving:
Assistant
#1117's four fixes are in — with wire-level FOR UPDATE assertions and 8/8 mutations killed. Watching its CI alongside #1115's:
Assistant
Both CI watches are running in the background. Waiting on those and the five remaining implementation agents.
Assistant
#594 is done — clean design (second-panel overlay with the z-score/raw-unit separation argued correctly, a11y table fallback, wire tests). Since its branch isn't pushed yet, I'll hold it until #1117 merges, then rebase it directly onto main — that avoids the stacked-PR-after-squash-merge conflict dance entirely. Same plan for the #593 UI branch. Waiting on the CI watches and remaining agents.
Assistant
#1116's fixes are in — including the proper secret_optional seam with explicit None-guards on the six mandatory-secret adapters. Watching its CI too:
Assistant
Three CI watches running (#1115, #1116, #1117). Still working: #593-UI, #283, #345. As CI goes green I'll merge in order, rebase the stacked branches onto main, and open their PRs.
Assistant
#1115 merged and #424 closed; the #593 UI branch is done too (catalog entry with a generic showWhen field mechanism, stripped on the payload side to satisfy the backend's strict column rejection — the right call). Both stacked branches (#593-UI, #594) are ready and waiting for #1117 to merge. Remaining in flight: #1116/#1117 CI, #283, #345.
Assistant
Rebase complete. Verifying the conflict resolution with the frontend suite (background) while merging #1116:
Assistant
Just the two new test fixtures missing #1115's required fields. Patching:
Assistant
PR #1119 is open. Running its 5-reviewer flow directly (it was just opened by me — eligibility is known):
Assistant
Review comment posted on #1119 and the four fixes dispatched. Current state of the board:
Merged: #1113 (#568), #1114 (#349), #1115 (#424), #1116 (#351), #1117 (#593 backend) — all four closed issues verified, #1118 filed for the pre-existing secret-ref exposure.
In review/fix: #1119 (#593 UI) — the reviewers found the min_points↔window coupling gap and the zero-threshold client-rule footgun; both being fixed in-PR now.
Queued for the train: #594 (done, rebases after #1119 merges), #345 (done, rebases after #594), #283 (still implementing).
Then: anomaly live verification against real Snowflake/UC via the local-worker-with-Key-Vault path (read-only measurement probes — the driver-boundary types are exactly what unit tests can't prove), and the batch close-out docs commit.
Assistant
#283 is done — and the agent caught a genuine design trap (PATCH's None-means-unset convention would have made restore silently fail to clear thresholds; proved with a failing test, then designed around it). Pushing #283 and opening its PR so its review runs in parallel:
Assistant
Waiting on #1119 CI and the #1120 fix round. The moment #1119 merges (closing #593 fully), the #594 rebase-and-land sequence starts, followed by #345.
Assistant
Three stray lines left from the old block tail — removing them:
Assistant
Rebase done. The tsc failure is a pnpm/corepack version-check issue, not a compile error — bypassing pnpm and invoking tsc directly:
Assistant
PR #1121 is open. Launching its review flow:
Assistant
Review comment posted and the #1121 fix round dispatched. Waiting on the two fix rounds (#1120, #1121); #345 rebases last. The anomaly live verification (my task, not delegated — it touches Key Vault credentials) comes after the train clears.
Assistant
#1120's fixes are in (the Popconfirm rethrow verified with a genuinely non-trivial test — the pointer-events signal work is exactly the "passes for the right reason" discipline). Watching its CI:
Assistant· <synthetic>
You've hit your session limit · resets 11:20am (America/Vancouver)
Assistant· <synthetic>
No response requested.
User
continue...
Assistant
Re-establishing state after the session restart: #1120's fixes were pushed (CI status unknown), the #1121 fix round and #345 were both interrupted. Checking #1120 and resuming both agents:
Assistant
#1120 is fully green — merging:
Assistant
#1120 merged and #283 closed. The pull hit dirty local files — checking what's in the way:
Assistant
Main is current and the user's settings.json edit is preserved untouched. Six of eight Week-5 issues are now closed (#568, #349, #424, #351, #593, #283 — plus #1114's #349). Remaining: the #1121 fix round and #345, both in flight.
Assistant
#1121's fix round is complete (seasonality-aware band mirroring eligible_values, honest captions, coverage gaps closed). Watching its CI, then merging:
Assistant
Both are keep-both-sides conflicts:
Assistant
The import list already merged cleanly. Committing the merge, verifying both suites, and pushing:
Assistant
That failure is environmental — the test resolves nginx.conf.template relative to cwd and I ran vitest from the wrong directory. Rerunning from frontend/:
Assistant
759 green + typecheck clean, merge pushed. Watching #1121 CI for the final merge:
Assistant
Running the Snowflake leg of the probe:
Assistant
Auth and quoting work — wrong table name. The known live tables are ORDERS_HEADER/ORDER_LINES:
Assistant
While the final merges run, updating the todo list to reflect true state:
Assistant
Docs targets located. Holding the close-out until the final two merges confirm.
Assistant
While the e2e fix lands, delegating the close-out docs pass with a complete fact sheet:
Assistant
Close-out docs are being drafted. Two items remain in flight: the #1122 e2e scoping fix and the docs branch. Then the final sweep.
Assistant
#1122 is fully patched (e2e scoping, main merged in, post-merge test fix) — watching its CI for the final feature merge:
Assistant
Waiting on the #1122 CI watch and the docs draft.
Assistant
The docs commit is ready on its branch. Verifying its diff quickly while #1122's CI finishes:
Assistant
The extra files are just my stale local main ref — comparing against origin/main instead:
Assistant
Clean — exactly the three docs files. Waiting on #1122's CI for the last merge.
Assistant
#1122's merge was refused — Frontend tests failed. Checking whether it's the same runner flake or real:
Assistant
Filed #1123 for the flake class. Watching the #1122 rerun — one merge from the finish line.
Assistant
The rerun failed again — twice on the same PR stops being dismissible as a flake. Checking whether it's the same test:
Assistant
PR #1124 is the unblock for #1122. Once it merges, I'll update-branch #1122 so its CI reruns with the new timeout. Waiting on CI.
Assistant
#1124 merged. #1122's branch is updating and its CI will rerun under the new timeout. Watching it:
Assistant
Docs branch amended (unpushed, so amend is safe). Waiting on #1122's CI rerun under the new timeout — then the final merge, docs PR, and sweep.
Assistant
While the docs PR's CI runs, the final issue-state sweep:
Assistant
Cleaning up the superseded 2026-07-28 handover memory (its "next" items shipped weeks ago):
Assistant
One line from that deleted memory is still a live user action (the state-encryption passphrase off-machine copy) — preserving it in the new memory file:
Assistant
Now waiting only on the docs PR's CI to merge and close the milestone.
Assistant
v1.1 Week 5 is closed — 8/8 issues shipped and merged, a week ahead of the 2026-08-08 due date. The milestone is closed on GitHub, all issue states individually verified, docs landed, and the only local modification remaining is your own pre-existing .claude/settings.json edit, untouched.
What shipped (PRs #1113–#1125, all squash-merged)
Issue
PR(s)
Delivered
#593 anomaly kind (P1)
#1117 + #1119
Rolling z-score baseline over self-measured row_count/freshness_age_hours (reusing the dialect-quoted Core builders), stored in the existing monitor_baselines table — no migration; per-check skip on cold start; authoring UI with conditional fields; z banded through unchanged ADR-0016 thresholds
#594 trend view (P2)
#1121
Threshold bands + seasonality-aware anomaly-baseline overlay (second panel — z-score and raw units kept honest), a11y data-table fallback, new authz-scoped baseline read endpoint
#568
#1113
warn≤fail≤critical + non-negativity enforced across create/update/import/dry-run
#424
#1115
Authoritative redaction: full/partial/none/null + redacted_columns on the read API; honest sample headers
#351
#1116
Draft-connection Test endpoint (structurally cannot persist) + form button; secret_optional seam fixed iceberg/dbt testing on both paths
#283
#1120
Version restore that re-validates against current rules and mints a new auditable version
#349
#1114
Shared runs fetch + shared date-window presets
#345
#1122
Zero-dependency print-stylesheet PDF report, redaction parity by omission
The parts I'd flag for your attention
Live verification passed on both warehouses (the #953 rule): local main against real Snowflake (ORDERS_HEADER: 34,680 rows, ORDER_TS 132.28h) and real Unity Catalog (gold.feedback_sentiment: 180 rows, scored_at TIMESTAMP → 132.48h) through the exact measure_metric driver-boundary path. Feature-matrix cells are now ✅ with the evidence recorded. Both ~132h freshness readings are consistent with the harness being deliberately stopped.
User
Great, cleanup the dead worktrees, fix the uncomitted changes, and wrap up the thread
Assistant
Waiting for the chore PR's CI, then the final merge closes everything out.
backend/tests/services/test_check_dimension.py (168 lines) — dimension derivation/round-trip tests; an anomaly entry (or deliberate omission) in _BY_KIND needs the present-null round-trip test pattern described in the skill (§5) and exercised here.
backend/tests/services/test_run_service.py (847 lines) — includes test_skip_run_marks_all_checks_skip_and_run_succeeded (line 541) and the _run_outcomes dispatch tests (stateful/comparison executor injection, unsupported-kind NotImplementedError) — the place to add anomaly dispatch-routing tests.
Integration/worker tests: backend/tests/integration/test_datasource_runs.py (skip-run persistence), backend/tests/worker/test_tasks.py (executor wiring through the Celery task, STATEFUL_MONITOR_KINDS gating).
No conftest.py fixture file specifically for monitors was found (find ... conftest.py | xargs grep -l "monitor" returned nothing) — tests build fixtures inline (fake CheckRunner/MonitorRunner, _sess() session fakes, monkeypatched registries) rather than via shared pytest fixtures.
<subagent_tokens>99384</subagent_tokens><tool_uses>42</tool_uses><duration_ms>191679</duration_ms>
ANOMALY_CAPABLE_TYPES
SCHEMA_DRIFT_CAPABLE_TYPES
expectation_type
monitor_expectation_type(kind)
validate_monitor_config
anomaly
MONITOR_CAPABLE_TYPES (line 92), SCHEMA_DRIFT_CAPABLE_TYPES (line 98) — per-datasource capability frozensets that anomaly will need its own variant of (or reuse) depending on what data it needs (likely just needs the check's own historical results.metric_value series, not the live datasource, so its capability set might be "any connection type that already has other checks producing metrics" rather than SQL/file-specific).
Export/import validation:backend/app/services/suite_io_service.py — imports MONITOR_KINDS (line 32), branches if c["kind"] in MONITOR_KINDS: (line 183) to call the monitor validator, elif c["kind"] == COMPARISON_KIND: (line 192) for comparison. Validation is atomic (every check validated before any row written, per module docstring line 14). anomaly joining MONITOR_KINDS automatically routes it into the existing monitor-validation branch here.
get_baseline(session, check_id) -> MonitorBaseline | None (select by check_id).
rebaseline(session, check) -> bool — deletes the row (not an immediate recapture — avoids running introspection on the API request thread); next run recaptures live. Returns whether a row existed.
No baseline row → captures current snapshot, INSERT ... ON CONFLICT DO NOTHING (constraint="uq_monitor_baselines_check") (handles concurrent first-runs racing on READ COMMITTED without blowing up the whole run's commit), reports "baseline captured" (success=True, metric_value=0.0).
Baseline row exists → diff current vs stored (diff_schemas), band via monitor_outcome(SCHEMA_DRIFT, scalar=payload, config=config, now=...).
Introspection failure → the check's operational error, not the run's (one unreachable target doesn't fail siblings).
Wiring (worker):backend/app/worker/tasks.py:198-210 — builds stateful_monitor_executor only when any(c.kind in STATEFUL_MONITOR_KINDS for c in checks), then passes it into run_service.execute_run(..., stateful_monitor_executor=...). An anomaly executor (build_anomaly_executor) would be built the same way, gated on STATEFUL_MONITOR_KINDS membership (which is automatic once registered with build_statement=None), and run_service._run_outcomes would need it threaded through similarly (it currently only accepts one stateful_monitor_executor param serving all stateful kinds via STATEFUL_MONITOR_KINDS, so both schema_drift and anomaly executors need to be composed/dispatched — check how _run_outcomes calls a single stateful_monitor_executor(checks[i]) for every stateful-kind index, line 155-167 — the executor closure itself would need to branch on check.kind internally, or the signature needs to grow a second executor param, mirroring how comparison_executor is a separate param from stateful_monitor_executor).
anomaly
freshness_column, _validate_freshness, _freshness_statement, _freshness_outcome — metric = age in hours (_freshness_age_hours), higher = worse.
_validate_schema_drift, _schema_drift_outcome — metric = drifted-column count (float), scalar is a dict payload (not a SQL scalar) computed by the stateful executor.
Run-time execution helpers:
run_monitor_specs(scalar_for, *, monitors, now) — bands a list of MonitorSpecs given a scalar source; isolates a bad monitor to its own errored outcome (never fails siblings); routes exceptions through classify_failure_reason unless the exception is a SafeMonitorError subclass (persisted verbatim — see the SafeMonitorError/MonitorConfigError docstrings, ~lines 60-115, on what's safe to persist into results.observed_value/message given #900/#828/#989).
evaluate_monitors(fetch_scalar, *, table, schema, catalog, monitors) — SQL-scalar path, builds the statement then calls fetch_scalar.
run_monitors_over_engine(engine, *, table, schema, catalog, monitors) — the shared execution edge SQL runners (Snowflake, Unity Catalog) use: opens one connection, sources every monitor's scalar from it (#428).
Dispatch by check.kind (ADR 0012 seam):backend/app/services/run_service.py, function _run_outcomes (lines 115-226):
monitor_idx = [... c.kind in SCALAR_MONITOR_KINDS] → runner's run_monitors (gated by the runner's advertised supported_monitor_kinds capability set, line 198 — notisinstance, to avoid a Protocol name-match footgun).
stateful_idx = [... c.kind in STATEFUL_MONITOR_KINDS] → the injected stateful_monitor_executor: Callable[[Check], CheckOutcome] | None (built by the worker per-run, owns the DB session/baseline store — runners never see it). No executor supplied → per-check errored outcome (line 156-165), never a hard failure.
comparison_idx → injected comparison_executor (ADR 0015 pattern, same no-executor semantics).
Any kind not in {expectation, *MONITOR_KINDS, comparison} → NotImplementedError (line 152) — this is why anomaly is currently unreachable at run time even though it's schema-valid.
anomaly (stateful shape, needing a stored baseline like schema_drift) would join STATEFUL_MONITOR_KINDS by registering with build_statement=None, and needs its own build_anomaly_executor-style injection wired the same way schema_drift is (see §2/§7 below, backend/app/worker/tasks.py:198-210).
metric_value / duration_ms / status production:
metric_value: For monitors, CheckOutcome.metric_value is set directly by the strategy's outcome() function (backend/app/datasources/base.py ~line 60, doc comment: "the badness scalar a monitor computed directly ... higher = worse"). For GX expectations, severity.extract_metric (see §3) pulls unexpected_percent from sample_failures instead. severity.extract_metric prefers outcome.metric_value when set (backend/app/services/severity.py lines ~30-63).
duration_ms: stays NULL in v1 — backend/app/services/run_service.py:69 comment ("per-check timing isn't separable from GX's single suite-level validate()") and ADR 0012 (docs/adr/0012-monitor-kind-seam.md line 93, ADR 0016 line 31). Not computed per-monitor at all currently — a new kind gets the same NULL.
Status: produced by severity.resolve_status/derive_status (see §3) inside run_service._build_result (backend/app/services/run_service.py:64-109), which maps a CheckOutcome + the check's three thresholds to a Result row (status, metric_value, observed_value, expected_value, sample_failures).
The /code-review rounds earned their cost: ~15 real defects fixed pre-merge, including a baseline lost-update race (now SELECT FOR UPDATE), a seasonality-blind chart band, a background-poll failure that would have wiped the Runs tab, and a dry-run path that accepted thresholds a save rejects.
Filed, open by design: #1118 — the pre-existing *_secret_name resolution on connection-test paths is a credential-exfiltration class under the single-tenant trust model; mitigation is deferred to the RBAC work (#740–#744). #1123 (CI flake recurrence) was filed and fixed same-day via #1124 (CI-gated 15s Vitest timeout).
Prod deploy is a separate, manual step — merged main isn't live until a gh workflow run Deploy (and the anomaly kind won't appear in the deployed app until then). I didn't trigger it; say the word if you want the deploy + post-deploy smoke run.
Next milestone: v1.1 Week 6 — scale-aware execution + hardening + cycle close (due 2026-08-15), headlined by #595 (sampling/partition-aware flat-file + UC runners).