fix(editorial): honor functional bring-up model and completion policy

This commit is contained in:
devops committed 2026-10-24 16:26:06 +00:00
1 parent 860324e3a9
commit 76670090ed
11 files changed
+178 -25

No files matched your search

+1 -1
View File
@@ -10,7 +10,7 @@ from pathlib import Path
import stat
PROFILES=('pmo','canina-competitor-worker','canina-seo-worker','canina-content-worker','canina-vet-review-worker','canina-qa-worker')
PACKAGE={'bundle.json','installer.py','client.py','runner.py','payload/editorial-v4/status.json'} | {f'payload/profiles/{p}/skills/canina-editorial-v4/{f}' for p in PROFILES for f in ('SKILL.md','references/policy.md','references/role.json')}
PACKAGE={'bundle.json','installer.py','client.py','runner.py','model-policy.json','payload/editorial-v4/status.json'} | {f'payload/profiles/{p}/skills/canina-editorial-v4/{f}' for p in PROFILES for f in ('SKILL.md','references/policy.md','references/role.json')}
LEAVES={'editorial-v4/owner-proposal.json','editorial-v4/status.json','editorial-v4/deployment.json','editorial-v4/credentials/editorial-pmo-token','editorial-v4/.installer/lock','editorial-v4/.installer/transaction.json'} | {'editorial-v4/runtime-package/'+f for f in PACKAGE} | {f'profiles/{p}/skills/canina-editorial-v4/{f}' for p in PROFILES for f in ('SKILL.md','references/policy.md','references/role.json')}
# State names are taken from the reviewed clients, not arbitrary directory trees.
STATE_ROOTS={'editorial-v4/runner-state','editorial-v4/client-state'} | {f'profiles/{p}/cache/editorial-runner' for p in PROFILES}
+3 -2
View File
@@ -14,7 +14,7 @@ import subprocess
import tempfile
PROFILES=('pmo','canina-competitor-worker','canina-seo-worker','canina-content-worker','canina-vet-review-worker','canina-qa-worker')
FILES={'bundle.json','installer.py','client.py','runner.py'} | {'payload/editorial-v4/status.json'} | {f'payload/profiles/{p}/skills/canina-editorial-v4/{f}' for p in PROFILES for f in ('SKILL.md','references/policy.md','references/role.json')}
FILES={'bundle.json','installer.py','client.py','runner.py','model-policy.json'} | {'payload/editorial-v4/status.json'} | {f'payload/profiles/{p}/skills/canina-editorial-v4/{f}' for p in PROFILES for f in ('SKILL.md','references/policy.md','references/role.json')}
def safe(path):
if not path.is_absolute() or '..' in path.parts: raise ValueError('Canonical path required')
@@ -66,6 +66,7 @@ def install(home, payload):
installer=importlib.util.module_from_spec(spec);spec.loader.exec_module(installer)
installer.execute('install',home)
report=installer.execute('verify',home)
model_profiles=installer.configure_models(home)
# Confirm all six skill discovery paths, without activating any scheduler.
for profile in PROFILES:
skill=home/f'profiles/{profile}/skills/canina-editorial-v4/SKILL.md'
@@ -80,7 +81,7 @@ def install(home, payload):
else:
value=secrets.token_urlsafe(48);atomic(token,value.encode())
atomic(home/'editorial-v4/deployment.json',json.dumps({'commitSha':payload['commitSha']}).encode())
return {'files':report['files'],'profiles':list(PROFILES),'credentialSha256':hashlib.sha256(value.encode()).hexdigest()}
return {'files':report['files'],'modelProfiles':model_profiles,'profiles':list(PROFILES),'credentialSha256':hashlib.sha256(value.encode()).hexdigest()}
def add_grant(config,digest):
if set(config)!={'grants','workerIds','stageCiIds','artifactBaseUrl'} or not re.fullmatch('[0-9a-f]{64}',digest):raise ValueError('Invalid grants')
+6
View File
@@ -20,6 +20,12 @@ class ProvisionTests(unittest.TestCase):
home=Path(t); sentinel=home/'config.yaml';sentinel.write_text('unchanged')
credentials=home/'credentials'; credentials.mkdir(); credentials.chmod(0o755)
os.chown(credentials,10000,10000)
policy=json.loads((BUNDLE/'model-policy.json').read_text())
registered=set(policy['profiles'])-set(policy['additionalProfiles'])
(home/policy['registry']).write_text('departments:\n'+''.join(' d%d: {profile: %s}\n' % (i,p) for i,p in enumerate(sorted(registered))))
for profile in policy['profiles']:
config=home/'profiles'/profile/'config.yaml';config.parent.mkdir(parents=True)
config.write_text('model:\n default: old\n provider: custom\nplatforms:\n telegram:\n allow_from: [123]\n');config.chmod(0o600)
payload=m.package(BUNDLE,'a'*40)
a=m.install(home,payload);b=m.install(home,payload)
self.assertEqual(a,b);self.assertEqual(sentinel.read_text(),'unchanged')