Sprint 27: end-of-sprint architecture refactor pass
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "ConstraintViolationDiagnostics.h"
|
||||
#include "ConstraintSchemaFailurePacket.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
@@ -38,7 +39,7 @@ public:
|
||||
auto validation = TypedTaskitemContractSchema::parseAndValidate(request.taskitemJson);
|
||||
if (!validation.valid) {
|
||||
result.schemaErrors = validation.errors;
|
||||
result.diagnostics = schemaFailurePacket(validation.errors);
|
||||
result.diagnostics = makeUnderConstrainedContractPacket(validation.errors);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -66,21 +67,4 @@ public:
|
||||
result.executed = result.diagnostics.ok;
|
||||
return result;
|
||||
}
|
||||
|
||||
private:
|
||||
static ConstraintDiagnosticPacket schemaFailurePacket(
|
||||
const std::vector<std::string>& errors) {
|
||||
ConstraintDiagnosticPacket packet;
|
||||
packet.ok = false;
|
||||
packet.recommendedAction = "escalate";
|
||||
for (const auto& error : errors) {
|
||||
packet.violations.push_back({
|
||||
"under_constrained_contract",
|
||||
"Taskitem contract failed schema validation",
|
||||
error,
|
||||
false
|
||||
});
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
};
|
||||
|
||||
23
editor/src/ConstraintSchemaFailurePacket.h
Normal file
23
editor/src/ConstraintSchemaFailurePacket.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
// Sprint 27 refactor: shared schema-failure packet helper
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "ConstraintViolationDiagnostics.h"
|
||||
|
||||
inline ConstraintDiagnosticPacket makeUnderConstrainedContractPacket(
|
||||
const std::vector<std::string>& errors) {
|
||||
ConstraintDiagnosticPacket packet;
|
||||
packet.ok = false;
|
||||
packet.recommendedAction = "escalate";
|
||||
for (const auto& error : errors) {
|
||||
packet.violations.push_back({
|
||||
"under_constrained_contract",
|
||||
"Taskitem contract failed schema validation",
|
||||
error,
|
||||
false
|
||||
});
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
#include "ConstraintViolationDiagnostics.h"
|
||||
#include "ConstraintSchemaFailurePacket.h"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
@@ -37,7 +38,7 @@ public:
|
||||
|
||||
auto schema = TypedTaskitemContractSchema::parseAndValidate(taskitemJson);
|
||||
if (!schema.valid) {
|
||||
result.diagnostics = schemaFailurePacket(schema.errors);
|
||||
result.diagnostics = makeUnderConstrainedContractPacket(schema.errors);
|
||||
return result;
|
||||
}
|
||||
result.contract = schema.contract;
|
||||
@@ -111,20 +112,4 @@ private:
|
||||
}
|
||||
return violations.empty() ? "proceed" : "retry";
|
||||
}
|
||||
|
||||
static ConstraintDiagnosticPacket schemaFailurePacket(
|
||||
const std::vector<std::string>& errors) {
|
||||
ConstraintDiagnosticPacket packet;
|
||||
packet.ok = false;
|
||||
packet.recommendedAction = "escalate";
|
||||
for (const auto& error : errors) {
|
||||
packet.violations.push_back({
|
||||
"under_constrained_contract",
|
||||
"Taskitem contract failed schema validation",
|
||||
error,
|
||||
false
|
||||
});
|
||||
}
|
||||
return packet;
|
||||
}
|
||||
};
|
||||
|
||||
36
progress.md
36
progress.md
@@ -8930,3 +8930,39 @@ notes.
|
||||
- **New tests in this sprint plan:** 112/112 passing
|
||||
- **Phase 27a (524-528):** 56/56 passing
|
||||
- **Phase 27b (529-533):** 56/56 passing
|
||||
|
||||
## Sprint 27 End Refactor Pass (Architecture Compliance)
|
||||
|
||||
Performed a dedicated post-sprint refactor pass to reduce duplication and
|
||||
re-validate architecture constraints without changing runtime behavior.
|
||||
|
||||
**Refactors applied:**
|
||||
- `editor/src/ConstraintSchemaFailurePacket.h`
|
||||
- extracted shared helper `makeUnderConstrainedContractPacket(...)`
|
||||
- centralized schema-failure diagnostics payload construction
|
||||
- `editor/src/ConstrainedTaskitemIntegration.h`
|
||||
- replaced inline schema-failure packet builder with shared helper usage
|
||||
- removed duplicate private schema-failure implementation
|
||||
- `editor/src/PreApplyValidationGate.h`
|
||||
- replaced inline schema-failure packet builder with shared helper usage
|
||||
- removed duplicate private schema-failure implementation
|
||||
|
||||
**Architecture compliance audit:**
|
||||
- Header size gate (`<=600` lines): PASS across Sprint 27 modules
|
||||
- largest audited header: `editor/src/ConstraintViolationDiagnostics.h` (`169` lines)
|
||||
- `goto` usage in Sprint 27 runtime path: PASS (none)
|
||||
- Stale TODO markers in Sprint 27 modules: PASS (none)
|
||||
- Header-only pattern for Sprint 27 additions: PASS
|
||||
|
||||
**Refactor verification run:**
|
||||
- `cmake --build editor/build-native --target step524_test step525_test step526_test step527_test step528_test step529_test step530_test step531_test step532_test step533_test` - PASS
|
||||
- `./editor/build-native/step524_test` - PASS (12/12)
|
||||
- `./editor/build-native/step525_test` - PASS (12/12)
|
||||
- `./editor/build-native/step526_test` - PASS (12/12)
|
||||
- `./editor/build-native/step527_test` - PASS (12/12)
|
||||
- `./editor/build-native/step528_test` - PASS (8/8)
|
||||
- `./editor/build-native/step529_test` - PASS (12/12)
|
||||
- `./editor/build-native/step530_test` - PASS (12/12)
|
||||
- `./editor/build-native/step531_test` - PASS (12/12)
|
||||
- `./editor/build-native/step532_test` - PASS (12/12)
|
||||
- `./editor/build-native/step533_test` - PASS (8/8)
|
||||
|
||||
Reference in New Issue
Block a user