instar 1.3.915 → 1.3.917

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/commands/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4EH,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAU3D,OAAO,EAAE,eAAe,EAAiC,MAAM,iCAAiC,CAAC;AA0BjG,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AA8H7D,OAAO,KAAK,EAAW,oBAAoB,EAAe,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAgFtD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,EACf,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC1C,OAAO,CAUT;AAyID,UAAU,YAAY;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;2DACuD;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AA+rDD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,oBAAoB,GAAG,IAAI,GACxC;IACD,YAAY,EAAE,oBAAoB,GAAG,IAAI,CAAC;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAC3C,QAA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AY,CAAC,EAAE,YAAY,EAC3B,WAAW,CAAC,EAAE,WAAW,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,iBAAiB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,EAGvE,UAAU,CAAC,EAAE,MAAM,OAAO,8BAA8B,EAAE,WAAW,GAAG,IAAI,EAK5E,qBAAqB,CAAC,EAAE,MAAM,OAAO,gCAAgC,EAAE,kBAAkB,GAAG,IAAI,EAKhG,mBAAmB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,EAQrD,oBAAoB,CAAC,EAAE,MAAM;IAC3B,YAAY,EAAE,OAAO,kBAAkB,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACrE,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAAC;IAC3C,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,GACP,IAAI,CAwtBN;AAgmBD,wBAAsB,WAAW,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAi4pBtE;AAED,wBAAsB,UAAU,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAsDzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAuD5E"}
@@ -22679,6 +22679,7 @@ export async function startServer(options) {
22679
22679
  const stageMod = await import('../core/StageAdvancer.js');
22680
22680
  const guardMod = await import('../config/stageWriteGuard.js');
22681
22681
  const crypto = await import('node:crypto');
22682
+ const failoverCheckMod = await import('../core/sessionPoolFailoverCheck.js');
22682
22683
  // HMAC over the agent's authToken — tamper-evident without a separate keystore.
22683
22684
  const hmacKey = String(config.authToken ?? 'instar-session-pool-e2e');
22684
22685
  const hmac = (c) => crypto.createHmac('sha256', hmacKey).update(c).digest('hex');
@@ -22695,27 +22696,60 @@ export async function startServer(options) {
22695
22696
  }
22696
22697
  },
22697
22698
  });
22698
- // Boot-cache the running commit SHA once (env first, else git HEAD, else
22699
- // 'unknown'). StageAdvancer scopes an E2E red/green to the CURRENT build via
22700
- // this, so a stale result from another commit can't trigger a revert/advance.
22699
+ // Resolve the checkout the failover subprocess will actually exercise.
22700
+ // Boot-pin it so the proof target and its build identity cannot drift
22701
+ // independently during a run.
22702
+ const failoverSourceCandidates = [
22703
+ process.env.INSTAR_SOURCE_ROOT,
22704
+ path.resolve(__dirname, '..', '..'),
22705
+ process.cwd(),
22706
+ ].filter((c) => typeof c === 'string' && c.length > 0);
22707
+ let sessionPoolFailoverSourceRoot = null;
22708
+ for (const candidate of failoverSourceCandidates) {
22709
+ try {
22710
+ if (fs.existsSync(path.join(candidate, 'node_modules', '.bin', 'vitest'))
22711
+ && fs.existsSync(path.join(candidate, failoverCheckMod.DEFAULT_FAILOVER_E2E_PATH))) {
22712
+ sessionPoolFailoverSourceRoot = candidate;
22713
+ break;
22714
+ }
22715
+ }
22716
+ catch { /* @silent-fallback-ok — probe the next bounded candidate */ }
22717
+ }
22718
+ // Boot-cache one build identity (env SHA first, else the exact runner
22719
+ // checkout's git HEAD, else cwd git HEAD, installed package version, then
22720
+ // 'unknown'). Producer and StageAdvancer share this exact closure.
22701
22721
  const gitMod = await import('../core/SafeGitExecutor.js');
22702
22722
  let bootCommitSha = process.env.INSTAR_COMMIT_SHA ?? process.env.GITHUB_SHA ?? '';
