From 9a3b2d0c04a80b791b16c8f6ab3ad07fe6a34720 Mon Sep 17 00:00:00 2001 From: Bill Date: Tue, 17 Feb 2026 10:42:36 -0700 Subject: [PATCH] Sprint 30: end-of-sprint architecture refactor pass --- editor/src/BreakpointSystem.h | 4 ++- editor/src/DebugSessionModel.h | 4 ++- editor/src/DebugValidationUtil.h | 12 ++++++++ editor/src/ExceptionStackTraceCapture.h | 4 ++- progress.md | 37 +++++++++++++++++++++++++ 5 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 editor/src/DebugValidationUtil.h diff --git a/editor/src/BreakpointSystem.h b/editor/src/BreakpointSystem.h index 7bb4bdb..94a1d3f 100644 --- a/editor/src/BreakpointSystem.h +++ b/editor/src/BreakpointSystem.h @@ -6,6 +6,8 @@ #include #include +#include "DebugValidationUtil.h" + struct Breakpoint { std::string id; std::string filePath; @@ -96,7 +98,7 @@ private: std::map index_; bool addBreakpoint(const Breakpoint& bp) { - if (bp.id.empty() || bp.filePath.empty() || bp.line <= 0) return false; + if (!hasRequiredDebugIds(bp.id, bp.filePath) || !isPositiveLine(bp.line)) return false; if (index_.count(bp.id) != 0) return false; breakpoints_.push_back(bp); index_[bp.id] = breakpoints_.size() - 1; diff --git a/editor/src/DebugSessionModel.h b/editor/src/DebugSessionModel.h index 46e0909..c5ef1dc 100644 --- a/editor/src/DebugSessionModel.h +++ b/editor/src/DebugSessionModel.h @@ -5,6 +5,8 @@ #include #include +#include "DebugValidationUtil.h" + struct DebugTargetContext { std::string targetId; std::string bufferId; @@ -90,7 +92,7 @@ private: const std::string& executablePath, bool attached, bool makeCurrent) { - if (targetId.empty() || bufferId.empty() || executablePath.empty()) return false; + if (!hasRequiredDebugIds(targetId, bufferId) || executablePath.empty()) return false; if (state_.targets.count(targetId) != 0) return false; DebugTargetContext context; diff --git a/editor/src/DebugValidationUtil.h b/editor/src/DebugValidationUtil.h new file mode 100644 index 0000000..a24d4ab --- /dev/null +++ b/editor/src/DebugValidationUtil.h @@ -0,0 +1,12 @@ +#pragma once +// Sprint 30 refactor: shared debug validation helpers + +#include + +inline bool hasRequiredDebugIds(const std::string& a, const std::string& b) { + return !a.empty() && !b.empty(); +} + +inline bool isPositiveLine(int line) { + return line > 0; +} diff --git a/editor/src/ExceptionStackTraceCapture.h b/editor/src/ExceptionStackTraceCapture.h index 5032983..3255f58 100644 --- a/editor/src/ExceptionStackTraceCapture.h +++ b/editor/src/ExceptionStackTraceCapture.h @@ -4,6 +4,8 @@ #include #include +#include "DebugValidationUtil.h" + struct StackFrame { std::string functionName; std::string filePath; @@ -52,7 +54,7 @@ private: std::vector out; int index = 0; for (const auto& f : frames) { - if (f.functionName.empty() || f.filePath.empty() || f.line <= 0) { + if (!hasRequiredDebugIds(f.functionName, f.filePath) || !isPositiveLine(f.line)) { errors.push_back("invalid_frame:" + std::to_string(index)); ++index; continue; diff --git a/progress.md b/progress.md index 8f52ac1..d027417 100644 --- a/progress.md +++ b/progress.md @@ -10118,3 +10118,40 @@ into phase-level and sprint-level outcomes with closure diagnostics. - **New tests in this sprint plan:** 112/112 passing - **Phase 30a (554-558):** 56/56 passing - **Phase 30b (559-563):** 56/56 passing + +### Sprint 30 End Refactor Pass (Architecture Compliance) +**Status:** PASS (112/112 tests revalidated) + +Performed a focused post-sprint refactor against `ARCHITECTURE.md` constraints to +reduce validation duplication across Sprint 30 debug modules while preserving +header-only design and deterministic behavior. + +**Files added:** +- `editor/src/DebugValidationUtil.h` - shared validation helpers: + - required debug/session/workflow id presence check + - positive source-line guard used by breakpoint/stack validation paths + +**Files modified:** +- `editor/src/DebugSessionModel.h` - uses shared id validation utility for target/session lifecycle checks +- `editor/src/BreakpointSystem.h` - uses shared line-validation utility for breakpoint insertion guards +- `editor/src/ExceptionStackTraceCapture.h` - uses shared line-validation utility for frame validation + +**Verification run:** +- `cmake --build editor/build-native --target step554_test step555_test step556_test step557_test step558_test step559_test step560_test step561_test step562_test step563_test` - PASS +- `./editor/build-native/step554_test` - PASS (12/12) +- `./editor/build-native/step555_test` - PASS (12/12) +- `./editor/build-native/step556_test` - PASS (12/12) +- `./editor/build-native/step557_test` - PASS (12/12) +- `./editor/build-native/step558_test` - PASS (8/8) +- `./editor/build-native/step559_test` - PASS (12/12) +- `./editor/build-native/step560_test` - PASS (12/12) +- `./editor/build-native/step561_test` - PASS (12/12) +- `./editor/build-native/step562_test` - PASS (12/12) +- `./editor/build-native/step563_test` - PASS (8/8) + +**Architecture gate check:** +- `editor/src/DebugValidationUtil.h` within header-size limit (`12` <= `600`) +- `editor/src/DebugSessionModel.h` within header-size limit (`108` <= `600`) +- `editor/src/BreakpointSystem.h` within header-size limit (`120` <= `600`) +- `editor/src/ExceptionStackTraceCapture.h` within header-size limit (`73` <= `600`) +- Shared validation centralization reduces duplicated guard logic and keeps module boundaries aligned with `ARCHITECTURE.md`