Introducing a new way to review your PRs.

Read the announcement

zipstack / unstract

LLM-Driven Extraction of Unstructured Data — Built for API Deployments & ETL Pipeline Workflows

View on GitHub

28 documents · Updated Nov 23, 2026

docs / container-composition-and-testing

Container composition and test infrastructure

The repository uses Docker Compose and a shared test rig to make the platform repeatable for development, integration checks, and end-to-end checks. Compose joins product services with their data and message services. The test rig selects the right checks, starts the needed runtime, and reports test results and coverage of high-value product flows. This page complements Deployment and operations.

Container environments

Compose describes several views of one platform. The base environment runs the product-shaped service set. Development and debug layers improve the edit-and-inspect cycle. The test layer keeps the same service boundaries while adding deterministic test controls.

Base platform environment

The base platform in docker/docker-compose.yaml provides the shared local service boundary. User-facing services connect through the frontend and reverse proxy. Backend workers use the database, cache, object store, broker, and feature services to process requests and background work. Named volumes preserve selected platform state across container restarts.

The VERSION value selects the image family used by the stack. The composition makes the PostgreSQL-backed worker fleet the main path for orchestration, file processing, callbacks, scheduling, metrics, execution, notifications, and recovery. RabbitMQ remains part of selected hand-offs, so the local platform represents a mixed queue transition rather than one queue system. Redis carries execution logs across publishers and the log-stream consumer, while the PostgreSQL scheduler owns periodic work that no longer depends on the retired Beat path.

The Agent-KV callback queue is handled by the PostgreSQL IDE callback worker. This lets an Agent-KV job finish its result, cleanup, slot release, and webhook path after engine work completes. The executor and callback roles therefore form one product flow even though they run as separate services.

The base composition includes a shared host-gateway mapping. Services that need host-installed tools can reach them through host.docker.internal. This mapping is a shared network contract, so a service that needs extra host entries must preserve the gateway entry when it overrides the list.

The sandbox worker is a deliberate exception to the general worker pattern. It runs generated code in an isolated, read-only container with no host gateway, a bounded temporary area, dropped capabilities, and a fixed memory budget. Its queue, concurrency, and shutdown limits are sized together so generated work cannot silently outgrow the container or be reclaimed while it is still running. docker/docker-compose.yaml• L77-212

The development essentials composition provides a smaller stateful foundation for local work. It starts PostgreSQL, Redis, MinIO, the reverse proxy, feature flags, optional document parsing, Qdrant, and RabbitMQ. It also bootstraps the MinIO bucket with Prompt Studio data. These services expose their local ports and keep data in named volumes, so product services can run against a stable set of dependencies without starting the full application stack. docker/docker-compose-dev-essentials.yaml• L1-160

References: docker/docker-compose.yaml• L1-16 docker/docker-compose.yaml• L16-75 docker/docker-compose.yaml• L100-171 docker/docker-compose.yaml• L173-245 docker/docker-compose.yaml• L246-341 docker/docker-compose.yaml• L343-469 docker/docker-compose.yaml• L473-572 docker/docker-compose.yaml• L574-649 docker/docker-compose.yaml• L651-662 docker/docker-compose-dev-essentials.yaml• L1-160

Development and debug environments

The development override turns the platform into a faster local feedback loop. It builds local service images, reduces local worker costs, and uses Compose Watch to sync source changes or rebuild when dependency files change. The override can disable older worker profiles and keep optional services out of a normal development run.

The debug layer adds remote debugger listeners to Python services and workers. It must be layered on top of the base and development files. For PostgreSQL-backed workers, the debug command must preserve the queue consumer selected by the base service; otherwise the container can start a different worker that does not consume the queue used by the application.

References: docker/sample.compose.override.yaml• L1-38 docker/sample.compose.override.yaml• L40-105 docker/sample.compose.override.yaml• L162-332 docker/compose.debug.yaml• L1-18 docker/compose.debug.yaml• L18-65 docker/compose.debug.yaml• L67-188

Managed-like Redis environment

The managed-like Redis composition provides a local stand-in for a hosted Redis service. It requires authentication and accepts only TLS traffic, so services must use the secure connection path instead of succeeding through an unnoticed plaintext fallback. It runs beside the normal development Redis and uses a separate port, which lets an engineer switch between both modes without changing the default stack.

The certificate script creates development-only keys for both container and host names. The test setup therefore checks the full path from workers and execution sidecars through log streaming and cache use. The CA must be available to clients that verify the server; sidecars use the runner's explicitly forwarded TLS setting when they do not receive that CA mount.

References: docker/docker-compose-redis-tls.yaml• L1-69 docker/…/README.md• L1-27 docker/…/README.md• L38-123 docker/…/README.md• L125-148 docker/…/generate-certs.sh• L1-44 docker/…/.gitignore• L1-2

Test environment

The end-to-end environment layers tests/…/docker-compose.test.yaml over the base platform. It uses the image tag built for the test run and sets controls that make execution checks repeatable. The overlay keeps real service boundaries in place instead of replacing application services with test doubles.

The test environment supplies a mock LLM response to the workers that can execute work. It raises the file-batch setting for fan-out checks and can enable Agent-KV calculation and page-cap scenarios. Agent-KV uses one object-store prefix in both the backend and executor, and its callback worker receives the same opt-in webhook setting when a host receiver is part of the test. For browser checks, the frontend mounts a test NGINX configuration that serves the application and proxies the API paths through the same browser origin. This avoids dependence on the local reverse-proxy hostname and preserves the origin that the browser sends to the backend.

