"""Functional preflight, separate from end-to-end model quality evaluation.""" from .engine import FEATURES def validate(engine): checks=[ ('schema',{'schema':{'properties':{'x':{'type':'integer'}},'required':['x'],'additionalProperties':False},'value':{'x':'7'}},'valid',False), ('workflow',{'nodes':3,'dependencies':[[0,1],[1,2]],'completed':[0]},'available',[1]), ('index',{'documents':[{'id':1,'key':1,'version':1,'text':'needle'}, {'id':2,'key':1,'version':2,'text':'current record'}, {'id':3,'key':2,'version':1,'text':'the needle'}],'query':'needle'},'document_id',3), ('syntax_scope',{'text':'([)]'},'balanced',False), ('polynomial',{'operation':'multiply','left':[1,1],'right':[1,-1]},'coefficients',[1,0,-1]), ('constraints',{'text':'one two\n\nthree four','words':4,'paragraphs':2},'valid',True), ('units',{'left':'N','right':'J'},'compatible',False), ('sat',{'variables':2,'clauses':[[1],[-1]]},'satisfiable',False), ('closure',{'nodes':3,'edges':[[0,1],[1,2]],'query':[0,2]},'reachable',True), ('binary',{'operation':'xor','left':[123],'right':[456]},'values',[435]), ] rows=[] for feature,payload,key,expected in checks: actual=engine.run(feature,payload) passed=actual[key]==expected rows.append({'feature':feature,'passed':passed,'actual':actual}) if not passed:raise AssertionError(f'Circuit preflight failed: {feature}: {actual}') if not all(not p.requires_grad for p in engine.parameters()):raise AssertionError('Analytic weights must be frozen') return rows