mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-28 10:54:30 +01:00
train S5: merge #3960 at a0d44c31ca v1.94.44.0
This commit is contained in:
commit
0d7353fdc1
12 files changed
+216
-59
No files matched your search
@@ -22,7 +22,7 @@
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { findInstallVerdict, installProject, readInstallVerdict, sourceRoot, verdictProblem } from '../install-verdict';
|
||||
import { admittedVerdict, findInstallVerdict, installProject, readInstallVerdict, sourceRoot } from '../install-verdict';
|
||||
import { resultCodeSuffix } from '../result-codes';
|
||||
import { collectPins, evaluatePins, exactPlan, parseVersion, satisfies } from '../runtime-pins';
|
||||
import { resolveStateRoot } from '../state-root';
|
||||
@@ -152,15 +152,15 @@ export interface LaunchRuntime {
|
||||
* The Bun the lanes and guards run under, its dir first on PATH; the env is
|
||||
* unchanged when nothing qualifies. Under the admission condition the install
|
||||
* verdict for (checkout, project) is validated as workflow admission does
|
||||
* (verdictProblem: ok, HEAD, pins, project, coverage, for /ship) and its
|
||||
* (admittedVerdict: ok, HEAD, pins, project, coverage, for /ship; else /ship's own record) and its
|
||||
* recorded Bun is the one launched; the gstack checkout itself binds the
|
||||
* 'none' verdict (installProject).
|
||||
*/
|
||||
export function launchRuntime(repoRoot: string, env: NodeJS.ProcessEnv): LaunchRuntime {
|
||||
const checkout = sourceRoot(GSTACK_ROOT);
|
||||
const project = installProject(checkout, repoRoot);
|
||||
const file = findInstallVerdict(checkout, project, env);
|
||||
const recorded = readInstallVerdict(file);
|
||||
const admitted = admittedVerdict('ship', checkout, findInstallVerdict(checkout, project, env), project, '', '');
|
||||
const recorded = readInstallVerdict(admitted.file);
|
||||
let pinsRoot: string | null = null;
|
||||
try { pinsRoot = fs.realpathSync(repoRoot); } catch { /* unresolvable: no pins */ }
|
||||
const { pinExact, accept } = projectBunPins(pinsRoot, env);
|
||||
@@ -174,14 +174,16 @@ export function launchRuntime(repoRoot: string, env: NodeJS.ProcessEnv): LaunchR
|
||||
if (env.GSTACK_CAPY !== '1' && !recorded) {
|
||||
verdictLine = 'install verdict: not checked (no GSTACK_CAPY=1 and no verdict for this checkout and project)';
|
||||
} else {
|
||||
const problem = verdictProblem('ship', GSTACK_ROOT, env, '', '', repoRoot);
|
||||
const { problem } = admitted;
|
||||
if (problem) return refuse('INSTALL_UNVERIFIED', problem.detail, problem.fix ?? installer);
|
||||
verdict = 'ok';
|
||||
if (recorded!.bun_path) {
|
||||
const now = fs.existsSync(recorded!.bun_path) ? bunVersionOf(recorded!.bun_path, env) : '';
|
||||
const why = !now ? 'is gone' : now !== recorded!.bun_version ? `now reports ${now}` : !accept(now) ? 'no longer satisfies the project pins' : '';
|
||||
if (why) return refuse('BUN_RESOLUTION_DRIFT', `recorded bun ${recorded!.bun_version} at ${recorded!.bun_path} ${why}`, 're-run the Capy skill installer with --check (scripts/install.sh --check --for ship) and follow its fix');
|
||||
const launch = recorded!.launch_path && fs.existsSync(recorded!.launch_path) ? recorded!.launch_path : path.dirname(recorded!.bun_path);
|
||||
let launchBun = '';
|
||||
try { launchBun = fs.realpathSync(path.join(recorded!.launch_path, 'bun')); } catch { /* no Bun in the launch dir */ }
|
||||
const launch = recorded!.launch_path && fs.existsSync(recorded!.launch_path) && (!launchBun || launchBun === recorded!.bun_path) ? recorded!.launch_path : path.dirname(recorded!.bun_path);
|
||||
return result(launch, now, `bun ${now} at ${recorded!.bun_path} (recorded by the install verdict)`, 'ok', '');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user