Skip to content

Commit f9e8ab4

Browse files
committed
fix(architect): enforce blackbox system representation in Context View
Updated architect commands to ensure Context View shows the system as a single unified node with only external connections: - Added critical constraint callout explaining blackbox requirement - System must appear as ONE node (no internal components) - Only stakeholders/users and external systems allowed - Internal databases, services, caches excluded from Context View - Added validation checklist with 5 verification points - Updated diagram templates with proper styling for entity types - Clear guidance on what belongs in Context vs Functional/Deployment views
1 parent 9e1ace2 commit f9e8ab4

File tree

3 files changed

+106
-23
lines changed

3 files changed

+106
-23
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [Unreleased]
1111

12+
### Changed
13+
14+
- **Context View Blackbox Enforcement**: Updated architect commands to strictly enforce blackbox system representation in Context View
15+
- System MUST appear as a single unified node (no internal components)
16+
- Only external actors (stakeholders/users) and external systems shown
17+
- Internal databases, services, caches explicitly excluded from Context View
18+
- Added validation checklist to `architect.implement` command
19+
- Updated diagram templates with proper styling for stakeholders vs external systems
20+
- Clear guidance on what belongs in Context View vs Functional/Deployment views
21+
1222
### Added
1323

1424
- **Lean Architecture Views**: Configurable view generation with core vs optional views

templates/architecture-template.md

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@
5151

5252
**Purpose**: Define system scope and external interactions
5353

54+
> **CRITICAL CONSTRAINT**: The Context View presents the system as a **single blackbox**. Internal components, services, or implementation details must NOT appear here. Only show:
55+
>
56+
> - The system as ONE unified node
57+
> - External actors (users, stakeholders)
58+
> - External systems the system integrates with
59+
> - Data flows crossing the system boundary
60+
5461
#### 3.1.1 System Scope
5562

5663
[High-level description of what the system does and its boundaries]
@@ -59,32 +66,54 @@
5966

6067
| Entity | Type | Interaction Type | Data Exchanged | Protocols |
6168
|--------|------|------------------|----------------|-----------|
62-
| [ENTITY_1] | User/System/API | [e.g., REST API, UI] | [e.g., User credentials, requests] | [e.g., HTTPS, WebSocket] |
69+
| [ENTITY_1] | User/Stakeholder | [e.g., Web UI, Mobile App] | [e.g., User credentials, requests] | [e.g., HTTPS] |
6370
| [ENTITY_2] | [External System] | [Integration method] | [Data format] | [Protocol] |
6471

72+
**Entity Types** (for Context View):
73+
74+
- **Stakeholders/Users**: Human actors who interact with the system
75+
- **External Systems**: Third-party services, APIs, or systems outside your control
76+
- **Data Sources**: External databases or data feeds the system consumes
77+
- **Data Sinks**: External systems that receive data from this system
78+
6579
#### 3.1.3 Context Diagram
6680

6781
**Note**: Diagrams are auto-generated based on your configured format (mermaid or ascii).
6882
To change format, edit `~/.config/specify/config.json` and set `architecture.diagram_format`.
6983

84+
> **Blackbox Requirement**: The system MUST appear as a single node. Do NOT show internal components (databases, caches, services) that are part of this system. Internal details belong in the Functional View (3.2) and Deployment View (3.6).
85+
7086
```mermaid
7187
graph TD
72-
Users["👥 Users"]
73-
System["🏢 System<br/>(Main Application)"]
74-
Database["🗄️ Database"]
75-
ExternalAPI["🌐 External APIs"]
76-
CloudServices["☁️ Cloud Services"]
88+
%% Stakeholders/Users (external actors)
89+
Users["👥 End Users"]
90+
Admins["👤 Administrators"]
91+
92+
%% THE SYSTEM (single blackbox)
93+
System["🏢 [SYSTEM_NAME]<br/>(This System)"]
94+
95+
%% External Systems (third-party, outside your control)
96+
PaymentGateway["💳 Payment Gateway<br/>(External)"]
97+
EmailService["📧 Email Service<br/>(External)"]
98+
IdentityProvider["🔐 Identity Provider<br/>(External)"]
99+
100+
%% Connections: Stakeholders to System
101+
Users -->|"Uses via Web/Mobile"| System
102+
Admins -->|"Manages via Admin Portal"| System
77103
78-
Users -->|Requests| System
79-
System -->|Queries| Database
80-
System -->|Integrates| ExternalAPI
81-
System -->|Deploys to| CloudServices
104+
%% Connections: System to External Systems
105+
System -->|"Processes payments"| PaymentGateway
106+
System -->|"Sends notifications"| EmailService
107+
System -->|"Authenticates users"| IdentityProvider
82108
83-
classDef systemNode fill:#f47721,stroke:#333,stroke-width:2px,color:#fff
84-
classDef externalNode fill:#e0e0e0,stroke:#333,stroke-width:1px
109+
%% Styling: System as prominent blackbox, externals as grey
110+
classDef systemNode fill:#f47721,stroke:#333,stroke-width:3px,color:#fff,font-weight:bold
111+
classDef stakeholderNode fill:#4a9eff,stroke:#333,stroke-width:1px,color:#fff
112+
classDef externalNode fill:#e0e0e0,stroke:#333,stroke-width:1px,color:#333
85113
86114
class System systemNode
87-
class Users,Database,ExternalAPI,CloudServices externalNode
115+
class Users,Admins stakeholderNode
116+
class PaymentGateway,EmailService,IdentityProvider externalNode
88117
```
89118

