diff --git a/editor/CMakeLists.txt b/editor/CMakeLists.txt index 5f6cee3..a7946d2 100644 --- a/editor/CMakeLists.txt +++ b/editor/CMakeLists.txt @@ -3505,4 +3505,13 @@ target_link_libraries(step513_test PRIVATE tree_sitter_javascript tree_sitter_typescript tree_sitter_java tree_sitter_rust tree_sitter_go) +add_executable(step514_test tests/step514_test.cpp) +target_include_directories(step514_test PRIVATE src) +target_link_libraries(step514_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) diff --git a/editor/src/Phase26aIntegration.h b/editor/src/Phase26aIntegration.h new file mode 100644 index 0000000..3a8b2d1 --- /dev/null +++ b/editor/src/Phase26aIntegration.h @@ -0,0 +1,100 @@ +#pragma once +// Step 514: Phase 26a Integration +// Integrates Steps 509-513 into a single reliability gate for docking, +// interaction, hierarchy, and accessibility consistency. + +#include "DockingReliability.h" +#include "PanelBoundaryReliability.h" +#include "InteractionStateModel.h" +#include "WindowHierarchyModel.h" +#include "AccessibilityBaseline.h" + +#include +#include + +struct Phase26aIntegrationResult { + bool dockingStable = false; + bool hitTargetsReliable = false; + bool interactionStatesValid = false; + bool hierarchyValid = false; + bool accessibilityBaselineValid = false; + bool editorFlowSafe = false; + bool pass = false; + std::vector notes; +}; + +class Phase26aIntegration { +public: + static Phase26aIntegrationResult run() { + Phase26aIntegrationResult out; + + // 509: docking/layout reliability + PanelManager pm; + pm.registerDefaults(); + pm.focusPanel("code-editor"); + auto dock = DockingReliability::auditAndRepair(pm, true); + out.dockingStable = dock.state.hasPanel("code-editor") && + dock.state.isVisible("code-editor") && + dock.state.layout().centerWidth >= 10.0f; + if (!out.dockingStable) out.notes.push_back("docking-not-stable"); + + // 510: split-bar hit targets and resize priority + std::vector panels = { + {"left", 0, 0, 220, 800}, + {"editor", 220, 0, 760, 800}, + {"right", 980, 0, 220, 800} + }; + std::vector bars = { + {"left-editor", true, 220, 6, "left", "editor"}, + {"editor-right", true, 980, 6, "editor", "right"} + }; + auto hit = PanelBoundaryReliability::resolveClick(221, 100, panels, bars); + auto norm = PanelBoundaryReliability::normalizeGeometry(panels, bars); + out.hitTargetsReliable = hit.resizeHit && hit.targetId == "left-editor" && + norm.bars[0].thickness >= 5.0f; + if (!out.hitTargetsReliable) out.notes.push_back("hit-target-not-reliable"); + + // 511: interaction-state validity + auto tokens = InteractionStateModel::defaultDarkTokens(); + auto styleFocus = InteractionStateModel::resolveStyle( + {false, true, false, false, false}, tokens); + auto stylePressed = InteractionStateModel::resolveStyle( + {true, true, true, true, false}, tokens); + out.interactionStatesValid = styleFocus.showFocusRing && + styleFocus.contrastPassAA && + stylePressed.state == InteractionState::Pressed; + if (!out.interactionStatesValid) out.notes.push_back("interaction-state-invalid"); + + // 512: hierarchy/layer semantics + std::vector surfaces = { + {"editor", SurfaceRole::Work, false, true, 0, {}}, + {"tool", SurfaceRole::Tool, false, true, 0, {}}, + {"overlay", SurfaceRole::Overlay, false, true, 0, {}}, + {"dialog", SurfaceRole::Modal, true, true, 0, {}} + }; + auto hierarchy = WindowHierarchyModel::validateAndOrder(surfaces); + out.hierarchyValid = hierarchy.valid; + if (!out.hierarchyValid) out.notes.push_back("hierarchy-invalid"); + + // 513: accessibility baseline + std::vector controls = { + {"menu", true, true, true, 0}, + {"explorer", true, true, true, 1}, + {"editor", true, true, true, 2}, + {"status", true, true, true, 3} + }; + auto ring = AccessibilityBaseline::resolveFocusRing(true, true, 0.1f, 0.9f); + auto access = AccessibilityBaseline::validate(controls, ring, 7.0f, 4.0f); + out.accessibilityBaselineValid = access.pass; + if (!out.accessibilityBaselineValid) out.notes.push_back("accessibility-invalid"); + + // Combined integration: editor flow should remain safe after all checks. + out.editorFlowSafe = out.dockingStable && out.hitTargetsReliable && + out.interactionStatesValid && out.hierarchyValid && + out.accessibilityBaselineValid; + + out.pass = out.editorFlowSafe; + if (out.pass) out.notes.push_back("phase-26a-integration-pass"); + return out; + } +}; diff --git a/editor/tests/step514_test.cpp b/editor/tests/step514_test.cpp new file mode 100644 index 0000000..db433bd --- /dev/null +++ b/editor/tests/step514_test.cpp @@ -0,0 +1,91 @@ +// Step 514: Phase 26a Integration (8 tests) + +#include "Phase26aIntegration.h" + +#include + +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 Phase26aIntegrationResult runNow() { + return Phase26aIntegration::run(); +} + +void test_docking_stability_gate_passes() { + TEST(docking_stability_gate_passes); + auto r = runNow(); + CHECK(r.dockingStable, "docking gate should pass"); + PASS(); +} + +void test_hit_target_reliability_gate_passes() { + TEST(hit_target_reliability_gate_passes); + auto r = runNow(); + CHECK(r.hitTargetsReliable, "hit-target gate should pass"); + PASS(); +} + +void test_interaction_state_gate_passes() { + TEST(interaction_state_gate_passes); + auto r = runNow(); + CHECK(r.interactionStatesValid, "interaction-state gate should pass"); + PASS(); +} + +void test_hierarchy_gate_passes() { + TEST(hierarchy_gate_passes); + auto r = runNow(); + CHECK(r.hierarchyValid, "hierarchy gate should pass"); + PASS(); +} + +void test_accessibility_gate_passes() { + TEST(accessibility_gate_passes); + auto r = runNow(); + CHECK(r.accessibilityBaselineValid, "accessibility gate should pass"); + PASS(); +} + +void test_editor_flow_safe_signal_is_true() { + TEST(editor_flow_safe_signal_is_true); + auto r = runNow(); + CHECK(r.editorFlowSafe, "editor flow should be safe"); + PASS(); +} + +void test_phase_pass_flag_is_true() { + TEST(phase_pass_flag_is_true); + auto r = runNow(); + CHECK(r.pass, "phase integration should pass"); + PASS(); +} + +void test_notes_include_pass_marker() { + TEST(notes_include_pass_marker); + auto r = runNow(); + bool found = false; + for (const auto& n : r.notes) { + if (n == "phase-26a-integration-pass") found = true; + } + CHECK(found, "pass marker note missing"); + PASS(); +} + +int main() { + std::cout << "Step 514: Phase 26a Integration\n"; + + test_docking_stability_gate_passes(); // 1 + test_hit_target_reliability_gate_passes(); // 2 + test_interaction_state_gate_passes(); // 3 + test_hierarchy_gate_passes(); // 4 + test_accessibility_gate_passes(); // 5 + test_editor_flow_safe_signal_is_true(); // 6 + test_phase_pass_flag_is_true(); // 7 + test_notes_include_pass_marker(); // 8 + + std::cout << "\nResults: " << passed << "/" << (passed + failed) << " passed\n"; + return failed == 0 ? 0 : 1; +} diff --git a/progress.md b/progress.md index d8ffe79..0d0c561 100644 --- a/progress.md +++ b/progress.md @@ -8179,3 +8179,35 @@ and iconography. - `editor/src/AccessibilityBaseline.h` within header-size limit (`99` <= `600`) - `editor/tests/step513_test.cpp` within test-file size guidance (`138` lines) - Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md` + +### Step 514: Phase 26a Integration +**Status:** PASS (8/8 tests) + +Integrates Steps 509-513 into a single phase gate verifying docking stability, +hit-target reliability, interaction-state correctness, hierarchy validity, and +accessibility baseline compliance with an explicit editor-flow-safe signal. + +**Files added:** +- `editor/src/Phase26aIntegration.h` - phase integration gate: + - consolidated execution of Step 509-513 reliability checks + - per-domain pass/fail signals plus final phase pass synthesis + - integration notes including explicit phase-pass marker +- `editor/tests/step514_test.cpp` - 8 integration tests covering: + - each domain gate (docking, hit-targets, interaction, hierarchy, accessibility) + - combined editor-flow-safe signal + - final phase pass signal + - pass-marker note emission + +**Files modified:** +- `editor/CMakeLists.txt` - `step514_test` target + +**Verification run:** +- `cmake -S editor -B editor/build-native` - PASS +- `cmake --build editor/build-native --target step514_test` - PASS +- `./editor/build-native/step514_test` - PASS (8/8) +- `./editor/build-native/step513_test` - PASS (12/12) regression coverage + +**Architecture gate check:** +- `editor/src/Phase26aIntegration.h` within header-size limit (`100` <= `600`) +- `editor/tests/step514_test.cpp` within test-file size guidance (`91` lines) +- Header-only architecture and naming conventions remain aligned with `ARCHITECTURE.md`