The test NGINX boundary is deliberately smaller than the production NGINX configuration. It serves the single-page application and forwards /api/v1, /deployment, and /public requests to the backend. It also keeps the frontend container usable as the unprivileged nginx user while the backend is still becoming ready. tests/compose/frontend-nginx.test.conf#L1-L106

References: tests/…/docker-compose.test.yaml• L1-31 tests/…/docker-compose.test.yaml• L33-76 tests/…/docker-compose.test.yaml• L77-94 tests/…/docker-compose.test.yaml• L96-109 tests/…/frontend-nginx.test.conf• L1-106 docker/README.md• L16-44

Service images and startup roles

The image set separates the platform into deployable roles while allowing related workers to share one image family. Compose uses the same image names for local runs and test runs, so a test can validate the image that a build produced.

Service image families

The main image families serve the frontend, backend API, runner, platform service, text service, tool sidecars, and workers. The unified worker image supports several queue roles through its startup command and environment. This keeps the service role explicit without requiring a separate image for each kind of background work.

The worker image is built for a non-root runtime and carries the shared worker code, package set, and executor plugins. Its Docker entry point provides the common start path, while Compose supplies the role-specific command and queue settings. This lets the sandbox and ordinary workers share a tested image family while receiving different security and resource boundaries. docker/dockerfiles/worker-unified.Dockerfile#L31-L52, docker/dockerfiles/worker-unified.Dockerfile#L78-L120

The frontend image has separate development and production goals. The development image starts the hot-reload server on port 80 after it creates runtime configuration. The production image builds static assets, serves them with NGINX, and creates the same runtime configuration at container start. The build can enable v1 development routes for the end-to-end image and select the product distribution that the frontend exposes; release builds leave the test-only route switch off. docker/dockerfiles/frontend.Dockerfile#L1-L100

The production frontend receives UNSTRACT_APPS_VERSION from the Compose image version. The running UI can therefore show the version of the image that is deployed, while runtime values such as the logo, analytics flag, and flow URL remain configurable when the container starts. frontend/generate-runtime-config.sh• L1-31

The Docker command guide is the main entry point for building and starting these images. It also explains how Compose file merging supports local resource limits, extra mounts, and alternate commands. Python project locks are maintained separately so image builds use current dependency definitions.

References: docker/README.md• L1-14 docker/README.md• L33-50 docker/docker-compose.yaml• L16-45 docker/docker-compose.yaml• L100-171 docker/docker-compose.yaml• L198-341 docker/docker-compose.yaml• L473-572 docker/…/worker-unified.Dockerfile• L1-17 docker/…/worker-unified.Dockerfile• L31-52 docker/…/worker-unified.Dockerfile• L78-120 docker/…/frontend.Dockerfile• L1-100 frontend/generate-runtime-config.sh• L1-31

Worker queue roles

The worker fleet divides background work by queue responsibility. Orchestration starts work, file processing fans work out, callbacks join results, schedulers trigger due work, and executor workers perform tool or model work. Metrics, logs, notifications, and recovery roles handle the supporting paths around execution.

The PostgreSQL queue workers cover the main orchestration and execution path, but the boundary is not fully broker-free. File processing, callbacks, scheduling, and some notifications still depend on RabbitMQ for downstream dispatch. The IDE callback role also drains agent_kv_callback; without it, an Agent-KV job can finish engine work but remain active because its final callback is not consumed. The reaper owns recovery and scheduled ticks. Dedicated consumers protect long-running execution and metrics work from short liveness limits.

Each worker role has a visibility window and health-stale window suited to its work. Long-running execution and file processing therefore need different limits from short callbacks or scheduled triggers. These settings are part of the queue contract because a window that is too short can reclaim live work and run it twice.

References: docker/docker-compose.yaml• L198-469 docker/docker-compose.yaml• L473-649 docker/compose.debug.yaml• L67-188

Local startup and inspection

The Docker command guide defines the normal local sequence: prepare environment files, build or select images, start the stack, then reach the frontend through its local hostname. Compose overrides provide the main way to reduce resource use or change a service for one developer.

Compose Watch reduces the time between a source edit and a running service. Debug ports provide a second inspection path when logs are not enough. These layers change how a service runs without changing the platform boundary that the tests exercise.

References: docker/README.md• L16-31 docker/README.md• L33-88 docker/README.md• L90-134

Release note delivery

The release-note script is the upgrade-time channel for self-hosted Compose operators. run-platform.sh --update prints entries from docker/…/release_notes.json when a target version crosses an entry's semantic-version boundary. This makes the notes part of the deployment contract rather than general project documentation.

The entries focus on actions that an operator must take or settings that an upgrade may leave unchanged. Environment merging preserves many existing values, so a changed sample default does not by itself change an upgraded deployment. Release entries must therefore use the release that carries the change and describe any required manual update, such as removing an old Agent-KV path override.

References: docker/…/README.md• L3-22 docker/…/README.md• L24-39 docker/…/release_notes.json• L1-10

Test rig

The test rig is the common control plane for repository tests. It turns named test groups into a dependency-ordered run, prepares infrastructure or a full platform when needed, and writes results that CI and engineers can use. Unit tests remain beside the service code. Cross-service and end-to-end tests use the shared tests area because they need common fixtures and runtime control.

Test group model

tests/groups.yaml is the source of truth for the test plan. A group states its tier, paths, runner, working directory, service or platform needs, dependencies, and whether it is critical or optional. Group settings can also define markers, coverage scope, package setup, and test environment values. The rig validates paths, runner settings, dependency edges, and platform-gate rules before it runs anything. It expands dependencies and runs the selected groups in a safe order.

