Complete Step 498: phase 25a integration
This commit is contained in:
@@ -3361,4 +3361,13 @@ target_link_libraries(step497_test PRIVATE
|
||||
tree_sitter_javascript tree_sitter_typescript
|
||||
tree_sitter_java tree_sitter_rust tree_sitter_go)
|
||||
|
||||
add_executable(step498_test tests/step498_test.cpp)
|
||||
target_include_directories(step498_test PRIVATE src)
|
||||
target_link_libraries(step498_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)
|
||||
|
||||
49
editor/src/SelfHostingPhase25aIntegration.h
Normal file
49
editor/src/SelfHostingPhase25aIntegration.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
|
||||
// Step 498: Phase 25a Integration
|
||||
// Full self-hosting pipeline: parse -> annotate -> transpile -> workflow -> metrics.
|
||||
|
||||
#include "SelfHostAnnotationAudit.h"
|
||||
#include "SelfHostCodebaseAudit.h"
|
||||
#include "SelfHostTranspileAudit.h"
|
||||
#include "SelfHostingMetricsReport.h"
|
||||
#include "SelfModernizationWorkflow.h"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct Phase25aIntegrationResult {
|
||||
CodebaseParseAudit parseAudit;
|
||||
SelfAnnotationAuditReport annotationAudit;
|
||||
SelfTranspileAuditReport transpileAudit;
|
||||
ModernizationWorkflowReport workflowAudit;
|
||||
SelfHostingMetrics metrics;
|
||||
bool parseCoverageGate = false; // >=95%
|
||||
bool transpileGate = false; // >=3 translated modules
|
||||
bool workflowGate = false; // deterministic modernization viable
|
||||
bool phasePass = false;
|
||||
std::vector<std::string> notes;
|
||||
};
|
||||
|
||||
class SelfHostingPhase25aIntegration {
|
||||
public:
|
||||
static Phase25aIntegrationResult runCurrentState() {
|
||||
Phase25aIntegrationResult out;
|
||||
out.parseAudit = SelfHostCodebaseAudit::auditDirectories({"editor/src", "editor/src/ast"});
|
||||
out.annotationAudit = SelfHostAnnotationAudit::auditDirectories({"editor/src", "editor/src/ast"});
|
||||
out.transpileAudit = SelfHostTranspileAudit::runDefault();
|
||||
out.workflowAudit = SelfModernizationWorkflow::createAndRun("editor/src/AnnotationValidator.h");
|
||||
out.metrics = SelfHostingMetricsReport::generate(
|
||||
out.parseAudit, out.annotationAudit, out.transpileAudit, out.workflowAudit);
|
||||
|
||||
out.parseCoverageGate = out.parseAudit.meetsTarget(0.95);
|
||||
out.transpileGate = static_cast<int>(out.transpileAudit.files.size()) >= 3;
|
||||
out.workflowGate = out.workflowAudit.deterministicCount == out.workflowAudit.deterministicValidCount;
|
||||
out.phasePass = out.parseCoverageGate && out.transpileGate && out.workflowGate;
|
||||
|
||||
out.notes.push_back("Phase 25a pipeline executed");
|
||||
out.notes.push_back(out.phasePass ? "Self-hosting thesis gate passed"
|
||||
: "Self-hosting thesis gate has outstanding gaps");
|
||||
return out;
|
||||
}
|
||||
};
|
||||
105
editor/tests/step498_test.cpp
Normal file
105
editor/tests/step498_test.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
// Step 498: Phase 25a Integration Tests (8 tests)
|
||||
|
||||
#include "SelfHostingPhase25aIntegration.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 Phase25aIntegrationResult runNow() {
|
||||
return SelfHostingPhase25aIntegration::runCurrentState();
|
||||
}
|
||||
|
||||
void test_full_pipeline_runs_parse_annotate_transpile_workflow_metrics() {
|
||||
TEST(full_pipeline_runs_parse_annotate_transpile_workflow_metrics);
|
||||
auto r = runNow();
|
||||
CHECK(r.parseAudit.totalFiles > 0, "parse audit missing");
|
||||
CHECK(r.annotationAudit.totalFiles > 0, "annotation audit missing");
|
||||
CHECK(!r.transpileAudit.files.empty(), "transpile audit missing");
|
||||
CHECK(!r.workflowAudit.tasks.empty(), "workflow audit missing");
|
||||
CHECK(r.metrics.filesTotal > 0, "metrics missing");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_parse_coverage_gate_uses_95_percent_threshold_semantics() {
|
||||
TEST(parse_coverage_gate_uses_95_percent_threshold_semantics);
|
||||
auto r = runNow();
|
||||
bool expected = r.parseAudit.parseRate() >= 0.95;
|
||||
CHECK(r.parseCoverageGate == expected, "parse gate mismatch");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_transpile_gate_requires_at_least_three_headers() {
|
||||
TEST(transpile_gate_requires_at_least_three_headers);
|
||||
auto r = runNow();
|
||||
CHECK(r.transpileAudit.files.size() >= 3, "expected >=3 transpiled headers");
|
||||
CHECK(r.transpileGate, "transpile gate should pass");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_workflow_gate_requires_all_deterministic_outputs_valid() {
|
||||
TEST(workflow_gate_requires_all_deterministic_outputs_valid);
|
||||
auto r = runNow();
|
||||
bool expected = (r.workflowAudit.deterministicCount == r.workflowAudit.deterministicValidCount);
|
||||
CHECK(r.workflowGate == expected, "workflow gate mismatch");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_phase_pass_equals_conjunction_of_all_gates() {
|
||||
TEST(phase_pass_equals_conjunction_of_all_gates);
|
||||
auto r = runNow();
|
||||
CHECK(r.phasePass == (r.parseCoverageGate && r.transpileGate && r.workflowGate),
|
||||
"phase pass logic mismatch");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_metrics_consistency_with_underlying_reports() {
|
||||
TEST(metrics_consistency_with_underlying_reports);
|
||||
auto r = runNow();
|
||||
CHECK(r.metrics.filesTotal == r.parseAudit.totalFiles, "metrics parse total mismatch");
|
||||
CHECK(r.metrics.transpileReviewRequired == r.transpileAudit.reviewRequiredCount,
|
||||
"metrics transpile review mismatch");
|
||||
CHECK(r.metrics.workflowTasks == (int)r.workflowAudit.tasks.size(), "metrics workflow task mismatch");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_notes_include_pipeline_execution_summary() {
|
||||
TEST(notes_include_pipeline_execution_summary);
|
||||
auto r = runNow();
|
||||
CHECK(!r.notes.empty(), "expected notes");
|
||||
CHECK(r.notes[0].find("pipeline executed") != std::string::npos, "missing execution note");
|
||||
PASS();
|
||||
}
|
||||
|
||||
void test_phase_status_note_reflects_pass_or_gap_state() {
|
||||
TEST(phase_status_note_reflects_pass_or_gap_state);
|
||||
auto r = runNow();
|
||||
CHECK(r.notes.size() >= 2, "missing status note");
|
||||
if (r.phasePass) {
|
||||
CHECK(r.notes[1].find("passed") != std::string::npos, "missing pass note");
|
||||
} else {
|
||||
CHECK(r.notes[1].find("outstanding gaps") != std::string::npos, "missing gap note");
|
||||
}
|
||||
PASS();
|
||||
}
|
||||
|
||||
int main() {
|
||||
std::cout << "Step 498: Phase 25a Integration Tests\n";
|
||||
|
||||
test_full_pipeline_runs_parse_annotate_transpile_workflow_metrics(); // 1
|
||||
test_parse_coverage_gate_uses_95_percent_threshold_semantics(); // 2
|
||||
test_transpile_gate_requires_at_least_three_headers(); // 3
|
||||
test_workflow_gate_requires_all_deterministic_outputs_valid(); // 4
|
||||
test_phase_pass_equals_conjunction_of_all_gates(); // 5
|
||||
test_metrics_consistency_with_underlying_reports(); // 6
|
||||
test_notes_include_pipeline_execution_summary(); // 7
|
||||
test_phase_status_note_reflects_pass_or_gap_state(); // 8
|
||||
|
||||
std::cout << "\nResults: " << passed << "/" << (passed + failed)
|
||||
<< " passed\n";
|
||||
return failed == 0 ? 0 : 1;
|
||||
}
|
||||
58
progress.md
58
progress.md
@@ -7556,3 +7556,61 @@ single report with gap analysis.
|
||||
- `editor/src/SelfHostingMetricsReport.h` within header-size limit (`96` <= `600`)
|
||||
- `editor/tests/step497_test.cpp` within test-file size guidance (`165` lines)
|
||||
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`
|
||||
|
||||
### Step 498: Phase 25a Integration
|
||||
**Status:** PASS (8/8 tests)
|
||||
|
||||
Integrates the full Phase 25a self-hosting pipeline:
|
||||
parse -> annotate -> transpile -> modernization workflow -> metrics,
|
||||
with thesis-level gate checks for parse coverage, transpilation breadth,
|
||||
and workflow viability.
|
||||
|
||||
**Files added:**
|
||||
- `editor/src/SelfHostingPhase25aIntegration.h` — phase integration composer:
|
||||
- `Phase25aIntegrationResult`
|
||||
- `runCurrentState()` executes:
|
||||
- `SelfHostCodebaseAudit`
|
||||
- `SelfHostAnnotationAudit`
|
||||
- `SelfHostTranspileAudit`
|
||||
- `SelfModernizationWorkflow`
|
||||
- `SelfHostingMetricsReport`
|
||||
- gate evaluation:
|
||||
- parse coverage gate (`>=95%`)
|
||||
- transpilation gate (`>=3` modules)
|
||||
- workflow gate (all deterministic outputs valid)
|
||||
- phase pass/fail synthesis + summary notes
|
||||
- `editor/tests/step498_test.cpp` — 8 integration tests covering:
|
||||
- full pipeline execution
|
||||
- gate threshold semantics
|
||||
- phase pass conjunction logic
|
||||
- cross-report metric consistency
|
||||
- integration note/status behavior
|
||||
- `editor/CMakeLists.txt` — `step498_test` target
|
||||
|
||||
**Verification run:**
|
||||
- `cmake --build editor/build-native --target step498_test step497_test` — PASS
|
||||
- `./editor/build-native/step498_test` — PASS (8/8)
|
||||
- `./editor/build-native/step497_test` — PASS (12/12) regression coverage
|
||||
|
||||
**Architecture gate check:**
|
||||
- `editor/src/SelfHostingPhase25aIntegration.h` within header-size limit (`49` <= `600`)
|
||||
- `editor/tests/step498_test.cpp` within test-file size guidance (`105` lines)
|
||||
- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`
|
||||
|
||||
**Phase 25a totals (493-498):**
|
||||
- **Steps:** 6
|
||||
- **Tests:** 68/68 passing
|
||||
- **Headers added:** 6
|
||||
- `SelfHostCodebaseAudit.h`
|
||||
- `SelfHostAnnotationAudit.h`
|
||||
- `SelfHostTranspileAudit.h`
|
||||
- `SelfModernizationWorkflow.h`
|
||||
- `SelfHostingMetricsReport.h`
|
||||
- `SelfHostingPhase25aIntegration.h`
|
||||
- **Capabilities delivered:**
|
||||
- full-header parser coverage auditing across Whetstone source
|
||||
- self-code annotation signal auditing
|
||||
- targeted self-module transpilation auditing (Python/Rust/Java)
|
||||
- self-modernization workflow routing + deterministic output validation
|
||||
- consolidated self-host metrics/gap analysis
|
||||
- phase-level self-hosting thesis gate evaluation
|
||||
|
||||
Reference in New Issue
Block a user