0007: TREDIS Global Dynamic service
Typed local replacements and explicit unsupported operations for MIDOT
- ID: PRD-0007
- Status: Accepted
- Decision maker: Trevor Gerhardt
- Scope: MIDOT, Contracts, Services, and RSDB
- Product owner: Trevor Gerhardt
- Design owner: Trevor Gerhardt
- Engineering owner: Conveyal
- Last reviewed: 2026-10-09
- Related issues or projects: Not applicable. This work follows a direct implementation request.
- Related designs: Not applicable. This delivery has no browser flow.
- Related ADRs: ADR 0011
- Related user documentation: Services guide
Summary
MIDOT needs a typed server capability for the behavior stored in tredis_global_dynamic.
The service replaces supported local procedures with TypeScript and Drizzle operations.
Unsupported operations remain callable methods that fail before storage access.
User problem and evidence
The SQL archive contains the source behavior. It includes local queries, data changes, external dependencies, obsolete columns, and credential outputs. The existing property-value service establishes the package boundaries for typed replacements.
Goals and success measures
| Goal | Measure | Target or review method |
|---|---|---|
| Account for every procedure | Compare archive names with the operation catalog | Every name has one replacement or stub |
| Preserve supported behavior | Domain and disposable MySQL tests | Correct results and stored changes |
| Protect credentials | Result projection and credential tests | No password or key in a result |
| Make unsupported behavior explicit | Refusal tests | Typed error before any storage work |
The operation catalog owns coverage and source references.
Non-goals
- New HTTP routes or browser flows.
- Application authentication or a Concourse-to-legacy identity mapping. PRD 0008 owns MIDOT sign-in.
- External database bindings, DDL capabilities, or broader MySQL grants.
- Repair of missing source tables or columns.
- Calls to stored procedures from production code.
Users and use cases
Use case: MIDOT server operations
- Actor: MIDOT server code.
- Need: Invoke a named operation with validated inputs and typed results.
- Goal: Use legacy data without database mechanics in application code.
Requirements
PRD-0007-US-01: Complete procedure coverage
- Story status: Current
- Replaces: N/A
- Replaced by: N/A
- User need: As a MIDOT developer, I want every procedure represented, so that omissions are visible.
- Requirement: Every archived procedure has one named method with an input contract, result contract, and source reference.
- Done when:
- The independent archive coverage test passes.
- Current and historical variants retain distinct methods and reviewed behavior.
- Unsupported methods identify their procedure, source, and reason.
- Each method is labeled a write exactly when its procedure changes a stored table.
PRD-0007-US-02: Safe local behavior
- Story status: Current
- Replaces: N/A
- Replaced by: N/A
- User need: As a server caller, I want typed local operations, so that queries and changes follow the reviewed database boundary.
- Requirement: Supported operations preserve filtering, calculations, ordering, and stored changes through one concrete RSDB binding.
- Done when:
- Named domain objects represent legacy outputs, including multiple result sets.
- Local temporary-table behavior uses typed selections or TypeScript transformations.
- Uncertain writes report
write-unknownwithout automatic retries. - Each session uses the SQL mode that the captured procedures record.
- Inputs that reach a column fit its width, so MySQL never cuts a stored value short.
- Tests use disposable MySQL and synthetic records.
PRD-0007-US-03: Password-free results
- Story status: Current
- Replaces: N/A
- Replaced by: N/A
- User need: As a server caller, I want credential verification, so that I do not need decrypted password results.
- Requirement: User results omit credential fields. Credential operations use an optional redacted server key.
- Done when:
- Verification returns a boolean for user or administrator credentials.
- Missing users and incorrect passwords return false.
- Missing or blank keys refuse credential operations before storage.
- Ordinary operations remain available without a key.
- No literal key from the archive enters implementation code.
PRD-0007-US-04: Explicit unsupported operations
- Story status: Current
- Replaces: N/A
- Replaced by: N/A
- User need: As a developer, I want unsupported methods to fail clearly, so that a stub cannot look like success.
- Requirement: External dependencies, unsupported DDL, missing schema, and the decryption diagnostic produce typed unsupported errors.
- Done when:
- Stubs fail before validation, encryption configuration, and storage work.
- The same refusal applies without Rackspace configuration.
- The error references the source SQL without copying its body.
Implementation
Contracts owns the operation catalog and password-free result schemas. Services owns local behavior, repositories, validation, credentials, and unsupported errors. RSDB owns the concrete schema binding and database resources. MIDOT composes a server runtime and releases it when the server closes. The service returns a created user ID in addition to the insertion side effect. Source decryption-key parameters become server configuration instead of method inputs. Date results retain MySQL wall-clock text; profile reads normalize legacy zero dates.
Experience and content
This delivery has no browser interface, loading state, or accessibility flow. Server callers receive named results, safe storage errors, or explicit unsupported errors. The caller owns authorization for legacy user and client identities. Deployment protection for the existing property-value read does not authorize these new methods.
Constraints and dependencies
- The existing RSDB session capabilities and grant profile remain unchanged.
- Transactions do not span databases.
- The source contains a MyISAM table; a transaction wrapper does not guarantee rollback for that engine.
- The credential key remains optional until a credential operation runs.
User documentation
- Audience: MIDOT server developers.
- Tasks to explain: Compose the runtime, invoke named methods, handle unsupported and uncertain outcomes, and supply optional encryption configuration.
- Agreed terms: Global Dynamic operation, unsupported operation, and legacy identity.
- Examples or screenshots needed: Server invocation example. No screenshots apply.
- Published documentation: The package guides own invocation details.
Revision history
No revisions.