The plan separates frontend and package or service unit checks from infrastructure-backed integration checks and real-platform end-to-end checks. Unit coverage includes the rig, both frontend unit suites, SDK, backend, workers, connectors, core packages, schema, filesystem, runner, tool-sidecar, and platform-service groups. Integration groups provision only the stateful services that they need. Platform groups depend on e2e-smoke, so the basic platform gate runs before the flows that rely on it. The optional e2e-agent-kv group is serialized because its concurrency scenario can occupy organization-wide slots until asynchronous finalization releases them. Optional groups such as Agent-KV, browser, Hurl, and some live-service checks can provide extra coverage without blocking a run that does not have their runtime or product needs.

Selection can come from named groups, a file, a tier, or changed paths. A missing optional path can skip without blocking. A failed dependency blocks its dependents. A required pytest group that collects no tests fails because an incorrect selection must not look successful. A red optional group remains visible in the report but does not gate the overall run.

The model supports pytest, HTTP checks, Vitest, and Playwright. This gives fast local checks and full browser checks one selection and reporting model.

References: tests/groups.yaml• L10-45 tests/groups.yaml• L47-199 tests/groups.yaml• L200-357 tests/…/groups.py• L21-31 tests/…/groups.py• L62-86 tests/…/groups.py• L157-182 tests/…/groups.py• L321-421 tests/…/test_groups.py• L18-222 tests/…/test_groups.py• L224-343 tests/…/test_groups.py• L388-537

Frontend test groups

Frontend checks use the same group model as service tests but cover different product boundaries. The frontend group uses Vitest and a DOM simulator for component behavior. The separate frontend-v1-unit group uses its own Vitest configuration for the v1 frontend suite, so the two suites do not change each other's result. The optional ui group uses Playwright against the running application, while frontend-v1-e2e exercises the versioned v1 routes in a real browser.

The browser groups support the OSS login path and enterprise Auth0 login. They can select the mode explicitly or detect it from the platform response. The v1 browser fixtures also require a distribution tag on each test. This lets the same suite run against the distributions that ship a page without silently collecting a test that belongs nowhere. Missing browser dependencies or unsuccessful optional authentication skip the group rather than turning an unavailable browser environment into a blocking failure, except that a rig-managed platform treats an unavailable login as a real failure.

References: tests/README.md• L118-167 tests/groups.yaml• L49-80 tests/groups.yaml• L334-357 tests/…/auth.ts• L1-18 tests/…/tags.ts• L1-115 tests/…/groups.py• L83-86 tests/…/test_cli.py• L841-1015

Selection rules

The rig combines positional group names, groups read from a file, tier filters, and changed-path selection. It then expands dependencies and orders the result before execution. The literal all selects every group, while an empty result is an error so an unintended selection cannot appear successful.

Changed-only selection compares the branch with its base revision and selects groups whose paths or working directories overlap the change. This supports fast branch feedback without changing the dependency and reporting rules used by a full run. The selected runnable groups define the scope for critical-path evaluation; skipped optional placeholders do not turn an unrun tier into a regression.

References: tests/README.md• L181-192 tests/…/selection.py• L1-200 tests/…/groups.py• L123-155 tests/…/cli.py• L469-496 tests/…/test_cli.py• L25-143

Runtime modes

The rig exposes one platform interface to tests while supporting three runtime modes. Compose runs the full production-shaped platform. Testcontainers starts stateful infrastructure for tests that do not need the full application. Local mode uses a platform that the engineer has already started.

The rig starts a platform once for a run that needs one. Compose captures the merged configuration after startup in reports/compose-config-<project>.yaml, so teardown can still see the exact services, networks, and volumes that it created if an overlay later moves or disappears. Before teardown, it saves container logs while they are still available and removes project-labeled volumes that a missing overlay no longer exposes. It waits for the backend, platform service, X2Text service, and frontend; the runner is not a readiness dependency because execution is moving into workers. The frontend probe checks / because a served application document is the browser contract.

Compose can also receive extra overlay files from the run environment. The runtime validates those paths before startup and captures the resolved file set, so a downstream overlay can add services without making teardown depend on a file that later disappears.

Testcontainers starts PostgreSQL, Redis, RabbitMQ, and MinIO for local infrastructure-backed groups. It does not start the backend or other application services, so full platform end-to-end checks use Compose or a developer-managed local stack. Local mode only reads the service URLs from the environment and leaves startup and shutdown to the developer.

The runtime keeps one endpoint interface while changing how those endpoints are supplied:

RuntimeMain useScope
ComposeCI and production-shaped end-to-end checksFull platform with the test overlay
TestcontainersLocal checks with real stateful servicesDatabase, cache, broker, and object store
LocalFast work against a developer-managed stackExisting service endpoints

The testcontainers mode currently provisions infrastructure only. It does not launch the backend or other application services as local subprocesses, so full-platform end-to-end checks should use Compose until that wiring exists. Runtime-provided endpoint values do not replace values already present in the environment, which makes local overrides useful but can also hide stale settings. The smoke check compares the fixture endpoint with the environment value to expose that mismatch.

This diagram shows how group selection becomes a prepared runtime and a report.

flowchart LR
    A[Selected groups] --> B{Platform needed?}
    B -->|No| C[Run group-local tests]
    B -->|Yes| D[Choose Compose, Testcontainers, or local]
    D --> E[Provide service endpoints]
    E --> F[Run groups in dependency order]
    C --> G[Write group results]
    F --> G
    G --> H[Evaluate critical paths]

