added
This commit is contained in:
1 parent
47158af30a
commit
67a7c79639
33 files changed
+1393
-32
No files matched your search
+23
-1
@@ -16,9 +16,24 @@ def validate(folder):
|
||||
check(end-start==timedelta(days=7),'Window must be exactly seven days')
|
||||
check((start.tzinfo is not None and end.tzinfo is not None),'Timezone required')
|
||||
check(log['window_start']==d['window_start'] and log['window_end']==d['window_end'],'Log window mismatch')
|
||||
gaps=log.get('coverage_gaps',[])
|
||||
partial=log.get('coverage_status')=='completed-with-gaps'
|
||||
check(isinstance(gaps,list),'Coverage gaps must be an array')
|
||||
check(log.get('coverage_status','complete') in ['complete','completed-with-gaps'],'Invalid coverage status')
|
||||
check(not partial or bool(gaps),'Completed-with-gaps requires gaps')
|
||||
check(partial or not gaps,'Coverage gaps require completed-with-gaps status')
|
||||
gap_engines=set()
|
||||
for gap in gaps if isinstance(gaps,list) else []:
|
||||
valid=isinstance(gap,dict) and gap.get('engine') in ['standard-web','exa'] and isinstance(gap.get('reason'),str) and bool(gap['reason'].strip())
|
||||
check(valid,'Invalid coverage gap')
|
||||
if valid:
|
||||
gap_engines.add(gap['engine'])
|
||||
for name in ['standard-web.md','exa.md','comparison.md']:
|
||||
txt=(folder/name).read_text(encoding='utf-8')
|
||||
check('completed-with-gaps' in txt and gap['reason'] in txt,'Missing coverage disclosure: '+name)
|
||||
for eng,key in [('standard-web','standard_web'),('exa','exa')]:
|
||||
txt=(folder/(eng+'.md')).read_text(encoding='utf-8')
|
||||
check(len(log.get(key,{}).get('queries',[]))>=6,'Missing search coverage: '+eng)
|
||||
check(len(log.get(key,{}).get('queries',[]))>=6 or (partial and eng in gap_engines),'Missing search coverage: '+eng)
|
||||
for cat in CATEGORIES:check('| '+cat+' |' in txt,'Missing coverage '+eng+' '+cat)
|
||||
for h in ['Internal','Customer-facing','Both','Method and limitations']: check('## '+h in txt,'Missing group '+h)
|
||||
ids=[]
|
||||
@@ -38,6 +53,13 @@ def validate(folder):
|
||||
check(c['source_url'] in txt and c['id'] in txt,'Report missing case citation')
|
||||
check(len(ids)==len(set(ids)),'Duplicate case ID')
|
||||
return errors
|
||||
def checkpoint_eligible(folder):
|
||||
"""Full-success checkpoints exclude validated completed-with-gaps outputs."""
|
||||
if validate(folder):
|
||||
return False
|
||||
log=json.loads((Path(folder)/'search-log.json').read_text(encoding='utf-8'))
|
||||
return log.get('coverage_status','complete')=='complete' and not log.get('coverage_gaps')
|
||||
|
||||
if __name__=='__main__':
|
||||
try: errors=validate(sys.argv[1])
|
||||
except (KeyError,ValueError,OSError,IndexError) as e: errors=[str(e)]
|
||||
|
||||
Reference in new issue
Block a user