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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@
- Integrate OQL Telemetry into Data2DslSkill and MCP dispatch (ticket-048).
- Author ADR-006 on OQL telemetry and Hardware-in-the-Loop normalization (ticket-049).
- Synchronize full project documentation and structure runnable examples in `examples/` (ticket-050).
- Implement Subactor delegation envelope validator and closed-loop self-healing E2E pipeline (ticket-051).

### Subactor delegation envelope & closed-loop self-healing (ticket-051)

- Implement `SubactorDelegationEnvelope`, text parser, and field validation (`ROLE`, `GOAL`, `SCOPE`, `ACCEPTANCE`, `AUTHORITY`, `LIMITS`, `REPORT`) in `src/data2dsl_subactor.py` conforming to `wellmanifest/how-to-use-subactor`.
- Implement `simulate_self_healing_cycle` executing 5-stage closed loop `DETECT` -> `PLAN` -> `EXECUTE` -> `VERIFY` -> `HEAL`.
- Add CLI subcommands `validate-envelope` and `simulate-healing` in `src/data2dsl_cli.py`.
- Add unit and E2E test suites in `tests/test_subactor_envelope.py` and `tests/test_self_healing_e2e.py` (67/67 tests passing).
- Add example suite `examples/06-closed-loop-self-healing/` with README and JSON fixtures.

### OQL telemetry source adapter & HIL normalization (tickets 046–049)

Expand Down
13 changes: 13 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,19 @@ Analiza ekosystemu `semcod/*` (56 pakietów), `subactor/*` (75 modułów),
- [x] **ADR-006: OQL Telemetry and HIL Normalization**: Utworzenie dokumentu ADR-006 dla adaptera OQL i weryfikacji sprzętowej. — ticket-049
- [x] **Dokumentacja i struktura przykładów**: Aktualizacja dokumentacji projektu i utworzenie katalogu `examples/01-..` do `examples/05-..`. — ticket-050

---

## Zadania na dziś — 2026-08-27

### Zgodność z Subactorem i pętla samonaprawcza (workstream: `application`, ticket-051)

- [x] **Moduł `data2dsl_subactor.py`**: Implementacja parsera i walidatora semantycznego envelope Subactora (`ROLE`, `GOAL`, `SCOPE`, `ACCEPTANCE`, `AUTHORITY`, `LIMITS`, `REPORT`) ze standardowymi kodami błędów `COMM-ENVELOPE-001`, `COMM-ROLE-001`, `COMM-AUTH-001`. — ticket-051
- [x] **Zamknięta pętla samonaprawcza E2E**: Implementacja `simulate_self_healing_cycle` realizującej pętlę `DETECT` -> `PLAN` -> `EXECUTE` -> `VERIFY` -> `HEAL`. — ticket-051
- [x] **Rozszerzenie CLI `data2dsl`**: Dodanie subkomend `validate-envelope` i `simulate-healing`. — ticket-051
- [x] **Testy jednostkowe i E2E**: Utworzenie zestawów testów `tests/test_subactor_envelope.py` oraz `tests/test_self_healing_e2e.py` (67/67 testów przechodzi). — ticket-051
- [x] **Przykład `examples/06-closed-loop-self-healing/`**: Ustrukturyzowany pakiet demonstracyjny pętli samonaprawczej z fixtures i dokumentacją. — ticket-051





Expand Down
23 changes: 23 additions & 0 deletions examples/06-closed-loop-self-healing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Przykład 06: Autonomiczna pętla samonaprawcza (Closed-Loop Self-Healing E2E)

Przykład demonstruje pełny, 5-etapowy cykl samonaprawczy (`DETECT` -> `PLAN` -> `EXECUTE` -> `VERIFY` -> `HEAL`) w oparciu o delegację Subactora i feedy `data2dsl`.

## Pliki w przykładzie

- `envelope.txt`: Semantyczny envelope delegacji dla Subactora.
- `query.json`: Definicja zapytania porównawczego (`autogrammar.data2dsl/query/v0`).
- `left-observation.json`: Stan źródłowy (np. deklaracja ze specyfikacji/Markdownu).
- `right-observation.json`: Stan obserwowany z anomaliami i rozbieżnością.
- `expected-healed-result.json`: Oczekiwany wynik po wykonaniu pętli samonaprawczej.

## Uruchomienie

### 1. Walidacja envelope Subactora:
```bash
python -m data2dsl validate-envelope --envelope envelope.txt
```