References: tests/README.md• L196-208 tests/…/runtime.py• L34-81 tests/…/runtime.py• L120-201 tests/…/runtime.py• L203-306 tests/…/runtime.py• L308-400 tests/…/runtime.py• L413-462 tests/…/test_cli.py• L401-457

End-to-end fixtures

API end-to-end fixtures create state through the product API. Shared fixtures handle login, organization selection, service access, workflow provisioning, and asynchronous execution. This lets each test focus on a product flow rather than repeat setup.

The rig sets a deterministic LLM response before the platform starts, and the test overlay passes it to execution workers. This keeps answer and token assertions stable and prevents execute-path checks from calling a real provider. The control applies to LLM completions, not embeddings, so workflows that index chunks need a separate embedding test strategy.

The ETL fixture adds a second workflow whose source and destination use the MinIO object store. The test reaches MinIO through its published endpoint, while workers use the Compose-network endpoint for the same bucket. One scheme controls both views, and a rig-provisioned run treats a missing client or unusable store as a failure instead of a skip.

The Agent-KV fixture creates a session key through the tenant API, then uses that key against the product extraction API at /api/v1/agentic-extract/. Static PDF, spreadsheet, and rent-roll fixtures cover document and table extraction paths. Shared helpers shape extractor requests, read extractor-specific results and stages, submit jobs, poll terminal state, cancel jobs, and delete jobs so scenarios can focus on authentication, validation, execution, and lifecycle behavior.

Accepted Agent-KV submits require three caller-supplied adapter IDs for the target organization: an advanced LLM adapter, a cheaper LLM adapter, and an X2TEXT adapter. The module also requires an explicit Agent-KV opt-in and a running backend URL. A dispatched failure scenario uses a separate operator-supplied LLM adapter with an invalid provider credential; it no longer relies on an executor-level LLM API key. Page-cap and host-webhook scenarios remain explicit configuration gates. Assertions check result and error structure rather than model-specific values, which keeps the lane useful with a mock or a real provider.

The original browser fixtures provide a shared layer for UI checks. The v1 fixture set adds a versioned browser contract: it reuses the v0 sign-in session, selects an organization, exposes both API and browser session context, creates and removes organization-scoped rows, waits for hydration without an unbounded network wait, and enables pre-release v1 pages only in the E2E build. Session checks prove that an active v0 session opens v1 without a second sign-in and that an ended or missing session reaches sign-in before protected data loads. Distribution tags decide whether a test runs for OSS, cloud, or on-prem.

The v1 browser helpers also cover the old-version preference for pages that support it. They verify the v1-to-v0 route, reload persistence, and the return route when the preference is off. Browser routes therefore use the same organization and user session as API calls while page availability and version routing follow the selected product distribution.

This diagram shows the v1 browser fixture flow from runtime setup to isolated page checks.

flowchart LR
    A[Rig endpoints and auth mode] --> B[Authenticate]
    B --> C[Select organization]
    C --> D[Share API and browser session]
    D --> E[Seed org-scoped data]
    E --> F[Apply v1 preview and distribution gate]
    F --> G[Run page flow]
    G --> H[Delete seeded data]

References: tests/README.md• L210-220 tests/README.md• L234-237 tests/…/docker-compose.test.yaml• L4-31 tests/…/docker-compose.test.yaml• L47-76 tests/…/conftest.py• L1-95 tests/…/conftest.py• L106-204 tests/…/conftest.py• L28-126 tests/…/conftest.py• L157-253 tests/…/conftest.py• L287-376 tests/…/test_agent_kv_e2e.py• L1-81 tests/…/test_agent_kv_e2e.py• L200-253 tests/…/auth.ts• L78-115 tests/…/auth.ts• L235-442 tests/…/env.ts• L1-29 tests/…/preview.ts• L1-78 tests/…/seed.ts• L1-118 tests/…/settle.ts• L1-15 tests/…/tags.ts• L1-115 tests/…/conftest.py• L91-126 tests/…/conftest.py• L205-253 tests/…/old-version.ts• L45-62 tests/…/old-version.ts• L100-158 tests/…/session.spec.ts• L26-95

End-to-end coverage

End-to-end groups protect the platform at its product boundaries. Smoke proves that the platform is reachable before the other platform groups run. API groups cover login, co-owner controls, workflow execution, API deployment, Prompt Studio responses, object-store ETL, and the optional Agent-KV product API lane. An optional Hurl group adds HTTP checks, while the optional Playwright groups provide browser layers for the existing UI and the v1 UI.

The Agent-KV lane is opt-in because it needs the cloud executor plugin and organization-level adapter setup. It requires AGENT_KV_E2E=1, a backend URL, and adapter IDs for scenarios that must dispatch accepted work. It covers API-key authentication, submit validation, completed and failed jobs, cancellation, deletion, page caps, sync-wait results, Excel input, webhooks, and concurrency limits through the product extraction path. The dispatched-failure check additionally needs an invalid LLM adapter chosen by the operator. The lane does not run by accident on a plain OSS platform.

The workflow fan-out path has an explicit coverage gap. Current execution results do not expose a durable batch or task identity that can prove that files ran in separate batches, and timing is not a reliable substitute under runner contention. The API deployment checks still prove the rejoin contract: one result per file, all files counted as successful when appropriate, and one row per file.

