Skip to content

Commit 3c13974

Browse files
committed
feat: enforce Mission Stack protocol guardrails
• [MSN] 1 mission to be verified • [EXC] Board idle, no stories queued or active • [HLT] 2 warnings, no structural errors detected
1 parent 6a2d96b commit 3c13974

24 files changed

Lines changed: 716 additions & 22 deletions

File tree

.keel/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,11 @@
454454
|--------|--------|
455455
| [Specify Managed Foreign Worktree Lifecycle](epics/VGdxE0lFe/voyages/VGdyGssEu/) | done |
456456

457-
### [Mission Stack Context Engine And Enforcement](epics/VGe7mCcFW/) (active)
457+
### [Mission Stack Context Engine And Enforcement](epics/VGe7mCcFW/) (done)
458458

459459
| Voyage | Status |
460460
|--------|--------|
461-
| [Implement Mission Stack Context Surfaces](epics/VGe7mCcFW/voyages/VGe8Ad6Jy/) | in-progress |
461+
| [Implement Mission Stack Context Surfaces](epics/VGe7mCcFW/voyages/VGe8Ad6Jy/) | done |
462462

463463
### [Mission Entity](epics/1vzeJF000/) (done)
464464

.keel/epics/VGe7mCcFW/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ mission: VGe7lZu9k
2222
## Voyages
2323

2424
<!-- BEGIN GENERATED -->
25-
**Progress:** 0/1 voyages complete, 2/3 stories done
25+
**Progress:** 1/1 voyages complete, 3/3 stories done
2626
| Voyage | Status | Stories |
2727
|--------|--------|---------|
28-
| [Implement Mission Stack Context Surfaces](voyages/VGe8Ad6Jy/) | in-progress | 2/3 |
28+
| [Implement Mission Stack Context Surfaces](voyages/VGe8Ad6Jy/) | done | 3/3 |
2929
<!-- END GENERATED -->
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# COMPLIANCE REPORT: Implement Mission Stack Context Surfaces
2+
3+
## Requirement Traceability Matrix
4+
5+
| Req ID | Status | Implemented By | Proof Artifacts |
6+
|--------|--------|----------------|-----------------|
7+
| SRS-01 | ✓ VERIFIED | [VGe8MfYJW](../../../../stories/VGe8MfYJW/README.md), [VGe8MfYJW](../../../../stories/VGe8MfYJW/README.md) | [ac-1.log](../../../../stories/VGe8MfYJW/EVIDENCE/ac-1.log)<br>[ac-2.log](../../../../stories/VGe8MfYJW/EVIDENCE/ac-2.log)<br>[ac-3.log](../../../../stories/VGe8MfYJW/EVIDENCE/ac-3.log)<br>[ac-1.log](../../../../stories/VGe8MfYJW/EVIDENCE/ac-1.log)<br>[ac-2.log](../../../../stories/VGe8MfYJW/EVIDENCE/ac-2.log)<br>[ac-3.log](../../../../stories/VGe8MfYJW/EVIDENCE/ac-3.log) |
8+
| SRS-02 | ✓ VERIFIED | [VGe8Mf0Jg](../../../../stories/VGe8Mf0Jg/README.md) | [ac-1.log](../../../../stories/VGe8Mf0Jg/EVIDENCE/ac-1.log)<br>[ac-2.log](../../../../stories/VGe8Mf0Jg/EVIDENCE/ac-2.log)<br>[ac-3.log](../../../../stories/VGe8Mf0Jg/EVIDENCE/ac-3.log) |
9+
| SRS-03 | ✓ VERIFIED | [VGe8Mf0Jg](../../../../stories/VGe8Mf0Jg/README.md) | [ac-1.log](../../../../stories/VGe8Mf0Jg/EVIDENCE/ac-1.log)<br>[ac-2.log](../../../../stories/VGe8Mf0Jg/EVIDENCE/ac-2.log)<br>[ac-3.log](../../../../stories/VGe8Mf0Jg/EVIDENCE/ac-3.log) |
10+
| SRS-04 | ✓ VERIFIED | [VGe8Mf0Jg](../../../../stories/VGe8Mf0Jg/README.md) | [ac-1.log](../../../../stories/VGe8Mf0Jg/EVIDENCE/ac-1.log)<br>[ac-2.log](../../../../stories/VGe8Mf0Jg/EVIDENCE/ac-2.log)<br>[ac-3.log](../../../../stories/VGe8Mf0Jg/EVIDENCE/ac-3.log) |
11+
| SRS-05 | ✓ VERIFIED | [VGe8Mg4Jj](../../../../stories/VGe8Mg4Jj/README.md), [VGe8Mg4Jj](../../../../stories/VGe8Mg4Jj/README.md) | [ac-1.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-1.log)<br>[ac-2.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-2.log)<br>[ac-3.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-3.log)<br>[ac-4.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-4.log)<br>[ac-5.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-5.log)<br>[ac-1.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-1.log)<br>[ac-2.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-2.log)<br>[ac-3.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-3.log)<br>[ac-4.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-4.log)<br>[ac-5.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-5.log) |
12+
| SRS-06 | ✓ VERIFIED | [VGe8Mg4Jj](../../../../stories/VGe8Mg4Jj/README.md) | [ac-1.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-1.log)<br>[ac-2.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-2.log)<br>[ac-3.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-3.log)<br>[ac-4.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-4.log)<br>[ac-5.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-5.log) |

