Sprint 30: end-of-sprint architecture refactor pass

This commit is contained in:
Bill
2026-02-17 10:42:36 -07:00
parent 67fc439ccd
commit 9a3b2d0c04
5 changed files with 58 additions and 3 deletions

View File

@@ -6,6 +6,8 @@
#include <string>
#include <vector>
#include "DebugValidationUtil.h"
struct Breakpoint {
std::string id;
std::string filePath;
@@ -96,7 +98,7 @@ private:
std::map<std::string, size_t> 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;

View File

@@ -5,6 +5,8 @@
#include <string>
#include <vector>
#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;

View File

@@ -0,0 +1,12 @@
#pragma once
// Sprint 30 refactor: shared debug validation helpers
#include <string>
inline bool hasRequiredDebugIds(const std::string& a, const std::string& b) {
return !a.empty() && !b.empty();
}
inline bool isPositiveLine(int line) {
return line > 0;
}

View File

@@ -4,6 +4,8 @@
#include <string>
#include <vector>
#include "DebugValidationUtil.h"
struct StackFrame {
std::string functionName;
std::string filePath;
@@ -52,7 +54,7 @@ private:
std::vector<StackFrame> 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;