Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
json
Languages:
English
Size:
10K - 100K
License:
| """Renderer-diversity ablation with renderer families held out by split.""" | |
| import argparse | |
| import hashlib | |
| import json | |
| import random | |
| from pathlib import Path | |
| from .common import POLICY, SCHEMA, digest, save_json | |
| from .data import COMPONENTS, labels, make_situation | |
| FAMILIES = { | |
| 'ticket': { | |
| 'head': 'Issue {task}: baseline suite had {passed} successes and {failed} failures ({error}). The last touched area was {recent}; that fact alone does not establish blame.', | |
| 'trial_ok': 'A clean {component} was swapped into the original snapshot by itself. The reported fault vanished.', | |
| 'trial_bad': 'A clean {component} was swapped into the original snapshot by itself. The reported fault was still present.', | |
| 'status': 'Current suite: {checks}. Product acceptance: {acceptance}.', | |
| 'retry': 'Transient obstruction: {blocker}. An identical retry: {retry}.', | |
| 'rollback': 'Patch reversal permission: {rollback}.', | |
| }, | |
| 'terminal': { | |
| 'head': '$ diagnose --task {task}\nBASELINE passed={passed} failed={failed} exception={error}\nNOTICE recent_change={recent} (unverified signal)', | |
| 'trial_ok': 'ISOLATED[{component}] => original_failure=ABSENT', | |
| 'trial_bad': 'ISOLATED[{component}] => original_failure=PRESENT', | |
| 'status': 'LATEST checks={checks}; accepted={acceptance}', | |
| 'retry': 'BLOCKER cleared={blocker}; SAME_RETRY failed_before={retry}', | |
| 'rollback': 'ROLLBACK allowed={rollback}', | |
| }, | |
| 'conversation': { | |
| 'head': 'Engineer: We are fixing {task}. The first run was {passed} passing and {failed} failing with {error}. We recently touched {recent}, but do not infer the cause from that.', | |
| 'trial_ok': 'Reviewer: When we changed just the {component} to a known-good one from the original failure point, we could not trigger the issue again.', | |
| 'trial_bad': 'Reviewer: When we changed just the {component} to a known-good one from the original failure point, we could still trigger the issue.', | |
| 'status': 'Engineer: Right now the checks are {checks}, and acceptance is {acceptance}.', | |
| 'retry': 'Reviewer: The temporary obstacle is {blocker}; the exact same retry is {retry}.', | |
| 'rollback': 'Engineer: Reverting the patch is {rollback}.', | |
| }, | |
| 'incident': { | |
| 'head': 'INCIDENT / {task}\nInitial evidence: {failed} failures after {passed} passes; symptom {error}; recently modified {recent} (possible distractor).', | |
| 'trial_ok': 'Control experiment—only {component} restored: the initial symptom ceased.', | |
| 'trial_bad': 'Control experiment—only {component} restored: the initial symptom continued.', | |
| 'status': 'Present verification is {checks}; formal approval is {acceptance}.', | |
| 'retry': 'The short-lived impediment is {blocker}; repeating without changes is {retry}.', | |
| 'rollback': 'Authority to reverse the change is {rollback}.', | |
| }, | |
| 'calibration': { | |
| 'head': 'Diagnostic memo for {task}. Originally: {passed} tests okay, {failed} not okay, reporting {error}. A recent edit involved {recent}, which may be irrelevant.', | |
| 'trial_ok': 'Starting over from the failing revision and altering nothing except {component} eliminated the original problem.', | |
| 'trial_bad': 'Starting over from the failing revision and altering nothing except {component} did not eliminate the original problem.', | |
| 'status': 'The newest check run is {checks}. Stakeholder confirmation is {acceptance}.', | |
| 'retry': 'The temporary roadblock is {blocker}. The same action has {retry}.', | |
| 'rollback': 'A rollback is {rollback}.', | |
| }, | |
| 'sealed': { | |
| 'head': 'Work item: {task}. At onset, {passed} checks succeeded while {failed} did not; the observed symptom was {error}. Although {recent} changed lately, treat that as circumstantial.', | |
| 'trial_ok': 'From an identical copy of the faulty revision, substituting solely the {component} made the original symptom non-reproducible.', | |
| 'trial_bad': 'From an identical copy of the faulty revision, substituting solely the {component} left the original symptom reproducible.', | |
| 'status': 'As of the latest run, verification is {checks}, with sign-off {acceptance}.', | |
| 'retry': 'The transient constraint is {blocker}; an otherwise unchanged reattempt has {retry}.', | |
| 'rollback': 'Authorization to back out the modification is {rollback}.', | |
| }, | |
| 'json_log': { | |
| 'head': '{{"task": "{task}", "baseline": {{"passed": {passed}, "failed": {failed}}}, "error": "{error}", "recent_change": "{recent}"}}', | |
| 'trial_ok': '{{"component": "{component}", "result": "original_failure_absent"}}', | |
| 'trial_bad': '{{"component": "{component}", "result": "original_failure_present"}}', | |
| 'status': '{{"checks": "{checks}", "acceptance": "{acceptance}"}}', | |
| 'retry': '{{"blocker": "{blocker}", "retry": "{retry}"}}', | |
| 'rollback': '{{"rollback": "{rollback}"}}', | |
| }, | |
| 'xml_report': { | |
| 'head': '<diagnosis task="{task}"><baseline passed="{passed}" failed="{failed}"/><error>{error}</error><recent>{recent}</recent></diagnosis>', | |
| 'trial_ok': '<trial component="{component}"><outcome>original_failure_absent</outcome></trial>', | |
| 'trial_bad': '<trial component="{component}"><outcome>original_failure_present</outcome></trial>', | |
| 'status': '<verification checks="{checks}" acceptance="{acceptance}"/>', | |
| 'retry': '<blocker cleared="{blocker}"/><retry failed_before="{retry}"/>', | |
| 'rollback': '<rollback allowed="{rollback}"/>', | |
| }, | |
| 'slack_thread': { | |
| 'head': '@engineer Task: {task}. First run: {passed} pass, {failed} fail. Error: {error}. Recent: {recent} (don\'t assume cause).', | |
| 'trial_ok': 'Reviewer: Swapped only {component} to known-good from failure point — issue gone.', | |
| 'trial_bad': 'Reviewer: Swapped only {component} to known-good from failure point — issue remains.', | |
| 'status': 'Eng: Checks are {checks}, acceptance is {acceptance}.', | |
| 'retry': 'Reviewer: Blocker is {blocker}; same retry is {retry}.', | |
| 'rollback': 'Eng: Patch revert is {rollback}.', | |
| }, | |
| 'github_issue': { | |
| 'head': '## Issue: {task}\n**Baseline**: {passed} passing, {failed} failing\n**Error**: `{error}`\n**Recent change**: {recent} (unverified)', | |
| 'trial_ok': '✅ **{component}**: Restored to known-good — original failure **resolved**.', | |
| 'trial_bad': '❌ **{component}**: Restored to known-good — original failure **persists**.', | |
| 'status': 'Latest CI: {checks}. Maintainer approval: {acceptance}.', | |
| 'retry': 'Transient blocker: {blocker}. Identical re-run: {retry}.', | |
| 'rollback': 'Revert permission: {rollback}.', | |
| }, | |
| 'jira_ticket': { | |
| 'head': 'JIRA-{task}: {failed} failures / {passed} passes after regression. Error: {error}. Touched: {recent}.', | |
| 'trial_ok': 'Isolation test [{component}]: Root cause eliminated.', | |
| 'trial_bad': 'Isolation test [{component}]: Root cause remains.', | |
| 'status': 'QA verification: {checks}. PO sign-off: {acceptance}.', | |
| 'retry': 'Impediment status: {blocker}. Re-test result: {retry}.', | |
| 'rollback': 'Rollback approved: {rollback}.', | |
| }, | |
| 'stack_trace': { | |
| 'head': 'TRACE task={task} passed={passed} failed={failed} err={error} recent={recent}', | |
| 'trial_ok': 'ISOLATE component={component} => failure=CLEARED', | |
| 'trial_bad': 'ISOLATE component={component} => failure=PERSISTS', | |
| 'status': 'CHECKS={checks} ACCEPTED={acceptance}', | |
| 'retry': 'BLOCKER={blocker} RETRY={retry}', | |
| 'rollback': 'ROLLBACK={rollback}', | |
| }, | |
| 'commit_msg': { | |
| 'head': 'fix({task}): investigate {failed} failures ({error}) after {passed} passes. recent: {recent}', | |
| 'trial_ok': 'test({component}): restored known-good — failure eliminated', | |
| 'trial_bad': 'test({component}): restored known-good — failure persists', | |
| 'status': 'ci: checks {checks} | approval: {acceptance}', | |
| 'retry': 'blocker: {blocker} | retry: {retry}', | |
| 'rollback': 'revert: {rollback}', | |
| }, | |
| 'pr_review': { | |
| 'head': 'PR Review: {task} — {passed}✓ {failed}✗ ({error}). Changed: {recent}.', | |
| 'trial_ok': 'Comment: Only {component} swap cleared the original failure.', | |
| 'trial_bad': 'Comment: Only {component} swap did not clear the original failure.', | |
| 'status': 'Checks: {checks}. LGTM: {acceptance}.', | |
| 'retry': 'Blocker: {blocker}. Re-run: {retry}.', | |
| 'rollback': 'Revert allowed: {rollback}.', | |
| }, | |
| } | |
| VALUES = { | |
| 'ticket': dict(pass_='passing', fail='failing', yes='confirmed', no='not confirmed', clear='cleared', blocked='not cleared', tried='already failed', untried='not been attempted', allowed='authorized', denied='not authorized'), | |
| 'terminal': dict(pass_='PASS', fail='FAIL', yes='YES', no='NO', clear='YES', blocked='NO', tried='YES', untried='NO', allowed='YES', denied='NO'), | |
| 'conversation': dict(pass_='all green', fail='still failing', yes='confirmed', no='still pending', clear='gone', blocked='still active', tried='already known to fail', untried='not yet tried', allowed='permitted', denied='not permitted'), | |
| 'incident': dict(pass_='successful', fail='unsuccessful', yes='granted', no='withheld', clear='resolved', blocked='unresolved', tried='already failed once', untried='not yet been tried', allowed='approved', denied='prohibited'), | |
| 'calibration': dict(pass_='passing', fail='failing', yes='present', no='absent', clear='no longer active', blocked='still active', tried='already failed', untried='not occurred', allowed='permitted', denied='forbidden'), | |
| 'sealed': dict(pass_='successful', fail='unsuccessful', yes='recorded', no='not recorded', clear='removed', blocked='still in force', tried='previously failed', untried='not previously occurred', allowed='approved', denied='not approved'), | |
| 'json_log': dict(pass_='true', fail='false', yes='true', no='false', clear='true', blocked='false', tried='true', untried='false', allowed='true', denied='false'), | |
| 'xml_report': dict(pass_='success', fail='failure', yes='granted', no='denied', clear='resolved', blocked='active', tried='yes', untried='no', allowed='permitted', denied='forbidden'), | |
| 'slack_thread': dict(pass_='green', fail='red', yes='approved', no='pending', clear='cleared', blocked='active', tried='failed', untried='untried', allowed='yes', denied='no'), | |
| 'github_issue': dict(pass_='passing', fail='failing', yes='approved', no='rejected', clear='fixed', blocked='open', tried='failed', untried='not run', allowed='merged', denied='closed'), | |
| 'jira_ticket': dict(pass_='passed', fail='failed', yes='signed off', no='pending', clear='done', blocked='blocked', tried='failed', untried='not executed', allowed='approved', denied='rejected'), | |
| 'stack_trace': dict(pass_='OK', fail='ERR', yes='YES', no='NO', clear='CLEARED', blocked='ACTIVE', tried='FAILED', untried='PENDING', allowed='OK', denied='BLOCKED'), | |
| 'commit_msg': dict(pass_='pass', fail='fail', yes='approved', no='pending', clear='fixed', blocked='blocked', tried='failed', untried='skipped', allowed='merged', denied='rejected'), | |
| 'pr_review': dict(pass_='pass', fail='fail', yes='lgtm', no='changes requested', clear='resolved', blocked='blocked', tried='failed', untried='not run', allowed='approved', denied='denied'), | |
| } | |
| def render_family(s, rng, family): | |
| f, v = FAMILIES[family], VALUES[family] | |
| vals = dict(s) | |
| vals.update(checks=v['pass_'] if s['latest_pass'] else v['fail'], | |
| acceptance=v['yes'] if s['accepted'] else v['no'], | |
| blocker=v['clear'] if s['blocker_cleared'] else v['blocked'], | |
| retry=v['tried'] if s['retry_failed'] else v['untried'], | |
| rollback=v['allowed'] if s['rollback'] else v['denied']) | |
| parts = [f['status'].format(**vals), f['retry'].format(**vals), f['rollback'].format(**vals)] | |
| order = list(range(4)); rng.shuffle(order) | |
| for c in order: | |
| parts.append(f['trial_ok' if s['cleared'][c] else 'trial_bad'].format(component=COMPONENTS[c])) | |
| rng.shuffle(parts) | |
| return f['head'].format(**vals) + '\nAll component experiments below independently restart from the same initial failure.\n' + '\n'.join(parts) | |
| def generate(root='data/diversity-v2', size=20000, seed=1729): | |
| root=Path(root); root.mkdir(parents=True, exist_ok=True) | |
| train_families=['ticket','terminal','conversation','incident','json_log','xml_report','slack_thread','github_issue','jira_ticket','stack_trace','commit_msg','pr_review'] | |
| spec={'version':'renderer-diversity-v2','seed':seed,'train':size,'validation':2000,'calibration':2000,'test':2000, | |
| 'train_families':train_families,'validation_families':train_families, | |
| 'calibration_families':['calibration'],'test_families':['sealed']} | |
| save_json(root/'spec.json',spec) | |
| seen=set() | |
| for si,split in enumerate(['train','validation','calibration','test']): | |
| rng=random.Random(seed+si*1000000); rows=[]; families=spec[f'{split}_families'] | |
| while len(rows)<spec[split]: | |
| s=make_situation(rng); key=hashlib.sha256(json.dumps(s,sort_keys=True).encode()).hexdigest() | |
| if key in seen: continue | |
| seen.add(key); family=families[len(rows)%len(families)] | |
| rows.append({'id':key,'state':render_family(s,rng,family),'labels':labels(s),'latent':s, | |
| 'provenance':{'generator':spec['version'],'split':split,'renderer':family,'seed':seed}}) | |
| (root/f'{split}.jsonl').write_text(''.join(json.dumps(r)+'\n' for r in rows)) | |
| save_json(root/'manifest.json',{'spec':spec,'schema':SCHEMA,'policy':POLICY, | |
| 'sha256':{p.name:digest(p) for p in root.glob('*.jsonl')}}) | |
| # Fixed manual-audit packet, sampled before training; includes latent truth beside text. | |
| audit=random.Random(seed+777).sample([json.loads(x) for x in (root/'train.jsonl').read_text().splitlines()],100) | |
| (root/'manual_audit_100.jsonl').write_text(''.join(json.dumps(r)+'\n' for r in audit)) | |
| print(json.dumps(spec)) | |
| if __name__=='__main__': | |
| p=argparse.ArgumentParser(); p.add_argument('--output',default='data/diversity-v2'); p.add_argument('--size',type=int,default=20000) | |
| a=p.parse_args(); generate(a.output,a.size) | |