@rightkit/git 0.2.0 → 0.2.1

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.
package/README.md CHANGED
@@ -19,6 +19,8 @@ GitHub Actions minutes are free and unlimited on public repos, and billed on pri
19
19
 
20
20
  Workflows are thin callers over the repo's own scripts, so a private repo running the same gates locally executes identical checks.
21
21
 
22
+ Sync records exact prior bytes, refuses unmanaged same-name workflows, & preflights every target before any write. Qualification preserves schema logs with a unique required artifact.
23
+
22
24
  ## Credential posture (read before enabling package-manager publishing)
23
25
 
24
26
  - **No code-signing credential ever reaches CI.** Signing and notarization stay local in `@rightkit/release`. The only publish credential in the npm lane is short-lived OIDC (trusted publishing, no long-lived token).
@@ -54,7 +54,7 @@ const FULL_MANIFEST = {
54
54
  schemaVersion: 1,
55
55
  lanes: [...KNOWN_LANES],
56
56
  matrix: { os: ["ubuntu-latest", "macos-latest", "windows-latest"], node: ["22.13", "24"] },
57
- packageManager: "pnpm@11.18.0",
57
+ packageManager: "pnpm@11.24.0",
58
58
  publish: {
59
59
  npm: { oidc: true, provenance: true },
60
60
  homebrew: { tap: "acme/homebrew-tap", formulaName: "widgets" },
@@ -219,6 +219,13 @@ test("F5: private-repo-guard job has no job-level `if` (always runs) and fails o
219
219
  }
220
220
  });
221
221
 
