fix: reject native source renames before management writes
This commit is contained in:
1 parent
36ff964230
commit
d40fa3a750
7 files changed
+102
-20
No files matched your search
@@ -63,7 +63,7 @@ def test_fixture_add_authority_requires_live_lease_and_fresh_staging(tmp_path, m
|
||||
from cbb_refresh_verify.library_lock import LibraryLock
|
||||
library = tmp_path/'native-add/fixture/mentor_lib.lmc'
|
||||
library.parent.mkdir(parents=True); library.write_bytes(b'owned fixture')
|
||||
source = tmp_path/'original/Source.prj'
|
||||
source = tmp_path/'original/Block.prj'
|
||||
source.parent.mkdir(); source.write_bytes(b'original source')
|
||||
(tmp_path/'probe-owner.json').write_text(json.dumps({'library': str(library), 'token': 'owned'}), encoding='utf-8')
|
||||
adapter = native.NativeManagementAdapter(mentor_home=tmp_path)
|
||||
@@ -71,7 +71,7 @@ def test_fixture_add_authority_requires_live_lease_and_fresh_staging(tmp_path, m
|
||||
monkeypatch.setattr(native, 'engineering_identity', lambda _: {'source': 'bytes'})
|
||||
def launch(job, root):
|
||||
staged = Path(job['source'])
|
||||
assert staged == root/'source/Source.prj' and staged != source
|
||||
assert staged == root/'source/Block.prj' and staged != source
|
||||
prepared_path = root/'add-prepared.json'
|
||||
prepared = json.loads(prepared_path.read_text(encoding='utf-8'))
|
||||
if invalid == 'nonce': job['transaction_nonce'] = 'foreign'
|
||||
@@ -114,7 +114,7 @@ def test_owned_fixture_retains_default_caller_lease_until_native_release(tmp_pat
|
||||
from cbb_refresh_verify.library_lock import LibraryLock, LibraryBusy, blocker_path, _owners, _guard
|
||||
library = tmp_path/'native-add/fixture/mentor_lib.lmc'
|
||||
library.parent.mkdir(parents=True); library.write_bytes(b'fixture')
|
||||
source = tmp_path/'original/Source.prj'; source.parent.mkdir(); source.write_bytes(b'source')
|
||||
source = tmp_path/'original/Block.prj'; source.parent.mkdir(); source.write_bytes(b'source')
|
||||
(tmp_path/'probe-owner.json').write_text(json.dumps({'library': str(library), 'token': 'owned'}), encoding='utf-8')
|
||||
adapter = native.NativeManagementAdapter(mentor_home=tmp_path)
|
||||
monkeypatch.setattr(adapter, 'route_capabilities', lambda: {'add': native.Capability(True, 'ready')})
|
||||
@@ -156,7 +156,7 @@ def test_fixture_nested_inside_source_tree_rejected_before_staging(tmp_path):
|
||||
from cbb_refresh_verify.library_lock import LibraryLock
|
||||
library = tmp_path/'native-add/fixture/mentor_lib.lmc'
|
||||
library.parent.mkdir(parents=True); library.write_bytes(b'fixture')
|
||||
source = tmp_path/'native-add/Source.prj'; source.write_bytes(b'original source')
|
||||
source = tmp_path/'native-add/Block.prj'; source.write_bytes(b'original source')
|
||||
(tmp_path/'probe-owner.json').write_text(json.dumps({'library': str(library), 'token': 'owned'}), encoding='utf-8')
|
||||
root = tmp_path/'add'; root.mkdir()
|
||||
with LibraryLock(library):
|
||||
@@ -217,7 +217,7 @@ def test_public_crud_scope_refuses_unproven_flow_or_partition(tmp_path, operatio
|
||||
def test_owned_fixture_add_passes_existing_library_and_source_to_worker(tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify.management import ManagementRequest
|
||||
import cbb_refresh_verify.native_management as native
|
||||
source = tmp_path/'source.prj'; source.write_bytes(b'source')
|
||||
source = tmp_path/'Block.prj'; source.write_bytes(b'source')
|
||||
library = tmp_path/'library.lmc'; library.write_bytes(b'library')
|
||||
seen = {}
|
||||
adapter = native.NativeManagementAdapter(mentor_home=tmp_path)
|
||||
@@ -244,7 +244,7 @@ def test_owned_fixture_add_passes_existing_library_and_source_to_worker(tmp_path
|
||||
def test_native_add_identity_mismatch_is_native_success_with_evidence(tmp_path, monkeypatch):
|
||||
from cbb_refresh_verify.management import ManagementRequest
|
||||
import cbb_refresh_verify.native_management as native
|
||||
source = tmp_path/'source.prj'; source.write_bytes(b'source')
|
||||
source = tmp_path/'Block.prj'; source.write_bytes(b'source')
|
||||
library = tmp_path/'library.lmc'; library.write_bytes(b'library')
|
||||
adapter = native.NativeManagementAdapter(mentor_home=tmp_path)
|
||||
monkeypatch.setattr(adapter, 'route_capabilities', lambda: {
|
||||
|
||||
Reference in new issue
Block a user