The most important distinction is between API and browser responsibility. API tests prove state changes and asynchronous results. Browser tests prove route rendering, layout, distribution-specific page availability, and browser-only behavior that a DOM simulator cannot observe.

Test areaProtected behavior
SmokeLogin and basic platform health
API flowsAuthentication, co-owner controls, workflows, Prompt Studio, and deployment results
ETLObject-store source and destination flow through MinIO
Agent-KVAPI-key jobs, extraction results, lifecycle controls, limits, and callbacks
HTTP checksOptional protocol-level end-to-end checks
Browser UIOptional Playwright checks against the real application UI
Versioned browser UIDistribution-tagged v1 route and page checks

References: tests/README.md• L26-37 tests/README.md• L222-232 tests/README.md• L234-236 tests/…/docker-compose.test.yaml• L42-55 tests/groups.yaml• L246-357 tests/…/test_agent_kv_e2e.py• L1-81 tests/…/test_agent_kv_e2e.py• L200-253 tests/…/test_agent_kv_e2e.py• L261-365 tests/…/test_agent_kv_e2e.py• L411-621 tests/…/test_agent_kv_e2e.py• L629-747 tests/…/test_agent_kv_e2e.py• L753-818 tests/…/tags.ts• L1-115 tests/…/conftest.py• L28-60 tests/…/conftest.py• L157-186 tests/…/session.spec.ts• L26-95 tests/…/old-version.ts• L100-158

Critical paths

Critical paths are named user or system flows whose failure has wider impact than one test file. tests/critical_paths.yaml maps each path to the groups that can prove it. A path is covered only when a mapped group passes.

The registry supports two proof levels. Group proof accepts any passing mapped group. Marker proof also requires a passing test with the matching critical_path marker, which prevents a group from appearing to protect a path after its real test is removed. The registry uses marker proof for the listed paths and keeps multi-file fan-out as an explicit gap because the current checks cannot observe batch identity.

The rig compares the current result with a cached main-branch baseline. It reports a gap when no covering group passes and a regression when a previously covered path loses coverage. A gap covered only by an unrun tier or with no declared group is out of scope and warns rather than failing that tier. An in-scope gap from a failed or unproven covering group can fail the run.

References: tests/critical_paths.yaml• L1-25 tests/critical_paths.yaml• L27-125 tests/README.md• L169-177 tests/…/test_cli.py• L299-399 tests/…/test_cli.py• L1144-1293

Reports and coverage

The rig keeps each group result separate, then combines the results into reports for people and automation. JUnit provides machine-readable test detail. Markdown and JSON summaries show group state and critical-path state. A compatibility report supports existing pull request comment flows.

Results distinguish passing, empty, failed, and blocked groups. A dependency-blocked group records the failed dependencies and never attests coverage. Empty collection is a neutral result for optional placeholders, but a required pytest group that collects nothing is a run failure. The parser treats malformed XML or missing counters as errors rather than as green zero-test runs. Vitest and Playwright write native JUnit; Hurl and early runner failures receive a synthetic report so their state remains visible.

Coverage is evidence for the test plan rather than a fixed percentage gate. Separate group files avoid collisions during parallel runs. The rig combines them after execution and carries results across CI tiers when the jobs merge artifacts. A corrupt baseline is shown in the durable summary and fails the reporting path; a red run cannot update the baseline.

References: tests/README.md• L240-276 tests/…/reporting.py• L27-73 tests/…/reporting.py• L80-218 tests/…/reporting.py• L231-380 tests/…/cli.py• L352-457 tests/…/test_reporting.py• L16-206 tests/…/test_cli.py• L460-649 tests/…/test_cli.py• L1144-1293

Repository integration

Tox gives developers and CI stable commands while the rig owns the test plan. Frontend, service unit, infrastructure-backed integration, API end-to-end, and browser end-to-end commands therefore resolve through the same group model instead of maintaining separate test lists.

CI builds tagged service images for the platform end-to-end lane. The test Compose overlay consumes those tags. Reports from the test tiers are combined after the tiers finish, and the combined result evaluates critical paths. A successful main-branch run can update the baseline used for later regression checks.

Branch policy belongs to CI rather than the rig. Main runs can fail on critical-path gaps and update the baseline after successful tier runs. Pull requests still show gaps without failing for them, while regressions remain errors. The slower end-to-end lane runs only for the CI cases that request it, such as main, labeled pull requests, scheduled runs, or manual dispatch.

The test rig's own unit suite protects the contracts that join these parts. It checks manifest expansion and validation, platform-gate rules, endpoint injection, dependency blocking, runner command shape, report parsing, and baseline decisions. Its fixtures clear inherited extra manifests so synthetic manifests test only the graph that they define.

The Agent-KV lane adds a deliberate product-specific boundary to this flow. Group selection keeps it optional and serial, while the Compose overlay supplies the executor queue, storage prefix, callback settings, and opt-in controls that must agree across services. Accepted-submit scenarios also depend on adapter IDs in the target organization, and the failed-job scenario depends on an explicitly invalid LLM adapter. The lane then proves behavior against the running platform rather than a mocked application boundary.

This diagram shows the repository validation path from a source change to the final policy result.

flowchart TB
    A[Source change] --> B[Select test groups]
    B --> C[Run unit and integration tiers]
    A --> D[Build tagged service images]
    D --> E[Run Compose API and browser checks]
    C --> F[Publish tier reports]
    E --> F
    F --> G[Combine reports and critical paths]
    G --> H[Review result and update main baseline]

