Complete step476 phase23a integration and summary
This commit is contained in:
@@ -3163,4 +3163,13 @@ target_link_libraries(step475_test PRIVATE
|
||||
tree_sitter_javascript tree_sitter_typescript
|
||||
tree_sitter_java tree_sitter_rust tree_sitter_go)
|
||||
|
||||
add_executable(step476_test tests/step476_test.cpp)
|
||||
target_include_directories(step476_test PRIVATE src)
|
||||
target_link_libraries(step476_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)
|
||||
|
||||
148
editor/tests/step476_test.cpp
Normal file
148
editor/tests/step476_test.cpp
Normal file
@@ -0,0 +1,148 @@
|
||||
// Step 476: Phase 23a Integration Tests (8 tests)
|
||||
|
||||
#include "ArchitectReviewInterface.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
|
||||
struct WorkflowTask {
|
||||
std::string moduleName;
|
||||
std::string functionName;
|
||||
};
|
||||
|
||||
static std::vector<WorkflowTask> createWorkflow(const SkeletonProjectSpec& sk) {
|
||||
std::vector<WorkflowTask> tasks;
|
||||
for (const auto& m : sk.modules) {
|
||||
for (const auto& f : m.functions) {
|
||||
tasks.push_back({m.moduleName, f.name});
|
||||
}
|
||||
}
|
||||
return tasks;
|
||||
}
|
||||
|
||||
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 ArchitectReviewState runFlow(const std::string& prompt) {
|
||||
auto req = ArchitectProblemParser::parse(prompt);
|
||||
auto graph = ArchitectModuleDecomposer::decompose(req, DecompositionStrategy::Layered);
|
||||
auto stack = ArchitectTechStackSelector::select(req, graph);
|
||||
auto sk = ArchitectSkeletonGenerator::generate(req, graph, stack);
|
||||
return ArchitectReviewInterface::initialize(sk, stack, graph);
|
||||
}
|
||||
|
||||
void test_full_flow_extracts_structured_requirements() {
|
||||
TEST(full_flow_extracts_structured_requirements);
|
||||
auto req = ArchitectProblemParser::parse(
|
||||
"Build a REST API for a bookstore with user auth, PostgreSQL, and a React web frontend.");
|
||||
CHECK(!req.functionalRequirements.empty(), "missing functional requirements");
|
||||
CHECK(!req.integrationRequirements.empty(), "missing integration requirements");
|
||||
CHECK(!req.platformConstraints.empty(), "missing platform requirements");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_full_flow_decomposes_expected_modules() {
|
||||
TEST(full_flow_decomposes_expected_modules);
|
||||
auto req = ArchitectProblemParser::parse(
|
||||
"Build a REST API for a bookstore with user auth, PostgreSQL, and a React web frontend.");
|
||||
auto g = ArchitectModuleDecomposer::decompose(req, DecompositionStrategy::Layered);
|
||||
CHECK(g.hasModule("api"), "missing api module");
|
||||
CHECK(g.hasModule("auth"), "missing auth module");
|
||||
CHECK(g.hasModule("data"), "missing data module");
|
||||
CHECK(g.hasModule("ui"), "missing ui module");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_full_flow_stack_selects_frontend_and_database() {
|
||||
TEST(full_flow_stack_selects_frontend_and_database);
|
||||
auto req = ArchitectProblemParser::parse(
|
||||
"Build a REST API for a bookstore with user auth, PostgreSQL, and a React web frontend.");
|
||||
auto g = ArchitectModuleDecomposer::decompose(req, DecompositionStrategy::Layered);
|
||||
auto stack = ArchitectTechStackSelector::select(req, g);
|
||||
auto ui = stack.getChoice("ui");
|
||||
auto data = stack.getChoice("data");
|
||||
CHECK(ui.language == "typescript", "expected typescript frontend");
|
||||
CHECK(ui.framework == "react", "expected react framework");
|
||||
CHECK(data.database == "postgresql", "expected postgresql");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_full_flow_generates_skeleton_modules_and_annotations() {
|
||||
TEST(full_flow_generates_skeleton_modules_and_annotations);
|
||||
auto st = runFlow(
|
||||
"Build a REST API for a bookstore with user auth, PostgreSQL, and a React web frontend.");
|
||||
CHECK(st.skeleton.hasModule("api"), "missing api skeleton module");
|
||||
auto api = st.skeleton.getModule("api");
|
||||
CHECK(!api.functions.empty(), "missing api functions");
|
||||
bool hasIntent = false, hasContract = false;
|
||||
for (const auto& a : api.functions[0].annotations) {
|
||||
if (a.key == "@Intent") hasIntent = true;
|
||||
if (a.key == "@Contract") hasContract = true;
|
||||
}
|
||||
CHECK(hasIntent && hasContract, "missing key annotations");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_architect_review_can_modify_and_approve() {
|
||||
TEST(architect_review_can_modify_and_approve);
|
||||
auto st = runFlow(
|
||||
"Build a REST API for a bookstore with user auth, PostgreSQL, and a React web frontend.");
|
||||
bool changed = ArchitectReviewInterface::changeModuleLanguage(st, "api", "go");
|
||||
CHECK(changed, "expected language change");
|
||||
ArchitectReviewInterface::approve(st);
|
||||
CHECK(st.approved, "expected approved state");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_workflow_created_after_approval() {
|
||||
TEST(workflow_created_after_approval);
|
||||
auto st = runFlow(
|
||||
"Build a REST API for a bookstore with user auth, PostgreSQL, and a React web frontend.");
|
||||
ArchitectReviewInterface::approve(st);
|
||||
auto tasks = createWorkflow(st.skeleton);
|
||||
CHECK(st.approved, "expected approved state");
|
||||
CHECK(!tasks.empty(), "expected workflow tasks");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_dependency_graph_available_in_review_snapshot() {
|
||||
TEST(dependency_graph_available_in_review_snapshot);
|
||||
auto st = runFlow(
|
||||
"Build a REST API for a bookstore with user auth, PostgreSQL, and a React web frontend.");
|
||||
auto snap = ArchitectReviewInterface::snapshot(st);
|
||||
CHECK(!snap.dependencyGraph.empty(), "expected dependency graph");
|
||||
CHECK(!snap.modules.empty(), "expected module summaries");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_end_to_end_flow_keeps_review_structured_for_mcp() {
|
||||
TEST(end_to_end_flow_keeps_review_structured_for_mcp);
|
||||
auto st = runFlow(
|
||||
"Build a REST API for a bookstore with user auth, PostgreSQL, and a React web frontend.");
|
||||
auto snap = ArchitectReviewInterface::snapshot(st);
|
||||
bool hasStackRationale = !snap.stackRationales.empty();
|
||||
bool hasModuleSummary = !snap.modules.empty();
|
||||
CHECK(hasStackRationale, "expected stack rationale entries");
|
||||
CHECK(hasModuleSummary, "expected module summary entries");
|
||||
PASS();
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::cout << "Step 476: Phase 23a Integration Tests\n";
|
||||
|
||||
test_full_flow_extracts_structured_requirements(); // 1
|
||||
test_full_flow_decomposes_expected_modules(); // 2
|
||||
test_full_flow_stack_selects_frontend_and_database(); // 3
|
||||
test_full_flow_generates_skeleton_modules_and_annotations();// 4
|
||||
test_architect_review_can_modify_and_approve(); // 5
|
||||
test_workflow_created_after_approval(); // 6
|
||||
test_dependency_graph_available_in_review_snapshot(); // 7
|
||||
test_end_to_end_flow_keeps_review_structured_for_mcp(); // 8
|
||||
|
||||
std::cout << "\nResults: " << passed << "/" << (passed + failed)
|
||||
<< " passed\n";
|
||||
return failed == 0 ? 0 : 1;
|
||||
}
|
||||
43
progress.md
43
progress.md
@@ -6620,3 +6620,46 @@ adjustment, approval).
|
||||
**Architecture gate check:**
|
||||
- `editor/src/ArchitectReviewInterface.h` within header-size limit (`231` <= `600`)
|
||||
- `editor/tests/step475_test.cpp` within test-file size guidance (`171` lines)
|
||||
|
||||
### Step 476: Phase 23a Integration
|
||||
**Status:** PASS (8/8 tests)
|
||||
|
||||
Adds full Phase 23a integration coverage for architect mode:
|
||||
problem description parsing → module decomposition → tech stack selection →
|
||||
skeleton generation → architect review/approval → workflow task materialization.
|
||||
|
||||
**Files added:**
|
||||
- `editor/tests/step476_test.cpp` — 8 integration tests covering:
|
||||
- end-to-end extraction/decomposition/selection flow for bookstore API scenario
|
||||
- frontend/database stack expectation checks
|
||||
- skeleton annotation presence checks
|
||||
- architect review modifications + approval
|
||||
- workflow task creation after approval
|
||||
- dependency graph and structured review snapshot checks
|
||||
- `editor/CMakeLists.txt` — `step476_test` target
|
||||
|
||||
**Verification run:**
|
||||
- `cmake --build editor/build-native --target step476_test` — PASS
|
||||
- `./editor/build-native/step476_test` — PASS (8/8)
|
||||
- `./editor/build-native/step475_test` — PASS (12/12) regression coverage
|
||||
|
||||
**Architecture gate check:**
|
||||
- `editor/tests/step476_test.cpp` within test-file size guidance (`148` lines)
|
||||
- No new production header introduced in this integration step
|
||||
|
||||
**Phase 23a totals (471-476):**
|
||||
- **Steps:** 6
|
||||
- **Tests:** 68/68 passing
|
||||
- **Headers added:** 5
|
||||
- `ArchitectProblemParser.h`
|
||||
- `ArchitectModuleDecomposer.h`
|
||||
- `ArchitectTechStackSelector.h`
|
||||
- `ArchitectSkeletonGenerator.h`
|
||||
- `ArchitectReviewInterface.h`
|
||||
- **Capabilities delivered:**
|
||||
- natural-language requirement extraction with confidence
|
||||
- strategy-aware module decomposition graph generation
|
||||
- per-module tech stack selection with preference overrides
|
||||
- annotated multi-module skeleton generation
|
||||
- architect review/modify/approve state model
|
||||
- end-to-end architect-mode flow readiness for phase 23b scaffolding
|
||||
|
||||
Reference in New Issue
Block a user