@smoothbricks/nx-plugin 0.6.1 → 0.6.3-0

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.
Files changed (104) hide show
  1. package/README.md +264 -55
  2. package/dist/.build-inputs.json +21 -15
  3. package/dist/bin/smoo-nx-publish.d.ts +3 -0
  4. package/dist/bin/smoo-nx-publish.d.ts.map +1 -0
  5. package/dist/bin/smoo-nx-publish.js +3 -0
  6. package/dist/cargo-retention-hook.d.ts +14 -3
  7. package/dist/cargo-retention-hook.d.ts.map +1 -1
  8. package/dist/cargo-retention-hook.js +25 -8
  9. package/dist/eslint-file-set.d.ts +4 -1
  10. package/dist/eslint-file-set.d.ts.map +1 -1
  11. package/dist/eslint-sources.d.ts +25 -0
  12. package/dist/eslint-sources.d.ts.map +1 -0
  13. package/dist/eslint-sources.js +99 -0
  14. package/dist/executors/all-verdicts/executor.d.ts +2 -1
  15. package/dist/executors/all-verdicts/executor.d.ts.map +1 -1
  16. package/dist/executors/all-verdicts/executor.js +48 -2
  17. package/dist/executors/all-verdicts/schema.d.ts +13 -0
  18. package/dist/executors/all-verdicts/schema.d.ts.map +1 -1
  19. package/dist/executors/all-verdicts/schema.js +7 -0
  20. package/dist/executors/bounded-exec/bounds.d.ts +57 -8
  21. package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
  22. package/dist/executors/bounded-exec/bounds.js +100 -11
  23. package/dist/executors/bounded-exec/executor.d.ts +2 -1
  24. package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
  25. package/dist/executors/bounded-exec/executor.js +270 -27
  26. package/dist/executors/bounded-exec/hang-diagnostics.d.ts +2 -0
  27. package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
  28. package/dist/executors/bounded-exec/hang-diagnostics.js +27 -3
  29. package/dist/executors/bounded-exec/mbx-pool.d.ts +20 -3
  30. package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
  31. package/dist/executors/bounded-exec/mbx-pool.js +84 -4
  32. package/dist/executors/bounded-exec/mbx-queue.d.ts +30 -0
  33. package/dist/executors/bounded-exec/mbx-queue.d.ts.map +1 -0
  34. package/dist/executors/bounded-exec/mbx-queue.js +229 -0
  35. package/dist/executors/bounded-exec/progress.d.ts +9 -2
  36. package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
  37. package/dist/executors/bounded-exec/progress.js +148 -22
  38. package/dist/executors/bounded-exec/test-result-writer.d.ts +30 -0
  39. package/dist/executors/bounded-exec/test-result-writer.d.ts.map +1 -0
  40. package/dist/executors/bounded-exec/test-result-writer.js +126 -0
  41. package/dist/executors/bounded-exec/test-results.d.ts +33 -0
  42. package/dist/executors/bounded-exec/test-results.d.ts.map +1 -0
  43. package/dist/executors/bounded-exec/test-results.js +33 -0
  44. package/dist/executors/bounded-exec/verdict.d.ts +20 -2
  45. package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
  46. package/dist/executors/bounded-exec/verdict.js +102 -4
  47. package/dist/index.d.ts +3 -2
  48. package/dist/index.d.ts.map +1 -1
  49. package/dist/index.js +67 -65
  50. package/dist/managed-files/files.d.ts.map +1 -1
  51. package/dist/managed-files/files.js +6 -0
  52. package/dist/nx-publish.d.ts +24 -0
  53. package/dist/nx-publish.d.ts.map +1 -0
  54. package/dist/nx-publish.js +150 -0
  55. package/dist/runtime-input-policy.d.ts +14 -0
  56. package/dist/runtime-input-policy.d.ts.map +1 -1
  57. package/dist/runtime-input-policy.js +1 -1
  58. package/dist/tool-bins.d.ts +6 -8
  59. package/dist/tool-bins.d.ts.map +1 -1
  60. package/dist/tool-bins.js +7 -5
  61. package/dist/workspace-index.d.ts +7 -0
  62. package/dist/workspace-index.d.ts.map +1 -1
  63. package/dist/workspace-index.js +11 -0
  64. package/executors.json +1 -1
  65. package/managed/raw/envrc +15 -0
  66. package/managed/raw/patches/ttsc@0.34.1.patch +75 -0
  67. package/managed/raw/tooling/devenv +1 -2
  68. package/managed/raw/tooling/direnv/developer-links.ts +15 -1
  69. package/managed/raw/tooling/direnv/devenv.smoo.nix +45 -13
  70. package/managed/raw/tooling/direnv/github-actions-bootstrap.sh +20 -10
  71. package/managed/raw/tooling/direnv/linked-snapshots.ts +50 -13
  72. package/managed/raw/tooling/direnv/setup-environment.ts +36 -9
  73. package/managed/raw/tooling/direnv/ttsc-env.sh +8 -6
  74. package/managed/raw/tooling/git-hooks/pre-push.sh +4 -1
  75. package/managed/raw/tooling/git-reword-commit +151 -0
  76. package/managed/templates/github/actions/cache-node-modules/action.yml +1 -1
  77. package/managed/templates/github/actions/cache-ttsc-plugins/action.yml +12 -11
  78. package/package.json +226 -10
  79. package/runtime/nx-publish/cache_adapter.js +45 -0
  80. package/runtime/nx-publish/nx_publish.js +60 -0
  81. package/runtime-input.sh +12 -3
  82. package/src/bin/smoo-nx-publish.ts +4 -0
  83. package/src/cargo-retention-hook.ts +28 -11
  84. package/src/eslint-file-set.ts +4 -1
  85. package/src/eslint-sources.ts +134 -0
  86. package/src/executors/all-verdicts/executor.ts +58 -3
  87. package/src/executors/all-verdicts/schema.json +4 -0
  88. package/src/executors/all-verdicts/schema.ts +14 -0
  89. package/src/executors/bounded-exec/bounds.ts +132 -15
  90. package/src/executors/bounded-exec/executor.ts +303 -27
  91. package/src/executors/bounded-exec/hang-diagnostics.ts +31 -3
  92. package/src/executors/bounded-exec/mbx-pool.ts +82 -5
  93. package/src/executors/bounded-exec/mbx-queue.ts +170 -0
  94. package/src/executors/bounded-exec/progress.ts +168 -15
  95. package/src/executors/bounded-exec/test-result-writer.ts +152 -0
  96. package/src/executors/bounded-exec/test-results.ts +39 -0
  97. package/src/executors/bounded-exec/verdict.ts +108 -5
  98. package/src/index.ts +74 -70
  99. package/src/managed-files/files.ts +6 -0
  100. package/src/nx-publish.ts +157 -0
  101. package/src/runtime-input-policy.ts +1 -1
  102. package/src/tool-bins.ts +13 -9
  103. package/src/workspace-index.ts +12 -0
  104. package/test-timings.json +8 -2
