[object Object]

← back to Ticket System

Save replay scripts for verified gated monitoring cycle

a9cc691702c8792bde659603ae451f9ad239ae1a · 2026-09-09 06:50:26 -0700 · Steve Abrams

Files touched

Diff

commit a9cc691702c8792bde659603ae451f9ad239ae1a
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Wed Sep 9 06:50:26 2026 -0700

    Save replay scripts for verified gated monitoring cycle
---
 .../cycle-20260909T1337Z.hV13mE/observe.py         | 76 ++++++++++++++++++++++
 .../cycle-20260909T1337Z.hV13mE/verify-cycle.py    | 54 +++++++++++++++
 2 files changed, 130 insertions(+)

diff --git a/data/codex-yoloforever/cycle-20260909T1337Z.hV13mE/observe.py b/data/codex-yoloforever/cycle-20260909T1337Z.hV13mE/observe.py
new file mode 100644
index 00000000..0bdb8cab
--- /dev/null
+++ b/data/codex-yoloforever/cycle-20260909T1337Z.hV13mE/observe.py
@@ -0,0 +1,76 @@
+import datetime,hashlib,json,math,os,pathlib,plistlib,subprocess,sys,urllib.request,urllib.error
+P=pathlib.Path(__file__).resolve().parent
+ROOT=P.parents[2]
+PREV=ROOT/'data/codex-yoloforever/cycle-20260908T1322Z.m4gNE5'
+now=lambda:datetime.datetime.now(datetime.timezone.utc).isoformat()
+def sha(p):return hashlib.sha256(pathlib.Path(p).read_bytes()).hexdigest()
+records=[]
+def run(argv,stdin=None):
+ r=subprocess.run(argv,input=stdin,text=True,capture_output=True,timeout=50)
+ records.append(dict(at=now(),argv=argv,stdin=stdin,returncode=r.returncode,stdout=r.stdout,stderr=r.stderr))
+ return r
+mode=sys.argv[1]
+number={'backup':'10928','mdc':'11307','enrichment':'11290','pricing':'11250'}.get(mode)
+out={'observed_at':now(),'mode':mode,'commands':records}
+if number:
+ js="const l=require('/Users/macstudio3/Projects/ticket-system/lib');let t=[...l.tickets().values()].find(t=>t.id.startsWith('TK-"+number+"-'));console.log(JSON.stringify({...t,actions:t.actions.slice(-4),comments:t.comments.slice(-2)}));"
+ r=run(['node','-e',js]);assert r.returncode==0
+ out['canonical']=json.loads(r.stdout);records[-1]['stdout']='Reduced canonical ticket retained in canonical field'
+if mode=='backup':
+ r=run(['du','-sk','/Users/macstudio3/Projects/.git']);assert r.returncode==0
+ out['root_kib']=int(r.stdout.split()[0]);out['root_mb']=math.floor(out['root_kib']/1024+.5)
+ js="import {classifyRepo,KNOWN_LEGIT} from '/Users/macstudio3/.claude/skills/dw-backup-canary/lib.mjs';console.log(JSON.stringify({floor:KNOWN_LEGIT['(projects-root)'].floor_mb,result:classifyRepo({repo:'(projects-root)',mb:"+str(out['root_mb'])+",remote:null,upstream:null,ahead:0})}));"
+ r=run(['node','--input-type=module','-e',js]);out['classifier']=json.loads(r.stdout)
+ assert r.returncode==0 and out['classifier']['floor']==3000
+ r=run(['launchctl','print','gui/'+str(os.getuid())+'/com.steve.dw-backup-canary']);assert r.returncode==0
+ a=pathlib.Path('/Users/macstudio3/.claude/skills/dw-backup-canary/data/latest.json');out['scheduler_artifact']={'sha256':sha(a),'data':json.loads(a.read_text()),'mtime':a.stat().st_mtime}
+ out['refs']=run(['git','--git-dir=/Users/macstudio3/Projects/.git','show-ref']).stdout
+ out['index_sha256']=sha('/Users/macstudio3/Projects/.git/index')
+ out['protected_master_ancestor']=run(['git','--git-dir=/Users/macstudio3/Projects/.git','merge-base','--is-ancestor','c539b5a08a4f84a551d8825a0fc73fa588bcbce8','refs/heads/master']).returncode==0
+ out['limits']='Size only, no source maintenance or recovery claim. Provenance/current retained objects+undo/two snapshot intervals/scheduler PASS remain unverified.'
+elif mode=='mdc':
+ commits=[('fix-live-board','2fe5fee'),('designerwallcoverings','bddd4d7'),('dw-domain-fleet','42bf6b7'),('designerwallcoverings','740956f'),('designerwallcoverings','da49390'),('designerwallcoverings','01c73ed')]
+ out['existing_commits']=[]
+ for repo,c in commits:
+  r=run(['git','-C','/Users/macstudio3/Projects/'+repo,'show','-s','--format=%H %cI %s',c]);assert r.returncode==0
+  out['existing_commits'].append({'repo':repo,'commit':r.stdout.strip()})
+ out['limits']='Six existing owner commits verified by identity only, no new implementation credit or integration/live search proof.'
+elif mode=='enrichment':
+ sql="BEGIN READ ONLY; SHOW transaction_read_only; SELECT json_build_object('checked_at',now(),'latest_phase3',max(phase3_ai_at),'stale_hours',round(EXTRACT(EPOCH FROM (now()-max(phase3_ai_at)))/3600)) FROM enrichment_tracking; ROLLBACK;"
+ r=run(['ssh','-o','BatchMode=yes','-o','ConnectTimeout=10','kamatera','runuser -u postgres -- psql -X -v ON_ERROR_STOP=1 -d dw_unified -At -f -'],sql)
+ out['rows']=[json.loads(l) for l in r.stdout.splitlines() if l.startswith('{')]
+ assert r.returncode==0 and '\non\n' in r.stdout and r.stdout.rstrip().endswith('ROLLBACK') and len(out['rows'])==1
+ r=run(['ssh','-o','BatchMode=yes','-o','ConnectTimeout=10','kamatera',"stat -c '%s %y' /root/DW-Agents/logs/full-monte-phase3.log"]);assert r.returncode==0
+ out['log_metadata']=r.stdout.strip();out['limits']='Authoritative freshness and existing log metadata only; no provider/retry/checker POST or cause inference.'
+elif mode=='pricing':
+ r=run(['/opt/homebrew/bin/psql','-X','-w','-h','/tmp','-d','dw_unified','-At','--set','ON_ERROR_STOP=1','-f',str(PREV/'11250-pricing.sql')])
+ out['rows']=[json.loads(l) for l in r.stdout.splitlines() if l.startswith('{')]
+ assert r.returncode==0 and len(out['rows'])==2 and out['rows'][0]['read_only']=='on' and r.stdout.rstrip().endswith('ROLLBACK')
+ prior=json.loads((PREV/'11250-assessment.json').read_text());changed=[]
+ for x in prior['files']:
+  q=pathlib.Path(x['path']);s=q.stat() if q.exists() else None
+  if s is None or s.st_size!=x['size'] or s.st_mtime!=x['mtime']:changed.append(str(q))
+ out['known_inputs_checked']=len(prior['files']);out['changed_input_metadata']=changed;out['filename_candidates']=[];out['input_scope']=prior['input_scope']
+ for scope in prior['input_scope']:
+  r=run(['rg','--files','--hidden','-g','!node_modules','-g','!.git','-g','!.env*',scope])
+  assert r.returncode in (0,1)
+  out['filename_candidates'] += [x for x in r.stdout.splitlines() if any(k in pathlib.Path(x).name.lower() for k in ['wholesale','price','pricing','cost'])]
+ out['limits']='Local mirror/schema and scoped filenames/metadata only, not exhaustive inputs or current Shopify proof.'
+elif mode=='boundary':
+ out['http']=[]
+ for path,want in [('/healthz',200),('/api/tickets',401)]:
+  try:
+   with urllib.request.urlopen('http://127.0.0.1:9794'+path,timeout=10) as r:code,body=r.status,r.read().decode()
+  except urllib.error.HTTPError as e:code,body=e.code,e.read().decode()
+  out['http'].append(dict(path=path,code=code,body=body[:200],pass_check=code==want));assert code==want
+ base=json.loads((P/'preconditions.json').read_text());out['protected_files']=[dict(path=x,sha256=sha(x),pass_check=sha(x)==h) for x,h in base['files'].items()];assert all(x['pass_check'] for x in out['protected_files'])
+ assert os.getenv('DTD_ZERO_COST')=='1' and (ROOT/'config/dtd-cost-mode').read_text()=='ZERO_COST_REQUIRED\n'
+ config=plistlib.loads(pathlib.Path('/Users/macstudio3/Library/LaunchAgents/com.steve.codex-yoloforever.plist').read_bytes());out['interval']=config.get('StartInterval');out['STOPPED']=(ROOT/'data/codex-yoloforever/STOPPED').exists();assert out['interval']==600 and not out['STOPPED']
+ assert run(['launchctl','list','com.steve.codex-yoloforever']).returncode==0
+ out['limits']='Existing runner retained. Actual worker exit observable only by runner after return.'
+else:raise ValueError(mode)
+
+if mode=='backup':
+ d=out['scheduler_artifact']['data'];out['scheduler_artifact']['data']={k:v for k,v in d.items() if k!='results'};out['scheduler_artifact']['data']['root_result']=next((x for x in d.get('results',[]) if x.get('repo')=='(projects-root)'),None)
+out['captured_at']=now();out['assertions']='PASS';dest=P/(sys.argv[2] if len(sys.argv)>2 else mode+'-observation.json');dest.write_text(json.dumps(out,indent=2)+'\n')
+print(json.dumps({k:v for k,v in out.items() if k not in ['commands','canonical','scheduler_artifact','existing_commits','protected_files','refs','filename_candidates']},indent=2))
diff --git a/data/codex-yoloforever/cycle-20260909T1337Z.hV13mE/verify-cycle.py b/data/codex-yoloforever/cycle-20260909T1337Z.hV13mE/verify-cycle.py
new file mode 100644
index 00000000..baf600e8
--- /dev/null
+++ b/data/codex-yoloforever/cycle-20260909T1337Z.hV13mE/verify-cycle.py
@@ -0,0 +1,54 @@
+"""Read-only replay of this monitoring cycle; source outcomes remain unresolved."""
+import datetime, hashlib, json, os, pathlib, subprocess, urllib.request, urllib.error
+
+P = pathlib.Path(__file__).resolve().parent
+checks, commands = [], []
+def read(n): return json.loads((P / n).read_text())
+def sha(p): return hashlib.sha256(pathlib.Path(p).read_bytes()).hexdigest()
+def check(name, ok, evidence):
+    checks.append(dict(name=name, verdict='PASS' if ok else 'FAIL', evidence=evidence))
+def run(args):
+    r = subprocess.run(args, text=True, capture_output=True, timeout=40)
+    commands.append(dict(argv=args, exit_code=r.returncode, stdout=r.stdout, stderr=r.stderr))
+    return r
+
+base = read('preconditions.json')
+check('Environment zero-cost control retained', os.getenv('DTD_ZERO_COST') == '1', 'DTD_ZERO_COST=1 required')
+for path, digest in base['files'].items():
+    check('Protected bytes retained: ' + path, sha(path) == digest, digest)
+for e in read('guard-proof.json')['entrypoints']:
+    s = pathlib.Path(e['path']).read_text()
+    check('Installed guard forces zero cost before key handling: ' + e['path'],
+          sha(e['path']) == e['sha256'] and s.index('ZERO_COST_REQUIRED) DTD_ZERO_COST=1') < s.index('OPENAI_KEY='), e)
+for e in read('gated-memos.json'):
+    check('Existing memo retained: ' + e['path'], sha(e['path']) == e['sha256'], e['sha256'])
+q, result = read('ordered-dispositions.json'), read('cycle-result.json')
+check('Complete supplied order and dispositions', q == result['ordered_dispositions'] and
+      [e['rank'] for e in q] == [39, 60] and [e['disposition'] for e in q] == ['prepared-gated', 'external-blocked'], q)
+check('No monitoring counted as implementation', result['actual_implementation_progress'] ==
+      dict(execution_iterations=0, execution_cap=6, implementation_increments=0, operational_closures=0), result['actual_implementation_progress'])
+js = "const l=require('/Users/macstudio3/Projects/ticket-system/lib');console.log(JSON.stringify([...l.tickets().values()].filter(t=>t.id.startsWith('TK-11307-')||t.id.startsWith('TK-11250-')).map(t=>({id:t.id,status:t.status,assignee:t.assignee,updated_at:t.updated_at}))));"
+r = run(['node', '-e', js]); current = json.loads(r.stdout)
+check('Canonical owners and source states preserved', r.returncode == 0 and len(current) == 2 and
+      all(t['status'] == 'open' and t['assignee'] == next(e['owner_preserved'] for e in q if e['id'] == t['id']) for t in current), current)
+check('No new source handoff since assessment', all(t['updated_at'] == next(e['updated_at'] for e in read('canonical-initial.json')['sources'] if e['id'] == t['id']) for t in current), current)
+sql = P.parent / 'cycle-20260908T1322Z.m4gNE5/11250-pricing.sql'
+r = run(['/opt/homebrew/bin/psql', '-X', '-w', '-h', '/tmp', '-d', 'dw_unified', '-At', '--set', 'ON_ERROR_STOP=1', '-f', str(sql)])
+rows = [json.loads(s) for s in r.stdout.splitlines() if s.startswith('{')]
+check('Real local pricing transaction is read-only and rolls back', r.returncode == 0 and len(rows) == 2 and rows[0]['read_only'] == 'on' and r.stdout.rstrip().endswith('ROLLBACK'), rows)
+check('Known scoped pricing blocker still present', len(rows) == 2 and rows[0]['rows'] == 1470 and rows[0]['positive_cost'] == rows[0]['positive_price'] == 0 and rows[1]['price_columns'] == 0, {'rows':rows, 'limit':'Local mirror and schema only; not exhaustive or current Shopify'})
+for route, expected in [('/healthz', 200), ('/api/tickets', 401)]:
+    try:
+        with urllib.request.urlopen('http://127.0.0.1:9794' + route, timeout=10) as response: status, body = response.status, response.read().decode()
+    except urllib.error.HTTPError as e: status, body = e.code, e.read().decode()
+    check('Real ticket API ' + route, status == expected and body.strip() == ('ok' if expected == 200 else 'auth'), {'status':status,'body':body})
+run_result = run(['launchctl', 'list', 'com.steve.codex-yoloforever'])
+import plistlib
+config = plistlib.loads(pathlib.Path('/Users/macstudio3/Library/LaunchAgents/com.steve.codex-yoloforever.plist').read_bytes())
+check('Existing 600-second runner remains loaded', run_result.returncode == 0 and config.get('StartInterval') == 600 and not (P.parent / 'STOPPED').exists(), {'interval':config.get('StartInterval'),'STOPPED':(P.parent/'STOPPED').exists()})
+checks.append(dict(name='Source outcome UI and catalog acceptance', verdict='SKIP', critical_for='Source completion', reason='No source implementation. Current source parity, rendered native/Boost search/card/AJAX, CTA and screenrecord, wholesale data and exact rollout approvals remain missing.'))
+out = dict(schema_version=1, intent='Prove monitoring evidence and preserved gates, not source delivery', risk_tier='R0 evidence with real read-only API/SQL checks', environment='MacStudio3 local mirror and canonical ticket ledger', timestamp=datetime.datetime.now(datetime.timezone.utc).isoformat(), baseline=base, build_identity=run(['git','-C',str(P.parents[2]),'rev-parse','HEAD']).stdout.strip(), commands=commands, checks=checks, summary={v:sum(e['verdict']==v for e in checks) for v in ['PASS','FAIL','SKIP']}, source_outcomes='Both UNRESOLVED', final_dtd=read('final-dtd.json') if (P/'final-dtd.json').exists() else 'Pending', retained_state='Evidence only; no source writes, rollback needed or cleanup deletion. Runner return observed externally after turn.', cycle_verdict='PASS monitoring evidence only' if not any(e['verdict']=='FAIL' for e in checks) else 'FAIL')
+(P/'verification').mkdir(exist_ok=True)
+(P/'verification/e2e-proof.json').write_text(json.dumps(out,indent=2)+'\n')
+print(json.dumps({'summary':out['summary'],'cycle_verdict':out['cycle_verdict'],'source_outcomes':out['source_outcomes']}))
+raise SystemExit(1 if any(e['verdict']=='FAIL' for e in checks) else 0)

← c040827a auto-data-snapshot: 2026-09-09T06:50:05 (35 data files) — da  ·  back to Ticket System  ·  Record ordered monitoring cycle and independent council comp 028ba24f →