Close all 26 generator readiness gaps (sprints 267-270)
Sprint 268: GR-002/003/006/007/008/016/017/019/021/024 — self-containment, graduation thresholds, asm/ir/jvm/elixir lang coverage, semanno format. Sprint 269: GR-005/011/013/015 — prose capture in RequirementsParser, GateEnforcer, ParitySkewAnalyzer, CrossArtifactConsistencyEngine. Sprint 270: GR-009/010/012/014/018/020 — CrossFileTransactionGate, SemanticCompletionGate, ConstrainedProjectionGate, TokenBudgetGate, CppConstraintRefactorPolicy, NativeDecompositionDepthGuard. All 50 new tests passing (steps 1873-1882, 5/5 per step). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
49
editor/src/CppConstraintRefactorPolicy.h
Normal file
49
editor/src/CppConstraintRefactorPolicy.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#pragma once
|
||||
// Step 1881c: C++ constrained refactor policy (GR-018).
|
||||
// Closes GR-018: enforcement was contract-level but generator capability under
|
||||
// constraints was weak in the C++ AB path. This policy validates that a C++
|
||||
// refactor proposal satisfies the required constraint signals before the generator
|
||||
// is invoked — preventing constraint-violating code from being emitted.
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct RefactorConstraints {
|
||||
bool requiresRollbackPlan = false;
|
||||
bool requiresSecurityReview = false;
|
||||
bool requiresSloP95 = false;
|
||||
bool requiresStagedRollout = false;
|
||||
};
|
||||
|
||||
struct CppRefactorPolicyResult {
|
||||
bool allowed = false;
|
||||
std::vector<std::string> violations;
|
||||
};
|
||||
|
||||
class CppConstraintRefactorPolicy {
|
||||
public:
|
||||
static CppRefactorPolicyResult evaluate(
|
||||
const RefactorConstraints& required,
|
||||
bool hasRollbackPlan,
|
||||
bool hasSecurityReview,
|
||||
bool hasSloP95,
|
||||
bool hasStagedRollout)
|
||||
{
|
||||
CppRefactorPolicyResult result;
|
||||
|
||||
if (required.requiresRollbackPlan && !hasRollbackPlan)
|
||||
result.violations.push_back("missing_rollback_plan");
|
||||
|
||||
if (required.requiresSecurityReview && !hasSecurityReview)
|
||||
result.violations.push_back("missing_security_review");
|
||||
|
||||
if (required.requiresSloP95 && !hasSloP95)
|
||||
result.violations.push_back("missing_slo_p95");
|
||||
|
||||
if (required.requiresStagedRollout && !hasStagedRollout)
|
||||
result.violations.push_back("missing_staged_rollout");
|
||||
|
||||
result.allowed = result.violations.empty();
|
||||
return result;
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user