fix: inspect native ICDB occupancy before bounded repair
This commit is contained in:
1 parent
cb1326688b
commit
e14a864b37
17 files changed
+617
-153
No files matched your search
@@ -48,20 +48,19 @@ def case(tmp_path, monkeypatch):
|
||||
|
||||
|
||||
def patch_verification_after_fault(monkeypatch, runner, verify):
|
||||
"""Inject native startup evidence, then exercise the production repair gate."""
|
||||
def worker(req, **kwargs):
|
||||
if not req.diagnostic_only:
|
||||
return verify(req, **kwargs)
|
||||
project, pcb = runner.preflight(req)
|
||||
root = req.evidence_dir/'native-startup'; root.mkdir(parents=True, exist_ok=True)
|
||||
(root/'diagnostics').mkdir(exist_ok=True)
|
||||
(root/'diagnostics/icdb-recovery.json').write_text(json.dumps({
|
||||
'error_code': 'ICDB_REPAIR_REQUIRED', 'scope': 'project', 'session': 'fixture',
|
||||
'database_path': str(project.parent/'database')}), encoding='utf-8')
|
||||
evidence = root/'result.json'; evidence.write_text('{}', encoding='utf-8')
|
||||
return runner.VerifyResult('FAIL', error_category='ICDB_REPAIR_REQUIRED',
|
||||
safe_to_continue=False, evidence_path=evidence)
|
||||
monkeypatch.setattr(runner, '_run_verify_serialized', worker)
|
||||
"""Inject only native process boundaries; production interprets the Output."""
|
||||
from cbb_refresh_verify import native_repair
|
||||
from test_native_occupancy import output
|
||||
repair = native_repair.run_native_repair
|
||||
def native(target, root, **kw):
|
||||
if not kw.get('inspection_only'):
|
||||
return repair(target, root, **kw)
|
||||
return {'inspection_only': True, 'repair_requested': False, 'native_pid': 777,
|
||||
'native_exit_code': 0, 'project': str(target.project), 'database': str(target.database),
|
||||
'output': output(target.project, target.database, fault=True),
|
||||
'status': 'NOT_IN_USE', 'repair_required': True, 'release': {'native_exited': True}}
|
||||
monkeypatch.setattr(native_repair, 'run_native_repair', native)
|
||||
monkeypatch.setattr(runner, '_run_verify_serialized', verify)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('pcb_config', ['standard', 'legacy_template'])
|
||||
|
||||
Reference in new issue
Block a user