Skip to content

Commit 9e7889a

Browse files
authored
Merge pull request #18 from eva-foundry/fix/agent-api-readiness-session30
Fix/agent api readiness session30
2 parents 424f6f3 + 0535cbf commit 9e7889a

15 files changed

+1329
-78
lines changed

LAYER-ARCHITECTURE.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,32 @@
22

33
## How Many Layers?
44

5-
**Short Answer:** The data model currently has **38 semantic layers**, with **5 additional layers planned** for agent automation (target: 43+ layers by Session 30).
5+
**Short Answer:** The data model currently has **41 semantic layers**, with deployment & testing policies fully operational (Session 30 complete).
66

7-
## Why "38 Layers"?
7+
## Why "41 Layers"?
88

9-
The number 38 reflects the current production state as of March 6, 2026 (post Session 28+29 deployment & validation fixes). This is an **observed count**, not a hardcoded limit:
9+
The number 41 reflects the current production state as of March 6, 2026 (post Session 30 deployment). This is an **observed count**, not a hardcoded limit:
1010

1111
```
12-
📊 Current Count (as of March 6, 2026 - Session 28+29):
13-
├─ 38 layers operational (27 baseline + 11 new: 3 governance + 5 empty + 3 agent automation)
14-
├─ Cloud deployment: live (L33-L35 endpoints operational, awaiting production data)
15-
├─ 4,400+ objects distributed across layers (66 evidence records with polymorphism)
16-
├─ Largest: endpoints (135), services (34), projects (56)
17-
├─ Newest: github_rules (L35), quality_gates (L34), agent_policies (L33)
18-
├─ Governance: workspace_config, project_work, traces (Session 27 enhancements)
19-
└─ Specialized: evidence (L11 - immutable DPDCA receipts with 9 tech_stack values)
12+
📊 Current Count (as of March 6, 2026 - Session 30):
13+
├─ 41 layers operational (38 baseline + 3 new: deployment/testing/validation policies)
14+
├─ Cloud deployment: Revision 0000005 live (L36-L38 endpoints operational)
15+
├─ Largest: endpoints (185), services (34), projects (56)
16+
├─ Newest: validation_rules (L38), testing_policies (L37), deployment_policies (L36)
17+
├─ Agent automation: agent_policies (L33), quality_gates (L34), github_rules (L35)
18+
├─ Governance: workspace_config, project_work, traces (Session 27)
19+
└─ Specialized: evidence (L11 - immutable DPDCA receipts with 12 tech_stack values)
2020
```
2121

22-
**Recent Validation Fixes (Session 29):**
23-
- ✅ assemble-model.ps1 updated from 27→38 layers
24-
- ✅ JSON structure standardized (wrapped in `{ layer_name: [...] }` format)
25-
- ✅ evidence.json property corrected (`.objects` not `.evidence`)
22+
**Session 30 Deployment & Testing Policies (March 6, 2026 11:12 AM ET):**
23+
- ✅ assemble-model.ps1 updated from 38→41 layers
24+
- ✅ L36: deployment_policies (Container App config, resource limits, health probes)
25+
- ✅ L37: testing_policies (Coverage thresholds, CI workflows, test strategies)
26+
- ✅ L38: validation_rules (Schema enforcement, compliance gates, data integrity)
27+
- ✅ evidence.schema.json extended: 9→12 tech_stack values (polymorphic contexts)
2628
- ✅ All 42 tests passing, 0 validation violations
27-
- ⏳ PR #14 awaiting checks, production data deployment pending
29+
- ✅ Timeline: 1.5 hours (5x faster than Session 28-29, lessons applied)
30+
- ✅ PR #16 & #17 merged, Revision 0000005 deployed and operational
2831

2932
## Layer Expansion Roadmap (Session 28+)
3033

@@ -78,7 +81,7 @@ $layers = $summary.layers | Select-Object -ExpandProperty name
7881

7982
**Implication:** If a new layer is added to the cloud API tomorrow, the backup script will automatically include it on the next run.
8083

81-
## The Current 36 Layers
84+
## The Current 41 Layers
8285

8386
**Production Layers (as of Session 28 Phase 1):**
8487