.keel/epics/VGe7mCcFW/voyages/VGe8Ad6Jy/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
---
22
# system-managed
33
id: VGe8Ad6Jy
4-
status: in-progress
4+
status: done
55
epic: VGe7mCcFW
66
created_at: 2026-04-12T22:33:49
77
# authored
88
title: Implement Mission Stack Context Surfaces
99
index: 1
1010
updated_at: 2026-04-12T22:35:36
1111
started_at: 2026-04-12T22:35:38
12+
completed_at: 2026-04-12T23:10:10
1213
---
1314

1415
# Implement Mission Stack Context Surfaces
@@ -22,16 +23,18 @@ started_at: 2026-04-12T22:35:38
2223
|----------|-------------|
2324
| [SRS.md](SRS.md) | Requirements and verification criteria |
2425
| [SDD.md](SDD.md) | Architecture and implementation details |
26+
| [VOYAGE_REPORT.md](VOYAGE_REPORT.md) | Narrative summary of implementation and evidence |
27+
| [COMPLIANCE_REPORT.md](COMPLIANCE_REPORT.md) | Traceability matrix and verification proof |
2528
<!-- END DOCUMENTS -->
2629

2730
## Stories
2831

2932
<!-- BEGIN GENERATED -->
30-
**Progress:** 2/3 stories complete
33+
**Progress:** 3/3 stories complete
3134

3235
| Title | Type | Status |
3336
|-------|------|--------|
3437
| [Surface Mission Stack In Turn Next And Mission Status](../../../../stories/VGe8Mf0Jg/README.md) | feat | done |
3538
| [Load Mission Stack Projection From Local Manifest](../../../../stories/VGe8MfYJW/README.md) | feat | done |
36-
| [Enforce Mission Stack Diagnostics And Foreign Worktree Guards](../../../../stories/VGe8Mg4Jj/README.md) | feat | backlog |
39+
| [Enforce Mission Stack Diagnostics And Foreign Worktree Guards](../../../../stories/VGe8Mg4Jj/README.md) | feat | done |
3740
<!-- END GENERATED -->
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# VOYAGE REPORT: Implement Mission Stack Context Surfaces
2+
3+
## Voyage Metadata
4+
- **ID:** VGe8Ad6Jy
5+
- **Epic:** VGe7mCcFW
6+
- **Status:** done
7+
- **Goal:** -
8+
9+
## Execution Summary
10+
**Progress:** 3/3 stories complete
11+
12+
## Implementation Narrative
13+
### Surface Mission Stack In Turn Next And Mission Status
14+
- **ID:** VGe8Mf0Jg
15+
- **Status:** done
16+
17+
#### Summary
18+
Thread the new Mission Stack projection through the canonical operator surfaces.
19+
`turn`, `next`, and `mission next --status` should explain local stack context,
20+
current gating, and cross-repo dependencies while staying unchanged when no
21+
stack is active.
22+
23+
#### Acceptance Criteria
24+
- [x] [SRS-02/AC-01] `keel turn` renders Mission Stack id, branch, member role, mode, checkpoint, and foreign-execution state in both text and JSON surfaces. <!-- verify: cargo test -p keel turn_surfaces_mission_stack_context_in_text_and_json, SRS-02:start:end, proof: ac-1.log -->
25+
- [x] [SRS-03/AC-01] `keel next` emits stack-aware block or yield decisions when local execution is forbidden by the active Mission Stack state. <!-- verify: cargo test -p keel next_emits_stack_aware_decisions, SRS-03:start:end, proof: ac-2.log -->
26+
- [x] [SRS-04/AC-01] `keel mission next --status` reports linked member missions, pending negotiations, and waiting receipts for the local stack. <!-- verify: cargo test -p keel mission_next_status_surfaces_stack_dependencies, SRS-04:start:end, proof: ac-3.log -->
27+
28+
#### Verified Evidence
29+
- [ac-1.log](../../../../stories/VGe8Mf0Jg/EVIDENCE/ac-1.log)
30+
- [ac-2.log](../../../../stories/VGe8Mf0Jg/EVIDENCE/ac-2.log)
31+
- [ac-3.log](../../../../stories/VGe8Mf0Jg/EVIDENCE/ac-3.log)
32+
33+
### Load Mission Stack Projection From Local Manifest
34+
- **ID:** VGe8MfYJW
35+
- **Status:** done
36+
37+
#### Summary
38+
Add the first repo-local Mission Stack read model. Keel should be able to load
39+
optional stack metadata from `.keel/stacks/<id>/manifest.yaml`, combine it with
40+
current git/worktree state, and produce a deterministic local projection for
41+
other adapters to consume without modifying the core board model.
42+
43+
#### Acceptance Criteria
44+
- [x] [SRS-01/AC-01] Keel loads a Mission Stack projection from repo-local manifest metadata and derives local member role, stack mode, checkpoint, linked missions, and receipt state. <!-- verify: cargo test mission_stack_loads_projection_from_manifest_and_git_state --lib, SRS-01:start, proof: ac-1.log -->
45+
- [x] [SRS-01/AC-02] The projection derives current branch and checkout/worktree metadata needed for later guardrails. <!-- verify: cargo test mission_stack_derives_branch_and_worktree_state --lib, SRS-01:end, proof: ac-2.log -->
46+
- [x] [SRS-NFR-01/AC-01] Repos without stack metadata remain a no-op and preserve current single-repo behavior. <!-- verify: cargo test mission_stack_absent_repo_is_noop --lib, SRS-NFR-01:start:end, proof: ac-3.log -->
47+
48+
#### Verified Evidence
49+
- [ac-1.log](../../../../stories/VGe8MfYJW/EVIDENCE/ac-1.log)
50+
- [ac-2.log](../../../../stories/VGe8MfYJW/EVIDENCE/ac-2.log)
51+
- [ac-3.log](../../../../stories/VGe8MfYJW/EVIDENCE/ac-3.log)
52+
53+
### Enforce Mission Stack Diagnostics And Foreign Worktree Guards
54+
- **ID:** VGe8Mg4Jj
55+
- **Status:** done
56+
57+
#### Summary
58+
Add the first enforcement layer for Mission Stack protocol rules. `doctor`
59+
should diagnose wrong-branch, checkpoint, foreign-worktree, and stack-close
60+
leftover violations, and execution surfaces should refuse unsupported foreign
61+
checkout paths instead of silently proceeding.
62+
63+
#### Acceptance Criteria
64+
- [x] [SRS-05/AC-01] `keel doctor` reports Mission Stack violations for wrong branch, missing checkpoint acknowledgment, and unsupported foreign execution state. <!-- verify: cargo test -p keel doctor_reports_mission_stack_violations, SRS-05:start, proof: ac-1.log -->
65+
- [x] [SRS-05/AC-02] Closed stacks with leftover managed foreign worktrees are reported conservatively instead of being deleted automatically. <!-- verify: cargo test -p keel doctor_reports_closed_stack_worktree_leftovers, SRS-05:end, proof: ac-2.log -->
66+
- [x] [SRS-06/AC-01] Stack-aware adapter output exposes deterministic machine-readable fields for Mission Stack context and gating decisions. <!-- verify: cargo test -p keel mission_stack_surfaces_expose_deterministic_json, SRS-06:start:end, proof: ac-3.log -->
67+
- [x] [SRS-NFR-02/AC-01] Stack-aware surfaces preserve repo-local heartbeat semantics and do not redefine pacemaker state. <!-- verify: cargo test -p keel mission_stack_surfaces_preserve_heartbeat_semantics, SRS-NFR-02:start:end, proof: ac-4.log -->
68+
- [x] [SRS-NFR-03/AC-01] Foreign-worktree guardrails fail safe by blocking unsupported execution without mutating uncertain checkouts. <!-- verify: cargo test -p keel mission_stack_guardrails_fail_safe, SRS-NFR-03:start:end, proof: ac-5.log -->
69+
70+
#### Verified Evidence
71+
- [ac-1.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-1.log)
72+
- [ac-2.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-2.log)
73+
- [ac-3.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-3.log)
74+
- [ac-4.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-4.log)
75+
- [ac-5.log](../../../../stories/VGe8Mg4Jj/EVIDENCE/ac-5.log)
76+
77+

.keel/missions/VGe7lZu9k/LOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,11 @@ Opened the execution mission for Mission Stack protocol work, planned voyage VGe
1010
## 2026-04-12T22:58:08
1111

1212
Completed story VGe8Mf0Jg by threading Mission Stack context into turn, next, and mission next. Added shared stack execution-gate logic, stack-aware yield/block decisions, and operator status surfaces with acceptance tests.
13+
14+
## 2026-04-12T23:09:38
15+
16+
Completed story VGe8Mg4Jj by adding Mission Stack workflow doctor checks, conservative closed-stack worktree warnings, heartbeat invariant coverage, deterministic JSON contract tests, and fail-safe foreign worktree blocking.
17+
18+
## 2026-04-12T23:10:20
19+
20+
Mission achieved by local system user 'alex'

.keel/missions/VGe7lZu9k/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
22
# system-managed
33
id: VGe7lZu9k
4-
status: active
4+
status: achieved
55
created_at: 2026-04-12T22:32:13
6-
updated_at: 2026-04-12T22:35:44
6+
updated_at: 2026-04-12T23:10:20
77
# authored
88
title: Implement Mission Stack Protocol
99
watch: ~
1010
activated_at: 2026-04-12T22:35:44
11+
achieved_at: 2026-04-12T23:10:20
1112
---
1213

1314
# Implement Mission Stack Protocol
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
recorded_at: 2026-04-12T23:06:05.173131560-07:00
3+
command: cargo test -p keel doctor_reports_mission_stack_violations -- --nocapture
4+
---
5+
6+
running 1 test
7+
test cli::commands::diagnostics::doctor::tests::doctor_reports_mission_stack_violations ... ok
8+
9+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 798 filtered out; finished in 16.44s
10+
11+
12+
--- stderr ---
13+
Compiling ring v0.17.14
14+
Compiling rustls v0.23.37
15+
Compiling rustls-webpki v0.103.11
16+
Compiling tokio-rustls v0.26.4
17+
Compiling hyper-rustls v0.27.8
18+
Compiling reqwest v0.12.28
19+
Compiling keel v0.2.1 (/home/alex/workspace/spoke-sh/keel/crates/keel-cli)
20+
Finished `test` profile [unoptimized + debuginfo] target(s) in 8.42s
21+
Running unittests src/main.rs (/home/alex/.cache/cargo-target/keel/debug/deps/keel-2e86119e532f3d98)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
recorded_at: 2026-04-12T23:06:37.172008120-07:00
3+
command: cargo test -p keel doctor_reports_closed_stack_worktree_leftovers -- --nocapture
4+
---
5+
6+
running 1 test
7+
test cli::commands::diagnostics::doctor::tests::doctor_reports_closed_stack_worktree_leftovers ... ok
8+
9+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 798 filtered out; finished in 16.61s
10+
11+
12+
--- stderr ---
13+
Compiling ring v0.17.14
14+
Compiling rustls v0.23.37
15+
Compiling rustls-webpki v0.103.11
16+
Compiling tokio-rustls v0.26.4
17+
Compiling hyper-rustls v0.27.8
18+
Compiling reqwest v0.12.28
19+
Compiling keel v0.2.1 (/home/alex/workspace/spoke-sh/keel/crates/keel-cli)
20+
Finished `test` profile [unoptimized + debuginfo] target(s) in 8.37s
21+
Running unittests src/main.rs (/home/alex/.cache/cargo-target/keel/debug/deps/keel-2e86119e532f3d98)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
recorded_at: 2026-04-12T23:06:48.571357154-07:00
3+
command: cargo test -p keel mission_stack_surfaces_expose_deterministic_json -- --nocapture
4+
---
5+
6+
running 1 test
7+
test cli::commands::diagnostics::turn::tests::mission_stack_surfaces_expose_deterministic_json ... ok
8+
9+
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 798 filtered out; finished in 0.04s
10+
11+
12+
--- stderr ---
13+
Compiling ring v0.17.14
14+
Compiling rustls v0.23.37
15+
Compiling rustls-webpki v0.103.11
16+
Compiling tokio-rustls v0.26.4
17+
Compiling hyper-rustls v0.27.8
18+
Compiling reqwest v0.12.28
19+
Compiling keel v0.2.1 (/home/alex/workspace/spoke-sh/keel/crates/keel-cli)
20+
Finished `test` profile [unoptimized + debuginfo] target(s) in 8.41s
21+
Running unittests src/main.rs (/home/alex/.cache/cargo-target/keel/debug/deps/keel-2e86119e532f3d98)

0 commit comments

Comments
 (0)