oficina / equipo Public
Live database structural check, 2026-11-26
Branch fix/check-db, from main 8a3f1d92. The one-shot equipo check-db runs before configuration, mail, migrations or application boot. No live instance was checked and no deployment was performed by this branch.
Live path and read-only behavior
CARLOS supplies CARLOS_DB to the command from the serving instance's actual dbPath: carlos/platform/internal/activator/cmdunit.go, ExecBackend.cmdVars. This command requires that path to be absolute and a regular file. It has no fallback to a replica, a default filename or the application's boot resolver. The filename is URL-encoded before adding the fixed SQLite mode=ro option. It does not use immutable, which would miss committed WAL changes.
One read transaction runs PRAGMA quick_check(100), then PRAGMA integrity_check(100), followed by page count, page size and journal mode. There are no setters, migrations, checkpoints or writes. The deadline is 60 seconds, including opening and reading. The serving writer remains usable. WAL size is observed if visible; otherwise it is null, as are failed metadata reads. SQLite diagnostics, filenames, table/index names, expressions and row contents never appear in the output.
The bounded JSON carries status, a reviewed failure message, per-check status, error count, a limit flag, at most five b-tree/page coordinates, metadata and elapsed milliseconds. Per-check results distinguish findings, error and findings_and_error, as well as ok and not_run. The count is the number of observed diagnostics and query/metadata failures, not unique corrupt pages: both checks can report the same damage. Each check stops at 100 findings. Failure, timeout and inability to write the report all exit nonzero.
Known limitation: constraint violations may not be reported; this checks file structure. A CHECK-constraint fixture was not reported by the pinned SQLite driver. Per the controller's ruling, it is not an assertion or a claim of coverage. The permanent byte-flipped b-tree fixture proves structural damage is detected. The command doc comment records the same limitation.
Operator invocations after deployment
Staging:
carlos run --app equipo-staging --account bds \
--console https://console.carloku.com \
--instance equipo-staging.bds.oncarlos.com --timeout 75s -- check-dbProduction:
carlos run --app equipo --account oficina \
--console https://console.carloku.com \
--instance equipo.bds.oncarlos.com --timeout 75s -- check-dbThese app/account/host values come from scripts/staging-thin.py and scripts/upgrade-thin.sh. Use the instance host, not the public alias. The 75-second outer timeout allows the 60-second check to return its JSON. The local installed CARLOS CLI predates run; these commands require the run-capable CLI used by the controller. Platform source confirms its syntax.
Copy
All seven CopyDB* messages and their Plan 3 inventory rows carry COPY ACCEPTED BY DELEGATION (Luna, 2026-11-26), explicitly approved by the controller. Per-check status values are machine-readable enums. No unreviewed operator prose or raw database errors are emitted.
Tests and mutations
Tests were written first; the initial run failed to compile on the missing check-db symbols. Implemented tests cover an intact live WAL database, a flipped b-tree page, write refusal even with query_only disabled, reading committed WAL data, clean missing/invalid paths, command dispatch without app configuration, diagnostic redaction and bounds, findings versus query errors, the command's own deadline, and output failure.
Local commands use GOMAXPROCS=2 GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 and -p 1. Each mutation is applied alone, runs go test -p 1 ./cmd/equipo -run TestCheckDB -count=1, and is restored. A kill requires a runtime assertion failure; compilation errors do not count.
Mutation results and final gate results are recorded below before handoff. Full local suites and simulators are deliberately avoided under the controller's loaded-machine ruling. Linux CI is the full gate. This CLI-only change adds no route, schema, protocol or performance endpoint record.
All 17 mutations were killed at runtime:
- Change
mode=rotomode=rw; addimmutable=1. - Remove the command's deadline; change the fixed 60-second bound.
- Remove the five-issue bound; emit raw diagnostic text; exceed 100 findings.
- Skip quickcheck; skip integritycheck.
- Ignore the final row error; report a query failure as success.
- Ignore output failure; return success despite integrity findings.
- Remove the absolute-path check; remove the regular-file check.
- Remove check-db dispatch; accept extra arguments.
Restored focused tests passed (TestCheckDB|TestCheckGitHub). make fmt-check budget copy-release-check passed. The sole size allowance change is the measured nine source lines for approved operator copy: internal/equipo 23239 to 23248. No timing budget changes. Post-commit dead-reference results and Linux CI are reported with the pushed SHA in the handoff.
Inventory gate follow-up
CI at 70831711 caught a missing entry in the inventory test's explicit key/date acceptance list. The seven new keys now require the exact approved COPY ACCEPTED BY DELEGATION (Luna, 2026-11-26) status in that list. No generic scanner rule was widened. git fetch origin and git merge origin/main reported already up to date at main 8a3f1d92.
go test -p 1 ./internal/plan3test -run '^TestPlan3ReleaseBoundaries$' -count=1 passed (4.262s), and python3 scripts/plan3-copy-check.py passed. The measured Plan 3 test budget increases by two lines, 11976 to 11978, for that acceptance entry. The earlier statement about the sole size allowance applies to the initial implementation; this follow-up also adjusts the measured test count.