90119
#### 3.1.4 External Dependencies

templates/commands/architect.implement.md

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -107,30 +107,74 @@ Generate views in this order (earlier views inform later ones):
107107

108108
**ADRs to Reference**: System style, integration patterns, external dependencies
109109

110+
> **CRITICAL: Blackbox Requirement**
111+
>
112+
> The Context View MUST show the system as a **single blackbox node**. This view answers: "What does the system connect to?" NOT "What's inside the system?"
113+
>
114+
> **DO include**:
115+
>
116+
> - The system as ONE unified node (no internal components)
117+
> - Stakeholders/Users (human actors)
118+
> - External systems (third-party services outside your control)
119+
> - Data flows crossing the system boundary
120+
>
121+
> **DO NOT include**:
122+
>
123+
> - Internal databases (those go in Deployment View)
124+
> - Internal services/microservices (those go in Functional View)
125+
> - Internal caches, queues, or storage (those go in Deployment View)
126+
> - Implementation details of any kind
127+
110128
**Generate**:
111129

112130
- System scope description (from system style ADR)
113-
- External entities table (from integration ADRs)
114-
- Context diagram (Mermaid format)
131+
- External entities table - ONLY stakeholders and external systems
132+
- Context diagram showing system as single blackbox
115133
- External dependencies table (from dependency ADRs)
116134

117135
**Diagram Template**:
118136

119137
```mermaid
120138
graph TD
121-
subgraph "External Entities"
122-
Users["Users/Clients"]
123-
ExtSystem["External System"]
124-
ExtAPI["External API"]
125-
end
139+
%% Stakeholders (human actors interacting with the system)
140+
Users["Users/Clients"]
141+
Admins["Administrators"]
126142
143+
%% THE SYSTEM - Single blackbox (NO internal components)
127144
System["[System Name]<br/>(This System)"]
128145
129-
Users -->|"[Interaction]"| System
130-
System -->|"[Interaction]"| ExtSystem
131-
System -->|"[Interaction]"| ExtAPI
146+
%% External Systems (third-party, outside your control)
147+
ExtPayment["Payment Provider<br/>(External)"]
148+
ExtAuth["Identity Provider<br/>(External)"]
149+
ExtAPI["Partner API<br/>(External)"]
150+
151+
%% Stakeholder interactions
152+
Users -->|"Uses"| System
153+
Admins -->|"Manages"| System
154+
155+
%% External system integrations
156+
System -->|"Processes payments"| ExtPayment
157+
System -->|"Authenticates"| ExtAuth
158+
System -->|"Exchanges data"| ExtAPI
159+
160+
%% Styling
161+
classDef systemNode fill:#f47721,stroke:#333,stroke-width:3px,color:#fff
162+
classDef stakeholderNode fill:#4a9eff,stroke:#333,stroke-width:1px,color:#fff
163+
classDef externalNode fill:#e0e0e0,stroke:#333,stroke-width:1px
164+
165+
class System systemNode
166+
class Users,Admins stakeholderNode
167+
class ExtPayment,ExtAuth,ExtAPI externalNode
132168
```
133169

170+
**Validation Checklist** (verify before finalizing Context View):
171+
172+
- [ ] System appears as exactly ONE node
173+
- [ ] No internal databases shown (e.g., PostgreSQL, Redis)
174+
- [ ] No internal services shown (e.g., AuthService, UserService)
175+
- [ ] All entities are either stakeholders OR external systems
176+
- [ ] All connections cross the system boundary
177+
134178
#### 3.2 Functional View
135179

136180
**Purpose**: Internal components, responsibilities, interactions

0 commit comments

Comments
 (0)