fix(release): scope missing-column guard and allow exact schema repair
This commit is contained in:
1 parent
688a0e4de5
commit
c69a779ecc
3 files changed
+74
-6
No files matched your search
@@ -9,7 +9,26 @@ SPEC.loader.exec_module(m)
|
||||
|
||||
class ProductionGuards(unittest.TestCase):
|
||||
def receipt(self):
|
||||
return dict(sha='a'*40, baseline='b'*40, stage_run_url='https://git.parsaaghayi.ir/parsa/canina/actions/runs/123', reviewer='CEO delegated acceptance', accepted=True, scope='reliability-only', paths=['nginx.conf'])
|
||||
return dict(sha='a'*40, baseline='b'*40, stage_run_url='https://git.parsaaghayi.ir/parsa/canina/actions/runs/123', reviewer='CEO delegated acceptance', accepted=True, scope='reliability-only', paths=['nginx.conf'], typed_catalog_acceptance=dict(accepted=True, sha='a'*40, scope='native-types-and-constraints', reviewer='Independent schema reviewer', evidence_sha256='c'*64))
|
||||
|
||||
def test_exact_auth_schema_paths_from_real_git_diff_allowed_only(self):
|
||||
import subprocess
|
||||
paths = subprocess.check_output([
|
||||
'git', 'diff', '--name-only', '688a0e4^', '688a0e4', '--',
|
||||
'.gitea/workflows/auth-schema-reconcile.yml',
|
||||
'docs/auth-schema-reconciliation.md', 'docs/auth-schema-rehearsal.json',
|
||||
'scripts/auth-schema-reconcile.sql', 'scripts/auth-schema-verify.sql',
|
||||
'scripts/ci-auth-schema-reconcile.sh', 'scripts/test_auth_schema_reconcile.py',
|
||||
], cwd=Path(__file__).parents[1], text=True).splitlines()
|
||||
self.assertEqual(len(paths), 7, paths)
|
||||
r = self.receipt(); r['paths'] = paths
|
||||
m.validate_receipt(r, 'a'*40, 'b'*40, paths)
|
||||
for path in ['scripts/auth-schema-other.sql', 'docs/auth-schema-other.md',
|
||||
'.gitea/workflows/other.yml', 'scripts/test_auth_schema_other.py']:
|
||||
r['paths'] = [path]
|
||||
with self.assertRaises(ValueError):
|
||||
m.validate_receipt(r, 'a'*40, 'b'*40, [path])
|
||||
self.assertFalse(any('*' in path for path in m.ALLOWED))
|
||||
|
||||
def test_exact_six_baseline_gate_repairs_allowed_not_frontend_wildcard(self):
|
||||
files = {
|
||||
@@ -45,6 +64,20 @@ class ProductionGuards(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
m.validate_receipt(r, 'a'*40, 'b'*40, [path])
|
||||
|
||||
def test_independent_typed_catalog_acceptance_required(self):
|
||||
r = self.receipt()
|
||||
r.pop('typed_catalog_acceptance', None)
|
||||
with self.assertRaisesRegex(ValueError, 'typed catalog'):
|
||||
m.validate_receipt(r, 'a'*40, 'b'*40, ['nginx.conf'])
|
||||
for acceptance in [
|
||||
{'accepted': False, 'sha': 'a'*40, 'evidence_sha256': 'c'*64},
|
||||
{'accepted': True, 'sha': 'd'*40, 'evidence_sha256': 'c'*64},
|
||||
{'accepted': True, 'sha': 'a'*40, 'evidence_sha256': ''},
|
||||
]:
|
||||
r['typed_catalog_acceptance'] = acceptance
|
||||
with self.assertRaisesRegex(ValueError, 'typed catalog'):
|
||||
m.validate_receipt(r, 'a'*40, 'b'*40, ['nginx.conf'])
|
||||
|
||||
def test_exact_stage_sha(self):
|
||||
r=self.receipt()
|
||||
m.validate_receipt(r, 'a'*40, 'b'*40, ['nginx.conf'])
|
||||
|
||||
Reference in new issue
Block a user