Document Generator Features
NOTE
The
Featuresdirectory encapsulates the vertical slices of functionality in the Document Generator. Each feature handles a specific type of document block generation (e.g., Requirements, Scanners, Test Cases) and conforms to a strict, database-free, pure-message architecture.
Overview
The MILTON.DocumentGenerator follows a message-only architectural paradigm for document generation. It relies entirely on the API to manage state and relational data.
Each feature folder adheres to this pattern and contains two primary components:
- The Generation Handler: A Wolverine message handler that acts as the entry point for the worker. It consumes the
[Type]GenerationRequestedevent, reads the payload from the S3 claim-check store, invokes the core, and writes the result back to the claim-check store. - The Generation Core: A pure, infrastructure-free business logic core. It orchestrates the AI calls (
IAIService), formats prompts, chunks data, and produces the required output structures without ever touching a database.
The Claim-Check Pattern
To avoid pushing large payloads (e.g., massive source code contexts or generated document outputs) across RabbitMQ, the generator uses an S3 Claim-Check Store (IClaimCheckStore in MILTON.Platform).
- The API writes the gathered payload to S3 and sends a lightweight message containing the claim-check key.
- The Generator Feature Handler reads the key, downloads the payload from S3, processes it, and uploads the result back to S3.
- The Generator sends a completed message containing the result claim-check key, which the API uses to finalize the database update.
Available Slices
- Common - Shared infrastructure-free logic, such as mapping AI presets to the
IAIServiceconfiguration. - Requirements - Handles the generation of system and sub-system requirements using iterative AI extraction.
- Scanners - Manages the processing of static analysis and architectural clustering modules.
- Test Cases - Generates structured QA test cases directly from requirement specifications.
Generator Execution Flow
Below is a representation of how any feature within the Document Generator processes a block. This applies universally to all slices (Requirements, Scanners, TestCases).
sequenceDiagram participant API participant Broker as RabbitMQ participant S3 as S3 Claim-Check participant Handler as GenerationHandler participant Core as GenerationCore participant AI as IAIService API->>S3: PutAsync(Payload) API->>Broker: Publish [Type]GenerationRequested(ClaimCheckKey) Broker->>Handler: Deliver Message Handler->>S3: GetAsync(ClaimCheckKey) Handler->>Core: GenerateAsync(Payload, IAIService) Core->>AI: GenerateAsync(Prompts) AI-->>Core: AI Response Core-->>Handler: [Type]GenerationResult Handler->>S3: PutAsync(Result) Handler->>Broker: Publish [Type]GenerationCompleted(ResultClaimCheckKey) Broker->>API: Deliver Message