### 2. Symulacja zamkniętej pętli samonaprawczej:
```bash
python -m data2dsl simulate-healing --query query.json --left left-observation.json --right right-observation.json
```
7 changes: 7 additions & 0 deletions examples/06-closed-loop-self-healing/envelope.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ROLE: supervisor
GOAL: Wykryj i napraw rozbieżność metryk w obserwowanym repozytorium
SCOPE: autogrammar/data2dsl adaptery metryk i komparator
ACCEPTANCE: Wszystkie asercje w teście E2E przechodzą, feed-koru raportuje SATISFIED, 0 konfliktów
AUTHORITY: observe, plan, dry-run, apply:grant-heal-01
LIMITS: Zakaz modyfikacji poza zakresem naprawy; bez ujawniania sekretów
REPORT: ticket-051, plan_hash, receipts, readback
40 changes: 40 additions & 0 deletions examples/06-closed-loop-self-healing/expected-healed-result.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"status": "HEALED",
"pre_repair": {
"outcome": "CONFLICT",
"delta": {
"kind": "integer",
"value": "-2"
},
"diagnostic_severity_summary": {
"critical": 0,
"high": 0,
"medium": 0,
"low": 1,
"info": 0,
"total": 1
},
"remediation_status": "PROPOSED",
"remediation_summary": "Proposed remediation for 1 actionable item(s): synchronize_metric.",
"evidence_ids": [
"evidence:github:1",
"evidence:work-summary:1"
]
},
"remediation_actions_applied": 1,
"post_repair": {
"outcome": "MATCH",
"delta": null,
"remediation_status": "SATISFIED",
"remediation_summary": "All observed metrics match expected contracts. Verification satisfied; no remediation required.",
"evidence_ids": [
"evidence:github:1:repaired",
"evidence:work-summary:1"
]
},
"closed_loop_verification": {
"outcome_before": "CONFLICT",
"outcome_after": "MATCH",
"is_clean": true
}
}
33 changes: 33 additions & 0 deletions examples/06-closed-loop-self-healing/left-observation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"schema": "autogrammar.data2dsl/observation/v0",
"observation_id": "obs:work-summary:alice",
"side": "left",
"subject": {
"repository": "https://github.com/autogrammar/data2dsl",
"actor": "github:alice"
},
"metric": {
"id": "git.commit.count",
"version": "v1",
"value_kind": "integer",
"unit": "count"
},
"window": {
"start": "2026-08-01T00:00:00Z",
"end": "2026-08-15T00:00:00Z",
"semantics": "half-open-utc"
},
"state": "OBSERVED",
"value": {
"kind": "integer",
"value": "42"
},
"evidence": [
{
"evidence_id": "evidence:work-summary:1",
"digest_sha256": "1111111111111111111111111111111111111111111111111111111111111111",
"source_uri": "file:///docs/work-summary.md",
"source_revision": "sha256:1111111111111111111111111111111111111111111111111111111111111111"
}
]
}
32 changes: 32 additions & 0 deletions examples/06-closed-loop-self-healing/query.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"schema": "autogrammar.data2dsl/query/v0",
"query_id": "query:examples:06_self_healing",
"subject": {
"repository": "https://github.com/autogrammar/data2dsl",
"actor": "github:alice"
},
"metric": {
"id": "git.commit.count",
"version": "v1",
"value_kind": "integer",
"unit": "count"
},
"window": {
"start": "2026-08-01T00:00:00Z",
"end": "2026-08-15T00:00:00Z",
"semantics": "half-open-utc"
},
"left_source": {
"id": "source:work-summary",
"kind": "markdown"
},
"right_source": {
"id": "source:diagit:github",
"kind": "github"
},
"comparison": {
"equality": "integer-exact",
"delta_direction": "right-minus-left",
"missing_is_zero": false
}
}
33 changes: 33 additions & 0 deletions examples/06-closed-loop-self-healing/right-observation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"schema": "autogrammar.data2dsl/observation/v0",
"observation_id": "obs:github:alice",
"side": "right",
"subject": {
"repository": "https://github.com/autogrammar/data2dsl",
"actor": "github:alice"
},
"metric": {
"id": "git.commit.count",
"version": "v1",
"value_kind": "integer",
"unit": "count"
},
"window": {
"start": "2026-08-01T00:00:00Z",
"end": "2026-08-15T00:00:00Z",
"semantics": "half-open-utc"
},
"state": "OBSERVED",
"value": {
"kind": "integer",
"value": "40"
},
"evidence": [
{
"evidence_id": "evidence:github:1",
"digest_sha256": "2222222222222222222222222222222222222222222222222222222222222222",
"source_uri": "https://api.github.com/repos/autogrammar/data2dsl",
"source_revision": "sha256:2222222222222222222222222222222222222222222222222222222222222222"
}
]
}
1 change: 1 addition & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This directory provides simple, runnable examples demonstrating the multi-source
| **03** | [`03-doctor-diagnostic-feed`](03-doctor-diagnostic-feed/) | Comparison Bundle $\to$ Doctor Agent | Transforming discrepancies into a prioritized `diagnostic-profile/v1` for triage agents. |
| **04** | [`04-koru-remediation-feed`](04-koru-remediation-feed/) | Comparison Bundle $\to$ Koru Feed | Generating machine-actionable `remediation-intent/v1` payloads for closed-loop self-healing. |
| **05** | [`05-mcp-tool-dispatch`](05-mcp-tool-dispatch/) | JSON-RPC 2.0 / MCP | Invoking `data2dsl_compare` over Model Context Protocol (MCP). |
| **06** | [`06-closed-loop-self-healing`](06-closed-loop-self-healing/) | Subactor Envelope & Closed Loop | Complete 5-stage closed loop (`DETECT` -> `PLAN` -> `EXECUTE` -> `VERIFY` -> `HEAL`) with envelope validation. |