22703
- if (!bootCommitSha) {
22723
+ const gitIdentityCandidates = [
22724
+ sessionPoolFailoverSourceRoot,
22725
+ process.cwd(),
22726
+ ].filter((c, index, all) => typeof c === 'string' && c.length > 0 && all.indexOf(c) === index);
22727
+ for (const candidate of gitIdentityCandidates) {
22728
+ if (bootCommitSha)
22729
+ break;
22704
22730
  try {
22705
22731
  bootCommitSha = gitMod.SafeGitExecutor.readSync(['rev-parse', 'HEAD'], {
22706
- cwd: process.cwd(), encoding: 'utf-8', stdio: 'pipe', operation: 'server.ts:rollout-commit-sha',
22732
+ cwd: candidate, encoding: 'utf-8', stdio: 'pipe', operation: 'server.ts:rollout-commit-sha',
22707
22733
  }).trim();
22708
22734
  }
22709
22735
  catch {
22710
- bootCommitSha = ''; /* @silent-fallback-ok — git unreadable → 'unknown' */
22736
+ bootCommitSha = ''; /* @silent-fallback-ok — git unreadable → package identity below */
22711
22737
  }
22712
22738
  }
22739
+ if (!bootCommitSha && startupVersion && startupVersion !== '0.0.0') {
22740
+ bootCommitSha = `package:${startupVersion}`;
22741
+ }
22742
+ const currentSessionPoolBuildIdentity = () => bootCommitSha || 'unknown';
22743
+ // ONE authoritative stage read for the rollout gate and its proof producer.
22744
+ // Splitting these previously let the runner stamp every green as stage 0
22745
+ // while StageAdvancer was already waiting for a green at stage 2.
22746
+ const readSessionPoolStage = () => liveConfig.get('multiMachine.sessionPool.stage', 'dark');
22713
22747
  // StageAdvancer: the sole stage writer. Held for the rollout job/route to drive;
22714
22748
  // constructed here so the write path (liveConfig + token) is wired in one place.
22715
22749
  const stageAdvancer = new stageMod.StageAdvancer({
22716
22750
  resultStore: sessionPoolE2EResultStore,
22717
- currentCommitSha: () => bootCommitSha || 'unknown',
22718
- readStage: () => liveConfig.get('multiMachine.sessionPool.stage', 'dark'),
22751
+ currentCommitSha: currentSessionPoolBuildIdentity,
22752
+ readStage: readSessionPoolStage,
22719
22753
  writeStageConfig: (s) => liveConfig.set(guardMod.STAGE_CONFIG_PATH, s, { stageWriteToken: guardMod.STAGE_WRITE_TOKEN }),
22720
22754
  audit: (event, detail) => console.log(pc.dim(` [stage-advancer] ${event} ${JSON.stringify(detail)}`)),
22721
22755
  });
@@ -22784,24 +22818,7 @@ export async function startServer(options) {
22784
22818
  const cp = await import('node:child_process');
22785
22819
  const failoverLogPath = path.join(config.stateDir, 'logs', 'session-pool-failover-runner.log');
22786
22820
  const runProcess = (args) => new Promise((resolve) => {
22787
- // Candidate source roots, most-specific first: an explicit env override,
22788
- // then this build's package root (dist/../..), then cwd. The first that
22789
- // carries BOTH node_modules/.bin/vitest AND the test file wins.
22790
- const candidates = [
22791
- process.env.INSTAR_SOURCE_ROOT,
22792
- path.resolve(__dirname, '..', '..'),
22793
- process.cwd(),
22794
- ].filter((c) => typeof c === 'string' && c.length > 0);
22795
- let sourceRoot = null;
22796
- for (const c of candidates) {
22797
- try {
22798
- if (fs.existsSync(path.join(c, 'node_modules', '.bin', 'vitest')) && fs.existsSync(path.join(c, args.testPath))) {
22799
- sourceRoot = c;
22800
- break;
22801
- }
22802
- }
22803
- catch { /* @silent-fallback-ok — probe next candidate */ }
22804
- }
22821
+ const sourceRoot = sessionPoolFailoverSourceRoot;
22805
22822
  if (!sourceRoot) {
22806
22823
  // No source/vitest resolvable → NOT a failover verdict; the check
22807
22824
  // contract makes this THROW so the runner records nothing.
@@ -22860,10 +22877,10 @@ export async function startServer(options) {
22860
22877
  resultStore: sessionPoolE2EResultStore,
22861
22878
  dryRunResultStore: failoverDryRunStore,
22862
22879
  runProcess,
22863
- currentCommitSha: () => bootCommitSha || 'unknown',
22864
- // The shadow→live-transfer failover is proven at the 'shadow' stage index
22865
- // (0), which StageAdvancer.advanceTo('live-transfer') reads.
22866
- provenStage: () => 0,
22880
+ currentCommitSha: currentSessionPoolBuildIdentity,
22881
+ // Credit the proof to the stage that is actually running. The next
22882
+ // promotion reads this same current-stage index as its prior-stage gate.
22883
+ provenStage: () => stageMod.stageIndex(readSessionPoolStage()),
22867
22884
  audit: (event, detail) => console.log(pc.dim(` [failover-runner] ${event} ${JSON.stringify(detail)}`)),
22868
22885
  });
22869
22886
  if (_sessionPoolFailoverRunnerDriver) {