Step 633: Sprint 37 integration summary

This commit is contained in:
Bill
2026-02-17 21:29:33 -07:00
parent 9373b604dd
commit b5f03bd7ae
4 changed files with 255 additions and 0 deletions

View File

@@ -4576,4 +4576,13 @@ target_link_libraries(step632_test PRIVATE
tree_sitter_javascript tree_sitter_typescript
tree_sitter_java tree_sitter_rust tree_sitter_go)
add_executable(step633_test tests/step633_test.cpp)
target_include_directories(step633_test PRIVATE src)
target_link_libraries(step633_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)

View File

@@ -0,0 +1,104 @@
#pragma once
// Step 633: Sprint 37 integration + summary
#include "AgentChatContextInjector.h"
#include "AgentChatPanelModel.h"
#include "AgentChatSessionPersistence.h"
#include "AgentMutationApproval.h"
#include "AgentTaskSlots.h"
#include "AgentTaskStatusOverlay.h"
#include <string>
struct Sprint37IntegrationResult {
bool chatPanelOpened = false;
bool contextInjected = false;
bool userMessageSent = false;
bool taskQueued = false;
bool overlayVisible = false;
bool previewShown = false;
bool mutationAccepted = false;
bool codeUpdated = false;
bool sessionSaved = false;
bool sessionRestored = false;
int runningTasks = 0;
int pendingTasks = 0;
std::size_t restoredMessageCount = 0;
std::string activeCode;
};
class Sprint37IntegrationSummary {
public:
static Sprint37IntegrationResult run(const std::string& workspaceRoot,
const std::string& projectFile,
const std::string& taskDescription,
const std::string& beforeCode,
const std::string& generatedRust,
const std::string& generatedCpp) {
Sprint37IntegrationResult out;
AgentChatState chat;
AgentTaskSlotsState slots;
out.chatPanelOpened = true;
AgentChatRuntimeSnapshot snapshot;
snapshot.activeFile = projectFile;
snapshot.language = "rust";
snapshot.astNodeCount = 42;
snapshot.openAnnotationCount = 3;
snapshot.workspacePath = workspaceRoot.empty() ? "." : workspaceRoot;
AgentChatContextInjector::inject(&chat, snapshot, "t0");
out.contextInjected = !chat.systemContext.empty() && !chat.messages.empty();
chat.draftInput = taskDescription;
out.userMessageSent = AgentChatPanelModel::sendUserMessage(&chat, "t1");
std::string taskId = AgentTaskSlots::enqueueTask(&slots, taskDescription);
out.taskQueued = !taskId.empty();
(void)AgentTaskSlots::assignPendingToSlotsAt(&slots, 100);
(void)AgentTaskSlots::updateTaskProgress(&slots, taskId, 2, "generate drone/nexus modules");
AgentTaskStatusSummary summary = AgentTaskStatusOverlay::buildSummary(slots);
out.overlayVisible = summary.hasWork;
out.runningTasks = summary.running;
out.pendingTasks = summary.pending;
std::string generatedCode = "// Rust\n" + generatedRust + "\n// C++\n" + generatedCpp;
AgentChatPanelModel::addToolCall(&chat,
"whetstone_generate_code",
{{"task", taskDescription}},
{{"rust", generatedRust}, {"cpp", generatedCpp}},
"t2");
AgentChatPanelModel::addMutationPreview(&chat,
"preview-37",
"{\"type\":\"replaceModule\"}",
beforeCode,
generatedCode,
"t3");
out.previewShown = !chat.mutationPreviews.empty();
out.mutationAccepted = AgentMutationApproval::accept(&chat.mutationApprovals, "preview-37");
out.activeCode = beforeCode;
if (out.mutationAccepted) {
out.activeCode = generatedCode;
out.codeUpdated = true;
}
std::string saveError;
out.sessionSaved = AgentChatSessionPersistence::saveSession(workspaceRoot,
projectFile,
"sprint37-demo",
chat,
&saveError);
AgentChatSavedSession loaded;
std::string loadError;
out.sessionRestored = AgentChatSessionPersistence::loadLatestSession(workspaceRoot,
projectFile,
&loaded,
&loadError);
if (out.sessionRestored) {
out.restoredMessageCount = loaded.chat.messages.size();
}
return out;
}
};

View File

