<?php
require __DIR__.'/common.php';require __DIR__.'/observe.php';if(is_file(__DIR__.'/private/auth.json'))throw new RuntimeException('Auth no replay');$before=$source();$expected=json_decode(file_get_contents(__DIR__.'/private/lease-expected-'.$lane.'.json'),true)['source_after'];if($before!==$expected||count($before['actor'])!==1)throw new RuntimeException('Full fresh auth lease');require __DIR__.'/app-init.php';$token=(new \app\p\logic\Login())->userTokenSet($before['actor'][0]);$save('auth.json',['token'=>$token,'actor'=>$before['actor'],'password_login_tested'=>false]);$after=$source();if($before!==$after)throw new RuntimeException('Auth DB drift');$save('auth-native.json',['native'=>NFGate::$journal,'included_files'=>$included(),'source_before'=>$before,'source_after'=>$after]);echo json_encode(['lane'=>$lane,'original_token_chain'=>true,'password_login_tested'=>false,'DML'=>NFGate::$dml]),"\n";

