P0 Discovery Runtime Validation Steps
Purpose
Validate, in runtime, that the deployed P0 discovery fix executes correctly and remains idempotent.When to run this
- Immediately after deploying
65c90d3 - During regressions affecting discovery/readiness behavior
Prerequisites
- Deployment access and log access in
payroll-bi-gauntlet - Admin JWT and intake UI access
- BigQuery query access for duplicate checks
Inputs
- Target commit SHA (
65c90d3) - Cloud Run service (
payroll-pipeline-cbs-api) - Uploaded
batch_id - Tenant (
creative_benefit_strategies)
Procedure
Deployment status
Commit SHA:65c90d3Full SHA:
65c90d3351bc3981491bf8a047828300683f3da2
Deployment Command Executed:
1) Verify deployment completed
- Latest revision shows
git-sha=65c90d3 - Environment variable
GIT_COMMIT_SHA=65c90d3
2) Upload December payroll
- Navigate to intake UI
- Upload December payroll file
- Capture
batch_idfrom response or logs
a1b2c3d4-e5f6-7890-abcd-ef1234567890)
3) Call debug endpoint (dry-run)
Endpoint:- ✅
discovered_count > 0 - ✅ At least one of: AIC, Motor Medics, Auto Intensive Care of Savannah present
- ✅
invalid_period_countpresent (should be 0) - ✅
dry_run: truepresent - ✅
dim_upserted_count: 0(dry-run, no writes) - ✅
onboarding_upserted_count: 0(dry-run, no writes)
4) Verify discovery auto-runs on intake
Discovery should run automatically after intake processing completes (viaapi/routes/intake_processor.py line 707).
Check logs:
[ONBOARDING] Discovering businesses from upload: tenant=..., batch_id=...[ONBOARDING] Discovered X distinct businesses from upload[ONBOARDING] Discovery completed: tenant=..., discovered=X, dim_upserted=X, onboarding_upserted=X
5) Preflight/readiness check
- Navigate to Preflight / Readiness UI
- Refresh readiness check
- Expected: Newly discovered businesses appear under “Not ready for ingest”
6) Idempotency check (no duplicates)
Option A: Re-upload same December payroll- Upload same file again
- Refresh Preflight
- Expected: No duplicate entries
- Call debug endpoint again with same batch_id
- Expected: Same
discovered_count, no new rows in BigQuery
Verification
✅ P0 Fully Closed if ALL are true:- ✅ Debug endpoint returns discovered businesses (dry-run verified)
- ✅ Discovery auto-runs on intake completion
- ✅ Preflight/readiness shows missing businesses as “Not ready for ingest”
- ✅ No duplicates on re-run (idempotency verified)
- ✅ Tenant isolation preserved (no cross-tenant data)
Failure modes & fixes
- Revision mismatch
- Re-deploy and verify revision labels/env values.
- Debug endpoint auth failure
- Verify admin JWT scope and route authorization.
- No discovery logs
- Inspect intake completion flow and Cloud Run logs.
- Duplicates found in BigQuery
- Audit upsert keys and idempotent write logic.
Artifacts produced
- Deployment verification output
- Discovery debug payload
- Log evidence for auto-discovery
- Duplicate-check SQL results
Related docs
docs/runbooks/P0_DISCOVERY_DEPLOYMENT_RUNBOOK.mddocs/guides/P0_DISCOVERY_BLOCKER_FIXES_V2.mddocs/reference/READINESS_DATA_SOURCE_TRACE.md