fix(reaper): exclude 'dolt' built-in system DB from database discovery#1812
Open
jonathanpberger wants to merge 2 commits intogastownhall:mainfrom
Open
fix(reaper): exclude 'dolt' built-in system DB from database discovery#1812jonathanpberger wants to merge 2 commits intogastownhall:mainfrom
jonathanpberger wants to merge 2 commits intogastownhall:mainfrom
Conversation
Two causes of height jiggle: 1. renderCityScopeBanner rendered 2 stats (no overseer) vs 5 stats (overseer present), making the right side change visual width. 2. The Activity stat timestamp could wrap at narrower viewports, making that stat taller and the banner grow. Fix: always render all 5 stats; use "—" placeholders when no overseer is active. Add white-space: nowrap to .scope-stat-value to prevent wrapping. Closes gastownhall#1804. Co-Authored-By: RubyBear (<synthetic>) <noreply@anthropic.com>
…ase discovery. Dolt's SHOW DATABASES output includes the 'dolt' internal system database, which lacks the wisps/issues/dependencies tables. The is_user_database exclusion list covered mysql, dolt_cluster, information_schema, etc., but not 'dolt' itself — causing table-not-found anomalies on every reaper run. Closes core-0ozp / tc-zlpa. Co-Authored-By: MistyCrane (claude-sonnet-4-6) <noreply@anthropic.com>
1 task
julianknutsen
pushed a commit
that referenced
this pull request
May 8, 2026
…ema (#1819) ## Summary Fixes #1816. Both `reaper.sh` and `jsonl-export.sh` iterate user databases discovered via `SHOW DATABASES` and run per-DB queries (`<db>.wisps` / `<db>.issues` / `<db>.dependencies`) without checking whether the database actually has bd schema. Any database that exists on the server without bd schema (orphan `CREATE DATABASE`, partial migration, system schemas not on the `is_user_database` blocklist) produces `Error 1146: table not found` on every query — which becomes spurious `ESCALATION: Reaper anomalies detected` mail (4 anomalies × N orphan DBs per cycle, every 30 minutes) and inflated `failed: <db>` entries in the `jsonl-export` summary. ## Changes - **`examples/gastown/packs/maintenance/assets/scripts/dolt-target.sh`** - New `has_wisps_table()` helper that probes `SHOW TABLES FROM \`<db>\` LIKE 'wisps'` and reports whether the database is bd-managed. Wisps acts as a proxy for bd schema; every bd-managed schema has a wisps table. - Fail-closed-toward-processing on probe error: if the SHOW TABLES call itself errors (dolt unreachable, connection dropped), the helper returns success so the caller falls through to its normal queries — those will fail in the same way and surface the dolt-side problem through the script's regular error-handling path. This matches the rest of the script's error semantics rather than silently skipping a real bead store on a transient blip. - **`examples/gastown/packs/maintenance/assets/scripts/reaper.sh`** - Per-DB iteration loop calls `has_wisps_table` right after the existing `valid_database_identifier` guard. Schemaless DB → `continue` silently, no anomaly recorded. - **`examples/gastown/packs/maintenance/assets/scripts/jsonl-export.sh`** - Same precheck applied. `TOTAL_DBS=$((TOTAL_DBS - 1))` decrement on skip so the DOG_DONE summary's `exported N/M` denominator reflects only bd-managed databases. - **`examples/gastown/maintenance_scripts_test.go`** - New `TestMaintenanceDoltScriptsSkipDatabasesWithoutWispsTable` (table-driven over both scripts). Asserts (a) the SHOW TABLES precheck actually ran for `empty_db`, (b) no `empty_db` table queries were issued, (c) no escalation surfaces `empty_db` to gc/mayor. - New `DOLT_DBS_WITHOUT_WISPS` env var on the shared `writeMaintenanceDoltStub` helper — space-separated DB names that report no wisps row. Defaults to empty (every DB has wisps), preserving backward compatibility with all 16+ existing tests that use this stub. - 17 inline raw-string dolt stubs and 3 Go-string-concatenated stubs (`writeIssuesPayloadDoltStub` and siblings) get a one-line SHOW TABLES case prepended so the new precheck doesn't spuriously skip their target DBs. ## Verification - `make build` clean - `make check` clean (~4m28s, fmt + lint + vet + test) - `go test ./examples/gastown/...` clean (13.6s, all maintenance tests green) - Sanity-verified: each script's precheck disabled independently makes the corresponding subtest of `TestMaintenanceDoltScriptsSkipDatabasesWithoutWispsTable` fail, with clear error messages naming the un-skipped query - `gofmt -l` clean, `go vet ./...` clean ## Multi-model review 5-reviewer panel (Claude × 3 lenses + Codex `gpt-5.4` + Copilot `gpt-5.3-codex`) iterated twice: - Iteration 1 flagged `jsonl-export.sh` as a major sibling-site bug (Codex + Copilot agreed independently). Addressed. - Iteration 2 clean across all reviewers; Codex independently sanity-verified the fix by removing each precheck and confirming subtest failure. ## Out of scope - "Why are orphan databases being created in the first place" — separate investigation. The `gascity_packs` orphan I observed was created today during normal city operation with no trace in supervisor.log, suggesting a different bug worth tracking down. - The `is_user_database()` blocklist itself — left unchanged. The precheck is additive, handles both system schemas and orphans uniformly, and is self-healing for future cases. - PR #1812 partially overlaps (adds `dolt` to the `is_user_database` blocklist). This PR's `SHOW TABLES` precheck strictly subsumes that change — `dolt` lacks a `wisps` table and would be skipped silently regardless. Maintainer's call which to land first. Closes #1816 <!-- codesmith:footer --> --- <a href="https://app.blacksmith.sh/gastownhall/codesmith/gascity/pr/1819"><picture><source media="(prefers-color-scheme: dark)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-in-codesmith-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://pr-comments-assets.blacksmith.sh/codesmith/view-in-codesmith-light.svg"><img alt="View in Codesmith" src="https://pr-comments-assets.blacksmith.sh/codesmith/view-in-codesmith-dark.svg"></picture></a> <sup>Need help on this PR? Tag <code>@codesmith</code> with what you need.</sup> - [ ] Let Codesmith autofix CI failures and bot reviews <!-- /codesmith:footer --> --------- Co-authored-by: sjarmak <sjarmak@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
doltsystem schema viaSHOW DATABASESis_user_database()excluded other system schemas (mysql,dolt_cluster, etc.) but misseddoltdoltas a user database, querieddolt.wisps, hit table-not-found (Error 1146), and mailed spurious ESCALATION anomalies to mayor on every runFix
Add
doltto the exclusion pattern inis_user_database():Test plan
doltexcluded fromis_user_database()— verified by code changehq,td_core) still processed — exclusion is pattern-matched, not a broad filterdoltDBCloses core-0ozp / tc-zlpa.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmithwith what you need.