fix(ci): honor atomic Gate1 READY transition in Stage acceptance

This commit is contained in:
Hermes Agent committed 2026-10-24 15:59:47 +00:00
1 parent 32d7116ce7
commit 0837042865
2 files changed
+7 -3

No files matched your search

+2 -3
View File
@@ -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)"
@@ -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')