feat(corporate): persist dated monthly plans and repair verified release gates
Deploy Canina / deploy (push) Successful in 4m38s
Deploy Canina / deploy (push) Successful in 4m38s
This commit is contained in:
1 parent
18094f91a6
commit
216e05ba25
18 files changed
+829
-29
No files matched your search
@@ -202,6 +202,13 @@ def ingest(client, store, manifest, hosts, key):
|
||||
return {'research': result, 'requestDigest': request_digest}
|
||||
|
||||
|
||||
def monthly_plan(client, store, body, key):
|
||||
# Backend owns calendar and stored-lineage validation. Preserve the exact
|
||||
# request before transmission; an ambiguous POST is never retried blindly.
|
||||
digest = client.checkpoint(store, key, 'monthly-plans', body)
|
||||
return {'plan': client.call('monthly-plans', body, key), 'checkpointDigest': digest}
|
||||
|
||||
|
||||
def fanout(client, roadmap, key):
|
||||
tasks = []
|
||||
for goal in roadmap['goals']:
|
||||
@@ -261,6 +268,8 @@ def main():
|
||||
i = sub.add_parser('replay-ingest'); i.add_argument('request_digest')
|
||||
i = sub.add_parser('replay-evidence'); i.add_argument('checkpoint_digest')
|
||||
i = sub.add_parser('roadmap'); i.add_argument('manifest')
|
||||
i = sub.add_parser('plan-month'); i.add_argument('manifest')
|
||||
i = sub.add_parser('read-plan'); i.add_argument('roadmap_id'); i.add_argument('month')
|
||||
i = sub.add_parser('fanout'); i.add_argument('roadmap_id')
|
||||
i = sub.add_parser('execute'); i.add_argument('--department', required=True)
|
||||
i = sub.add_parser('qa'); i.add_argument('task_id'); i.add_argument('evidence_id')
|
||||
@@ -268,7 +277,7 @@ def main():
|
||||
i = sub.add_parser('report'); i.add_argument('manifest')
|
||||
sub.add_parser('status')
|
||||
a = p.parse_args()
|
||||
if a.command != 'status' and not a.key:
|
||||
if a.command not in ('status', 'read-plan') and not a.key:
|
||||
p.error('--key required for mutations')
|
||||
c = Client(a.api, 'CORPORATE_QA_API_KEY' if a.command == 'qa' else 'CORPORATE_API_KEY', a.allow_stage_https)
|
||||
s = Store(a.store)
|
||||
@@ -280,6 +289,11 @@ def main():
|
||||
body = load()
|
||||
if body.get('isActive') is not False: raise ValueError('Manual roadmap must explicitly be inactive')
|
||||
result = c.call('monthly-roadmap', body, a.key)
|
||||
elif a.command == 'plan-month': result = monthly_plan(c, s, load(), a.key)
|
||||
elif a.command == 'read-plan':
|
||||
if not re.fullmatch(r'[a-f0-9-]{36}', a.roadmap_id) or not re.fullmatch(r'[2-9][0-9]{3}-(0[1-9]|1[0-2])', a.month):
|
||||
raise ValueError('Invalid roadmap/month')
|
||||
result = c.call('monthly-plans/' + a.roadmap_id + '?month=' + a.month)
|
||||
elif a.command == 'fanout':
|
||||
page = 1
|
||||
while True:
|
||||
|
||||
@@ -40,6 +40,23 @@ class Safety(unittest.TestCase):
|
||||
digest = client.checkpoint(store, 'stable-key', path, {'result': 'original timestamp'})
|
||||
self.assertEqual(client.replay(store, digest), {'id': 'persisted'})
|
||||
self.assertEqual(calls, [(path, {'result':'original timestamp'}, 'stable-key')])
|
||||
def test_monthly_plan_checkpoints_exact_request_before_post(self):
|
||||
calls = []
|
||||
class Client:
|
||||
def checkpoint(self, store, key, path, body):
|
||||
calls.append(('checkpoint', key, path, body))
|
||||
return 'digest'
|
||||
def call(self, path, body, key):
|
||||
calls.append(('post', key, path, body))
|
||||
return {'tasks': [{'id': 'persisted'}]}
|
||||
body = {'roadmapId': 'stored-roadmap', 'month': '2026-10',
|
||||
'dailyArticles': [{'dueCycle': '2026-10-01', 'sourceIds': ['stored-source']}], 'needs': []}
|
||||
result = r.monthly_plan(Client(), object(), body, 'stable-plan-key')
|
||||
self.assertEqual([c[0] for c in calls], ['checkpoint', 'post'])
|
||||
self.assertEqual(calls[0][1:], calls[1][1:])
|
||||
self.assertEqual(calls[1][1:], ('stable-plan-key', 'monthly-plans', body))
|
||||
self.assertEqual(result, {'plan': {'tasks': [{'id': 'persisted'}]}, 'checkpointDigest': 'digest'})
|
||||
|
||||
def test_api_target(self):
|
||||
with self.assertRaises(ValueError): r.api_target('http://example.com/api/admin/hermes',False)
|
||||
with self.assertRaises(ValueError): r.api_target('https://example.com/api/admin/hermes',False)
|
||||
|
||||
Reference in new issue
Block a user