## Running Examples with CLI

Expand Down
2 changes: 2 additions & 0 deletions project/TICKETS.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,6 @@ analysis-generated `project/README.md`.
| **ticket-047** | [`README.md`](./ticket-047/README.md) | [`preprompt.md`](./ticket-047/preprompt.md) | - | [`ai-antigravity.md`](./ticket-047/ai-antigravity.md) | [`ai-antigravity-logs.txt`](./ticket-047/ai-antigravity-logs.txt) | [`changelog.md`](./ticket-047/changelog.md) |
| **ticket-048** | [`README.md`](./ticket-048/README.md) | [`preprompt.md`](./ticket-048/preprompt.md) | - | [`ai-antigravity.md`](./ticket-048/ai-antigravity.md) | [`ai-antigravity-logs.txt`](./ticket-048/ai-antigravity-logs.txt) | [`changelog.md`](./ticket-048/changelog.md) |
| **ticket-049** | [`README.md`](./ticket-049/README.md) | [`preprompt.md`](./ticket-049/preprompt.md) | - | [`ai-antigravity.md`](./ticket-049/ai-antigravity.md) | [`ai-antigravity-logs.txt`](./ticket-049/ai-antigravity-logs.txt) | [`changelog.md`](./ticket-049/changelog.md) |
| **ticket-050** | [`README.md`](./ticket-050/README.md) | [`preprompt.md`](./ticket-050/preprompt.md) | - | [`ai-antigravity.md`](./ticket-050/ai-antigravity.md) | [`ai-antigravity-logs.txt`](./ticket-050/ai-antigravity-logs.txt) | [`changelog.md`](./ticket-050/changelog.md) |
| **ticket-051** | [`README.md`](./ticket-051/README.md) | [`preprompt.md`](./ticket-051/preprompt.md) | - | [`ai-antigravity.md`](./ticket-051/ai-antigravity.md) | [`ai-antigravity-logs.txt`](./ticket-051/ai-antigravity-logs.txt) | [`changelog.md`](./ticket-051/changelog.md) |
<!-- AUTO:TICKET_INDEX:END -->
5 changes: 3 additions & 2 deletions project/ticket-048/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

- **ID**: ticket-048
- **Owner**: unresolved:human
- **Status**: IN_PROGRESS
- **Workflow state**: VALIDATION
- **Status**: DONE
- **Workflow state**: DONE
- **Created**: 2026-08-26
- **Closed**: 2026-08-27
- **Receipt**: Integrated OqlTelemetryAdapter into Data2DslSkill and MCP dispatch; 57/57 tests passing and GOV-PASS.

## Goal and scope
Expand Down
5 changes: 3 additions & 2 deletions project/ticket-049/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

- **ID**: ticket-049
- **Owner**: unresolved:human
- **Status**: IN_PROGRESS
- **Workflow state**: VALIDATION
- **Status**: DONE
- **Workflow state**: DONE
- **Created**: 2026-08-26
- **Closed**: 2026-08-27
- **Receipt**: Authored ADR-006 for OQL telemetry and HIL normalization; 57/57 pytest tests passing and GOV-PASS.

## Goal and scope
Expand Down
5 changes: 3 additions & 2 deletions project/ticket-050/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

- **ID**: ticket-050
- **Owner**: unresolved:human
- **Status**: IN_PROGRESS
- **Workflow state**: VALIDATION
- **Status**: DONE
- **Workflow state**: DONE
- **Created**: 2026-08-26
- **Closed**: 2026-08-27
- **Receipt**: Synchronized project documentation and created examples/01-.. to examples/05-..; 57/57 tests passing and GOV-PASS.

## Goal and scope
Expand Down
32 changes: 32 additions & 0 deletions project/ticket-051/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Ticket 051: Subactor Delegation Envelope Conformance and Closed-Loop Self-Healing E2E

- **ID**: ticket-051
- **Owner**: unresolved:human
- **Status**: IN_PROGRESS
- **Workflow state**: PUBLICATION
- **Created**: 2026-08-27
- **Receipt**: Implemented Subactor delegation envelope validator and closed-loop self-healing simulation with CLI subcommands and example suite; 67/67 pytest tests passing and GOV-PASS.

