8.13 Configuration and adapter selection¶
Every port that reaches outside the process has a stub and at least one real adapter, and which one
runs is configuration, never an
if branch in domain code: intake.converter for the converter, extraction.provider with the
mistral or vertex-ai profile for the model, cases.* for the queue and the stores. The stub
defines the contract and is the default, so the offline build needs no network, key or Docker
(CLAUDE.md, "Architecture"; ADR-0004 (docs/adr/adr-0004-document-conversion-docling.md) §5: "Which
converter is used is configuration (intake.converter), never a branch in domain code"). The one
port without a stub is intake's LanguageDetector: its only adapter, OpenNlpLanguageDetector,
runs in the process and needs no network, so the offline build needs nothing in its place.
The same pattern is the template for every service on Google Cloud: a provider-specific client
lives in an infrastructure adapter, selected by a property, with a provider-neutral default, and
every service stays switchable to another provider by configuration only, with the container image
as the unit that moves (ADR-0006 (docs/adr/adr-0006-services-on-google-cloud.md) §3 point 2 and §5).
Rule 6 of 8.6 keeps provider SDKs out of the domain and
application rings.
This is how ARC-Q4's switchability is met, since every piece of infrastructure is chosen per installation (4.5): either a library abstracts the provider — Spring Boot, Spring AI, the Spring Cloud libraries — or FeeCheck writes its own port with adapters selected by property or Spring profile.
Labs features¶
A labs feature is an experiment that runs on a developer machine only: it is tried there before
anyone provisions, grants or deploys anything for it
(spec 630 (docs/specs/630-labs-marker.md)). It is built like any other feature — issue, spec, tests, the gate — and is switched on by a
profile of its own that sets feecheck.labs=true. Its issue carries the labs label.
It cannot reach Cloud Run: LabsGuard stops the backend at startup when feecheck.labs is true and
K_SERVICE is set, and LabsGuardTest fails when the profiles .claude/ops-doctor.json declares
for the service resolve feecheck.labs=true. A labs feature graduates in the pull request that adds
its cloud profile, which drops the property and the label. The first is firestore-local, the local
document database.
8.13.1 In the code¶
The chapters name these building blocks by their role; this is where the role meets the code
(backend/app/src/main/java/net/lauper/feecheck, backend/app/src/main/resources/application*.properties).
| Role | Port | Stub (the default) | Real adapter | Selected by |
|---|---|---|---|---|
| the converter | DocumentConverter |
StubDocumentConverter |
DoclingDocumentConverter — docling-serve at intake.docling.base-url (default http://localhost:5001), with intake.docling.auth=google-id-token for the IAM-only Cloud Run service |
intake.converter = stub · docling; the profiles docling-local and docling-cloud-run |
| the model provider | DocumentExtractor |
StubDocumentExtractor |
MistralDocumentExtractor, GeminiDocumentExtractor |
extraction.provider = stub · mistral · vertex-ai; the profiles mistral and vertex-ai |
| the case's queue | CaseQueue |
StubCaseQueue (cases.queue=none: an upload converts in its own call) |
PubSubCaseQueue |
cases.queue; the profiles cases-local and cases-cloud-run |
| the case store | CaseStore |
StubCaseStore |
PostgresCaseStore |
cases.store = stub · postgres; cases-cloud-run names no store and postgres-cloud-run selects it; PostgreSQL comes under postgres-local (which local brings along, and cases-local keeps) and postgres-cloud-run |
| the document store | DocumentStore |
StubDocumentStore |
CloudStorageDocumentStore |
cases.documents; the same two profiles |
the contract gate (spec 367 (docs/specs/367-contract-gate.md)) |
ContractGate |
ContractGate.UNCHECKED — no model, every document unchecked |
ModelContractGate — the ChatModel the active profile provides, asked for intake.gate.model |
intake.gate.provider = stub · model; the profile mistral sets model with mistral-medium-latest, the profile vertex-ai keeps the stub |
the translator (spec 368 (docs/specs/368-translation-port.md)) |
DocumentTranslator |
DocumentTranslator.NONE — no model, nothing translated |
ModelDocumentTranslator — the ChatModel the active profile provides, asked for intake.translation.model, one call per page |
intake.translation.provider = stub · model; the profile mistral sets model with mistral-small-latest, every other profile keeps the stub |
| the language detector | LanguageDetector |
— | OpenNlpLanguageDetector |
— |
| the MCP server | — | — | McpConfiguration, FeeCheckTools |
the profile mcp |
| Endpoint (5.1.1) | Class |
|---|---|
the case endpoints (/api/cases) |
CaseController |
the extraction-stage endpoints (/api/cases/{id}/extraction) |
CaseExtractionController, through CaseExtractionService |
the push endpoints (/api/intake/jobs/push, /dead-letter) and their push-token check |
CasePushController, PushTokenCheck; the check is set by cases.push.auth |
the converter-status endpoint (/api/intake/converter) |
ConversionController |
the settings endpoint (/api/intake/settings) |
IntakeSettingsController |
the signed-in person's endpoint (/api/me, /website) |
SignedInPersonController |
| the sign-in configuration | SignInConfiguration |
| the three actuator endpoints | management.endpoints.web.exposure.include=health,info,modulith in application.properties; management.endpoint.health.show-details=when-authorized shows the components to a signed-in person only; the database profiles add db to the readiness group, never to liveness |