test(drift): CI guard for source-of-truth drift (backend hosts + workload names)#218
Merged
Conversation
…load names) Mocked unit tests can't catch a chart rename that breaks the names summary.sh / diagnose.sh grep for, or a backend host changed in one of the three files that hardcode it — they ship green and break in the field. Add a drift checker: - backend API host parity across preflight.sh / install-client-helm.sh / install-k8s.ps1 (dev/stg/prod hosts must match). - workload-name contract: the Deployments/DaemonSet that summary.sh (readiness wait) and diagnose.sh (--diagnose bundle) reference by name must be rendered by the chart (helm template), and the scripts must still reference each. - 8 bats cases for the checker; drift-checks.yaml runs on scripts/ or client/ changes (helm set up in CI); check-drift.sh added to the shellcheck list. Refs tracebloc/backend#746 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
👋 Heads-up — Code review queue is at 24 / 8 Above the WIP limit. The team convention is to review existing PRs before opening new work. Open PRs currently in Code review (oldest first):
Pull from review before opening new work. (This is a nudge from the kanban WIP check, not a block.) |
This was referenced Jun 6, 2026
saadqbal
approved these changes
Jun 8, 2026
saadqbal
left a comment
Contributor
There was a problem hiding this comment.
Solid net-new drift guard — CI-only, can't affect runtime. Check 1 (backend host parity across preflight.sh / install-client-helm.sh / install-k8s.ps1) and Check 2 (workload-name contract: 2a scripts ↔ 2b helm template render) both look correct, and sourcing is side-effect-safe (set + main gated on direct execution) so the bats suite can exercise the helpers. 8/8 bats green. LGTM.
This was referenced Jun 8, 2026
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.
What
Net-new CI drift check — fails when two sources of truth that must agree have silently diverged. From the test-hardening analysis; the only roadmap item with no existing PR. Tracks backend#746.
Two checks (
scripts/tests/check-drift.sh):1. Backend API host parity — the dev/stg/prod hosts are hardcoded in three files (
preflight.sh::_pf_backend_host,install-client-helm.sh::_backend_url,install-k8s.ps1::Get-BackendUrl). Asserts all three carry the identical*.tracebloc.iohost set.2. Workload-name contract —
summary.sh(readiness wait,rollout status deployment/<name>) anddiagnose.sh(--diagnosebundle,logs deploy/<name>+daemonset/<name>) referencemysql-client,<release>-jobs-manager,<release>-requests-proxy,tracebloc-resource-monitorby name. A chart rename breaks readiness + diagnostics silently — same class as theapp=managerselector bug. Renders the chart (helm template) and asserts each name exists, and that the scripts still reference each (so the contract can't go stale on either side).How
.github/workflows/drift-checks.yamlruns onscripts/**ORclient/**(either side moving is the drift), sets up helm, runs the check.scripts/tests/check-drift.bats— 8 cases (parity match / mismatch / removed; contract drop; render-missing; helm-absent skip).check-drift.shadded to the static job's shellcheck list.Testing
bash scripts/tests/check-drift.sh→ green on develop (both checks pass; the chart render confirms the four workload names).bats scripts/tests/check-drift.bats→ 8/8.Follow-ups (separate)
docs-l app=…selectors ↔ chart labels (the originalapp=managersurface) — needs a cross-repo guard.Source-of-truth driftjob to a required status check once proven stable.Refs tracebloc/backend#746
🤖 Generated with Claude Code