@smoothbricks/nx-plugin 0.7.16 → 0.7.17
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 +6 -0
- package/dist/.build-inputs.json +5 -3
- package/dist/compile-environment.d.ts +8 -0
- package/dist/compile-environment.d.ts.map +1 -0
- package/dist/compile-environment.js +80 -0
- package/dist/dependency-manifests.d.ts +13 -0
- package/dist/dependency-manifests.d.ts.map +1 -0
- package/dist/dependency-manifests.js +20 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -8
- package/dist/managed-files/files.d.ts +3 -3
- package/dist/managed-files/files.js +3 -3
- package/dist/typecheck-route.d.ts +3 -4
- package/dist/typecheck-route.d.ts.map +1 -1
- package/dist/typecheck-route.js +4 -15
- package/managed/raw/patches/{ttsc@0.34.1.patch → ttsc@0.36.3.patch} +728 -71
- package/managed/raw/tooling/direnv/devenv.smoo.nix +1 -1
- package/package.json +4 -4
- package/src/compile-environment.ts +35 -0
- package/src/dependency-manifests.ts +30 -0
- package/src/index.ts +17 -8
- package/src/managed-files/files.ts +3 -3
- package/src/typecheck-route.ts +5 -14
|
@@ -1,4 +1,163 @@
|
|
|
1
|
-
diff --git a/
|
|
1
|
+
diff --git a/cmd/ttsc/api_transform.go b/cmd/ttsc/api_transform.go
|
|
2
|
+
index 4434cf69ea3b5128987c9216f871db13f827d7a4..681f59ebef551e99853737f28f1eff6f77f61262 100644
|
|
3
|
+
--- a/cmd/ttsc/api_transform.go
|
|
4
|
+
+++ b/cmd/ttsc/api_transform.go
|
|
5
|
+
@@ -55,6 +55,12 @@ type apiTransformResult struct {
|
|
6
|
+
// Null means absence; omitted keys leave symlink or junction identity unknown.
|
|
7
|
+
HostInputRealpaths map[string]*string `json:"hostInputRealpaths,omitempty"`
|
|
8
|
+
|
|
9
|
+
+ // EnvironmentInputs maps each environment variable a linked hook read
|
|
10
|
+
+ // through PluginContext.Env to the value it read; null means unset.
|
|
11
|
+
+ // Omitted when no hook read one. Names only identify inputs; values can be
|
|
12
|
+
+ // secrets and belong to the consumer's reuse check, not to logs.
|
|
13
|
+
+ EnvironmentInputs map[string]*string `json:"environmentInputs,omitempty"`
|
|
14
|
+
+
|
|
15
|
+
// ObservationsComplete is false only for an explicit unsupported observation
|
|
16
|
+
// boundary reported by a linked hook. Absence does not prove completeness.
|
|
17
|
+
ObservationsComplete *bool `json:"observationsComplete,omitempty"`
|
|
18
|
+
@@ -115,6 +121,7 @@ func writeTransformedProgramResponse(prog *driver.Program, diags []driver.Diagno
|
|
19
|
+
var hostInputs []string
|
|
20
|
+
var hostInputHashes map[string]*string
|
|
21
|
+
var hostInputRealpaths map[string]*string
|
|
22
|
+
+ var environmentInputs map[string]*string
|
|
23
|
+
var observationsComplete *bool
|
|
24
|
+
if prog == nil {
|
|
25
|
+
unavailable := false
|
|
26
|
+
@@ -134,6 +141,7 @@ func writeTransformedProgramResponse(prog *driver.Program, diags []driver.Diagno
|
|
27
|
+
hostInputs = prog.PluginHostInputs()
|
|
28
|
+
hostInputHashes = prog.PluginHostInputHashes()
|
|
29
|
+
hostInputRealpaths = prog.PluginHostInputRealpaths()
|
|
30
|
+
+ environmentInputs = prog.PluginEnvironmentInputs()
|
|
31
|
+
if prog.PluginObservationsIncomplete() {
|
|
32
|
+
incomplete := false
|
|
33
|
+
observationsComplete = &incomplete
|
|
34
|
+
@@ -148,6 +156,7 @@ func writeTransformedProgramResponse(prog *driver.Program, diags []driver.Diagno
|
|
35
|
+
HostInputs: hostInputs,
|
|
36
|
+
HostInputHashes: hostInputHashes,
|
|
37
|
+
HostInputRealpaths: hostInputRealpaths,
|
|
38
|
+
+ EnvironmentInputs: environmentInputs,
|
|
39
|
+
ObservationsComplete: observationsComplete,
|
|
40
|
+
TypeScript: typescript,
|
|
41
|
+
}
|
|
42
|
+
diff --git a/cmd/ttsc/build.go b/cmd/ttsc/build.go
|
|
43
|
+
index 3140699bdd3f26f8513f95d8750ed632a99fc425..f7b39f13238a59cefa2716d61ee978a73c369bbf 100644
|
|
44
|
+
--- a/cmd/ttsc/build.go
|
|
45
|
+
+++ b/cmd/ttsc/build.go
|
|
46
|
+
@@ -137,6 +137,7 @@ func writeBuildProgramResponse(prog *driver.Program, diags []driver.Diagnostic,
|
|
47
|
+
}
|
|
48
|
+
fmt.Fprintln(stdout, " +", rel)
|
|
49
|
+
}
|
|
50
|
+
+ driver.WriteEnvironmentInputsSummary(stdout, "// ttsc: ", prog)
|
|
51
|
+
}
|
|
52
|
+
if request.manifestPath != "" {
|
|
53
|
+
// The manifest is intentionally just the emitted file list. Higher
|
|
54
|
+
diff --git a/driver/check_observations.go b/driver/check_observations.go
|
|
55
|
+
index ef50afa6c3f02f80951c4ebd367c670a842aa0db..8e48e460fcff160c3e7e8f77abc211ff060e766f 100644
|
|
56
|
+
--- a/driver/check_observations.go
|
|
57
|
+
+++ b/driver/check_observations.go
|
|
58
|
+
@@ -19,6 +19,8 @@ import (
|
|
59
|
+
// the population complete or repair missing or conflicting individual proofs.
|
|
60
|
+
// The caller owns a fresh result path, its parent directory and eventual artifact
|
|
61
|
+
// removal. Publication occurs only after a temporary write and close succeed.
|
|
62
|
+
+// Environment variables the hooks read through PluginContext.Env travel in
|
|
63
|
+
+// environmentInputs with their recorded values, omitted when none was read.
|
|
64
|
+
//
|
|
65
|
+
// @evidence contracts/common.md#principled-implementation The same loaded Program supplies recorded input names and consistent supplied content and physical-path reports; missing generation authority is explicitly incomplete, while diagnostics and individual conflicts retain their independent meanings.
|
|
66
|
+
// @evidence contracts/common.md#clear-and-simple-design One typed wire object keeps hook observations separate from human diagnostic streams and never reloads a second compiler generation to reconstruct them.
|
|
67
|
+
@@ -52,6 +54,7 @@ func WriteCheckRecoveryObservationsJSON(fileName string, program *Program, recov
|
|
68
|
+
inputs := []string{}
|
|
69
|
+
hashes := map[string]*string{}
|
|
70
|
+
realpaths := map[string]*string{}
|
|
71
|
+
+ var environment map[string]*string
|
|
72
|
+
var complete *bool
|
|
73
|
+
var graph *TransformGraph
|
|
74
|
+
if program == nil {
|
|
75
|
+
@@ -74,14 +77,16 @@ func WriteCheckRecoveryObservationsJSON(fileName string, program *Program, recov
|
|
76
|
+
if recorded := program.PluginHostInputRealpaths(); recorded != nil {
|
|
77
|
+
realpaths = recorded
|
|
78
|
+
}
|
|
79
|
+
+ environment = program.PluginEnvironmentInputs()
|
|
80
|
+
}
|
|
81
|
+
data, err := json.Marshal(struct {
|
|
82
|
+
Graph *TransformGraph `json:"graph,omitempty"`
|
|
83
|
+
HostInputs []string `json:"hostInputs"`
|
|
84
|
+
HostInputHashes map[string]*string `json:"hostInputHashes"`
|
|
85
|
+
HostInputRealpaths map[string]*string `json:"hostInputRealpaths"`
|
|
86
|
+
+ EnvironmentInputs map[string]*string `json:"environmentInputs,omitempty"`
|
|
87
|
+
ObservationsComplete *bool `json:"observationsComplete,omitempty"`
|
|
88
|
+
- }{graph, inputs, hashes, realpaths, complete})
|
|
89
|
+
+ }{graph, inputs, hashes, realpaths, environment, complete})
|
|
90
|
+
if err != nil {
|
|
91
|
+
return err
|
|
92
|
+
}
|
|
93
|
+
diff --git a/driver/emit_plugin.go b/driver/emit_plugin.go
|
|
94
|
+
index 3793b3a406c2bf2643567a755d34e66a26eac5c8..3c690ac3d9a99be7914ad9aed76e5890d236ea9b 100644
|
|
95
|
+
--- a/driver/emit_plugin.go
|
|
96
|
+
+++ b/driver/emit_plugin.go
|
|
97
|
+
@@ -427,7 +427,13 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
98
|
+
return diagnostics, err
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
- return diagnostics, output.flush()
|
|
102
|
+
+ if err := output.flush(); err != nil {
|
|
103
|
+
+ return diagnostics, err
|
|
104
|
+
+ }
|
|
105
|
+
+ // Files linked plugins reported writing beside these outputs follow them
|
|
106
|
+
+ // through the host's writer, so the host lists them too (ReportHostOutput).
|
|
107
|
+
+ _, err = p.writeHostOutputs(writeFile)
|
|
108
|
+
+ return diagnostics, err
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// writePluginEmitOutput writes one artifact of the hand-assembled emit, passing
|
|
112
|
+
diff --git a/driver/environment_inputs.go b/driver/environment_inputs.go
|
|
113
|
+
new file mode 100644
|
|
114
|
+
index 0000000000000000000000000000000000000000..4dcac95a1ea40978bba81e3e2ab9c5775b3c5b64
|
|
115
|
+
--- /dev/null
|
|
116
|
+
+++ b/driver/environment_inputs.go
|
|
117
|
+
@@ -0,0 +1,42 @@
|
|
118
|
+
+package driver
|
|
119
|
+
+
|
|
120
|
+
+import (
|
|
121
|
+
+ "encoding/json"
|
|
122
|
+
+ "fmt"
|
|
123
|
+
+ "io"
|
|
124
|
+
+ "sort"
|
|
125
|
+
+)
|
|
126
|
+
+
|
|
127
|
+
+// WriteEnvironmentInputsSummary writes the build summary line naming the
|
|
128
|
+
+// environment variables the Program's linked hooks read through
|
|
129
|
+
+// PluginContext.Env, as `<prefix>environment inputs=<sorted JSON array>`. It
|
|
130
|
+
+// writes nothing when no hook read one, so builds of plugins that read no
|
|
131
|
+
+// environment print the same summary as before. Only names are printed:
|
|
132
|
+
+// values can be secrets, and the envelope carries them to the consumers that
|
|
133
|
+
+// compare them. Like the summary lines around it, the write is best-effort.
|
|
134
|
+
+//
|
|
135
|
+
+// @evidence contracts/common.md#principled-implementation The names come from the same generation ledger the envelopes publish, sorted so the line is deterministic.
|
|
136
|
+
+// @evidence contracts/common.md#clear-and-simple-design One writer owns the line's format for every build lane; each lane supplies its own summary prefix.
|
|
137
|
+
+// @evidence contracts/common.md#prohibited-implementation-shortcuts Values never reach the output stream, and an empty ledger prints nothing rather than an empty list.
|
|
138
|
+
+// @evidence contracts/common.md#meaningful-documentation Native prose states the line format, the empty case, why values are withheld and the best-effort write following the documentation skill.
|
|
139
|
+
+// @evidenceExclude contracts/portability.md#os-neutral-implementation The writer formats recorded names and performs no native path or process operation.
|
|
140
|
+
+// @evidence contracts/performance.md#efficient-algorithms One ledger copy, an O(n log n) sort of the distinct names and one JSON encoding.
|
|
141
|
+
+// @evidenceExclude contracts/performance.md#reuse-equivalent-work Formatting a summary coordinates no shared computation.
|
|
142
|
+
+// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The name list and encoding are call-local; the caller owns the writer.
|
|
143
|
+
+func WriteEnvironmentInputsSummary(w io.Writer, prefix string, p *Program) {
|
|
144
|
+
+ inputs := p.PluginEnvironmentInputs()
|
|
145
|
+
+ if len(inputs) == 0 {
|
|
146
|
+
+ return
|
|
147
|
+
+ }
|
|
148
|
+
+ names := make([]string, 0, len(inputs))
|
|
149
|
+
+ for name := range inputs {
|
|
150
|
+
+ names = append(names, name)
|
|
151
|
+
+ }
|
|
152
|
+
+ sort.Strings(names)
|
|
153
|
+
+ encoded, err := json.Marshal(names)
|
|
154
|
+
+ if err != nil {
|
|
155
|
+
+ // encoding/json cannot fail on a []string.
|
|
156
|
+
+ panic(err)
|
|
157
|
+
+ }
|
|
158
|
+
+ fmt.Fprintf(w, "%senvironment inputs=%s\n", prefix, encoded)
|
|
159
|
+
+}
|
|
160
|
+
diff --git a/driver/force_emit_analysis_options_test.go b/driver/force_emit_analysis_options_test.go
|
|
2
161
|
new file mode 100644
|
|
3
162
|
index 0000000000000000000000000000000000000000..97d1522f7979b488dc62b86cc1d78d72f1913cb5
|
|
4
163
|
--- /dev/null
|
|
@@ -73,27 +232,8 @@ index 0000000000000000000000000000000000000000..97d1522f7979b488dc62b86cc1d78d72
|
|
|
73
232
|
+ t.Fatalf("forced emit did not rewrite the runtime import: %s", output["index.js"])
|
|
74
233
|
+ }
|
|
75
234
|
+}
|
|
76
|
-
diff --git a/driver/emit_plugin.go b/driver/emit_plugin.go
|
|
77
|
-
index 3793b3a406c2bf2643567a755d34e66a26eac5c8..3c690ac3d9a99be7914ad9aed76e5890d236ea9b 100644
|
|
78
|
-
--- a/driver/emit_plugin.go
|
|
79
|
-
+++ b/driver/emit_plugin.go
|
|
80
|
-
@@ -427,7 +427,13 @@ func (p *Program) EmitWithPluginTransformers(transforms []PluginTransform, write
|
|
81
|
-
return diagnostics, err
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
- return diagnostics, output.flush()
|
|
85
|
-
+ if err := output.flush(); err != nil {
|
|
86
|
-
+ return diagnostics, err
|
|
87
|
-
+ }
|
|
88
|
-
+ // Files linked plugins reported writing beside these outputs follow them
|
|
89
|
-
+ // through the host's writer, so the host lists them too (ReportHostOutput).
|
|
90
|
-
+ _, err = p.writeHostOutputs(writeFile)
|
|
91
|
-
+ return diagnostics, err
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// writePluginEmitOutput writes one artifact of the hand-assembled emit, passing
|
|
95
235
|
diff --git a/driver/plugins.go b/driver/plugins.go
|
|
96
|
-
index 1778e250d80d1316e108f1f36b6e1a38724922d5..
|
|
236
|
+
index 1778e250d80d1316e108f1f36b6e1a38724922d5..f5997531e4142526bd8764c6db15aa393fb9781a 100644
|
|
97
237
|
--- a/driver/plugins.go
|
|
98
238
|
+++ b/driver/plugins.go
|
|
99
239
|
@@ -8,6 +8,8 @@ import (
|
|
@@ -105,15 +245,16 @@ index 1778e250d80d1316e108f1f36b6e1a38724922d5..2964783d058000080d987044e1fe1db5
|
|
|
105
245
|
)
|
|
106
246
|
|
|
107
247
|
// LinkedPluginsEnv is the environment variable ttsc sets to pass the JSON
|
|
108
|
-
@@ -169,6 +171,
|
|
248
|
+
@@ -169,6 +171,8 @@ type PluginContext struct {
|
|
109
249
|
reportFileDependencyRejected func(string)
|
|
110
250
|
reportFileComplete func(string)
|
|
111
251
|
reportEveryFileComplete func()
|
|
252
|
+
+ readEnvironment func(string) (string, bool)
|
|
112
253
|
+ reportHostOutput func(string)
|
|
113
254
|
}
|
|
114
255
|
|
|
115
256
|
// ReportObservationIncomplete declares that this hook's input population could
|
|
116
|
-
@@ -195,6 +
|
|
257
|
+
@@ -195,6 +199,60 @@ func (ctx PluginContext) ReportObservationIncomplete() {
|
|
117
258
|
}
|
|
118
259
|
}
|
|
119
260
|
|
|
@@ -134,11 +275,47 @@ index 1778e250d80d1316e108f1f36b6e1a38724922d5..2964783d058000080d987044e1fe1db5
|
|
|
134
275
|
+ }
|
|
135
276
|
+ ctx.reportHostOutput(filepath.Clean(file))
|
|
136
277
|
+}
|
|
278
|
+
+
|
|
279
|
+
+// Env returns the value of the environment variable name, like os.LookupEnv,
|
|
280
|
+
+// and records the read as an input of this compiler generation. A plugin whose
|
|
281
|
+
+// output depends on a variable reads it here instead of calling os.Getenv, so
|
|
282
|
+
+// the envelope's environmentInputs names it and persistent hosts withdraw
|
|
283
|
+
+// output compiled under another value. The first read of a name fixes its
|
|
284
|
+
+// value for the whole generation: a later read returns the recorded value even
|
|
285
|
+
+// if the process environment changed in between, so the output never depends
|
|
286
|
+
+// on a value the record does not carry. ok is false for an unset variable, and
|
|
287
|
+
+// that absence is recorded too.
|
|
288
|
+
+//
|
|
289
|
+
+// A name that cannot name a variable (empty, or containing '=' or NUL) reads
|
|
290
|
+
+// as unset and is not recorded. A context without a driver callback reads the
|
|
291
|
+
+// process environment without recording it.
|
|
292
|
+
+//
|
|
293
|
+
+// The precedents are Rust's proc_macro::tracked_env::var, Cargo's
|
|
294
|
+
+// rerun-if-env-changed, and Racket's register-external-file: the read site
|
|
295
|
+
+// itself declares the dependency, so no tool keeps a list of variables.
|
|
296
|
+
+//
|
|
297
|
+
+// @evidence contracts/common.md#principled-implementation The read site records the exact name and value or absence it returned, and the generation ledger returns the first recorded value for every later read, so output and record cannot disagree.
|
|
298
|
+
+// @evidence contracts/common.md#clear-and-simple-design One callback delegates to the generation ledger; name validation precedes it and the uncallbacked context falls back to os.LookupEnv.
|
|
299
|
+
+// @evidence contracts/common.md#prohibited-implementation-shortcuts No static variable list, prefix rule or intercepted os.Getenv replaces the explicit read; values are not hashed or redacted, so equality checks compare what the plugin saw.
|
|
300
|
+
+// @evidence contracts/common.md#meaningful-documentation Native paragraphs state the lookup semantics, first-read fixing, absence recording, invalid names and the precedents following the documentation skill.
|
|
301
|
+
+// @evidence contracts/portability.md#os-neutral-implementation os.LookupEnv supplies the platform's own name matching, including Windows case-insensitivity; the recorded name keeps the caller's spelling and consumers compare it under their platform's environment rule.
|
|
302
|
+
+// @evidence contracts/performance.md#bound-retention-and-release-resources The ledger retains one name and value copy per distinct name read for the generation's lifetime; repeated reads add nothing. No handle is acquired and no cap is imposed.
|
|
303
|
+
+// @evidence contracts/performance.md#efficient-algorithms Name validation scans the name once; the ledger takes one lock and one map lookup, plus one os.LookupEnv on the first read of a name.
|
|
304
|
+
+// @evidenceExclude contracts/performance.md#reuse-equivalent-work Recording an input coordinates no completed or in-flight computation; consumers decide reuse from the record.
|
|
305
|
+
+func (ctx PluginContext) Env(name string) (string, bool) {
|
|
306
|
+
+ if name == "" || strings.ContainsAny(name, "=\x00") {
|
|
307
|
+
+ return "", false
|
|
308
|
+
+ }
|
|
309
|
+
+ if ctx.readEnvironment == nil {
|
|
310
|
+
+ return os.LookupEnv(name)
|
|
311
|
+
+ }
|
|
312
|
+
+ return ctx.readEnvironment(name)
|
|
313
|
+
+}
|
|
137
314
|
+
|
|
138
315
|
// ReportHostInputHash declares the exact file state consumed by a native
|
|
139
316
|
// plugin. hash is a lowercase SHA-256 digest for an observed file and nil for
|
|
140
317
|
// a missing candidate. Conflicting observations are retained as host inputs
|
|
141
|
-
@@ -506,11 +
|
|
318
|
+
@@ -506,11 +564,29 @@ type EmitTransformPlugin interface {
|
|
142
319
|
EmitTransform(PluginContext) (PluginTransform, error)
|
|
143
320
|
}
|
|
144
321
|
|
|
@@ -168,7 +345,67 @@ index 1778e250d80d1316e108f1f36b6e1a38724922d5..2964783d058000080d987044e1fe1db5
|
|
|
168
345
|
tsconfig string
|
|
169
346
|
}
|
|
170
347
|
|
|
171
|
-
@@ -
|
|
348
|
+
@@ -518,9 +594,57 @@ type linkedPluginState struct {
|
|
349
|
+
// one hook cannot prove another hook's same-file dependency when that hook only
|
|
350
|
+
// reported the path, while ReportHostInput followed by ReportHostInputHash in
|
|
351
|
+
// one hook remains one complete observation.
|
|
352
|
+
+//
|
|
353
|
+
+// Environment reads are kept once per generation instead: a value is a
|
|
354
|
+
+// complete observation by itself, and every hook must see the value the
|
|
355
|
+
+// generation records, so the first read of a name fixes it for all of them.
|
|
356
|
+
type pluginHostInputScopes struct {
|
|
357
|
+
- mu sync.Mutex
|
|
358
|
+
- scopes []*pluginHostInputs
|
|
359
|
+
+ mu sync.Mutex
|
|
360
|
+
+ scopes []*pluginHostInputs
|
|
361
|
+
+ environment map[string]*string
|
|
362
|
+
+}
|
|
363
|
+
+
|
|
364
|
+
+// readEnvironment returns the generation's recorded value of name, reading and
|
|
365
|
+
+// recording the process environment on the first read. A nil ledger records
|
|
366
|
+
+// nothing.
|
|
367
|
+
+func (inputs *pluginHostInputScopes) readEnvironment(name string) (string, bool) {
|
|
368
|
+
+ if inputs == nil {
|
|
369
|
+
+ return os.LookupEnv(name)
|
|
370
|
+
+ }
|
|
371
|
+
+ inputs.mu.Lock()
|
|
372
|
+
+ defer inputs.mu.Unlock()
|
|
373
|
+
+ recorded, exists := inputs.environment[name]
|
|
374
|
+
+ if !exists {
|
|
375
|
+
+ if value, ok := os.LookupEnv(name); ok {
|
|
376
|
+
+ recorded = &value
|
|
377
|
+
+ }
|
|
378
|
+
+ if inputs.environment == nil {
|
|
379
|
+
+ inputs.environment = map[string]*string{}
|
|
380
|
+
+ }
|
|
381
|
+
+ inputs.environment[name] = recorded
|
|
382
|
+
+ }
|
|
383
|
+
+ if recorded == nil {
|
|
384
|
+
+ return "", false
|
|
385
|
+
+ }
|
|
386
|
+
+ return *recorded, true
|
|
387
|
+
+}
|
|
388
|
+
+
|
|
389
|
+
+// environmentList copies the recorded environment reads, or returns nil when
|
|
390
|
+
+// no hook read one.
|
|
391
|
+
+func (inputs *pluginHostInputScopes) environmentList() map[string]*string {
|
|
392
|
+
+ if inputs == nil {
|
|
393
|
+
+ return nil
|
|
394
|
+
+ }
|
|
395
|
+
+ inputs.mu.Lock()
|
|
396
|
+
+ defer inputs.mu.Unlock()
|
|
397
|
+
+ if len(inputs.environment) == 0 {
|
|
398
|
+
+ return nil
|
|
399
|
+
+ }
|
|
400
|
+
+ environment := make(map[string]*string, len(inputs.environment))
|
|
401
|
+
+ for name, value := range inputs.environment {
|
|
402
|
+
+ environment[name] = cloneStringPointer(value)
|
|
403
|
+
+ }
|
|
404
|
+
+ return environment
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
type pluginHostInputs struct {
|
|
408
|
+
@@ -800,6 +924,7 @@ func loadLinkedPluginState(cwd, tsconfigPath string) (linkedPluginState, error)
|
|
172
409
|
cwd: cwd,
|
|
173
410
|
declarations: newPluginFileDeclarations(),
|
|
174
411
|
inputs: newPluginHostInputScopes(),
|
|
@@ -176,7 +413,7 @@ index 1778e250d80d1316e108f1f36b6e1a38724922d5..2964783d058000080d987044e1fe1db5
|
|
|
176
413
|
tsconfig: tsconfigPath,
|
|
177
414
|
}, nil
|
|
178
415
|
}
|
|
179
|
-
@@ -812,6 +
|
|
416
|
+
@@ -812,6 +937,7 @@ func loadLinkedPluginState(cwd, tsconfigPath string) (linkedPluginState, error)
|
|
180
417
|
declarations: newPluginFileDeclarations(),
|
|
181
418
|
entries: entries,
|
|
182
419
|
inputs: newPluginHostInputScopes(),
|
|
@@ -184,7 +421,7 @@ index 1778e250d80d1316e108f1f36b6e1a38724922d5..2964783d058000080d987044e1fe1db5
|
|
|
184
421
|
tsconfig: tsconfigPath,
|
|
185
422
|
}, nil
|
|
186
423
|
}
|
|
187
|
-
@@ -896,6 +
|
|
424
|
+
@@ -896,6 +1022,42 @@ func (state linkedPluginState) emitTransforms() ([]PluginTransform, error) {
|
|
188
425
|
return out, nil
|
|
189
426
|
}
|
|
190
427
|
|
|
@@ -227,10 +464,21 @@ index 1778e250d80d1316e108f1f36b6e1a38724922d5..2964783d058000080d987044e1fe1db5
|
|
|
227
464
|
// registeredPlugin returns the plugin registered at position index, or
|
|
228
465
|
// (nil, false) when the index is out of range. Registration order matches
|
|
229
466
|
// the order of linked Go init() calls.
|
|
230
|
-
@@ -
|
|
467
|
+
@@ -913,7 +1075,8 @@ func registeredPlugin(index int) (any, bool) {
|
|
468
|
+
// declarations are scoped per plugin instead: completeness is a claim about
|
|
469
|
+
// everything one plugin contributes to a file, so the claims of its preamble
|
|
470
|
+
// and program hooks are the same plugin's claim and must not be attributed
|
|
471
|
+
-// separately.
|
|
472
|
+
+// separately. Environment reads go to the generation ledger, which fixes one
|
|
473
|
+
+// value per name for every hook.
|
|
474
|
+
func (state linkedPluginState) contextAt(index int, entry PluginEntry) PluginContext {
|
|
475
|
+
inputs := state.inputs.newScope()
|
|
476
|
+
declaration := state.declarations.forPlugin(index)
|
|
477
|
+
@@ -931,7 +1094,44 @@ func (state linkedPluginState) contextAt(index int, entry PluginEntry) PluginCon
|
|
231
478
|
reportFileDependencyRejected: declaration.rejectDependency,
|
|
232
479
|
reportFileComplete: declaration.addComplete,
|
|
233
480
|
reportEveryFileComplete: declaration.completeEveryFile,
|
|
481
|
+
+ readEnvironment: state.inputs.readEnvironment,
|
|
234
482
|
+ reportHostOutput: state.outputs.add,
|
|
235
483
|
+ }
|
|
236
484
|
+}
|
|
@@ -256,7 +504,7 @@ index 1778e250d80d1316e108f1f36b6e1a38724922d5..2964783d058000080d987044e1fe1db5
|
|
|
256
504
|
+ defer outputs.mu.Unlock()
|
|
257
505
|
+ if _, ok := outputs.seen[file]; ok {
|
|
258
506
|
+ return
|
|
259
|
-
|
|
507
|
+
}
|
|
260
508
|
+ outputs.seen[file] = struct{}{}
|
|
261
509
|
+ outputs.files = append(outputs.files, file)
|
|
262
510
|
+}
|
|
@@ -264,18 +512,26 @@ index 1778e250d80d1316e108f1f36b6e1a38724922d5..2964783d058000080d987044e1fe1db5
|
|
|
264
512
|
+func (outputs *pluginHostOutputs) list() []string {
|
|
265
513
|
+ if outputs == nil {
|
|
266
514
|
+ return nil
|
|
267
|
-
|
|
515
|
+
+ }
|
|
268
516
|
+ outputs.mu.Lock()
|
|
269
517
|
+ defer outputs.mu.Unlock()
|
|
270
518
|
+ return append([]string(nil), outputs.files...)
|
|
271
519
|
}
|
|
272
520
|
|
|
273
521
|
// hostInputs returns the exact native configuration inputs reported in this
|
|
522
|
+
@@ -947,3 +1147,7 @@ func (state linkedPluginState) hostInputHashes() map[string]*string {
|
|
523
|
+
func (state linkedPluginState) hostInputRealpaths() map[string]*string {
|
|
524
|
+
return state.inputs.realpathList()
|
|
525
|
+
}
|
|
526
|
+
+
|
|
527
|
+
+func (state linkedPluginState) environmentInputs() map[string]*string {
|
|
528
|
+
+ return state.inputs.environmentList()
|
|
529
|
+
+}
|
|
274
530
|
diff --git a/driver/program.go b/driver/program.go
|
|
275
|
-
index
|
|
531
|
+
index 3a061b06bb7d1fa8ff5a8f7454634c158a6848a4..c5330185a700ac39c5ec87d7630d6cf4eb7ac953 100644
|
|
276
532
|
--- a/driver/program.go
|
|
277
533
|
+++ b/driver/program.go
|
|
278
|
-
@@ -
|
|
534
|
+
@@ -792,6 +792,12 @@ func forceEmit(parsed *tsoptions.ParsedCommandLine) {
|
|
279
535
|
options := parsed.ParsedConfig.CompilerOptions
|
|
280
536
|
options.NoEmit = core.TSFalse
|
|
281
537
|
options.EmitDeclarationOnly = core.TSFalse
|
|
@@ -288,7 +544,36 @@ index f6ee81fb1af41deea022b92e838a7c4665eb9778..6dc6b4d77b7cde5051782478cdc527a1
|
|
|
288
544
|
}
|
|
289
545
|
|
|
290
546
|
// forceNoEmit sets noEmit so the program type-checks without writing files.
|
|
291
|
-
@@ -
|
|
547
|
+
@@ -1069,6 +1075,28 @@ func (p *Program) PluginHostInputRealpaths() map[string]*string {
|
|
548
|
+
return p.plugins.hostInputRealpaths()
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
+// PluginEnvironmentInputs returns every environment variable a linked hook
|
|
552
|
+
+// read through PluginContext.Env while this Program was loaded or transformed,
|
|
553
|
+
+// keyed by the name the hook passed, with the value the generation recorded
|
|
554
|
+
+// for it. A nil value records that the variable was unset. The result is nil
|
|
555
|
+
+// when no hook read one, so a plugin that reads no environment leaves every
|
|
556
|
+
+// envelope unchanged. It does not run a pending ProgramPlugin hook.
|
|
557
|
+
+//
|
|
558
|
+
+// @evidence contracts/common.md#principled-implementation The ledger keeps the first value each name returned, so the reported value is the one every hook's output was computed from.
|
|
559
|
+
+// @evidence contracts/common.md#clear-and-simple-design One generation ledger owns the reads; this accessor copies it beside the host-input accessors.
|
|
560
|
+
+// @evidence contracts/common.md#prohibited-implementation-shortcuts Nothing is read from the process environment here; an unrecorded variable is never added after the fact.
|
|
561
|
+
+// @evidence contracts/common.md#meaningful-documentation Native prose defines keys, values, nil absence, the empty result and hook timing following the documentation skill.
|
|
562
|
+
+// @evidenceExclude contracts/portability.md#os-neutral-implementation Recorded names and values are returned without native environment access or name normalization.
|
|
563
|
+
+// @evidence contracts/performance.md#efficient-algorithms One lock and one copy of the recorded names and values; cost is linear in distinct names read.
|
|
564
|
+
+// @evidenceExclude contracts/performance.md#reuse-equivalent-work This accessor exposes recorded inputs without deciding reuse.
|
|
565
|
+
+// @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The returned copy is caller-owned and no additional state is retained.
|
|
566
|
+
+func (p *Program) PluginEnvironmentInputs() map[string]*string {
|
|
567
|
+
+ if p == nil {
|
|
568
|
+
+ return nil
|
|
569
|
+
+ }
|
|
570
|
+
+ return p.plugins.environmentInputs()
|
|
571
|
+
+}
|
|
572
|
+
+
|
|
573
|
+
// PluginObservationsIncomplete reports whether any linked hook explicitly
|
|
574
|
+
// declared that its supported public API could not observe the input population
|
|
575
|
+
// for this generation. False means no such declaration, not completeness proof.
|
|
576
|
+
@@ -1181,6 +1209,10 @@ func (p *Program) diagnostics(files []*ast.SourceFile) []Diagnostic {
|
|
292
577
|
}
|
|
293
578
|
}
|
|
294
579
|
raw = filterDiagnostics(raw)
|
|
@@ -404,10 +689,348 @@ index 79be74d24e879da216ad680d23ecfeb5f11a29db..6db9dddba05bd50e13ed92535ca442c3
|
|
|
404
689
|
}
|
|
405
690
|
|
|
406
691
|
func defaultWriteFile(fileName, text string) error {
|
|
692
|
+
diff --git a/lib/compiler/internal/build/RuntimeBuildInputs.js b/lib/compiler/internal/build/RuntimeBuildInputs.js
|
|
693
|
+
index 855c4b3fbcda8e55dac89e568405766864bf7139..858c6df808b105098372a8d46eea02ecdf8fa581 100644
|
|
694
|
+
--- a/lib/compiler/internal/build/RuntimeBuildInputs.js
|
|
695
|
+
+++ b/lib/compiler/internal/build/RuntimeBuildInputs.js
|
|
696
|
+
@@ -375,7 +375,9 @@ var RuntimeBuildInputs;
|
|
697
|
+
});
|
|
698
|
+
return false;
|
|
699
|
+
}
|
|
700
|
+
- const accepted = RuntimeInputProof_1.RuntimeInputProof.holds(result, execution.projectRoot, emitDir);
|
|
701
|
+
+ // The plugins of this build would run under env, so a recorded
|
|
702
|
+
+ // environment read must still hold there.
|
|
703
|
+
+ const accepted = RuntimeInputProof_1.RuntimeInputProof.holds(result, execution.projectRoot, emitDir, env);
|
|
704
|
+
if (!accepted)
|
|
705
|
+
RuntimeBuildExplanation_1.RuntimeBuildExplanation.report({
|
|
706
|
+
outcome: "rejected",
|
|
707
|
+
diff --git a/lib/compiler/internal/build/RuntimeInputProof.js b/lib/compiler/internal/build/RuntimeInputProof.js
|
|
708
|
+
index b64e043c810ad0834e98a441d012208a06d8aa81..35d3fef74ad87ad06e9677e5d46ea9364f59da58 100644
|
|
709
|
+
--- a/lib/compiler/internal/build/RuntimeInputProof.js
|
|
710
|
+
+++ b/lib/compiler/internal/build/RuntimeInputProof.js
|
|
711
|
+
@@ -7,6 +7,7 @@ exports.RuntimeInputProof = void 0;
|
|
712
|
+
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
713
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
714
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
715
|
+
+const SidecarEnvironment_1 = require("../sharedHost/SidecarEnvironment");
|
|
716
|
+
/**
|
|
717
|
+
* Replay the compiler and native input witnesses of a completed runtime build.
|
|
718
|
+
* Read predicates keep their original text or raw-byte codec; absence, entry
|
|
719
|
+
@@ -27,21 +28,26 @@ var RuntimeInputProof;
|
|
720
|
+
/**
|
|
721
|
+
* Validate result-level host witnesses and every reported compiler predicate.
|
|
722
|
+
* The caller independently proves the selected compiler, project membership
|
|
723
|
+
- * and plugin selection; an absent graph alone grants no completeness.
|
|
724
|
+
+ * and plugin selection; an absent graph alone grants no completeness. Every
|
|
725
|
+
+ * recorded environment read must still have its value, or remain unset, in
|
|
726
|
+
+ * `environment`, the environment the build would spawn its plugins under.
|
|
727
|
+
*
|
|
728
|
+
- * @evidence contracts/common.md#principled-implementation Explicit incomplete observations and any graph failure reject reuse; host paths require both content and physical witnesses, and rich compiler predicates are replayed under their own codec.
|
|
729
|
+
+ * @evidence contracts/common.md#principled-implementation Explicit incomplete observations and any graph failure reject reuse; host paths require both content and physical witnesses, recorded environment reads require their exact value or absence, and rich compiler predicates are replayed under their own codec.
|
|
730
|
+
* @evidence contracts/common.md#clear-and-simple-design One admission pass delegates individual compiler observations and native codecs.
|
|
731
|
+
- * @evidence contracts/common.md#prohibited-implementation-shortcuts Missing witness fields never become an empty successful observation, and only the caller-owned private output subtree is excluded.
|
|
732
|
+
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts Missing witness fields never become an empty successful observation, a changed environment value is a changed input, and only the caller-owned private output subtree is excluded.
|
|
733
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies result admission and the caller's separate completeness obligations.
|
|
734
|
+
- * @evidence contracts/portability.md#os-neutral-implementation Native path resolution anchors producer-relative graph keys, and current physical paths come from native realpath.
|
|
735
|
+
+ * @evidence contracts/portability.md#os-neutral-implementation Native path resolution anchors producer-relative graph keys, current physical paths come from native realpath, and SidecarEnvironment.read applies Windows' case-insensitive variable names.
|
|
736
|
+
* @evidence contracts/performance.md#efficient-algorithms Input and predicate populations drive replay; each read hashes its actual bytes and directories sort immediate entry records.
|
|
737
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Generation witnesses, rather than an identity-key match, decide whether a completed build remains reusable.
|
|
738
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Temporary path and predicate records are invocation-owned without retained handles or history.
|
|
739
|
+
*/
|
|
740
|
+
- function holds(result, projectRoot, emitDir) {
|
|
741
|
+
+ function holds(result, projectRoot, emitDir, environment) {
|
|
742
|
+
if (result.observationsComplete === false ||
|
|
743
|
+
Object.keys(result.graph?.inputProofFailures ?? {}).length !== 0)
|
|
744
|
+
return false;
|
|
745
|
+
+ for (const [name, recorded] of Object.entries(result.environmentInputs ?? {}))
|
|
746
|
+
+ if ((SidecarEnvironment_1.SidecarEnvironment.read(environment, name) ?? null) !== recorded)
|
|
747
|
+
+ return false;
|
|
748
|
+
try {
|
|
749
|
+
for (const file of result.hostInputs ?? []) {
|
|
750
|
+
const [currentPhysical, hash] = observeHostInput(file);
|
|
751
|
+
diff --git a/lib/compiler/internal/build/appendBuildOutput.js b/lib/compiler/internal/build/appendBuildOutput.js
|
|
752
|
+
index 17a19b74c4e7ba08c6cc77c31bcfff596ec9e30f..a9212bf6fc0d344d2ce068363faaa645eb74a76c 100644
|
|
753
|
+
--- a/lib/compiler/internal/build/appendBuildOutput.js
|
|
754
|
+
+++ b/lib/compiler/internal/build/appendBuildOutput.js
|
|
755
|
+
@@ -2,6 +2,7 @@
|
|
756
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
757
|
+
exports.appendBuildOutput = appendBuildOutput;
|
|
758
|
+
exports.mergeCheckGraphs = mergeCheckGraphs;
|
|
759
|
+
+const mergeEnvironmentInputs_1 = require("./mergeEnvironmentInputs");
|
|
760
|
+
const normalizeBuildOutput_1 = require("./normalizeBuildOutput");
|
|
761
|
+
/**
|
|
762
|
+
* Merge two `TtscBuildResult` values into one.
|
|
763
|
+
@@ -15,6 +16,8 @@ const normalizeBuildOutput_1 = require("./normalizeBuildOutput");
|
|
764
|
+
* - Check inputs are unioned; independently compatible content and physical
|
|
765
|
+
* witnesses survive. A lost witness cannot be restored by a later phase.
|
|
766
|
+
* Explicit observation incompleteness is sticky.
|
|
767
|
+
+ * - `environmentInputs`: unioned; two phases that recorded different values for
|
|
768
|
+
+ * one name withdraw reuse through `observationsComplete: false`.
|
|
769
|
+
*
|
|
770
|
+
* The shared normalizer moves combined stdout to stderr when the merged result
|
|
771
|
+
* failed and stderr is blank, preserving visibility for stderr-only consumers.
|
|
772
|
+
@@ -47,6 +50,7 @@ function appendBuildOutput(left, right) {
|
|
773
|
+
hostInputHashes: mergeInputWitnesses(left, right, "hostInputHashes", hostInputs),
|
|
774
|
+
hostInputRealpaths: mergeInputWitnesses(left, right, "hostInputRealpaths", hostInputs),
|
|
775
|
+
}),
|
|
776
|
+
+ ...(0, mergeEnvironmentInputs_1.mergeEnvironmentInputs)(left.environmentInputs, right.environmentInputs),
|
|
777
|
+
...(left.observationsComplete === false ||
|
|
778
|
+
right.observationsComplete === false
|
|
779
|
+
? { observationsComplete: false }
|
|
780
|
+
diff --git a/lib/compiler/internal/build/mergeEnvironmentInputs.js b/lib/compiler/internal/build/mergeEnvironmentInputs.js
|
|
781
|
+
new file mode 100644
|
|
782
|
+
index 0000000000000000000000000000000000000000..17010bfbaedc7a28e821d676af7a350f22112877
|
|
783
|
+
--- /dev/null
|
|
784
|
+
+++ b/lib/compiler/internal/build/mergeEnvironmentInputs.js
|
|
785
|
+
@@ -0,0 +1,47 @@
|
|
786
|
+
+"use strict";
|
|
787
|
+
+Object.defineProperty(exports, "__esModule", { value: true });
|
|
788
|
+
+exports.mergeEnvironmentInputs = mergeEnvironmentInputs;
|
|
789
|
+
+/**
|
|
790
|
+
+ * Union the environment reads of the native generations behind one result.
|
|
791
|
+
+ *
|
|
792
|
+
+ * Every phase of one compile spawns its plugins under the same environment, so
|
|
793
|
+
+ * a name normally carries one value across phases. If two phases recorded
|
|
794
|
+
+ * different values for a name, no single environment reproduces the result: the
|
|
795
|
+
+ * first value is kept and `observationsComplete: false` withdraws reuse, the
|
|
796
|
+
+ * same refusal an explicitly incomplete producer causes. The returned object
|
|
797
|
+
+ * spreads into a result and adds nothing when no phase read a variable.
|
|
798
|
+
+ *
|
|
799
|
+
+ * @evidence contracts/common.md#principled-implementation A name is an input of the merged result if any phase read it; contradictory values cannot be satisfied by one environment, so they withdraw reuse instead of picking a winner silently.
|
|
800
|
+
+ * @evidence contracts/common.md#clear-and-simple-design One merger serves phase composition and the transform router; the existing sticky observation marker carries a conflict rather than a new proof state.
|
|
801
|
+
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No current environment value is read to repair a conflict, and a conflicting name is not dropped, which would hide an input.
|
|
802
|
+
+ * @evidence contracts/common.md#meaningful-documentation Native prose explains why values normally agree, the conflict policy and the spreadable empty result.
|
|
803
|
+
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Recorded names and values are compared literally as producer data; native environment name rules belong to the consumers that look them up.
|
|
804
|
+
+ * @evidence contracts/performance.md#efficient-algorithms One pass over every group's entries with own-key lookups; linear in recorded names.
|
|
805
|
+
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Combining supplied records coordinates no shared production.
|
|
806
|
+
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The returned record transfers to the caller; nothing is retained.
|
|
807
|
+
+ */
|
|
808
|
+
+function mergeEnvironmentInputs(...groups) {
|
|
809
|
+
+ const merged = {};
|
|
810
|
+
+ let conflicting = false;
|
|
811
|
+
+ for (const group of groups) {
|
|
812
|
+
+ for (const [name, value] of Object.entries(group ?? {})) {
|
|
813
|
+
+ if (Object.hasOwn(merged, name)) {
|
|
814
|
+
+ if (merged[name] !== value)
|
|
815
|
+
+ conflicting = true;
|
|
816
|
+
+ continue;
|
|
817
|
+
+ }
|
|
818
|
+
+ // A literal wire name must not reach an inherited setter.
|
|
819
|
+
+ Object.defineProperty(merged, name, {
|
|
820
|
+
+ configurable: true,
|
|
821
|
+
+ enumerable: true,
|
|
822
|
+
+ value,
|
|
823
|
+
+ writable: true,
|
|
824
|
+
+ });
|
|
825
|
+
+ }
|
|
826
|
+
+ }
|
|
827
|
+
+ return {
|
|
828
|
+
+ ...(Object.keys(merged).length === 0 ? {} : { environmentInputs: merged }),
|
|
829
|
+
+ ...(conflicting ? { observationsComplete: false } : {}),
|
|
830
|
+
+ };
|
|
831
|
+
+}
|
|
832
|
+
+//# sourceMappingURL=mergeEnvironmentInputs.js.map
|
|
833
|
+
|
|
834
|
+
diff --git a/lib/compiler/internal/parseEnvironmentInputs.js b/lib/compiler/internal/parseEnvironmentInputs.js
|
|
835
|
+
new file mode 100644
|
|
836
|
+
index 0000000000000000000000000000000000000000..cfba66dc36b5250461e07d0cddf1c0666541d4bb
|
|
837
|
+
--- /dev/null
|
|
838
|
+
+++ b/lib/compiler/internal/parseEnvironmentInputs.js
|
|
839
|
+
@@ -0,0 +1,43 @@
|
|
840
|
+
+"use strict";
|
|
841
|
+
+Object.defineProperty(exports, "__esModule", { value: true });
|
|
842
|
+
+exports.parseEnvironmentInputs = parseEnvironmentInputs;
|
|
843
|
+
+/**
|
|
844
|
+
+ * Decode a native `environmentInputs` section: variable names to the value a
|
|
845
|
+
+ * plugin read through `ctx.Env`, or null for an unset variable.
|
|
846
|
+
+ *
|
|
847
|
+
+ * Each entry is a dependency of the whole generation, so a malformed section
|
|
848
|
+
+ * throws instead of dropping an entry, which would hide an input and let a
|
|
849
|
+
+ * consumer reuse output computed under another value. An absent or empty
|
|
850
|
+
+ * section decodes to `undefined`.
|
|
851
|
+
+ *
|
|
852
|
+
+ * @evidence contracts/common.md#principled-implementation Names must be non-empty strings and values strings or null; anything else fails the response rather than weakening the input record.
|
|
853
|
+
+ * @evidence contracts/common.md#clear-and-simple-design One decoder serves the transform envelope and the check/emit observation sidecar, which carry the same field.
|
|
854
|
+
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts No value is read from the current environment and no malformed entry is silently discarded.
|
|
855
|
+
+ * @evidence contracts/common.md#meaningful-documentation Native prose states the wire shape, the failure policy and why it is strict.
|
|
856
|
+
+ * @evidenceExclude contracts/portability.md#os-neutral-implementation Names and values are retained as producer data; environment name rules belong to the consumers that look them up.
|
|
857
|
+
+ * @evidence contracts/performance.md#efficient-algorithms One pass over the section's entries; linear in names and value bytes.
|
|
858
|
+
+ * @evidenceExclude contracts/performance.md#reuse-equivalent-work Each response is decoded independently.
|
|
859
|
+
+ * @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The decoded record transfers to the caller; nothing is retained.
|
|
860
|
+
+ */
|
|
861
|
+
+function parseEnvironmentInputs(value) {
|
|
862
|
+
+ if (value === undefined)
|
|
863
|
+
+ return undefined;
|
|
864
|
+
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
865
|
+
+ throw new Error("ttsc: invalid native environment input record");
|
|
866
|
+
+ }
|
|
867
|
+
+ const output = {};
|
|
868
|
+
+ for (const [name, recorded] of Object.entries(value)) {
|
|
869
|
+
+ if (name.length === 0 ||
|
|
870
|
+
+ (recorded !== null && typeof recorded !== "string"))
|
|
871
|
+
+ throw new Error("ttsc: invalid native environment input entry");
|
|
872
|
+
+ // A literal wire name must not reach an inherited setter.
|
|
873
|
+
+ Object.defineProperty(output, name, {
|
|
874
|
+
+ configurable: true,
|
|
875
|
+
+ enumerable: true,
|
|
876
|
+
+ value: recorded,
|
|
877
|
+
+ writable: true,
|
|
878
|
+
+ });
|
|
879
|
+
+ }
|
|
880
|
+
+ return Object.keys(output).length === 0 ? undefined : output;
|
|
881
|
+
+}
|
|
882
|
+
+//# sourceMappingURL=parseEnvironmentInputs.js.map
|
|
883
|
+
|
|
884
|
+
diff --git a/lib/compiler/internal/parseNativeTransformOutput.js b/lib/compiler/internal/parseNativeTransformOutput.js
|
|
885
|
+
index 56f9c61c7048af48686cbbab8dc9367cb3461b0d..2ff9f8dbacccacb6412526e5a534b7c711797040 100644
|
|
886
|
+
--- a/lib/compiler/internal/parseNativeTransformOutput.js
|
|
887
|
+
+++ b/lib/compiler/internal/parseNativeTransformOutput.js
|
|
888
|
+
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
889
|
+
exports.parseNativeTransformOutput = parseNativeTransformOutput;
|
|
890
|
+
exports.parseReferenceGraph = parseReferenceGraph;
|
|
891
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
892
|
+
+const parseEnvironmentInputs_1 = require("./parseEnvironmentInputs");
|
|
893
|
+
/**
|
|
894
|
+
* Parse the JSON envelope written by the native transform host to stdout.
|
|
895
|
+
*
|
|
896
|
+
@@ -29,7 +30,9 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
897
|
+
* Observation limits have a stricter protocol: completeness is only explicit
|
|
898
|
+
* false, and per-input reasons require absolute native paths and the supported
|
|
899
|
+
* unavailable reason. Invalid limit metadata fails instead of becoming an
|
|
900
|
+
- * exemption; omission asserts no completeness.
|
|
901
|
+
+ * exemption; omission asserts no completeness. Recorded environment reads are
|
|
902
|
+
+ * strict too: dropping a malformed entry would hide an input, so a malformed
|
|
903
|
+
+ * `environmentInputs` section fails the response.
|
|
904
|
+
*
|
|
905
|
+
* @evidence contracts/common.md#principled-implementation Required source output is decoded as an object of strings; advisory members are retained only by their declared shape with literal source keys stored as own data properties, while malformed observation exemptions fail rather than authorize reuse.
|
|
906
|
+
* @evidence contracts/common.md#clear-and-simple-design This decoder owns the wire shape independently of process execution and proof revalidation; private helpers validate the distinct optional sections.
|
|
907
|
+
@@ -61,6 +64,7 @@ stderr) {
|
|
908
|
+
const dependencies = parseDependencyLists(parsed.dependencies);
|
|
909
|
+
const dependenciesComplete = parseFileList(parsed.dependenciesComplete);
|
|
910
|
+
const graph = parseReferenceGraph(parsed.graph);
|
|
911
|
+
+ const environmentInputs = (0, parseEnvironmentInputs_1.parseEnvironmentInputs)(parsed.environmentInputs);
|
|
912
|
+
const hostInputHashes = parseHostInputHashes(parsed.hostInputHashes);
|
|
913
|
+
const hostInputRealpaths = parseHostInputRealpaths(parsed.hostInputRealpaths);
|
|
914
|
+
const hostInputs = parseFileList(parsed.hostInputs);
|
|
915
|
+
@@ -69,6 +73,7 @@ stderr) {
|
|
916
|
+
return {
|
|
917
|
+
...(dependencies === undefined ? {} : { dependencies }),
|
|
918
|
+
...(dependenciesComplete === undefined ? {} : { dependenciesComplete }),
|
|
919
|
+
+ ...(environmentInputs === undefined ? {} : { environmentInputs }),
|
|
920
|
+
...(graph === undefined ? {} : { graph }),
|
|
921
|
+
...(hostInputHashes === undefined ? {} : { hostInputHashes }),
|
|
922
|
+
...(hostInputRealpaths === undefined ? {} : { hostInputRealpaths }),
|
|
923
|
+
diff --git a/lib/compiler/internal/runNativeCheckWithObservations.js b/lib/compiler/internal/runNativeCheckWithObservations.js
|
|
924
|
+
index 6fd2b52ccdb5f81fe3c2fb317a1713cd4db15f37..a5ddfe21a1bba502985c6cea16d7b063b58f9666 100644
|
|
925
|
+
--- a/lib/compiler/internal/runNativeCheckWithObservations.js
|
|
926
|
+
+++ b/lib/compiler/internal/runNativeCheckWithObservations.js
|
|
927
|
+
@@ -7,6 +7,7 @@ exports.runNativeCheckWithObservations = runNativeCheckWithObservations;
|
|
928
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
929
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
930
|
+
const createCanonicalTempDirectory_1 = require("../../internal/createCanonicalTempDirectory");
|
|
931
|
+
+const parseEnvironmentInputs_1 = require("./parseEnvironmentInputs");
|
|
932
|
+
const parseNativeTransformOutput_1 = require("./parseNativeTransformOutput");
|
|
933
|
+
/**
|
|
934
|
+
* Execute a check or opted-in build with same-generation input observations,
|
|
935
|
+
@@ -168,7 +169,9 @@ function parseObservations(value) {
|
|
936
|
+
graph.inputObservations === undefined &&
|
|
937
|
+
graph.inputRealpaths === undefined &&
|
|
938
|
+
graph.inputProofFailures === undefined);
|
|
939
|
+
+ const environmentInputs = (0, parseEnvironmentInputs_1.parseEnvironmentInputs)(value.environmentInputs);
|
|
940
|
+
return {
|
|
941
|
+
+ ...(environmentInputs === undefined ? {} : { environmentInputs }),
|
|
942
|
+
...(graph === undefined ? {} : { graph }),
|
|
943
|
+
...(graphUnavailable ? { observationsComplete: false } : {}),
|
|
944
|
+
hostInputs: [...inputs],
|
|
945
|
+
diff --git a/lib/compiler/internal/transformProjectInMemory.js b/lib/compiler/internal/transformProjectInMemory.js
|
|
946
|
+
index 999805a36b0a7f55bfcb421805ceba8fdd8da778..e1de410793dbefa35054f16308130423997eab2a 100644
|
|
947
|
+
--- a/lib/compiler/internal/transformProjectInMemory.js
|
|
948
|
+
+++ b/lib/compiler/internal/transformProjectInMemory.js
|
|
949
|
+
@@ -12,6 +12,7 @@ const loadProjectPlugins_1 = require("../../plugin/internal/load/loadProjectPlug
|
|
950
|
+
const realpathHostInputPaths_1 = require("../../plugin/internal/load/realpathHostInputPaths");
|
|
951
|
+
const CompilationSnapshot_1 = require("./CompilationSnapshot");
|
|
952
|
+
const appendBuildOutput_1 = require("./build/appendBuildOutput");
|
|
953
|
+
+const mergeEnvironmentInputs_1 = require("./build/mergeEnvironmentInputs");
|
|
954
|
+
const normalizeBuildOutput_1 = require("./build/normalizeBuildOutput");
|
|
955
|
+
const buildNativeCompiler_1 = require("./buildNativeCompiler");
|
|
956
|
+
const outputText_1 = require("./outputText");
|
|
957
|
+
@@ -46,11 +47,13 @@ const spawnNative_1 = require("./spawnNative");
|
|
958
|
+
* Explicit unavailable-observation reports survive every lane so consumers can
|
|
959
|
+
* use a fresh successful result while withholding reuse. They cannot excuse a
|
|
960
|
+
* content or physical witness that changed or conflicted across stages.
|
|
961
|
+
- * Opted-in checks supply their same-generation observations through a private
|
|
962
|
+
- * sidecar on failure as well as success. A later transform cannot restore a
|
|
963
|
+
- * check's rejected proof or replace it with an unavailable-input exemption.
|
|
964
|
+
- * Other check hosts retain their existing descriptor and declared-input
|
|
965
|
+
- * observation contract rather than inheriting the driver's protocol.
|
|
966
|
+
+ * Environment variables read by the check and transform stages are unioned into
|
|
967
|
+
+ * `environmentInputs`. Opted-in checks supply their same-generation
|
|
968
|
+
+ * observations through a private sidecar on failure as well as success. A later
|
|
969
|
+
+ * transform cannot restore a check's rejected proof or replace it with an
|
|
970
|
+
+ * unavailable-input exemption. Other check hosts retain their existing
|
|
971
|
+
+ * descriptor and declared-input observation contract rather than inheriting the
|
|
972
|
+
+ * driver's protocol.
|
|
973
|
+
*
|
|
974
|
+
* @returns A `{ result, typescript }` pair where `typescript` maps output paths
|
|
975
|
+
* to their transformed TypeScript source text, and `pluginSources` the state
|
|
976
|
+
@@ -140,6 +143,7 @@ function transformProjectWithNativeHost(options, project, baseline) {
|
|
977
|
+
const hostInputRealpaths = mergeCompatibleHostInputHashes(finalObservedHostInputRealpaths, finalOutputHostInputRealpaths, observedHostInputs, output.hostInputs);
|
|
978
|
+
return {
|
|
979
|
+
...envelopeSideChannels(output),
|
|
980
|
+
+ ...(0, mergeEnvironmentInputs_1.mergeEnvironmentInputs)(output.environmentInputs),
|
|
981
|
+
...observationLimitations([
|
|
982
|
+
baseline,
|
|
983
|
+
{
|
|
984
|
+
@@ -184,6 +188,7 @@ function transformProjectWithPlugins(options, loaded) {
|
|
985
|
+
if (checked.status !== 0) {
|
|
986
|
+
return {
|
|
987
|
+
...(checked.graph === undefined ? {} : { graph: checked.graph }),
|
|
988
|
+
+ ...(0, mergeEnvironmentInputs_1.mergeEnvironmentInputs)(checked.environmentInputs),
|
|
989
|
+
...observationLimitations([loaded, checked], checkedHostInputHashes, checkedHostInputRealpaths, unprovenCheckInputs),
|
|
990
|
+
...(checked.graph === undefined
|
|
991
|
+
? { observationsComplete: false }
|
|
992
|
+
@@ -203,6 +208,7 @@ function transformProjectWithPlugins(options, loaded) {
|
|
993
|
+
const hostInputRealpaths = mergeCompatibleHostInputHashes(finalLoadedHostInputRealpaths, transformed.hostInputRealpaths, checkedHostInputs, transformed.hostInputs);
|
|
994
|
+
return {
|
|
995
|
+
...envelopeSideChannels(transformed),
|
|
996
|
+
+ ...(0, mergeEnvironmentInputs_1.mergeEnvironmentInputs)(checked.environmentInputs, transformed.environmentInputs),
|
|
997
|
+
graph: mergeTransformGraphs(checked.graph, transformed.graph, checks.length),
|
|
998
|
+
...observationLimitations([loaded, checked, transformed], hostInputHashes, hostInputRealpaths, unprovenCheckInputs),
|
|
999
|
+
hostInputHashes,
|
|
1000
|
+
@@ -236,6 +242,7 @@ function transformProjectWithPlugins(options, loaded) {
|
|
1001
|
+
const hostInputRealpaths = mergeCompatibleHostInputHashes(finalLoadedHostInputRealpaths, finalOutputHostInputRealpaths, checkedHostInputs, output.hostInputs, deferredTransformInputs);
|
|
1002
|
+
return {
|
|
1003
|
+
...envelopeSideChannels(output),
|
|
1004
|
+
+ ...(0, mergeEnvironmentInputs_1.mergeEnvironmentInputs)(checked.environmentInputs, output.environmentInputs),
|
|
1005
|
+
graph: mergeTransformGraphs(checked.graph, output.graph, checks.length),
|
|
1006
|
+
...observationLimitations([loaded, checked, output], hostInputHashes, hostInputRealpaths, unprovenCheckInputs),
|
|
1007
|
+
hostInputHashes,
|
|
1008
|
+
diff --git a/lib/internal/CompilerResultAdapter.js b/lib/internal/CompilerResultAdapter.js
|
|
1009
|
+
index 7ff885f63d081b950730bd303aeeed70aada8067..a43778c1fe3711da0db4743b3f00b903fd22e01d 100644
|
|
1010
|
+
--- a/lib/internal/CompilerResultAdapter.js
|
|
1011
|
+
+++ b/lib/internal/CompilerResultAdapter.js
|
|
1012
|
+
@@ -179,7 +179,7 @@ function toCompilerResult(project) {
|
|
1013
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Returned source/advisory objects remain reachable under caller ownership; this operation owns no process, lease or historical registry.
|
|
1014
|
+
*/
|
|
1015
|
+
function toCompilerTransformation(project) {
|
|
1016
|
+
- const { dependencies: reportedDependencies, dependenciesComplete, graph, hostInputHashes, hostInputProofFailures, hostInputRealpaths, hostInputs, observationsComplete, pluginSources, result, sourceMaps, typescript, volatile, } = project;
|
|
1017
|
+
+ const { dependencies: reportedDependencies, dependenciesComplete, environmentInputs, graph, hostInputHashes, hostInputProofFailures, hostInputRealpaths, hostInputs, observationsComplete, pluginSources, result, sourceMaps, typescript, volatile, } = project;
|
|
1018
|
+
let dependencies = reportedDependencies;
|
|
1019
|
+
if (graph?.contentMapperInputs?.length) {
|
|
1020
|
+
const keys = new Set([
|
|
1021
|
+
@@ -204,6 +204,7 @@ function toCompilerTransformation(project) {
|
|
1022
|
+
const advisoryFields = {
|
|
1023
|
+
...(dependencies === undefined ? {} : { dependencies }),
|
|
1024
|
+
...(dependenciesComplete === undefined ? {} : { dependenciesComplete }),
|
|
1025
|
+
+ ...(environmentInputs === undefined ? {} : { environmentInputs }),
|
|
1026
|
+
...(graph === undefined ? {} : { graph }),
|
|
1027
|
+
...(hostInputHashes === undefined ? {} : { hostInputHashes }),
|
|
1028
|
+
...(hostInputProofFailures === undefined ? {} : { hostInputProofFailures }),
|
|
407
1029
|
diff --git a/lib/internal/javascriptRuntimeCapabilities.js b/lib/internal/javascriptRuntimeCapabilities.js
|
|
1030
|
+
index 53dc81d7ae8b6eac246306ad8f94b01f2594689a..d6ad694d69deca3661f5b89b491a48f282b34d42 100644
|
|
408
1031
|
--- a/lib/internal/javascriptRuntimeCapabilities.js
|
|
409
1032
|
+++ b/lib/internal/javascriptRuntimeCapabilities.js
|
|
410
|
-
@@ -43,6 +43,19 @@
|
|
1033
|
+
@@ -43,6 +43,19 @@ const spawnSyncWithLowDescriptors_1 = require("./spawnSyncWithLowDescriptors");
|
|
411
1034
|
* @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.
|
|
412
1035
|
*/
|
|
413
1036
|
function javascriptRuntimeCapabilities(runtime, env, cwd, identities) {
|
|
@@ -428,9 +1051,10 @@ diff --git a/lib/internal/javascriptRuntimeCapabilities.js b/lib/internal/javasc
|
|
|
428
1051
|
// which would refuse the cache and run in the probe (#1740).
|
|
429
1052
|
const effectiveEnv = TtsxNodeOptions_1.TtsxNodeOptions.forHelpers(SidecarEnvironment_1.SidecarEnvironment.merge(process.env, env));
|
|
430
1053
|
diff --git a/lib/plugin/internal/load/loadProjectPlugins.js b/lib/plugin/internal/load/loadProjectPlugins.js
|
|
1054
|
+
index b833157164e2125551debbd5c4eda35dd9d223fd..0e03aa37a66a08b3546a4edf0c3338a0083eaa7c 100644
|
|
431
1055
|
--- a/lib/plugin/internal/load/loadProjectPlugins.js
|
|
432
1056
|
+++ b/lib/plugin/internal/load/loadProjectPlugins.js
|
|
433
|
-
@@ -275,10 +275,14 @@
|
|
1057
|
+
@@ -275,10 +275,14 @@ function loadProjectPlugins(options) {
|
|
434
1058
|
// With the witness of each such reading, so a build of a directory package
|
|
435
1059
|
// selection already read keys on that reading instead of probing Go again.
|
|
436
1060
|
const environmentWitnesses = new Map();
|
|
@@ -445,7 +1069,7 @@ diff --git a/lib/plugin/internal/load/loadProjectPlugins.js b/lib/plugin/interna
|
|
|
445
1069
|
};
|
|
446
1070
|
// Records describing sources must never land inside one, so the store is
|
|
447
1071
|
// admitted for source proofs only once every source of the load is known.
|
|
448
|
-
@@ -314,6 +318,7 @@
|
|
1072
|
+
@@ -314,6 +318,7 @@ function loadProjectPlugins(options) {
|
|
449
1073
|
// A worker owns the watch baseline now. Complete this handoff before Go
|
|
450
1074
|
// metadata or source proof consumes the roots, preserving #1728 (#1758).
|
|
451
1075
|
yield options.onWatchInputs([...interests].sort(), sourceIdentities);
|
|
@@ -453,7 +1077,7 @@ diff --git a/lib/plugin/internal/load/loadProjectPlugins.js b/lib/plugin/interna
|
|
|
453
1077
|
const initialSize = interests.size;
|
|
454
1078
|
for (const candidate of candidates) {
|
|
455
1079
|
// Nested source-only proposals replace the outer root manifests. Do not
|
|
456
|
-
@@ -324,8 +329,10 @@
|
|
1080
|
+
@@ -324,8 +329,10 @@ function loadProjectPlugins(options) {
|
|
457
1081
|
if (reportsPluginSource(directory))
|
|
458
1082
|
interests.add(directory);
|
|
459
1083
|
}
|
|
@@ -465,7 +1089,7 @@ diff --git a/lib/plugin/internal/load/loadProjectPlugins.js b/lib/plugin/interna
|
|
|
465
1089
|
}
|
|
466
1090
|
const proposals = NativeSourcePackages_1.NativeSourcePackages.propose(candidates.map((candidate) => ({
|
|
467
1091
|
...candidate,
|
|
468
|
-
@@ -370,6 +377,8 @@
|
|
1092
|
+
@@ -370,6 +377,8 @@ function loadProjectPlugins(options) {
|
|
469
1093
|
// Admission can now narrow the provisional interests without restamping the
|
|
470
1094
|
// retained package/module baselines. Final host errors still keep these roots.
|
|
471
1095
|
yield options.onWatchInputs?.(buildDirectories, sourceIdentities);
|
|
@@ -474,7 +1098,7 @@ diff --git a/lib/plugin/internal/load/loadProjectPlugins.js b/lib/plugin/interna
|
|
|
474
1098
|
const keyedDirectories = new Set(buildDirectories);
|
|
475
1099
|
const linkedContributors = records
|
|
476
1100
|
.filter((record) => record.stage === "transform")
|
|
477
|
-
@@ -
|
|
1101
|
+
@@ -565,7 +574,7 @@ function loadProjectPlugins(options) {
|
|
478
1102
|
env: effectiveEnv,
|
|
479
1103
|
sourceDigest,
|
|
480
1104
|
environment: environmentDigests.get(directory) ??
|
|
@@ -484,9 +1108,10 @@ diff --git a/lib/plugin/internal/load/loadProjectPlugins.js b/lib/plugin/interna
|
|
|
484
1108
|
])),
|
|
485
1109
|
project,
|
|
486
1110
|
diff --git a/lib/plugin/internal/source/GoSourceInputs.js b/lib/plugin/internal/source/GoSourceInputs.js
|
|
1111
|
+
index 6bf30f65eb6f046eb2b9d505f6838b330a444df4..abc3485a35c4e380dc6e4c07fbacf2553ff2e21a 100644
|
|
487
1112
|
--- a/lib/plugin/internal/source/GoSourceInputs.js
|
|
488
1113
|
+++ b/lib/plugin/internal/source/GoSourceInputs.js
|
|
489
|
-
@@ -73,6 +73,16 @@
|
|
1114
|
+
@@ -73,6 +73,16 @@ var GoSourceInputs;
|
|
490
1115
|
function goBuildEnv(goBinary, goBuildCacheRoot, effectiveEnv = process.env) {
|
|
491
1116
|
const env = { ...effectiveEnv };
|
|
492
1117
|
env.GOWORK = "auto";
|
|
@@ -504,6 +1129,7 @@ diff --git a/lib/plugin/internal/source/GoSourceInputs.js b/lib/plugin/internal/
|
|
|
504
1129
|
// (`go mod edit`, `go env`, `go version`) call goBuildEnv with no cache root
|
|
505
1130
|
// and inherit ambient GOCACHE rather than receiving the managed build
|
|
506
1131
|
diff --git a/lib/plugin/internal/source/NativeSourcePackages.d.ts b/lib/plugin/internal/source/NativeSourcePackages.d.ts
|
|
1132
|
+
index 898f9333ddee1701d1f8af9b19c64c4f1263b9a4..037129fdcc7cf778c8f0eb4e7dd3da01f790864d 100644
|
|
507
1133
|
--- a/lib/plugin/internal/source/NativeSourcePackages.d.ts
|
|
508
1134
|
+++ b/lib/plugin/internal/source/NativeSourcePackages.d.ts
|
|
509
1135
|
@@ -1,5 +1,6 @@
|
|
@@ -513,7 +1139,7 @@ diff --git a/lib/plugin/internal/source/NativeSourcePackages.d.ts b/lib/plugin/i
|
|
|
513
1139
|
import { SourcePluginWorkspace } from "./SourcePluginWorkspace";
|
|
514
1140
|
/**
|
|
515
1141
|
* Observe Go-selected packages under the native builder's workspace policy.
|
|
516
|
-
@@ -68,6 +69,11 @@
|
|
1142
|
+
@@ -68,6 +69,11 @@ export declare namespace NativeSourcePackages {
|
|
517
1143
|
* directory keys on that reading instead of probing Go again.
|
|
518
1144
|
*/
|
|
519
1145
|
witnesses?: Map<string, PluginBuildEnvironmentWitness.Record>;
|
|
@@ -526,9 +1152,10 @@ diff --git a/lib/plugin/internal/source/NativeSourcePackages.d.ts b/lib/plugin/i
|
|
|
526
1152
|
/**
|
|
527
1153
|
* Observe entries together in a private module layout for their context.
|
|
528
1154
|
diff --git a/lib/plugin/internal/source/NativeSourcePackages.js b/lib/plugin/internal/source/NativeSourcePackages.js
|
|
1155
|
+
index 47a28235462559085e2cd4849d5920f2ae48395f..05ffe792a0e10a380c71a77bfa7533e103fccb1c 100644
|
|
529
1156
|
--- a/lib/plugin/internal/source/NativeSourcePackages.js
|
|
530
1157
|
+++ b/lib/plugin/internal/source/NativeSourcePackages.js
|
|
531
|
-
@@ -391,7 +391,7 @@
|
|
1158
|
+
@@ -391,7 +391,7 @@ function selectionIdentity(opts, moduleRoot, goBinary, env, identities) {
|
|
532
1159
|
if (environment === undefined) {
|
|
533
1160
|
const hash = node_crypto_1.default.createHash("sha256");
|
|
534
1161
|
const witness = new Map();
|
|
@@ -538,9 +1165,10 @@ diff --git a/lib/plugin/internal/source/NativeSourcePackages.js b/lib/plugin/int
|
|
|
538
1165
|
readings.environments?.set(resolvedRoot, environment);
|
|
539
1166
|
readings.witnesses?.set(resolvedRoot, witness);
|
|
540
1167
|
diff --git a/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js b/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js
|
|
1168
|
+
index da585c3ce22340d4a7d3c2b2793ae5c951958372..63c842daefa4c15cbc17b778dd382ac038eed69a 100644
|
|
541
1169
|
--- a/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js
|
|
542
1170
|
+++ b/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js
|
|
543
|
-
@@ -20,10 +20,10 @@
|
|
1171
|
+
@@ -20,10 +20,10 @@ const pluginBuildEnvironment_1 = require("./pluginBuildEnvironment");
|
|
544
1172
|
* Cold asynchronous reads run in an exclusively owned worker. Its complete
|
|
545
1173
|
* environment snapshot is passed explicitly to the native reader. Publication
|
|
546
1174
|
* rechecks both current host variables and external witnesses after transfer.
|
|
@@ -555,7 +1183,7 @@ diff --git a/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js b/lib/
|
|
|
555
1183
|
*
|
|
556
1184
|
* @evidence contracts/common.md#principled-implementation Readings pair complete environment identity with the producer's native pre-read witness; cached reuse validates that witness and asynchronous publication rechecks variables/witness after transfer. Synchronous fresh reads publish their paired observations without an extra post-read holds call here; native metadata distinguishability remains a premise.
|
|
557
1185
|
* @evidence contracts/common.md#clear-and-simple-design One owner shares observation records across synchronous reads, cache-only proof and asynchronous preparation.
|
|
558
|
-
@@ -253,7 +253,7 @@
|
|
1186
|
+
@@ -253,7 +253,7 @@ var PluginBuildEnvironmentReadings;
|
|
559
1187
|
function acquireWorker() {
|
|
560
1188
|
if (worker !== undefined)
|
|
561
1189
|
return worker;
|
|
@@ -565,6 +1193,7 @@ diff --git a/lib/plugin/internal/source/PluginBuildEnvironmentReadings.js b/lib/
|
|
|
565
1193
|
const retire = () => {
|
|
566
1194
|
if (worker === created)
|
|
567
1195
|
diff --git a/lib/plugin/internal/source/collectPluginSourceFiles.d.ts b/lib/plugin/internal/source/collectPluginSourceFiles.d.ts
|
|
1196
|
+
index 596a3ef69b0dca254e16d30ab2787ec9342f2b0c..296d6ac8e79ddd8ba3bb825fb2b065ffa4e262ec 100644
|
|
568
1197
|
--- a/lib/plugin/internal/source/collectPluginSourceFiles.d.ts
|
|
569
1198
|
+++ b/lib/plugin/internal/source/collectPluginSourceFiles.d.ts
|
|
570
1199
|
@@ -21,7 +21,11 @@
|
|
@@ -581,9 +1210,10 @@ diff --git a/lib/plugin/internal/source/collectPluginSourceFiles.d.ts b/lib/plug
|
|
|
581
1210
|
* @param root The source directory: a plugin's Go module root, an overlay
|
|
582
1211
|
* module, a contributor's source, or a `replace` target outside the module.
|
|
583
1212
|
diff --git a/lib/plugin/internal/source/collectPluginSourceFiles.js b/lib/plugin/internal/source/collectPluginSourceFiles.js
|
|
1213
|
+
index a658d747d126ef367b1d2e984131447cc3f71010..2919c93daa252715add66be29b449df327c18e5b 100644
|
|
584
1214
|
--- a/lib/plugin/internal/source/collectPluginSourceFiles.js
|
|
585
1215
|
+++ b/lib/plugin/internal/source/collectPluginSourceFiles.js
|
|
586
|
-
@@ -30,7 +30,11 @@
|
|
1216
|
+
@@ -30,7 +30,11 @@ const GoSourceInputs_1 = require("./GoSourceInputs");
|
|
587
1217
|
* A link (a symbolic link or a Windows junction) outside those directories is
|
|
588
1218
|
* refused rather than skipped. The build would compile what it names, which
|
|
589
1219
|
* neither this list nor anything keyed on it covers; a Go module zip excludes
|
|
@@ -596,7 +1226,7 @@ diff --git a/lib/plugin/internal/source/collectPluginSourceFiles.js b/lib/plugin
|
|
|
596
1226
|
*
|
|
597
1227
|
* @param root The source directory: a plugin's Go module root, an overlay
|
|
598
1228
|
* module, a contributor's source, or a `replace` target outside the module.
|
|
599
|
-
@@ -72,7 +76,8 @@
|
|
1229
|
+
@@ -72,7 +76,8 @@ function walk(root, dir, out) {
|
|
600
1230
|
// list, the key, nor a watch covers, and a copy of the module cannot
|
|
601
1231
|
// recreate a link without the symlink privilege on Windows.
|
|
602
1232
|
if (GoSourceInputs_1.GoSourceInputs.shouldPruneDirectory(entry.name) ||
|
|
@@ -606,7 +1236,7 @@ diff --git a/lib/plugin/internal/source/collectPluginSourceFiles.js b/lib/plugin
|
|
|
606
1236
|
continue;
|
|
607
1237
|
throw new Error(`ttsc: plugin source ${root} contains a link at ${full}. A plugin's Go ` +
|
|
608
1238
|
`sources are its own files, as a Go module zip holds them: replace the ` +
|
|
609
|
-
@@ -92,4 +97,15 @@
|
|
1239
|
+
@@ -92,4 +97,15 @@ function walk(root, dir, out) {
|
|
610
1240
|
out.push(full);
|
|
611
1241
|
}
|
|
612
1242
|
}
|
|
@@ -624,9 +1254,10 @@ diff --git a/lib/plugin/internal/source/collectPluginSourceFiles.js b/lib/plugin
|
|
|
624
1254
|
//# sourceMappingURL=collectPluginSourceFiles.js.map
|
|
625
1255
|
|
|
626
1256
|
diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts b/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts
|
|
1257
|
+
index b8475fb40b83ea29d631368bc3273936ba94aec9..7464692c67e560ff9dc37c65381e4babeb3ee276 100644
|
|
627
1258
|
--- a/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts
|
|
628
1259
|
+++ b/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts
|
|
629
|
-
@@ -37,6 +37,10 @@
|
|
1260
|
+
@@ -37,6 +37,10 @@ import type { SourceBuildFilesystemOperations } from "./SourceBuildFilesystemOpe
|
|
630
1261
|
* @param identities Record store that lets a new process prove the GOROOT
|
|
631
1262
|
* corpus and executable bytes from their metadata (`PluginContentIdentities`,
|
|
632
1263
|
* #1722); without it every process reads them.
|
|
@@ -637,7 +1268,7 @@ diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts b/lib/pl
|
|
|
637
1268
|
* @evidence contracts/common.md#principled-implementation Fixed artifact flags, observed compiler bytes/version, selected reported-or-fallback build values, named command executables and selected SDK files enter the same framed identity used by source-state reporting. Fallback values and metadata-qualified reuse are explicit premises, not complete observation of arbitrary toolchain inputs. GOFLAGS enters without ttsc's own compiler-target tag, so the caller's environment reproduces a 7.1 load's digest; targets are separated by their overlay modules in the build key.
|
|
638
1269
|
* @evidence contracts/common.md#clear-and-simple-design Private helpers separate compiler identity, Go-reported settings, external variables and SDK content while sharing one hash sink and optional pre-read witness.
|
|
639
1270
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts Cache signatures include real identity/change metadata and effective invocation context; failed SDK witnessing refuses reuse rather than accepting a VERSION-only proxy.
|
|
640
|
-
@@ -48,4 +52,18 @@
|
|
1271
|
+
@@ -48,4 +52,18 @@ import type { SourceBuildFilesystemOperations } from "./SourceBuildFilesystemOpe
|
|
641
1272
|
*/
|
|
642
1273
|
export declare function hashPluginBuildEnvironment(hash: {
|
|
643
1274
|
update(data: string): unknown;
|
|
@@ -658,9 +1289,10 @@ diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.d.ts b/lib/pl
|
|
|
658
1289
|
+ };
|
|
659
1290
|
+}
|
|
660
1291
|
diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.js b/lib/plugin/internal/source/hashPluginBuildEnvironment.js
|
|
1292
|
+
index 9a33d59cedb86a4e8228cbfe1034cd1001aa338c..d7ad8c6e97e7ba4e5990d3a6b9b8264145d54627 100644
|
|
661
1293
|
--- a/lib/plugin/internal/source/hashPluginBuildEnvironment.js
|
|
662
1294
|
+++ b/lib/plugin/internal/source/hashPluginBuildEnvironment.js
|
|
663
|
-
@@ -50,6 +50,10 @@
|
|
1295
|
+
@@ -50,6 +50,10 @@ const spawnGoTool_1 = require("./spawnGoTool");
|
|
664
1296
|
* @param identities Record store that lets a new process prove the GOROOT
|
|
665
1297
|
* corpus and executable bytes from their metadata (`PluginContentIdentities`,
|
|
666
1298
|
* #1722); without it every process reads them.
|
|
@@ -671,7 +1303,7 @@ diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.js b/lib/plug
|
|
|
671
1303
|
* @evidence contracts/common.md#principled-implementation Fixed artifact flags, observed compiler bytes/version, selected reported-or-fallback build values, named command executables and selected SDK files enter the same framed identity used by source-state reporting. Fallback values and metadata-qualified reuse are explicit premises, not complete observation of arbitrary toolchain inputs. GOFLAGS enters without ttsc's own compiler-target tag, so the caller's environment reproduces a 7.1 load's digest; targets are separated by their overlay modules in the build key.
|
|
672
1304
|
* @evidence contracts/common.md#clear-and-simple-design Private helpers separate compiler identity, Go-reported settings, external variables and SDK content while sharing one hash sink and optional pre-read witness.
|
|
673
1305
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts Cache signatures include real identity/change metadata and effective invocation context; failed SDK witnessing refuses reuse rather than accepting a VERSION-only proxy.
|
|
674
|
-
@@ -59,7 +63,7 @@
|
|
1306
|
+
@@ -59,7 +63,7 @@ const spawnGoTool_1 = require("./spawnGoTool");
|
|
675
1307
|
* @evidence contracts/performance.md#reuse-equivalent-work Compiler memo identity includes selected path/file metadata and invocation cwd/environment; SDK aggregate reuse requires matching complete ordered metadata/topology. With a record store, a new process reuses the SDK aggregate and executable digests only while their signatures match the recorded ones and every stamp is separable from a freshly minted reference (#1722); `go version` and `go env` stay live because they report toolchain selection no file metadata shows. All of this relies on native metadata distinguishability and sequential observation premises. Physical directories expand once per selection policy while aliases retain edges; optional caller witnesses receive reached selected dependencies.
|
|
676
1308
|
* @evidence contracts/performance.md#bound-retention-and-release-resources Compiler, Go-environment-path and SDK maps retain historical distinct tool/context/root keys without eviction; persisted records belong to the single-file collector. SDK population/topology and full individual file reads contribute transient bytes; synchronous probes delegate process/capture lifetime to their owner and do not certify arbitrary descendants are gone. No independent entry/record/file/output byte ceiling is imposed here.
|
|
677
1309
|
*/
|
|
@@ -680,7 +1312,7 @@ diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.js b/lib/plug
|
|
|
680
1312
|
// Fixed artifact policy must invalidate binaries and reported source states
|
|
681
1313
|
// together, including binaries cached before this policy was introduced.
|
|
682
1314
|
hash.update(JSON.stringify(["source-build-flags", GoSourceInputs_1.GoSourceInputs.BUILD_FLAGS]));
|
|
683
|
-
@@ -69,7 +73,7 @@
|
|
1315
|
+
@@ -69,7 +73,7 @@ function hashPluginBuildEnvironment(hash, goBinary, directory, env, filesystem,
|
|
684
1316
|
resolveGoCompilerIdentity(goBinary, env, directory, witness, identities),
|
|
685
1317
|
]));
|
|
686
1318
|
}
|
|
@@ -689,7 +1321,7 @@ diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.js b/lib/plug
|
|
|
689
1321
|
hashExternalGoBuildEnvironment(hash, env);
|
|
690
1322
|
}
|
|
691
1323
|
// Go build environment values that can change the produced binary or decide
|
|
692
|
-
@@ -296,8 +300,8 @@
|
|
1324
|
+
@@ -296,8 +300,8 @@ function hashFile(file) {
|
|
693
1325
|
hash.update(node_fs_1.default.readFileSync(file));
|
|
694
1326
|
return hash.digest("hex");
|
|
695
1327
|
}
|
|
@@ -700,7 +1332,7 @@ diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.js b/lib/plug
|
|
|
700
1332
|
for (const key of GO_BUILD_ENV_KEYS) {
|
|
701
1333
|
const value = values.get(key);
|
|
702
1334
|
if (value !== undefined && value !== "") {
|
|
703
|
-
@@ -305,7 +309,7 @@
|
|
1335
|
+
@@ -305,7 +309,7 @@ function hashGoBuildEnvironment(hash, goBinary, cwd, env, filesystem, witness, i
|
|
704
1336
|
}
|
|
705
1337
|
}
|
|
706
1338
|
}
|
|
@@ -709,7 +1341,7 @@ diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.js b/lib/plug
|
|
|
709
1341
|
const values = new Map();
|
|
710
1342
|
if (goBinary !== undefined) {
|
|
711
1343
|
const parsed = GoEnvironmentReading_1.GoEnvironmentReading.read(goBinary, cwd, env, GO_BUILD_ENV_KEYS, witness, identities);
|
|
712
|
-
@@ -314,7 +318,7 @@
|
|
1344
|
+
@@ -314,7 +318,7 @@ function resolveGoBuildEnvironment(goBinary, cwd, env, filesystem, witness, iden
|
|
713
1345
|
for (const key of GO_BUILD_ENV_KEYS) {
|
|
714
1346
|
const raw = parsed[key];
|
|
715
1347
|
if (typeof raw === "string" && raw !== "") {
|
|
@@ -718,7 +1350,7 @@ diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.js b/lib/plug
|
|
|
718
1350
|
}
|
|
719
1351
|
}
|
|
720
1352
|
}
|
|
721
|
-
@@ -329,19 +333,19 @@
|
|
1353
|
+
@@ -329,19 +333,19 @@ function resolveGoBuildEnvironment(goBinary, cwd, env, filesystem, witness, iden
|
|
722
1354
|
continue;
|
|
723
1355
|
const value = env[key];
|
|
724
1356
|
if (value !== undefined && value !== "") {
|
|
@@ -741,7 +1373,7 @@ diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.js b/lib/plug
|
|
|
741
1373
|
}
|
|
742
1374
|
if (key === "GOFLAGS") {
|
|
743
1375
|
// ttsc's compiler-target tag is not the caller's Go environment. Omitting
|
|
744
|
-
@@ -445,10 +449,12 @@
|
|
1376
|
+
@@ -445,10 +449,12 @@ function hashExternalGoBuildEnvironment(hash, env) {
|
|
745
1377
|
}
|
|
746
1378
|
}
|
|
747
1379
|
// GOROOT is usually stable but its selected source/tool payloads contribute to
|
|
@@ -758,7 +1390,7 @@ diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.js b/lib/plug
|
|
|
758
1390
|
//
|
|
759
1391
|
// WARNING (#1186, #1722): this map lives only as long as the process. #1186
|
|
760
1392
|
// stopped at it, so every CLI launch, worker and bundler restart still read the
|
|
761
|
-
@@ -456,12 +462,12 @@
|
|
1393
|
+
@@ -456,12 +462,12 @@ function hashExternalGoBuildEnvironment(hash, env) {
|
|
762
1394
|
// below is what carries the identity across processes; never drop it in favor
|
|
763
1395
|
// of this memo alone.
|
|
764
1396
|
const goRootIdentityCache = new Map();
|
|
@@ -773,7 +1405,7 @@ diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.js b/lib/plug
|
|
|
773
1405
|
if (!snapshot.complete)
|
|
774
1406
|
PluginBuildEnvironmentWitness_1.PluginBuildEnvironmentWitness.refuse(witness, resolved);
|
|
775
1407
|
if (snapshot.complete) {
|
|
776
|
-
@@ -502,6 +508,29 @@
|
|
1408
|
+
@@ -502,6 +508,29 @@ function resolveGoRootCacheIdentity(goRoot, filesystem, witness, identities) {
|
|
777
1409
|
}
|
|
778
1410
|
return identity;
|
|
779
1411
|
}
|
|
@@ -804,9 +1436,10 @@ diff --git a/lib/plugin/internal/source/hashPluginBuildEnvironment.js b/lib/plug
|
|
|
804
1436
|
const out = [];
|
|
805
1437
|
const state = { complete: true, separable: references !== undefined };
|
|
806
1438
|
diff --git a/lib/plugin/internal/source/inspectPluginBuildLock.js b/lib/plugin/internal/source/inspectPluginBuildLock.js
|
|
1439
|
+
index 1d9fba4c59143dc68efff3dba52499121f727b66..63d7ba0a344119dad76df5fdc2477c69dccb7ba9 100644
|
|
807
1440
|
--- a/lib/plugin/internal/source/inspectPluginBuildLock.js
|
|
808
1441
|
+++ b/lib/plugin/internal/source/inspectPluginBuildLock.js
|
|
809
|
-
@@ -65,9 +65,16 @@
|
|
1442
|
+
@@ -65,9 +65,16 @@ function inspectPluginBuildLock(lockDir) {
|
|
810
1443
|
const PLUGIN_BUILD_LOCK_OBSERVER = node_crypto_1.default.randomBytes(16).toString("hex");
|
|
811
1444
|
function inspectV3PluginBuildLock(lockDir) {
|
|
812
1445
|
const generationDir = node_path_1.default.join(lockDir, PluginBuildLockProtocol_1.PluginBuildLockProtocol.PLUGIN_BUILD_LOCK_CURRENT_DIR);
|
|
@@ -824,7 +1457,7 @@ diff --git a/lib/plugin/internal/source/inspectPluginBuildLock.js b/lib/plugin/i
|
|
|
824
1457
|
return { state: "released" };
|
|
825
1458
|
}
|
|
826
1459
|
throw new Error(`ttsc plugin build lock has no valid ${PluginBuildLockProtocol_1.PluginBuildLockProtocol.PLUGIN_BUILD_LOCK_GENERATION_FILE}: ${generationDir}`);
|
|
827
|
-
@@ -269,6 +276,22 @@
|
|
1460
|
+
@@ -269,6 +276,22 @@ function readPluginBuildLockGeneration(generationDir) {
|
|
828
1461
|
return null;
|
|
829
1462
|
}
|
|
830
1463
|
}
|
|
@@ -848,6 +1481,7 @@ diff --git a/lib/plugin/internal/source/inspectPluginBuildLock.js b/lib/plugin/i
|
|
|
848
1481
|
* Whether a path lookup proves absence. Permission and sharing failures are
|
|
849
1482
|
* inconclusive, never evidence of a released or old abandoned generation.
|
|
850
1483
|
diff --git a/lib/plugin/internal/source/pluginBuildEnvironment.d.ts b/lib/plugin/internal/source/pluginBuildEnvironment.d.ts
|
|
1484
|
+
index fa3512f0805d2ae0feccc90b7b0a6bce9a1db2f3..7817e88063e6d5b7851ca587dc808d9411fc25d3 100644
|
|
851
1485
|
--- a/lib/plugin/internal/source/pluginBuildEnvironment.d.ts
|
|
852
1486
|
+++ b/lib/plugin/internal/source/pluginBuildEnvironment.d.ts
|
|
853
1487
|
@@ -1,5 +1,6 @@
|
|
@@ -857,7 +1491,7 @@ diff --git a/lib/plugin/internal/source/pluginBuildEnvironment.d.ts b/lib/plugin
|
|
|
857
1491
|
/**
|
|
858
1492
|
* The digest of the environment a plugin build in `directory` is keyed on: the
|
|
859
1493
|
* Go compiler the build resolves there, the Go build environment `go env`
|
|
860
|
-
@@ -23,6 +24,8 @@
|
|
1494
|
+
@@ -23,6 +24,8 @@ import type { PluginContentIdentities } from "./PluginContentIdentities";
|
|
861
1495
|
* carries (`hashPluginBuildEnvironment`).
|
|
862
1496
|
* @param identities Record store that lets a new process prove the SDK and
|
|
863
1497
|
* executables from metadata (#1722).
|
|
@@ -866,7 +1500,7 @@ diff --git a/lib/plugin/internal/source/pluginBuildEnvironment.d.ts b/lib/plugin
|
|
|
866
1500
|
* @evidence contracts/common.md#principled-implementation The digest uses the same resolved compiler and environment serializer as the binary key, so reported toolchain state denotes the inputs actually used by the build.
|
|
867
1501
|
* @evidence contracts/common.md#clear-and-simple-design Compiler selection, executable resolution and hashing each stay with their owning helper; this function only composes one environment reading.
|
|
868
1502
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts The result comes from real Go/environment inputs, not a fixed compiler version or a caller-specific substitute.
|
|
869
|
-
@@ -30,7 +33,7 @@
|
|
1503
|
+
@@ -30,7 +33,7 @@ import type { PluginContentIdentities } from "./PluginContentIdentities";
|
|
870
1504
|
* @evidence contracts/portability.md#os-neutral-implementation Executable identity is resolved before probing, and Node filesystem/process boundaries implement native spelling rather than assuming Windows or POSIX paths are interchangeable.
|
|
871
1505
|
* @evidence contracts/performance.md#efficient-algorithms The wrapper resolves the compiler/tool under the supplied environment before delegating full environment hashing. Native resolution/probes, SDK metadata/name/path sorting and changed-manifest full content reads contribute cost; the final hash output is fixed-width but streamed identity/input text and full-file buffers are not. No independent duplicate source-directory digest scan is added here.
|
|
872
1506
|
*
|
|
@@ -877,9 +1511,10 @@ diff --git a/lib/plugin/internal/source/pluginBuildEnvironment.d.ts b/lib/plugin
|
|
|
877
1511
|
-export declare function pluginBuildEnvironment(directory: string, env?: NodeJS.ProcessEnv, witness?: PluginBuildEnvironmentWitness.Record, identities?: PluginContentIdentities.Store): string;
|
|
878
1512
|
+export declare function pluginBuildEnvironment(directory: string, env?: NodeJS.ProcessEnv, witness?: PluginBuildEnvironmentWitness.Record, identities?: PluginContentIdentities.Store, goRoots?: GoRootBatch): string;
|
|
879
1513
|
diff --git a/lib/plugin/internal/source/pluginBuildEnvironment.js b/lib/plugin/internal/source/pluginBuildEnvironment.js
|
|
1514
|
+
index 63041fd3831d6d51faebc61df12db26b5f852383..fb2694b9b12ba3029fd873b28e5dfb0492fb0a6f 100644
|
|
880
1515
|
--- a/lib/plugin/internal/source/pluginBuildEnvironment.js
|
|
881
1516
|
+++ b/lib/plugin/internal/source/pluginBuildEnvironment.js
|
|
882
|
-
@@ -32,6 +32,8 @@
|
|
1517
|
+
@@ -32,6 +32,8 @@ const resolveGoCompiler_1 = require("./resolveGoCompiler");
|
|
883
1518
|
* carries (`hashPluginBuildEnvironment`).
|
|
884
1519
|
* @param identities Record store that lets a new process prove the SDK and
|
|
885
1520
|
* executables from metadata (#1722).
|
|
@@ -888,7 +1523,7 @@ diff --git a/lib/plugin/internal/source/pluginBuildEnvironment.js b/lib/plugin/i
|
|
|
888
1523
|
* @evidence contracts/common.md#principled-implementation The digest uses the same resolved compiler and environment serializer as the binary key, so reported toolchain state denotes the inputs actually used by the build.
|
|
889
1524
|
* @evidence contracts/common.md#clear-and-simple-design Compiler selection, executable resolution and hashing each stay with their owning helper; this function only composes one environment reading.
|
|
890
1525
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts The result comes from real Go/environment inputs, not a fixed compiler version or a caller-specific substitute.
|
|
891
|
-
@@ -39,13 +41,13 @@
|
|
1526
|
+
@@ -39,13 +41,13 @@ const resolveGoCompiler_1 = require("./resolveGoCompiler");
|
|
892
1527
|
* @evidence contracts/portability.md#os-neutral-implementation Executable identity is resolved before probing, and Node filesystem/process boundaries implement native spelling rather than assuming Windows or POSIX paths are interchangeable.
|
|
893
1528
|
* @evidence contracts/performance.md#efficient-algorithms The wrapper resolves the compiler/tool under the supplied environment before delegating full environment hashing. Native resolution/probes, SDK metadata/name/path sorting and changed-manifest full content reads contribute cost; the final hash output is fixed-width but streamed identity/input text and full-file buffers are not. No independent duplicate source-directory digest scan is added here.
|
|
894
1529
|
*
|
|
@@ -907,9 +1542,10 @@ diff --git a/lib/plugin/internal/source/pluginBuildEnvironment.js b/lib/plugin/i
|
|
|
907
1542
|
//# sourceMappingURL=pluginBuildEnvironment.js.map
|
|
908
1543
|
|
|
909
1544
|
diff --git a/lib/plugin/internal/source/waitForPluginBinary.js b/lib/plugin/internal/source/waitForPluginBinary.js
|
|
1545
|
+
index 191b99ea9f36da615f82f921d40c185a56737bbd..a741af5a3e5d401f1827d896774d89bf7e2bd0c5 100644
|
|
910
1546
|
--- a/lib/plugin/internal/source/waitForPluginBinary.js
|
|
911
1547
|
+++ b/lib/plugin/internal/source/waitForPluginBinary.js
|
|
912
|
-
@@ -25,6 +25,12 @@
|
|
1548
|
+
@@ -25,6 +25,12 @@ const inspectPluginBuildLock_1 = require("./inspectPluginBuildLock");
|
|
913
1549
|
* run. An opted-in synchronous owner can cancel observation or interrupt a
|
|
914
1550
|
* polling sleep; cancellation never retires the holder's generation.
|
|
915
1551
|
*
|
|
@@ -922,7 +1558,7 @@ diff --git a/lib/plugin/internal/source/waitForPluginBinary.js b/lib/plugin/inte
|
|
|
922
1558
|
* @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.
|
|
923
1559
|
* @evidence contracts/common.md#clear-and-simple-design The loop separates publication, release, retirement and periodic status reporting; generation interpretation belongs to inspectPluginBuildLock.
|
|
924
1560
|
* @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.
|
|
925
|
-
@@ -43,22 +49,9 @@
|
|
1561
|
+
@@ -43,22 +49,9 @@ function waitForPluginBinary(opts) {
|
|
926
1562
|
OwnedSynchronousProcess_1.OwnedSynchronousProcess.checkpoint();
|
|
927
1563
|
SourceNativeRetirement_1.SourceNativeRetirement.assertAvailable(protocolDir);
|
|
928
1564
|
const protectedNativeInputs = SourceNativeRetirement_1.SourceNativeRetirement.isProtected(protocolDir);
|
|
@@ -945,7 +1581,7 @@ diff --git a/lib/plugin/internal/source/waitForPluginBinary.js b/lib/plugin/inte
|
|
|
945
1581
|
if (lock.state === "abandoned") {
|
|
946
1582
|
return {
|
|
947
1583
|
outcome: "abandoned",
|
|
948
|
-
@@ -66,6 +59,12 @@
|
|
1584
|
+
@@ -66,6 +59,12 @@ function waitForPluginBinary(opts) {
|
|
949
1585
|
fence: lock.fence,
|
|
950
1586
|
};
|
|
951
1587
|
}
|
|
@@ -959,7 +1595,7 @@ diff --git a/lib/plugin/internal/source/waitForPluginBinary.js b/lib/plugin/inte
|
|
|
959
1595
|
throw new Error(`ttsc: timed out after ${(0, formatDuration_1.formatDuration)(clock - startedAt)} waiting for ` +
|
|
960
1596
|
`${opts.lockInfo.label} "${opts.lockInfo.pluginName}" at ${opts.lockDir}; ` +
|
|
961
1597
|
diff --git a/utility/host.go b/utility/host.go
|
|
962
|
-
index
|
|
1598
|
+
index 5db2b9af70ee7b971659670bbe09d186ea90ada9..dcd04ca94c0900896b0e1bc04e9ed53e7da47b65 100644
|
|
963
1599
|
--- a/utility/host.go
|
|
964
1600
|
+++ b/utility/host.go
|
|
965
1601
|
@@ -7,6 +7,7 @@ import (
|
|
@@ -970,7 +1606,19 @@ index fab9fcc72897ec54540a5f5e93dfe115bba102a5..9d72bb780e5e104f6a41889a712efe67
|
|
|
970
1606
|
"strings"
|
|
971
1607
|
|
|
972
1608
|
shimcompiler "github.com/microsoft/typescript-go/shim/compiler"
|
|
973
|
-
@@ -
|
|
1609
|
+
@@ -79,6 +80,11 @@ type transformResult struct {
|
|
1610
|
+
HostInputHashes map[string]*string `json:"hostInputHashes,omitempty"`
|
|
1611
|
+
HostInputRealpaths map[string]*string `json:"hostInputRealpaths,omitempty"`
|
|
1612
|
+
|
|
1613
|
+
+ // EnvironmentInputs maps each environment variable a linked hook read
|
|
1614
|
+
+ // through PluginContext.Env to the value it read; null means unset.
|
|
1615
|
+
+ // Omitted when no hook read one.
|
|
1616
|
+
+ EnvironmentInputs map[string]*string `json:"environmentInputs,omitempty"`
|
|
1617
|
+
+
|
|
1618
|
+
// ObservationsComplete is present only as false when a linked hook explicitly
|
|
1619
|
+
// could not observe its input population. Absence is not completeness proof.
|
|
1620
|
+
ObservationsComplete *bool `json:"observationsComplete,omitempty"`
|
|
1621
|
+
@@ -255,7 +261,10 @@ func RunBuildWithIO(args []string, stdout, stderr io.Writer) int {
|
|
974
1622
|
opts.quiet = false // --verbose overrides the default --quiet=true
|
|
975
1623
|
}
|
|
976
1624
|
if !opts.quiet {
|
|
@@ -982,7 +1630,7 @@ index fab9fcc72897ec54540a5f5e93dfe115bba102a5..9d72bb780e5e104f6a41889a712efe67
|
|
|
982
1630
|
}
|
|
983
1631
|
writeFile, finishPreamble := makeSourcePreambleWriteFile(prog)
|
|
984
1632
|
var snapshot func() map[string][]string
|
|
985
|
-
@@ -
|
|
1633
|
+
@@ -305,6 +314,19 @@ func RunBuildWithIO(args []string, stdout, stderr io.Writer) int {
|
|
986
1634
|
}
|
|
987
1635
|
if !opts.quiet {
|
|
988
1636
|
fmt.Fprintf(opts.stdout, "// ttsc utility: emitted=%d files\n", len(emittedFiles))
|
|
@@ -998,6 +1646,15 @@ index fab9fcc72897ec54540a5f5e93dfe115bba102a5..9d72bb780e5e104f6a41889a712efe67
|
|
|
998
1646
|
+ }
|
|
999
1647
|
+ fmt.Fprintln(opts.stdout, " +", rel)
|
|
1000
1648
|
+ }
|
|
1649
|
+
+ driver.WriteEnvironmentInputsSummary(opts.stdout, "// ttsc utility: ", prog)
|
|
1001
1650
|
}
|
|
1002
1651
|
return 0
|
|
1003
1652
|
}
|
|
1653
|
+
@@ -398,6 +420,7 @@ func RunTransformWithIO(args []string, stdout, stderr io.Writer) int {
|
|
1654
|
+
out.HostInputs = prog.PluginHostInputs()
|
|
1655
|
+
out.HostInputHashes = prog.PluginHostInputHashes()
|
|
1656
|
+
out.HostInputRealpaths = prog.PluginHostInputRealpaths()
|
|
1657
|
+
+ out.EnvironmentInputs = prog.PluginEnvironmentInputs()
|
|
1658
|
+
if prog.PluginObservationsIncomplete() {
|
|
1659
|
+
incomplete := false
|
|
1660
|
+
out.ObservationsComplete = &incomplete
|