fix(cli): repair legacy core ledgers and make --keep-local durable
Store canonical core hashes in lock.core, add core.schema and repair legacy ledgers from the registered commit before deciding drift. Skipped --keep-local files remain tracked with the target canonical hash, fail closed when the old core cannot be resolved, and update core reports per-file actions.
This commit is contained in:
@@ -46,6 +46,30 @@ Harness::it('lock guarda core y componentes con schema esperado', function () {
|
||||
rrmdir($dir);
|
||||
});
|
||||
|
||||
Harness::it('guardar componentes no asciende el esquema del core', function () {
|
||||
$dir = tmpdir();
|
||||
$lock = Lock::empty();
|
||||
$lock->setCore(['schema' => 1, 'version' => '1.0.0', 'commit' => 'abc', 'files' => ['a' => 'sha256:x']]);
|
||||
$lock->setComponent('p:c', [
|
||||
'package' => 'p',
|
||||
'version' => '1.0.0',
|
||||
'toolbox_commit' => null,
|
||||
'mode' => 'copy',
|
||||
'files' => [],
|
||||
]);
|
||||
$lock->save($dir);
|
||||
|
||||
eq(1, Lock::load($dir)->coreSchema(), 'un guardado de componentes preserva el esquema legacy');
|
||||
$raw = json_decode((string) file_get_contents(Lock::path($dir)), true);
|
||||
eq(1, $raw['core']['schema'], 'el JSON conserva schema 1');
|
||||
|
||||
unset($raw['core']['schema']);
|
||||
file_put_contents(Lock::path($dir), json_encode($raw));
|
||||
eq(1, Lock::load($dir)->coreSchema(), 'sin marca se interpreta como esquema 1');
|
||||
|
||||
rrmdir($dir);
|
||||
});
|
||||
|
||||
Harness::it('ownership detecta colisión de rutas', function () {
|
||||
$lock = Lock::empty();
|
||||
$lock->setCore(['files' => ['src/Libs/X.php' => 'sha256:a']]);
|
||||
|
||||
Reference in New Issue
Block a user