@@ -1,13 +1,11 @@
1
1
  import type { TargetConfiguration } from 'nx/src/devkit-exports.js';
2
- /** The tool packages whose executables inferred commands run. */
3
- declare const NATIVE_TOOL_PACKAGES: readonly ['build-inputs', 'cargo-retain', 'nextest-extract'];
2
+ /** The tool packages whose native artifacts inferred commands consume. */
3
+ declare const NATIVE_TOOL_PACKAGES: readonly ['build-inputs', 'cargo-retain', 'nextest-extract', 'cowshed'];
4
4
  export type NativeToolPackage = (typeof NATIVE_TOOL_PACKAGES)[number];
5
5
  type TargetDependency = NonNullable<TargetConfiguration['dependsOn']>[number];
6
6
  /**
7
- * The tool packages' executables as the inferring host runs them. Every scriptc package ships each platform's
8
- * executable under `dist/bin/<platform>/`, so an installed tool package already carries this host's. A tool package
9
- * that is a project of the workspace being inferred (a checkout of the repository that builds it) has only what its
10
- * `scriptc-<arch>-<family>` target last wrote, so a command running it depends on that target.
7
+ * Native tools as the inferring host consumes them. Installed packages already ship their artifacts; a workspace
8
+ * package needs its declared producer. Scriptc tools use the host platform target, cowshed its napi-native addon.
11
9
  */