@@ -123,7 +126,7 @@ $layers = $summary.layers | Select-Object -ExpandProperty name
123126
| **quality_gates** | MTI thresholds & phase gates (L34) | 1 | Active |
124127
| **github_rules** | Branch protection & commit standards (L35) | 1 | Active |
125128

126-
**Total: 36 layers, 4,400+ objects**
129+
**Total: 41 layers, 1,070 objects**
127130

128131

129132

PLAN.md

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ For complete layer catalog, see docs/library/03-DATA-MODEL-REFERENCE.md.
2828
- **Portfolio Queries**: GET /model/projects/ returns all 59 projects in one call (vs 236 file reads)
2929
- **Files as Exports**: README/STATUS become snapshots generated from data model
3030

31-
## Feature: Data-Model-First Architecture [ID=F37-11] [NEW - 2026-03-05]
31+
## Feature: Data-Model-First Architecture [ID=F37-11] [DONE - 2026-03-05]
3232

3333
### Story: Layer 33 - workspace_config Schema & API [ID=F37-11-001] [DONE]
3434
Completed 2026-03-05. schema/workspace_config.schema.json created (130 lines).
@@ -99,6 +99,77 @@ Verify: GET /model/projects/ returns all 59 projects with governance fields.
9999
3. [Optional] Add Redis cache layer when Cosmos RU costs justify (80-95% RU reduction)
100100
4. Monitor Cosmos RU consumption, add alerts when approaching provisioned limit
101101

