perf: replace automatic backups with manual backup reminders

This commit is contained in:
阿白叔 committed 2026-11-03 16:44:30 +08:00
1 parent 7527800128
commit c85696080d
26 files changed
+385 -102

No files matched your search

+6 -5
View File
@@ -42,8 +42,8 @@ def transaction(tmp_path, monkeypatch):
if job['operation'] == 'add':
if state.get('tamper') == 'nonce': job['transaction_nonce'] = 'foreign'
if state.get('tamper') == 'supervisor': job['supervisor_pid'] = -1
if state.get('tamper') == 'backup':
(evidence.parent/'library-before'/library.name).write_bytes(b'corrupted backup')
if state.get('tamper') == 'baseline':
(evidence.parent/'library-baseline-manifest.json').write_text('{}')
if state.get('tamper') == 'source':
(Path(job['source']).parent/'database/icdb.dat').write_bytes(b'changed staged input')
validate_transaction(job, evidence.parent)
@@ -110,13 +110,14 @@ def test_native_registered_but_asset_mismatch_retains_recovery(transaction, corr
assert result.status == 'RECOVERY_REQUIRED' and not result.safe_to_continue
def test_update_readd_failure_preserves_snapshot_and_removed_checkpoint(transaction):
def test_update_readd_failure_preserves_baseline_and_removed_checkpoint(transaction):
root, request, state = transaction
assert execute(root, request).status == 'UPLOADED'
state['fail_add'] = True
result = execute(root, replace(request, operation='update'))
assert result.status == 'RECOVERY_REQUIRED' and not result.safe_to_continue
assert (result.evidence_path.parent/'library-before/ReusableBlocksLP/Block/Work/Source.prj').exists()
assert (result.evidence_path.parent/'library-baseline-manifest.json').exists()
assert not (result.evidence_path.parent/'library-before').exists()
assert 'removed' in [entry['stage'] for entry in json.loads(result.evidence_path.read_text())['history']]
@@ -129,7 +130,7 @@ def test_fixture_grant_cannot_authorize_arbitrary_library(transaction, tmp_path)
assert other.read_bytes() == b'unchanged' and not state['calls']
@pytest.mark.parametrize('tamper', ['nonce', 'supervisor', 'backup', 'source'])
@pytest.mark.parametrize('tamper', ['nonce', 'supervisor', 'baseline', 'source'])
def test_worker_rejects_modified_management_authority_before_add(transaction, tamper):
root, request, state = transaction
state['tamper'] = tamper