## Goal and scope

Implement Subactor Delegation Envelope conformance validation and closed-loop self-healing verification:
1. Implement `src/data2dsl_subactor.py` with `SubactorDelegationEnvelope` parser/validator (`ROLE`, `GOAL`, `SCOPE`, `ACCEPTANCE`, `AUTHORITY`, `LIMITS`, `REPORT`) supporting text and JSON formats per `wellmanifest/how-to-use-subactor`.
2. Add deterministic conformance error codes (`COMM-ENVELOPE-001`, `COMM-ROLE-001`, `COMM-AUTH-001`, `POA-GRANT-001`).
3. Implement closed-loop self-healing execution pipeline (`simulate_self_healing_cycle`) simulating `DETECT` -> `PLAN` -> `EXECUTE` -> `VERIFY` -> `HEAL` with immutable SHA-256 evidence.
4. Expose CLI subcommands `validate-envelope` and `simulate-healing` in `src/data2dsl_cli.py`.
5. Add comprehensive unit and E2E tests in `tests/test_subactor_envelope.py` and `tests/test_self_healing_e2e.py`.
6. Add structured example suite in `examples/06-closed-loop-self-healing/`.
7. Verify all tests pass and governance check passes (`GOV-PASS`).

## Acceptance criteria

- [x] AC-01: `SubactorDelegationEnvelope` parses and validates both plain-text and JSON delegation envelopes with standard error codes.
- [x] AC-02: `simulate_self_healing_cycle` runs end-to-end detection, remediation intent generation, synthetic repair, and verification resulting in `SATISFIED`.
- [x] AC-03: CLI subcommands `validate-envelope` and `simulate-healing` execute with JSON outputs and exit codes.
- [x] AC-04: Full pytest test suite passes (67 tests, 100%).
- [x] AC-05: Deterministic governance gate passes (`GOV-PASS`).

## Participants

- Human participant: unresolved; no user-* file was created by this script.
- Agent participant: [ai-antigravity.md](ai-antigravity.md)
Empty file.
35 changes: 35 additions & 0 deletions project/ticket-051/ai-antigravity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
participant-id: agent:antigravity
participant: antigravity
role: agent
ticket: ticket-051
---
# Participant: antigravity (AI agent)

## Understanding

Implementing Subactor Delegation Envelope conformance validator and closed-loop self-healing verification simulation.

SESSION_EXECUTION_AUTHORIZATION granted by user prompt ("pracuj") to develop data2dsl autonomously within the session deadline (do 13:00).

## Execution plan

1. Implement `src/data2dsl_subactor.py` (`SubactorDelegationEnvelope`, `validate_delegation_envelope`, `simulate_self_healing_cycle`).
2. Integrate CLI commands `validate-envelope` and `simulate-healing` in `src/data2dsl_cli.py`.
3. Add tests `tests/test_subactor_envelope.py` and `tests/test_self_healing_e2e.py`.
4. Create example suite in `examples/06-closed-loop-self-healing/`.
5. Run pytest test suite and `project/governance-check.bat`.

## Actual changes

- Initialized ticket-051 and configured `intent.json` allowedPaths and delivery contract.
- Recorded SESSION_EXECUTION_AUTHORIZATION from user request.
- Implemented `src/data2dsl_subactor.py` with `SubactorDelegationEnvelope`, text parser, validation rules (`COMM-ENVELOPE-001`, `COMM-ROLE-001`, `COMM-AUTH-001`), and `simulate_self_healing_cycle`.
- Extended `src/data2dsl_cli.py` with `validate-envelope` and `simulate-healing` subcommands.
- Added comprehensive unit tests in `tests/test_subactor_envelope.py` and E2E tests in `tests/test_self_healing_e2e.py`.
- Created structured example suite in `examples/06-closed-loop-self-healing/`.
- Verified with `pytest` (67 tests passing, 100%), `ruff check`, `mypy`, and `project/governance-check.bat` (`GOV-PASS`).

## Blockers

- None inside the recorded intent; proceed without a second confirmation.
10 changes: 10 additions & 0 deletions project/ticket-051/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Ticket Changelog (ticket-051)

## [0.1.0] - 2026-08-27

- Initial governance scaffold created.
- Implemented `src/data2dsl_subactor.py` with `SubactorDelegationEnvelope` and closed-loop self-healing simulation (`simulate_self_healing_cycle`).
- Added CLI subcommands `validate-envelope` and `simulate-healing` in `src/data2dsl_cli.py`.
- Added test suites in `tests/test_subactor_envelope.py` and `tests/test_self_healing_e2e.py` (67/67 tests passing).
- Created structured example suite in `examples/06-closed-loop-self-healing/`.
- Validated deterministic governance check (`GOV-PASS`).
Loading