Skip to content

fix: canonical schema.sql + integration test integrity#191

Merged
Depo-dev merged 3 commits into
mainfrom
fix/schema-and-test-integrity
Jul 3, 2026
Merged

fix: canonical schema.sql + integration test integrity#191
Depo-dev merged 3 commits into
mainfrom
fix/schema-and-test-integrity

Conversation

@Depo-dev

@Depo-dev Depo-dev commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Hardening fixes cut cleanly against main. Full findings in REPORT.md.

fix(db): schema.sql is now a faithful mirror of migrations 0001-0009

database/schema.sql claimed canonical but had drifted from the migration chain that CI and production apply. On main a DB bootstrapped from it is missing audit logging, parse-error isolation, and indexer health/alert state:

  • add missing tables audit_log (0006) and parse_errors (0008)
  • add system_state health columns (0002) + alert columns (0003)
  • replace the legacy soroban_events index set with the canonical 0004/0009 indexes (network, network_contract, contract_ledger, contract_topic0 partial, id_desc, ledger_timestamp)
  • drop uq_soroban_events_tx_index, which no migration defines

Verified: tables, columns and indexes now match the migration end-state exactly.

fix(ci): validate integration DB from migrations + fail loud on missing test services

  • rust-integration builds trident_test from the migration chain instead of the (drift-prone) schema.sql mirror — the same artifact the rust job and production apply.
  • REQUIRE_TEST_SERVICES makes require_services! panic instead of silently return-ing when TEST_DATABASE_URL/TEST_REDIS_URL are absent. A misconfigured integration job can no longer report green without exercising the DB/Redis tests. Local dev still skips.

Verification

  • Local: cargo fmt --check, cargo clippy --all-targets -- -D warnings, structural schema-equality check all green.
  • CI rust-integration on this PR now builds from migrations and runs the DB/Redis tests with the fail-loud gate armed.

Depo-dev added 3 commits July 3, 2026 14:13
schema.sql claimed to be canonical but had drifted from the migration
chain that CI and production actually apply:

- add missing tables audit_log (0006) and parse_errors (0008)
- add system_state health columns (0002) and alert columns (0003)
- replace the legacy soroban_events index set with the canonical
  0004/0009 indexes (network, network_contract, contract_ledger,
  contract_topic0 partial, id_desc, ledger_timestamp)
- drop uq_soroban_events_tx_index, which no migration defines

Tables, columns and indexes now match the migration end-state exactly.
…g test services

The rust-integration job built trident_test from database/schema.sql,
so any drift in that mirror silently reduced integration coverage.
Apply the real migration chain instead — the same artifact the rust job
and production apply — validating it as an ordered, idempotent chain.

Also arm REQUIRE_TEST_SERVICES in that job so require_services! panics
instead of silently returning when TEST_DATABASE_URL/TEST_REDIS_URL are
absent. A misconfigured integration job can no longer report green
without actually exercising the DB/Redis tests. Local dev still skips.
@Depo-dev Depo-dev merged commit 639152b into main Jul 3, 2026
8 checks passed
@Depo-dev Depo-dev deleted the fix/schema-and-test-integrity branch July 3, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant