Step 587: add guided architect execution demo mode
This commit is contained in:
@@ -4162,4 +4162,13 @@ target_link_libraries(step586_test PRIVATE
|
||||
tree_sitter_javascript tree_sitter_typescript
|
||||
tree_sitter_java tree_sitter_rust tree_sitter_go)
|
||||
|
||||
add_executable(step587_test tests/step587_test.cpp)
|
||||
target_include_directories(step587_test PRIVATE src)
|
||||
target_link_libraries(step587_test PRIVATE
|
||||
nlohmann_json::nlohmann_json
|
||||
unofficial::tree-sitter::tree-sitter
|
||||
tree_sitter_python tree_sitter_cpp tree_sitter_elisp
|
||||
tree_sitter_javascript tree_sitter_typescript
|
||||
tree_sitter_java tree_sitter_rust tree_sitter_go)
|
||||
|
||||
# Step 12: Dear ImGui shell scaffolding created (main.cpp exists but not built due to dependencies)
|
||||
|
||||
95
editor/src/GuidedArchitectExecutionDemoMode.h
Normal file
95
editor/src/GuidedArchitectExecutionDemoMode.h
Normal file
@@ -0,0 +1,95 @@
|
||||
#pragma once
|
||||
// Step 587: Guided Architect-to-Execution Demo Mode
|
||||
|
||||
#include "IntakeToQueueSimulationHarness.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
enum class DemoStage {
|
||||
NotStarted,
|
||||
Intake,
|
||||
Review,
|
||||
Queue,
|
||||
ConstrainedEdits,
|
||||
Verification,
|
||||
Complete
|
||||
};
|
||||
|
||||
struct DemoModeState {
|
||||
DemoStage stage = DemoStage::NotStarted;
|
||||
bool active = false;
|
||||
IntakeQueueSimulationResult simulation;
|
||||
std::vector<std::string> timeline;
|
||||
};
|
||||
|
||||
class GuidedArchitectExecutionDemoMode {
|
||||
public:
|
||||
static bool start(const IntakeQueueSimulationInput& input,
|
||||
DemoModeState* state,
|
||||
std::string* error) {
|
||||
if (!state || !error) return false;
|
||||
error->clear();
|
||||
state->simulation = IntakeToQueueSimulationHarness::run(input);
|
||||
state->stage = DemoStage::Intake;
|
||||
state->active = true;
|
||||
state->timeline.clear();
|
||||
state->timeline.push_back("stage:intake");
|
||||
if (!state->simulation.ok) return fail(error, "simulation_failed");
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool advance(DemoModeState* state, std::string* error) {
|
||||
if (!state || !error) return false;
|
||||
error->clear();
|
||||
if (!state->active) return fail(error, "demo_inactive");
|
||||
|
||||
if (state->stage == DemoStage::Intake) {
|
||||
state->stage = DemoStage::Review;
|
||||
state->timeline.push_back("stage:review");
|
||||
return true;
|
||||
}
|
||||
if (state->stage == DemoStage::Review) {
|
||||
state->stage = DemoStage::Queue;
|
||||
state->timeline.push_back("stage:queue");
|
||||
return true;
|
||||
}
|
||||
if (state->stage == DemoStage::Queue) {
|
||||
if (state->simulation.queuedCount == 0) return fail(error, "queue_empty");
|
||||
state->stage = DemoStage::ConstrainedEdits;
|
||||
state->timeline.push_back("stage:constrained_edits");
|
||||
return true;
|
||||
}
|
||||
if (state->stage == DemoStage::ConstrainedEdits) {
|
||||
state->stage = DemoStage::Verification;
|
||||
state->timeline.push_back("stage:verification");
|
||||
return true;
|
||||
}
|
||||
if (state->stage == DemoStage::Verification) {
|
||||
state->stage = DemoStage::Complete;
|
||||
state->active = false;
|
||||
state->timeline.push_back("stage:complete");
|
||||
return true;
|
||||
}
|
||||
return fail(error, "demo_already_complete");
|
||||
}
|
||||
|
||||
static float completionFraction(const DemoModeState& state) {
|
||||
switch (state.stage) {
|
||||
case DemoStage::NotStarted: return 0.0f;
|
||||
case DemoStage::Intake: return 0.2f;
|
||||
case DemoStage::Review: return 0.4f;
|
||||
case DemoStage::Queue: return 0.6f;
|
||||
case DemoStage::ConstrainedEdits: return 0.8f;
|
||||
case DemoStage::Verification: return 0.9f;
|
||||
case DemoStage::Complete: return 1.0f;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
private:
|
||||
static bool fail(std::string* error, const char* code) {
|
||||
*error = code;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
182
editor/tests/step587_test.cpp
Normal file
182
editor/tests/step587_test.cpp
Normal file
@@ -0,0 +1,182 @@
|
||||
// Step 587: Guided Architect-to-Execution Demo Mode (12 tests)
|
||||
|
||||
#include "GuidedArchitectExecutionDemoMode.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
static int passed = 0, failed = 0;
|
||||
#define TEST(name) { std::cout << " " << #name << "... "; }
|
||||
#define PASS() { std::cout << "PASS\n"; ++passed; }
|
||||
#define FAIL(msg) { std::cout << "FAIL: " << msg << "\n"; ++failed; }
|
||||
#define CHECK(cond, msg) if (!(cond)) { FAIL(msg); return; } else {}
|
||||
|
||||
static IntakeQueueSimulationInput validInput() {
|
||||
IntakeQueueSimulationInput input;
|
||||
input.markdown = R"(## Goals
|
||||
- Improve intake quality
|
||||
## Constraints
|
||||
- Enable deterministic parser behavior
|
||||
## Dependencies
|
||||
- CMake
|
||||
## Acceptance Criteria
|
||||
- Queue includes bound acceptance checks
|
||||
)";
|
||||
return input;
|
||||
}
|
||||
|
||||
void test_start_success() {
|
||||
TEST(start_success);
|
||||
DemoModeState state;
|
||||
std::string error;
|
||||
CHECK(GuidedArchitectExecutionDemoMode::start(validInput(), &state, &error), "start should succeed");
|
||||
CHECK(state.active, "demo should be active");
|
||||
CHECK(state.stage == DemoStage::Intake, "initial stage mismatch");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_start_fails_when_simulation_fails() {
|
||||
TEST(start_fails_when_simulation_fails);
|
||||
DemoModeState state;
|
||||
std::string error;
|
||||
auto bad = validInput();
|
||||
bad.markdown = "";
|
||||
CHECK(!GuidedArchitectExecutionDemoMode::start(bad, &state, &error), "start should fail");
|
||||
CHECK(error == "simulation_failed", "wrong error");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_advance_intake_to_review() {
|
||||
TEST(advance_intake_to_review);
|
||||
DemoModeState state;
|
||||
std::string error;
|
||||
CHECK(GuidedArchitectExecutionDemoMode::start(validInput(), &state, &error), "start failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance failed");
|
||||
CHECK(state.stage == DemoStage::Review, "stage should be review");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_advance_review_to_queue() {
|
||||
TEST(advance_review_to_queue);
|
||||
DemoModeState state;
|
||||
std::string error;
|
||||
CHECK(GuidedArchitectExecutionDemoMode::start(validInput(), &state, &error), "start failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 1 failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 2 failed");
|
||||
CHECK(state.stage == DemoStage::Queue, "stage should be queue");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_queue_stage_requires_non_empty_queue() {
|
||||
TEST(queue_stage_requires_non_empty_queue);
|
||||
DemoModeState state;
|
||||
std::string error;
|
||||
CHECK(GuidedArchitectExecutionDemoMode::start(validInput(), &state, &error), "start failed");
|
||||
state.simulation.queuedCount = 0;
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance to review failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance to queue failed");
|
||||
CHECK(!GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance to constrained edits should fail");
|
||||
CHECK(error == "queue_empty", "wrong error");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_advance_queue_to_constrained_edits() {
|
||||
TEST(advance_queue_to_constrained_edits);
|
||||
DemoModeState state;
|
||||
std::string error;
|
||||
CHECK(GuidedArchitectExecutionDemoMode::start(validInput(), &state, &error), "start failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 1 failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 2 failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 3 failed");
|
||||
CHECK(state.stage == DemoStage::ConstrainedEdits, "stage should be constrained edits");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_advance_to_verification() {
|
||||
TEST(advance_to_verification);
|
||||
DemoModeState state;
|
||||
std::string error;
|
||||
CHECK(GuidedArchitectExecutionDemoMode::start(validInput(), &state, &error), "start failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 1 failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 2 failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 3 failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 4 failed");
|
||||
CHECK(state.stage == DemoStage::Verification, "stage should be verification");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_advance_verification_to_complete_deactivates() {
|
||||
TEST(advance_verification_to_complete_deactivates);
|
||||
DemoModeState state;
|
||||
std::string error;
|
||||
CHECK(GuidedArchitectExecutionDemoMode::start(validInput(), &state, &error), "start failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 1 failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 2 failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 3 failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 4 failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance 5 failed");
|
||||
CHECK(state.stage == DemoStage::Complete, "stage should be complete");
|
||||
CHECK(!state.active, "demo should deactivate");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_advance_fails_when_inactive() {
|
||||
TEST(advance_fails_when_inactive);
|
||||
DemoModeState state;
|
||||
std::string error;
|
||||
CHECK(!GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance should fail");
|
||||
CHECK(error == "demo_inactive", "wrong error");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_completion_fraction_increases_by_stage() {
|
||||
TEST(completion_fraction_increases_by_stage);
|
||||
DemoModeState state;
|
||||
std::string error;
|
||||
CHECK(GuidedArchitectExecutionDemoMode::start(validInput(), &state, &error), "start failed");
|
||||
const float intake = GuidedArchitectExecutionDemoMode::completionFraction(state);
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance failed");
|
||||
const float review = GuidedArchitectExecutionDemoMode::completionFraction(state);
|
||||
CHECK(review > intake, "completion should increase");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_timeline_records_stage_transitions() {
|
||||
TEST(timeline_records_stage_transitions);
|
||||
DemoModeState state;
|
||||
std::string error;
|
||||
CHECK(GuidedArchitectExecutionDemoMode::start(validInput(), &state, &error), "start failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance failed");
|
||||
CHECK(GuidedArchitectExecutionDemoMode::advance(&state, &error), "advance failed");
|
||||
CHECK(state.timeline.size() == 3, "timeline size mismatch");
|
||||
CHECK(state.timeline[0] == "stage:intake", "timeline intake missing");
|
||||
CHECK(state.timeline[2] == "stage:queue", "timeline queue missing");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_complete_stage_returns_full_fraction() {
|
||||
TEST(complete_stage_returns_full_fraction);
|
||||
DemoModeState state;
|
||||
state.stage = DemoStage::Complete;
|
||||
CHECK(GuidedArchitectExecutionDemoMode::completionFraction(state) == 1.0f, "complete fraction should be 1.0");
|
||||
PASS();
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::cout << "Step 587: Guided Architect-to-Execution Demo Mode\n";
|
||||
|
||||
test_start_success(); // 1
|
||||
test_start_fails_when_simulation_fails(); // 2
|
||||
test_advance_intake_to_review(); // 3
|
||||
test_advance_review_to_queue(); // 4
|
||||
test_queue_stage_requires_non_empty_queue(); // 5
|
||||
test_advance_queue_to_constrained_edits(); // 6
|
||||
test_advance_to_verification(); // 7
|
||||
test_advance_verification_to_complete_deactivates();// 8
|
||||
test_advance_fails_when_inactive(); // 9
|
||||
test_completion_fraction_increases_by_stage(); // 10
|
||||
test_timeline_records_stage_transitions(); // 11
|
||||
test_complete_stage_returns_full_fraction(); // 12
|
||||
|
||||
std::cout << "\nResults: " << passed << "/" << (passed + failed) << " passed\n";
|
||||
return failed == 0 ? 0 : 1;
|
||||
}
|
||||
35
progress.md
35
progress.md
@@ -11054,3 +11054,38 @@ operation counts, and contextual recommendations.
|
||||
- `editor/src/CapabilityDiscoveryPanels.h` within header-size limit (`86` <= `600`)
|
||||
- `editor/tests/step586_test.cpp` within test-file size guidance (`150` lines)
|
||||
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`
|
||||
|
||||
### Step 587: Guided Architect-to-Execution Demo Mode
|
||||
**Status:** PASS (12/12 tests)
|
||||
|
||||
Implements a guided demo state machine that walks users through intake,
|
||||
review, queue, constrained edits, and verification stages.
|
||||
|
||||
**Files added:**
|
||||
- `editor/src/GuidedArchitectExecutionDemoMode.h` - demo mode module:
|
||||
- simulation-backed demo initialization
|
||||
- staged progression with gate checks
|
||||
- queue readiness enforcement before constrained edits
|
||||
- completion fraction reporting
|
||||
- stage timeline capture for demo narration
|
||||
- `editor/tests/step587_test.cpp` - 12 tests covering:
|
||||
- start success/failure behavior
|
||||
- stage-by-stage advancement behavior
|
||||
- queue gate failure behavior
|
||||
- completion/deactivation behavior
|
||||
- progress fraction behavior
|
||||
- timeline capture behavior
|
||||
|
||||
**Files modified:**
|
||||
- `editor/CMakeLists.txt` - `step587_test` target
|
||||
|
||||
**Verification run:**
|
||||
- `cmake -S editor -B editor/build-native` - PASS
|
||||
- `cmake --build editor/build-native --target step587_test step586_test` - PASS
|
||||
- `./editor/build-native/step587_test` - PASS (12/12)
|
||||
- `./editor/build-native/step586_test` - PASS (12/12) regression coverage
|
||||
|
||||
**Architecture gate check:**
|
||||
- `editor/src/GuidedArchitectExecutionDemoMode.h` within header-size limit (`95` <= `600`)
|
||||
- `editor/tests/step587_test.cpp` within test-file size guidance (`182` lines)
|
||||
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`
|
||||
|
||||
Reference in New Issue
Block a user