Step 648: phase 39a integration

This commit is contained in:
Bill
2026-02-17 21:51:45 -07:00
parent c05e83ec75
commit 319b6734d0
4 changed files with 104 additions and 0 deletions

View File

@@ -4711,4 +4711,13 @@ target_link_libraries(step647_test PRIVATE
tree_sitter_javascript tree_sitter_typescript
tree_sitter_java tree_sitter_rust tree_sitter_go)
add_executable(step648_test tests/step648_test.cpp)
target_include_directories(step648_test PRIVATE src)
target_link_libraries(step648_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,49 @@
#pragma once
// Step 648: Phase 39a integration
#include "InEditorTestRunnerModel.h"
#include "ProjectAstCMakeGenerator.h"
#include "SelfHostingProjectConfig.h"
#include "SelfModificationSafetyGuard.h"
struct Phase39aIntegrationResult {
bool configLoaded = false;
bool cmakeGenerated = false;
bool testRunTriggered = false;
bool testRunComplete = false;
bool mutationBlocked = false;
bool safetyReasonPresent = false;
bool selfHostingReady = false;
bool integrationReady = false;
};
class Phase39aIntegration {
public:
static Phase39aIntegrationResult run() {
Phase39aIntegrationResult out;
SelfHostingProjectConfig cfg{"whetstone_DSL", "/workspace", {"editor/src"}, {"step648_test"}, true};
auto j = SelfHostingProjectConfigModel::toJson(cfg);
SelfHostingProjectConfig parsed;
std::string err;
out.configLoaded = SelfHostingProjectConfigModel::fromJson(j, &parsed, &err);
out.selfHostingReady = SelfHostingProjectConfigModel::canSelfHost(parsed);
ProjectAstDescription ast{"whetstone_editor", {"src/main.cpp"}, {"step648_test"}, {"nlohmann_json"}, true};
std::string cmake = ProjectAstCMakeGenerator::generate(ast);
out.cmakeGenerated = cmake.find("add_executable(whetstone_editor") != std::string::npos;
auto testSummary = InEditorTestRunnerModel::run({"step648_test"});
out.testRunTriggered = !testSummary.items.empty();
out.testRunComplete = testSummary.complete;
std::string reason;
out.mutationBlocked = !SelfModificationSafetyGuard::allowMutation("editor/src/main.cpp", {"editor/src"}, &reason);
out.safetyReasonPresent = !reason.empty();
out.integrationReady = out.configLoaded && out.cmakeGenerated && out.testRunTriggered &&
out.testRunComplete && out.mutationBlocked && out.safetyReasonPresent &&
out.selfHostingReady;
return out;
}
};

View File

@@ -0,0 +1,21 @@
// Step 648: Phase 39a integration (8 tests)
#include "Phase39aIntegration.h"
#include <iostream>
static int p=0,f=0;
#define T(n) { std::cout<<" "<<#n<<"... "; }
#define P() { std::cout<<"PASS\n"; ++p; }
#define F(m) { std::cout<<"FAIL: "<<m<<"\n"; ++f; }
#define C(c,m) if(!(c)){F(m);return;}
void t1(){T(config_loaded);auto r=Phase39aIntegration::run();C(r.configLoaded,"config");P();}
void t2(){T(cmake_generated);auto r=Phase39aIntegration::run();C(r.cmakeGenerated,"cmake");P();}
void t3(){T(test_run_triggered);auto r=Phase39aIntegration::run();C(r.testRunTriggered,"trigger");P();}
void t4(){T(test_run_complete);auto r=Phase39aIntegration::run();C(r.testRunComplete,"complete");P();}
void t5(){T(mutation_blocked_for_live_file);auto r=Phase39aIntegration::run();C(r.mutationBlocked,"blocked");P();}
void t6(){T(safety_reason_present);auto r=Phase39aIntegration::run();C(r.safetyReasonPresent,"reason");P();}
void t7(){T(self_hosting_ready);auto r=Phase39aIntegration::run();C(r.selfHostingReady,"self-host");P();}
void t8(){T(integration_ready_signal);auto r=Phase39aIntegration::run();C(r.integrationReady,"integration");P();}
int main(){std::cout<<"Step 648: Phase 39a integration\n";t1();t2();t3();t4();t5();t6();t7();t8();std::cout<<"\nResults: "<<p<<"/"<<(p+f)<<" passed\n";return f?1:0;}

View File

@@ -13276,3 +13276,28 @@ reason messaging and allow/block decision helpers for mutation requests.
- `editor/src/SelfModificationSafetyGuard.h` (`28` <= `600`)
- `editor/tests/step647_test.cpp` within test-file size guidance (`25` lines)
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`
### Step 648: Phase 39a Integration
**Status:** PASS (8/8 tests)
Integrates self-hosting config load, AST-driven CMake generation, in-editor
test runner execution, and live-binary mutation blocking into one Phase 39a
readiness signal.
**Files added:**
- `editor/src/Phase39aIntegration.h` - integration runner for Step 644-647
- `editor/tests/step648_test.cpp` - 8 integration checks
**Files modified:**
- `editor/CMakeLists.txt` - `step648_test` target
**Verification run:**
- `cmake -S editor -B editor/build-native` - PASS
- `cmake --build editor/build-native --target step648_test step647_test` - PASS
- `./editor/build-native/step648_test` - PASS (8/8)
- `./editor/build-native/step647_test` - PASS (12/12) regression coverage
**Architecture gate check:**
- `editor/src/Phase39aIntegration.h` (`49` <= `600`)
- `editor/tests/step648_test.cpp` within test-file size guidance (`21` lines)
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`