Service FAQ
Evidence boundary: These answers describe reviewed service boundaries for
Java 1.525-RELEASE and Rust 4.1.1. Only the recorded Rust/SQLite combination
has current end-to-end runtime evidence; exact framework and provider behavior
must be verified separately.
Where should business orchestration live?
Keep controllers focused on transport, services/use cases responsible for transactions and orchestration, and reusable domain behavior independent from database I/O where practical.
Where should provider setup happen?
Register the modules, repositories, policy, and providers required by the
selected stack at application startup or test setup. Business queries should
use generated Q APIs without constructing pools or choosing providers in the
query itself. Exact assembly APIs are version-specific.
See Rust Data Providers.
Should the application edit generated code?
No. Inspect generated source for exact contracts, then fix the model, generator configuration, version alignment, or handwritten caller. A fix must survive clean regeneration.
Where should schema ensure run?
At a controlled setup, deployment, startup, or admin boundary with reviewed database permissions. It should not be hidden inside domain methods or normal request handling. Production migrations may require a separate reviewed process.
How should a background job obtain UserContext?
Create an explicit service identity, tenant scope, request purpose, runtime policy, and infrastructure resources. Do not reuse an anonymous context merely to satisfy a method signature.
What proves that a mutation is auditable?
More than an auditAs/audit_as call. Verify identity, business description,
event emission, sink durability, masking, access control, retention, and failure
behavior.
See Audit-Ready Mutation.
Can MemoryRepository replace provider tests?
No. It is useful for fast generated-API and business-behavior tests. Production providers still require schema, SQL, transaction, locking, type, collation, and concurrency integration tests.
See Test with MemoryRepository.
How do I prepare an upgrade?
Record the current generator/runtime/provider baseline, regenerate from an unchanged model, review the diff, run layered verification, and prepare code, schema, and data rollback plans.
See Upgrade Guide.