@@ -0,0 +1,109 @@
// Step 633: Sprint 37 integration + summary (8 tests)
#include "Sprint37IntegrationSummary.h"
#include <filesystem>
#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 std::string testWorkspace() {
return "/tmp/whetstone_step633_workspace";
}
static Sprint37IntegrationResult runScenario() {
const std::string workspace = testWorkspace();
std::filesystem::remove_all(workspace);
std::filesystem::create_directories(workspace);
return Sprint37IntegrationSummary::run(
workspace,
"hivemind/bs_s1_01.whet",
"BS-S1-01: generate drone and nexus modules",
"module Drone {}\nmodule Nexus {}\n",
"pub struct Drone;",
"struct Nexus {};"
);
}
void test_chat_panel_marked_open() {
TEST(chat_panel_marked_open);
auto result = runScenario();
CHECK(result.chatPanelOpened, "chat panel should be marked open");
PASS();
}
void test_context_is_injected_on_start() {
TEST(context_is_injected_on_start);
auto result = runScenario();
CHECK(result.contextInjected, "context should be injected");
PASS();
}
void test_user_task_description_is_sent() {
TEST(user_task_description_is_sent);
auto result = runScenario();
CHECK(result.userMessageSent, "user message should be sent");
PASS();
}
void test_background_task_is_running_and_overlay_visible() {
TEST(background_task_is_running_and_overlay_visible);
auto result = runScenario();
CHECK(result.taskQueued, "task should be queued");
CHECK(result.overlayVisible, "overlay should be visible");
CHECK(result.runningTasks == 1, "running task count mismatch");
CHECK(result.pendingTasks == 0, "pending task count mismatch");
PASS();
}
void test_mutation_preview_is_present() {
TEST(mutation_preview_is_present);
auto result = runScenario();
CHECK(result.previewShown, "preview should be shown");
PASS();
}
void test_mutation_accept_path_is_successful() {
TEST(mutation_accept_path_is_successful);
auto result = runScenario();
CHECK(result.mutationAccepted, "mutation should be accepted");
PASS();
}
void test_code_updates_to_rust_and_cpp_output() {
TEST(code_updates_to_rust_and_cpp_output);
auto result = runScenario();
CHECK(result.codeUpdated, "code should be updated");
CHECK(result.activeCode.find("pub struct Drone;") != std::string::npos, "rust output missing");
CHECK(result.activeCode.find("struct Nexus {};") != std::string::npos, "c++ output missing");
PASS();
}
void test_session_is_saved_and_restored() {
TEST(session_is_saved_and_restored);
auto result = runScenario();
CHECK(result.sessionSaved, "session should be saved");
CHECK(result.sessionRestored, "session should be restored");
CHECK(result.restoredMessageCount >= 3, "restored message count should include context + chat");
PASS();
}
int main() {
std::cout << "Step 633: Sprint 37 integration + summary\n";
test_chat_panel_marked_open(); // 1
test_context_is_injected_on_start(); // 2
test_user_task_description_is_sent(); // 3
test_background_task_is_running_and_overlay_visible(); // 4
test_mutation_preview_is_present(); // 5
test_mutation_accept_path_is_successful(); // 6
test_code_updates_to_rust_and_cpp_output(); // 7
test_session_is_saved_and_restored(); // 8
std::cout << "\nResults: " << passed << "/" << (passed + failed) << " passed\n";
return failed == 0 ? 0 : 1;
}

View File

@@ -12746,3 +12746,36 @@ step, and per-task cancel action.
- `editor/src/panels/AgentChatPanel.h` (`208` <= `600`)
- `editor/tests/step632_test.cpp` within test-file size guidance (`193` lines)
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`
### Step 633: Sprint 37 Integration + Summary
**Status:** PASS (8/8 tests)
Adds a Sprint 37 end-to-end integration runner for the in-editor agent chat
flow: context injection, background slot scheduling, status overlay signal,
mutation preview acceptance, code update, and chat-session save/restore.
**Files added:**
- `editor/src/Sprint37IntegrationSummary.h` - integration runner:
- models the Sprint 37 demo path for a hivemind-style task prompt
- composes context injection, task-slot/overlay, mutation approval, and
session persistence
- returns summary signals for sprint-level readiness checks
- `editor/tests/step633_test.cpp` - 8 tests covering:
- chat/context bootstrapping and user-message send path
- background-task overlay state
- mutation preview/accept and code refresh behavior
- persistence save + latest-session restore behavior
**Files modified:**
- `editor/CMakeLists.txt` - `step633_test` target
**Verification run:**
- `cmake -S editor -B editor/build-native` - PASS
- `cmake --build editor/build-native --target step633_test step632_test` - PASS
- `./editor/build-native/step633_test` - PASS (8/8)
- `./editor/build-native/step632_test` - PASS (12/12) regression coverage
**Architecture gate check:**
- `editor/src/Sprint37IntegrationSummary.h` (`104` <= `600`)
- `editor/tests/step633_test.cpp` within test-file size guidance (`109` lines)
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`