sds: id: SDS-002 title: Semantic Core & DSL Management Service bounded_context: semantic-core satisfies_prds: [PRD-001, PRD-003] satisfies_adrs: [ADR-001, ADR-002] version: 1.1.0 status: approved owners: [“sea-core-team”] created: 2025-12-01 —
✅ MVP
This service is responsible for managing the core DSL definitions and policies. It provides APIs for defining, validating, and retrieving semantic concepts and rules, ensuring a single source of truth for business semantics across the enterprise. It also includes a Policy Evaluator for automated enforcement.
| Direction | Description | Format |
|---|---|---|
| Input | DSL definitions | YAML/JSON |
| Input | SEA™ DSL policy statements | Structured text |
| Output | Validated SEA™ DSL | JSON |
| Output | Query results for semantic concepts | JSON |
| Output | Policy enforcement outcomes | JSON |
Refer to SDS-001: Data Model Schemas for:
Entity schemaResource schemaFlow schemaInstance schemaPolicy schema| Endpoint | Method | Description |
|---|---|---|
/dsl/define |
POST | Define new DSL concept |
/dsl/concepts |
GET | Query semantic concepts |
/policy/evaluate |
POST | Evaluate SEA™ DSL policy against data |
Define DSL Concept
1
2
3
4
5
6
7
8
POST /dsl/define
{
"concept": {
"name": "Customer",
"type": "Entity",
"attributes": {...}
}
}
Evaluate Policy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
POST /policy/evaluate
{
"policyId": "order-minimum-value",
"data": {
"orderId": "123",
"totalValue": 5.00
}
}
// Response
{
"valid": false,
"violations": [
{
"rule": "order-minimum-value",
"message": "Order total must be at least $10"
}
]
}
| Code | Description |
|---|---|
400 Bad Request |
Invalid SEA™ DSL/Policy syntax |
409 Conflict |
Semantic inconsistency with existing definitions |
| Dependency | Type | Version | Justification |
|---|---|---|---|
| PostgreSQL | Database | 16.x | Primary persistence layer |
| OPA | Policy Engine | 0.68.x | SEA™ DSL Policy Engine runtime |
This service integrates with the following hexagonal ports:
| Port | Location | Purpose |
|---|---|---|
PolicyEnginePort |
libs/skeleton/policy/ports | Policy evaluation interface |
The PolicyEnginePort provides:
evaluate(input: PolicyInput): Promise<PolicyDecision> — Evaluate policy rulesisAllowed(user, action, resource): Promise<boolean> — Authorization checklistPolicies(): Promise<string[]> — List available policiesThis section defines the versioning and synchronization contract that ensures downstream consumers (particularly the Isomorphic Semantic Compiler, SDS-027) operate on consistent semantic model snapshots.
Every mutation to the semantic model increments a monotonic version counter:
| Field | Type | Description |
|---|---|---|
semanticVersion |
integer |
Monotonically increasing, starts at 1 |
lastUpdated |
datetime |
Timestamp of last mutation |
| Endpoint | Method | Description |
|---|---|---|
/dsl/version |
GET | Returns current semanticVersion and lastUpdated |
/dsl/concepts?version={v} |
GET | Returns snapshot at version v (or 409 if stale) |
/policy/evaluate?version={v} |
POST | Evaluates policy against version v model |
Stale Query Behavior:
requested_version < current_version: Return 409 Conflict with message "Semantic model has advanced to v{current}"requested_version == current_version: Return normal responserequested_version > current_version: Return 400 Bad Request (future version requested)On every semantic model mutation, emit:
1
2
3
4
5
6
7
8
9
10
11
{
"type": "governance.semantic-model.updated",
"source": "//core/semantic-registry",
"data": {
"previousVersion": 5,
"currentVersion": 6,
"changedConcepts": ["Customer", "Order"],
"changedPolicies": ["order-minimum-value"],
"timestamp": "2025-12-31T10:00:00Z"
}
}
Downstream services (e.g., SDS-027 Isomorphic Semantic Compiler) MUST:
version parametergovernance.semantic-model.updated for cache invalidationsemanticVersion in output provenance for audit trail