Sprint 63: Learned Adapter Hints (Non-Authoritative) — Steps 859-868
Implements the learned adapter hints layer with governance guardrails: - HintFeatureExtractor: extract features from decision ledgers (step 859) - HintModelInterface: pair-specific hint query interface (step 860) - DeterministicFallback: safe fallback when hints unavailable (step 861) - HintConfidencePacket: confidence bands and escalation logic (step 862) - HintABHarness: A/B harness to measure hint effectiveness (step 863) - HintRollbackControl: suppress and lift hint suppression per pair (step 864) - whetstone_get_adapter_hints MCP tool (step 865) - whetstone_set_hint_policy MCP tool (step 866) - HintSafetyGuardrails: non-authoritative enforcement + audit (step 867) - Sprint63IntegrationSummary (step 868) All 10 steps passing (94 tests). Governance rule: learned hints may suggest; deterministic policy decides. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
44
editor/tests/step867_test.cpp
Normal file
44
editor/tests/step867_test.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
// Step 867: Hint safety guardrails and audit fields (8 tests)
|
||||
#include "graduation/HintSafetyGuardrails.h"
|
||||
#include <iostream>
|
||||
static int p=0,f=0;
|
||||
#define T(n) { std::cout << " " << #n << "... "; }
|
||||
#define P() { std::cout << "PASS\n"; ++p; }
|
||||
#define F(m) { std::cout << "FAIL: " << m << "\n"; ++f; }
|
||||
#define C(c,m) if(!(c)){F(m);return;}
|
||||
|
||||
void t1(){T(check_passes_valid);
|
||||
auto r=HintSafetyGuardrails::check("H-1",0.8f,true,true);
|
||||
C(r.passed,"passed");P();}
|
||||
void t2(){T(check_fails_authoritative);
|
||||
auto r=HintSafetyGuardrails::check("H-1",0.8f,false,true);
|
||||
C(!r.passed,"failed");P();}
|
||||
void t3(){T(check_fails_no_deterministic_policy);
|
||||
auto r=HintSafetyGuardrails::check("H-1",0.8f,true,false);
|
||||
C(!r.passed,"failed");P();}
|
||||
void t4(){T(violation_in_list);
|
||||
auto r=HintSafetyGuardrails::check("H-1",0.8f,false,true);
|
||||
C(!r.violations.empty(),"violations");P();}
|
||||
void t5(){T(hint_id_set);
|
||||
auto r=HintSafetyGuardrails::check("H-99",0.8f,true,true);
|
||||
C(r.hintId=="H-99","id");P();}
|
||||
void t6(){T(audit_record_from_check);
|
||||
auto c=HintSafetyGuardrails::check("H-1",0.8f,true,true);
|
||||
auto a=HintSafetyGuardrails::audit("H-1","py->cpp",c);
|
||||
C(a.guardPassed,"passed");P();}
|
||||
void t7(){T(audit_guard_reason_on_fail);
|
||||
auto c=HintSafetyGuardrails::check("H-1",0.8f,false,true);
|
||||
auto a=HintSafetyGuardrails::audit("H-1","py->cpp",c);
|
||||
C(!a.guardReason.empty(),"reason");P();}
|
||||
void t8(){T(to_json_has_guard_passed);
|
||||
auto c=HintSafetyGuardrails::check("H-1",0.8f,true,true);
|
||||
auto a=HintSafetyGuardrails::audit("H-1","py->cpp",c);
|
||||
auto j=HintSafetyGuardrails::toJson(a);
|
||||
C(j.contains("guard_passed"),"json");P();}
|
||||
|
||||
int main(){
|
||||
std::cout<<"Step 867: Hint safety guardrails\n";
|
||||
t1();t2();t3();t4();t5();t6();t7();t8();
|
||||
std::cout<<"\nResults: "<<p<<"/"<<(p+f)<<" passed\n";
|
||||
return f?1:0;
|
||||
}
|
||||
Reference in New Issue
Block a user