12
10
  export interface NativeTools {
13
11
  /** The host's directory under a tool package's `dist/bin`. */
@@ -27,7 +25,7 @@ export declare function resolveNativeTools(workspaceRoot: string, projectManifes
27
25
  * where no tool package carries an executable to run.
28
26
  */
29
27
  export declare function nativeToolCommand(tools: Pick<NativeTools, 'platform'> | null, cwd: string, tool: NativeToolPackage, bin: string): string;
30
- /** The task that builds `tool`'s executables for this host, when this workspace builds them. */
31
- export declare function nativeToolDependsOn(tools: NativeTools | null, tool: NativeToolPackage): TargetDependency[];
28
+ /** The task producing a tool artifact, only when this workspace owns its package. */
29
+ export declare function nativeToolDependsOn(tools: NativeTools | null, tool: NativeToolPackage, target?: string): TargetDependency[];
32
30
  export {};
33
31
  //# sourceMappingURL=tool-bins.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tool-bins.d.ts","sourceRoot":"","sources":["../src/tool-bins.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAsBpE,iEAAiE;AACjE,QAAA,MAAM,oBAAoB,YAAI,cAAc,EAAE,cAAc,EAAE,iBAAiB,CAAU,CAAC;AAE1F,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,KAAK,gBAAgB,GAAG,WAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;CAC3D;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,SAAS,MAAM,EAAE,EACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,CAmBtB;AAUD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,IAAI,EAC3C,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,iBAAiB,EACvB,GAAG,EAAE,MAAM,GACV,MAAM,CAOR;AAED,gGAAgG;AAChG,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,EAAE,IAAI,EAAE,iBAAiB,GAAG,gBAAgB,EAAE,CAG1G"}
1
+ {"version":3,"file":"tool-bins.d.ts","sourceRoot":"","sources":["../src/tool-bins.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAsBpE,0EAA0E;AAC1E,QAAA,MAAM,oBAAoB,YAAI,cAAc,EAAE,cAAc,EAAE,iBAAiB,EAAE,SAAS,CAAU,CAAC;AAErG,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,KAAK,gBAAgB,GAAG,WAAW,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kFAAkF;IAClF,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;CAC3D;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CACtC,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,SAAS,MAAM,EAAE,EACnC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,CAmBtB;AAUD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,UAAU,CAAC,GAAG,IAAI,EAC3C,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,iBAAiB,EACvB,GAAG,EAAE,MAAM,GACV,MAAM,CAOR;AAED,qFAAqF;AACrF,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,GAAG,IAAI,EACzB,IAAI,EAAE,iBAAiB,EACvB,MAAM,CAAC,EAAE,MAAM,GACd,gBAAgB,EAAE,CAKpB"}
package/dist/tool-bins.js CHANGED
@@ -18,8 +18,8 @@ const PLUGIN_LINK = 'node_modules/@smoothbricks/nx-plugin';
18
18
  function toolCommand(cwd, tool, file) {
19
19
  return `${posix.join(posix.relative(cwd, '.'), PLUGIN_LINK)}/../${tool}/${file}`;
20
20
  }
21
- /** The tool packages whose executables inferred commands run. */
22
- const NATIVE_TOOL_PACKAGES = ['build-inputs', 'cargo-retain', 'nextest-extract'];
21
+ /** The tool packages whose native artifacts inferred commands consume. */
22
+ const NATIVE_TOOL_PACKAGES = ['build-inputs', 'cargo-retain', 'nextest-extract', 'cowshed'];
23
23
  /**
24
24
  * The tools of the workspace at `workspaceRoot`, whose project manifests are `projectManifests` (workspace-relative):
25
25
  * a tool package is a project when the plugin's link resolves beside one of them.
@@ -65,8 +65,10 @@ export function nativeToolCommand(tools, cwd, tool, bin) {
65
65
  }
66
66
  return toolCommand(cwd, tool, `dist/bin/${tools.platform}/${bin}`);
67
67
  }
68
- /** The task that builds `tool`'s executables for this host, when this workspace builds them. */
69
- export function nativeToolDependsOn(tools, tool) {
68
+ /** The task producing a tool artifact, only when this workspace owns its package. */
69
+ export function nativeToolDependsOn(tools, tool, target) {
70
70
  const project = tools?.projects.get(tool);
71
- return project === undefined || tools === null ? [] : [{ projects: [project], target: tools.target }];
71
+ return project === undefined || tools === null
72
+ ? []
73
+ : [{ projects: [project], target: target ?? (tool === 'cowshed' ? 'napi-native' : tools.target) }];
72
74
  }
@@ -9,4 +9,11 @@
9
9
  * test fixture or a foreign checkout, is indexed by this process's context.
10
10
  */
11
11
  export declare function globIndexedFiles(workspaceRoot: string, globs: string[]): Promise<string[]>;
12
+ /**
13
+ * Like {@link globIndexedFiles}, read from the filesystem now: a new native context, the same walk and the same ignore
14
+ * rules, never the table of this process or of the daemon. A table only learns of a write when a watcher event reaches
15
+ * it, so one the watcher missed leaves a deleted file listed and an added one unlisted until that process ends. What
16
+ * runs on the files as they are asks here; what describes a graph asks {@link globIndexedFiles}.
17
+ */
18
+ export declare function freshIndexedFiles(workspaceRoot: string, globs: string[]): string[];
12
19
  //# sourceMappingURL=workspace-index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-index.d.ts","sourceRoot":"","sources":["../src/workspace-index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAIhG"}
1
+ {"version":3,"file":"workspace-index.d.ts","sourceRoot":"","sources":["../src/workspace-index.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAIhG;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAElF"}
@@ -1,3 +1,5 @@
1
+ import native from 'nx/src/native/index.js';
2
+ import { workspaceDataDirectoryForWorkspace } from 'nx/src/utils/cache-directory.js';
1
3
  import { globWithWorkspaceContext, globWithWorkspaceContextSync } from 'nx/src/utils/workspace-context.js';
2
4
  import { workspaceRoot as daemonWorkspaceRoot } from 'nx/src/utils/workspace-root.js';
3
5
  /**
@@ -15,3 +17,12 @@ export async function globIndexedFiles(workspaceRoot, globs) {
15
17
  ? globWithWorkspaceContext(workspaceRoot, globs)
16
18
  : globWithWorkspaceContextSync(workspaceRoot, globs);
17
19
  }
20
+ /**
21
+ * Like {@link globIndexedFiles}, read from the filesystem now: a new native context, the same walk and the same ignore
22
+ * rules, never the table of this process or of the daemon. A table only learns of a write when a watcher event reaches
23
+ * it, so one the watcher missed leaves a deleted file listed and an added one unlisted until that process ends. What
24
+ * runs on the files as they are asks here; what describes a graph asks {@link globIndexedFiles}.
25
+ */
26
+ export function freshIndexedFiles(workspaceRoot, globs) {
27
+ return new native.WorkspaceContext(workspaceRoot, workspaceDataDirectoryForWorkspace(workspaceRoot)).glob(globs);
28
+ }
package/executors.json CHANGED
@@ -43,7 +43,7 @@
43
43
  "all-verdicts": {
44
44
  "implementation": "./dist/executors/all-verdicts/executor.js",
45
45
  "schema": "./src/executors/all-verdicts/schema.json",
46
- "description": "Run every command at once to its own verdict and report each one a signal ended or that never ran as UNJUDGED"
46
+ "description": "Run every command at once to its own verdict and report each one a signal ended or that never ran as UNJUDGED; resolve an ESLint sources placeholder against the files that exist when the command runs"
47
47
  }
48
48
  }
49
49
  }
package/managed/raw/envrc CHANGED
@@ -13,7 +13,22 @@ if ! has devenv; then
13
13
  fi
14
14
  pushd tooling/direnv >/dev/null
15
15
  eval "$(devenv direnvrc)"
16
+ # devenv's use_devenv answers an evaluation that failed with `exit 0`, keeping whatever environment
17
+ # the shell had. Entered by direnv, or activated by cowshed for a workspace's jobs, that shell then
18
+ # has none of this checkout's tools and says nothing (a cancelled evaluation left one recorded as a
19
+ # workspace's shell). Entry fails instead: direnv's exit hook (__dump_at_exit) still dumps the
20
+ # diff, now with this status. An inherited DEVENV_ROOT is another shell's, never this evaluation's.
21
+ unset DEVENV_ROOT
22
+ smoo_require_devenv() {
23
+ local status=$?
24
+ [ -n "${DEVENV_ROOT-}" ] && return "$status"
25
+ log_error "devenv built no environment (see above): this checkout's shell is not entered"
26
+ return 1
27
+ }
28
+ trap 'smoo_require_devenv; __dump_at_exit' EXIT
16
29
  use devenv
30
+ trap __dump_at_exit EXIT
31
+ unset -f smoo_require_devenv
17
32
  popd >/dev/null
18
33
 
19
34
  # devenv hands direnv only the files its evaluation read; a directory a devenv
@@ -90,6 +90,29 @@ index f6ee81fb1af41deea022b92e838a7c4665eb9778..112faf913ce38b1f4624b38db3783937
90
90
  }
91
91
 
92
92
  // forceNoEmit sets noEmit so the program type-checks without writing files.
93
+ diff --git a/lib/internal/javascriptRuntimeCapabilities.js b/lib/internal/javascriptRuntimeCapabilities.js
94
+ --- a/lib/internal/javascriptRuntimeCapabilities.js
95
+ +++ b/lib/internal/javascriptRuntimeCapabilities.js
96
+ @@ -43,6 +43,19 @@
97
+ * @evidence contracts/performance.md#bound-retention-and-release-resources The synchronous probe owns child completion and fallback captures; finally attempts capture close/removal, whose helper suppresses cleanup failures, so native/file release is unconfirmed on failure. Capability entries retain absolute spellings and path/identity text with no eviction quota; failed identity validation can remove an entry. Returned capability copies transfer to callers.
98
+ */
99
+ function javascriptRuntimeCapabilities(runtime, env, cwd, identities) {
100
+ + // The running process answers for itself. Under Bun, process.execPath names
101
+ + // Bun (pluginDescriptorRuntimeBinary), and a probe of it can fail for reasons
102
+ + // that say nothing about the executable: its 30 s timeout under load, or a
103
+ + // spawn the host refused. Read as "not Bun", that failure handed Bun Node's
104
+ + // `--input-type ""`, which Bun runs as an empty `bun run` script, so the
105
+ + // plugin descriptor produced no output. This process knows what it is.
106
+ + if (node_path_1.default.isAbsolute(runtime) && sameRuntimeExecutable(runtime, process.execPath)) {
107
+ + return {
108
+ + bun: typeof globalThis.Bun === "object",
109
+ + executable: process.execPath,
110
+ + registerHooks: typeof require("node:module").registerHooks === "function",
111
+ + };
112
+ + }
113
+ // Inside a ttsx run this is the user's NODE_OPTIONS, not ttsx's preloads,
114
+ // which would refuse the cache and run in the probe (#1740).
115
+ const effectiveEnv = TtsxNodeOptions_1.TtsxNodeOptions.forHelpers(SidecarEnvironment_1.SidecarEnvironment.merge(process.env, env));
93
116
  diff --git a/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js b/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js
94
117
  --- a/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js
95
118
  +++ b/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js
@@ -117,3 +140,55 @@ diff --git a/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js b/lib/
117
140
  worker = created;
118
141
  const retire = () => {
119
142
  if (worker === created)
143
+ diff --git a/lib/plugin/internal/source/waitForPluginBinary.js b/lib/plugin/internal/source/waitForPluginBinary.js
144
+ --- a/lib/plugin/internal/source/waitForPluginBinary.js
145
+ +++ b/lib/plugin/internal/source/waitForPluginBinary.js
146
+ @@ -25,6 +25,12 @@
147
+ * run. An opted-in synchronous owner can cancel observation or interrupt a
148
+ * polling sleep; cancellation never retires the holder's generation.
149
+ *
150
+ + * A published binary is not admission: the caller registers as its reader
151
+ + * under the key, which only release or retirement frees. Each poll therefore
152
+ + * inspects the lock before it reports publication, so a holder that died
153
+ + * holding the key after its binary was published is reported abandoned
154
+ + * instead of outwaiting the admission budget.
155
+ + *
156
+ * @evidence contracts/common.md#principled-implementation Polling first refuses unknown/malformed native guards, suppresses publication while pending and rechecks after observed release; actual abandoned-owner observations retain their exact generation, while budget expiry fails without revoking a possibly active payload task.
157
+ * @evidence contracts/common.md#clear-and-simple-design The loop separates publication, release, retirement and periodic status reporting; generation interpretation belongs to inspectPluginBuildLock.
158
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Budget expiry throws instead of retiring a live-looking generation and compensating for concurrent callbacks; status output never substitutes for ownership evidence.
159
+ @@ -43,22 +49,9 @@
160
+ OwnedSynchronousProcess_1.OwnedSynchronousProcess.checkpoint();
161
+ SourceNativeRetirement_1.SourceNativeRetirement.assertAvailable(protocolDir);
162
+ const protectedNativeInputs = SourceNativeRetirement_1.SourceNativeRetirement.isProtected(protocolDir);
163
+ - if (!protectedNativeInputs && node_fs_1.default.existsSync(opts.binaryPath)) {
164
+ - OwnedSynchronousProcess_1.OwnedSynchronousProcess.checkpoint();
165
+ - return { outcome: "published" };
166
+ - }
167
+ const clock = performance.now();
168
+ const lock = (0, inspectPluginBuildLock_1.inspectPluginBuildLock)(opts.lockDir);
169
+ OwnedSynchronousProcess_1.OwnedSynchronousProcess.checkpoint();
170
+ - if (lock.state === "released") {
171
+ - // The holder retired its generation between the binary check above and
172
+ - // this observation. That is a normal release, not abandonment: prefer the
173
+ - // binary when it landed inside that window, otherwise hand the free key
174
+ - // back to the caller.
175
+ - return !protectedNativeInputs && node_fs_1.default.existsSync(opts.binaryPath)
176
+ - ? { outcome: "published" }
177
+ - : { outcome: "released" };
178
+ - }
179
+ if (lock.state === "abandoned") {
180
+ return {
181
+ outcome: "abandoned",
182
+ @@ -66,6 +59,12 @@
183
+ fence: lock.fence,
184
+ };
185
+ }
186
+ + if (!protectedNativeInputs && node_fs_1.default.existsSync(opts.binaryPath)) {
187
+ + return { outcome: "published" };
188
+ + }
189
+ + if (lock.state === "released") {
190
+ + return { outcome: "released" };
191
+ + }
192
+ if (clock - startedAt >= opts.timeoutMs) {
193
+ throw new Error(`ttsc: timed out after ${(0, formatDuration_1.formatDuration)(clock - startedAt)} waiting for ` +
194
+ `${opts.lockInfo.label} "${opts.lockInfo.pluginName}" at ${opts.lockDir}; ` +
@@ -4,7 +4,6 @@
4
4
 
5
5
  # Save the current working directory
6
6
  ORIGINAL_PWD="$(pwd)"
7
- SELF_PATH="$(realpath "$0")"
8
7
 
9
8
  # Locate this repository's tooling/ from the INVOCATION path, not from
10
9
  # realpath($0). WHY: tooling/devenv is a symlink into
@@ -29,7 +28,7 @@ fi
29
28
  # Find the actual Nix-built devenv binary, skipping every wrapper script.
30
29
  # WHY: PATH routinely holds more than one of these wrappers at once — this
31
30
  # repo's tooling/devenv, sibling repos' wrappers, and direnv-stacked parent
32
- # environments. A plain "not equal to SELF_PATH" check happily selects a
31
+ # environments. Excluding only this wrapper's own path happily selects a
33
32
  # *different* wrapper and exec's it, so `devenv` bounces into the wrong repo
34
33
  # (or self-execs forever on cheap checks like `devenv version`). The real devenv
35
34
  # is always the Nix-managed executable under /nix/store, so match that and ignore
@@ -126,6 +126,7 @@ import path from 'node:path';
126
126
  import type { BuildInputProducer, KeepDeveloperLinksOptions } from '@smoothbricks/nx-plugin/managed-assets';
127
127
  import {
128
128
  linkAnchor,
129
+ newestSealedSnapshot,
129
130
  type ProducerProbe,
130
131
  packedFiles,
131
132
  pinnedSnapshot,
@@ -445,6 +446,9 @@ export interface DeclaredLinksPlan {
445
446
  * binding it inherited from the main checkout, or reach through a redirected or
446
447
  * escaping path. Resolving a snapshot may capture one (linked-snapshots.ts),
447
448
  * which writes only the snapshot store.
449
+ * A throw is a refusal. Shell entry fails on it: once the tasks have run, the
450
+ * enterShell prologue plans again (setup-environment.ts, `--links --refusal`),
451
+ * so a refusal is read from the providers at that entry and none is kept.
448
452
  */
449
453
  export async function planDeclaredLinks(root: string): Promise<DeclaredLinksPlan> {
450
454
  const declared = readDeclaredLinks(root);
@@ -478,7 +482,17 @@ export async function planDeclaredLinks(root: string): Promise<DeclaredLinksPlan
478
482
  // own producer provenance instead).
479
483
  if (snapshot === undefined) {
480
484
  const stale = staleBuilds(name, source);
481
- if (stale.length > 0) throw new Error(staleBuildsRefusal(stale));
485
+ if (stale.length > 0) {
486
+ // The live build is older than its sources: serve the newest sealed snapshot of the package instead, named with
487
+ // the revision it holds and why, so shell entry goes on with a build that describes its own sources. With none
488
+ // sealed, the link is refused as before.
489
+ const fallback = newestSealedSnapshot(root, name, source);
490
+ if (fallback === null) throw new Error(staleBuildsRefusal(stale));
491
+ binding = { kind: 'snapshot', target: fallback.directory, id: fallback.id };
492
+ reports.push(
493
+ `! smoo.developerLinks ${name}: serving sealed snapshot ${fallback.id} of ${fallback.head}, the newest this checkout holds, because the live checkout's build is stale: ${staleBuildsRefusal(stale)}`,
494
+ );
495
+ }
482
496
  }
483
497
  if (snapshot !== undefined) {
484
498
  const outcome = await snapshotBinding(root, name, source, snapshot, probe);
@@ -214,13 +214,12 @@ in {
214
214
  # wants the cache anyway names it in its own nix.conf.
215
215
  cachix.enable = false;
216
216
 
217
- # sccache is deliberately absent from this shell. It used to export
217
+ # No compiler cache is exported from this shell. One shell once exported
218
218
  # RUSTC_WRAPPER=sccache as a BARE NAME, which PATH then resolved per project —
219
- # which is precisely how an unpatched binary from one profile came to serve
220
- # clients from another. sccache now belongs to cowshed: `cowshed setup
221
- # --sccache` builds packages/cowshed/nix/sccache, pins the result with a nix GC
222
- # root, and supervises that exact store path. A repository shell has no
223
- # business deciding which compiler cache a host runs.
219
+ # which is how an unpatched binary from one profile came to serve clients from
220
+ # another. Cargo's cache is mbx: a repository pins it in its own devenv, and
221
+ # cowshed proves that pin against the mbx it installs beside itself
222
+ # (specs/cowshed/05_gateway.md, "Pool selection and revision").
224
223
 
225
224
  # One toolchain for every repository and every workspace, pinned by devenv.lock
226
225
  # rather than by a rust-toolchain file. devenv resolves the channel through
@@ -488,6 +487,11 @@ in {
488
487
  # digest under the install lock, so two shells entering at once install once.
489
488
  # The scripts themselves are inputs: a new setup-environment.ts reruns.
490
489
  #
490
+ # A uv project also has live installed state: a copied environment can hold
491
+ # an absolute editable mapping while every input digest is unchanged. Its
492
+ # status joins the installer's own input stamps and relocation witness;
493
+ # non-Python projects retain the input-only task cache below.
494
+ #
491
495
  # smoo:cargo-fetch establishes what the Nx plugin's offline `cargo metadata
492
496
  # --locked` needs: every Cargo workspace's locked packages in CARGO_HOME. Its
493
497
  # stamps live in smoo's user cache and count only while CARGO_HOME names the
@@ -511,15 +515,30 @@ in {
511
515
  # A runner links nothing.
512
516
  #
513
517
  # A failed task does not fail shell entry (devenv reports it and the shell
514
- # still loads, so the tools to repair it stay available). CI runs both with
515
- # `devenv tasks run`, which does fail; setup-environment.ts is strict there.
518
+ # still loads, so the tools to repair it stay available), with one
519
+ # exception: smoo:developer-links refusing the declared links. A shell on
520
+ # links its declaration does not describe runs another build than it says
521
+ # (a live checkout whose build is stale, with no sealed snapshot to serve
522
+ # instead), and the repair is in the provider checkout, not in this shell.
523
+ # So the prologue below asks `setup-environment.ts --links --refusal` once
524
+ # the tasks have run, and fails entry with the planner's reason: the answer
525
+ # is read from the providers at that entry, so the entry after the provider
526
+ # is rebuilt goes in with no step between, and nothing of a refusal outlives
527
+ # it. devenv also evaluates the whole enterShell script once before it runs
528
+ # any task, only to capture the environment (it sets DEVENV_SKIP_TASKS), and
529
+ # a script that fails in that pass stops the tasks that would repair: it
530
+ # asks nothing there, and a manifest that declares no links starts no
531
+ # process. CI runs both with `devenv tasks run`, which does fail;
532
+ # setup-environment.ts is strict there.
516
533
  tasks = let
517
534
  setup = ''bun "$DEVENV_ROOT/setup-environment.ts"'';
535
+ install = setup + lib.optionalString uvProject " --python ${python.package.interpreter}";
518
536
  in {
519
537
  "smoo:install" = {
520
538
  description = "bun install / uv sync when what they read changed";
521
- exec = setup + lib.optionalString uvProject " --python ${python.package.interpreter}";
522
- execIfModified = [
539
+ exec = install;
540
+ status = lib.mkIf uvProject (install + " --check");
541
+ execIfModified = lib.optionals (!uvProject) [
523
542
  "../../package.json"
524
543
  "../../bun.lock"
525
544
  "../../bun.lockb"
@@ -563,7 +582,9 @@ in {
563
582
  # Prologue, in order:
564
583
  #
565
584
  # 1. The devenv wrapper runs from tooling/direnv; every later step expects the
566
- # workspace root.
585
+ # workspace root. Once the tasks have run, the planner's refusal of the
586
+ # declared links (smoo:developer-links above) fails entry before any
587
+ # later step.
567
588
  # 2. PATH order is most-specific → least-specific, the same list the git hooks
568
589
  # use, so a hook and a shell resolve one binary the same way. The Rust
569
590
  # toolchain's store bin then goes ahead of all of it (rustToolchainBin
@@ -571,8 +592,10 @@ in {
571
592
  # owns.
572
593
  # 3. ttsc drives the native TypeScript 7 binary while Nx imports the TypeScript
573
594
  # 6 API, so the two must be named separately.
574
- # 4. ttsc caches in the checkout's .cache/ttsc (the path the CI ttsc-plugin
575
- # cache restores), its Go build cache in a directory of its own so
595
+ # 4. ttsc caches its plugin binaries in the checkout's .cache/ttsc-plugins (the
596
+ # path the CI ttsc-plugin cache restores, and the output a repository's
597
+ # plugin build target declares), its Go build cache in .cache/ttsc/go-build,
598
+ # a directory of its own outside that output, so
576
599
  # `ttsc clean` can reclaim it: ttsc never deletes a GOCACHE it did not
577
600
  # resolve itself, and sharing GOCACHE once left 35G nothing could empty.
578
601
  # GOFLAGS carries -trimpath, Go's stable way to keep absolute build paths
@@ -652,6 +675,12 @@ in {
652
675
  # they run.
653
676
  (lib.mkBefore ''
654
677
  cd "$DEVENV_ROOT/../.."
678
+ # smoo:developer-links (tasks above) refusing the declared links fails
679
+ # shell entry with the planner's reason, asked of the providers now. Only
680
+ # the entry proper asks, and only a manifest that declares links.
681
+ if [ -z "''${DEVENV_SKIP_TASKS:-}" ] && grep -qF developerLinks package.json; then
682
+ bun "$DEVENV_ROOT/setup-environment.ts" --links --refusal || exit $?
683
+ fi
655
684
  # A bare assignment: export's status would hide repo-path's refusal of a
656
685
  # cowshed workspace it could not serve, and the shell would enter with an
657
686
  # empty PATH.
@@ -681,6 +710,9 @@ in {
681
710
  unset GOROOT
682
711
  ${lib.optionalString uvProject ''
683
712
  if [ -f pyproject.toml ]; then
713
+ # The installer above owns sync and rewrites editable mappings after it.
714
+ # A reader's uv run must not rewrite them to this checkout's absolute path.
715
+ export UV_NO_SYNC=1
684
716
  export VIRTUAL_ENV="$UV_PROJECT_ENVIRONMENT"
685
717
  export PATH="$VIRTUAL_ENV/bin:$PATH"
686
718
  fi
@@ -11,11 +11,7 @@ repo_root="$(cd "$script_dir/../.." && pwd)"
11
11
  # A separate name on purpose: assigning to TTSC_CACHE_DIR itself would mutate
12
12
  # the (possibly exported) environment that persist_devenv_environment later
13
13
  # fingerprints as the pre-shell baseline.
14
- ttsc_cache_dir_default="${TTSC_CACHE_DIR:-$repo_root/.cache/ttsc}"
15
-
16
- add_repo_paths() {
17
- "$repo_root/tooling/direnv/repo-path" --github-path
18
- }
14
+ ttsc_cache_dir_default="${TTSC_CACHE_DIR:-$repo_root/.cache/ttsc-plugins}"
19
15
 
20
16
  # The CLI that evaluates the shell must be the commit whose modules the shell is
21
17
  # locked to, so this installs the commit devenv.lock's `devenv` node names and
@@ -171,9 +167,6 @@ build_devenv_shell() {
171
167
  if [ "${SMOO_ROOT_BUILD_INPUTS:-false}" = true ]; then
172
168
  root_build_inputs "$since"
173
169
  fi
174
- # Add repo-local tools only after the shell exists; cleanup steps use an
175
- # explicit PATH because failures before this point must still refresh caches.
176
- add_repo_paths
177
170
  }
178
171
 
179
172
  # The store cache's post phase collects garbage down to the live roots before
@@ -218,6 +211,8 @@ root_build_inputs() {
218
211
  persist_devenv_environment() {
219
212
  [ -n "${GITHUB_ENV:-}" ] || return 0
220
213
  local name entry value captured bkey persisted=""
214
+ local i
215
+ local -a path_entries
221
216
  # Baseline: this step's own exported variables, before shell influence.
222
217
  # Stored as smoo_baseline_<name> pseudo-map entries (printf -v), not a
223
218
  # bash-4 associative array — macOS runners still ship bash 3.2. compgen -e
@@ -238,8 +233,23 @@ persist_devenv_environment() {
238
233
  name="${entry%%=*}"
239
234
  value="${entry#*=}"
240
235
  case "$name" in
241
- # The runner step owns these; PATH persistence is add_repo_paths' job.
242
- PATH | PWD | OLDPWD | SHLVL | SHELL | HOME | USER | LOGNAME | HOSTNAME | TERM | TMPDIR | TMP | TEMP | _ | PS1) continue ;;
236
+ PATH)
237
+ # The profile alone is not the shell: mbx removes its Cargo shim's
238
+ # directory, which also holds the profile's linker. Keep the individual
239
+ # package bins the shell already selected, not a second tool list.
240
+ path_entries=()
241
+ while [[ "$value" == *:* ]]; do
242
+ path_entries+=("${value%%:*}")
243
+ value="${value#*:}"
244
+ done
245
+ path_entries+=("$value")
246
+ # GITHUB_PATH prepends; reverse to retain the shell's search order.
247
+ for (( i=${#path_entries[@]}-1; i>=0; i-- )); do
248
+ printf '%s\n' "${path_entries[i]}"
249
+ done >> "$GITHUB_PATH"
250
+ continue ;;
251
+ # The runner step owns these.
252
+ PWD | OLDPWD | SHLVL | SHELL | HOME | USER | LOGNAME | HOSTNAME | TERM | TMPDIR | TMP | TEMP | _ | PS1) continue ;;
243
253
  GITHUB_* | RUNNER_* | ACTIONS_* | CI) continue ;;
244
254
  # Shell-session bookkeeping, meaningful only inside the shell itself.
245
255
  DIRENV_* | DEVENV_* | NIX_* | BASH* | XDG_* | IN_NIX_SHELL | SMOO_ENV_CAPTURE_OUT) continue ;;
@@ -925,6 +925,56 @@ function copySealed(from: string, to: string): void {
925
925
  }
926
926
  }
927
927
 
928
+ /**
929
+ * The newest sealed snapshot of `name` this checkout's store, or else its link anchor's (the main checkout's), holds,
930
+ * newest by the commit time of the HEAD it captured, as `source`'s repository knows it; or null when there is none.
931
+ * What a live developer link serves while the live checkout's build does not describe its sources (developer-links.ts):
932
+ * the last revision that was built and sealed, never the stale build, and never a refusal that stops shell entry.
933
+ */
934
+ export function newestSealedSnapshot(
935
+ root: string,
936
+ name: string,
937
+ source: string,
938
+ ): (SealedSnapshot & { readonly head: string }) | null {
939
+ const stores = [...new Set([path.join(root, SNAPSHOT_STORE), path.join(linkAnchor(root), SNAPSHOT_STORE)])];
940
+ const candidates: { readonly directory: string; readonly receipt: SnapshotReceipt; readonly time: number }[] = [];
941
+ for (const store of stores) {
942
+ let entries: string[];
943
+ try {
944
+ entries = readdirSync(store);
945
+ } catch {
946
+ continue;
947
+ }
948
+ for (const entry of entries) {
949
+ const directory = path.join(store, entry);
950
+ const receipt = readSealed(directory);
951
+ if (receipt === null || receipt.name !== name || !contained(receipt.packagePath)) continue;
952
+ const committed = spawnSync('git', ['-C', source, 'log', '-1', '--format=%ct', receipt.provenance.head], {
953
+ encoding: 'utf8',
954
+ env: { ...process.env, GIT_CONFIG_GLOBAL: '/dev/null', GIT_CONFIG_NOSYSTEM: '1' },
955
+ });
956
+ const time = Number.parseInt(committed.stdout.trim(), 10);
957
+ if (committed.status === 0 && Number.isFinite(time)) candidates.push({ directory, receipt, time });
958
+ }
959
+ }
960
+ candidates.sort((left, right) => right.time - left.time);
961
+ for (const { directory, receipt } of candidates) {
962
+ try {
963
+ verifySnapshot(directory);
964
+ } catch (error) {
965
+ if (error instanceof SnapshotRefusal) continue;
966
+ throw error;
967
+ }
968
+ return {
969
+ kind: 'snapshot',
970
+ id: receipt.id,
971
+ directory: path.join(directory, receipt.packagePath),
972
+ head: receipt.provenance.head,
973
+ };
974
+ }
975
+ return null;
976
+ }
977
+
928
978
  /** A sealed snapshot's receipt, or null when `directory` holds none. Its census is not verified here. */
929
979
  export function readSealed(directory: string): SnapshotReceipt | null {
930
980
  let input: unknown;
@@ -941,19 +991,6 @@ export function readSealed(directory: string): SnapshotReceipt | null {
941
991
  return receipt;
942
992
  }
943
993
 
944
- /** The sealed snapshot `target` lies in, found by its receipt above it, or null. */
945
- export function sealedSnapshotOf(
946
- target: string,
947
- ): { readonly directory: string; readonly receipt: SnapshotReceipt } | null {
948
- for (let at = path.dirname(target); ; at = path.dirname(at)) {
949
- if (lstatSync(path.join(at, SNAPSHOT_RECEIPT), { throwIfNoEntry: false }) !== undefined) {
950
- const receipt = readSealed(at);
951
- return receipt === null ? null : { directory: at, receipt };
952
- }
953
- if (path.dirname(at) === at) return null;
954
- }
955
- }
956
-
957
994
  /**
958
995
  * The sealed snapshot of `name` in this checkout's store that `linkText`, an alias's recorded link at `entry`, binds,
959
996
  * once it verifies; or null when that text names no snapshot left in the store. When no new snapshot can be made the
@@ -212,6 +212,9 @@ const POST_COMMIT_BLOCK = [
212
212
  // points the packages `smoo.developerLinks` declares at their local checkouts.
213
213
  // devenv's smoo:developer-links task uses `--links --check` as its status:
214
214
  // links can change without any smoo:install input changing.
215
+ // `--links --refusal` is the question the managed enterShell prologue asks once the tasks have run (devenv.smoo.nix):
216
+ // silent and exit 0 unless the planner refuses the declared links now, then its reason and exit 1. It reads the
217
+ // providers' state at that entry, and nothing is kept for the next.
215
218
  // Declared above the bootstrap block for the same hoisting reason as above.
216
219
  const { values: flags } = parseArgs({
217
220
  options: {
@@ -219,6 +222,7 @@ const { values: flags } = parseArgs({
219
222
  cargo: { type: 'boolean' },
220
223
  links: { type: 'boolean' },
221
224
  check: { type: 'boolean' },
225
+ refusal: { type: 'boolean' },
222
226
  'repair-missing-payload': { type: 'string' },
223
227
  },
224
228
  });
@@ -232,6 +236,11 @@ const CARGO_WORKSPACE = /^\s*\[workspace\]/m;
232
236
  process.chdir(projectRoot);
233
237
 
234
238
  try {
239
+ if (flags.refusal === true && (flags.links !== true || flags.check === true)) {
240
+ reportSetupFailure(
241
+ new Error("--refusal is shell entry's question about the declared links: it takes --links and no --check"),
242
+ );
243
+ }
235
244
  const requestedPayload = flags['repair-missing-payload'];
236
245
  if (requestedPayload !== undefined) {
237
246
  if (flags.links === true || flags.check === true || cargoMode || flags.python !== undefined) {
@@ -246,6 +255,11 @@ try {
246
255
  if (process.env.GITHUB_ACTIONS === 'true') {
247
256
  process.exit(0);
248
257
  }
258
+ if (flags.refusal === true) {
259
+ // Asked once the tasks have run, so a refusal here is one they could not repair; it reaches the catch below.
260
+ await planDeclaredLinks(projectRoot);
261
+ process.exit(0);
262
+ }
249
263
  if (flags.check === true) {
250
264
  const plan = await planDeclaredLinks(projectRoot);
251
265
  // A refused or unclaimed snapshot is current only when said: the exec that follows names its cause.
@@ -297,10 +311,14 @@ try {
297
311
  // and package resolution/Typia transforms are not available yet.
298
312
  const bunInputs = bunInstallInputs();
299
313
  const cargoFetches = cargoMode ? cargoWorkspaces(bunInputs).map(cargoFetcher) : [];
300
- if (flags.check === true) {
314
+ if (flags.check === true && cargoMode) {
301
315
  process.exit(cargoFetches.every((fetch) => fetch.isCurrent()) ? 0 : 1);
302
316
  }
303
317
  const uvInputs = cargoMode ? [] : uvSyncInputs();
318
+ if (flags.check === true) {
319
+ const uv = uvInstaller(uvInputs, { locked: process.env.GITHUB_ACTIONS === 'true' });
320
+ process.exit(bunInstaller(bunInputs).isCurrent() && (uv === null || uv.isCurrent()) ? 0 : 1);
321
+ }
304
322
  // A CI runner is GitHub Actions or Forgejo Actions, which mirrors every FORGEJO_*
305
323
  // variable as GITHUB_*. Not `CI`: agent harnesses set CI=true on every command
306
324
  // they run, and this branch installs unconditionally.
@@ -410,6 +428,12 @@ try {
410
428
  }
411
429
  }
412
430
  } catch (error) {
431
+ // Thrown out of the refusal question, an error is the planner refusing the declared links.
432
+ if (flags.refusal === true) {
433
+ console.error(
434
+ "smoo:developer-links refuses this checkout's declared links; shell entry fails while the planner refuses them:",
435
+ );
436
+ }
413
437
  reportSetupFailure(error);
414
438
  }
415
439
 
@@ -1052,9 +1076,11 @@ function uvInstaller(inputs: readonly string[], options: { locked: boolean }): I
1052
1076
  return stampOk && witnessOk;
1053
1077
  },
1054
1078
  install: async ({ quiet }) => {
1055
- // An inherited VIRTUAL_ENV names some other environment; uv would warn
1056
- // that it does not match the project environment and ignore it.
1057
- const env = Object.fromEntries(Object.entries(process.env).filter(([name]) => name !== 'VIRTUAL_ENV'));
1079
+ // The managed installer is the only environment writer. An inherited VIRTUAL_ENV names another checkout;
1080
+ // UV_NO_SYNC belongs to reader commands, not to this deliberate sync.
1081
+ const env = Object.fromEntries(
1082
+ Object.entries(process.env).filter(([name]) => name !== 'VIRTUAL_ENV' && name !== 'UV_NO_SYNC'),
1083
+ );
1058
1084
  // Replacement is gated on the same witness currentness uses, not only on the config
1059
1085
  // line: a valid config beside an absolute launcher or .pth would otherwise sync over
1060
1086
  // the escape and stamp it. uv venv refuses a directory that already holds an
@@ -1427,14 +1453,15 @@ async function applyWorkspaceGitConfig(root: string): Promise<void> {
1427
1453
 
1428
1454
  const gitDir = path.resolve(root, new TextDecoder().decode(gitDirResult.stdout).trim());
1429
1455
  const tooling = path.join(root, 'tooling');
1430
- linkHook(gitDir, tooling, 'pre-commit');
1456
+ linkHook(gitDir, path.join(tooling, 'git-hooks', 'pre-commit.sh'));
1431
1457
  installPostCommitHook(gitDir, tooling);
1432
- linkHook(gitDir, tooling, 'commit-msg');
1433
- linkHook(gitDir, tooling, 'pre-push');
1458
+ linkHook(gitDir, path.join(tooling, 'git-hooks', 'commit-msg.sh'));
1459
+ linkHook(gitDir, path.join(tooling, 'git-hooks', 'pre-push.sh'));
1434
1460
  }
1435
1461
 
1436
- function linkHook(gitDir: string, tooling: string, name: string): void {
1437
- const source = path.join(tooling, 'git-hooks', `${name}.sh`);
1462
+ /** Links `.git/hooks/<name>` to the hook source `<name>.sh`. */
1463
+ function linkHook(gitDir: string, source: string): void {
1464
+ const name = path.basename(source, '.sh');
1438
1465
  if (!existsSync(source)) {
1439
1466
  throw new Error(`Missing ${name} hook source: ${source}`);
1440
1467
  }