222
+ test("qualification preserves failing schema evidence as a unique required artifact", () => {
223
+ const template = fs.readFileSync(path.join(templatesDir, "qualification.yml"), "utf8");
224
+ assert.doesNotMatch(template, /\|\| true/);
225
+ assert.match(template, /set -o pipefail[\s\S]*tee qualification-schema\.log/);
226
+ assert.match(template, /uses: actions\/upload-artifact@v4[\s\S]*github\.run_id[\s\S]*github\.run_attempt[\s\S]*if-no-files-found: error/);
227
+ });
228
+
222
229
  test("rust-hybrid ci keeps its work behind the public-repository guard", () => {
223
230
  const manifest = { ...FULL_MANIFEST, lanes: ["ci"], profile: "rust-hybrid", gate: { path: "scripts/gate.sh" } };
224
231
  const template = fs.readFileSync(path.join(templatesDir, "profiles/rust-hybrid/ci.yml"), "utf8");
package/install.mjs CHANGED
@@ -9,10 +9,10 @@ import fs from "node:fs";
9
9
  import path from "node:path";
10
10
  import { assertPublic } from "./policy/visibility-gate.mjs";
11
11
  import { MANIFEST_FILENAME, validateManifest } from "./manifest.mjs";
12
- import { syncCommand } from "./sync.mjs";
12
+ import { applyPlan, planSync } from "./sync.mjs";
13
13
 
14
14
  export const DEFAULT_MATRIX = { os: ["ubuntu-latest", "macos-latest", "windows-latest"], node: ["22.13", "24"] };
15
- export const DEFAULT_PACKAGE_MANAGER = "pnpm@11.18.0";
15
+ export const DEFAULT_PACKAGE_MANAGER = "pnpm@11.24.0";
16
16
  export const DEFAULT_TEMPLATE_VERSION = "1.1.0";
17
17
 
18
18
  /**
@@ -67,8 +67,14 @@ export async function installCommand(repoPath, opts = {}, deps = {}) {
67
67
  const { valid, errors } = validateManifest(manifest);
68
68
  if (!valid) return { ok: false, stage: "manifest-invalid", errors };
69
69
 
70
- fs.writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
71
-
72
- const plan = await syncCommand(repoPath, { dryRun: false, deps });
73
- return { ok: plan.ok, stage: "synced", errors: plan.errors || [], manifestPath, plan };
70
+ const manifestBytes = `${JSON.stringify(manifest, null, 2)}\n`;
71
+ const plan = await planSync(repoPath, deps, manifest);
72
+ if (!plan.ok) return { ok: false, stage: plan.stage, errors: plan.errors, plan };
73
+ fs.writeFileSync(manifestPath, manifestBytes, "utf8");
74
+ const applied = applyPlan(repoPath, plan);
75
+ if (!applied.ok) {
76
+ if (fs.readFileSync(manifestPath, "utf8") === manifestBytes) fs.rmSync(manifestPath);
77
+ return { ok: false, stage: applied.stage, errors: applied.errors, plan };
78
+ }
79
+ return { ok: true, stage: "synced", errors: [], manifestPath, plan };
74
80
  }
package/manifest.mjs CHANGED
@@ -232,7 +232,12 @@ function parsePackageManager(spec) {
232
232
  yarn: "yarn install --frozen-lockfile",
233
233
  }[name];
234
234
  const runPrefix = { pnpm: "pnpm run", npm: "npm run", yarn: "yarn run" }[name];
235
- return { name, version, installCommand, runPrefix };
235
+ const setup = {
236
+ pnpm: ` - uses: pnpm/action-setup@v4\n with:\n version: ${version}`,
237
+ npm: "",
238
+ yarn: ` - run: corepack enable && corepack prepare yarn@${version} --activate`,
239
+ }[name];
240
+ return { name, version, installCommand, runPrefix, setup };
236
241
  }
237
242
 
238
243
  function yamlFlowStringList(values) {
@@ -274,6 +279,7 @@ export function buildRenderContext(manifest, repoPath) {
274
279
  PM_CACHE: pm.name,
275
280
  INSTALL_COMMAND: pm.installCommand,
276
281
  PM_RUN: pm.runPrefix,
282
+ PACKAGE_MANAGER_SETUP: pm.setup,
277
283
  ARTIFACT_PREFIX: artifactPrefix,
278
284
  TEMPLATE_VERSION: manifest.templateVersion,
279
285
  GATE_PATH: manifest.gate?.path,
package/manifest.test.mjs CHANGED
@@ -6,7 +6,7 @@ const VALID_MINIMAL = {
6
6
  schemaVersion: 1,
7
7
  lanes: ["ci"],
8
8
  matrix: { os: ["ubuntu-latest"], node: ["22.13"] },
9
- packageManager: "pnpm@11.18.0",
9
+ packageManager: "pnpm@11.24.0",
10
10
  templateVersion: "1.0.0",
11
11
  };
12
12
 
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@rightkit/git",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Public-repo-only GitHub Actions workflow layer: templates, visibility gate, sync/drift/adopt/uninstall for right-git.",
5
+ "license": "MIT OR Apache-2.0",
5
6
  "type": "module",
6
7
  "bin": {
7
8
  "right-git": "cli/right-git.mjs"
@@ -20,7 +21,7 @@
20
21
  },
21
22
  "repository": {
22
23
  "type": "git",
23
- "url": "git+https://github.com/adrdsouza/claude.git",
24
+ "url": "git+https://github.com/bogusyogi/claude.git",
24
25
  "directory": "tools/rightkit/packages/git"
25
26
  },
26
27
  "scripts": {
package/render.test.mjs CHANGED
@@ -13,7 +13,7 @@ const FULL_MANIFEST = {
13
13
  schemaVersion: 1,
14
14
  lanes: [...KNOWN_LANES],
15
15
  matrix: { os: ["ubuntu-latest", "macos-latest", "windows-latest"], node: ["22.13", "24"] },
16
- packageManager: "pnpm@11.18.0",
16
+ packageManager: "pnpm@11.24.0",
17
17
  publish: {
18
18
  npm: { oidc: true, provenance: true },
19
19
  homebrew: { tap: "acme/homebrew-tap", formulaName: "widgets" },
@@ -45,7 +45,8 @@ test("every known lane has a template file and renders without an unresolved pla
45
45
  test("rust-hybrid ci renders its pinned package manager and gate", () => {
46
46
  const manifest = { ...FULL_MANIFEST, lanes: ["ci"], profile: "rust-hybrid", gate: { path: "scripts/gate.sh" }, templateVersion: "1.1.0" };
47
47
  const content = renderTemplate(fs.readFileSync(path.join(templatesDir, "profiles/rust-hybrid/ci.yml"), "utf8"), buildRenderContext(manifest, "/repos/widgets"));
48
- assert.match(content, /corepack prepare pnpm@11\.18\.0 --activate/);
48
+ assert.match(content, /uses: pnpm\/action-setup@v4/);
49
+ assert.match(content, /version: 11\.24\.0/);
49
50
  assert.match(content, /rustup toolchain install stable/);
50
51
  assert.match(content, /bash \.\/scripts\/gate\.sh/);
51
52
  });
@@ -59,7 +60,7 @@ test("render determinism: same manifest renders byte-identical output every time
59
60
  });
60
61
 
61
62
  test("rendered workflows never request pnpm or yarn setup-node caching before package-manager activation", () => {
62
- for (const packageManager of ["pnpm@11.18.0", "yarn@4.6.0"]) {
63
+ for (const packageManager of ["pnpm@11.24.0", "yarn@4.6.0"]) {
63
64
  const rendered = renderAllLanes({ ...FULL_MANIFEST, packageManager }, "/repos/widgets");
64
65
  for (const [lane, content] of Object.entries(rendered)) {
65
66
  assert.doesNotMatch(
@@ -71,6 +72,26 @@ test("rendered workflows never request pnpm or yarn setup-node caching before pa
71
72
  }
72
73
  });
73
74
 
75
+ test("rendered workflows bootstrap each declared package manager safely", () => {
76
+ const pnpm = renderAllLanes({ ...FULL_MANIFEST, packageManager: "pnpm@11.24.0" }, "/repos/widgets");
77
+ for (const content of Object.values(pnpm)) {
78
+ assert.match(content, /uses: pnpm\/action-setup@v4/);
79
+ assert.match(content, /version: 11\.24\.0/);
80
+ assert.doesNotMatch(content, /corepack enable/);
81
+ }
82
+
83
+ const npm = renderAllLanes({ ...FULL_MANIFEST, packageManager: "npm@11.0.0" }, "/repos/widgets");
84
+ for (const content of Object.values(npm)) {
85
+ assert.doesNotMatch(content, /pnpm\/action-setup|corepack enable/);
86
+ }
87
+
88
+ const yarn = renderAllLanes({ ...FULL_MANIFEST, packageManager: "yarn@4.6.0" }, "/repos/widgets");
89
+ for (const content of Object.values(yarn)) {
90
+ assert.match(content, /corepack prepare yarn@4\.6\.0 --activate/);
91
+ assert.doesNotMatch(content, /pnpm\/action-setup/);
92
+ }
93
+ });
94
+
74
95
  // F5 fix: a job-level `if: !private` on the real work job means GitHub
75
96
  // SKIPS that job entirely for a private repo — the nested "refuse" step
76
97
  // inside it is then unreachable and never runs, so nothing fails and the
package/sync.mjs CHANGED
@@ -70,13 +70,15 @@ export function lineDiff(oldText, newText) {
70
70
  * managed file whose lane fell out of the manifest.
71
71
  * Returns a typed result — never throws.
72
72
  */
73
- export async function planSync(repoPath, deps = {}) {
73
+ export async function planSync(repoPath, deps = {}, manifestOverride = null) {
74
74
  const visibility = await assertPublic(repoPath, deps);
75
75
  if (!visibility.allowed) {
76
76
  return { ok: false, stage: "visibility", errors: [visibility.reason], changes: [] };
77
77
  }
78
78
 
79
- const loaded = loadManifest(repoPath);
79
+ const loaded = manifestOverride === null
80
+ ? loadManifest(repoPath)
81
+ : { ok: true, manifest: manifestOverride };
80
82
  if (!loaded.ok) {
81
83
  return { ok: false, stage: "manifest", errors: loaded.errors, changes: [] };
82
84
  }
@@ -94,24 +96,38 @@ export async function planSync(repoPath, deps = {}) {
94
96
  // not installed yet
95
97
  }
96
98
  if (existing === content) {
97
- changes.push({ lane, filename, action: "unchanged", diff: [] });
99
+ changes.push({ lane, filename, action: "unchanged", before: existing, diff: [] });
100
+ } else if (existing !== null && !existing.startsWith(MANAGED_MARKER)) {
101
+ changes.push({ lane, filename, action: "managed-conflict", before: existing, diff: [] });
98
102
  } else {
99
- changes.push({ lane, filename, action: existing === null ? "create" : "update", diff: lineDiff(existing, content), content });
103
+ changes.push({ lane, filename, action: existing === null ? "create" : "update", before: existing, diff: lineDiff(existing, content), content });
100
104
  }
101
105
  }
102
106
 
103
107
  for (const managedFilename of listManagedFiles(repoPath)) {
104
108
  if (!wantedFilenames.has(managedFilename)) {
105
- changes.push({ lane: null, filename: managedFilename, action: "remove", diff: [] });
109
+ changes.push({ lane: null, filename: managedFilename, action: "remove", before: fs.readFileSync(path.join(repoPath, WORKFLOWS_SUBDIR, managedFilename), "utf8"), diff: [] });
106
110
  }
107
111
  }
108
112
 
109
- return { ok: true, stage: "planned", errors: [], changes };
113
+ const conflicts = changes.filter((change) => change.action === "managed-conflict");
114
+ return conflicts.length
115
+ ? { ok: false, stage: "managed-conflict", errors: conflicts.map((change) => `${change.filename} is unmanaged`), changes }
116
+ : { ok: true, stage: "planned", errors: [], changes };
110
117
  }
111
118
 
112
119
  /** Apply a plan produced by planSync: write/update/remove files on disk. */
113
120
  export function applyPlan(repoPath, plan) {
114
121
  const dir = path.join(repoPath, WORKFLOWS_SUBDIR);
122
+ for (const change of plan.changes) {
123
+ if (change.action === "unchanged") continue;
124
+ const target = path.join(dir, change.filename);
125
+ let current = null;
126
+ try { current = fs.readFileSync(target, "utf8"); } catch {}
127
+ if (current !== change.before) {
128
+ return { ok: false, stage: "apply-conflict", errors: [`${change.filename} changed after planning`] };
129
+ }
130
+ }
115
131
  fs.mkdirSync(dir, { recursive: true });
116
132
  for (const change of plan.changes) {
117
133
  const target = path.join(dir, change.filename);
@@ -121,6 +137,7 @@ export function applyPlan(repoPath, plan) {
121
137
  fs.rmSync(target, { force: true });
122
138
  }
123
139
  }
140
+ return { ok: true, stage: "applied", errors: [] };
124
141
  }
125
142
 
126
143
  /** Full sync: plan, print diff, apply unless dryRun. Returns the plan. */
@@ -135,7 +152,8 @@ export async function syncCommand(repoPath, { dryRun = false, deps = {} } = {})
135
152
  }
136
153
 
137
154
  if (!dryRun) {
138
- applyPlan(repoPath, plan);
155
+ const applied = applyPlan(repoPath, plan);
156
+ if (!applied.ok) return { ...plan, ...applied };
139
157
  }
140
158
  return plan;
141
159
  }
