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>
49 lines
2.0 KiB
C++
49 lines
2.0 KiB
C++
// Step 860: Pair-specific hint model interface (10 tests)
|
|
#include "graduation/HintModelInterface.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(empty_pair_model_unavailable);
|
|
auto r=HintModelInterface::query("",{});
|
|
C(!r.modelAvailable,"unavailable");P();}
|
|
void t2(){T(valid_pair_model_available);
|
|
auto r=HintModelInterface::query("py->cpp",{"feat1"});
|
|
C(r.modelAvailable,"available");P();}
|
|
void t3(){T(pair_id_set);
|
|
auto r=HintModelInterface::query("rust->go",{"f"});
|
|
C(r.pairId=="rust->go","pairId");P();}
|
|
void t4(){T(hints_generated_for_features);
|
|
auto r=HintModelInterface::query("py->cpp",{"f1","f2"});
|
|
C(r.hints.size()==2,"size");P();}
|
|
void t5(){T(hint_ids_sequential);
|
|
auto r=HintModelInterface::query("py->cpp",{"a","b"});
|
|
C(r.hints[0].hintId=="H-1"&&r.hints[1].hintId=="H-2","ids");P();}
|
|
void t6(){T(hint_non_authoritative);
|
|
auto r=HintModelInterface::query("py->cpp",{"x"});
|
|
C(r.hints[0].nonAuthoritative,"nonAuth");P();}
|
|
void t7(){T(hint_confidence_positive);
|
|
auto r=HintModelInterface::query("py->cpp",{"x"});
|
|
C(r.hints[0].confidence>0.0f,"confidence");P();}
|
|
void t8(){T(hint_suggestion_contains_feature);
|
|
auto r=HintModelInterface::query("py->cpp",{"myFeat"});
|
|
C(r.hints[0].suggestion.find("myFeat")!=std::string::npos,"suggestion");P();}
|
|
void t9(){T(to_json_has_model_available);
|
|
auto r=HintModelInterface::query("py->cpp",{"f"});
|
|
auto j=HintModelInterface::toJson(r);
|
|
C(j.contains("model_available"),"json");P();}
|
|
void t10(){T(to_json_hints_array);
|
|
auto r=HintModelInterface::query("py->cpp",{"f"});
|
|
auto j=HintModelInterface::toJson(r);
|
|
C(j["hints"].is_array(),"array");P();}
|
|
|
|
int main(){
|
|
std::cout<<"Step 860: Pair-specific hint model interface\n";
|
|
t1();t2();t3();t4();t5();t6();t7();t8();t9();t10();
|
|
std::cout<<"\nResults: "<<p<<"/"<<(p+f)<<" passed\n";
|
|
return f?1:0;
|
|
}
|