The image tag is a shared contract between the build output, base Compose file, and test overlay. A filtered-out tier is a skipped scope, not a failed test. A tier that runs and fails remains visible and can block the final result.

References: tests/README.md• L280-288 tests/README.md• L346-369 tests/…/docker-compose.test.yaml• L4-18 tests/…/docker-compose.test.yaml• L47-94 tests/…/cli.py• L460-768 tests/…/conftest.py• L1-26 tests/…/test_cli.py• L746-839

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the image tag contract aligned between image builds, base Compose services, and the test overlay.
  • When a service readiness target or browser origin changes, update the runtime probes, smoke checks, and test NGINX boundary together.
  • When a worker queue or role changes, update the Compose role and the debug override so local inspection still consumes the intended queue.
  • When a worker's transport, periodic ownership, visibility window, or health limit changes, check its producer, consumer, scheduler, and recovery partners together.
  • When the test mock, file-batch control, Agent-KV storage prefix, adapter IDs, page cap, or executor queue changes, keep the backend, executor, callback worker, and rig defaults aligned.
  • When the Agent-KV callback queue changes, check job finalization, staged-input cleanup, concurrency-slot release, and webhook delivery together.
  • When a group path, runner, dependency, optional flag, or critical-path marker changes, check the critical-path mapping and the dependency gate behavior.
  • When a group workdir, marker, package setup, Vitest config, or coverage scope changes, check that the selected runner still reaches the intended tests and reports the intended source.
  • When an end-to-end group changes, preserve the e2e-smoke dependency and review whether its critical or optional status still matches its role in the release gate.
  • When a critical path changes from group proof to marker proof, ensure the mapped test carries the exact path marker.
  • When a stateful service changes, check both the Compose service path and the Testcontainers endpoint injection path.
  • When Redis TLS support changes, check the secure listener, certificate names, client CA settings, sidecar forwarding, and the separate cache database contract together.
  • When ETL storage endpoints change, keep the test's published endpoint and the workers' internal endpoint on the same scheme, credentials, bucket, and path model.
  • When report or baseline behavior changes, preserve the distinction between skipped scope, empty collection, blocked dependency, gap, regression, and an optional red group.
  • When Compose overlays are added or removed during a run, preserve the saved merged configuration and log capture path so teardown still removes the right project resources and keeps failure evidence.
  • When an HTTP service or browser endpoint changes, update the single readiness target list and the endpoint values passed to fixtures together.
  • When Testcontainers infrastructure changes, keep paired host and port values complete and keep the endpoint credentials available to connector checks.
  • When frontend or browser test dependencies change, preserve the optional skip behavior and keep OSS and Auth0 login flows aligned with the API fixture.
  • When changed-only selection changes, preserve the union of explicit, file, tier, and path-based selection before dependency expansion.
  • When the LLM mock or execution controls change, keep the value set before platform startup and forwarded to every execute-path worker.
  • When manifest overlays change, preserve name-collision checks, cross-manifest dependencies, and isolation for explicit manifest loads.
  • When the frontend build stages or runtime configuration change, keep development and production serving on the expected port and preserve the test-only route controls without changing release defaults.
  • When a self-hosted upgrade changes a default, URL, migration, or required operator action, add or retarget the release note at the version that carries the change; a sample environment change alone does not update retained values.
  • When the Agent-KV public path changes, keep the release note, backend default, test client URL, and operator-facing probe on the same path.
  • When the shared host-gateway mapping changes, keep every service override from silently dropping host access.
  • When the frontend version contract changes, keep the Compose image tag and the UNSTRACT_APPS_VERSION runtime value aligned.
  • When the test browser origin or backend route prefixes change, keep the test NGINX proxy list, forwarded host header, and browser API base URL aligned.
  • When v1 pages or product distributions change, keep the E2E build route switch, preview registry, distribution tags, and group selection aligned.
  • When v1 auth or organization selection changes, keep the API session, browser route name, user id, and OSS/Auth0 handshake contracts aligned.
  • When v1 session guards or old-version routing changes, keep the v0 cookie handoff, sign-in redirect, user storage marker, route mappings, and reload checks aligned.
  • When v1 seeded resources change, preserve reverse-order cleanup and fail on rows that cannot be deleted so one shared organization does not accumulate test state.
  • When Agent-KV adapter validation changes, keep the three accepted-submit adapter IDs, their organization and types, and the invalid-adapter failure setup aligned with the deployed API.
  • When Agent-KV test gates change, keep explicit opt-in, page-cap, webhook, and concurrency controls aligned with the scenario's premise.

Important failure modes

