Compare commits

...
Author SHA1 Message Date
james.maesandCodex 8160559838 ci: run business E2E on changes and preserve main validation
Co-Authored-By: Codex <noreply@openai.com>
2026-10-21 01:14:58 -05:00
james.maesandCodex 5e9bbb54ec ci: add batch version rollout for canonical consumers (#54)
Validate every checkout before updating its orb pin. Preserve publication policy, filters, credentials contexts and forwarded parameters; reject custom callers and mismatched declarations. Cover all 12 profiles, dry runs, no-op repeats, invalid batches and duplicate input with six new tests in the existing contract job. Existing migration and standard tests pass; Linux packed generator check passes.

Co-authored-by: Codex <noreply@openai.com>
2026-10-21 00:45:50 -05:00
james.maesandCodex 5bcec90e33 ci: report the shared database gate on every pull request (#53)
Preserve migration verification, avoid duplicate feature push builds, and cancel superseded pull request runs so the gate can be required safely.

Co-authored-by: Codex <noreply@openai.com>
2026-10-20 22:25:38 -05:00
james.maesandCodex a50b07d927 fix: escape Android heredoc in continued Circle configuration (#51)
Circle accepts the continuation request before reporting an unescaped heredoc as a pipeline configuration error. Escape the template marker and emulate Circle unescaping in executable publisher tests. Validate the actual continued config with CircleCI.

Co-authored-by: Codex <noreply@openai.com>
2026-10-20 22:00:56 -05:00
12 changed files with 252 additions and 27 deletions

No files matched your search

+1
View File
@@ -49,6 +49,7 @@ jobs:
python3 tests/test_cli_ci_contract.py
python3 tests/test_maven_ci_contract.py
python3 tests/test_standardize_qbit.py
python3 tests/test_rollout_version.py
python3 tests/test_validate_standard.py
python3 tests/test_voyage_profile.py
python3 tests/test_next_native.py
+1
View File
@@ -58,6 +58,7 @@ test-pipelines: pack
bash tests/test_cli_ci_behavior.sh
python3 tests/test_cli_ci_contract.py
python3 tests/test_standardize_qbit.py
python3 tests/test_rollout_version.py
python3 tests/test_validate_standard.py
python3 tests/test_voyage_profile.py
python3 tests/test_next_native.py
+26
View File
@@ -65,3 +65,29 @@ actionlint .github/workflows/workflow-lint.yml
Tests cover exact no-CI allowlists and drift, unknown repositories, missing configured
profiles/native bridges, retained legacy workflows, bootstrap dependency/gate removal,
required-check unknown states, and the lint image/tool/command/caller contract.
## Batch orb-version rollout
Upgrade existing canonical CircleCI consumers with one command:
```sh
python tools/rollout_version.py --orb-version 0.7.11 /checkouts/qbit-one /checkouts/qqq-cli
python tools/rollout_version.py --orb-version 0.7.11 --write /checkouts/qbit-one /checkouts/qqq-cli
```
The first command previews the batch. The second updates only `.qqq-ci.yml` and
`.circleci/config.yml`, after every supplied checkout passes the existing manifest
and canonical-caller validators. It preserves publication opt-outs, release filters,
credential context names and forwarded profile parameters. Already-current files
are unchanged. Duplicate checkouts, custom jobs, invalid options and mismatched
pins reject the batch before writing; resolve these in the central profile first.
Use isolated checkouts of the intended repository heads, inspect the resulting
patches, then commit and push through the normal automated gates. The tool does not
commit, push, publish packages, change GitHub rules or modify native/RC worker pins.
A version update does not prove a publication succeeded: retain exact-head hosted
verification and artifact evidence. The requested version must already be published.
```sh
python3 -m unittest discover -s tests -p test_rollout_version.py
```
+1 -1
View File
@@ -22,7 +22,7 @@ VOYAGE_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNrtW+tz2zYS/56/A
NEXT_TEMPLATE = json.loads(zlib.decompress(base64.b64decode("eNrNVE1v2zAMvedXCFqAtlscb70tQLGtXTEUGFYgHXqJM0OxmUSJLCmS7DYr8t9HubaXOOnHYYfdLPLp6fGR9EOHEFqAsVxJOiCn/Q89H1FmYvH4gN94Wq1WAUYwQJdczqxRahlWwc9xfD08j28vhzdX1z/imOKVTcmxUNscOp8Ibudxyux8ophJ4wUzTRoBcA9J7pSP1Q+GC1Yw2qsR1oH2jKMqgKFkDslS5a4BkYZwW3nIpXVMiLgkHOxgEFVnpUoBs87k0NtF+Ez81yZ6ekq3AJvme/OEDpPL/Wcly/xz9BYMn66JmwPhWZY7NhFADAhgFkj9aEtQorKMydRfr5C1vLOIdh8uroYX3y/jn1++vSk2EY3k1CjpQKYNqnvsayKBJhEyrHJu4PioH2qWLNkM+gur5NFJv0JH9CSSGStAbt3PCkmCcxKsyByEHkDBRM4cUn6Fe23AljBt1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+HELwPjj2WPhqxIlCl3G5u4pgcpjhq87IKiUc4qGj8NmCTAFFi15HObHp7vLD5gLXiPGDUbLXTF37lJluGXONcI6aTvTlC2I0VejryyywCgqcWXAHl1AYMVNd5hRKpLvbyWSz2XxF39H7VuHZ/EE2Q7orNBwzb2fFEtZ53Psj6YRBHO2OrUMaxOyJCZV74XRNwmkb9YusjU+6u3OoZU/pAF97DuVyXyv6WnEo9vna7nOdXr8trMqrvDBpv88rKK52XkI/7dVhyoiw6fYJDvv6lXaVTvBtMpn0QOJ5bzI8Fu4jGQb1HojoaPWB+hM4ahP8KL2OlXjg1t+Ym506ASriBbDG64Sr0glN1C9TJ5xyd2ehE07oAK8ThnK51wleJwzFPq8TPtfpXid4nTAYNzt1gmaCEcMw7DvmMbHMKwb/SVZNCv+JzjCuON/vbwbwlhcuZxEfr3K8yjkLqnpJ9BtHyOsnr58ugshVbR/VM/ezuMLhBvcODhzy/8NhuSgd0qmCc63igtrquPby93r+YJYRLv2LvsES1XuKmGFfvJ2KKEXuXrpFNIZckKt+llQ4TGNc4tq+2Q4P/lbJzxWTdv1zpUIqCgP7xvAsqdy0RzH5xLWSGaDdSHcIdhhOlM5ICViCMXjA/2UdqH2StngXvklasNCw0DJJpDXl2LCGh83UxJ3R4zXJxIEFHsEuIwaBKuUb5T+chfEh62tks9Z/qkigP/+63PR6Mvr6Oub/cvR+XeL+e3q0Gf0Hgnpc+w==")))
+1 -1
View File
@@ -87,7 +87,7 @@
{
"run": {
"name": "Publish with shared Maven credentials",
"command": "set -euo pipefail\n: \"${GITHUB_TOKEN:?GitHub Packages write credential is required}\"\n# Authenticate before compiling; repository access is necessary, not proof of package write access.\nregistry_user=$(python3 <<'PYTHON'\nimport json\nimport os\nimport urllib.request\n\nclass NoRedirect(urllib.request.HTTPRedirectHandler):\n def redirect_request(self, req, fp, code, msg, headers, newurl):\n raise RuntimeError(\"GitHub authentication redirect refused\")\n\ntry:\n opener = urllib.request.build_opener(NoRedirect)\n def get(path):\n request = urllib.request.Request(\"https://api.github.com/\" + path,\n headers={\"Authorization\": \"Bearer \" + os.environ[\"GITHUB_TOKEN\"],\n \"Accept\": \"application/vnd.github+json\"})\n with opener.open(request, timeout=30) as response:\n return json.load(response)\n user = get(\"user\").get(\"login\")\n if not isinstance(user, str) or not user or not get(\"repos/QRun-IO/qqq-maven-registry\").get(\"permissions\", {}).get(\"push\"):\n raise ValueError(\"Missing registry access\")\n print(user)\nexcept Exception:\n raise SystemExit(\"GitHub Packages credential cannot access the Maven registry\") from None\nPYTHON\n)\nexport ORG_GRADLE_PROJECT_githubQqqMavenRegistryUsername=\"$registry_user\"\nexport ORG_GRADLE_PROJECT_githubQqqMavenRegistryPassword=\"$GITHUB_TOKEN\"\n./gradlew --console=plain publishMavenPublicationToGithubQqqMavenRegistryRepository\n"
"command": "set -euo pipefail\n: \"${GITHUB_TOKEN:?GitHub Packages write credential is required}\"\n# Authenticate before compiling; repository access is necessary, not proof of package write access.\nregistry_user=$(python3 \\<<'PYTHON'\nimport json\nimport os\nimport urllib.request\n\nclass NoRedirect(urllib.request.HTTPRedirectHandler):\n def redirect_request(self, req, fp, code, msg, headers, newurl):\n raise RuntimeError(\"GitHub authentication redirect refused\")\n\ntry:\n opener = urllib.request.build_opener(NoRedirect)\n def get(path):\n request = urllib.request.Request(\"https://api.github.com/\" + path,\n headers={\"Authorization\": \"Bearer \" + os.environ[\"GITHUB_TOKEN\"],\n \"Accept\": \"application/vnd.github+json\"})\n with opener.open(request, timeout=30) as response:\n return json.load(response)\n user = get(\"user\").get(\"login\")\n if not isinstance(user, str) or not user or not get(\"repos/QRun-IO/qqq-maven-registry\").get(\"permissions\", {}).get(\"push\"):\n raise ValueError(\"Missing registry access\")\n print(user)\nexcept Exception:\n raise SystemExit(\"GitHub Packages credential cannot access the Maven registry\") from None\nPYTHON\n)\nexport ORG_GRADLE_PROJECT_githubQqqMavenRegistryUsername=\"$registry_user\"\nexport ORG_GRADLE_PROJECT_githubQqqMavenRegistryPassword=\"$GITHUB_TOKEN\"\n./gradlew --console=plain publishMavenPublicationToGithubQqqMavenRegistryRepository\n"
}
}
]
+6 -17
View File
@@ -198,20 +198,10 @@
"caller": {
"name": "Database migrations",
"on": {
"pull_request": {
"paths": [
"db/**",
"pom.xml",
".github/workflows/db-migrations.yml"
]
},
"pull_request": {},
"push": {
"branches": [
"main"
],
"paths": [
"db/**",
"pom.xml"
]
}
},
@@ -222,6 +212,10 @@
"validate": {
"uses": "QRun-IO/qqq-orb/.github/workflows/business-db.yml@WORKER_SHA"
}
},
"concurrency": {
"group": "business-db-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}",
"cancel-in-progress": "${{ github.event_name == 'pull_request' }}"
}
}
},
@@ -262,11 +256,6 @@
"main"
]
},
"schedule": [
{
"cron": "17 6 * * *"
}
],
"workflow_dispatch": null
},
"permissions": {
@@ -274,7 +263,7 @@
},
"concurrency": {
"group": "e2e-${{ github.ref }}",
"cancel-in-progress": true
"cancel-in-progress": "${{ github.event_name == 'pull_request' }}"
},
"jobs": {
"validate": {
+4 -2
View File
@@ -58,12 +58,14 @@ class SpecialistNativeTests(unittest.TestCase):
def worker(self, kind):
return yaml.safe_load((ROOT / '.github/workflows' / (kind + '.yml')).read_text(encoding='utf-8'))
def test_business_database_job_and_path_filters_are_unchanged(self):
def test_business_database_gate_reports_for_every_pr_and_preserves_validation(self):
original = self.originals['business-db']
worker = self.worker('business-db')
self.assertEqual(worker['jobs'], original['workflow']['jobs'])
caller = bridge.canonical('business-db', SHA)
self.assertEqual(caller['on'], original['events'])
self.assertEqual(caller['on'], {'pull_request': {}, 'push': {'branches': ['main']}})
self.assertEqual(caller['concurrency']['cancel-in-progress'], "${{ github.event_name == 'pull_request' }}")
self.assertIn('github.event.pull_request.number || github.ref', caller['concurrency']['group'])
self.assertEqual(set(worker['jobs']), {'empty-database-migration'})
self.assertNotIn('secrets', caller['jobs']['validate'])
self.assertNotIn('schedule', caller['on'])
+6 -3
View File
@@ -29,11 +29,14 @@ class BusinessE2ETests(unittest.TestCase):
self.assertEqual('always()', self.worker['jobs']['e2e']['steps'][-1]['if'])
self.assertEqual('docker compose -f deploy/compose/docker-compose.yml down -v', self.worker['jobs']['e2e']['steps'][-1]['run'])
def test_events_permissions_path_and_single_concurrency_owner_preserved(self):
self.assertEqual(self.original['events'], self.caller['on'])
def test_code_changes_and_manual_runs_keep_full_gate_without_nightly_duplicates(self):
expected_events = copy.deepcopy(self.original['events'])
del expected_events['schedule']
self.assertEqual(expected_events, self.caller['on'])
self.assertEqual(self.original['workflow']['permissions'], self.caller['permissions'])
self.assertEqual(self.caller['permissions'], self.worker['permissions'])
self.assertEqual(self.original['workflow']['concurrency'], self.caller['concurrency'])
self.assertEqual(self.original['workflow']['concurrency']['group'], self.caller['concurrency']['group'])
self.assertEqual("${{ github.event_name == 'pull_request' }}", self.caller['concurrency']['cancel-in-progress'])
self.assertNotIn('concurrency', self.worker)
self.assertEqual('.github/workflows/e2e.yml', aux.BRIDGES['business-e2e']['path'])
self.assertEqual({'workflow_call': {'secrets': {'E2E_ALERT_WEBHOOK_URL': {'required': False}}}}, self.worker['on'])
+3 -1
View File
@@ -38,7 +38,9 @@ class MobilePolicyTests(unittest.TestCase):
data = json.loads((ROOT / "src/scripts/templates/android.json").read_text())
steps = data["jobs"]["maven-deploy"]["steps"]
self.assertEqual(len(steps), 3)
command = steps[2]["run"]["command"]
raw = steps[2]["run"]["command"]
self.assertIn("python3 \\<<'PYTHON'", raw)
command = raw.replace("\\<<", "<<")
with tempfile.TemporaryDirectory() as folder:
root = Path(folder)
runner = root / "gradlew"
+109
View File
@@ -0,0 +1,109 @@
"""Version rollouts preserve policy and reject drift before changing any repo."""
import importlib.util
from pathlib import Path
import tempfile
import unittest
import yaml
spec = importlib.util.spec_from_file_location('rollout', Path(__file__).resolve().parents[1] / 'tools/rollout_version.py')
rollout = importlib.util.module_from_spec(spec)
spec.loader.exec_module(rollout)
class RolloutTests(unittest.TestCase):
def setUp(self):
self.temp = tempfile.TemporaryDirectory()
self.addCleanup(self.temp.cleanup)
self.root = Path(self.temp.name)
def checkout(self, name, profile='qbit', explicit=False, **policy):
root = self.root / name
(root / '.circleci').mkdir(parents=True)
manifest = {'profile': profile, 'orb_version': '0.7.4', 'default_branch': 'develop', **policy}
caller = rollout.standard.canonical_caller(profile, '0.7.4', explicit_manifest=explicit,
release_tag_policy=manifest.get('release_tag_policy'))
(root / '.qqq-ci.yml').write_text(yaml.safe_dump(manifest), encoding='utf-8')
(root / '.circleci/config.yml').write_text(yaml.safe_dump(caller), encoding='utf-8')
return root
def contents(self, root):
return [(root / path).read_bytes() for path in ('.circleci/config.yml', '.qqq-ci.yml')]
def test_batch_preserves_opt_outs_filters_contexts_and_forwarded_parameters(self):
qbit = self.checkout('qbit', release_tag_policy='none', release_on_main=False,
test_branch_policy='feature', browsers=False,
publish={'snapshot': False, 'release_candidate': False, 'release': False})
core = self.checkout('core', profile='core', explicit=True)
cli = self.checkout('cli', profile='cli', publish={'release': True}, publish_context='npm-publisher')
roots = [qbit, core, cli]
originals = [yaml.safe_load((root / '.qqq-ci.yml').read_text()) for root in roots]
results = rollout.rollout(roots, '0.7.11', write=True)
self.assertTrue(all(result['changed'] for result in results))
for root, original in zip(roots, originals):
expected = {**original, 'orb_version': '0.7.11'}
self.assertEqual(expected, yaml.safe_load((root / '.qqq-ci.yml').read_text()))
rollout.standard.validate(*(data.decode() for data in self.contents(root)), '0.7.11')
rollout.pipeline.load_manifest(root / '.qqq-ci.yml', '0.7.11')
core_caller = yaml.safe_load((core / '.circleci/config.yml').read_text())
options = core_caller['workflows']['setup']['jobs'][0]['qqq-orb/generate_pipeline']
self.assertEqual('.qqq-ci.yml', options['manifest'])
self.assertEqual('<< pipeline.parameters.mongo_bind_diagnostics >>', options['mongo_bind_diagnostics'])
def test_all_supported_profiles_remain_valid_after_the_same_batch_upgrade(self):
roots = [self.checkout(profile, profile=profile, default_branch='main') for profile in rollout.standard.PROFILE_PARAMETERS]
results = rollout.rollout(roots, '0.7.11', write=True)
self.assertEqual(set(rollout.standard.PROFILE_PARAMETERS), {item['profile'] for item in results})
for root in roots:
rollout.pipeline.load_manifest(root / '.qqq-ci.yml', '0.7.11')
rollout.standard.validate(*(data.decode() for data in self.contents(root)), '0.7.11')
def test_dry_run_and_repeated_application_do_not_rewrite_files(self):
root = self.checkout('qbit')
before = self.contents(root)
self.assertTrue(rollout.rollout([root], '0.7.11')[0]['changed'])
self.assertEqual(before, self.contents(root))
rollout.rollout([root], '0.7.11', write=True)
applied = self.contents(root)
self.assertFalse(rollout.rollout([root], '0.7.11', write=True)[0]['changed'])
self.assertEqual(applied, self.contents(root))
def test_one_custom_caller_rejects_entire_batch_before_any_write(self):
good = self.checkout('good')
bad = self.checkout('bad')
before = self.contents(good)
with (bad / '.circleci/config.yml').open('a') as stream:
stream.write('\njobs: {custom: {steps: [checkout]}}\n')
with self.assertRaises(ValueError):
rollout.rollout([good, bad], '0.7.11', write=True)
self.assertEqual(before, self.contents(good))
def test_duplicate_manifest_keys_unknown_settings_and_mismatched_pins_are_rejected(self):
for suffix in ['orb_version: 0.7.4\n', 'unknown_setting: true\n', 'publish: {release: maybe}\n']:
with self.subTest(suffix=suffix):
root = self.checkout(str(len(list(self.root.iterdir()))))
with (root / '.qqq-ci.yml').open('a') as stream:
stream.write(suffix)
before = self.contents(root)
with self.assertRaises(ValueError):
rollout.rollout([root], '0.7.11', write=True)
self.assertEqual(before, self.contents(root))
root = self.checkout('mismatch')
path = root / '.circleci/config.yml'
path.write_text(path.read_text().replace('0.7.4', '0.7.3'))
with self.assertRaises(ValueError):
rollout.rollout([root], '0.7.11', write=True)
def test_invalid_target_and_duplicate_checkout_are_rejected(self):
root = self.checkout('qbit')
before = self.contents(root)
for version in ['latest', 'dev:test', '0.7', '0.7.11\n']:
with self.assertRaises(ValueError):
rollout.rollout([root], version, write=True)
with self.assertRaises(ValueError):
rollout.rollout([root, root], '0.7.11', write=True)
self.assertEqual(before, self.contents(root))
if __name__ == '__main__':
unittest.main()
+92
View File
@@ -0,0 +1,92 @@
#!/usr/bin/env python3
"""Upgrade canonical CircleCI callers in one batch; dry-run unless --write.
Only the orb pin changes. Repository publication policy and profile parameters
are preserved. Git commits, pushes and hosted verification remain separate.
"""
import argparse
import importlib.util
import json
from pathlib import Path
import re
import sys
import yaml
ROOT = Path(__file__).resolve().parents[1]
def module(name):
spec = importlib.util.spec_from_file_location(name, ROOT / 'src/scripts' / (name + '.py'))
result = importlib.util.module_from_spec(spec)
spec.loader.exec_module(result)
return result
standard = module('validate_standard')
pipeline = module('generate_pipeline')
def plan(checkout, version):
root = Path(checkout).resolve(strict=True)
paths = [root / '.circleci/config.yml', root / '.qqq-ci.yml']
if any(not path.resolve(strict=True).is_relative_to(root) for path in paths):
raise ValueError('CI declarations must remain inside their checkout')
originals = [path.read_bytes() for path in paths]
caller_raw, manifest_raw = [data.decode('utf-8') for data in originals]
manifest = standard.load_yaml(manifest_raw)
if not isinstance(manifest, dict):
raise ValueError('Existing manifest must be a mapping')
previous = manifest.get('orb_version')
standard.validate(caller_raw, manifest_raw, previous)
pipeline.load_manifest(paths[1], previous)
caller = standard.load_yaml(caller_raw)
if previous == version:
replacements = originals
else:
manifest['orb_version'] = version
caller['orbs']['qqq-orb'] = 'kingsrook/qqq-orb@' + version
caller['workflows']['setup']['jobs'][0]['qqq-orb/generate_pipeline']['orb_version'] = version
new_caller = yaml.safe_dump(caller, sort_keys=False)
new_manifest = yaml.safe_dump(manifest, sort_keys=False)
standard.validate(new_caller, new_manifest, version)
replacements = [new_caller.encode('utf-8'), new_manifest.encode('utf-8')]
return {'checkout': str(root), 'profile': manifest['profile'], 'from': previous, 'to': version,
'files': list(zip(paths, originals, replacements))}
def rollout(checkouts, version, write=False):
if not re.fullmatch(r'\d+\.\d+\.\d+', version):
raise ValueError('Fleet upgrades require an explicit stable orb version')
# Validate the entire batch before writing any repository.
plans = [plan(path, version) for path in checkouts]
if len({item['checkout'] for item in plans}) != len(plans):
raise ValueError('Each checkout may appear only once')
if write:
for item in plans:
for path, original, replacement in item['files']:
if path.read_bytes() != original:
raise ValueError('CI declaration changed after preflight; rerun the rollout')
for item in plans:
for path, original, replacement in item['files']:
if replacement != original:
path.write_bytes(replacement)
return [{**{key: value for key, value in item.items() if key != 'files'},
'changed': any(old != new for _, old, new in item['files']), 'written': write}
for item in plans]
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('checkouts', nargs='+', type=Path)
parser.add_argument('--orb-version', required=True)
parser.add_argument('--write', action='store_true')
args = parser.parse_args()
print(json.dumps(rollout(args.checkouts, args.orb_version, args.write), indent=2))
if __name__ == '__main__':
try:
main()
except (ValueError, OSError) as error:
sys.exit('Version rollout rejected: ' + str(error))
+2 -2
View File
@@ -2,7 +2,7 @@
"""Replace audited standard QBit pipelines with the canonical orb caller.
Only modifies the two CI declarations in a supplied checkout. Git operations and
publication remain separate. Unknown jobs/options fail closed for human review.
publication remain separate. Unknown jobs/options fail closed for central profile resolution.
"""
import argparse
from pathlib import Path
@@ -158,7 +158,7 @@ def main():
manifest_path = args.checkout / ".qqq-ci.yml"
config = yaml.safe_load(config_path.read_text(encoding="utf-8"))
if manifest_path.exists():
raise ValueError("Already has a manifest; use the version rollout operation")
raise ValueError("Already has a manifest; use tools/rollout_version.py")
manifest = infer_manifest(config, args.orb_version, args.default_branch)
caller = canonical_caller(args.orb_version, manifest["release_tag_policy"])
if args.write: