diff --git a/scripts/stage-editorial-acceptance.py b/scripts/stage-editorial-acceptance.py index b7b18637..e1b9d53a 100644 --- a/scripts/stage-editorial-acceptance.py +++ b/scripts/stage-editorial-acceptance.py @@ -79,9 +79,8 @@ def main(): if p['state']!='GATE1_PENDING' or p['version']!=2: raise ValueError('Fresh proposal only; never replay execution') task=p['taskId']; route='tasks/'+task approved=a(route+'/gates/1/decide',{'decision':'APPROVED','expectedVersion':p['version'],'idempotencyKey':SESSION+':gate1','expiresAt':time.strftime('%Y-%m-%dT%H:%M:%SZ',time.gmtime(time.time()+450)),'notes':'Explicit owner-authorized bounded Stage acceptance only; no QA/publication/Production authority.'}) - if approved['state']!='GATE1_APPROVED': raise ValueError('Gate1 required') - ready=w('editorial-queue',{'taskId':task,'expectedVersion':approved['version'],'idempotencyKey':SESSION+':queue'}) - if ready['state']!='READY': raise ValueError('READY required') + # Gate1 approval atomically queues PREPARE tasks; no second queue request. + if approved['state']!='READY': raise ValueError('Gate1 must enqueue READY') # Exactly one process, as hermes. Installed runner has 120-second profile cap, # CLI headroom30 and allowlisted timing evidence. Total330 fits window480. code="import sys,json;sys.path.insert(0,'/opt/data/editorial-v4/runtime-package');import runner;from pathlib import Path;runner.run(Path('/opt/data'),sys.argv[1],total_seconds=330)" diff --git a/scripts/test_stage_editorial_acceptance.py b/scripts/test_stage_editorial_acceptance.py index 6b80e4e8..893a3139 100644 --- a/scripts/test_stage_editorial_acceptance.py +++ b/scripts/test_stage_editorial_acceptance.py @@ -9,6 +9,11 @@ m=importlib.util.module_from_spec(spec) if p.exists(): spec.loader.exec_module(m) class AcceptanceTests(unittest.TestCase): + def test_gate1_uses_actual_atomic_ready_contract(self): + source=p.read_text() + self.assertIn("approved['state']!='READY'",source) + self.assertNotIn("approved['state']!='GATE1_APPROVED'",source) + self.assertNotIn("w('editorial-queue'",source) def test_prior_contract_copied_exactly(self): prior={'state':'FAILED','version':5,'title':'Editorial research: Persian owner topic','metadata':{'scope':'editorial-research-to-brief-v1\nTopic: Persian owner topic\nResearch and evidence-backed brief only. No publication, release, production changes or execution authorization.','acceptanceCriteria':['Do not invent QA']}} self.assertTrue(hasattr(m,'proposal'), 'missing bounded proposal builder')