TriggerConsequenceGuard
A release note is keyed to a version that does not carry the change, or no note covers a retained setting changeAn operator may edit the wrong value, miss a required action, or run a released stack with stale behaviorKey each note to the carrying release and document actions that environment merging does not apply automatically
An Agent-KV caller or fixture keeps the retired public pathThe request reaches the wrong route and can look like an authentication failureKeep the /api/v1/agentic-extract/ contract aligned across the service, tests, and upgrade note
Build and test Compose files use different image tagsEnd-to-end checks run old images or cannot find the built imagesPass one test version through image build and test startup
The test frontend serves the SPA without API proxy pathsBrowser login and authenticated UI checks fail even though the page loadsMount the test NGINX configuration and keep its proxy paths aligned with the backend boundary
The test NGINX proxy uses the wrong host header or resolves the backend too earlyCSRF rejects browser writes, or the frontend fails during a backend startup racePreserve the browser host and dynamic Docker DNS lookup in the test boundary
A debug override replaces a PostgreSQL worker with the wrong commandThe container starts but does not consume the queue used by the applicationPreserve the base queue consumer command in the debug layer
The Agent-KV executor does not consume the Agent-KV queueJobs remain dispatched because no worker runs the extraction requestKeep agent_kv execution on WORKER_PG_QUEUE_CONSUMER_QUEUE and use the production-shaped executor image
The Agent-KV callback queue is not assigned to the IDE callback workerA job can finish engine work but remain active without result cleanup, slot release, or webhook deliveryKeep agent_kv_callback in the PostgreSQL callback consumer queue
Backend and executor use different Agent-KV storage prefixesThe executor cannot read staged input or find the matching OCR cacheSet one bucket-rooted prefix in both services
Accepted-submit Agent-KV tests lack one of the three organization adaptersThe API rejects the request before dispatch, so extraction assertions cannot runExport caller-owned LLM, cheaper LLM, and X2TEXT adapter IDs for the target organization
The Agent-KV failed-job scenario uses a valid adapter or the obsolete executor API-key gateThe job completes instead of reaching the terminal failed path, or the scenario skips a configured laneSupply AGENT_KV_E2E_BAD_LLM_ADAPTER for an adapter with an intentionally invalid provider credential
Agent-KV concurrency tests run in parallelSibling tests receive false 429 responses while the saturation jobs finalizeKeep the group serial and run the saturation scenario last
A worker's visibility timeout is shorter than its taskLive work is reclaimed and can run twice, or the worker is marked staleSet visibility and health-stale limits above the role's worst-case work time
Periodic ownership is not adopted while the old scheduler is absentScheduled work remains stored but never firesKeep periodic adoption enabled when the PostgreSQL scheduler replaces Beat
Required host access is lost from a Compose service overrideA container cannot reach host-installed tools or callback servicesPreserve host.docker.internal:host-gateway whenever extra_hosts is overridden
A required group collects no testsA broken path or marker appears greenTreat empty required pytest collection as a failure
A smoke dependency failsDependent platform checks run against a partial or unready stackMake platform groups depend on the smoke gate and block dependents
A group uses the wrong runner, workdir, Vitest config, or marker filterThe intended suite is skipped or a different suite reports the resultValidate group settings and keep them aligned with the suite's project boundary
The LLM mock is absent from execute-path workersTests call a real provider or skip the behavior they should proveSet the mock before platform startup and forward it to the executing workers
A covering group is red or has no passing marked testIts critical path is reported as a gap or regression rather than coveredCount only passing covering groups and apply marker proof where configured
A critical path maps to a group that does not exercise itA failure in an unrelated test falsely changes path coverageMap each path only to a group and marker that observe the named flow
Runtime startup fails and teardown hides the first errorThe useful startup failure is lost behind a cleanup errorPreserve the in-flight startup exception during teardown
A baseline is corrupt or updated from a red runRegression checks become unreliable on later buildsReport baseline corruption and update the baseline only after a successful run
A Compose overlay disappears before teardownContainers may stop but declared volumes can remain and later runs can conflictTear down from the saved merged config and remove project-labeled leftover volumes
A client points at the managed-like Redis listener without TLS or the right CAThe connection fails loudly, or a client uses the wrong Redis mode and misses execution or log dataKeep the plaintext listener disabled and align the URL, password, CA, hostname, and sidecar settings
ETL tests use different MinIO schemes or endpoints for the test and workersConnector setup can pass but the workflow cannot read or write the object-store prefixesDerive both views from one scheme and verify the rig-provided store before creating the workflow
The runner is treated as a readiness targetEnd-to-end startup waits for or fails on a service that the execution path no longer needsKeep readiness targets aligned with the current in-worker execution path
Testcontainers starts only part of a paired endpointConnector setup receives incomplete infrastructure settings and fails laterReject host or port pairs that are not both present
A browser runner lacks its packages or browser binaryOptional UI coverage disappears without a visible test failureKeep the frontend and browser groups optional and report the skipped group
A stale environment URL overrides a runtime endpointTests connect to the wrong platform while the runtime appears healthyCompare fixture URLs with exported runtime values and clear stale overrides
Fan-out is inferred from timing aloneResource contention makes serial and parallel runs look alike, leaving the path falsely unprovenTreat fan-out as an explicit observability gap until execution exposes batch or task identity
The LLM mock is active during adapter connection validationThe connection check rejects the fixed mock response even though normal execution is deterministicKeep adapter-registration coverage separate from the mocked execute path
An overlay group collides with a base group or inherits an unintended test configThe merged test plan is ambiguous or runs with another project's optionsReject duplicate names and reject pytest config inherited from an unrelated project
A dependency is red or blocked but its dependent still runsTests produce noise against a failed precondition and can falsely suggest coverageRecord blocked groups and cascade the dependency failure before execution
A report has malformed XML, no counters, or no file after a runner crashA failed or incomplete group can disappear from the summaryParse counters strictly and create a synthetic report for early runner failures
A production frontend image expects build-time configuration for a runtime-only valueThe deployed UI shows stale or empty settings until the image is rebuiltKeep deploy-time settings in the generated runtime configuration and build-time route settings in the image build
The runtime config script cannot write or serve its generated fileThe frontend loads without the expected version or product settingsCreate the config directory with NGINX-readable permissions and run the entrypoint before serving
A v1 test has no distribution tag or uses a page that the selected distribution does not shipThe test fails collection or asserts a route that the build must not exposeRequire a known distribution tag and reject non-shipping preview pages
The v1 preview switch is enabled in a release imagePre-release routes become available outside the intended E2E buildKeep VITE_V1_DEV_ROUTES limited to the test image
A v1 page loses the v0 session handoff or its session guardA signed-in user must sign in again, or a guest can trigger protected data calls before redirectKeep the v0 session cookie handoff and redirect guard covered by the session lane
An old-version toggle page changes its route map or storage key without updating the round-trip helperThe preference appears to work in one direction but reloads or return navigation land on the wrong UICheck the user-scoped preference, v1-to-v0 map, reverse map, and reload path together
A v1 browser test cannot derive a delete path or cleanup failsRows leak into the shared organization and change later test resultsTrack every created row and fail teardown when it cannot delete the row
A rig-managed v1 login fails but the fixture skips itA broken platform appears green with no browser coverageTreat missing credentials or failed login as errors for rig-managed runs
A browser fixture waits forever for network idlePolling or a long request consumes the whole test timeoutUse a bounded settle wait and continue when the page has not become idle
The sandbox worker has a writable host path, host gateway, or uncapped temporary areaGenerated code can reach host services or consume host resourcesKeep the sandbox isolated, use a bounded temporary area, and drop capabilities

