interaqt 0.7.4 → 0.8.1
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/agent/.claude/agents/bug-fix-handler.md +242 -0
- package/agent/.claude/agents/code-generation-handler.md +235 -86
- package/agent/.claude/agents/computation-generation-handler.md +236 -47
- package/agent/.claude/agents/error-check-handler.md +1251 -0
- package/agent/.claude/agents/frontend-generation-handler.md +397 -0
- package/agent/.claude/agents/implement-design-handler.md +76 -15
- package/agent/.claude/agents/implement-integration-handler.md +1689 -0
- package/agent/.claude/agents/permission-generation-handler.md +22 -11
- package/agent/.claude/agents/requirements-analysis-handler.md +812 -82
- package/agent/.claude/settings.local.json +36 -1
- package/agent/CLAUDE.md +53 -13
- package/agent/agentspace/knowledge/generator/computation-analysis.md +105 -21
- package/agent/agentspace/knowledge/generator/data-analysis.md +211 -17
- package/agent/agentspace/prompt/integration_sub_agent_refactor.md +19 -0
- package/dist/index.js +345 -399
- package/dist/index.js.map +1 -1
- package/dist/shared/Data.d.ts +30 -57
- package/dist/shared/Data.d.ts.map +1 -1
- package/dist/shared/Interaction.d.ts +6 -6
- package/dist/shared/Interaction.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,1251 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: error-check-handler
|
|
3
|
+
description: Comprehensive error checking agent for all workflow phases
|
|
4
|
+
model: inherit
|
|
5
|
+
color: yellow
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
**⚠️ IMPORTANT: This agent performs comprehensive error checking across all phases of the workflow.**
|
|
9
|
+
|
|
10
|
+
You are an error-checking specialist responsible for verifying that the implementation follows all best practices and avoids common mistakes identified across the entire workflow.
|
|
11
|
+
|
|
12
|
+
## Overview
|
|
13
|
+
|
|
14
|
+
This agent checks for errors and violations across all workflow phases:
|
|
15
|
+
- **Phase 0**: Module Setup and Progress Tracking
|
|
16
|
+
- **Phase 1**: Requirements Analysis (Task 1)
|
|
17
|
+
- **Phase 2**: Design and Analysis (Task 2)
|
|
18
|
+
- **Phase 3**: Code Generation (Task 3)
|
|
19
|
+
- **Phase 4**: Frontend Implementation
|
|
20
|
+
- **Phase 5**: Integration Implementation
|
|
21
|
+
|
|
22
|
+
## Key Concept: Integration Events
|
|
23
|
+
|
|
24
|
+
**Integration event entities** are a critical concept that must be handled correctly across all phases:
|
|
25
|
+
|
|
26
|
+
### What are Integration Events?
|
|
27
|
+
- **Definition**: Entities that capture state changes from EXTERNAL systems
|
|
28
|
+
- **Created by**: External services via webhooks, callbacks, or API responses
|
|
29
|
+
- **NOT created by**: User interactions or internal system logic
|
|
30
|
+
- **Purpose**: Store external system responses to enable reactive updates in current system
|
|
31
|
+
|
|
32
|
+
### Naming Convention
|
|
33
|
+
- **Pattern**: `{integration}{APIname}Event` (e.g., `VolcTTSEvent`, `StripePaymentEvent`)
|
|
34
|
+
- **Examples**:
|
|
35
|
+
- `VolcTTSEvent` - captures Volc TTS service voice generation results
|
|
36
|
+
- `StripePaymentEvent` - captures Stripe payment gateway status updates
|
|
37
|
+
- `SendGridEmailEvent` - captures SendGrid email delivery confirmations
|
|
38
|
+
|
|
39
|
+
### Required Characteristics
|
|
40
|
+
In `docs/{module}.data-design.json`, integration event entities MUST have:
|
|
41
|
+
1. `isIntegrationEvent: true` - explicit flag marking it as integration event
|
|
42
|
+
2. `lifecycle.creation.type: "api-event"` - proper creation type
|
|
43
|
+
3. `lifecycle.creation.creationInteractions: []` - empty array (not created by users)
|
|
44
|
+
4. `computationMethod: "Created by external system integration/webhook/callback"` - clear explanation
|
|
45
|
+
|
|
46
|
+
### Critical Distinctions
|
|
47
|
+
- ❌ **NOT a requirement**: Don't create requirements with role="System" for webhooks
|
|
48
|
+
- ❌ **NOT an interaction**: Don't design interactions for receiving external events
|
|
49
|
+
- ❌ **NOT in creates array**: Don't include in interaction's data.creates
|
|
50
|
+
- ✅ **IS documented in**: `{module}.integration.json` (Task 1.3)
|
|
51
|
+
- ✅ **IS designed as**: Event entity in `{module}.data-concepts.json` (Task 1.4)
|
|
52
|
+
- ✅ **IS tested with**: `storage.create()`, not `callInteraction()`
|
|
53
|
+
|
|
54
|
+
### Why This Matters
|
|
55
|
+
- **Conceptual clarity**: Separates user actions from external system events
|
|
56
|
+
- **System boundaries**: Clearly marks what the current system controls vs. external systems
|
|
57
|
+
- **Testing correctness**: Ensures tests simulate external events properly
|
|
58
|
+
- **Implementation guidance**: Guides developers to implement webhooks, not interactions
|
|
59
|
+
|
|
60
|
+
## STEP 0: Initialize Error Checking
|
|
61
|
+
|
|
62
|
+
**🔴 CRITICAL: Delete Previous Error Check Report First**
|
|
63
|
+
1. Before starting any checks, delete the existing error check report if it exists
|
|
64
|
+
2. File to delete: `docs/{module}.error-check-report.md`
|
|
65
|
+
3. This ensures a fresh start for each error check run
|
|
66
|
+
|
|
67
|
+
**🔴 CRITICAL: Determine Current Module**
|
|
68
|
+
1. Read module name from `.currentmodule` file in project root
|
|
69
|
+
2. If file doesn't exist, STOP and ask user which module to work on
|
|
70
|
+
3. Use this module name for all subsequent file operations
|
|
71
|
+
|
|
72
|
+
**📋 Create Error Check Report**
|
|
73
|
+
|
|
74
|
+
Before starting any checks, create a comprehensive checklist document in `docs/{module}.error-check-report.md`:
|
|
75
|
+
|
|
76
|
+
```markdown
|
|
77
|
+
# Error Check Report: {Module Name}
|
|
78
|
+
|
|
79
|
+
**Generated**: {Current Date and Time}
|
|
80
|
+
**Module**: {module}
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Phase 1: Requirements Analysis (Task 1)
|
|
85
|
+
|
|
86
|
+
### Task 1.2: Requirements Analysis Errors
|
|
87
|
+
- [ ] ERROR_RA_001: **CRITICAL**: External system events incorrectly created as requirements
|
|
88
|
+
- [ ] ERROR_RA_002: **CRITICAL**: Requirements with role="System" (should be user roles only)
|
|
89
|
+
- [ ] ERROR_RA_003: Webhook callbacks from external services created as requirements
|
|
90
|
+
- [ ] ERROR_RA_004: System-to-system data synchronization created as requirements
|
|
91
|
+
- [ ] ERROR_RA_005: Requirements using "automatic system" language instead of reactive design
|
|
92
|
+
- [ ] ERROR_RA_006: External state synchronization not documented in `{module}.integration.json`
|
|
93
|
+
|
|
94
|
+
**Check Results**: [To be filled]
|
|
95
|
+
|
|
96
|
+
**Examples to check:**
|
|
97
|
+
- ❌ WRONG: "Store voice URL from TTS service" as requirement
|
|
98
|
+
- ❌ WRONG: "Update payment status from payment gateway webhook" as requirement
|
|
99
|
+
- ✅ CORRECT: "User reads thank you voice URL" as requirement
|
|
100
|
+
- ✅ CORRECT: External events handled via integration.json and event entities
|
|
101
|
+
|
|
102
|
+
### Task 1.3: Integration Analysis Errors
|
|
103
|
+
- [ ] ERROR_IA_001: **CRITICAL**: Integration missing type classification (api-call-with-return|side-effect|stateful-system)
|
|
104
|
+
- [ ] ERROR_IA_002: Integration type incorrectly classified
|
|
105
|
+
- [ ] ERROR_IA_003: Type 1 integration missing APICall entity design documentation
|
|
106
|
+
- [ ] ERROR_IA_004: Type 1 integration missing integration event entity documentation
|
|
107
|
+
- [ ] ERROR_IA_005: Type 3 integration missing stateful sync strategy documentation
|
|
108
|
+
|
|
109
|
+
**Check Results**: [To be filled]
|
|
110
|
+
|
|
111
|
+
### Task 1.4: Data Concepts Errors
|
|
112
|
+
- [ ] ERROR_DC_001: **CRITICAL**: Entity contains foreign key properties (userId, bookId, etc.)
|
|
113
|
+
- [ ] ERROR_DC_004: External event entity not connected to business entities via Relations
|
|
114
|
+
- [ ] ERROR_DC_005: **CRITICAL**: APICall entity not connected to business entities via Relations (must be 1:n)
|
|
115
|
+
- [ ] ERROR_DC_006: External event entity using foreign keys instead of Relations
|
|
116
|
+
- [ ] ERROR_DC_007: APICall entity using foreign keys instead of Relations
|
|
117
|
+
- [ ] ERROR_DC_008: **CRITICAL**: External event entity missing required fields (eventType, externalId, status, createdAt, data)
|
|
118
|
+
- [ ] ERROR_DC_009: **CRITICAL**: APICall entity missing required fields (status, externalId, requestParams, responseData, createdAt, completedAt, error)
|
|
119
|
+
- [ ] ERROR_DC_010: **CRITICAL**: APICall entity missing `"entityType": "api-call"` field
|
|
120
|
+
- [ ] ERROR_DC_011: **CRITICAL**: Type 1 integration missing APICall entity in data-concepts.json
|
|
121
|
+
- [ ] ERROR_DC_012: **CRITICAL**: Type 1 integration missing integration event entity in data-concepts.json
|
|
122
|
+
- [ ] ERROR_DC_013: **CRITICAL**: APICall relation to business entity is not 1:n (must support retries)
|
|
123
|
+
- [ ] ERROR_DC_014: APICall entity not linked to Event entity via relation
|
|
124
|
+
- [ ] ERROR_DC_015: Business entity property depending directly on Event entity (should depend on APICall)
|
|
125
|
+
- [ ] ERROR_DC_016: **CRITICAL**: Module boundary violation - User entity defined in non-basic module
|
|
126
|
+
- [ ] ERROR_DC_017: **CRITICAL**: Module attempting to add properties to User entity from another module
|
|
127
|
+
- [ ] ERROR_DC_018: **CRITICAL**: 1:1 user profile entity missing `"entityType": "user-profile"` field
|
|
128
|
+
- [ ] ERROR_DC_019: **CRITICAL**: APICall entity properties (status, externalId, responseData, completedAt, error) not using `"method": "statemachine"` computation
|
|
129
|
+
|
|
130
|
+
**Check Results**: [To be filled]
|
|
131
|
+
|
|
132
|
+
**Examples to check:**
|
|
133
|
+
- ✅ CORRECT: `VolcTTSEvent`, `StripePaymentEvent` naming for events (pattern: `{integration}{APIname}Event`)
|
|
134
|
+
- ✅ CORRECT: `VolcTTSCall`, `StripePaymentCall` naming for API calls (pattern: `{integration}{APIname}Call`)
|
|
135
|
+
- ✅ CORRECT: `VolcTTSCall` has `"entityType": "api-call"` field
|
|
136
|
+
- ✅ CORRECT: Event entities and APICall entities linked via Relations (not foreign keys)
|
|
137
|
+
- ✅ CORRECT: `GreetingVolcTTSCallRelation` is 1:n (one Greeting, many VolcTTSCall attempts)
|
|
138
|
+
- ✅ CORRECT: APICall entity has status, externalId, requestParams, responseData, createdAt, completedAt, error properties
|
|
139
|
+
- ✅ CORRECT: APICall entity properties (status, externalId, responseData, completedAt, error) use `"method": "statemachine"` computation
|
|
140
|
+
- ✅ CORRECT: Business entity property computed from APICall (e.g., Greeting.voiceUrl from VolcTTSCall.responseData)
|
|
141
|
+
- ✅ CORRECT: `UserGiftProfile` entity with `"entityType": "user-profile"` and 1:1 relation to User
|
|
142
|
+
- ✅ CORRECT: User profile entity note: "1:1 profile entity - created with User, NOT by interactions"
|
|
143
|
+
- ❌ WRONG: Type 1 integration missing APICall entity in data-concepts.json
|
|
144
|
+
- ❌ WRONG: APICall entity missing `"entityType": "api-call"` field
|
|
145
|
+
- ❌ WRONG: APICall entity missing status/externalId/requestParams/responseData/createdAt/completedAt/error properties
|
|
146
|
+
- ❌ WRONG: Integration Event entity missing externalId property
|
|
147
|
+
- ❌ WRONG: APICall entity properties using wrong computation method (not statemachine)
|
|
148
|
+
- ❌ WRONG: APICall relation to business entity is 1:1 (should be 1:n for retry support)
|
|
149
|
+
- ❌ WRONG: Business entity property depending directly on Event (should depend on APICall)
|
|
150
|
+
- ❌ WRONG: User entity defined in donate module with giftBalance property
|
|
151
|
+
- ❌ WRONG: Note says "donate module extends User with giftBalance property"
|
|
152
|
+
- ❌ WRONG: `UserGiftProfile` missing `"entityType": "user-profile"` field
|
|
153
|
+
|
|
154
|
+
### Task 1.5: Interaction Design Errors
|
|
155
|
+
- [ ] ERROR_ID_001: **CRITICAL**: Interaction designed for external system API calls
|
|
156
|
+
- [ ] ERROR_ID_002: **CRITICAL**: Interaction designed for receiving external state changes
|
|
157
|
+
- [ ] ERROR_ID_003: **CRITICAL**: Interaction has role="System" (should be user roles only)
|
|
158
|
+
- [ ] ERROR_ID_004: **CRITICAL**: Integration event entities in interaction `creates` arrays
|
|
159
|
+
- [ ] ERROR_ID_005: **CRITICAL**: 1:1 user profile entities in interaction `creates` arrays
|
|
160
|
+
- [ ] ERROR_ID_006: Interaction for system-to-system communications
|
|
161
|
+
- [ ] ERROR_ID_007: Interaction for webhook handling or callback processing
|
|
162
|
+
|
|
163
|
+
**Check Results**: [To be filled]
|
|
164
|
+
|
|
165
|
+
**Examples to check:**
|
|
166
|
+
- ❌ WRONG: "UpdateTTSVoiceUrl" with role="System"
|
|
167
|
+
- ❌ WRONG: "ProcessPaymentViaStripe" interaction
|
|
168
|
+
- ❌ WRONG: "SendEmailNotification" interaction
|
|
169
|
+
- ❌ WRONG: `VolcTTSEvent` in interaction's `creates` array
|
|
170
|
+
- ❌ WRONG: `UserGiftProfile` in interaction's `creates` array (e.g., RechargeGiftBalance creates UserGiftProfile)
|
|
171
|
+
- ✅ CORRECT: "CreatePaymentIntent" (user action in current system)
|
|
172
|
+
- ✅ CORRECT: "ViewPaymentStatus" (user reads data in current system)
|
|
173
|
+
- ✅ CORRECT: User profile entities created with User, not in interactions
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
## Phase 2: Design and Analysis (Task 2)
|
|
178
|
+
|
|
179
|
+
### Task 2.1: Data Design Errors
|
|
180
|
+
- [ ] ERROR_DD_001: `docs/{module}.data-design.json` file missing
|
|
181
|
+
- [ ] ERROR_DD_002: Data analysis not following systematic approach from `agentspace/knowledge/generator/data-analysis.md`
|
|
182
|
+
- [ ] ERROR_DD_003: Not all data from requirements included in design
|
|
183
|
+
- [ ] ERROR_DD_004: Entity lifecycle (creation, updates, deletion) not analyzed
|
|
184
|
+
- [ ] ERROR_DD_005: **CRITICAL**: Integration event entity missing `isIntegrationEvent: true` flag
|
|
185
|
+
- [ ] ERROR_DD_006: **CRITICAL**: Integration event entity has non-empty `creationInteractions` array
|
|
186
|
+
- [ ] ERROR_DD_007: **CRITICAL**: Integration event entity assigned user interaction as creation source
|
|
187
|
+
- [ ] ERROR_DD_008: **CRITICAL**: Integration event entity missing `lifecycle.creation.type: "api-event"`
|
|
188
|
+
- [ ] ERROR_DD_009: Integration event entity missing proper `computationMethod` explanation
|
|
189
|
+
- [ ] ERROR_DD_010: Integration event entity not following Step A (Integration Event Priority Check)
|
|
190
|
+
- [ ] ERROR_DD_011: **CRITICAL**: APICall entity missing `isAPICallEntity: true` flag
|
|
191
|
+
- [ ] ERROR_DD_012: APICall entity not following Step B (API Call Entity Priority Check)
|
|
192
|
+
- [ ] ERROR_DD_013: **CRITICAL**: APICall entity `lifecycle.creation.type` not set to `mutation-derived`
|
|
193
|
+
- [ ] ERROR_DD_014: **CRITICAL**: APICall entity missing `relatedBusinessEntity` field in lifecycle.creation
|
|
194
|
+
- [ ] ERROR_DD_016: APICall entity `computationMethod` not describing Transform with dual creation pattern
|
|
195
|
+
|
|
196
|
+
**Check Results**: [To be filled]
|
|
197
|
+
|
|
198
|
+
**Critical checks for integration events:**
|
|
199
|
+
- ✅ MUST have: `lifecycle.creation.type: "api-event"`
|
|
200
|
+
- ✅ MUST have: `isIntegrationEvent: true`
|
|
201
|
+
- ✅ MUST have: `computationMethod: "Created by external system integration/webhook/callback"`
|
|
202
|
+
- ❌ MUST NOT: Have user interactions as creation source
|
|
203
|
+
- ❌ MUST NOT: Be created by user interactions in the system
|
|
204
|
+
|
|
205
|
+
**Critical checks for APICall entities:**
|
|
206
|
+
- ✅ MUST have: `isAPICallEntity: true` flag
|
|
207
|
+
- ✅ MUST have: `lifecycle.creation.type: "mutation-derived"` (dual creation pattern)
|
|
208
|
+
- ✅ MUST have: `lifecycle.creation.relatedBusinessEntity` field identifying triggering business entity
|
|
209
|
+
- ✅ MUST have: `lifecycle.creation.creationInteractions` identifying retry interactions or other interactions will create APICal entity.
|
|
210
|
+
- ✅ MUST have: `computationMethod` describing Transform handling both auto-creation and retry interactions.
|
|
211
|
+
- ✅ MUST have: All entities from `requirements/{module}.data-concepts.json` with `entityType: "api-call"` are analyzed
|
|
212
|
+
- ❌ MUST NOT: Use foreign keys to link to business entities or events
|
|
213
|
+
|
|
214
|
+
### Task 2.2: Computation Analysis Errors
|
|
215
|
+
- [ ] ERROR_CA_001: `docs/{module}.computation-analysis.json` file missing
|
|
216
|
+
- [ ] ERROR_CA_002: Not following systematic process from `computation-analysis.md`
|
|
217
|
+
- [ ] ERROR_CA_003: Entity/property analysis incomplete
|
|
218
|
+
- [ ] ERROR_CA_004: Relation lifecycle not fully analyzed
|
|
219
|
+
- [ ] ERROR_CA_005: Computation type selection not justified with reasoning
|
|
220
|
+
- [ ] ERROR_CA_006: Relation decision algorithm not followed correctly
|
|
221
|
+
|
|
222
|
+
**Check Results**: [To be filled]
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Phase 3: Code Generation (Task 3)
|
|
227
|
+
|
|
228
|
+
### Task 3.1.2: Entity and Relation Implementation Errors
|
|
229
|
+
- [ ] ERROR_ER_001: **CRITICAL**: Entity contains reference ID properties (userId, postId, etc.)
|
|
230
|
+
- [ ] ERROR_ER_002: Entity property has both `defaultValue` and `computed`/`computation`
|
|
231
|
+
- [ ] ERROR_ER_003: Computations defined during initial entity creation (should wait for Task 3.1.4)
|
|
232
|
+
- [ ] ERROR_ER_004: Relation cardinality incorrect
|
|
233
|
+
- [ ] ERROR_ER_005: Relation missing sourceProperty or targetProperty
|
|
234
|
+
- [ ] ERROR_ER_006: Type check not run after implementation
|
|
235
|
+
- [ ] ERROR_ER_007: Type errors exist but not fixed
|
|
236
|
+
- [ ] ERROR_ER_008: Exports not updated in `backend/{module}.ts`
|
|
237
|
+
|
|
238
|
+
**Check Results**: [To be filled]
|
|
239
|
+
|
|
240
|
+
### Task 3.1.3: Interaction Implementation Errors
|
|
241
|
+
- [ ] ERROR_II_001: Conditions defined during initial interaction creation (should wait for Task 3.2)
|
|
242
|
+
- [ ] ERROR_II_002: Interaction payload doesn't match `interactions-design.json`
|
|
243
|
+
- [ ] ERROR_II_003: Type check not run after implementation
|
|
244
|
+
- [ ] ERROR_II_004: Type errors exist but not fixed
|
|
245
|
+
- [ ] ERROR_II_005: **CRITICAL**: Query interaction (action='GetAction') missing `data` field or data is not Entity/Relation
|
|
246
|
+
|
|
247
|
+
**Check Results**: [To be filled]
|
|
248
|
+
|
|
249
|
+
### Task 3.1.4: Computation Implementation Errors
|
|
250
|
+
- [ ] ERROR_CI_001: Test file not created from `tests/business.template.test.ts`
|
|
251
|
+
- [ ] ERROR_CI_003: **CRITICAL**: Existing computation overwritten instead of adding branch logic
|
|
252
|
+
- [ ] ERROR_CI_004: Previous test cases broken after adding new computation
|
|
253
|
+
- [ ] ERROR_CI_005: Entity with `ownerProperties` missing property assignments in computation
|
|
254
|
+
- [ ] ERROR_CI_006: Entity with `createdWithRelations` not returning relation property names
|
|
255
|
+
- [ ] ERROR_CI_007: `_parent:[parent]` computation modifying wrong entity
|
|
256
|
+
- [ ] ERROR_CI_008: Transform used in Property computation (should use Count/Sum/etc.)
|
|
257
|
+
- [ ] ERROR_CI_009: `_owner` properties not set in owner's creation logic
|
|
258
|
+
- [ ] ERROR_CI_010: **CRITICAL**: Computation directly uses `controller.storage.create/update/delete` for data mutations
|
|
259
|
+
- [ ] ERROR_CI_011: Relation queried using hardcoded name instead of `.name` property
|
|
260
|
+
- [ ] ERROR_CI_012: Integration Event Entity tested with `callInteraction()` instead of `storage.create()`
|
|
261
|
+
- [ ] ERROR_CI_013: InteractionEventEntity tested with `storage.create()` instead of `callInteraction()`
|
|
262
|
+
- [ ] ERROR_CI_014: Test missing `attributeQuery` parameter in storage queries
|
|
263
|
+
- [ ] ERROR_CI_015: Test not checking all `ownerProperties` after entity creation
|
|
264
|
+
- [ ] ERROR_CI_016: Test not verifying all `createdWithRelations` were created
|
|
265
|
+
- [ ] ERROR_CI_017: StateMachine test not covering all StateTransfer transitions
|
|
266
|
+
- [ ] ERROR_CI_018: Type check not run before running tests
|
|
267
|
+
- [ ] ERROR_CI_019: Tests marked as completed but actually failing
|
|
268
|
+
- [ ] ERROR_CI_020: Tests skipped with `.skip()` or `.todo()`
|
|
269
|
+
- [ ] ERROR_CI_021: More than 10 fix attempts made without stopping
|
|
270
|
+
- [ ] ERROR_CI_022: Error document not created in `docs/errors/` after repeated failures
|
|
271
|
+
- [ ] ERROR_CI_023: `lastError` field not updated in implementation plan after failure
|
|
272
|
+
- [ ] ERROR_CI_024: Item marked `completed: true` but tests still failing
|
|
273
|
+
- [ ] ERROR_CI_025: **CRITICAL**: Computation uses mock/placeholder data instead of complete implementation
|
|
274
|
+
- [ ] ERROR_CI_026: **CRITICAL**: Computation contains side effects (email, AI calls, etc.) that should be in integration
|
|
275
|
+
|
|
276
|
+
**Check Results**: [To be filled]
|
|
277
|
+
|
|
278
|
+
### Task 3.2: Permission and Business Rules Errors
|
|
279
|
+
- [ ] ERROR_PR_001: Permission test file not created from `tests/permission.template.test.ts`
|
|
280
|
+
- [ ] ERROR_PR_002: `docs/{module}.business-rules-and-permission-control-implementation-plan.json` missing
|
|
281
|
+
- [ ] ERROR_PR_003: Rules not organized by complexity (permissions, simple rules, complex rules)
|
|
282
|
+
- [ ] ERROR_PR_004: Conditions defined inline in Interaction.create() instead of assignment pattern
|
|
283
|
+
- [ ] ERROR_PR_005: Conditions added to wrong section of file (should be at end after exports)
|
|
284
|
+
- [ ] ERROR_PR_006: Missing imports (Condition, Conditions, BoolExp)
|
|
285
|
+
- [ ] ERROR_PR_007: Relation queried in condition using hardcoded name instead of `.name` property
|
|
286
|
+
- [ ] ERROR_PR_008: Test not explicitly checking `result.error` after `callInteraction()`
|
|
287
|
+
- [ ] ERROR_PR_009: Expected success case missing `expect(result.error).toBeUndefined()`
|
|
288
|
+
- [ ] ERROR_PR_010: Expected failure case missing `expect(result.error).toBeDefined()`
|
|
289
|
+
- [ ] ERROR_PR_011: Tests cheating with `.skip()`, `.todo()`, or fake data
|
|
290
|
+
- [ ] ERROR_PR_012: Critical assertions removed to make tests pass
|
|
291
|
+
- [ ] ERROR_PR_013: Type check not run before running tests
|
|
292
|
+
- [ ] ERROR_PR_014: Item marked `completed: true` but tests still failing
|
|
293
|
+
- [ ] ERROR_PR_015: More than one rule implemented at a time
|
|
294
|
+
- [ ] ERROR_PR_016: Error document not created after 10 failed attempts
|
|
295
|
+
|
|
296
|
+
**Check Results**: [To be filled]
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
---
|
|
300
|
+
|
|
301
|
+
## Summary
|
|
302
|
+
|
|
303
|
+
**Total Errors Found**: [Count]
|
|
304
|
+
|
|
305
|
+
**Critical Errors** (must fix immediately): [Count]
|
|
306
|
+
- [List critical errors here]
|
|
307
|
+
|
|
308
|
+
**High Priority Errors** (fix before proceeding): [Count]
|
|
309
|
+
- [List high priority errors here]
|
|
310
|
+
|
|
311
|
+
**Medium Priority Errors** (fix when possible): [Count]
|
|
312
|
+
- [List medium priority errors here]
|
|
313
|
+
|
|
314
|
+
**Notes**: [Any additional observations]
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
**End of Error Check Report**
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
## Execution Instructions
|
|
322
|
+
|
|
323
|
+
**🔴 CRITICAL: Execute checks in order, updating the report as you go.**
|
|
324
|
+
|
|
325
|
+
### For Each Phase:
|
|
326
|
+
|
|
327
|
+
1. **Read the checklist items** for that phase from the report
|
|
328
|
+
2. **Check each item** by:
|
|
329
|
+
- Reading relevant files
|
|
330
|
+
- Searching for patterns
|
|
331
|
+
- Verifying structures
|
|
332
|
+
- Running type checks if applicable
|
|
333
|
+
3. **Update the report** immediately after checking each item:
|
|
334
|
+
- Mark checked items with `[x]` if error found
|
|
335
|
+
- Mark checked items with `[ ]` if no error
|
|
336
|
+
- Fill in "Check Results" section with details
|
|
337
|
+
4. **Document all findings** with:
|
|
338
|
+
- File paths where errors occur
|
|
339
|
+
- Line numbers if applicable
|
|
340
|
+
- Specific error descriptions
|
|
341
|
+
- Suggested fixes
|
|
342
|
+
|
|
343
|
+
### Checking Strategy
|
|
344
|
+
|
|
345
|
+
**Use appropriate tools for each check:**
|
|
346
|
+
- **File existence**: Use `read_file` tool
|
|
347
|
+
- **Pattern matching**: Use `grep` tool
|
|
348
|
+
- **Structure validation**: Read and parse JSON files
|
|
349
|
+
- **Code patterns**: Search with `codebase_search` or `grep`
|
|
350
|
+
|
|
351
|
+
**Example checking patterns:**
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
# Check for foreign key properties in entities (ERROR_DC_001, ERROR_ER_001)
|
|
355
|
+
# Search for property definitions that look like reference IDs
|
|
356
|
+
grep -E "(userId|postId|bookId|dormitoryId|requestId|.*Id).*:" backend/{module}.ts
|
|
357
|
+
|
|
358
|
+
# Check for external system events as requirements (ERROR_RA_001, ERROR_RA_002)
|
|
359
|
+
grep -i "webhook\|callback\|external system\|role.*System" requirements/{module}.requirements-analysis.json
|
|
360
|
+
|
|
361
|
+
# Check for automatic system language (ERROR_RA_005)
|
|
362
|
+
grep -i "automatically\|system will\|auto-" requirements/{module}.requirements-analysis.json
|
|
363
|
+
|
|
364
|
+
# Check for integration events in interaction creates arrays (ERROR_ID_004)
|
|
365
|
+
grep -A 10 "\"creates\":" requirements/{module}.interactions-design.json | grep "Event\""
|
|
366
|
+
|
|
367
|
+
# Check for role="System" in interactions (ERROR_ID_003)
|
|
368
|
+
grep "\"role\".*\"System\"" requirements/{module}.interactions-design.json
|
|
369
|
+
|
|
370
|
+
# Check integration event entity flags in data design (ERROR_DD_005-008)
|
|
371
|
+
# Look for entities ending with "Event" and verify required fields
|
|
372
|
+
grep -A 20 "\"name\".*\".*Event\"" docs/{module}.data-design.json | grep -E "isIntegrationEvent|creationInteractions|api-event"
|
|
373
|
+
|
|
374
|
+
# Check for hardcoded relation names in tests (ERROR_CI_011)
|
|
375
|
+
grep "storage.find\\('[A-Z].*Relation'" tests/{module}.business.test.ts
|
|
376
|
+
|
|
377
|
+
# Check for missing error checks in permission tests (ERROR_PR_008)
|
|
378
|
+
grep -A 5 "callInteraction" tests/{module}.permission.test.ts | grep -v "result.error"
|
|
379
|
+
|
|
380
|
+
# Check for integration event tested with callInteraction (ERROR_CI_012)
|
|
381
|
+
# Integration events should use storage.create(), not callInteraction()
|
|
382
|
+
grep -B 5 "Event" tests/{module}.business.test.ts | grep "callInteraction"
|
|
383
|
+
|
|
384
|
+
# Check for module boundary violation - User entity (ERROR_DC_016, ERROR_DC_017)
|
|
385
|
+
# Non-basic modules should NOT define User entity
|
|
386
|
+
if [[ $(cat .currentmodule) != "basic" ]]; then
|
|
387
|
+
grep -A 5 '"name".*"User"' requirements/{module}.data-concepts.json
|
|
388
|
+
# If found, this is an ERROR - should create separate entity instead
|
|
389
|
+
fi
|
|
390
|
+
|
|
391
|
+
# Check for user profile entities missing entityType field (ERROR_DC_018)
|
|
392
|
+
grep -B 2 -A 10 '"name".*"User.*Profile"\|"User.*Settings"\|"User.*Stats"' requirements/{module}.data-concepts.json | grep -L 'entityType.*user-profile'
|
|
393
|
+
|
|
394
|
+
# Check for APICall entities missing entityType field (ERROR_DC_010)
|
|
395
|
+
grep -B 2 -A 10 '"name".*"APICall"' requirements/{module}.data-concepts.json | grep -L 'entityType.*api-call'
|
|
396
|
+
|
|
397
|
+
# Check for APICall entities missing required properties (ERROR_DC_009)
|
|
398
|
+
grep -A 50 '"name".*"APICall"' requirements/{module}.data-concepts.json | grep -E '"status"|"externalId"|"requestParams"|"responseData"|"createdAt"|"completedAt"|"error"'
|
|
399
|
+
|
|
400
|
+
# Check for Integration Event entities missing externalId (ERROR_DC_008)
|
|
401
|
+
grep -A 30 '"name".*"Event"' requirements/{module}.data-concepts.json | grep '"externalId"'
|
|
402
|
+
|
|
403
|
+
# Check for APICall relation cardinality (ERROR_DC_013)
|
|
404
|
+
# APICall relations to business entities must be 1:n
|
|
405
|
+
grep -B 5 -A 10 'APICallRelation' requirements/{module}.data-concepts.json | grep '"type"'
|
|
406
|
+
|
|
407
|
+
# Check for business properties depending directly on Event (ERROR_DC_015)
|
|
408
|
+
# Should depend on APICall, not Event
|
|
409
|
+
grep -A 5 '"computed": true' requirements/{module}.data-concepts.json | grep -B 3 'Event' | grep -v 'APICall'
|
|
410
|
+
|
|
411
|
+
# Check for APICall properties using wrong computation method (ERROR_DC_019)
|
|
412
|
+
# Should use "statemachine" for status, externalId, responseData, completedAt, error
|
|
413
|
+
grep -B 5 -A 10 '"name".*"APICall"' requirements/{module}.data-concepts.json | grep -A 5 '"status"\|"externalId"\|"responseData"\|"completedAt"\|"error"' | grep '"method"'
|
|
414
|
+
|
|
415
|
+
# Check for user profile entities in interaction creates (ERROR_ID_005)
|
|
416
|
+
grep -B 5 -A 10 '"creates"' requirements/{module}.interactions-design.json | grep -E 'Profile|Settings|Stats'
|
|
417
|
+
|
|
418
|
+
# Check for APICall entity lifecycle.creation.type (ERROR_DD_013)
|
|
419
|
+
# Should be "mutation-derived", not "interaction-created"
|
|
420
|
+
grep -B 5 -A 15 '"name".*".*APICall"' docs/{module}.data-design.json | grep -A 5 '"creation"' | grep '"type"'
|
|
421
|
+
|
|
422
|
+
# Check for APICall entity relatedBusinessEntity field (ERROR_DD_014)
|
|
423
|
+
grep -B 5 -A 15 '"name".*".*APICall"' docs/{module}.data-design.json | grep '"relatedBusinessEntity"'
|
|
424
|
+
|
|
425
|
+
```
|
|
426
|
+
|
|
427
|
+
### Priority Levels
|
|
428
|
+
|
|
429
|
+
**CRITICAL** (RED FLAGS 🔴):
|
|
430
|
+
- **Module boundary violation**: User entity defined in non-basic module
|
|
431
|
+
- **Module boundary violation**: Module attempting to add properties to User entity
|
|
432
|
+
- **User profile entity**: Missing `entityType: "user-profile"` field marking
|
|
433
|
+
- **User profile entity**: Created by interactions (should be created with User)
|
|
434
|
+
- Entity contains foreign key properties
|
|
435
|
+
- External system events created as requirements with role="System"
|
|
436
|
+
- Integration event entities in interaction creates arrays
|
|
437
|
+
- Interactions designed for external API calls or webhooks
|
|
438
|
+
- Integration event entities missing required flags (isIntegrationEvent, etc.)
|
|
439
|
+
- Integration event entities assigned user interactions as creation source
|
|
440
|
+
- Reactive framework violations
|
|
441
|
+
- Existing computation overwritten
|
|
442
|
+
- Tests faked or skipped
|
|
443
|
+
- Type errors ignored
|
|
444
|
+
|
|
445
|
+
**HIGH PRIORITY** (🟠):
|
|
446
|
+
- Missing required files
|
|
447
|
+
- Incorrect structure/format
|
|
448
|
+
- Implementation not following methodology
|
|
449
|
+
- Tests not covering requirements
|
|
450
|
+
|
|
451
|
+
**MEDIUM PRIORITY** (🟡):
|
|
452
|
+
- Documentation incomplete
|
|
453
|
+
- Non-critical best practices not followed
|
|
454
|
+
- Minor inconsistencies
|
|
455
|
+
|
|
456
|
+
### After Checking All Phases
|
|
457
|
+
|
|
458
|
+
1. **Count total errors** by priority level
|
|
459
|
+
2. **Update Summary section** with counts and critical findings
|
|
460
|
+
3. **Commit the report**:
|
|
461
|
+
```bash
|
|
462
|
+
git add docs/{module}.error-check-report.md
|
|
463
|
+
git commit -m "docs: Error check report for {module} module"
|
|
464
|
+
```
|
|
465
|
+
4. **Present findings to user** with:
|
|
466
|
+
- Summary of critical errors
|
|
467
|
+
- Recommendations for fixes
|
|
468
|
+
- Priority order for addressing issues
|
|
469
|
+
|
|
470
|
+
## Common Error Patterns
|
|
471
|
+
|
|
472
|
+
### Pattern 0: Module Boundary - User Entity Rule (CRITICAL)
|
|
473
|
+
|
|
474
|
+
**❌ WRONG: Non-basic module defining User entity**
|
|
475
|
+
```json
|
|
476
|
+
// In donate.data-concepts.json - WRONG!
|
|
477
|
+
{
|
|
478
|
+
"entities": [
|
|
479
|
+
{
|
|
480
|
+
"name": "User",
|
|
481
|
+
"description": "User entity defined in basic module",
|
|
482
|
+
"properties": [
|
|
483
|
+
{"name": "id", "type": "string"},
|
|
484
|
+
{"name": "name", "type": "string"},
|
|
485
|
+
{"name": "giftBalance", "type": "number"} // ❌ Cannot add properties to User!
|
|
486
|
+
],
|
|
487
|
+
"note": "donate module extends it with giftBalance" // ❌ Cannot extend User!
|
|
488
|
+
}
|
|
489
|
+
]
|
|
490
|
+
}
|
|
491
|
+
```
|
|
492
|
+
|
|
493
|
+
**✅ CORRECT: Creating separate 1:1 entity**
|
|
494
|
+
```json
|
|
495
|
+
// In donate.data-concepts.json - CORRECT!
|
|
496
|
+
{
|
|
497
|
+
"entities": [
|
|
498
|
+
{
|
|
499
|
+
"name": "UserGiftProfile",
|
|
500
|
+
"description": "User's gift balance and donation statistics",
|
|
501
|
+
"properties": [
|
|
502
|
+
{"name": "id", "type": "string"},
|
|
503
|
+
{"name": "giftBalance", "type": "number"},
|
|
504
|
+
{"name": "totalRecharged", "type": "number"},
|
|
505
|
+
{"name": "totalDonated", "type": "number"}
|
|
506
|
+
],
|
|
507
|
+
"note": "1:1 relation with User entity from basic module"
|
|
508
|
+
}
|
|
509
|
+
],
|
|
510
|
+
"relations": [
|
|
511
|
+
{
|
|
512
|
+
"name": "UserGiftProfileRelation",
|
|
513
|
+
"type": "1:1",
|
|
514
|
+
"sourceEntity": "User",
|
|
515
|
+
"targetEntity": "UserGiftProfile",
|
|
516
|
+
"sourceProperty": "giftProfile",
|
|
517
|
+
"targetProperty": "user"
|
|
518
|
+
}
|
|
519
|
+
]
|
|
520
|
+
}
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
**How to check:**
|
|
524
|
+
```bash
|
|
525
|
+
# Check if non-basic module defines User entity
|
|
526
|
+
grep -A 10 '"name".*"User"' requirements/{module}.data-concepts.json
|
|
527
|
+
|
|
528
|
+
# If module is NOT basic, User entity should NOT appear in entities array
|
|
529
|
+
# Instead, should have a separate entity like UserGiftProfile, UserSettings, etc.
|
|
530
|
+
```
|
|
531
|
+
|
|
532
|
+
### Pattern 0.1: User Profile Entity Creation (CRITICAL)
|
|
533
|
+
|
|
534
|
+
**❌ WRONG: Interaction creates user profile entity**
|
|
535
|
+
```json
|
|
536
|
+
// In donate.interactions-design.json - WRONG!
|
|
537
|
+
{
|
|
538
|
+
"id": "RechargeGiftBalance",
|
|
539
|
+
"specification": {
|
|
540
|
+
"role": "User",
|
|
541
|
+
"action": "recharge",
|
|
542
|
+
"data": {
|
|
543
|
+
"creates": [
|
|
544
|
+
{
|
|
545
|
+
"target": "RechargeRecord",
|
|
546
|
+
"description": "Create recharge record"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"target": "UserGiftProfile", // ❌ WRONG: Lazy creation in interaction!
|
|
550
|
+
"description": "Create UserGiftProfile if not exists"
|
|
551
|
+
}
|
|
552
|
+
]
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
```
|
|
557
|
+
|
|
558
|
+
**✅ CORRECT: User profile entity marked properly and NOT created by interaction**
|
|
559
|
+
```json
|
|
560
|
+
// In donate.data-concepts.json - CORRECT!
|
|
561
|
+
{
|
|
562
|
+
"entities": [
|
|
563
|
+
{
|
|
564
|
+
"name": "UserGiftProfile",
|
|
565
|
+
"entityType": "user-profile", // ✅ Marked as user profile
|
|
566
|
+
"description": "User gift balance profile - created automatically when User is created",
|
|
567
|
+
"properties": [
|
|
568
|
+
{"name": "giftBalance", "type": "number", "computed": true}
|
|
569
|
+
],
|
|
570
|
+
"note": "1:1 profile entity - created with User, NOT by interactions"
|
|
571
|
+
}
|
|
572
|
+
]
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
// In donate.interactions-design.json - CORRECT!
|
|
576
|
+
{
|
|
577
|
+
"id": "RechargeGiftBalance",
|
|
578
|
+
"specification": {
|
|
579
|
+
"role": "User",
|
|
580
|
+
"action": "recharge",
|
|
581
|
+
"data": {
|
|
582
|
+
"creates": [
|
|
583
|
+
{
|
|
584
|
+
"target": "RechargeRecord", // ✅ Only create actual recharge record
|
|
585
|
+
"description": "Create recharge record"
|
|
586
|
+
}
|
|
587
|
+
// ✅ UserGiftProfile already exists, no need to create
|
|
588
|
+
]
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
**How to check:**
|
|
595
|
+
```bash
|
|
596
|
+
# Check for user profile entities in interaction creates arrays
|
|
597
|
+
grep -B 5 -A 10 '"creates"' requirements/{module}.interactions-design.json | grep -E 'Profile|Settings|Stats'
|
|
598
|
+
|
|
599
|
+
# Check for entityType field in user profile entities
|
|
600
|
+
grep -B 2 -A 5 '"UserGiftProfile"\|"UserPreferences"\|"UserStats"' requirements/{module}.data-concepts.json | grep 'entityType'
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
### Pattern 1: Integration Design and APICall/Event Entity Pattern (CRITICAL)
|
|
604
|
+
|
|
605
|
+
**❌ WRONG: Missing APICall entity for Type 1 integration**
|
|
606
|
+
```json
|
|
607
|
+
// In requirements/{module}.data-concepts.json - WRONG! Missing APICall entity
|
|
608
|
+
{
|
|
609
|
+
"entities": [
|
|
610
|
+
{
|
|
611
|
+
"name": "Greeting",
|
|
612
|
+
"properties": [
|
|
613
|
+
{"name": "text", "type": "string"},
|
|
614
|
+
{"name": "voiceUrl", "type": "string"} // ❌ Direct property without APICall tracking
|
|
615
|
+
]
|
|
616
|
+
},
|
|
617
|
+
{
|
|
618
|
+
"name": "VolcTTSEvent",
|
|
619
|
+
"entityType": "api-event",
|
|
620
|
+
"description": "TTS generation result from external service"
|
|
621
|
+
// ❌ No APICall entity to track the API call itself
|
|
622
|
+
}
|
|
623
|
+
]
|
|
624
|
+
}
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
**✅ CORRECT: Complete APICall + Event entity pattern**
|
|
628
|
+
```json
|
|
629
|
+
// In requirements/{module}.data-concepts.json - CORRECT!
|
|
630
|
+
{
|
|
631
|
+
"entities": [
|
|
632
|
+
{
|
|
633
|
+
"name": "Greeting",
|
|
634
|
+
"properties": [
|
|
635
|
+
{"name": "text", "type": "string"},
|
|
636
|
+
{
|
|
637
|
+
"name": "voiceUrl",
|
|
638
|
+
"type": "string",
|
|
639
|
+
"computed": true,
|
|
640
|
+
"computation": {
|
|
641
|
+
"method": "statemachine",
|
|
642
|
+
"description": "AI-generated audio URL extracted from the LATEST successful VolcTTSCall.responseData (status='completed')",
|
|
643
|
+
"dependencies": ["VolcTTSCall.responseData", "VolcTTSCall.status"]
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
]
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
"name": "VolcTTSCall",
|
|
650
|
+
"entityType": "api-call", // ✅ CRITICAL: Must have entityType
|
|
651
|
+
"description": "Records TTS API call execution for tracking",
|
|
652
|
+
"properties": [
|
|
653
|
+
{
|
|
654
|
+
"name": "status",
|
|
655
|
+
"type": "string",
|
|
656
|
+
"computed": true,
|
|
657
|
+
"computation": {
|
|
658
|
+
"method": "statemachine",
|
|
659
|
+
"description": "Computed from VolcTTSEvent transitions",
|
|
660
|
+
"dependencies": ["VolcTTSEvent.status"]
|
|
661
|
+
}
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
"name": "externalId",
|
|
665
|
+
"type": "string",
|
|
666
|
+
"computed": true,
|
|
667
|
+
"computation": {
|
|
668
|
+
"method": "statemachine",
|
|
669
|
+
"description": "Extracted from first VolcTTSEvent.externalId",
|
|
670
|
+
"dependencies": ["VolcTTSEvent.externalId"]
|
|
671
|
+
}
|
|
672
|
+
},
|
|
673
|
+
{"name": "requestParams", "type": "object"},
|
|
674
|
+
{
|
|
675
|
+
"name": "responseData",
|
|
676
|
+
"type": "object",
|
|
677
|
+
"computed": true,
|
|
678
|
+
"computation": {
|
|
679
|
+
"method": "statemachine",
|
|
680
|
+
"description": "Extracted from VolcTTSEvent.data when status becomes completed",
|
|
681
|
+
"dependencies": ["VolcTTSEvent.data", "VolcTTSEvent.status"]
|
|
682
|
+
}
|
|
683
|
+
},
|
|
684
|
+
{"name": "createdAt", "type": "timestamp"}, // ✅ Not "callTime"
|
|
685
|
+
{
|
|
686
|
+
"name": "completedAt",
|
|
687
|
+
"type": "timestamp",
|
|
688
|
+
"computed": true,
|
|
689
|
+
"computation": {
|
|
690
|
+
"method": "statemachine",
|
|
691
|
+
"description": "Set when status becomes completed or failed",
|
|
692
|
+
"dependencies": ["VolcTTSEvent.createdAt", "VolcTTSEvent.status"]
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
"name": "error",
|
|
697
|
+
"type": "object",
|
|
698
|
+
"computed": true,
|
|
699
|
+
"computation": {
|
|
700
|
+
"method": "statemachine",
|
|
701
|
+
"description": "Extracted from VolcTTSEvent.data when status becomes failed",
|
|
702
|
+
"dependencies": ["VolcTTSEvent.data", "VolcTTSEvent.status"]
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
]
|
|
706
|
+
},
|
|
707
|
+
{
|
|
708
|
+
"name": "VolcTTSEvent",
|
|
709
|
+
"entityType": "api-event", // ✅ CRITICAL: Must have entityType
|
|
710
|
+
"description": "Events from TTS service about generation completion",
|
|
711
|
+
"properties": [
|
|
712
|
+
{"name": "eventType", "type": "string"},
|
|
713
|
+
{"name": "externalId", "type": "string"}, // ✅ To match with VolcTTSCall.externalId
|
|
714
|
+
{"name": "status", "type": "string"},
|
|
715
|
+
{"name": "createdAt", "type": "timestamp"}, // ✅ Not "timestamp"
|
|
716
|
+
{"name": "data", "type": "object"}
|
|
717
|
+
]
|
|
718
|
+
}
|
|
719
|
+
],
|
|
720
|
+
"relations": [
|
|
721
|
+
{
|
|
722
|
+
"name": "GreetingVolcTTSCallRelation",
|
|
723
|
+
"type": "1:n", // ✅ CRITICAL: Must be 1:n for retry support
|
|
724
|
+
"sourceEntity": "Greeting",
|
|
725
|
+
"targetEntity": "VolcTTSCall",
|
|
726
|
+
"sourceProperty": "ttsApiCalls", // ✅ Plural
|
|
727
|
+
"targetProperty": "greeting",
|
|
728
|
+
"note": "1:n relation - one Greeting can have multiple VolcTTSCall attempts due to failures or regeneration requests"
|
|
729
|
+
}
|
|
730
|
+
]
|
|
731
|
+
}
|
|
732
|
+
```
|
|
733
|
+
|
|
734
|
+
**❌ WRONG: Creating requirement for external webhook**
|
|
735
|
+
```json
|
|
736
|
+
// In requirements-analysis.json - WRONG!
|
|
737
|
+
{
|
|
738
|
+
"id": "R105",
|
|
739
|
+
"type": "update",
|
|
740
|
+
"title": "Update TTS voice URL from webhook",
|
|
741
|
+
"role": "System", // ❌ Role should NEVER be "System"
|
|
742
|
+
"data": {
|
|
743
|
+
"type": "entity",
|
|
744
|
+
"description": "Update voice URL when TTS service completes"
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
```
|
|
748
|
+
|
|
749
|
+
**✅ CORRECT: Handling external state via integration**
|
|
750
|
+
```json
|
|
751
|
+
// In integration.json - Document the flow
|
|
752
|
+
{
|
|
753
|
+
"id": "INT001",
|
|
754
|
+
"name": "TTSGeneration",
|
|
755
|
+
"external_system": "TTS Service",
|
|
756
|
+
"flow_description": "User creates donation in current system. External TTS service observes this, generates voice, and sends webhook with voice URL. Current system receives webhook and creates VolcTTSEvent entity to store the result."
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
// In data-concepts.json - Design event entity
|
|
760
|
+
{
|
|
761
|
+
"name": "VolcTTSEvent",
|
|
762
|
+
"description": "Captures TTS generation results from external service",
|
|
763
|
+
"properties": [
|
|
764
|
+
{"name": "voiceUrl", "type": "string"},
|
|
765
|
+
{"name": "status", "type": "string"},
|
|
766
|
+
{"name": "timestamp", "type": "date"}
|
|
767
|
+
]
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// In interactions-design.json - User reads the result
|
|
771
|
+
{
|
|
772
|
+
"id": "ViewDonationVoice",
|
|
773
|
+
"specification": {
|
|
774
|
+
"role": "User", // ✅ User role, not System
|
|
775
|
+
"action": "view",
|
|
776
|
+
"data": {
|
|
777
|
+
"reads": ["VolcTTSEvent.voiceUrl"]
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
```
|
|
782
|
+
|
|
783
|
+
**❌ WRONG: Integration event entity in docs/{module}.data-design.json**
|
|
784
|
+
```json
|
|
785
|
+
{
|
|
786
|
+
"name": "VolcTTSEvent",
|
|
787
|
+
"isIntegrationEvent": false, // ❌ Missing or wrong flag
|
|
788
|
+
"lifecycle": {
|
|
789
|
+
"creation": {
|
|
790
|
+
"type": "user-interaction", // ❌ Wrong type
|
|
791
|
+
"creationInteractions": ["CreateDonation"], // ❌ Should be empty
|
|
792
|
+
"computationMethod": "Created when user creates donation" // ❌ Wrong explanation
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
```
|
|
797
|
+
|
|
798
|
+
**✅ CORRECT: Integration event entity in docs/{module}.data-design.json**
|
|
799
|
+
```json
|
|
800
|
+
{
|
|
801
|
+
"name": "VolcTTSEvent",
|
|
802
|
+
"isIntegrationEvent": true, // ✅ Explicit flag
|
|
803
|
+
"lifecycle": {
|
|
804
|
+
"creation": {
|
|
805
|
+
"type": "api-event", // ✅ Correct type
|
|
806
|
+
"creationInteractions": [], // ✅ Empty - not created by user
|
|
807
|
+
"computationMethod": "Created by external TTS service webhook/callback when voice generation completes" // ✅ Clear explanation
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
```
|
|
812
|
+
|
|
813
|
+
**❌ WRONG: APICall entity in docs/{module}.data-design.json**
|
|
814
|
+
```json
|
|
815
|
+
{
|
|
816
|
+
"name": "VolcTTSCall",
|
|
817
|
+
"isIntegrationEvent": false, // ❌ Missing isAPICallEntity flag
|
|
818
|
+
"lifecycle": {
|
|
819
|
+
"creation": {
|
|
820
|
+
"type": "interaction-created", // ❌ Wrong type, should be mutation-derived
|
|
821
|
+
}
|
|
822
|
+
},
|
|
823
|
+
"computationMethod": "Created by interactions" // ❌ Missing dual creation pattern explanation
|
|
824
|
+
}
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
**✅ CORRECT: APICall entity in docs/{module}.data-design.json**
|
|
828
|
+
```json
|
|
829
|
+
{
|
|
830
|
+
"name": "VolcTTSCall",
|
|
831
|
+
"isAPICallEntity": true, // ✅ CRITICAL: Must have this flag
|
|
832
|
+
"isIntegrationEvent": false,
|
|
833
|
+
"dataDependencies": ["DonationRecord"],
|
|
834
|
+
"computationMethod": "Transform: Auto-create when DonationRecord is created. Also supports retry via RetryTTSCall interaction. Both paths produce mutations handled by same Transform.",
|
|
835
|
+
"lifecycle": {
|
|
836
|
+
"creation": {
|
|
837
|
+
"type": "mutation-derived", // ✅ Dual creation pattern
|
|
838
|
+
"parent": null,
|
|
839
|
+
"relatedBusinessEntity": "DonationRecord", // ✅ Identifies business entity trigger
|
|
840
|
+
"creationInteractions": ["RetryGeneration"] // ✅ created by Transform, can be also created by interactions
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
**❌ WRONG: Integration event in interaction creates array**
|
|
847
|
+
```json
|
|
848
|
+
{
|
|
849
|
+
"id": "CreateDonation",
|
|
850
|
+
"specification": {
|
|
851
|
+
"role": "User",
|
|
852
|
+
"action": "create",
|
|
853
|
+
"data": {
|
|
854
|
+
"creates": [
|
|
855
|
+
{"target": "Donation"},
|
|
856
|
+
{"target": "VolcTTSEvent"} // ❌ User doesn't create this!
|
|
857
|
+
]
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
```
|
|
862
|
+
|
|
863
|
+
**✅ CORRECT: Integration event NOT in interaction**
|
|
864
|
+
```json
|
|
865
|
+
{
|
|
866
|
+
"id": "CreateDonation",
|
|
867
|
+
"specification": {
|
|
868
|
+
"role": "User",
|
|
869
|
+
"action": "create",
|
|
870
|
+
"data": {
|
|
871
|
+
"creates": [
|
|
872
|
+
{"target": "Donation"} // ✅ Only what user creates
|
|
873
|
+
// VolcTTSEvent is created by external system, not here
|
|
874
|
+
]
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
```
|
|
879
|
+
|
|
880
|
+
**❌ WRONG: Testing integration event with callInteraction**
|
|
881
|
+
```typescript
|
|
882
|
+
// In test file - WRONG!
|
|
883
|
+
const result = await controller.callInteraction('CreateTTSEvent', {
|
|
884
|
+
user: testUser,
|
|
885
|
+
payload: { voiceUrl: 'test.mp3' }
|
|
886
|
+
})
|
|
887
|
+
// ❌ Integration events are not created via user interactions!
|
|
888
|
+
```
|
|
889
|
+
|
|
890
|
+
**✅ CORRECT: Testing integration event with storage.create**
|
|
891
|
+
```typescript
|
|
892
|
+
// In test file - CORRECT!
|
|
893
|
+
const event = await controller.system.storage.create(
|
|
894
|
+
'VolcTTSEvent',
|
|
895
|
+
{
|
|
896
|
+
voiceUrl: 'test.mp3',
|
|
897
|
+
status: 'completed',
|
|
898
|
+
timestamp: Date.now()
|
|
899
|
+
}
|
|
900
|
+
)
|
|
901
|
+
// ✅ Simulating external system creating the event
|
|
902
|
+
```
|
|
903
|
+
|
|
904
|
+
### Pattern 1: Entity Property Design
|
|
905
|
+
|
|
906
|
+
**❌ WRONG:**
|
|
907
|
+
```typescript
|
|
908
|
+
const User = Entity.create({
|
|
909
|
+
name: 'User',
|
|
910
|
+
properties: [
|
|
911
|
+
Property.create({ name: 'name', type: 'string' }),
|
|
912
|
+
Property.create({ name: 'dormitoryId', type: 'string' }), // ❌ Foreign key!
|
|
913
|
+
Property.create({ name: 'postIds', type: 'string[]' }) // ❌ Foreign keys!
|
|
914
|
+
]
|
|
915
|
+
})
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
**✅ CORRECT:**
|
|
919
|
+
```typescript
|
|
920
|
+
const User = Entity.create({
|
|
921
|
+
name: 'User',
|
|
922
|
+
properties: [
|
|
923
|
+
Property.create({ name: 'name', type: 'string' })
|
|
924
|
+
// No foreign keys! Use relations instead
|
|
925
|
+
]
|
|
926
|
+
})
|
|
927
|
+
|
|
928
|
+
const UserDormitoryRelation = Relation.create({
|
|
929
|
+
type: 'n:1',
|
|
930
|
+
source: User,
|
|
931
|
+
target: Dormitory,
|
|
932
|
+
sourceProperty: 'dormitory',
|
|
933
|
+
targetProperty: 'residents'
|
|
934
|
+
})
|
|
935
|
+
```
|
|
936
|
+
|
|
937
|
+
### Pattern 2: Reactive Requirements
|
|
938
|
+
|
|
939
|
+
**❌ WRONG:**
|
|
940
|
+
"System automatically calculates total books"
|
|
941
|
+
"System automatically creates uniform record"
|
|
942
|
+
"System detects uniqueness automatically"
|
|
943
|
+
|
|
944
|
+
**✅ CORRECT:**
|
|
945
|
+
"There is a `totalBookCount` data that represents the statistical result"
|
|
946
|
+
"When creating employee, automatically create uniform record" (data constraint)
|
|
947
|
+
"Can only create unique XXX" (constraint condition)
|
|
948
|
+
|
|
949
|
+
### Pattern 3: Computation Implementation
|
|
950
|
+
|
|
951
|
+
**❌ WRONG:**
|
|
952
|
+
```typescript
|
|
953
|
+
// Overwriting existing computation
|
|
954
|
+
User.computation = Transform.create({
|
|
955
|
+
// This deletes previous computation!
|
|
956
|
+
})
|
|
957
|
+
```
|
|
958
|
+
|
|
959
|
+
**✅ CORRECT:**
|
|
960
|
+
```typescript
|
|
961
|
+
// Adding branch logic
|
|
962
|
+
User.computation = Transform.create({
|
|
963
|
+
callback: function(event) {
|
|
964
|
+
if (event.interactionName === 'ExistingInteraction') {
|
|
965
|
+
// Existing branch - PRESERVED
|
|
966
|
+
return { ... }
|
|
967
|
+
} else if (event.interactionName === 'NewInteraction') {
|
|
968
|
+
// New branch - ADDED
|
|
969
|
+
return { ... }
|
|
970
|
+
}
|
|
971
|
+
}
|
|
972
|
+
})
|
|
973
|
+
```
|
|
974
|
+
|
|
975
|
+
### Pattern 4: Query Interaction Data Field
|
|
976
|
+
|
|
977
|
+
**❌ WRONG:**
|
|
978
|
+
```typescript
|
|
979
|
+
// Query interaction without data field
|
|
980
|
+
const GetDonations = Interaction.create({
|
|
981
|
+
name: 'GetDonations',
|
|
982
|
+
action: GetAction,
|
|
983
|
+
payload: Payload.create({
|
|
984
|
+
items: [
|
|
985
|
+
PayloadItem.create({ name: 'userId', type: 'string' })
|
|
986
|
+
]
|
|
987
|
+
})
|
|
988
|
+
// ❌ Missing data field!
|
|
989
|
+
})
|
|
990
|
+
|
|
991
|
+
```
|
|
992
|
+
|
|
993
|
+
**✅ CORRECT:**
|
|
994
|
+
```typescript
|
|
995
|
+
// Query interaction with proper data field
|
|
996
|
+
const GetDonations = Interaction.create({
|
|
997
|
+
name: 'GetDonations',
|
|
998
|
+
action: GetAction,
|
|
999
|
+
data: Donation, // ✅ Entity reference
|
|
1000
|
+
payload: Payload.create({
|
|
1001
|
+
items: [
|
|
1002
|
+
PayloadItem.create({ name: 'userId', type: 'string' })
|
|
1003
|
+
]
|
|
1004
|
+
})
|
|
1005
|
+
})
|
|
1006
|
+
|
|
1007
|
+
// Query interaction returning relation data
|
|
1008
|
+
const GetUserDonations = Interaction.create({
|
|
1009
|
+
name: 'GetUserDonations',
|
|
1010
|
+
action: GetAction,
|
|
1011
|
+
data: UserDonationRelation, // ✅ Relation reference
|
|
1012
|
+
payload: Payload.create({
|
|
1013
|
+
items: [
|
|
1014
|
+
PayloadItem.create({ name: 'userId', type: 'string' })
|
|
1015
|
+
]
|
|
1016
|
+
})
|
|
1017
|
+
})
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1020
|
+
### Pattern 5: Test Error Checking
|
|
1021
|
+
|
|
1022
|
+
**❌ WRONG:**
|
|
1023
|
+
```typescript
|
|
1024
|
+
const result = await controller.callInteraction('CreateDormitory', {
|
|
1025
|
+
user: nonAdmin,
|
|
1026
|
+
payload: { name: 'Test' }
|
|
1027
|
+
})
|
|
1028
|
+
// Missing error check!
|
|
1029
|
+
expect(result.data).toBeDefined()
|
|
1030
|
+
```
|
|
1031
|
+
|
|
1032
|
+
**✅ CORRECT:**
|
|
1033
|
+
```typescript
|
|
1034
|
+
const result = await controller.callInteraction('CreateDormitory', {
|
|
1035
|
+
user: nonAdmin,
|
|
1036
|
+
payload: { name: 'Test' }
|
|
1037
|
+
})
|
|
1038
|
+
expect(result.error).toBeDefined() // ✅ Explicitly check error
|
|
1039
|
+
expect(result.error.type).toBe('condition check failed')
|
|
1040
|
+
```
|
|
1041
|
+
|
|
1042
|
+
### Pattern 6: Relation Querying
|
|
1043
|
+
|
|
1044
|
+
**❌ WRONG:**
|
|
1045
|
+
```typescript
|
|
1046
|
+
// Hardcoded relation name
|
|
1047
|
+
const relations = await storage.find(
|
|
1048
|
+
'UserDormitoryRelation', // ❌ Hardcoded!
|
|
1049
|
+
MatchExp.atom({ key: 'source.id', value: ['=', userId] })
|
|
1050
|
+
)
|
|
1051
|
+
```
|
|
1052
|
+
|
|
1053
|
+
**✅ CORRECT:**
|
|
1054
|
+
```typescript
|
|
1055
|
+
// Using relation instance name
|
|
1056
|
+
const relations = await storage.find(
|
|
1057
|
+
UserDormitoryRelation.name, // ✅ Using instance!
|
|
1058
|
+
MatchExp.atom({ key: 'source.id', value: ['=', userId] })
|
|
1059
|
+
)
|
|
1060
|
+
```
|
|
1061
|
+
|
|
1062
|
+
### Pattern 7: Data Mutations in Computation
|
|
1063
|
+
|
|
1064
|
+
**❌ WRONG:**
|
|
1065
|
+
```typescript
|
|
1066
|
+
// Directly mutating data in computation - FORBIDDEN!
|
|
1067
|
+
userActiveProperty.computation = Custom.create({
|
|
1068
|
+
name: 'userStatusComputation',
|
|
1069
|
+
async getInitialValue(this: Controller, record?: any) {
|
|
1070
|
+
// ❌ CRITICAL ERROR: Direct storage mutation in computation!
|
|
1071
|
+
await this.system.storage.create('Log', {
|
|
1072
|
+
userId: record.id,
|
|
1073
|
+
action: 'user_created'
|
|
1074
|
+
})
|
|
1075
|
+
|
|
1076
|
+
// ❌ CRITICAL ERROR: Updating data in computation!
|
|
1077
|
+
await this.system.storage.update('UserStats',
|
|
1078
|
+
MatchExp.atom({ key: 'userId', value: ['=', record.id] }),
|
|
1079
|
+
{ lastActive: Date.now() }
|
|
1080
|
+
)
|
|
1081
|
+
|
|
1082
|
+
return 'active'
|
|
1083
|
+
}
|
|
1084
|
+
})
|
|
1085
|
+
```
|
|
1086
|
+
|
|
1087
|
+
**✅ CORRECT:**
|
|
1088
|
+
```typescript
|
|
1089
|
+
// Computations should only READ and COMPUTE, not mutate
|
|
1090
|
+
userActiveProperty.computation = Custom.create({
|
|
1091
|
+
name: 'userStatusComputation',
|
|
1092
|
+
async getInitialValue(this: Controller, record?: any) {
|
|
1093
|
+
// ✅ CORRECT: Only reading data to compute a value
|
|
1094
|
+
const stats = await this.system.storage.findOne(
|
|
1095
|
+
'UserStats',
|
|
1096
|
+
MatchExp.atom({ key: 'userId', value: ['=', record.id] }),
|
|
1097
|
+
undefined,
|
|
1098
|
+
['lastActive']
|
|
1099
|
+
)
|
|
1100
|
+
|
|
1101
|
+
// ✅ CORRECT: Pure computation based on read data
|
|
1102
|
+
if (!stats || Date.now() - stats.lastActive > 30 * 24 * 60 * 60 * 1000) {
|
|
1103
|
+
return 'inactive'
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
return 'active'
|
|
1107
|
+
}
|
|
1108
|
+
})
|
|
1109
|
+
|
|
1110
|
+
// ✅ If you need to create/update data, use Interactions or RecordMutationSideEffect
|
|
1111
|
+
// Data mutations should happen through interactions or side effects, NOT in computations
|
|
1112
|
+
```
|
|
1113
|
+
|
|
1114
|
+
**Why this is critical:**
|
|
1115
|
+
- Computations are meant to be **reactive** - they compute values based on existing data
|
|
1116
|
+
- Data mutations should **only** happen through **Interactions** (user-triggered) or **RecordMutationSideEffect** (reactive side effects)
|
|
1117
|
+
- Mixing computation and mutation creates unpredictable behavior and breaks the reactive model
|
|
1118
|
+
- If a computation needs to trigger data changes, the proper approach is to return computed values that other parts of the system react to
|
|
1119
|
+
|
|
1120
|
+
### Pattern 8: Mock Data and Incomplete Implementation in Computation
|
|
1121
|
+
|
|
1122
|
+
**❌ WRONG:**
|
|
1123
|
+
```typescript
|
|
1124
|
+
// Using mock/placeholder data - FORBIDDEN!
|
|
1125
|
+
userScoreProperty.computation = Custom.create({
|
|
1126
|
+
name: 'calculateUserScore',
|
|
1127
|
+
async getInitialValue(this: Controller, record?: any) {
|
|
1128
|
+
// ❌ CRITICAL ERROR: Using mock data instead of real calculation
|
|
1129
|
+
return 100 // TODO: Implement real score calculation later
|
|
1130
|
+
|
|
1131
|
+
// ❌ CRITICAL ERROR: Returning placeholder
|
|
1132
|
+
return 0 // Placeholder
|
|
1133
|
+
|
|
1134
|
+
// ❌ CRITICAL ERROR: Hardcoded test data
|
|
1135
|
+
if (record.id === 'test-user-1') return 95
|
|
1136
|
+
return 80 // Default for testing
|
|
1137
|
+
}
|
|
1138
|
+
})
|
|
1139
|
+
|
|
1140
|
+
// Computation with side effects - FORBIDDEN!
|
|
1141
|
+
orderStatusProperty.computation = Custom.create({
|
|
1142
|
+
name: 'processOrder',
|
|
1143
|
+
async getInitialValue(this: Controller, record?: any) {
|
|
1144
|
+
// ❌ CRITICAL ERROR: Sending email in computation (side effect!)
|
|
1145
|
+
await sendEmail(record.customerEmail, 'Order confirmed')
|
|
1146
|
+
|
|
1147
|
+
// ❌ CRITICAL ERROR: Calling AI API in computation (side effect!)
|
|
1148
|
+
const aiResponse = await callOpenAI({
|
|
1149
|
+
prompt: `Analyze order: ${record.items}`
|
|
1150
|
+
})
|
|
1151
|
+
|
|
1152
|
+
// ❌ CRITICAL ERROR: Calling external payment API (side effect!)
|
|
1153
|
+
await stripeAPI.createCharge(record.amount)
|
|
1154
|
+
|
|
1155
|
+
return 'processed'
|
|
1156
|
+
}
|
|
1157
|
+
})
|
|
1158
|
+
```
|
|
1159
|
+
|
|
1160
|
+
**✅ CORRECT:**
|
|
1161
|
+
```typescript
|
|
1162
|
+
// Complete implementation with real data calculation
|
|
1163
|
+
userScoreProperty.computation = Custom.create({
|
|
1164
|
+
name: 'calculateUserScore',
|
|
1165
|
+
async getInitialValue(this: Controller, record?: any) {
|
|
1166
|
+
// ✅ CORRECT: Read actual data and perform complete calculation
|
|
1167
|
+
const activities = await this.system.storage.find(
|
|
1168
|
+
'UserActivity',
|
|
1169
|
+
MatchExp.atom({ key: 'userId', value: ['=', record.id] }),
|
|
1170
|
+
undefined,
|
|
1171
|
+
['points', 'timestamp']
|
|
1172
|
+
)
|
|
1173
|
+
|
|
1174
|
+
// ✅ CORRECT: Complete business logic implementation
|
|
1175
|
+
const recentActivities = activities.filter(
|
|
1176
|
+
a => Date.now() - a.timestamp < 30 * 24 * 60 * 60 * 1000
|
|
1177
|
+
)
|
|
1178
|
+
|
|
1179
|
+
const totalPoints = recentActivities.reduce((sum, a) => sum + a.points, 0)
|
|
1180
|
+
const activityBonus = recentActivities.length > 10 ? 20 : 0
|
|
1181
|
+
|
|
1182
|
+
return totalPoints + activityBonus
|
|
1183
|
+
}
|
|
1184
|
+
})
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
## Report Update Protocol
|
|
1188
|
+
|
|
1189
|
+
**After checking each section:**
|
|
1190
|
+
|
|
1191
|
+
1. Update the checkbox for each error type
|
|
1192
|
+
2. Fill in the "Check Results" section with:
|
|
1193
|
+
- Total items checked
|
|
1194
|
+
- Errors found with details
|
|
1195
|
+
- Specific file paths and line numbers
|
|
1196
|
+
- Severity level for each error
|
|
1197
|
+
|
|
1198
|
+
**Example:**
|
|
1199
|
+
|
|
1200
|
+
```markdown
|
|
1201
|
+
### Task 3.1.2: Entity and Relation Implementation Errors
|
|
1202
|
+
- [x] ERROR_ER_001: **CRITICAL**: Entity contains reference ID properties
|
|
1203
|
+
- [ ] ERROR_ER_002: Entity property has both defaultValue and computed
|
|
1204
|
+
- [ ] ERROR_ER_003: Computations defined during initial entity creation
|
|
1205
|
+
- ...
|
|
1206
|
+
|
|
1207
|
+
**Check Results**:
|
|
1208
|
+
- **Total Checks**: 8
|
|
1209
|
+
- **Errors Found**: 1 CRITICAL
|
|
1210
|
+
|
|
1211
|
+
**ERROR_ER_001 Details**:
|
|
1212
|
+
- **File**: `backend/content.ts`
|
|
1213
|
+
- **Line**: 45
|
|
1214
|
+
- **Severity**: CRITICAL 🔴
|
|
1215
|
+
- **Description**: User entity has `dormitoryId` property (foreign key)
|
|
1216
|
+
- **Current Code**:
|
|
1217
|
+
```typescript
|
|
1218
|
+
Property.create({ name: 'dormitoryId', type: 'string' })
|
|
1219
|
+
```
|
|
1220
|
+
- **Suggested Fix**: Remove this property and use UserDormitoryRelation instead
|
|
1221
|
+
```
|
|
1222
|
+
|
|
1223
|
+
## Best Practices for Error Checking
|
|
1224
|
+
|
|
1225
|
+
1. **Be Thorough**: Check every file mentioned in the workflow
|
|
1226
|
+
2. **Be Specific**: Provide exact line numbers and file paths
|
|
1227
|
+
3. **Be Helpful**: Suggest specific fixes, not just point out problems
|
|
1228
|
+
4. **Be Honest**: Don't overlook errors to make reports look good
|
|
1229
|
+
5. **Be Systematic**: Follow the checklist order, don't skip items
|
|
1230
|
+
|
|
1231
|
+
## When to Stop and Report
|
|
1232
|
+
|
|
1233
|
+
**STOP IMMEDIATELY and report to user if:**
|
|
1234
|
+
- Any CRITICAL errors found (🔴)
|
|
1235
|
+
- More than 10 HIGH PRIORITY errors found in one phase
|
|
1236
|
+
- Type checking fails
|
|
1237
|
+
- Required files are missing
|
|
1238
|
+
- Tests are failing but marked as completed
|
|
1239
|
+
|
|
1240
|
+
**Continue checking if:**
|
|
1241
|
+
- Only MEDIUM PRIORITY errors found
|
|
1242
|
+
- Documentation issues
|
|
1243
|
+
- Minor inconsistencies
|
|
1244
|
+
|
|
1245
|
+
**🛑 CRITICAL: This agent does NOT fix errors - it only finds and reports them. After reporting, wait for user instructions on how to proceed.**
|
|
1246
|
+
|
|
1247
|
+
## Important Notes
|
|
1248
|
+
|
|
1249
|
+
**⚠️ Do NOT use git commit**: The user will manually commit changes. This agent should only check for errors and report them, without making any git commits or modifications to the codebase.
|
|
1250
|
+
|
|
1251
|
+
**📋 Reporting Only**: This agent's sole responsibility is to identify and document errors. Any fixes or modifications should be handled by other agents or the user directly.
|