From 0ca4aad44eb9bce6d1b4384f22793edf52368f65 Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 17 Feb 2026 09:46:52 -0700 Subject: [PATCH] Sprint 28: end-of-sprint architecture refactor pass --- editor/src/AdapterOperationUtil.h | 11 ++++++ editor/src/CppConstructiveEditAdapter.h | 9 ++--- .../PythonTypeScriptConstructiveEditAdapter.h | 9 ++--- editor/src/RustGoConstructiveEditAdapter.h | 9 ++--- progress.md | 39 +++++++++++++++++++ 5 files changed, 59 insertions(+), 18 deletions(-) create mode 100644 editor/src/AdapterOperationUtil.h diff --git a/editor/src/AdapterOperationUtil.h b/editor/src/AdapterOperationUtil.h new file mode 100644 index 0000000..0a63b43 --- /dev/null +++ b/editor/src/AdapterOperationUtil.h @@ -0,0 +1,11 @@ +#pragma once +// Sprint 28 refactor: shared adapter operation helpers + +#include +#include +#include + +inline bool adapterHasOperation(const std::vector& operations, + const std::string& operation) { + return std::find(operations.begin(), operations.end(), operation) != operations.end(); +} diff --git a/editor/src/CppConstructiveEditAdapter.h b/editor/src/CppConstructiveEditAdapter.h index c52f369..33c090d 100644 --- a/editor/src/CppConstructiveEditAdapter.h +++ b/editor/src/CppConstructiveEditAdapter.h @@ -1,10 +1,11 @@ #pragma once // Step 539: C/C++ Constructive Edit Adapter -#include #include #include +#include "AdapterOperationUtil.h" + struct CppConstructiveEditRequest { std::string language; // c or cpp std::string constructKind; // declaration/definition/include/macro/class/member @@ -36,7 +37,7 @@ public: return result; } - if (!contains(result.legalOperations, request.operation)) { + if (!adapterHasOperation(result.legalOperations, request.operation)) { result.diagnostics.push_back("operation_not_legal_for_construct"); return result; } @@ -83,8 +84,4 @@ private: return ""; } - static bool contains(const std::vector& values, - const std::string& value) { - return std::set(values.begin(), values.end()).count(value) != 0; - } }; diff --git a/editor/src/PythonTypeScriptConstructiveEditAdapter.h b/editor/src/PythonTypeScriptConstructiveEditAdapter.h index 3fa91e3..4fb007c 100644 --- a/editor/src/PythonTypeScriptConstructiveEditAdapter.h +++ b/editor/src/PythonTypeScriptConstructiveEditAdapter.h @@ -1,10 +1,11 @@ #pragma once // Step 540: Python/TypeScript Constructive Edit Adapter -#include #include #include +#include "AdapterOperationUtil.h" + struct PyTsConstructiveEditRequest { std::string language; // python/typescript std::string constructKind; // function/class/import/signature/module_stmt @@ -36,7 +37,7 @@ public: return result; } - if (!contains(result.legalOperations, request.operation)) { + if (!adapterHasOperation(result.legalOperations, request.operation)) { result.diagnostics.push_back("operation_not_legal_for_construct"); return result; } @@ -77,8 +78,4 @@ private: return ""; } - static bool contains(const std::vector& values, - const std::string& value) { - return std::set(values.begin(), values.end()).count(value) != 0; - } }; diff --git a/editor/src/RustGoConstructiveEditAdapter.h b/editor/src/RustGoConstructiveEditAdapter.h index 9d7f8ce..ba13d19 100644 --- a/editor/src/RustGoConstructiveEditAdapter.h +++ b/editor/src/RustGoConstructiveEditAdapter.h @@ -1,10 +1,11 @@ #pragma once // Step 541: Rust/Go Constructive Edit Adapter -#include #include #include +#include "AdapterOperationUtil.h" + struct RustGoConstructiveEditRequest { std::string language; // rust/go std::string constructKind; // function/struct/impl/import/channel/borrow_region @@ -37,7 +38,7 @@ public: return result; } - if (!contains(result.legalOperations, request.operation)) { + if (!adapterHasOperation(result.legalOperations, request.operation)) { result.diagnostics.push_back("operation_not_legal_for_construct"); return result; } @@ -84,8 +85,4 @@ private: return ""; } - static bool contains(const std::vector& values, - const std::string& value) { - return std::set(values.begin(), values.end()).count(value) != 0; - } }; diff --git a/progress.md b/progress.md index 7da9731..7e8cd10 100644 --- a/progress.md +++ b/progress.md @@ -9321,3 +9321,42 @@ into phase-level and sprint-level pass/fail outcomes with closure notes. - **New tests in this sprint plan:** 112/112 passing - **Phase 28a (534-538):** 56/56 passing - **Phase 28b (539-543):** 56/56 passing + +## Sprint 28 End Refactor Pass (Architecture Compliance) + +Performed a dedicated post-sprint refactor pass to reduce adapter duplication and +re-validate architecture constraints without behavior changes. + +**Refactors applied:** +- `editor/src/AdapterOperationUtil.h` + - added shared adapter operation helper `adapterHasOperation(...)` + - removed repeated inline membership helpers across language adapters +- `editor/src/CppConstructiveEditAdapter.h` + - switched operation legality checks to shared helper + - removed local duplicate membership implementation +- `editor/src/PythonTypeScriptConstructiveEditAdapter.h` + - switched operation legality checks to shared helper + - removed local duplicate membership implementation +- `editor/src/RustGoConstructiveEditAdapter.h` + - switched operation legality checks to shared helper + - removed local duplicate membership implementation + +**Architecture compliance audit:** +- Header size gate (`<=600` lines): PASS across Sprint 28 modules + - largest audited header: `editor/src/Phase28aIntegration.h` (`118` lines) +- `goto` usage in Sprint 28 runtime path: PASS (none) +- Stale TODO markers in Sprint 28 modules: PASS (none) +- Header-only pattern for Sprint 28 additions: PASS + +**Refactor verification run:** +- `cmake --build editor/build-native --target step534_test step535_test step536_test step537_test step538_test step539_test step540_test step541_test step542_test step543_test` - PASS +- `./editor/build-native/step534_test` - PASS (12/12) +- `./editor/build-native/step535_test` - PASS (12/12) +- `./editor/build-native/step536_test` - PASS (12/12) +- `./editor/build-native/step537_test` - PASS (12/12) +- `./editor/build-native/step538_test` - PASS (8/8) +- `./editor/build-native/step539_test` - PASS (12/12) +- `./editor/build-native/step540_test` - PASS (12/12) +- `./editor/build-native/step541_test` - PASS (12/12) +- `./editor/build-native/step542_test` - PASS (12/12) +- `./editor/build-native/step543_test` - PASS (8/8)