Key files

FileWhy to read it
docker/docker-compose.yamlDefines the platform services, worker roles, queue transition, Agent-KV callback path, shared host access, volumes, and network.
docker/dockerfiles/worker-unified.DockerfileDefines the shared worker image, non-root runtime, dependency layers, and Docker entry point.
docker/docker-compose-dev-essentials.yamlDefines the smaller local stateful stack and MinIO bootstrap used before application services run.
docker/sample.compose.override.yamlShows the intended local build, resource, and Compose Watch layer.
docker/compose.debug.yamlShows how local debugger access is added without replacing the platform model.
docker/docker-compose-redis-tls.yamlProvides a local managed-like Redis with AUTH and TLS for secure connection-path checks.
docker/…/README.mdExplains how to generate certificates, switch clients, and verify execution and log transport over TLS.
docker/…/generate-certs.shCreates the development CA and server certificate for both host and container names.
docker/README.mdGives the main build, run, override, watch, and debug entry points.
docker/…/README.mdDefines when self-hosted upgrades need an operator note and how version boundaries affect delivery.
docker/…/release_notes.jsonRecords upgrade actions and warnings, including the Agent-KV public path change.
docker/dockerfiles/frontend.DockerfileShows how development, test, and production frontend images build and serve the application.
frontend/generate-runtime-config.shShows which frontend settings are generated when the container starts.
tests/…/docker-compose.test.yamlDefines the test image tags, execution controls, Agent-KV settings, callback settings, and browser overlay.
tests/compose/frontend-nginx.test.confDefines the one-origin browser boundary that serves the SPA and proxies its backend paths.
tests/README.mdExplains the test group model, frontend and browser groups, runtime modes, fixtures, reports, and critical-path policy.
tests/…/runtime.pyDefines runtime selection, Compose overlay handling, readiness, endpoint propagation, log capture, and teardown.
tests/…/cli.pyCoordinates group selection, runtime setup, execution, dependency blocking, endpoint injection, reporting, and baseline policy.
tests/…/groups.pyLoads and validates the group manifest, dependency graph, platform gate, and optional overlay manifests.
tests/…/reporting.pyConverts group results and JUnit evidence into durable machine and human reports.
tests/…/conftest.pyKeeps rig self-tests isolated from environment-provided group overlays.
tests/…/test_cli.pyProtects the rig contracts for selection scope, runtime cleanup, endpoint wiring, runner behavior, reporting, and baseline decisions.
tests/…/test_groups.pyProtects manifest validation, dependency expansion, platform gates, overlays, migration setup, and frontend runner separation.
tests/…/test_reporting.pyProtects JUnit parsing, empty and blocked states, critical-path attestation, and malformed-report handling.
tests/groups.yamlDefines the repository test groups, their runners and setup, and their dependency relationships.
tests/critical_paths.yamlDefines the high-value flows, their proof mode, and the test groups that protect them.
tests/…/conftest.pyProvides shared API end-to-end setup and execution fixtures.
tests/…/conftest.pyBuilds the MinIO-backed ETL workflow and keeps internal worker access aligned with the test client endpoint.
tests/…/conftest.pyProvides Agent-KV keys, document fixtures, adapter gates, submission helpers, polling, and lifecycle helpers.
tests/…/test_agent_kv_e2e.pyShows the opt-in Agent-KV product checks and their adapter, page-cap, webhook, failed-job, lifecycle, limit, and concurrency gates.
tests/…/fixtures.jsProvides browser authentication, organization context, and navigation fixtures for the existing UI suite.
tests/…/index.tsProvides the shared entry point for v1 browser specs and exposes the session, seed, preview, and distribution contracts.
tests/…/auth.tsDefines OSS and Auth0 sign-in, organization selection, shared API/browser session state, and rig-managed failure behavior.
tests/…/seed.tsCreates organization-scoped API data and removes it in reverse order after each browser test.
tests/…/preview.tsEnables pre-release v1 pages only when the selected build and distribution can render them.
tests/…/tags.tsEnforces distribution tags and selects tests for OSS, cloud, and on-prem runs.
tests/…/old-version.tsVerifies user-scoped old-version preferences and v1-to-v0 route round trips.
tests/…/session.spec.tsVerifies v0-to-v1 session reuse and redirects when a v1 session ends or is absent.
tests/…/critical_paths.pyEvaluates critical-path gaps and regressions against the baseline.