@caddis/cli 0.4.18 → 0.4.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/antigravity-plugin/plugin.json +1 -1
- package/bundles/antigravity-plugin/scripts/caddis_adhoc.py +530 -0
- package/bundles/antigravity-plugin/scripts/caddis_lanes.py +8 -0
- package/bundles/antigravity-plugin/skills/_registry.md +5 -0
- package/bundles/antigravity-plugin/skills/data-lineage/SKILL.md +32 -0
- package/bundles/antigravity-plugin/skills/hld/SKILL.md +39 -0
- package/bundles/antigravity-plugin/skills/lld/SKILL.md +45 -0
- package/bundles/antigravity-plugin/skills/mmr/SKILL.md +87 -0
- package/bundles/antigravity-plugin/skills/port-to-github/SKILL.md +231 -0
- package/bundles/antigravity-plugin/skills/port-to-github/references/ci-and-credentials.md +66 -0
- package/bundles/antigravity-plugin/skills/port-to-github/references/config.example.json +18 -0
- package/bundles/antigravity-plugin/skills/port-to-github/references/old-host.md +61 -0
- package/bundles/antigravity-plugin/skills/port-to-github/scripts/Compare-PortRefs.ps1 +68 -0
- package/bundles/antigravity-plugin/skills/port-to-github/scripts/Convert-PortWorkflow.ps1 +92 -0
- package/bundles/antigravity-plugin/skills/port-to-github/scripts/Get-PortSource.ps1 +459 -0
- package/bundles/antigravity-plugin/skills/port-to-github/scripts/PortCommon.ps1 +130 -0
- package/bundles/antigravity-plugin/skills/port-to-github/scripts/Publish-PortToGitHub.ps1 +156 -0
- package/bundles/antigravity-plugin/skills/port-to-github/scripts/Switch-CheckoutOrigin.ps1 +182 -0
- package/bundles/antigravity-plugin/skills/port-to-github/scripts/Test-PortReadiness.ps1 +218 -0
- package/bundles/antigravity-plugin/skills/port-to-github/scripts/Test-PortWorkflowParses.ps1 +62 -0
- package/bundles/antigravity-plugin-extras/plugin.json +1 -1
- package/bundles/antigravity-plugin-extras/skills/_registry.md +3 -0
- package/bundles/antigravity-plugin-extras/skills/data-lineage/SKILL.md +158 -0
- package/bundles/antigravity-plugin-extras/skills/data-lineage/scripts/convert_doc_to_confluence.py +1430 -0
- package/bundles/antigravity-plugin-extras/skills/hld/SKILL.md +220 -0
- package/bundles/antigravity-plugin-extras/skills/hld/references/gold-standard-hld.md +428 -0
- package/bundles/antigravity-plugin-extras/skills/hld/scripts/convert_doc_to_confluence.py +1430 -0
- package/bundles/antigravity-plugin-extras/skills/lld/SKILL.md +198 -0
- package/bundles/antigravity-plugin-extras/skills/lld/scripts/convert_doc_to_confluence.py +1430 -0
- package/bundles/codex/.codex/skills/devops/port-to-github/SKILL.md +231 -0
- package/bundles/codex/.codex/skills/devops/port-to-github/references/ci-and-credentials.md +66 -0
- package/bundles/codex/.codex/skills/devops/port-to-github/references/config.example.json +18 -0
- package/bundles/codex/.codex/skills/devops/port-to-github/references/old-host.md +61 -0
- package/bundles/codex/.codex/skills/devops/port-to-github/scripts/Compare-PortRefs.ps1 +68 -0
- package/bundles/codex/.codex/skills/devops/port-to-github/scripts/Convert-PortWorkflow.ps1 +92 -0
- package/bundles/codex/.codex/skills/devops/port-to-github/scripts/Get-PortSource.ps1 +459 -0
- package/bundles/codex/.codex/skills/devops/port-to-github/scripts/PortCommon.ps1 +130 -0
- package/bundles/codex/.codex/skills/devops/port-to-github/scripts/Publish-PortToGitHub.ps1 +156 -0
- package/bundles/codex/.codex/skills/devops/port-to-github/scripts/Switch-CheckoutOrigin.ps1 +182 -0
- package/bundles/codex/.codex/skills/devops/port-to-github/scripts/Test-PortReadiness.ps1 +218 -0
- package/bundles/codex/.codex/skills/devops/port-to-github/scripts/Test-PortWorkflowParses.ps1 +62 -0
- package/bundles/manifest.json +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hld
|
|
3
|
+
description: Generates High-Level Design (HLD) Markdown documentation and converts to Confluence Storage Format XHTML with native PlantUML diagrams and auto-generated legends.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# High-Level Design (HLD) Authoring Skill
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
This skill generates High-Level Design (HLD) documents for enterprise application fleet systems. It produces human-readable, professional architectural documentation and converts them to Confluence Storage Format XHTML using native PlantUML (`<ac:structured-macro ac:name="plantuml">`) diagrams with high contrast, crisp 200 DPI vector rendering, dynamic orientation, auto-wrapped labels, and clean embedded Creole legends.
|
|
10
|
+
|
|
11
|
+
## Mandatory Workflow Steps
|
|
12
|
+
|
|
13
|
+
### Step 1: Deep Codebase and Architectural Discovery
|
|
14
|
+
Analyze the target codebase, configuration files, deployment scripts, database schemas, and external integrations to discover:
|
|
15
|
+
- Business initiative objectives and high-level workflows.
|
|
16
|
+
- Physical hosting environments, virtual machines, databases, and client surfaces.
|
|
17
|
+
- All interconnected systems, platforms, and third-party gateways.
|
|
18
|
+
- External network connectivity, protocols, ports, and batch schedules.
|
|
19
|
+
|
|
20
|
+
### Step 2: Component & Interface Classification Interview (Grill-Me)
|
|
21
|
+
**MANDATORY GATE:** Before generating diagrams or drafting documentation, the agent **MUST** present the discovered components and interfaces to the user and interview them to confirm lifecycle classifications:
|
|
22
|
+
1. **Component Classification:**
|
|
23
|
+
- Which systems/components are **Existing** pre-production fleet infrastructure (`Impacted = No`)?
|
|
24
|
+
- Which systems/components are **New** or **Impacted** by this solution (`Impacted = Yes`)?
|
|
25
|
+
2. **Interface Classification:**
|
|
26
|
+
- Which interfaces are **Existing Connectivity** (pre-existing enterprise links, rendered in Green `#16A34A`)?
|
|
27
|
+
- Which interfaces are **New Connectivity** (links created or modified for this initiative, rendered in Red `#DC2626`)?
|
|
28
|
+
3. Present clear recommendations based on codebase findings, allowing the user to confirm or adjust classifications in a single interactive turn.
|
|
29
|
+
|
|
30
|
+
### Step 3: Markdown Document Authoring
|
|
31
|
+
Draft the canonical HLD Markdown file following the standard 7-section structure. Adhere strictly to the scope rules below.
|
|
32
|
+
|
|
33
|
+
### Step 4: Confluence XHTML Conversion & Verification
|
|
34
|
+
Convert the Markdown to Confluence Storage Format XHTML using `scripts/convert_doc_to_confluence.py`. Verify well-formed XML and correct PlantUML macro rendering.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Scope and Boundary Principles (Strict)
|
|
39
|
+
|
|
40
|
+
1. **High-Level Design Only:**
|
|
41
|
+
- **Include:** Business initiative goals, high-level architecture topology, user surfaces, high-level database references, and security/privacy controls.
|
|
42
|
+
- **DO NOT INCLUDE:**
|
|
43
|
+
- Physical code repository locations, local filesystem folder paths (e.g. `E:\Projects\...`), or git repository URLs. HLD focuses strictly on logical solution architecture, business functions, and system interactions.
|
|
44
|
+
- Internal application API routes or controller implementation details.
|
|
45
|
+
- Stored procedure names, parameter lists, or SQL code.
|
|
46
|
+
- Low-level ETL batch scripts, job schedules, or internal script arguments.
|
|
47
|
+
- Low-level table schemas or physical column definitions.
|
|
48
|
+
2. **Strict Grounding - No Synthetic Target Architecture or Security Topology:**
|
|
49
|
+
- **DO NOT synthesize or fabricate "Target Architecture", "Target State Roadmap", or "Security Topology" sections/diagrams** when there are no notes, documentation, or backlog items mentioning future architecture, and when the user has not explicitly requested them.
|
|
50
|
+
- **Condition for Inclusion:** Only include a Target Architecture, Target State Roadmap, or future security topology section/diagram when:
|
|
51
|
+
1. The user explicitly requests it, OR
|
|
52
|
+
2. Existing repository documentation, PRDs, ADRs, or notes explicitly specify something to be done in the future.
|
|
53
|
+
- When neither condition is met, omit these sections entirely. Do not invent speculative enterprise identity evolutions, automated operational integrations, or synthetic filesystem/host boundary diagrams. Document only the authenticated, current-state solution architecture and established security posture.
|
|
54
|
+
3. **Database Representation:**
|
|
55
|
+
- Mention the physical database host and database name.
|
|
56
|
+
- List high-level reporting summary tables or key domain mart entities only.
|
|
57
|
+
- Low-level staging tables and stored procedures belong strictly in the Lower-Level Design (LLD).
|
|
58
|
+
4. **Sequence Diagrams:**
|
|
59
|
+
- Automated schedulers (such as Windows Task Scheduler or cron) must be depicted as system components or lifeline participants, **NEVER** as human actors.
|
|
60
|
+
5. **Mermaid Diagram Standards (Expert Systems Architect & Mermaid Designer):**
|
|
61
|
+
Render highly professional, visually balanced, and easily readable system architecture diagrams using Mermaid.js markdown blocks. Avoid cluttered, sprawling layouts by enforcing structural constraints and optimized styles.
|
|
62
|
+
|
|
63
|
+
**🎨 Design & Styling Principles:**
|
|
64
|
+
- **Color Palette & Semantic Styling (Standard/Impact/Existing):**
|
|
65
|
+
- Use desaturated, modern executive colors. Do not use highly saturated primary colors.
|
|
66
|
+
- Define exactly 3-4 standard semantic class styles at the top of every diagram:
|
|
67
|
+
- `existingStyle`: Clean Blue (`fill:#EFF6FF,stroke:#2563EB,stroke-width:2px,color:#1E40AF`) for legacy/established components.
|
|
68
|
+
- `newStyle`: Warm Red/Crimson (`fill:#FEF2F2,stroke:#DC2626,stroke-width:2px,color:#991B1B`) for greenfield/new components.
|
|
69
|
+
- `impactedStyle`: Amber/Gold (`fill:#FFFBEB,stroke:#D97706,stroke-width:2px,color:#92400E`) for modified/impacted systems.
|
|
70
|
+
- Apply classes consistently to the nodes using the triple colon notation (e.g., `NodeName:::newStyle`).
|
|
71
|
+
- **Diagram Scalability Settings (Initialization Block):**
|
|
72
|
+
- Always prepend diagrams with a configuration initialization block to control sizing and font scales:
|
|
73
|
+
```mermaid
|
|
74
|
+
%%{init: {
|
|
75
|
+
'theme': 'default',
|
|
76
|
+
'themeVariables': { 'fontSize': '14px', 'subgraphTitleSize': '16px' },
|
|
77
|
+
'flowchart': { 'useMaxWidth': false, 'htmlLabels': true, 'curve': 'basis' }
|
|
78
|
+
} }%%
|
|
79
|
+
```
|
|
80
|
+
- **Readable Text Wrapping:**
|
|
81
|
+
- Never let a single node have a long horizontal text block. Use `<br/>` tags to stack text vertically.
|
|
82
|
+
- Format nodes with clear visual hierarchy: Use bolding for titles, bracket notation for IDs, and italics for status:
|
|
83
|
+
`NodeName["📅 <b>Windows Scheduler</b><br/>[SYS_03]<br/><i>New Component</i>"]`
|
|
84
|
+
|
|
85
|
+
**📐 Layout & Real Estate Rules:**
|
|
86
|
+
- **The 3-Column Kanban Layout (Side-by-Side):**
|
|
87
|
+
- When sequential phases are required (e.g., Phase 1 | Phase 2 | Phase 3) but need to prevent horizontal text compression, utilize a "Hybrid Columnar Layout".
|
|
88
|
+
- **Rule:** Set the top-level flow to Left-to-Right (`flowchart LR`) to align parent containers horizontally, but enforce vertical stacking (`direction TB`) *inside* each subgraph container.
|
|
89
|
+
- **Example Structure:**
|
|
90
|
+
```mermaid
|
|
91
|
+
flowchart LR
|
|
92
|
+
subgraph Phase1["Phase 1"]
|
|
93
|
+
direction TB
|
|
94
|
+
A --> B --> C
|
|
95
|
+
end
|
|
96
|
+
subgraph Phase2["Phase 2"]
|
|
97
|
+
direction TB
|
|
98
|
+
D --> E --> F
|
|
99
|
+
end
|
|
100
|
+
Phase1 --> Phase2
|
|
101
|
+
```
|
|
102
|
+
- **The Two-Line Grid Layout (Row Stacking):**
|
|
103
|
+
- When a 3-pillar horizontal layout spans too wide, stack them into rows by setting the top-level structure to Top-to-Bottom (`flowchart TD`).
|
|
104
|
+
- Group the lower pillars (Phase 2 and Phase 3) side-by-side inside a helper subgraph container that uses `direction LR`. This forces Phase 2 to wrap onto a new line directly below Phase 1.
|
|
105
|
+
- **Component Types:**
|
|
106
|
+
- Use standard flowchart shapes to represent structural entities:
|
|
107
|
+
- `[(Database Node)]` for persistent storage, tables, or file outputs.
|
|
108
|
+
- `["Application Node"]` for processing scripts, APIs, or services.
|
|
109
|
+
- `["🖥️ UI Node"]` for user interfaces.
|
|
110
|
+
6. **Diagram Rendering and Styling (PlantUML Native Engine in Confluence):**
|
|
111
|
+
- Confluence rendering uses native `<ac:structured-macro ac:name="plantuml">` blocks requiring zero page attachments.
|
|
112
|
+
- Standard parameters: `scale 1.2` for flowcharts, `scale max 2000 width` for sequence diagrams, and `skinparam defaultFontSize 11` (no `skinparam dpi 200` to prevent image blowout) to guarantee crisp rendering, neat proportioning, and sharp text without oversized canvas stretching.
|
|
113
|
+
- Spacing: `skinparam ranksep 28` and `skinparam nodesep 24`, package `Padding 10` for tight, balanced whitespace without excessive canvas stretching.
|
|
114
|
+
- Natural curved splines: Do not force `skinparam linetype ortho` or `polyline` which distort canvases. Natural curved spline arrows route cleanly without unnatural box stretching.
|
|
115
|
+
- Zero label clutter: Omit stereotypes (`<<impacted>>`, `<<service>>`, etc.) and verbose status annotations (`(New Component)`, `(Existing Platform)`, `[New]`, `[Existing]`) inside component boxes or on connection labels. Component status is communicated cleanly through color coding and the bottom legend.
|
|
116
|
+
- Automatic edge label wrapping: Labels are wrapped at ~24 characters to prevent horizontal text collision with component bounding boxes.
|
|
117
|
+
- Bold container headers: Package and cluster titles are rendered in bold font (`package "<b>Title</b>"`).
|
|
118
|
+
- Component styling: Colored backgrounds and distinct borders with `skinparam rectangle { BorderThickness 1.5 }` and `skinparam database { BorderThickness 1.5 }`:
|
|
119
|
+
- New / Impacted Components: `rectangle "<b>Title</b>\n[SYS_xx]" as Alias #FEF2F2;line:DC2626` (or `database ... #FEF2F2;line:DC2626`) for a crimson red border.
|
|
120
|
+
- Existing Components: `rectangle "<b>Title</b>\n[SYS_xx]" as Alias #EFF6FF;line:2563EB` (or `database ... #EFF6FF;line:2563EB`) for a deep blue border.
|
|
121
|
+
- Connectivity color coding:
|
|
122
|
+
- New / Impacted connectivity: Solid Red (`#DC2626` / `━━━━▶`).
|
|
123
|
+
- Existing connectivity: Solid Blue (`#2563EB` / `━━━━▶`).
|
|
124
|
+
- Cross-package and feedback connectors: Append `norank` (`-[color,norank]right->`, `-[color,norank]up->`) to prevent vertical rank collapse in horizontal flows and tier scrambling in layered architectures.
|
|
125
|
+
- Dynamic layout heuristics:
|
|
126
|
+
- **Operational Process / Lifecycle Flows**: Must use Left-to-Right (`flowchart LR`) layout organized into sequential multi-stage columns (`subgraph` packages with internal `direction TB`). Inter-stage transitions link horizontally across stages without pushing downstream packages downward (`norank` ranking in PlantUML). This creates a clean side-by-side kanban/phase layout that stays compact vertically.
|
|
127
|
+
- **Solution Landscapes / Architecture Diagrams**: Must follow a clean 3-Tier Layered Hierarchy (`flowchart TD`) ordered along the natural dataflow:
|
|
128
|
+
1. Top Tier: Presentation & Application Tier (Dashboards, APIs, Web UI - `direction LR`)
|
|
129
|
+
2. Middle Tier: Automation & Enterprise Integration Tier (Orchestrators, Pipelines, Gateways, Core Services - `direction LR`)
|
|
130
|
+
3. Bottom Tier: Core Data & Intelligence Platform (Databases, Marts, AI Reasoning Engines - `direction LR`)
|
|
131
|
+
Arranging layers along this hierarchical flow ensures all downward dependency arrows travel cleanly and eliminates criss-crossing diagonal lines or backwards-pointing loops.
|
|
132
|
+
- Arrow sequence numbering: Place sequence numbers and interface IDs clearly on arrow labels (e.g. `SYS_01 -->|"INT_01 [1]: SFTP Batch Transfer"| SYS_04`).
|
|
133
|
+
- Clean embedded Creole legend: Flowchart and architecture diagrams automatically include an embedded PlantUML Creole table legend explaining connection and component markers. Omit legend on sequence diagrams and entity/class domain models.
|
|
134
|
+
- **Entity-Relationship and Domain Class Models:** Use Mermaid `classDiagram` or `erDiagram` syntax under Section 5 (e.g. `### 5.2 Domain Entity Model`). The converter automatically transforms these into native PlantUML `@startuml ... class / entity ... @enduml` macros with scale 1.2, crisp borders, and full attribute rendering.
|
|
135
|
+
- **Diagram Title & Section Placement:** The core solution architecture diagram must ALWAYS be titled `### 4.1 Solution Design and Architecture` under `## 4. Solution Architecture Landscape`. Never title it `System Topology Architecture Diagram` or place it in Section 2.
|
|
136
|
+
7. **No AI Traces and Clean STE:**
|
|
137
|
+
- The HLD must contain zero hints or traces of AI generation (no model names, tool mentions, or meta-notices in the Confluence HTML).
|
|
138
|
+
- Write in Simplified Technical English (ASD-STE100): short sentences, active voice, and clear technical descriptions.
|
|
139
|
+
- Executive Metadata is omitted from the Confluence HTML view (metadata belongs in LLD).
|
|
140
|
+
8. **Dynamic Frontmatter Model:**
|
|
141
|
+
- The Markdown frontmatter `Creating Model:` must dynamically capture whatever model is executing the task (e.g. `gemini-3.8-flash`), never hardcoded.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Standard HLD Document Structure (Markdown)
|
|
146
|
+
Every HLD document must follow this standardized 8-section structure (exemplified by the gold standard reference implementation [`references/gold-standard-hld.md`](references/gold-standard-hld.md), shipped with this skill; read it before writing and match its structure, diagram styling, ID schemes and table columns):
|
|
147
|
+
|
|
148
|
+
```markdown
|
|
149
|
+
---
|
|
150
|
+
type: design
|
|
151
|
+
status: current
|
|
152
|
+
feature: <app>-hld
|
|
153
|
+
creation-agent: caddis
|
|
154
|
+
Original Author: Solutions Architecture
|
|
155
|
+
Creation Date: <YYYY-MM-DDTHH:MM:SSZ>
|
|
156
|
+
Creating Model: <active model ID, e.g. gemini-3.8-flash>
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
# High-Level Architecture (HLA): <Application Name>
|
|
160
|
+
|
|
161
|
+
## Document Information
|
|
162
|
+
|
|
163
|
+
### Version History
|
|
164
|
+
| Version | Date | Author | Description |
|
|
165
|
+
|---|---|---|---|
|
|
166
|
+
| 1.0 | <YYYY-MM-DD> | Solutions Architecture | Initial High-Level Architecture Draft |
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## 1. Executive Summary
|
|
171
|
+
- 1.1 Initiative Goal
|
|
172
|
+
- 1.2 Solution Architecture Summary
|
|
173
|
+
- 1.3 Business Value & Operational Outcomes
|
|
174
|
+
|
|
175
|
+
## 2. Project Context and Scope
|
|
176
|
+
- 2.1 Background
|
|
177
|
+
- 2.2 Scope (In Scope / Out of Scope)
|
|
178
|
+
- 2.3 Architecture Boundaries and Key Assumptions
|
|
179
|
+
|
|
180
|
+
## 3. Solution Approach and Workflow
|
|
181
|
+
- 3.1 Operational Process Flow (Mermaid flowchart with classDef styles)
|
|
182
|
+
- 3.2 End-to-End Operational Sequence Diagram (Mermaid sequence diagram with system scheduler participant)
|
|
183
|
+
|
|
184
|
+
## 4. Solution Architecture Landscape
|
|
185
|
+
- 4.1 Solution Design and Architecture (Mermaid topology diagram with SYS_xx nodes and INT_xx arrows)
|
|
186
|
+
- 4.2 Applications and Components Overview
|
|
187
|
+
- Summary Table columns: ID (SYS_xx), Application / Component, Application Type, Description, Impacted (Yes/No)
|
|
188
|
+
- Detailed subsections for each component (4.2.1 .. 4.2.N)
|
|
189
|
+
- 4.3 Interfaces
|
|
190
|
+
- Summary Table columns: ID (INT_xx), Type / Protocol, From, To, Connectivity (Connectivity Exists / New Connectivity)
|
|
191
|
+
- Detailed subsections for each interface (4.3.1 .. 4.3.N)
|
|
192
|
+
- 4.4 Primary Production Navigation Surfaces (Operational domains and core views)
|
|
193
|
+
- 4.5 Auxiliary and Direct-URL Surfaces (Health, export, documentation endpoints)
|
|
194
|
+
|
|
195
|
+
## 5. High-Level Data and Storage Architecture
|
|
196
|
+
- 5.1 Host and Database/Storage Topology (Database instances, working storage layout)
|
|
197
|
+
- 5.2 Domain Entity Model (Mermaid classDiagram or erDiagram rendered as native PlantUML)
|
|
198
|
+
- 5.3 Output Channels, Summary Mart, or Caching Strategy (As applicable to the application architecture)
|
|
199
|
+
|
|
200
|
+
## 6. Security Architecture and Controls
|
|
201
|
+
- 6.1 Identity and Access Management (Authentication seams, roles, authorization boundaries)
|
|
202
|
+
- 6.2 Network Boundaries and Perimeter Controls (Subnets, ports, host environments)
|
|
203
|
+
- 6.3 Data Protection and Privacy (Encryption, sensitive data handling)
|
|
204
|
+
- 6.4 Auditability and Governance
|
|
205
|
+
|
|
206
|
+
## 7. Architecture Traceability Matrix
|
|
207
|
+
- 7.1 Initiative Requirements & Traceability (DO NOT include section 7.2 or any target roadmap unless explicitly requested by user or documented in notes)
|
|
208
|
+
|
|
209
|
+
## 8. Appendix
|
|
210
|
+
- 8.1 Terms and Definitions
|
|
211
|
+
- 8.2 Reference Documents
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
## Conversion Workflow
|
|
215
|
+
1. Write the canonical HLD Markdown file to `docs/<app>/<app>-hld.md`.
|
|
216
|
+
2. Run the conversion script:
|
|
217
|
+
```powershell
|
|
218
|
+
python scripts/convert_doc_to_confluence.py docs/<app>/<app>-hld.md --output docs/<app>/<app>-hld.html --diagram-type plantuml
|
|
219
|
+
```
|
|
220
|
+
3. Verify that the output validates as well-formed XML and contains `<ac:structured-macro ac:name="plantuml">` blocks with scale 1.2 vector styling, centered alignment, wrapped edge labels, and embedded Creole legend.
|
|
@@ -0,0 +1,428 @@
|
|
|
1
|
+
---
|
|
2
|
+
type: design
|
|
3
|
+
status: current
|
|
4
|
+
feature: invoice-composition-replacement
|
|
5
|
+
creation-agent: caddis
|
|
6
|
+
Original Author: Antigravity
|
|
7
|
+
Creation Date: 2026-09-19T13:35:00Z
|
|
8
|
+
Creating Model: gemini-3.8-flash
|
|
9
|
+
Last Author: Antigravity
|
|
10
|
+
Last Updated: 2026-09-19T14:05:00Z
|
|
11
|
+
Last Model Used: gemini-3.8-flash
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<!--
|
|
15
|
+
GOLD STANDARD REFERENCE for the hld skill.
|
|
16
|
+
This is a real HLD whose organisation-specific facts (company, vendors, hosts, paths, customer
|
|
17
|
+
volumes) were replaced with neutral ones so it can ship publicly. Everything the skill copies
|
|
18
|
+
from it is unchanged: the 8-section structure, heading numbering, the diagram types and their
|
|
19
|
+
styling, the ID schemes (SYS_nn, INT_nn, REQ-nn), and every table's columns. Match THAT, not
|
|
20
|
+
the domain.
|
|
21
|
+
-->
|
|
22
|
+
|
|
23
|
+
# High-Level Architecture (HLA): Invoice Composition Replacement Platform
|
|
24
|
+
|
|
25
|
+
## 1. Executive Summary
|
|
26
|
+
|
|
27
|
+
### 1.1 Initiative Goal
|
|
28
|
+
The Invoice Composition Replacement Platform replaces the proprietary third-party invoice composition system that a telecommunications operator uses for fixed-line billing.
|
|
29
|
+
|
|
30
|
+
This platform achieves the following primary business goals:
|
|
31
|
+
- It eliminates third-party licensing costs, proprietary dependencies, and vendor software lock-in.
|
|
32
|
+
- It provides a locally controlled, deterministic, and auditable composition engine.
|
|
33
|
+
- It delivers high-throughput batch generation for four recurring monthly billing cycles: `BR-07`, `BR-14`, `BR-21`, and `BR-28`.
|
|
34
|
+
- It processes approximately 100,000 customer accounts per billing run within a four-hour service level agreement (SLA) window.
|
|
35
|
+
- It simultaneously produces four synchronized output channels from a single canonical document model: Customer PDF, Print Spool AFP, Mailroom Index JRN, and Digital Portal XML.
|
|
36
|
+
- It guarantees full financial integrity through mandatory, fail-closed automated reconciliation gates.
|
|
37
|
+
|
|
38
|
+
### 1.2 Solution Architecture Summary
|
|
39
|
+
The solution operates as a standalone Python-based batch processing engine deployed on host `batch-host-01`. It processes raw billing stream files (`.EN`) from the upstream billing engine, executes financial reconciliation, and renders customer-facing outputs. The engine isolates every run in an immutable staging directory, verifies cryptographic checksums, and publishes outputs atomically only after all financial and population gates pass.
|
|
40
|
+
|
|
41
|
+
### 1.3 Business Value & Operational Outcomes
|
|
42
|
+
- **Cost Reduction**: Complete decommissioning of third-party composition licenses.
|
|
43
|
+
- **Operational Autonomy**: Full internal control over document templates, business rules, and legal notices.
|
|
44
|
+
- **Audit Defensibility**: Cryptographic sealing of every batch run with complete provenance manifests and append-only event journals.
|
|
45
|
+
- **Financial Compliance**: Zero-tolerance reconciliation preventing billing discrepancies between rated data and rendered customer invoices.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 2. Project Context and Scope
|
|
50
|
+
|
|
51
|
+
### 2.1 Background
|
|
52
|
+
The operator's fixed customer billing produces monthly invoices across four staggered billing cycles. The legacy composition workflow relied on an external vendor system. This introduced high annual licensing costs and operational delays whenever regulatory or template changes occurred. The replacement platform moves invoice composition entirely onto internal infrastructure using high-performance open standards.
|
|
53
|
+
|
|
54
|
+
### 2.2 Scope
|
|
55
|
+
|
|
56
|
+
#### 2.2.1 In Scope
|
|
57
|
+
- Ingestion of raw `.EN` tagged-record stream files generated by the upstream billing engine.
|
|
58
|
+
- Syntactic and structural validation of incoming batch streams with marker-file arrival detection.
|
|
59
|
+
- Transformation of raw stream records into an immutable, strongly typed canonical domain model.
|
|
60
|
+
- Full-population financial reconciliation covering invoice totals, line item aggregates, tax breakdowns, and balance brought forward.
|
|
61
|
+
- Version-controlled template selection and date-effective static legal content resolution.
|
|
62
|
+
- High-performance direct-draw PDF rendering using PyMuPDF with byte-level determinism.
|
|
63
|
+
- High-speed print spool generation using MO:DCA AFP binary encoding.
|
|
64
|
+
- Print house journal index generation for postal insertion and mailroom tracking.
|
|
65
|
+
- Lossless structured XML generation for online customer self-service portals.
|
|
66
|
+
- Run-level cryptographic manifest creation and append-only event journaling.
|
|
67
|
+
- Atomic publication to destination endpoints with isolated staging and late-arriving release markers.
|
|
68
|
+
|
|
69
|
+
#### 2.2.2 Out of Scope
|
|
70
|
+
- Upstream rating, charging, or billing account balance calculation performed by the billing engine.
|
|
71
|
+
- Direct management or control of physical print-house insertion machinery and postal sorters.
|
|
72
|
+
- Real-time customer web serving; online portals ingest published outputs asynchronously.
|
|
73
|
+
- Probabilistic, generative, or Large Language Model (LLM) components in the financial generation path.
|
|
74
|
+
|
|
75
|
+
### 2.3 Architecture Boundaries and Key Assumptions
|
|
76
|
+
- **Deterministic Processing**: All calculations and document renderings produce identical, byte-reproducible outputs for identical inputs.
|
|
77
|
+
- **Local Filesystem Isolation**: Network-isolated execution on `batch-host-01` with zero runtime external API or HTTP dependencies.
|
|
78
|
+
- **Fail-Closed Operations**: Any financial discrepancy, unmapped record, or population count mismatch immediately halts the run and prevents output release.
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 3. Solution Approach and Workflow
|
|
83
|
+
|
|
84
|
+
### 3.1 Operational Process Flow
|
|
85
|
+
|
|
86
|
+
The batch execution pipeline operates across five consecutive stages governed by a strict nine-state finite state machine (`RunLifecycle`):
|
|
87
|
+
`RECEIVED` -> `INGESTING` -> `INPUT_VALIDATED` -> `GENERATING` -> `VALIDATING` -> `RECONCILING` -> `READY_FOR_RELEASE` -> `PUBLISHING` -> `RELEASED`.
|
|
88
|
+
|
|
89
|
+
```mermaid
|
|
90
|
+
flowchart LR
|
|
91
|
+
classDef stageStyle fill:#F8FAFC,stroke:#475569,stroke-width:2px,color:#0F172A;
|
|
92
|
+
classDef gateStyle fill:#FEF2F2,stroke:#DC2626,stroke-width:2px,color:#991B1B;
|
|
93
|
+
|
|
94
|
+
subgraph S1["Stage 1: Ingestion & Staging"]
|
|
95
|
+
direction TB
|
|
96
|
+
P1["Check Marker & File Stability"]:::stageStyle
|
|
97
|
+
P2["Stage Input & Verify SHA-256"]:::stageStyle
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
subgraph S2["Stage 2: Canonical Mapping"]
|
|
101
|
+
direction TB
|
|
102
|
+
P3["Parse Tagged-Record Stream"]:::stageStyle
|
|
103
|
+
P4["Build Canonical BillDocument"]:::stageStyle
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
subgraph S3["Stage 3: Reconciliation Gate"]
|
|
107
|
+
direction TB
|
|
108
|
+
P5["Full-Population Financial Gate"]:::gateStyle
|
|
109
|
+
P6["Resolve Date-Effective Content"]:::stageStyle
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
subgraph S4["Stage 4: Composition & Rendering"]
|
|
113
|
+
direction TB
|
|
114
|
+
P7["Render Direct-Draw PDF"]:::stageStyle
|
|
115
|
+
P8["Compose AFP, JRN & XML"]:::stageStyle
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
subgraph S5["Stage 5: Atomic Release & Publish"]
|
|
119
|
+
direction TB
|
|
120
|
+
P9["Cross-Output Population Audit"]:::stageStyle
|
|
121
|
+
P10["Atomic Copy & Write Release Marker"]:::stageStyle
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
P1 --> P2
|
|
125
|
+
P2 --> P3
|
|
126
|
+
P3 --> P4
|
|
127
|
+
P4 --> P5
|
|
128
|
+
P5 --> P6
|
|
129
|
+
P6 --> P7
|
|
130
|
+
P7 --> P8
|
|
131
|
+
P8 --> P9
|
|
132
|
+
P9 --> P10
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 3.2 End-to-End Operational Sequence Diagram
|
|
136
|
+
|
|
137
|
+
The sequence diagram below illustrates the batch execution sequence from cycle trigger through atomic publication:
|
|
138
|
+
|
|
139
|
+
```mermaid
|
|
140
|
+
sequenceDiagram
|
|
141
|
+
autonumber
|
|
142
|
+
participant Sched as Automated Batch Scheduler
|
|
143
|
+
participant Orch as Batch Orchestrator
|
|
144
|
+
participant Reader as Tagged-Record Ingestor
|
|
145
|
+
participant Reconcile as Financial Reconciliation Gate
|
|
146
|
+
participant Render as Multi-Channel Composition Engine
|
|
147
|
+
participant Audit as Cryptographic Audit Logger
|
|
148
|
+
participant Storage as Working Staging Root
|
|
149
|
+
participant Targets as Production Distribution Endpoints
|
|
150
|
+
|
|
151
|
+
Note over Sched,Targets: Stage 1: Ingestion & Verification
|
|
152
|
+
Sched->>Orch: Trigger cycle run (e.g. BR-07)
|
|
153
|
+
Orch->>Storage: Verify incoming .EN stream and arrival marker
|
|
154
|
+
Orch->>Storage: Stage input files and compute baseline SHA-256 hashes
|
|
155
|
+
Orch->>Audit: Record RunLifecycle::INPUT_VALIDATED
|
|
156
|
+
|
|
157
|
+
Note over Orch,Reconcile: Stage 2 & 3: Parsing, Mapping & Financial Gate
|
|
158
|
+
Orch->>Reader: Stream staged .EN tagged records
|
|
159
|
+
Reader->>Reader: Map raw tokens to canonical BillDocument model
|
|
160
|
+
Orch->>Reconcile: Execute full-population financial balance audit
|
|
161
|
+
alt Financial Discrepancy Found
|
|
162
|
+
Reconcile-->>Orch: Financial mismatch error (fail-closed)
|
|
163
|
+
Orch->>Audit: Record RunLifecycle::FAILED with audit delta
|
|
164
|
+
Orch-->>Sched: Abort run execution
|
|
165
|
+
else All Accounts Balanced
|
|
166
|
+
Reconcile-->>Orch: Reconciliation passed (0 errors)
|
|
167
|
+
Orch->>Audit: Record RunLifecycle::GENERATING
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
Note over Orch,Render: Stage 4: Multi-Channel Composition
|
|
171
|
+
par Parallel Rendering
|
|
172
|
+
Orch->>Render: Render byte-deterministic PDF invoices (PyMuPDF)
|
|
173
|
+
Orch->>Render: Generate MO:DCA AFP print spools
|
|
174
|
+
Orch->>Render: Compile JRN mailroom insertion indexes
|
|
175
|
+
Orch->>Render: Emit lossless eBilling XML files
|
|
176
|
+
end
|
|
177
|
+
Render->>Storage: Write outputs into staging directories
|
|
178
|
+
|
|
179
|
+
Note over Orch,Targets: Stage 5: Population Audit & Atomic Release
|
|
180
|
+
Orch->>Audit: Verify population counts (PDF == XML == AFP == 100,000)
|
|
181
|
+
Orch->>Audit: Seal freeze-manifest.json and compute final SHA-256 digests
|
|
182
|
+
Orch->>Audit: Transition to RunLifecycle::READY_FOR_RELEASE
|
|
183
|
+
Orch->>Targets: Copy verified artifacts to delivery endpoints
|
|
184
|
+
Orch->>Targets: Write atomic release marker file (.COMPLETE)
|
|
185
|
+
Orch->>Audit: Transition to RunLifecycle::RELEASED
|
|
186
|
+
Orch-->>Sched: Batch execution completed successfully
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## 4. Solution Architecture Landscape
|
|
192
|
+
|
|
193
|
+
### 4.1 Solution Design and Architecture
|
|
194
|
+
|
|
195
|
+
The solution landscape connects the upstream billing rating engine, the core batch transformation platform, and downstream customer presentation and physical print channels.
|
|
196
|
+
|
|
197
|
+
```mermaid
|
|
198
|
+
flowchart TD
|
|
199
|
+
classDef existingStyle fill:#EFF6FF,stroke:#2563EB,stroke-width:2px,color:#1E40AF;
|
|
200
|
+
classDef newStyle fill:#FEF2F2,stroke:#DC2626,stroke-width:2px,color:#991B1B;
|
|
201
|
+
|
|
202
|
+
subgraph Upstream["Upstream Billing Systems"]
|
|
203
|
+
direction LR
|
|
204
|
+
SYS_01["SYS_01: Billing & Rating Engine<br/>Rating & Billing Lifecycle"]:::existingStyle
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
subgraph CorePlatform["Invoice Composition Replacement Platform (batch-host-01)"]
|
|
208
|
+
direction LR
|
|
209
|
+
SYS_02["SYS_02: Composition Replacement Engine<br/>Ingestion, Mapping, Reconcile & Render"]:::newStyle
|
|
210
|
+
SYS_06["SYS_06: Operations Control Centre<br/>Audit Journal, Sealed Manifest & CLI"]:::newStyle
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
subgraph Downstream["Downstream Distribution Channels"]
|
|
214
|
+
direction LR
|
|
215
|
+
SYS_03["SYS_03: Print House & Mailroom<br/>Physical Print & Insertion Spool"]:::existingStyle
|
|
216
|
+
SYS_04["SYS_04: Customer Self-Service Portal<br/>Online eBilling XML Viewer"]:::existingStyle
|
|
217
|
+
SYS_05["SYS_05: Enterprise Document Archive<br/>Customer PDF Storage & Email"]:::existingStyle
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
SYS_01 -->|"INT_01: .EN Billing Stream & Marker"| SYS_02
|
|
221
|
+
SYS_02 -->|"INT_02: MO:DCA AFP Spools"| SYS_03
|
|
222
|
+
SYS_02 -->|"INT_03: JRN Insertion Indexes"| SYS_03
|
|
223
|
+
SYS_02 -->|"INT_04: eBilling XML Batches"| SYS_04
|
|
224
|
+
SYS_02 -->|"INT_05: Deterministic PDF Invoices"| SYS_05
|
|
225
|
+
SYS_02 -->|"INT_06: Telemetry & Sealed Manifest"| SYS_06
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### 4.2 Applications and Components Overview
|
|
229
|
+
|
|
230
|
+
The table below catalogs all systems and platforms within the solution boundary:
|
|
231
|
+
|
|
232
|
+
| ID | Application / Component | Application Type | Description | Impacted |
|
|
233
|
+
|---|---|---|---|---|
|
|
234
|
+
| `SYS_01` | Billing & Rating Engine | Billing / Rating | Upstream rating engine producing periodic `.EN` billing stream files. | No |
|
|
235
|
+
| `SYS_02` | Composition Replacement Engine | Batch Engine | Core batch orchestration, mapping, financial reconciliation, and multi-channel rendering engine. | Yes |
|
|
236
|
+
| `SYS_03` | External Print House & Mailroom Spool | Print Production | Commercial printing facility ingesting MO:DCA AFP spools and JRN insertion records. | No |
|
|
237
|
+
| `SYS_04` | Customer Self-Service Portal | Web Portal | Customer billing portal ingesting structured eBilling XML for web presentation. | No |
|
|
238
|
+
| `SYS_05` | Enterprise Document Archive & Dispatcher | Document Repository | Long-term customer communications repository and email dispatcher ingesting certified PDF invoices. | No |
|
|
239
|
+
| `SYS_06` | Operations Control Centre & Audit Journal | Ops & Governance | Operational monitoring CLI, telemetry aggregator, and sealed run manifest validator. | Yes |
|
|
240
|
+
|
|
241
|
+
#### 4.2.1 SYS_01: Billing & Rating Engine
|
|
242
|
+
The billing engine calculates customer monthly billing totals, rating, and payment adjustments. At cycle close, it exports raw `.EN` tagged-record stream files to the staging transfer area.
|
|
243
|
+
|
|
244
|
+
#### 4.2.2 SYS_02: Composition Replacement Engine
|
|
245
|
+
The core processing component implemented in Python. It executes local staging, canonical data mapping, strict financial reconciliation, and parallel document rendering.
|
|
246
|
+
|
|
247
|
+
#### 4.2.3 SYS_03: External Print House & Mailroom Spool
|
|
248
|
+
Receives binary MO:DCA AFP print spools and JRN insertion index files for postal sorting, physical paper printing, envelope inserting, and mail dispatch.
|
|
249
|
+
|
|
250
|
+
#### 4.2.4 SYS_04: Customer Self-Service Portal
|
|
251
|
+
The customer-facing digital web application that parses structured XML invoice streams to present interactive online bill breakdowns.
|
|
252
|
+
|
|
253
|
+
#### 4.2.5 SYS_05: Enterprise Document Archive & Dispatcher
|
|
254
|
+
The central document store that ingests byte-deterministic PDF files for permanent customer record retention and automated email bill dispatch.
|
|
255
|
+
|
|
256
|
+
#### 4.2.6 SYS_06: Operations Control Centre & Audit Journal
|
|
257
|
+
The administrative command-line and operational tooling suite used to trigger batch runs, monitor state transitions, verify cryptographic checksums, and inspect audit logs.
|
|
258
|
+
|
|
259
|
+
### 4.3 Interfaces
|
|
260
|
+
|
|
261
|
+
The table below details all communication interfaces across the platform boundary:
|
|
262
|
+
|
|
263
|
+
| ID | Type / Protocol | From | To | Description | Connectivity |
|
|
264
|
+
|---|---|---|---|---|---|
|
|
265
|
+
| `INT_01` | SFTP / SMB File Feed | `SYS_01` | `SYS_02` | Tagged-record billing stream (`.EN`) and cycle marker file. | Existing Connectivity |
|
|
266
|
+
| `INT_02` | Secure File Transfer | `SYS_02` | `SYS_03` | MO:DCA AFP binary print stream partitioned at source-EN granularity. | New Connectivity |
|
|
267
|
+
| `INT_03` | Secure File Transfer | `SYS_02` | `SYS_03` | Tabular ASCII index files (`.JRN`) containing mailroom insertion records. | New Connectivity |
|
|
268
|
+
| `INT_04` | Secure File Transfer | `SYS_02` | `SYS_04` | Lossless structured XML documents matching customer portal schema. | New Connectivity |
|
|
269
|
+
| `INT_05` | Secure File Transfer | `SYS_02` | `SYS_05` | Certified, byte-deterministic PDF customer invoices. | New Connectivity |
|
|
270
|
+
| `INT_06` | Local File / JSONL | `SYS_02` | `SYS_06` | Append-only execution journal, telemetry events, and sealed manifest. | New Connectivity |
|
|
271
|
+
|
|
272
|
+
#### 4.3.1 INT_01: Billing Stream & Completion Marker
|
|
273
|
+
Transfers raw `.EN` data files containing account records, billing headers, charge breakdowns, and payment histories. A completion marker file signals batch completeness.
|
|
274
|
+
|
|
275
|
+
#### 4.3.2 INT_02: MO:DCA AFP Print Spools
|
|
276
|
+
Delivers structured binary AFP spools formatted for high-speed commercial printers. Each AFP file corresponds to an upstream input batch.
|
|
277
|
+
|
|
278
|
+
#### 4.3.3 INT_03: JRN Mailroom Insertion Indexes
|
|
279
|
+
Delivers ASCII index files specifying sheet counts, account identifiers, envelope barcodes, and selective advertising insert triggers.
|
|
280
|
+
|
|
281
|
+
#### 4.3.4 INT_04: eBilling XML Batches
|
|
282
|
+
Transfers schema-validated XML documents containing invoice data for online customer self-service viewing.
|
|
283
|
+
|
|
284
|
+
#### 4.3.5 INT_05: Deterministic PDF Invoices
|
|
285
|
+
Transfers byte-deterministic PDF documents containing vector brand artwork, billing transaction tables, and payment slips.
|
|
286
|
+
|
|
287
|
+
#### 4.3.6 INT_06: Telemetry & Sealed Manifest
|
|
288
|
+
Emits structured JSONL telemetry and a cryptographic `release_manifest.json` sealing file counts, execution parameters, and SHA-256 hashes.
|
|
289
|
+
|
|
290
|
+
### 4.4 Primary Production Execution Surfaces
|
|
291
|
+
The platform provides administrative command-line surfaces for operations and scheduling:
|
|
292
|
+
- `python -m src.cli run --cycle BR-07`: Executes an end-to-end scheduled batch run.
|
|
293
|
+
- `python -m src.cli verify --run-id <ID>`: Validates stage outputs and cryptographic manifests.
|
|
294
|
+
- `python -m src.cli reconcile --run-id <ID>`: Executes standalone full-population financial audits.
|
|
295
|
+
- `python -m src.cli status`: Queries active pipeline state, worker progress, and memory utilization.
|
|
296
|
+
|
|
297
|
+
### 4.5 Auxiliary and Operational Audit Surfaces
|
|
298
|
+
- **Freeze Manifests**: `<working_root>/<run_id>/<attempt_id>/manifests/freeze-manifest.json` locks template versions, configuration files, and legal text snapshots before rendering starts.
|
|
299
|
+
- **Release Manifests**: `<working_root>/<run_id>/<attempt_id>/manifests/release_manifest.json` contains cryptographic SHA-256 hashes for all generated output files.
|
|
300
|
+
- **Execution Evidence**: `<working_root>/<run_id>/<attempt_id>/evidence/` contains test logs, financial reconciliation summaries, and output population audits.
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## 5. High-Level Data and Storage Architecture
|
|
305
|
+
|
|
306
|
+
### 5.1 Host & Working Storage Topology
|
|
307
|
+
The engine executes entirely within a dedicated local filesystem hierarchy on host `batch-host-01`. Every batch run is isolated by unique run and attempt identifiers:
|
|
308
|
+
|
|
309
|
+
```
|
|
310
|
+
<working_root>/<run_id>/<attempt_id>/
|
|
311
|
+
├── input/ # Immutable local copy of source .EN files
|
|
312
|
+
├── staging/ # Active rendering and composition working directory
|
|
313
|
+
│ ├── pdf/ # Rendered PDF files
|
|
314
|
+
│ ├── xml/ # Generated eBilling XML files
|
|
315
|
+
│ ├── afp/ # Generated MO:DCA AFP print spools
|
|
316
|
+
│ └── jrn/ # Generated JRN insertion journals
|
|
317
|
+
├── output/ # Ready-for-release consolidated output artifacts
|
|
318
|
+
├── manifests/ # Frozen configuration, effective hashes, and audit logs
|
|
319
|
+
│ ├── content.yml # Frozen legal and marketing text snapshot
|
|
320
|
+
│ ├── effective-config.json
|
|
321
|
+
│ └── freeze-manifest.json
|
|
322
|
+
└── evidence/ # Automated test reports, parity logs, and execution evidence
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### 5.2 Canonical Domain Entity Model
|
|
326
|
+
|
|
327
|
+
The domain entity model enforces type safety and monetary precision across all transformation steps:
|
|
328
|
+
|
|
329
|
+
```mermaid
|
|
330
|
+
classDiagram
|
|
331
|
+
class BillDocument {
|
|
332
|
+
+String invoice_id
|
|
333
|
+
+String account_number
|
|
334
|
+
+Date issue_date
|
|
335
|
+
+Date due_date
|
|
336
|
+
+Decimal total_amount
|
|
337
|
+
+Decimal balance_brought_forward
|
|
338
|
+
+Decimal amount_due
|
|
339
|
+
+List~ChargeItem~ charges
|
|
340
|
+
+List~PaymentRecord~ payments
|
|
341
|
+
+List~TaxItem~ tax_items
|
|
342
|
+
}
|
|
343
|
+
class ChargeItem {
|
|
344
|
+
+String description
|
|
345
|
+
+String category
|
|
346
|
+
+Decimal gross_amount
|
|
347
|
+
+Decimal vat_rate
|
|
348
|
+
+Decimal vat_amount
|
|
349
|
+
}
|
|
350
|
+
class PaymentRecord {
|
|
351
|
+
+Date payment_date
|
|
352
|
+
+String payment_method
|
|
353
|
+
+Decimal amount
|
|
354
|
+
}
|
|
355
|
+
class TaxItem {
|
|
356
|
+
+Decimal vat_rate
|
|
357
|
+
+Decimal net_amount
|
|
358
|
+
+Decimal vat_amount
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
BillDocument "1" *-- "many" ChargeItem
|
|
362
|
+
BillDocument "1" *-- "many" PaymentRecord
|
|
363
|
+
BillDocument "1" *-- "many" TaxItem
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### 5.3 Multi-Channel Output Volume & Specifications
|
|
367
|
+
Production metrics established during candidate certification (ATT-006 baseline):
|
|
368
|
+
- **PDF Documents**: 100,750 total PDF files (100,000 primary invoices + 750 secondary itemized schedules).
|
|
369
|
+
- **XML Documents**: 100,000 structured customer eBilling files.
|
|
370
|
+
- **AFP Spools**: 32 consolidated MO:DCA print files matching the 32 upstream input batches.
|
|
371
|
+
- **JRN Journals**: 32 postal index files containing 100% field parity with postal insertion machinery.
|
|
372
|
+
|
|
373
|
+
---
|
|
374
|
+
|
|
375
|
+
## 6. Security Architecture and Controls
|
|
376
|
+
|
|
377
|
+
The platform security architecture adheres to strict controls defined in `docs/SECURITY_AND_PRIVACY.md`:
|
|
378
|
+
|
|
379
|
+
### 6.1 Hardened Parsing & Processing Controls
|
|
380
|
+
- **XML Security**: `ingestion/xml_reader.py` disables external entity resolution (`resolve_entities=False`), network access (`no_network=True`), and DTD loading. Any incoming document containing a `DOCTYPE` declaration is rejected immediately. Input file size is capped at 10 MiB to prevent memory exhaustion attacks.
|
|
381
|
+
- **Output Escaping**: The Jinja2 rendering environment enforces `autoescape=True` unconditionally. File loaders are confined to approved template directories to prevent path traversal attacks.
|
|
382
|
+
|
|
383
|
+
### 6.2 Zero Runtime Network Access
|
|
384
|
+
- No module within `ingestion/`, `mapping/`, `templating/`, or `rendering/` initiates external HTTP or network requests during generation.
|
|
385
|
+
- All fonts, styling assets, and configuration templates reside locally on disk on `batch-host-01`.
|
|
386
|
+
|
|
387
|
+
### 6.3 Working Storage Path Isolation & Traversal Defense
|
|
388
|
+
- File discovery resolves candidate paths and rejects any file whose resolved parent directory escapes the staging root.
|
|
389
|
+
- Output filenames derive from validated invoice identifiers using a strict alphanumeric pattern (`[A-Za-z0-9._-]`). Path traversal attempts are rejected immediately.
|
|
390
|
+
|
|
391
|
+
### 6.4 Privacy and Audit Redaction
|
|
392
|
+
- Domain models override string representations to redact personal customer names and street addresses from log outputs.
|
|
393
|
+
- Upstream customer metadata categories (`FIRSTNAME`, `EMAIL`, `OFFNETID`, `POSTCODE`) are dropped during ingestion mapping.
|
|
394
|
+
- Audit manifests record only source file basenames, billing reference numbers, and one-way SHA-256 correlation identifiers.
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## 7. Architecture Traceability Matrix
|
|
399
|
+
|
|
400
|
+
### 7.1 Architecture Traceability Matrix
|
|
401
|
+
|
|
402
|
+
| Requirement | Description | Component Implementation | Verification Control |
|
|
403
|
+
|---|---|---|---|
|
|
404
|
+
| `REQ-01` | Ingest `.EN` tagged-record streams | `SYS_02` (`ingestion/en_reader.py`) | Automated parser unit tests and zero-failure batch validation. |
|
|
405
|
+
| `REQ-02` | Strong financial reconciliation | `SYS_02` (`reconciliation/checks.py`) | Full-population balance reconciliation gate (`reconcile()`). |
|
|
406
|
+
| `REQ-03` | Byte-deterministic PDF rendering | `SYS_02` (`rendering/mupdf_renderer.py`) | SHA-256 byte-identity verification against certified baseline. |
|
|
407
|
+
| `REQ-04` | Multi-channel parity (PDF/XML/AFP/JRN) | `SYS_02` (`mapping/*`, `rendering/*`) | Cross-output population count verification (`100,000` exact). |
|
|
408
|
+
| `REQ-05` | Atomic release & staging isolation | `SYS_02` (`batch/orchestrator.py`) | Zero output visibility before `READY_FOR_RELEASE` and marker written last. |
|
|
409
|
+
| `REQ-06` | Auditability & run sealing | `SYS_06` (`audit/manifest.py`) | Cryptographic `release_manifest.json` generation. |
|
|
410
|
+
|
|
411
|
+
---
|
|
412
|
+
|
|
413
|
+
## 8. Appendix
|
|
414
|
+
|
|
415
|
+
### 8.1 Terms and Definitions
|
|
416
|
+
|
|
417
|
+
| Term | Definition |
|
|
418
|
+
|---|---|
|
|
419
|
+
| `.EN` | Proprietary tagged-record flat file format emitted by the upstream billing engine. |
|
|
420
|
+
| AFP | Advanced Function Presentation / MO:DCA binary print architecture used in industrial mailrooms. |
|
|
421
|
+
| JRN | Journal insertion index file coordinating automated paper folding and envelope stuffing. |
|
|
422
|
+
| Byte Determinism | The guarantee that identical inputs rendered with identical parameters yield identical binary SHA-256 hashes. |
|
|
423
|
+
| Fail-Closed | An architectural principle where any detected inconsistency aborts processing before releasing outputs. |
|
|
424
|
+
|
|
425
|
+
### 8.2 Reference Documents
|
|
426
|
+
- `<repo>/README.md`: System operational runbook and architecture overview.
|
|
427
|
+
- `<repo>/docs/SECURITY_AND_PRIVACY.md`: Security controls and privacy safeguards.
|
|
428
|
+
- `<repo>/docs/PRODUCTION_CANDIDATE_ATT006.md`: Candidate certification report and benchmark results.
|