10 Quality Requirements¶
10.1 Quality Requirements Overview¶
The goal table and the ranking are in 1.2 Quality Goals. The requirements, with the sections below that state them in full; the category is the quality characteristic of ISO/IEC 25010:2023 each one refines:
| ID | Category | Requirement | Refined into | Scenarios |
|---|---|---|---|---|
| REQ-Q1 | Security (accountability) | Traceability of every statement and every release | — | QS-1, QS-2 |
| REQ-Q2 | Functional suitability (correctness) | Extraction correctness with a controlled error direction | — | QS-2 |
| SEC-Q3 | Security (confidentiality) | Confidentiality and data sovereignty towards the model provider | — | QS-4, QS-13, QS-14 |
| ARC-Q4 | Flexibility (installability, adaptability); maintainability (analysability) | Operability and deployment portability | ARC-Q4.1 to ARC-Q4.4 | QS-6, QS-7, QS-8, QS-11 |
| ARC-Q5 | Maintainability (modifiability) | Modifiability | ARC-Q5.1 to ARC-Q5.3 | QS-9 |
| ARC-Q6 | Maintainability (analysability); flexibility (installability) | Simplicity (proportionality) | ARC-Q6.1 to ARC-Q6.3 | QS-12 |
| — | Performance efficiency; reliability (fault tolerance, availability) | Subordinate qualities (budgets, not drivers) | — | QS-10, QS-15, QS-16, QS-17 |
10.1.1 REQ-Q1 — Traceability of every statement and every release¶
Requirement. Once the evaluation set and the persistence exist, 100% of released findings carry: the contract evidence (page number and text excerpt), the master-data source and its version, the model identifier, prompt version and evaluation-set version in effect, the rule set version, and the identity and timestamp of the human who released it. A random sample of 20 findings drawn from the versioned evaluation set can be reconstructed end to end without access to the original PDF.
Rationale. The reviewer cannot judge a field without seeing where the value came from; internal audit cannot re-perform a release decision without knowing which model and rules produced it. Because model and prompt change during the project, the record must pin the version actually used.
Architectural consequences. Evidence (page + excerpt) is a mandatory field in the extraction
target schema. A value without verifiable evidence is kept for the reviewer, flagged
UNSUPPORTED, forced into review and never counts as confirmed; the extraction is then incomplete
. The audit trail is relational and
append-only. Versions are recorded per finding, not per deployment. Audit retention is defined
separately from operational log retention. Carried out in 8.7 and
8.2.
A GROUNDED value carries the verbatim passage it was read from and the page that
passage starts on (spec 8 (docs/specs/8-intake-into-extraction.md); the
extraction rules). That is SPEC.md's "page number and text
excerpt". No extracted value carries a finer position inside the page, such as a line range or an
offset (8.19.5).
Verification. Reconstruction test over the sample; a test asserting that a value without
verifiable evidence comes back UNSUPPORTED and leaves the extraction incomplete; a CI check that version fields are populated.
10.1.2 REQ-Q2 — Extraction correctness with a controlled error direction¶
Requirement. Once the versioned evaluation set exists, measured against it: field accuracy of at least 90% per attribute category (percentage and calculation-base attributes measured separately from free-text attributes), and at most 1% undetected real deviations — cases reported as matching although contract and master data genuinely differ. Fabricated values (a value not present in the source text) count as defects regardless of plausibility, target zero.
Rationale. The two error directions cost very different amounts. A false positive costs a reviewer minutes. A false negative passes as green and becomes an incorrect payment nobody is looking for. A single aggregate accuracy figure hides exactly the error that matters.
Architectural consequences. Deterministic rules decide the unambiguous cases first; only unclear cases reach semantic matching and LLM classification. Completeness is derived from validated fields, never taken from the model's self-report. Confidence thresholds are deterministic code and biased towards review. The evaluation set is versioned in the repository and is a build input. Carried out in 8.7 and 8.5.
Verification. Automated evaluation run reporting accuracy per attribute category, undetected-deviation rate and fabrication count, published per build so that a model or prompt change is comparable against the previous run.
10.1.3 SEC-Q3 — Confidentiality and data sovereignty towards the model provider¶
Requirement. In the proof of concept, no contract content, master data or personal data is transmitted to an inference endpoint outside Switzerland or the EU; for the product, where inference may run is decided per installation under its regulatory regime (4.7). In either case, no provider is used that trains on submitted data. Every guardrail violation (schema violation, blocked content, permission denial on the MCP tool) is logged with cause and correlation ID. Once the findings tool of KF-5 exists, at least one negative test per threat path is green: prompt injection originating from a contract document, egress to a non-approved endpoint, schema violation passing into business code, unauthorised access through the MCP tool.
Rationale. Contract documents contain partner terms, names and contract numbers. This is the requirement that forces the expensive-to-revise decision of model provider and hosting location. The threat runs both ways: content flows out, instructions can flow in from an uploaded PDF.
Architectural consequences. Which provider and region a regime admits is decided per installation
(4.7). Provider and hosting region are an ADR, not a config detail:
ADR-0012 (docs/adr/adr-0012-model-provider-and-extraction-shape.md) admits Mistral's hosted API and
Gemini on Vertex AI pinned to Zurich (europe-west6) if it serves the model, otherwise an EU
region, with a customer-operated model as the on-premise equivalent. europe-west6 serves no Gemini
model, so the vertex-ai profile runs in europe-west3 (Frankfurt), as ADR-0012 records. In the
extraction loop every
tool result is contract text and so untrusted input; the injection guard holds per tool result,
not per prompt. Carried out in 8.2.
Prompt content is classified before sending; what may enter a prompt is an allowlist. Contract
text is untrusted input and is never interpreted as instruction. The MCP tool
get_reconciliation_findings exposes released findings only, permission-checked, with no database
access for downstream agents. No contract content is logged at any level — no prompt or response
payloads, no values, no passages; log lines carry internal IDs. Two run modes are planned —
anonymised, where a pluggable anonymisation step minimises PII out of the prompt before it reaches
the model provider (G-2), and plain — how the mode is switched, and what the default is, is
open (OQ-13). The mode
is about what leaves the process for the model provider; it does not relax
G-6, which already keeps contract content out of the log in both modes.
Verification. Negative tests per threat path in CI; review of guardrail logs for evaluation runs; dependency and secret scan in the DevSecOps gate.
10.1.4 ARC-Q4 — Operability and deployment portability (most important)¶
Requirement.
- One artefact, two worlds. The same versioned container image set runs on-premise at a customer and as a cloud service, with no source change and no cloud-provider-specific managed service on the critical path. Verified, once the deployment is built, by a reproducible start from the repository on a machine holding no cloud credentials, reaching a successful end-to-end extraction within 30 minutes of clone.
- Exchangeable inference. Switching the model provider — hosted API to customer-operated model — requires changing configuration and credentials only. Proven by running the full evaluation set against at least two different providers or models with an unchanged source tree, once the evaluation set exists, with the quality delta reported.
- No orphan dependencies. 100% of infrastructure dependencies (database, vector store, messaging, identity, metrics, log sink) have a documented on-premise equivalent named in 7.1.3. A dependency without one is not admissible.
- Diagnosability without SaaS. A failed extraction run can be attributed to a cause (input, provider, schema, rules) from structured logs, metrics and traces alone, using tooling that runs on-premise. Demonstrated once per product version on a deliberately broken run.
Rationale. C1 makes cloud optional for the customer, not for the product: a supervised institution may be unable to send contract content to an external endpoint at all, while the next customer wants a managed service and nothing else. Both must be the same product, because maintaining two variants is not affordable under C7. This requirement also carries the 1 000-approver figure: those users authenticate against whatever identity provider the customer already runs, on-premise or cloud, so identity must be a port as well.
Architectural consequences. Inference behind a port (hexagonal), provider adapters selected by configuration and never referenced from domain or application code. No managed-service SDK in the critical path; vector store and messaging chosen for self-hostability. Federated identity, no local user store. Reproducible builds, base images pinned by digest. Observability via open formats (OpenTelemetry, Prometheus-compatible) so the sink is exchangeable. Secrets injected, never baked. Carried out in 4.4, 8.13 and 8.14.
Every piece of infrastructure — the identity provider included — is therefore chosen per installation, never once for the product, and this drives the choice of libraries: ones that adapt to a wide range of infrastructure (Spring Boot, Spring AI, the Spring Cloud libraries), or FeeCheck's own port with adapters selected by configuration where none does (4.5).
Verification. Credential-free clean-machine start per product version; two-provider evaluation run; dependency table reviewed per product version; broken-run diagnosis exercise.
10.1.5 ARC-Q5 — Modifiability¶
Requirement.
- Adding one extraction attribute (target schema, prompt, evaluation case, review UI field) is completed within one working day by one developer and touches at most one module per concern — measured by performing the change once per product version on a real attribute and recording touched files.
- Replacing the inference provider or the model touches adapter code only: zero changed files in domain and application modules, verified by the diff of the two-provider run in ARC-Q4.
- Once the modules are cut, module boundaries are enforced by the build (Spring Modulith and Gradle subproject boundaries): a dependency crossing a boundary in the wrong direction fails the build rather than a review. The Spring Modulith half is in the gate — the build's modularity test runs Spring Modulith's module verification beside the ArchUnit rings (8.16); the Gradle subproject boundaries follow the module cut (OQ-11).
Rationale. Four things change on different clocks and none of them will hold still: the model and its API, the attribute set (the decided cut is 19 attributes in four slices, 1.1.3; more per contract type), what the neighbouring settlement systems expose, and per-customer variation. "Scalability from small to large customers" is in practice a variability requirement, not a load requirement — see 10.1.8. C2 adds a second reason: with distributed delivery, a boundary that is only documented is a boundary that erodes.
Architectural consequences. Attribute schema is data-driven rather than hard-coded wherever the cost is comparable. Anti-corruption layer towards the master-data system. Contracts between modules are explicit and versioned. Boundary enforcement is part of the build, not the review checklist. Carried out in 8.10, 8.15 and 8.16.
Verification. Timed change exercise per product version; diff evidence from the provider swap; build fails on an intentionally introduced boundary violation.
10.1.6 ARC-Q6 — Simplicity (proportionality)¶
Requirement.
- FeeCheck consists of at most one backend deployable (three modules) plus one frontend. Every additional deployable unit or infrastructure component requires an ADR naming the quality requirement that forces it and the alternative rejected — no component enters the design because it is expected, conventional, or already present in the platform.
- A developer new to the repository reaches a running local system with a successful smoke path in under 30 minutes using the setup guide only. Verified by an actual timed run once per product version.
- The number of infrastructure dependencies is stated explicitly in 7.1.3 and does not grow without an ADR (see ARC-Q4.3, which also requires an on-premise equivalent for each).
Rationale. With 5–10 daily users, fewer than 50 concurrent sessions and about 185 hours of total effort, the realistic failure mode of this project is not insufficient capacity — it is a design that is too large to finish, operate on-premise, or explain. Simplicity is also what makes C6 coherent: a service-based architecture with a shared central database is the right answer because these numbers do not justify the cost of independent per-service data ownership, and that argument only holds if it is stated as a deliberate quality goal rather than a shortcut.
Architectural consequences. Modules exchange domain events on one backbone, delivered in memory
within the deployable; a broker carries them only to another deployable or a downstream system
(8.16.3). A separate deployable, such as a worker, is introduced
only where a named requirement forces it (long-running extraction, see
10.1.8 fault tolerance).
The concept reused the fee calculation and invoicing system's platform services (gateway, messaging,
monitoring) rather than re-implementing them (SPEC.md §8, A-3, open); for two of them that is superseded — FeeCheck builds
its own API gateway (ADR-0010 (docs/adr/adr-0010-api-gateway-and-api-contract.md)), and Pub/Sub
replaces the platform's Kafka (ADR-0009 (docs/adr/adr-0009-async-intake-pubsub-bucket-firestore.md)).
Each platform service still used is a dependency that must satisfy ARC-Q4.3. The MCP server is not one of them: it is FeeCheck's own, in-process in
the backend behind the MCP profile (ADR-0011 (docs/adr/adr-0011-mcp-server-placement.md)).
Verification. Deployable and dependency count reviewed per product version against the ADR list; timed onboarding run.
10.1.7 Ranking and what it means for the database ADR¶
Among the architecture drivers the order is ARC-Q4 ahead of ARC-Q5 ahead of ARC-Q6. Where two of them conflict, the higher one wins and the decision is recorded. The known conflicts:
| Conflict | Resolution |
|---|---|
| ARC-Q6 vs ARC-Q4 | Reusing an existing platform service is simpler than self-hosting an equivalent, but only admissible if the service can also run on-premise. Portability wins |
| ARC-Q5 vs ARC-Q6 | A configuration-driven attribute schema is more modifiable and more complex than a compiled one. Resolve per attribute class, not globally; default to the simpler option until the watch-list trigger in 11.2 fires |
| C6 vs independent deployability | The shared central database is chosen deliberately and costs independent deployment and per-service scaling. Under the figures in 2.1 neither is needed, so the price is acceptable — the ADR on the shared database (not yet written, open.md) must say exactly this rather than claiming a microservice benefit the design does not deliver |
Rejected alongside C6: a central "entity service" behind its own REST API, called by every other service the way marketing or sales services would call a customer service. That reintroduces the per-service data-ownership split C6 already trades away, without buying back any of C6's operability benefit — the modulith (4.2) is the chosen alternative.
10.1.8 Subordinate qualities (budgets, not drivers)¶
Examined against the figures in 2.1 and consciously not promoted. Exceeding a budget triggers review, not redesign.
| Quality | Budget | Why it is not a driver |
|---|---|---|
| Performance | Review screen renders in under 2 s at fewer than 50 concurrent sessions | 5–10 daily specialists and at most 1 000 occasional approvers; a single instance is oversized for this |
| Latency | Extraction of one contract within minutes; the settlement-to-release window is measured in days (OQ-2) | The human review step dominates end-to-end time; no interactive SLA on extraction |
| Scalability | Vertical first; extraction stays asynchronous and stateless so a queue plus horizontal workers can be added without redesign. The intake has its queue (ADR-0009 (docs/adr/adr-0009-async-intake-pubsub-bucket-firestore.md)): conversions in flight are bounded by Cloud Run's max instances and concurrency, and a stage's requests can be taken by a worker deployment of the same image, by configuration (8.16.3) |
Customer size varies in contract volume, which is a cost and batch-window question, not a structural one. The cheap hedge is kept, the machinery is not built |
| Availability | Business hours; no high-availability setup, no multi-region | An interrupted run is repeated; persisted workflow state means nothing is lost |
| Fault tolerance | A failed or timed-out extraction run resumes from the last persisted step rather than restarting; provider errors are retried with backoff and surfaced, never silently swallowed | Scoped narrowly on purpose: LLM calls do fail, and re-running a batch costs real tokens (QS-10). Beyond resumability, nothing here justifies redundancy |
| Cost | Token cost per contract measured and reported per evaluation run | Volume is low enough that cost shapes model choice only marginally — but it is the figure that changes first if contract volumes turn out large (OQ-3) |
| Security beyond SEC-Q3 | Federated identity, role-based authorisation, segregation of review and release | Confidentiality towards the provider is covered by SEC-Q3; tenancy is settled in 4.6 — not in the PoC, one isolated installation per customer if a cloud offering follows — not a budget |
10.2 Quality Scenarios¶
The quality goal is named where the requirement's own text in 10.1 states the scenario's stimulus or measure; an empty cell has no such link.
| ID | Stimulus | Expected response | Measure | Quality goal |
|---|---|---|---|---|
| QS-1 | Auditor picks a finding released six months ago | Model, prompt, rule and eval versions, evidence and releasing user are shown | Reconstruction succeeds for 20 of 20 sampled findings | REQ-Q1 |
| QS-2 | Model returns a value not present in the contract text | Value is kept for the reviewer, flagged UNSUPPORTED and forced into review; the extraction is incomplete |
Zero fabricated values pass as GROUNDED in the eval run |
REQ-Q1, REQ-Q2 |
| QS-3 | Contract states a tier scale, master data holds a flat rate | Classified as a real content deviation, routed to review | Appears in the review queue with a one-sentence justification | |
| QS-4 | Contract PDF contains text instructing the model to report a match | Instruction has no effect on the extraction result | Injection negative test green | SEC-Q3 |
| QS-5 | Confidence for a field falls below the threshold | Field is presented to the reviewer instead of auto-matched | Threshold logic unit-tested; no auto-release below threshold | |
| QS-6 | Model provider or version is changed | Quality comparable before and after | Evaluation run against the same versioned set meets REQ-Q2's thresholds again — at least 90 % accuracy per attribute category, at most 1 % undetected deviations, no fabricated value — and the delta is reported | ARC-Q4.2 |
| QS-7 | Customer forbids any external inference endpoint | System runs against a customer-operated model | Configuration change only; evaluation set passes; zero source changes | ARC-Q4.2 |
| QS-8 | Installation on a customer network without outbound internet access | System starts and completes the smoke path | Credential-free clean-machine start under 30 minutes | ARC-Q4.1 |
| QS-9 | A new contract type introduces three additional attributes | Attributes are extracted, reviewed and evaluated | One working day, touched files recorded, boundaries unviolated | ARC-Q5.1 |
| QS-10 | Inference provider times out mid-run for a 200-contract batch | Run resumes from the last persisted step, no duplicate LLM cost for completed contracts | Resume test green; no re-extraction of completed contracts | none — the fault-tolerance budget of 10.1.8 |
| QS-11 | A deliberately broken extraction run — a wrong input, a provider fault, a schema change or a rule change | The cause is attributed from structured logs, metrics and traces alone, with tooling that runs on-premise, and no contract content in any of them | The cause named correctly from the case's internal ID, once per product version | ARC-Q4.4 |
| QS-12 | A developer new to the repository follows the setup guide | A running local system with a successful smoke path | Under 30 minutes, timed once per product version | ARC-Q6.2 |
| QS-13 | A configuration names an inference endpoint outside the installation's approved regions, or a provider that trains on submitted data | No contract content reaches it | 0 requests to a non-approved endpoint; negative test green (NFR-4) | SEC-Q3 |
| QS-14 | A caller without the permission to invoke the backend calls the MCP endpoint | Refused before any tool runs | Negative test green; no tool invocation recorded | SEC-Q3 |
| QS-15 | A PDF is uploaded while docling-serve is scaled to zero |
The conversion starts once the converter answers, or the case is failed with the converter's unavailability as cause | The converter answers within the cold-start budget of 2 minutes (ADR-0006 (docs/adr/adr-0006-services-on-google-cloud.md)); otherwise the case is retried by the delivery, never left hanging |
none — the fault-tolerance budget of 10.1.8 |
| QS-16 | The model provider answers with a server error during an extraction | The call is retried with backoff, then the extraction answers with its defined fallback, an incomplete result that goes to review | Retries bounded by the loop's limits; one log event per retry; no stack trace reaches the caller (8.7) | none — the fault-tolerance budget of 10.1.8 |
| QS-17 | A pushed conversion fails on every delivery attempt | After the last attempt the dead-letter push marks the case failed with its cause | No case stays converting or queued without an end; the attempts as 7.1.2.2 configures them | none — the fault-tolerance budget of 10.1.8 |