package/sync.test.mjs CHANGED
@@ -2,7 +2,7 @@ import test from "node:test";
2
2
  import assert from "node:assert/strict";
3
3
  import fs from "node:fs";
4
4
  import path from "node:path";
5
- import { syncCommand } from "./sync.mjs";
5
+ import { applyPlan, planSync, syncCommand } from "./sync.mjs";
6
6
  import { makeTempRepo, PUBLIC_DEPS, PRIVATE_DEPS, SAMPLE_MANIFEST } from "./test-support.mjs";
7
7
 
8
8
  test("sync refuses a private repo and writes nothing", async () => {
@@ -54,6 +54,27 @@ test("sync reports manifest errors instead of writing files", async () => {
54
54
  assert.equal(result.stage, "manifest");
55
55
  });
56
56
 
57
+ test("sync refuses an unmanaged same-name workflow", async () => {
58
+ const dir = makeTempRepo(SAMPLE_MANIFEST);
59
+ const target = path.join(dir, ".github", "workflows", "ci.yml");
60
+ fs.mkdirSync(path.dirname(target), { recursive: true });
61
+ fs.writeFileSync(target, "name: handwritten\n", "utf8");
62
+ const result = await syncCommand(dir, { deps: PUBLIC_DEPS });
63
+ assert.equal(result.stage, "managed-conflict");
64
+ assert.equal(fs.readFileSync(target, "utf8"), "name: handwritten\n");
65
+ });
66
+
67
+ test("apply preflights every planned byte before writing", async () => {
68
+ const dir = makeTempRepo(SAMPLE_MANIFEST);
69
+ const plan = await planSync(dir, PUBLIC_DEPS);
70
+ const target = path.join(dir, ".github", "workflows", "ci.yml");
71
+ fs.mkdirSync(path.dirname(target), { recursive: true });
72
+ fs.writeFileSync(target, "raced\n", "utf8");
73
+ const applied = applyPlan(dir, plan);
74
+ assert.equal(applied.stage, "apply-conflict");
75
+ assert.equal(fs.existsSync(path.join(dir, ".github", "workflows", "package-smoke.yml")), false);
76
+ });
77
+
57
78
  // F15 end-to-end: a hostile `.rightgit.json` on disk — the real attack
58
79
  // surface, not just the in-memory validateManifest() unit — must be refused
59
80
  // at the manifest stage, before renderLanes() (and therefore render.mjs's
package/templates/ci.yml CHANGED
@@ -37,7 +37,8 @@ jobs:
37
37
  - uses: actions/setup-node@v5
38
38
  with:
39
39
  node-version: ${{ matrix.node }}
40
- - run: corepack enable
40
+ package-manager-cache: false
41
+ ${PACKAGE_MANAGER_SETUP}
41
42
  - run: ${INSTALL_COMMAND}
42
43
  - run: ${PM_RUN} test
43
44
  - run: ${PM_RUN} test:random
@@ -31,6 +31,7 @@ jobs:
31
31
  - uses: actions/setup-node@v5
32
32
  with:
33
33
  node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
34
- - run: corepack enable
34
+ package-manager-cache: false
35
+ ${PACKAGE_MANAGER_SETUP}
35
36
  - run: ${INSTALL_COMMAND}
36
37
  - run: node scripts/test-package.mjs
@@ -24,6 +24,7 @@ jobs:
24
24
  - uses: actions/setup-node@v5
25
25
  with:
26
26
  node-version: ${{ matrix.node }}
27
- - run: corepack enable && corepack prepare ${PM_NAME}@${PM_VERSION} --activate
27
+ package-manager-cache: false
28
+ ${PACKAGE_MANAGER_SETUP}
28
29
  - run: rustup toolchain install stable --profile minimal
29
30
  - run: bash ./${GATE_PATH}
@@ -1,7 +1,6 @@
1
1
  # Managed by right-git — do not hand-edit. Run `right-git sync` to update.
2
2
  # Template: publish-npm.yml | Template version: ${TEMPLATE_VERSION}
3
- # Extracted from Cortex's immutable-release.yml publish-npm job only
4
- # (DESIGN.md §6). OIDC trusted publishing is the sole publish credential —
3
+ # OIDC trusted publishing is the sole publish credential —
5
4
  # no long-lived npm token, no signing material (invariant I2). Runs after
6
5
  # right-release has already built/signed/notarized locally and attached
7
6
  # artifacts to the GitHub Release (DESIGN.md §7); this job publishes the
@@ -38,7 +37,8 @@ jobs:
38
37
  with:
39
38
  node-version: ${NODE_PUBLISH_VERSION}
40
39
  registry-url: https://registry.npmjs.org
41
- - run: corepack enable
40
+ package-manager-cache: false
41
+ ${PACKAGE_MANAGER_SETUP}
42
42
  - run: ${INSTALL_COMMAND}
43
43
  - run: node scripts/release/build-candidate.mjs --version "${{ github.event.release.tag_name }}" --platform current --out "release/candidates/publish"
44
44
  - run: node scripts/release/check-release.mjs release/candidates/publish
@@ -76,7 +76,8 @@ jobs:
76
76
  - uses: actions/setup-node@v5
77
77
  with:
78
78
  node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
79
- - run: corepack enable
79
+ package-manager-cache: false
80
+ ${PACKAGE_MANAGER_SETUP}
80
81
  - run: ${INSTALL_COMMAND}
81
82
  - run: ruby -c release/homebrew/${HOMEBREW_FORMULA_NAME}.rb
82
83
  - name: Checkout Homebrew tap
@@ -26,7 +26,8 @@ jobs:
26
26
  - uses: actions/setup-node@v5
27
27
  with:
28
28
  node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
29
- - run: corepack enable
29
+ package-manager-cache: false
30
+ ${PACKAGE_MANAGER_SETUP}
30
31
  - run: ${INSTALL_COMMAND}
31
32
  - run: ${PM_RUN} test:all
32
33
  schema:
@@ -37,9 +38,21 @@ jobs:
37
38
  - uses: actions/setup-node@v5
38
39
  with:
39
40
  node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
40
- - run: corepack enable
41
+ package-manager-cache: false
42
+ ${PACKAGE_MANAGER_SETUP}
41
43
  - run: ${INSTALL_COMMAND}
42
- - run: node scripts/ci/check-schema.mjs || true
44
+ - name: Check schema with evidence log
45
+ shell: bash
46
+ run: |
47
+ set -o pipefail
48
+ node scripts/ci/check-schema.mjs 2>&1 | tee qualification-schema.log
49
+ - name: Upload schema evidence
50
+ if: ${{ always() }}
51
+ uses: actions/upload-artifact@v4
52
+ with:
53
+ name: qualification-schema-${{ github.run_id }}-${{ github.run_attempt }}
54
+ path: qualification-schema.log
55
+ if-no-files-found: error
43
56
  security:
44
57
  needs: [qualification]
45
58
  runs-on: ubuntu-latest
@@ -48,7 +61,8 @@ jobs:
48
61
  - uses: actions/setup-node@v5
49
62
  with:
50
63
  node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
51
- - run: corepack enable
64
+ package-manager-cache: false
65
+ ${PACKAGE_MANAGER_SETUP}
52
66
  - run: ${INSTALL_COMMAND}
53
67
  - run: node scripts/ci/check-network-boundary.mjs
54
68
  - name: Hostile-repository and secret-egress suite
@@ -61,7 +75,8 @@ jobs:
61
75
  - uses: actions/setup-node@v5
62
76
  with:
63
77
  node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
64
- - run: corepack enable
78
+ package-manager-cache: false
79
+ ${PACKAGE_MANAGER_SETUP}
65
80
  - run: ${INSTALL_COMMAND}
66
81
  - run: ${PM_RUN} test:hardening
67
82
  conformance:
@@ -72,6 +87,7 @@ jobs:
72
87
  - uses: actions/setup-node@v5
73
88
  with:
74
89
  node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
75
- - run: corepack enable
90
+ package-manager-cache: false
91
+ ${PACKAGE_MANAGER_SETUP}
76
92
  - run: ${INSTALL_COMMAND}
77
93
  - run: ${PM_RUN} test:conformance
@@ -32,7 +32,8 @@ jobs:
32
32
  - uses: actions/setup-node@v5
33
33
  with:
34
34
  node-version: ${{ fromJSON('${NODE_MATRIX}')[0] }}
35
- - run: corepack enable
35
+ package-manager-cache: false
36
+ ${PACKAGE_MANAGER_SETUP}
36
37
  - run: ${INSTALL_COMMAND}
37
38
  - run: node --test tests/release-candidate.test.mjs
38
39
  - run: node scripts/release/build-candidate.mjs --platform current --out "${{ runner.temp }}/${ARTIFACT_PREFIX}-rc"
package/test-support.mjs CHANGED
@@ -28,6 +28,6 @@ export const SAMPLE_MANIFEST = {
28
28
  schemaVersion: 1,
29
29
  lanes: ["ci", "package-smoke"],
30
30
  matrix: { os: ["ubuntu-latest"], node: ["22.13"] },
31
- packageManager: "pnpm@11.18.0",
31
+ packageManager: "pnpm@11.24.0",
32
32
  templateVersion: "1.0.0",
33
33
  };
@@ -33,7 +33,7 @@ test("uninstall removes every managed file, leaving zero behind — including th
33
33
  // only ever looked at marker-bearing workflow files, so it reported success
34
34
  // while leaving the manifest behind. Reproduces the QA report's
35
35
  // "interruptedInstall" probe.
36
- test("F6: uninstall removes the manifest left behind by an install interrupted after the visibility check", async () => {
36
+ test("install rolls back precisely when visibility changes after preflight", async () => {
37
37
  const dir = makeTempRepo(null);
38
38
  let calls = 0;
39
39
  const flakyDeps = {
@@ -47,13 +47,8 @@ test("F6: uninstall removes the manifest left behind by an install interrupted a
47
47
 
48
48
  const installResult = await installCommand(dir, { lanes: ["ci"] }, flakyDeps);
49
49
  assert.equal(installResult.ok, false);
50
- assert.equal(installResult.stage, "synced");
51
- assert.ok(fs.existsSync(path.join(dir, MANIFEST_FILENAME)), "setup: interrupted install must still leave the manifest on disk");
52
-
53
- const uninstallResult = uninstallCommand(dir);
54
- assert.equal(uninstallResult.ok, true);
55
- assert.ok(uninstallResult.removed.includes(MANIFEST_FILENAME));
56
- assert.equal(fs.existsSync(path.join(dir, MANIFEST_FILENAME)), false, "F6: manifest must not survive uninstall after an interrupted install");
50
+ assert.equal(installResult.stage, "visibility");
51
+ assert.equal(fs.existsSync(path.join(dir, MANIFEST_FILENAME)), false);
57
52
  });
58
53
 
59
54
  test("uninstall never touches an unmanaged file in the same directory", async () => {
@@ -75,3 +70,10 @@ test("uninstall on a repo with no managed files is a no-op, not an error", () =>
75
70
  assert.equal(result.ok, true);
76
71
  assert.deepEqual(result.removed, []);
77
72
  });
73
+
74
+ test("install validates before it creates a manifest", async () => {
75
+ const dir = makeTempRepo(null);
76
+ const result = await installCommand(dir, { lanes: ["not-a-lane"] }, PUBLIC_DEPS);
77
+ assert.equal(result.stage, "manifest-invalid");
78
+ assert.equal(fs.existsSync(path.join(dir, MANIFEST_FILENAME)), false);
79
+ });