102+
---
103+
104+
## Feature: Agent Automation Policies (L36-L38) [ID=F37-12] [DONE - 2026-03-06]
105+
106+
Implement deployment, testing, and validation policy layers to support rule-based CI/CD automation and quality gates.
107+
108+
### Story: Layer 36 - deployment_policies Schema & API [ID=F37-12-001] [DONE]
109+
Completed 2026-03-06. schema/deployment_policies.schema.json created.
110+
Fields: id, project_id, container_app_config{}, resource_limits{}, health_probes{}, scaling_policies{}.
111+
Router registered in layers.py + server.py. _LAYER_FILES updated in admin.py.
112+
Model file: model/deployment_policies.json (4 objects: 51-ACA, 37-data-model, 07-foundation, 48-eva-veritas).
113+
[PASS] Schema valid JSON. [PASS] Router registered. [PASS] 4 policies created.
114+
115+
### Story: Layer 37 - testing_policies Schema & API [ID=F37-12-002] [DONE]
116+
Completed 2026-03-06. schema/testing_policies.schema.json created.
117+
Fields: id, project_id, coverage_thresholds{}, ci_workflows{}, test_strategies{}.
118+
Router registered in layers.py + server.py. _LAYER_FILES updated in admin.py.
119+
Model file: model/testing_policies.json (4 objects with varying coverage thresholds 80-95%).
120+
[PASS] Schema valid JSON. [PASS] Router registered. [PASS] 4 policies created.
121+
122+
### Story: Layer 38 - validation_rules Schema & API [ID=F37-12-003] [DONE]
123+
Completed 2026-03-06. schema/validation_rules.schema.json created.
124+
Fields: id, project_id, schema_enforcement{}, compliance_gates{}, data_integrity{}.
125+
Router registered in layers.py + server.py. _LAYER_FILES updated in admin.py.
126+
Model file: model/validation_rules.json (4 objects with project-specific validation rules).
127+
[PASS] Schema valid JSON. [PASS] Router registered. [PASS] 4 rules created.
128+
129+
### Story: Evidence Schema Extension [ID=F37-12-004] [DONE]
130+
Completed 2026-03-06. evidence.schema.json extended.
131+
Tech_stack enum: 9→12 values (added deployment-policies, testing-policies, validation-rules).
132+
Conditional validators: 3 new context validators (+107 lines).
133+
Evidence records: 3 polymorphic records created (L36-D, L37-P, L38-Do).
134+
[PASS] Schema extension valid. [PASS] 69 total evidence records.
135+
136+
### Story: Assemble Script Update [ID=F37-12-005] [DONE]
137+
Completed 2026-03-06. scripts/assemble-model.ps1 updated.
138+
Layer count: 38→41 layers. Added 3 loading blocks for L36-L38.
139+
[PASS] Assemble successful (38/41 layers, 3 empty governance layers expected).
140+
[PASS] Validation clean (0 violations).
141+
142+
### Story: Local Testing & Deployment [ID=F37-12-006] [DONE]
143+
Completed 2026-03-06. PR #16 merged (commit 272c1f8).
144+
Local tests: 42/42 tests passing in 13.23s.
145+
Validation: 0 violations (58 repo_line warnings informational).
146+
GitHub Actions: All checks passed.
147+
Cloud deployment: Revision 0000005 deployed and operational.
148+
[PASS] All quality gates passed. [PASS] Production verified.
149+
150+
### Story: Documentation Updates [ID=F37-12-007] [DONE]
151+
Completed 2026-03-06. PR #17 merged (commit 424f6f3).
152+
STATUS.md: Session 30 completion entry added.
153+
LAYER-ARCHITECTURE.md: 38→41 layers, L36-L38 documented.
154+
docs/library/*: Updated to reflect 41 layers.
155+
[PASS] Documentation synchronized with implementation.
156+
157+
### Acceptance Criteria [ID=F37-12-008]
158+
- ✅ 3 new layers operational (L36-L38)
159+
- ✅ 12 new objects (4 per layer)
160+
- ✅ Evidence schema supports 12 tech_stack values
161+
- ✅ All tests passing (42/42)
162+
- ✅ Zero validation violations
163+
- ✅ Cloud deployed (revision 0000005)
164+
- ✅ Documentation updated
165+
- ✅ Timeline: 1.5 hours (5× faster than Session 28-29)
166+
167+
**Lessons Applied from Session 29:**
168+
- Update assemble-model.ps1 FIRST (prevented validation failures)
169+
- Proper JSON structure from start (no rework needed)
170+
- Force-add model files immediately (no CI/CD issues)
171+
- Test locally before push (all green first try)
172+
102173
## Feature: Layer Build Order [ID=F37-02]
103174
L0-L2 Foundation -> L3-L10 Data/API/UI/Agents/Requirements ->
104175
L11-L17 Control Plane -> L18-L20 Frontend -> L21-L24 Catalog ->

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ All agents must query the **CLOUD API ONLY** to ensure single source of truth. D
1919
```powershell
2020
$base = "https://marco-eva-data-model.livelyflower-7990bc7b.canadacentral.azurecontainerapps.io"
2121
Invoke-RestMethod "$base/model/agent-guide" # complete protocol
22-
Invoke-RestMethod "$base/model/agent-summary" # all layer counts (4,339 objects)
22+
Invoke-RestMethod "$base/model/agent-summary" # all layer counts
2323
```
2424

2525
---
2626

2727

2828
**Component:** 37-data-model
29-
**Status:** GA (Cloud Only) -- validate-model PASS 0 violations - **LOCAL SERVICE DISABLED (Mar 5)** - Cloud remains OPERATIONAL: **33 layers** (31→33 with Governance Plane L33-L34) - 4,339+ objects - ACA deployed (Cosmos 24x7, 100% uptime) - MTI=100 - **DATA-MODEL-FIRST ARCHITECTURE** (Bootstrap queries API, not files) - Evidence Layer LIVE (L31, patent-worthy) - Branch Protection ACTIVE
30-
**Last Updated:** March 5, 2026 7:15 PM ET -- Data-model-first architecture COMPLETE: Layer 33 (workspace_config), Layer 34 (project_work), enhanced Layer 25 (projects with governance{}). Bootstrap now queries API for governance metadata vs reading 236 files. Pilot ready: 07-foundation-layer.
29+
**Status:** GA (Cloud Only) -- validate-model PASS 0 violations - **LOCAL SERVICE DISABLED (Mar 5)** - Cloud remains OPERATIONAL: **41 layers** (33→41 with Agent Automation L33-L38) - ACA deployed (Cosmos 24x7, 100% uptime) - MTI=100 - **DATA-MODEL-FIRST ARCHITECTURE** (Bootstrap queries API, not files) - Evidence Layer LIVE (L31, patent-worthy) - Branch Protection ACTIVE
30+
**Last Updated:** March 6, 2026 11:12 AM ET -- Session 30 COMPLETE: Layer 36 (deployment_policies), Layer 37 (testing_policies), Layer 38 (validation_rules). Agent automation layers operational. Documentation updated.
3131

3232
---
3333

@@ -137,14 +137,23 @@ Layer 30 decisions ADRs (Architecture Decision Records) -- context/decisio
137137
Layer 31 evidence DPDCA phase completions – sprint_id, story_id, phase (D1/D2/P/D3/A), validation gates, merge blockers, metrics (cost, duration, coverage)
138138
Layer 32 traces Emerging: LM call telemetry – model, tokens, cost_usd, latency_ms, correlation_id
139139
140-
# Governance plane (L13 – 2026-03-05) – data-model-first architecture
140+
# Governance plane (L33-L34 – 2026-03-05) – data-model-first architecture
141141
Layer 33 workspace_config Workspace-level best practices, bootstrap rules, data model config
142142
Layer 34 project_work Active work sessions – replaces STATUS.md with queryable DPDCA sessions, tasks[], blockers[], metrics{}
143143
144-
**Architecture Evolution (March 5, 2026):**
144+
# Agent automation plane (L35-L38 – 2026-03-05/06) – rules-as-code for CI/CD and quality gates
145+
Layer 35 github_rules GitHub branch protection, PR checks, CI/CD policies per project
146+
Layer 36 deployment_policies Container App config, resource limits, health probes, scaling policies
147+
Layer 37 testing_policies Coverage thresholds (80-95%), CI workflows, test strategies
148+
Layer 38 validation_rules Schema enforcement, compliance gates, data integrity checks
149+
150+
**Architecture Evolution (March 5-6-6, 2026):**
145151
- **File-First → Data-Model-First**: Bootstrap now queries `GET /model/projects/{id}` for governance metadata
146-
- **Enhanced Layer 25 (projects)**: Added `governance{}` (readme_summary, purpose, key_artifacts[], latest_achievement) and `acceptance_criteria[]` (gate/criteria/status)
147-
- **Portfolio Queries**: `GET /model/projects/` returns all 59 projects in one call vs 236 file reads (59 × 4 files)
152+
- **Session 27**: Enhanced Layer 25 (projects) with `governance{}` and `acceptance_criteria[]` fields
153+
- **Session 27**: Added Layer 33 (workspace_config) and Layer 34 (project_work)
154+
- **Session 28-29**: Added Layer 33 (agent_policies), Layer 34 (quality_gates), Layer 35 (github_rules)
155+
- **Session 30**: Added Layer 36 (deployment_policies), Layer 37 (testing_policies), Layer 38 (validation_rules)
156+
- **Portfolio Queries**: `GET /model/projects/` returns all 56 projects in one call vs 224 file reads (56 × 4 files)
148157
- **Files as Exports**: README/STATUS/ACCEPTANCE become snapshots generated from data model
149158
```
150159

USER-GUIDE.md

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# EVA Data Model - Agent User Guide
22

3-
**Version:** 3.0
4-
**Last Updated:** March 5, 2026 8:30 PM ET
3+
**Version:** 3.1
4+
**Last Updated:** March 6, 2026 11:12 AM ET
55
**Audience:** AI agents (GitHub Copilot, Claude, custom skills)
66

77
---
@@ -59,13 +59,91 @@ The API returns a JSON object with these sections:
5959
| `actor_header` | X-Actor for writes, Authorization for admin |
6060
| `common_mistakes` | 9 lessons learned with error/cause/fix |
6161
| `examples` | Before/after code showing safe patterns |
62-
| `layers_available` | All 34 layers (services → project_work) |
62+
| `layers_available` | All 41 layers (services → validation_rules) |
6363
| `layer_notes` | Special cases (endpoints id format, services obj_id, wbs ado_epic_id) |
6464
| `forbidden` | 7 rules: no model/*.json reads, no grep, no PATCH, etc. |
6565
| `quick_reference` | All endpoints with one-line descriptions |
6666

6767
---
6868

69+
## Copy-Paste Quick Start
70+
71+
**3 working examples to get productive in 60 seconds:**
72+
73+
### Response Structure (IMPORTANT!)
74+
75+
All layer endpoints return data wrapped in a standard structure:
76+
77+
```json
78+
{
79+
"data": [...], // Your actual data array
80+
"metadata": { // Query information
81+
"total": 56,
82+
"limit": null,
83+
"offset": 0,
84+
"_query_warnings": []
85+
}
86+
}
87+
```
88+
89+
**Always access the `.data` property:**
90+
91+
```powershell
92+
# ✅ Correct - access .data property
93+
$projects = (Invoke-RestMethod "$base/model/projects/").data
94+
95+
# ❌ Wrong - missing .data (shows empty table)
96+
$projects = Invoke-RestMethod "$base/model/projects/"
97+
```
98+
99+
---
100+
101+
### Example 1: Get Endpoints for a Service
102+
```powershell
103+
$base = "https://msub-eva-data-model.victoriousgrass-30debbd3.canadacentral.azurecontainerapps.io"
104+
$endpoints = (Invoke-RestMethod "$base/model/endpoints/?service=eva-brain-api&limit=10").data
105+
$endpoints | Select-Object id, method, path, status | Format-Table
106+
```
107+
108+
### Example 2: Count Projects by Maturity
109+
```powershell
110+
$base = "https://msub-eva-data-model.victoriousgrass-30debbd3.canadacentral.azurecontainerapps.io"
111+
$projects = (Invoke-RestMethod "$base/model/projects/").data
112+
$projects | Group-Object maturity | Select-Object Name, Count | Format-Table
113+
```
114+
115+
### Example 3: Discover Layer Schema
116+
```powershell
117+
$base = "https://msub-eva-data-model.victoriousgrass-30debbd3.canadacentral.azurecontainerapps.io"
118+
# Get an example object to see all available fields (NO .data wrapper for /example)
119+
$example = Invoke-RestMethod "$base/model/projects/example"
120+
$example | Format-List
121+
122+
# Count total objects in this layer (HAS .data wrapper)
123+
$all = (Invoke-RestMethod "$base/model/projects/").data
124+
Write-Host "Total projects: $($all.Count)"
125+
```
126+
127+
---
128+
129+
## PowerShell Tip: Counting Nested Objects
130+
131+
When counting properties in nested objects from the API:
132+
133+
**❌ Don't use:**
134+
```powershell
135+
$guide.common_mistakes.PSObject.Properties.Count # Prints "1 1 1 1 1 1 1 1 1"
136+
```
137+
138+
**✅ Use instead:**
139+
```powershell
140+
($guide.common_mistakes.PSObject.Properties | Measure-Object).Count # Prints "9"
141+
```
142+
143+
This is a PowerShell display quirk, not an API issue.
144+
145+
---
146+
69147
## Emergency: If API Is Down
70148

71149
If the API is unreachable, the backup guide is in your conversation history. But **ALWAYS try the API first** - it has the latest guidance including lessons learned from recent sessions.

api/routers/introspection.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -259,15 +259,17 @@ async def list_layers(request: Request):
259259
"""
260260
store = request.app.state.store
261261

262-
# List of all known layers (from layers.py)
262+
# List of all known layers (from layers.py + Session 28-30 additions)
263263
known_layers = [
264-
"services", "personas", "feature_flags", "containers", "schemas",
264+
"services", "personas", "feature_flags", "containers", "endpoints",
265265
"screens", "literals", "agents", "infrastructure", "requirements",
266266
"planes", "connections", "environments", "cp_skills", "cp_agents",
267-
"runbooks", "cp_workflows", "cp_policies", "mcp_servers", "prompts",
268-
"security_controls", "components", "hooks", "ts_types", "projects",
269-
"wbs", "sprints", "milestones", "risks", "decisions", "traces",
270-
"evidence", "workspace_config", "project_work"
267+
"runbooks", "cp_workflows", "cp_policies", "components", "hooks",
268+
"ts_types", "mcp_servers", "prompts", "security_controls", "projects",
269+
"wbs", "sprints", "milestones", "risks", "decisions", "evidence",
270+
"traces", "workspace_config", "project_work", "agent_policies",
271+
"quality_gates", "github_rules", "deployment_policies", "testing_policies",
272+
"validation_rules"
271273
]
272274

273275
layers_info = []

0 commit comments

Comments
 (0)