Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ jobs:
restore-keys: nuget-${{ runner.os }}-

- name: Test with coverage
run: dotnet test -c Release --collect:"XPlat Code Coverage" --results-directory ./coverage
run: dotnet test -c Release --collect:"XPlat Code Coverage" --settings tests/coverlet.runsettings --results-directory ./coverage

- name: Enforce coverage threshold (line >= 0.60)
- name: Enforce coverage threshold (line >= 0.80)
run: |
COUNT=$(find ./coverage -name 'coverage.cobertura.xml' | wc -l)
test "$COUNT" -eq 1 || { echo "expected exactly 1 coverage report (single test project), found $COUNT"; exit 1; }
FILE=$(find ./coverage -name 'coverage.cobertura.xml')
RATE=$(grep -o 'line-rate="[0-9.]*"' "$FILE" | head -1 | grep -o '[0-9.]*')
echo "line coverage: $RATE (threshold 0.60)"
awk -v r="$RATE" 'BEGIN { exit (r >= 0.60 ? 0 : 1) }'
echo "line coverage: $RATE (threshold 0.80)"
awk -v r="$RATE" 'BEGIN { exit (r >= 0.80 ? 0 : 1) }'
11 changes: 7 additions & 4 deletions README-SCAFFOLD.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ dotnet build
dotnet test
```

Coverage (target: ≥60% line coverage on src/, governance hardest):
Coverage (CI gate: ≥80% line coverage on src/, scoped by tests/coverlet.runsettings — same command as CI):
```
dotnet test --collect:"XPlat Code Coverage"
dotnet test --collect:"XPlat Code Coverage" --settings tests/coverlet.runsettings
# summary: the generated coverage.cobertura.xml under tests/Covenant.Tests/TestResults/<guid>/
grep -o 'line-rate="[0-9.]*"' tests/Covenant.Tests/TestResults/*/coverage.cobertura.xml | head -1
```
Expand Down Expand Up @@ -215,8 +215,11 @@ from openai import OpenAI
client = OpenAI(base_url="http://localhost:5100/v1", api_key="demo-key")
client.chat.completions.create(model="gpt-4o-mini", messages=[{"role": "user", "content": "hi"}])
```
First slice speaks plain-text chat (buffered + SSE). Multimodal content and tool calls are not yet
part of the wire surface.
Wire surface: plain-text chat (buffered + SSE) on both dialects; `max_tokens` is forwarded to the
model. Anything governance cannot inspect — image/file content parts, tool definitions, tool calls
and results — is **refused with HTTP 400** (`unsupported` / `invalid_request_error`) and audited,
never silently stripped: an image could carry PHI the classifier never saw. Tool-call governance
is a future ADR.

## 6. Next
- Run the **NativeAOT spike** from ADR-0001 (`PublishAot=true` in `Covenant.Host.csproj`) and record the
Expand Down
2 changes: 1 addition & 1 deletion docs/diagrams/covenant-architecture.drawio

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/diagrams/covenant-architecture.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/diagrams/covenant-overview.drawio
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<mxfile host="app.diagrams.net" agent="Covenant gen_diagram.py" version="24.0.0"><diagram name="Covenant architecture" id="covenant-arch"><mxGraphModel dx="1240" dy="500" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1270" pageHeight="510" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="perimeter" value="&lt;b&gt;Customer perimeter — nothing leaves except allow-listed model egress&lt;/b&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#616161;fontColor=#212121;verticalAlign=top;align=left;spacingLeft=8;spacingTop=2;container=1;dashed=1;strokeWidth=2;" vertex="1" parent="1"><mxGeometry x="250" y="50" width="700" height="420" as="geometry"/></mxCell><mxCell id="clients" value="&lt;b&gt;Any AI client&lt;/b&gt;&lt;br&gt;OpenAI or Anthropic wire&lt;br&gt;SDKs, Open WebUI, agents" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e3f2fd;strokeColor=#1565c0;fontColor=#0d47a1;" vertex="1" parent="1"><mxGeometry x="30" y="230" width="180" height="90" as="geometry"/></mxCell><mxCell id="covenant" value="&lt;b&gt;Covenant — one governed pipeline&lt;/b&gt;&lt;br&gt;auth → classify → policy → cache → rate limit&lt;br&gt;→ budget / kill switch → provider → attribute cost&lt;br&gt;&lt;br&gt;fail-closed: no match, no call" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff3e0;strokeColor=#ef6c00;fontColor=#e65100;" vertex="1" parent="1"><mxGeometry x="290" y="120" width="360" height="150" as="geometry"/></mxCell><mxCell id="evidence" value="&lt;b&gt;Tamper-evident evidence&lt;/b&gt;&lt;br&gt;hash-chained audit log + anchored head&lt;br&gt;spend ledger · evidence export · dashboard" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f3e5f5;strokeColor=#6a1b9a;fontColor=#4a148c;" vertex="1" parent="1"><mxGeometry x="290" y="320" width="360" height="110" as="geometry"/></mxCell><mxCell id="local" value="&lt;b&gt;In-perimeter model&lt;/b&gt;&lt;br&gt;Ollama / vLLM&lt;br&gt;PII / PHI never leave" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e8f5e9;strokeColor=#2e7d32;fontColor=#1b5e20;" vertex="1" parent="1"><mxGeometry x="700" y="320" width="210" height="90" as="geometry"/></mxCell><mxCell id="external" value="&lt;b&gt;Allow-listed providers&lt;/b&gt;&lt;br&gt;OpenAI · Anthropic&lt;br&gt;egress only to these" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e8f5e9;strokeColor=#2e7d32;fontColor=#1b5e20;" vertex="1" parent="1"><mxGeometry x="1000" y="130" width="200" height="110" as="geometry"/></mxCell><mxCell id="admins" value="&lt;b&gt;Admins / auditors&lt;/b&gt;&lt;br&gt;kill switch · evidence" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e3f2fd;strokeColor=#1565c0;fontColor=#0d47a1;" vertex="1" parent="1"><mxGeometry x="30" y="360" width="180" height="70" as="geometry"/></mxCell><mxCell id="e0" value="every request" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;endFill=1;strokeColor=#455a64;" edge="1" parent="1" source="clients" target="covenant"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="e1" value="permitted routes" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;endFill=1;strokeColor=#455a64;" edge="1" parent="1" source="covenant" target="external"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="e2" value="sensitive data" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;endFill=1;strokeColor=#455a64;" edge="1" parent="1" source="covenant" target="local"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="e3" value="allow, deny, error alike" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;endFill=1;strokeColor=#455a64;" edge="1" parent="1" source="covenant" target="evidence"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="e4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;endFill=1;strokeColor=#455a64;" edge="1" parent="1" source="admins" target="evidence"><mxGeometry relative="1" as="geometry"/></mxCell></root></mxGraphModel></diagram></mxfile>
<mxfile host="app.diagrams.net" agent="Covenant gen_diagram.py" version="24.0.0"><diagram name="Covenant architecture" id="covenant-arch"><mxGraphModel dx="1240" dy="500" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1270" pageHeight="510" math="0" shadow="0"><root><mxCell id="0"/><mxCell id="1" parent="0"/><mxCell id="perimeter" value="&lt;b&gt;Customer perimeter — nothing leaves except allow-listed model egress&lt;/b&gt;" style="rounded=1;whiteSpace=wrap;html=1;fillColor=none;strokeColor=#616161;fontColor=#212121;verticalAlign=top;align=left;spacingLeft=8;spacingTop=2;container=1;dashed=1;strokeWidth=2;" vertex="1" parent="1"><mxGeometry x="250" y="50" width="700" height="420" as="geometry"/></mxCell><mxCell id="clients" value="&lt;b&gt;Any AI client&lt;/b&gt;&lt;br&gt;OpenAI or Anthropic wire&lt;br&gt;SDKs, Open WebUI, agents" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e3f2fd;strokeColor=#1565c0;fontColor=#0d47a1;" vertex="1" parent="1"><mxGeometry x="30" y="230" width="180" height="90" as="geometry"/></mxCell><mxCell id="covenant" value="&lt;b&gt;Covenant — one governed pipeline&lt;/b&gt;&lt;br&gt;auth → shape → classify → policy → cache → rate limit&lt;br&gt;→ budget / kill switch → provider → attribute cost&lt;br&gt;&lt;br&gt;fail-closed: no match, no call" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#fff3e0;strokeColor=#ef6c00;fontColor=#e65100;" vertex="1" parent="1"><mxGeometry x="290" y="120" width="360" height="150" as="geometry"/></mxCell><mxCell id="evidence" value="&lt;b&gt;Tamper-evident evidence&lt;/b&gt;&lt;br&gt;hash-chained audit log + anchored head&lt;br&gt;spend ledger · evidence export · dashboard" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#f3e5f5;strokeColor=#6a1b9a;fontColor=#4a148c;" vertex="1" parent="1"><mxGeometry x="290" y="320" width="360" height="110" as="geometry"/></mxCell><mxCell id="local" value="&lt;b&gt;In-perimeter model&lt;/b&gt;&lt;br&gt;Ollama / vLLM&lt;br&gt;PII / PHI never leave" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e8f5e9;strokeColor=#2e7d32;fontColor=#1b5e20;" vertex="1" parent="1"><mxGeometry x="700" y="320" width="210" height="90" as="geometry"/></mxCell><mxCell id="external" value="&lt;b&gt;Allow-listed providers&lt;/b&gt;&lt;br&gt;OpenAI · Anthropic&lt;br&gt;egress only to these" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e8f5e9;strokeColor=#2e7d32;fontColor=#1b5e20;" vertex="1" parent="1"><mxGeometry x="1000" y="130" width="200" height="110" as="geometry"/></mxCell><mxCell id="admins" value="&lt;b&gt;Admins / auditors&lt;/b&gt;&lt;br&gt;kill switch · evidence" style="rounded=1;whiteSpace=wrap;html=1;fillColor=#e3f2fd;strokeColor=#1565c0;fontColor=#0d47a1;" vertex="1" parent="1"><mxGeometry x="30" y="360" width="180" height="70" as="geometry"/></mxCell><mxCell id="e0" value="every request" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;endFill=1;strokeColor=#455a64;" edge="1" parent="1" source="clients" target="covenant"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="e1" value="permitted routes" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;endFill=1;strokeColor=#455a64;" edge="1" parent="1" source="covenant" target="external"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="e2" value="sensitive data" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;endFill=1;strokeColor=#455a64;" edge="1" parent="1" source="covenant" target="local"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="e3" value="allow, deny, error alike" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;endFill=1;strokeColor=#455a64;" edge="1" parent="1" source="covenant" target="evidence"><mxGeometry relative="1" as="geometry"/></mxCell><mxCell id="e4" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=1;html=1;endArrow=block;endFill=1;strokeColor=#455a64;" edge="1" parent="1" source="admins" target="evidence"><mxGeometry relative="1" as="geometry"/></mxCell></root></mxGraphModel></diagram></mxfile>
Loading
Loading