Cloud Agent: Postgres bootstrap + indexer/.env for integration tests (follow-up MR !91 / #324) #335

Closed
opened 2026-06-05 13:56:14 +00:00 by PlasticDigits · 21 comments
PlasticDigits commented 2026-06-05 13:56:14 +00:00 (Migrated from gitlab.com)

Summary

Follow-up from MR !809 (#324): enable Postgres + indexer/.env provisioning on Cursor Cloud Agent VMs so indexer integration tests (cargo test --tests, especially api_route_solve) can run without a full LocalTerra wasm deploy. MR !809 verified #324 via lib tests only and explicitly SKIPped integration coverage because Postgres / indexer/.env were unavailable in the Cloud Agent environment.

This issue covers the infra + automation gap, not re-implementing #324 solver logic (already merged).

Current codebase

Postgres stack (Docker Compose)

Database bootstrap + indexer/.env sync

  • scripts/setup-postgres-dev-databases.sh — idempotent: bootstraps cl8y_legal via superuser when missing, creates dex_indexer + dex_indexer_test, upserts DATABASE_URL / TEST_DATABASE_URL into indexer/.env via scripts/lib/upsert-dotenv.sh. Requires host psql; if absent, warns and only writes env URLs (cannot create DBs).
  • scripts/lib/postgres-bootstrap-role.sh — superuser bootstrap helper.
  • Makefile — make start runs compose + best-effort setup script; make wait-healthy waits for Postgres and re-runs setup; make test-setup-postgres runs static + optional live Docker bootstrap regression.

Full deploy path (writes complete indexer/.env)

  • scripts/deploy-dex-local.sh phase 6.2 — runs setup script then overwrites indexer/.env with DATABASE_URL, TEST_DATABASE_URL, FACTORY_ADDRESS, ROUTER_ADDRESS, LCD_URLS, CORS_ORIGINS, etc.
  • indexer/.env.example — documents required vars; indexer/.env is gitignored.

Cloud Agent full-stack setup (heavyweight)

  • scripts/setup-cloud-agent-localterra.sh / make setup-cloud-localterra — starts dockerd, make start + wait-healthy, optional build-optimized (~10–15 min), deploy-dex-local.sh, starts indexer in tmux. Does write indexer/.env, but only after full deploy (or deploy skip when stamp matches).
  • AGENTS.md § LocalTerra documents this path; does not document a lightweight Postgres-only path for integration tests.

Integration test expectations

MR !809 / #324 verification gap

  • MR !809 checklist: lib tests PASS; api_route_solve integration → SKIP ("Requires Postgres (indexer/.env); not run in Cloud Agent VM").
  • #324 concurrent-solve behavior is covered by unit tests in indexer/src/api/best_execution.rs (concurrent_solve_tests); HTTP-level cache/concurrency invariants remain in integration tests only.
  • scripts/qa/verify-issue-245.sh runs cargo test --test api_route_solve but assumes Postgres + indexer/.env already exist; no Cloud Agent–specific bootstrap step.

CI / reference automation

  • .github/workflows/test.yml reference Indexer job uses ephemeral postgres:16 service with postgres:postgres (not cl8y_legal) and runs cargo test (lib + integration in default profile) — does not mirror local compose credentials or indexer/.env dotenv path.
  • .gitlab-ci.yml — builds release binary only; no Postgres service or integration test job.

Why this is needed

  1. Verification debt from #324. MR !809 merged solver concurrency + cache-key changes without HTTP integration proof on the same environment agents use for indexer work. Regressions in tier-isolation cache sharing (route_solve_get_cache_*) or route-solve response shape would not be caught by lib tests alone.
  2. Cloud Agent workflow mismatch. Agents working on indexer-only changes should not require a 15-minute wasm build + LocalTerra deploy just to run cargo test --test api_route_solve. Today the only documented Cloud path is full-stack setup.
  3. indexer/.env is gitignored and incomplete without automation. Fresh Cloud Agent checkouts have indexer/.env.example but no indexer/.env. Integration tests load dotenv from CWD; missing file → fallback URL may fail if Postgres/role/DB not provisioned.
  4. Host tooling gaps on Cloud VMs. setup-postgres-dev-databases.sh requires psql on the host; Cloud Agent VMs may lack postgresql-client, causing silent skip of DB creation while still writing URLs — tests then fail at connect/migrate with opaque panics.
  5. Agent playbook completeness. skills/AGENTS_LOCAL_POSTGRES_DEV.md documents local dev well but not a minimal Cloud Agent bootstrap (Postgres-only, no chain).

Constraints and guardrails

  • Do not change #324 solver logic — this issue is infra/automation only; solver behavior is merged in MR !809.
  • Preserve #283 / #324 cache invariants — integration tests route_solve_get_cache_tier_isolation and route_solve_get_cache_same_tier_reuses_lcd must remain the authority for tier isolation vs same-tier sharing; do not weaken assertions to make setup "pass."
  • Keep cl8y_legal as the app role — do not revert to postgres:postgres as the default app user (scripts/lib/postgres-dev.env, #245).
  • Serialized integration tests — automation must document/enforce -j 1 -- --test-threads=1; do not enable parallel integration runs against one dex_indexer_test.
  • Idempotent scripts — safe to re-run on an already-provisioned VM; must not wipe volumes or redeploy contracts unless explicitly requested (--fresh).
  • No secrets in git — indexer/.env stays gitignored; scripts write it locally only.
  • Docker group / dockerd — Cloud Agent shells may need sg docker -c '…' (AGENTS.md); new scripts must follow existing patterns in scripts/setup-cloud-agent-localterra.sh.
  • Rust toolchain — indexer needs Cargo 1.96+ (export PATH="/usr/local/cargo/bin:$PATH" in tmux sessions).

Relevant files

Area Paths
Compose / init docker-compose.yml, docker/postgres-init/
Postgres env + bootstrap scripts/lib/postgres-dev.env, scripts/lib/postgres-bootstrap-role.sh, scripts/lib/upsert-dotenv.sh, scripts/setup-postgres-dev-databases.sh, scripts/test-setup-postgres-dev-databases.sh
Cloud Agent setup scripts/setup-cloud-agent-localterra.sh, AGENTS.md, Makefile (setup-cloud-localterra, test-setup-postgres, wait-healthy)
Deploy (full env) scripts/deploy-dex-local.sh
Indexer env template indexer/.env.example, indexer/.env (gitignored, created by scripts)
Integration harness indexer/tests/common/mod.rs, indexer/tests/api_route_solve.rs, indexer/tests/api_route_solve_db_hybrid.rs
QA verification scripts/qa/verify-issue-245.sh (pattern for new verify-issue-324 or generic target)
Docs / skills docs/testing.md, skills/AGENTS_LOCAL_POSTGRES_DEV.md, skills/AGENTS_HYBRID_QUOTING.md, skills/AGENTS_INDEXER_HYBRID_BEST_EXECUTION.md
Reference CI .github/workflows/test.yml (indexer job), .gitlab-ci.yml
  1. Add a lightweight Cloud Agent Postgres bootstrap — e.g. scripts/setup-cloud-agent-indexer-postgres.sh and/or make setup-indexer-postgres that:
    • Ensures dockerd (reuse _ensure_dockerd pattern).
    • Runs docker compose up -d postgres (not LocalTerra).
    • Waits for health (pg_isready via host or docker compose exec).
    • Runs database ensure + indexer/.env sync (DATABASE_URL, TEST_DATABASE_URL minimum).
    • Prints the exact integration test command.
  2. Harden setup-postgres-dev-databases.sh for Cloud VMs — when host psql is missing, fall back to docker compose exec -T postgres psql … (same as make wait-healthy partially does for pg_isready). Fail loudly if DBs cannot be created.
  3. Optional flag on existing cloud script — --postgres-only on scripts/setup-cloud-agent-localterra.sh to run step 1 without wasm build/deploy.
  4. Makefile targets:
    • make setup-indexer-postgres — bootstrap only.
    • make test-indexer-integration — depends on setup, runs cd indexer && cargo test --tests -j 1 -- --test-threads=1.
    • Optional: make verify-issue-324 — lib concurrent/cache tests + api_route_solve cache tier tests (subset covering MR !809 integration gap).
  5. Update agent docs — AGENTS.md § new subsection "Indexer integration tests (Postgres-only)" pointing to the lightweight path; cross-link in skills/AGENTS_LOCAL_POSTGRES_DEV.md.
  6. Extend scripts/test-setup-postgres-dev-databases.sh — static assert that cloud bootstrap script exists and is referenced from AGENTS.md; optional live test with SKIP_LIVE off on a VM with Docker.
  7. (Stretch, separate MR if large) Align reference .github/workflows/test.yml indexer job with cl8y_legal + dex_indexer_test or document intentional divergence.

Acceptance criteria

  • A documented one-command path on Cloud Agent VMs provisions Postgres + writes indexer/.env with valid DATABASE_URL and TEST_DATABASE_URL without build-optimized / deploy-dex-local.
  • cd indexer && cargo test --test api_route_solve -- --test-threads=1 passes after the bootstrap on a fresh Cloud Agent VM (with Docker + Rust already provisioned per AGENTS.md).
  • make test-indexer-integration (or equivalent) passes the full integration suite serialized (--tests -j 1 -- --test-threads=1).
  • Bootstrap is idempotent — second run succeeds without error.
  • When host psql is absent but Docker is available, DB creation still succeeds via compose exec fallback.
  • AGENTS.md documents the Postgres-only path and distinguishes it from make setup-cloud-localterra.
  • make test-setup-postgres static checks cover the new automation.
  • Optional make verify-issue-324 runs lib #324 tests + api_route_solve cache tier integration tests and is referenced from MR !809 verification docs / skills/AGENTS_HYBRID_QUOTING.md.

Test plan (functional paths)

# Scenario Setup Expected
1 Fresh Cloud VM, no indexer/.env Run new bootstrap command indexer/.env created with both DB URLs; dex_indexer + dex_indexer_test exist
2 Postgres-only bootstrap docker compose up -d postgres via script LocalTerra not started; port 5432 reachable
3 Integration smoke After bootstrap cargo test --test api_health -- --test-threads=1 green
4 #324 integration coverage After bootstrap cargo test --test api_route_solve route_solve_get_cache -- --test-threads=1 green
5 Full api_route_solve After bootstrap Entire api_route_solve binary green serialized
6 Full integration suite After bootstrap cargo test --tests -j 1 -- --test-threads=1 green
7 Idempotent re-run Run bootstrap twice No errors; tests still pass
8 Missing host psql Uninstall/locate without psql on PATH; Docker up Script uses compose exec; DBs created; tests pass
9 Stale volume (legacy postgres:postgres) Old volume without cl8y_legal Bootstrap creates role via superuser or prints actionable error + docs link (#245)
10 Deploy skip path Cloud setup with deploy stamp match, no redeploy Postgres bootstrap still ensures test DB + env URLs if missing
11 Lib-only fast path unchanged No Postgres cargo test --lib still works without bootstrap
12 make test-setup-postgres CI/agent static gate Passes including new file references

Test plan (attack, hack, and abuse vectors)

# Vector Setup Expected / guardrail
A1 Cross-tier cache quote leakage (#283) Run route_solve_get_cache_tier_isolation after bootstrap Distinct tiers → distinct cache keys/responses; test must pass
A2 Same-tier over-sharing after #324 key change Run route_solve_get_cache_same_tier_reuses_lcd Same tier shares cache (fewer LCD calls); different tier does not
A3 Shared test DB race Two parallel cargo test --tests without -j 1 Documented failure mode; Makefile target enforces serialization; file lock reduces corruption (#210)
A4 Credential leakage Inspect git status after bootstrap indexer/.env gitignored; not committed
A5 Superuser bootstrap misuse Run bootstrap against production-like Postgres without superuser Script warns and skips destructive steps; no password reset on existing role (postgres-bootstrap-role.sh idempotent)
A6 Wrong DB URL injection Manually set malicious TEST_DATABASE_URL in env Tests connect only to operator-supplied URL — document that agents must not point at prod; default remains localhost test DB
A7 Open Postgres port exposure After compose up Postgres bound to 127.0.0.1:5432 only (docker-compose.yml)
A8 Rate-limit / DoS via integration tests Run route-solve integration tests Tests use wiremock LCD (indexer/tests/common/lcd_mock.rs); no live LCD amplification in default integration path

Verification criteria

Third parties (and Cloud Agents closing this issue) should be able to run:

# One-time / per-session Postgres bootstrap (no wasm deploy)
make setup-indexer-postgres   # or documented script equivalent

# #324 follow-up: lib + integration
cd indexer && cargo test --lib concurrent_solve hybrid_cache_key
cd indexer && cargo test --test api_route_solve route_solve_get_cache -- --test-threads=1

# Full integration gate
make test-indexer-integration

# Static regression
make test-setup-postgres

Done when: MR !809-style verification no longer lists api_route_solve as SKIP on Cloud Agent VMs; AGENTS.md documents the path; acceptance criteria checkboxes satisfied.

  • MR !809 — merged #324; integration tests skipped on Cloud Agent
  • #324 — concurrent candidate solve + cache-key robustness (implementation merged)
  • #279 — parent hybrid solver program
  • #283 — discount-tier cache isolation (must remain covered by integration tests)
  • #245 — Postgres cl8y_legal bootstrap
  • #210 — shared test DB file lock
  • skills/AGENTS_LOCAL_POSTGRES_DEV.md — local Postgres playbook
## Summary Follow-up from [MR !809](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/91) ([#324](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/324)): enable **Postgres + `indexer/.env`** provisioning on **Cursor Cloud Agent VMs** so indexer **integration tests** (`cargo test --tests`, especially `api_route_solve`) can run without a full LocalTerra wasm deploy. MR !809 verified #324 via **lib tests only** and explicitly **SKIP**ped integration coverage because Postgres / `indexer/.env` were unavailable in the Cloud Agent environment. This issue covers the **infra + automation gap**, not re-implementing #324 solver logic (already merged). ## Current codebase ### Postgres stack (Docker Compose) - [`docker-compose.yml`](docker-compose.yml) — `postgres` service on `127.0.0.1:5432`, default user **`cl8y_legal`** / password **`cl8y_legal`**, DB **`dex_indexer`**, init scripts in [`docker/postgres-init/`](docker/postgres-init/). - Canonical credentials: [`scripts/lib/postgres-dev.env`](scripts/lib/postgres-dev.env) — `DATABASE_URL`, `TEST_DATABASE_URL`, `POSTGRES_SUPERUSER` bootstrap vars ([#245](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/245)). ### Database bootstrap + `indexer/.env` sync - [`scripts/setup-postgres-dev-databases.sh`](scripts/setup-postgres-dev-databases.sh) — idempotent: bootstraps `cl8y_legal` via superuser when missing, creates **`dex_indexer`** + **`dex_indexer_test`**, **upserts `DATABASE_URL` / `TEST_DATABASE_URL` into `indexer/.env`** via [`scripts/lib/upsert-dotenv.sh`](scripts/lib/upsert-dotenv.sh). Requires host **`psql`**; if absent, warns and only writes env URLs (cannot create DBs). - [`scripts/lib/postgres-bootstrap-role.sh`](scripts/lib/postgres-bootstrap-role.sh) — superuser bootstrap helper. - [`Makefile`](Makefile) — `make start` runs compose + best-effort setup script; `make wait-healthy` waits for Postgres and re-runs setup; `make test-setup-postgres` runs static + optional live Docker bootstrap regression. ### Full deploy path (writes complete `indexer/.env`) - [`scripts/deploy-dex-local.sh`](scripts/deploy-dex-local.sh) phase 6.2 — runs setup script then **overwrites** `indexer/.env` with `DATABASE_URL`, `TEST_DATABASE_URL`, `FACTORY_ADDRESS`, `ROUTER_ADDRESS`, `LCD_URLS`, `CORS_ORIGINS`, etc. - [`indexer/.env.example`](indexer/.env.example) — documents required vars; **`indexer/.env` is gitignored**. ### Cloud Agent full-stack setup (heavyweight) - [`scripts/setup-cloud-agent-localterra.sh`](scripts/setup-cloud-agent-localterra.sh) / `make setup-cloud-localterra` — starts dockerd, `make start` + `wait-healthy`, optional **`build-optimized`** (~10–15 min), **`deploy-dex-local.sh`**, starts indexer in tmux. **Does write `indexer/.env`**, but only after full deploy (or deploy skip when stamp matches). - [`AGENTS.md`](AGENTS.md) § LocalTerra documents this path; **does not document a lightweight Postgres-only path** for integration tests. ### Integration test expectations - [`indexer/tests/common/mod.rs`](indexer/tests/common/mod.rs) — `dotenvy::dotenv()` loads **`indexer/.env`**; `setup_pool()` connects to **`TEST_DATABASE_URL`** (fallback hardcoded `cl8y_legal@127.0.0.1:5432/dex_indexer_test`); runs `sqlx::migrate!()`; exclusive file lock at `/tmp/cl8y-dex-indexer-test.seed.lock` for shared DB. - **31 integration test binaries** under [`indexer/tests/`](indexer/tests/) including: - [`indexer/tests/api_route_solve.rs`](indexer/tests/api_route_solve.rs) — route solve POST/GET, hybrid merge, **#283/#324 cache tier isolation** (`route_solve_get_cache_tier_isolation`, `route_solve_get_cache_same_tier_reuses_lcd`), 3-hop hybrid ([#192](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/192)). - [`indexer/tests/api_route_solve_db_hybrid.rs`](indexer/tests/api_route_solve_db_hybrid.rs), [`indexer/tests/security.rs`](indexer/tests/security.rs), [`indexer/tests/db_orderbook_mirror.rs`](indexer/tests/db_orderbook_mirror.rs), etc. - Serialized execution required: `cargo test --tests -j 1 -- --test-threads=1` ([`docs/testing.md`](docs/testing.md) § Shared Postgres). ### MR !809 / #324 verification gap - [MR !809](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/91) checklist: lib tests **PASS**; **`api_route_solve` integration → SKIP** ("Requires Postgres (`indexer/.env`); not run in Cloud Agent VM"). - #324 concurrent-solve behavior is covered by **unit tests** in [`indexer/src/api/best_execution.rs`](indexer/src/api/best_execution.rs) (`concurrent_solve_tests`); **HTTP-level cache/concurrency invariants** remain in integration tests only. - [`scripts/qa/verify-issue-245.sh`](scripts/qa/verify-issue-245.sh) runs `cargo test --test api_route_solve` but assumes Postgres + `indexer/.env` already exist; no Cloud Agent–specific bootstrap step. ### CI / reference automation - [`.github/workflows/test.yml`](.github/workflows/test.yml) reference **Indexer** job uses ephemeral `postgres:16` service with **`postgres:postgres`** (not `cl8y_legal`) and runs **`cargo test`** (lib + integration in default profile) — **does not mirror** local compose credentials or `indexer/.env` dotenv path. - [`.gitlab-ci.yml`](.gitlab-ci.yml) — builds release binary only; **no Postgres service or integration test job**. ## Why this is needed 1. **Verification debt from #324.** MR !809 merged solver concurrency + cache-key changes without HTTP integration proof on the same environment agents use for indexer work. Regressions in tier-isolation cache sharing (`route_solve_get_cache_*`) or route-solve response shape would not be caught by lib tests alone. 2. **Cloud Agent workflow mismatch.** Agents working on indexer-only changes should not require a **15-minute wasm build + LocalTerra deploy** just to run `cargo test --test api_route_solve`. Today the only documented Cloud path is full-stack setup. 3. **`indexer/.env` is gitignored and incomplete without automation.** Fresh Cloud Agent checkouts have [`indexer/.env.example`](indexer/.env.example) but no `indexer/.env`. Integration tests load dotenv from CWD; missing file → fallback URL may fail if Postgres/role/DB not provisioned. 4. **Host tooling gaps on Cloud VMs.** `setup-postgres-dev-databases.sh` requires **`psql`** on the host; Cloud Agent VMs may lack `postgresql-client`, causing silent skip of DB creation while still writing URLs — tests then fail at connect/migrate with opaque panics. 5. **Agent playbook completeness.** [`skills/AGENTS_LOCAL_POSTGRES_DEV.md`](skills/AGENTS_LOCAL_POSTGRES_DEV.md) documents local dev well but not a **minimal Cloud Agent bootstrap** (Postgres-only, no chain). ## Constraints and guardrails - **Do not change #324 solver logic** — this issue is infra/automation only; solver behavior is merged in MR !809. - **Preserve #283 / #324 cache invariants** — integration tests `route_solve_get_cache_tier_isolation` and `route_solve_get_cache_same_tier_reuses_lcd` must remain the authority for tier isolation vs same-tier sharing; do not weaken assertions to make setup "pass." - **Keep `cl8y_legal` as the app role** — do not revert to `postgres:postgres` as the default app user ([`scripts/lib/postgres-dev.env`](scripts/lib/postgres-dev.env), [#245](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/245)). - **Serialized integration tests** — automation must document/enforce `-j 1 -- --test-threads=1`; do not enable parallel integration runs against one `dex_indexer_test`. - **Idempotent scripts** — safe to re-run on an already-provisioned VM; must not wipe volumes or redeploy contracts unless explicitly requested (`--fresh`). - **No secrets in git** — `indexer/.env` stays gitignored; scripts write it locally only. - **Docker group / dockerd** — Cloud Agent shells may need `sg docker -c '…'` ([`AGENTS.md`](AGENTS.md)); new scripts must follow existing patterns in [`scripts/setup-cloud-agent-localterra.sh`](scripts/setup-cloud-agent-localterra.sh). - **Rust toolchain** — indexer needs Cargo **1.96+** (`export PATH="/usr/local/cargo/bin:$PATH"` in tmux sessions). ## Relevant files | Area | Paths | |------|-------| | Compose / init | `docker-compose.yml`, `docker/postgres-init/` | | Postgres env + bootstrap | `scripts/lib/postgres-dev.env`, `scripts/lib/postgres-bootstrap-role.sh`, `scripts/lib/upsert-dotenv.sh`, `scripts/setup-postgres-dev-databases.sh`, `scripts/test-setup-postgres-dev-databases.sh` | | Cloud Agent setup | `scripts/setup-cloud-agent-localterra.sh`, `AGENTS.md`, `Makefile` (`setup-cloud-localterra`, `test-setup-postgres`, `wait-healthy`) | | Deploy (full env) | `scripts/deploy-dex-local.sh` | | Indexer env template | `indexer/.env.example`, `indexer/.env` (gitignored, created by scripts) | | Integration harness | `indexer/tests/common/mod.rs`, `indexer/tests/api_route_solve.rs`, `indexer/tests/api_route_solve_db_hybrid.rs` | | QA verification | `scripts/qa/verify-issue-245.sh` (pattern for new `verify-issue-324` or generic target) | | Docs / skills | `docs/testing.md`, `skills/AGENTS_LOCAL_POSTGRES_DEV.md`, `skills/AGENTS_HYBRID_QUOTING.md`, `skills/AGENTS_INDEXER_HYBRID_BEST_EXECUTION.md` | | Reference CI | `.github/workflows/test.yml` (indexer job), `.gitlab-ci.yml` | ## Recommended direction 1. **Add a lightweight Cloud Agent Postgres bootstrap** — e.g. `scripts/setup-cloud-agent-indexer-postgres.sh` and/or `make setup-indexer-postgres` that: - Ensures dockerd (reuse `_ensure_dockerd` pattern). - Runs `docker compose up -d postgres` (not LocalTerra). - Waits for health (`pg_isready` via host or `docker compose exec`). - Runs database ensure + **`indexer/.env` sync** (`DATABASE_URL`, `TEST_DATABASE_URL` minimum). - Prints the exact integration test command. 2. **Harden `setup-postgres-dev-databases.sh` for Cloud VMs** — when host `psql` is missing, fall back to `docker compose exec -T postgres psql …` (same as `make wait-healthy` partially does for `pg_isready`). Fail loudly if DBs cannot be created. 3. **Optional flag on existing cloud script** — `--postgres-only` on [`scripts/setup-cloud-agent-localterra.sh`](scripts/setup-cloud-agent-localterra.sh) to run step 1 without wasm build/deploy. 4. **Makefile targets:** - `make setup-indexer-postgres` — bootstrap only. - `make test-indexer-integration` — depends on setup, runs `cd indexer && cargo test --tests -j 1 -- --test-threads=1`. - Optional: `make verify-issue-324` — lib concurrent/cache tests + `api_route_solve` cache tier tests (subset covering MR !809 integration gap). 5. **Update agent docs** — [`AGENTS.md`](AGENTS.md) § new subsection "Indexer integration tests (Postgres-only)" pointing to the lightweight path; cross-link in [`skills/AGENTS_LOCAL_POSTGRES_DEV.md`](skills/AGENTS_LOCAL_POSTGRES_DEV.md). 6. **Extend `scripts/test-setup-postgres-dev-databases.sh`** — static assert that cloud bootstrap script exists and is referenced from AGENTS.md; optional live test with `SKIP_LIVE` off on a VM with Docker. 7. **(Stretch, separate MR if large)** Align reference `.github/workflows/test.yml` indexer job with `cl8y_legal` + `dex_indexer_test` or document intentional divergence. ## Acceptance criteria - [ ] A documented **one-command** path on Cloud Agent VMs provisions Postgres + writes **`indexer/.env`** with valid `DATABASE_URL` and `TEST_DATABASE_URL` **without** `build-optimized` / `deploy-dex-local`. - [ ] `cd indexer && cargo test --test api_route_solve -- --test-threads=1` passes after the bootstrap on a fresh Cloud Agent VM (with Docker + Rust already provisioned per AGENTS.md). - [ ] `make test-indexer-integration` (or equivalent) passes the full integration suite serialized (`--tests -j 1 -- --test-threads=1`). - [ ] Bootstrap is **idempotent** — second run succeeds without error. - [ ] When host `psql` is absent but Docker is available, DB creation still succeeds via compose exec fallback. - [ ] [`AGENTS.md`](AGENTS.md) documents the Postgres-only path and distinguishes it from `make setup-cloud-localterra`. - [ ] `make test-setup-postgres` static checks cover the new automation. - [ ] Optional `make verify-issue-324` runs lib #324 tests + `api_route_solve` cache tier integration tests and is referenced from MR !809 verification docs / `skills/AGENTS_HYBRID_QUOTING.md`. ## Test plan (functional paths) | # | Scenario | Setup | Expected | |---|----------|-------|----------| | 1 | Fresh Cloud VM, no `indexer/.env` | Run new bootstrap command | `indexer/.env` created with both DB URLs; `dex_indexer` + `dex_indexer_test` exist | | 2 | Postgres-only bootstrap | `docker compose up -d postgres` via script | LocalTerra **not** started; port 5432 reachable | | 3 | Integration smoke | After bootstrap | `cargo test --test api_health -- --test-threads=1` green | | 4 | #324 integration coverage | After bootstrap | `cargo test --test api_route_solve route_solve_get_cache -- --test-threads=1` green | | 5 | Full `api_route_solve` | After bootstrap | Entire `api_route_solve` binary green serialized | | 6 | Full integration suite | After bootstrap | `cargo test --tests -j 1 -- --test-threads=1` green | | 7 | Idempotent re-run | Run bootstrap twice | No errors; tests still pass | | 8 | Missing host `psql` | Uninstall/locate without psql on PATH; Docker up | Script uses compose exec; DBs created; tests pass | | 9 | Stale volume (legacy `postgres:postgres`) | Old volume without `cl8y_legal` | Bootstrap creates role via superuser or prints actionable error + docs link ([#245](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/245)) | | 10 | Deploy skip path | Cloud setup with deploy stamp match, no redeploy | Postgres bootstrap still ensures test DB + env URLs if missing | | 11 | Lib-only fast path unchanged | No Postgres | `cargo test --lib` still works without bootstrap | | 12 | `make test-setup-postgres` | CI/agent static gate | Passes including new file references | ## Test plan (attack, hack, and abuse vectors) | # | Vector | Setup | Expected / guardrail | |---|--------|-------|------------------------| | A1 | **Cross-tier cache quote leakage (#283)** | Run `route_solve_get_cache_tier_isolation` after bootstrap | Distinct tiers → distinct cache keys/responses; test must pass | | A2 | **Same-tier over-sharing after #324 key change** | Run `route_solve_get_cache_same_tier_reuses_lcd` | Same tier shares cache (fewer LCD calls); different tier does not | | A3 | **Shared test DB race** | Two parallel `cargo test --tests` without `-j 1` | Documented failure mode; Makefile target enforces serialization; file lock reduces corruption ([#210](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/210)) | | A4 | **Credential leakage** | Inspect git status after bootstrap | `indexer/.env` gitignored; not committed | | A5 | **Superuser bootstrap misuse** | Run bootstrap against production-like Postgres without superuser | Script warns and skips destructive steps; no password reset on existing role ([`postgres-bootstrap-role.sh`](scripts/lib/postgres-bootstrap-role.sh) idempotent) | | A6 | **Wrong DB URL injection** | Manually set malicious `TEST_DATABASE_URL` in env | Tests connect only to operator-supplied URL — document that agents must not point at prod; default remains localhost test DB | | A7 | **Open Postgres port exposure** | After compose up | Postgres bound to `127.0.0.1:5432` only ([`docker-compose.yml`](docker-compose.yml)) | | A8 | **Rate-limit / DoS via integration tests** | Run route-solve integration tests | Tests use wiremock LCD ([`indexer/tests/common/lcd_mock.rs`](indexer/tests/common/lcd_mock.rs)); no live LCD amplification in default integration path | ## Verification criteria Third parties (and Cloud Agents closing this issue) should be able to run: ```bash # One-time / per-session Postgres bootstrap (no wasm deploy) make setup-indexer-postgres # or documented script equivalent # #324 follow-up: lib + integration cd indexer && cargo test --lib concurrent_solve hybrid_cache_key cd indexer && cargo test --test api_route_solve route_solve_get_cache -- --test-threads=1 # Full integration gate make test-indexer-integration # Static regression make test-setup-postgres ``` **Done when:** MR !809-style verification no longer lists `api_route_solve` as SKIP on Cloud Agent VMs; AGENTS.md documents the path; acceptance criteria checkboxes satisfied. ## Related - [MR !809](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/91) — merged #324; integration tests skipped on Cloud Agent - [#324](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/324) — concurrent candidate solve + cache-key robustness (implementation merged) - [#279](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/279) — parent hybrid solver program - [#283](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/283) — discount-tier cache isolation (must remain covered by integration tests) - [#245](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/245) — Postgres `cl8y_legal` bootstrap - [#210](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/issues/210) — shared test DB file lock - [`skills/AGENTS_LOCAL_POSTGRES_DEV.md`](skills/AGENTS_LOCAL_POSTGRES_DEV.md) — local Postgres playbook
ghost1 commented 2026-06-05 13:59:45 +00:00 (Migrated from gitlab.com)

mentioned in commit caeaa9389e

mentioned in commit caeaa9389eb37233d6dc2591f388cebc56485853
PlasticDigits commented 2026-06-05 14:08:09 +00:00 (Migrated from gitlab.com)

mentioned in merge request !818

mentioned in merge request !818
PlasticDigits commented 2026-06-05 14:08:26 +00:00 (Migrated from gitlab.com)

Implemented in !818.

Summary: Lightweight Cloud Agent Postgres bootstrap (make setup-indexer-postgres) provisions compose postgres + indexer/.env without wasm deploy. Host psql optional via compose exec fallback.

Verification (this VM):

  • make setup-indexer-postgres — PASS (idempotent)
  • make verify-issue-324 — PASS
  • cargo test --test api_route_solve — PASS (23/23)
  • make test-setup-postgres — PASS
  • make test-indexer-integration — FAIL at pre-existing indexer_ingestion_hardening (4 tests; same on origin/main)

Issue stays open until MR merges. Removing agent labels.

Implemented in [!818](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/100). **Summary:** Lightweight Cloud Agent Postgres bootstrap (`make setup-indexer-postgres`) provisions compose postgres + `indexer/.env` without wasm deploy. Host `psql` optional via compose exec fallback. **Verification (this VM):** - `make setup-indexer-postgres` — PASS (idempotent) - `make verify-issue-324` — PASS - `cargo test --test api_route_solve` — PASS (23/23) - `make test-setup-postgres` — PASS - `make test-indexer-integration` — FAIL at pre-existing `indexer_ingestion_hardening` (4 tests; same on origin/main) Issue stays open until MR merges. Removing agent labels.
PlasticDigits commented 2026-06-05 14:27:34 +00:00 (Migrated from gitlab.com)

mentioned in commit a4127b646c

mentioned in commit a4127b646cc449257adbae5449264d78bf5f65b3
Brouie commented 2026-06-06 02:05:51 +00:00 (Migrated from gitlab.com)

#335 — verified the bootstrap + automation + docs on current main (merged !818, commits caeaa93 / a4127b6). 7 of the 8 acceptance items hold; the 8th (full integration suite green) is blocked by a pre-existing, unrelated test failure that I root-caused — details below.

What passes:

  • One-command Postgres bootstrap, no deploy: make setup-indexer-postgres provisions compose postgres + syncs indexer/.env with DATABASE_URL + TEST_DATABASE_URL, no build-optimized / deploy-dex-local. Non-destructive — it upserts the DB URLs and left the rest of indexer/.env intact.
  • api_route_solve after bootstrap: 23/23 (the MR !809 / #324 integration gap is closed — these now run without a wasm deploy).
  • Idempotent: second run = "already exists", exit 0, no error.
  • psql-absent fallback: scripts/lib/postgres-psql.sh switches POSTGRES_PSQL_MODE host -> compose (docker compose exec) when host psql is missing.
  • AGENTS.md: "Indexer integration tests (Postgres-only)" section + --postgres-only, distinct from setup-cloud-localterra.
  • make test-setup-postgres: OK (static checks + live superuser bootstrap).
  • make verify-issue-324: 3/3 (lib concurrent_solve + hybrid_cache_key + api_route_solve cache tier); referenced from the agent skills.
  • Postgres bound 127.0.0.1:5432 only (A7); indexer/.env gitignored (A4).

The one that doesn't (acceptance #3 / make test-indexer-integration full suite):

  • The ONLY failing binary is indexer_ingestion_hardening: 2 passed, 4 failed (cursor_advances_on_empty_block_success, invalid_tx_and_header_timestamp_fails_block, missing_tx_timestamp_uses_block_header_time, multi_page_block_txs_ingested_count_matches_lcd_total). Every other integration binary passes.
  • Pre-existing + orthogonal to #335: !818 touched zero ingestion code (scripts/Makefile/docs + a 4-line api_route_solve.rs tweak), and indexer_ingestion_hardening.rs was last modified by #236/#243 — both BEFORE the #292 SDK53 tx-search migration.
  • Deterministic, not a shared-DB ordering artifact: fails identically in isolation (cargo test --test indexer_ingestion_hardening = 2 passed / 4 failed).
  • Root cause: the wiremock mocks use the OLD tx-search format. mount_block_txs_json matches query_param("events", "tx.height=H") and the pagination mocks match pagination.offset — but post-#292 the indexer queries the v4 format (txs?query=tx.height=H&page=1&limit=100&order_by=1), so wiremock returns 404 -> AllEndpointsFailed. The production indexer is fine against real v4 LCD; only these mocks lagged the #292 migration.

So #335's actual goal — Postgres-only integration testing without a wasm deploy — is achieved, and it surfaced exactly the kind of pre-existing gap it was built to expose (these integration tests were SKIP on the cloud agent that did the #292 work). The indexer_ingestion_hardening failure is its own test-debt fix (update the 3 stale wiremock matchers to the #292 query=/page/limit format), not in #335's scope.

@PlasticDigits — #335 itself is good on 7/8; the full-suite criterion is blocked only by the stale-mock test debt above. Want me to ship the test-only mock fix (small separate MR) so the suite goes green, or file it as its own issue? Your call.

#335 — verified the bootstrap + automation + docs on current main (merged !818, commits caeaa93 / a4127b6). 7 of the 8 acceptance items hold; the 8th (full integration suite green) is blocked by a pre-existing, unrelated test failure that I root-caused — details below. What passes: - One-command Postgres bootstrap, no deploy: `make setup-indexer-postgres` provisions compose postgres + syncs indexer/.env with DATABASE_URL + TEST_DATABASE_URL, no build-optimized / deploy-dex-local. Non-destructive — it upserts the DB URLs and left the rest of indexer/.env intact. - api_route_solve after bootstrap: 23/23 (the MR !809 / #324 integration gap is closed — these now run without a wasm deploy). - Idempotent: second run = "already exists", exit 0, no error. - psql-absent fallback: scripts/lib/postgres-psql.sh switches POSTGRES_PSQL_MODE host -> compose (docker compose exec) when host psql is missing. - AGENTS.md: "Indexer integration tests (Postgres-only)" section + `--postgres-only`, distinct from setup-cloud-localterra. - make test-setup-postgres: OK (static checks + live superuser bootstrap). - make verify-issue-324: 3/3 (lib concurrent_solve + hybrid_cache_key + api_route_solve cache tier); referenced from the agent skills. - Postgres bound 127.0.0.1:5432 only (A7); indexer/.env gitignored (A4). The one that doesn't (acceptance #3 / make test-indexer-integration full suite): - The ONLY failing binary is indexer_ingestion_hardening: 2 passed, 4 failed (cursor_advances_on_empty_block_success, invalid_tx_and_header_timestamp_fails_block, missing_tx_timestamp_uses_block_header_time, multi_page_block_txs_ingested_count_matches_lcd_total). Every other integration binary passes. - Pre-existing + orthogonal to #335: !818 touched zero ingestion code (scripts/Makefile/docs + a 4-line api_route_solve.rs tweak), and indexer_ingestion_hardening.rs was last modified by #236/#243 — both BEFORE the #292 SDK53 tx-search migration. - Deterministic, not a shared-DB ordering artifact: fails identically in isolation (cargo test --test indexer_ingestion_hardening = 2 passed / 4 failed). - Root cause: the wiremock mocks use the OLD tx-search format. mount_block_txs_json matches query_param("events", "tx.height=H") and the pagination mocks match pagination.offset — but post-#292 the indexer queries the v4 format (txs?query=tx.height=H&page=1&limit=100&order_by=1), so wiremock returns 404 -> AllEndpointsFailed. The production indexer is fine against real v4 LCD; only these mocks lagged the #292 migration. So #335's actual goal — Postgres-only integration testing without a wasm deploy — is achieved, and it surfaced exactly the kind of pre-existing gap it was built to expose (these integration tests were SKIP on the cloud agent that did the #292 work). The indexer_ingestion_hardening failure is its own test-debt fix (update the 3 stale wiremock matchers to the #292 query=/page/limit format), not in #335's scope. @PlasticDigits — #335 itself is good on 7/8; the full-suite criterion is blocked only by the stale-mock test debt above. Want me to ship the test-only mock fix (small separate MR) so the suite goes green, or file it as its own issue? Your call.
PlasticDigits commented 2026-06-06 06:49:16 +00:00 (Migrated from gitlab.com)

Fix the mock as part of this issue with new mr

Fix the mock as part of this issue with new mr
ghost1 commented 2026-06-06 06:55:40 +00:00 (Migrated from gitlab.com)

mentioned in commit fec80e46ed

mentioned in commit fec80e46ed150a723abb0cfdbeb7943eb2a9d086
PlasticDigits commented 2026-06-06 06:57:53 +00:00 (Migrated from gitlab.com)

mentioned in merge request !823

mentioned in merge request !823
PlasticDigits commented 2026-06-06 06:58:13 +00:00 (Migrated from gitlab.com)

Implemented the remaining test-debt fix requested in the last comment — !823.

Change: swap_events_hybrid_columns integration fixture now uses _contract_address (was contract_address), matching #285 parser scoping. Bootstrap infra from !818 was already on main; ingestion hardening wiremocks were aligned in de3b956 (#292).

Acceptance checklist

# Criterion Command Result
1 One-command Postgres bootstrap (no wasm deploy) make setup-indexer-postgres PASS
2 api_route_solve after bootstrap cd indexer && cargo test --test api_route_solve -- --test-threads=1 PASS (23/23)
3 Full integration suite serialized make test-indexer-integration PASS
4 Bootstrap idempotent make setup-indexer-postgres ×2 PASS
5 Host psql absent → compose exec fallback observed POSTGRES_PSQL_MODE=compose PASS
6 AGENTS.md Postgres-only path review (!818) PASS
7 make test-setup-postgres make test-setup-postgres PASS
8 make verify-issue-324 make verify-issue-324 PASS

Issue stays open until !823 merges.

Implemented the remaining test-debt fix requested in the last comment — [!823](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/105). **Change:** `swap_events_hybrid_columns` integration fixture now uses `_contract_address` (was `contract_address`), matching #285 parser scoping. Bootstrap infra from [!818](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/100) was already on `main`; ingestion hardening wiremocks were aligned in `de3b956` (#292). ## Acceptance checklist | # | Criterion | Command | Result | |---|-----------|---------|--------| | 1 | One-command Postgres bootstrap (no wasm deploy) | `make setup-indexer-postgres` | **PASS** | | 2 | `api_route_solve` after bootstrap | `cd indexer && cargo test --test api_route_solve -- --test-threads=1` | **PASS** (23/23) | | 3 | Full integration suite serialized | `make test-indexer-integration` | **PASS** | | 4 | Bootstrap idempotent | `make setup-indexer-postgres` ×2 | **PASS** | | 5 | Host `psql` absent → compose exec fallback | observed `POSTGRES_PSQL_MODE=compose` | **PASS** | | 6 | `AGENTS.md` Postgres-only path | review (!818) | **PASS** | | 7 | `make test-setup-postgres` | `make test-setup-postgres` | **PASS** | | 8 | `make verify-issue-324` | `make verify-issue-324` | **PASS** | Issue stays open until !823 merges.
PlasticDigits commented 2026-06-06 07:09:56 +00:00 (Migrated from gitlab.com)

mentioned in commit 593ab1353f

mentioned in commit 593ab1353f8facf62337aee7cf55ebf92109f772
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-06-06 07:19:36 +00:00
PlasticDigits commented 2026-06-06 07:19:47 +00:00 (Migrated from gitlab.com)

"## Verification \u2014 issue #335 (agent:verify)\n\nVerified on Cursor Cloud Agent VM against current main (includes !818 bootstrap + !823 ingestion mock fix).\n\nIssue: https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/335\n\n### Acceptance criteria\n\n| # | Criterion | Command / check | Result |\n|---|-----------|-----------------|--------|\n| 1 | One-command Postgres bootstrap (no wasm deploy) | Removed indexer/.env, ran make setup-indexer-postgres | PASS \u2014 compose postgres only (LocalTerra not started); indexer/.env created with DATABASE_URL + TEST_DATABASE_URL (cl8y_legal@127.0.0.1:5432) |\n| 2 | api_route_solve after bootstrap | cd indexer && cargo test --test api_route_solve -- --test-threads=1 | PASS \u2014 23/23 |\n| 3 | Full integration suite serialized | make test-indexer-integration | PASS \u2014 all binaries green (cargo test --tests -j 1 -- --test-threads=1, ~163s) |\n| 4 | Bootstrap idempotent | make setup-indexer-postgres \u00d72 | PASS \u2014 second run exit 0, DBs already exist |\n| 5 | Host psql absent \u2192 compose exec fallback | command -v psql \u2192 absent; bootstrap log | PASS \u2014 [setup-postgres] using docker compose exec psql (host psql not installed) |\n| 6 | AGENTS.md Postgres-only path documented | review AGENTS.md \u00a7 Indexer integration tests + skills/AGENTS_LOCAL_POSTGRES_DEV.md | PASS \u2014 distinct from make setup-cloud-localterra; --postgres-only on cloud script |\n| 7 | make test-setup-postgres static gate | make test-setup-postgres | PASS \u2014 OK: setup-postgres static checks |\n| 8 | make verify-issue-324 | make verify-issue-324 | PASS \u2014 3/3 (lib concurrent_solve, hybrid_cache_key, integration route_solve_get_cache) |\n\n### Additional functional checks\n\n| Scenario | Result |\n|----------|--------|\n| api_health smoke after bootstrap | PASS \u2014 1/1 |\n| make verify-issue-324 cache tier tests (route_solve_get_cache_*) | PASS \u2014 tier isolation + same-tier reuse (A1/A2) |\n| indexer_ingestion_hardening (previously blocking full suite) | PASS \u2014 6/6 |\n| Lib-only path without Postgres | PASS \u2014 cargo test --lib 131/131 with indexer/.env temporarily removed |\n| Postgres port binding (A7) | PASS \u2014 127.0.0.1:5432 in docker-compose.yml |\n| indexer/.env not committed (A4) | PASS \u2014 gitignored (.gitignore:2:.env) |\n| --postgres-only on setup-cloud-agent-localterra.sh | PASS |\n\n### Notes\n\n- MR !809 / #324 integration gap is closed: api_route_solve cache-tier HTTP tests run on Cloud Agent VMs without wasm deploy.\n- No repository changes were required during this verification pass.\n\nClosing as verified.\n"

"## Verification \u2014 issue #335 (agent:verify)\n\nVerified on Cursor Cloud Agent VM against current `main` (includes [!818](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/100) bootstrap + [!823](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/105) ingestion mock fix).\n\nIssue: https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/335\n\n### Acceptance criteria\n\n| # | Criterion | Command / check | Result |\n|---|-----------|-----------------|--------|\n| 1 | One-command Postgres bootstrap (no wasm deploy) | Removed `indexer/.env`, ran `make setup-indexer-postgres` | **PASS** \u2014 compose `postgres` only (LocalTerra not started); `indexer/.env` created with `DATABASE_URL` + `TEST_DATABASE_URL` (`cl8y_legal@127.0.0.1:5432`) |\n| 2 | `api_route_solve` after bootstrap | `cd indexer && cargo test --test api_route_solve -- --test-threads=1` | **PASS** \u2014 23/23 |\n| 3 | Full integration suite serialized | `make test-indexer-integration` | **PASS** \u2014 all binaries green (`cargo test --tests -j 1 -- --test-threads=1`, ~163s) |\n| 4 | Bootstrap idempotent | `make setup-indexer-postgres` \u00d72 | **PASS** \u2014 second run exit 0, DBs already exist |\n| 5 | Host `psql` absent \u2192 compose exec fallback | `command -v psql` \u2192 absent; bootstrap log | **PASS** \u2014 `[setup-postgres] using docker compose exec psql (host psql not installed)` |\n| 6 | `AGENTS.md` Postgres-only path documented | review `AGENTS.md` \u00a7 Indexer integration tests + `skills/AGENTS_LOCAL_POSTGRES_DEV.md` | **PASS** \u2014 distinct from `make setup-cloud-localterra`; `--postgres-only` on cloud script |\n| 7 | `make test-setup-postgres` static gate | `make test-setup-postgres` | **PASS** \u2014 `OK: setup-postgres static checks` |\n| 8 | `make verify-issue-324` | `make verify-issue-324` | **PASS** \u2014 3/3 (lib `concurrent_solve`, `hybrid_cache_key`, integration `route_solve_get_cache`) |\n\n### Additional functional checks\n\n| Scenario | Result |\n|----------|--------|\n| `api_health` smoke after bootstrap | **PASS** \u2014 1/1 |\n| `make verify-issue-324` cache tier tests (`route_solve_get_cache_*`) | **PASS** \u2014 tier isolation + same-tier reuse (A1/A2) |\n| `indexer_ingestion_hardening` (previously blocking full suite) | **PASS** \u2014 6/6 |\n| Lib-only path without Postgres | **PASS** \u2014 `cargo test --lib` 131/131 with `indexer/.env` temporarily removed |\n| Postgres port binding (A7) | **PASS** \u2014 `127.0.0.1:5432` in `docker-compose.yml` |\n| `indexer/.env` not committed (A4) | **PASS** \u2014 gitignored (`.gitignore:2:.env`) |\n| `--postgres-only` on `setup-cloud-agent-localterra.sh` | **PASS** |\n\n### Notes\n\n- MR !809 / #324 integration gap is closed: `api_route_solve` cache-tier HTTP tests run on Cloud Agent VMs without wasm deploy.\n- No repository changes were required during this verification pass.\n\nClosing as verified.\n"
PlasticDigits commented 2026-06-06 07:19:57 +00:00 (Migrated from gitlab.com)

Verification — issue #335 (agent:verify)

Verified on Cursor Cloud Agent VM against current main (includes !818 bootstrap + !823 ingestion mock fix).

Issue: https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/335

Acceptance criteria

# Criterion Command / check Result
1 One-command Postgres bootstrap (no wasm deploy) Removed indexer/.env, ran make setup-indexer-postgres PASS — compose postgres only (LocalTerra not started); indexer/.env created with DATABASE_URL + TEST_DATABASE_URL (cl8y_legal@127.0.0.1:5432)
2 api_route_solve after bootstrap cd indexer && cargo test --test api_route_solve -- --test-threads=1 PASS — 23/23
3 Full integration suite serialized make test-indexer-integration PASS — all binaries green (cargo test --tests -j 1 -- --test-threads=1, ~163s)
4 Bootstrap idempotent make setup-indexer-postgres ×2 PASS — second run exit 0, DBs already exist
5 Host psql absent → compose exec fallback command -v psql → absent; bootstrap log PASS — [setup-postgres] using docker compose exec psql (host psql not installed)
6 AGENTS.md Postgres-only path documented review AGENTS.md § Indexer integration tests + skills/AGENTS_LOCAL_POSTGRES_DEV.md PASS — distinct from make setup-cloud-localterra; --postgres-only on cloud script
7 make test-setup-postgres static gate make test-setup-postgres PASS — OK: setup-postgres static checks
8 make verify-issue-324 make verify-issue-324 PASS — 3/3 (lib concurrent_solve, hybrid_cache_key, integration route_solve_get_cache)

Additional functional checks

Scenario Result
api_health smoke after bootstrap PASS — 1/1
make verify-issue-324 cache tier tests (route_solve_get_cache_*) PASS — tier isolation + same-tier reuse (A1/A2)
indexer_ingestion_hardening (previously blocking full suite) PASS — 6/6
Lib-only path without Postgres PASS — cargo test --lib 131/131 with indexer/.env temporarily removed
Postgres port binding (A7) PASS — 127.0.0.1:5432 in docker-compose.yml
indexer/.env not committed (A4) PASS — gitignored (.gitignore:2:.env)
--postgres-only on setup-cloud-agent-localterra.sh PASS

Notes

  • MR !809 / #324 integration gap is closed: api_route_solve cache-tier HTTP tests run on Cloud Agent VMs without wasm deploy.
  • No repository changes were required during this verification pass.

Closing as verified.

## Verification — issue #335 (agent:verify) Verified on Cursor Cloud Agent VM against current `main` (includes [!818](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/100) bootstrap + [!823](https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/merge_requests/105) ingestion mock fix). Issue: https://gitlab.com/PlasticDigits/cl8y-dex-terraclassic/-/work_items/335 ### Acceptance criteria | # | Criterion | Command / check | Result | |---|-----------|-----------------|--------| | 1 | One-command Postgres bootstrap (no wasm deploy) | Removed `indexer/.env`, ran `make setup-indexer-postgres` | **PASS** — compose `postgres` only (LocalTerra not started); `indexer/.env` created with `DATABASE_URL` + `TEST_DATABASE_URL` (`cl8y_legal@127.0.0.1:5432`) | | 2 | `api_route_solve` after bootstrap | `cd indexer && cargo test --test api_route_solve -- --test-threads=1` | **PASS** — 23/23 | | 3 | Full integration suite serialized | `make test-indexer-integration` | **PASS** — all binaries green (`cargo test --tests -j 1 -- --test-threads=1`, ~163s) | | 4 | Bootstrap idempotent | `make setup-indexer-postgres` ×2 | **PASS** — second run exit 0, DBs already exist | | 5 | Host `psql` absent → compose exec fallback | `command -v psql` → absent; bootstrap log | **PASS** — `[setup-postgres] using docker compose exec psql (host psql not installed)` | | 6 | `AGENTS.md` Postgres-only path documented | review `AGENTS.md` § Indexer integration tests + `skills/AGENTS_LOCAL_POSTGRES_DEV.md` | **PASS** — distinct from `make setup-cloud-localterra`; `--postgres-only` on cloud script | | 7 | `make test-setup-postgres` static gate | `make test-setup-postgres` | **PASS** — `OK: setup-postgres static checks` | | 8 | `make verify-issue-324` | `make verify-issue-324` | **PASS** — 3/3 (lib `concurrent_solve`, `hybrid_cache_key`, integration `route_solve_get_cache`) | ### Additional functional checks | Scenario | Result | |----------|--------| | `api_health` smoke after bootstrap | **PASS** — 1/1 | | `make verify-issue-324` cache tier tests (`route_solve_get_cache_*`) | **PASS** — tier isolation + same-tier reuse (A1/A2) | | `indexer_ingestion_hardening` (previously blocking full suite) | **PASS** — 6/6 | | Lib-only path without Postgres | **PASS** — `cargo test --lib` 131/131 with `indexer/.env` temporarily removed | | Postgres port binding (A7) | **PASS** — `127.0.0.1:5432` in `docker-compose.yml` | | `indexer/.env` not committed (A4) | **PASS** — gitignored (`.gitignore:2:.env`) | | `--postgres-only` on `setup-cloud-agent-localterra.sh` | **PASS** | ### Notes - MR !809 / #324 integration gap is closed: `api_route_solve` cache-tier HTTP tests run on Cloud Agent VMs without wasm deploy. - No repository changes were required during this verification pass. Closing as verified.
PlasticDigits commented 2026-06-08 08:43:13 +00:00 (Migrated from gitlab.com)

mentioned in commit c0baf17f46

mentioned in commit c0baf17f46392f351af79afc597d0787a24e4129
PlasticDigits commented 2026-06-08 08:43:13 +00:00 (Migrated from gitlab.com)

mentioned in commit c99c7d335e

mentioned in commit c99c7d335ec5efadfbdec4b2875d3d50606c330e
PlasticDigits commented 2026-06-08 08:43:13 +00:00 (Migrated from gitlab.com)

mentioned in commit c9fa5ad7da

mentioned in commit c9fa5ad7da20c50a26d15e94ec9821c6afc9f6fb
PlasticDigits commented 2026-06-08 08:43:13 +00:00 (Migrated from gitlab.com)

mentioned in commit f090a17315

mentioned in commit f090a173150d0fb4eb18d452b0cdd55a26668da4
PlasticDigits commented 2026-06-08 13:42:27 +00:00 (Migrated from gitlab.com)

mentioned in commit d50d39a3ed

mentioned in commit d50d39a3ed9f6e58f4a548d0ac556aed32f78754
PlasticDigits commented 2026-06-08 13:42:28 +00:00 (Migrated from gitlab.com)

mentioned in commit 59c1013758

mentioned in commit 59c1013758d0a0b64d25cd2d98656847d892356e
PlasticDigits commented 2026-06-08 13:42:28 +00:00 (Migrated from gitlab.com)

mentioned in commit 59c1013758

mentioned in commit 59c1013758d0a0b64d25cd2d98656847d892356e
PlasticDigits commented 2026-06-08 13:42:28 +00:00 (Migrated from gitlab.com)

mentioned in commit 15bfbff71a

mentioned in commit 15bfbff71af44d56c4c23b0bc4a77c3849210f81
PlasticDigits commented 2026-06-08 13:42:30 +00:00 (Migrated from gitlab.com)

mentioned in commit 4ebf10632d

mentioned in commit 4ebf10632d11a9f4c14dd0fc46173f08930d94db
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic#335
No description provided.