@ttsc/unplugin 0.31.0 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/bun/bun.d.cts +3 -2
- package/lib/core/bun/bun.d.mts +3 -2
- package/lib/core/bun/bun.d.ts +3 -2
- package/lib/core/bun/bun.js +8 -4
- package/lib/core/bun/bun.js.map +1 -1
- package/lib/core/bun/bun.mjs +8 -4
- package/lib/core/bun/bun.mjs.map +1 -1
- package/lib/core/observer/createInputObserver.js +6 -5
- package/lib/core/observer/createInputObserver.js.map +1 -1
- package/lib/core/observer/createInputObserver.mjs +6 -5
- package/lib/core/observer/createInputObserver.mjs.map +1 -1
- package/lib/core/observer/openIsolatedRecursiveWatch.d.cts +11 -12
- package/lib/core/observer/openIsolatedRecursiveWatch.d.mts +11 -12
- package/lib/core/observer/openIsolatedRecursiveWatch.d.ts +11 -12
- package/lib/core/observer/openIsolatedRecursiveWatch.js +11 -12
- package/lib/core/observer/openIsolatedRecursiveWatch.js.map +1 -1
- package/lib/core/observer/openIsolatedRecursiveWatch.mjs +11 -12
- package/lib/core/observer/openIsolatedRecursiveWatch.mjs.map +1 -1
- package/lib/core/transform/cache/TtscCachedProjectTransform.d.cts +12 -3
- package/lib/core/transform/cache/TtscCachedProjectTransform.d.mts +12 -3
- package/lib/core/transform/cache/TtscCachedProjectTransform.d.ts +12 -3
- package/lib/core/transform/cache/selectCachedGenerationAction.d.cts +2 -0
- package/lib/core/transform/cache/selectCachedGenerationAction.d.mts +2 -0
- package/lib/core/transform/cache/selectCachedGenerationAction.d.ts +2 -0
- package/lib/core/transform/cache/selectCachedGenerationAction.js +1 -1
- package/lib/core/transform/cache/selectCachedGenerationAction.js.map +1 -1
- package/lib/core/transform/cache/selectCachedGenerationAction.mjs +1 -1
- package/lib/core/transform/cache/selectCachedGenerationAction.mjs.map +1 -1
- package/lib/core/transform/deliverCachedTransform.d.cts +36 -0
- package/lib/core/transform/deliverCachedTransform.d.mts +36 -0
- package/lib/core/transform/deliverCachedTransform.d.ts +36 -0
- package/lib/core/transform/deliverCachedTransform.js +73 -0
- package/lib/core/transform/deliverCachedTransform.js.map +1 -0
- package/lib/core/transform/deliverCachedTransform.mjs +71 -0
- package/lib/core/transform/deliverCachedTransform.mjs.map +1 -0
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.d.cts +2 -2
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.d.mts +2 -2
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.d.ts +2 -2
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.js +6 -2
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.js.map +1 -1
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.mjs +6 -2
- package/lib/core/transform/envelope/selectDeclaredProjectInputKeys.mjs.map +1 -1
- package/lib/core/transform/envelope/selectExternalInputPaths.d.cts +3 -5
- package/lib/core/transform/envelope/selectExternalInputPaths.d.mts +3 -5
- package/lib/core/transform/envelope/selectExternalInputPaths.d.ts +3 -5
- package/lib/core/transform/envelope/selectExternalInputPaths.js +8 -7
- package/lib/core/transform/envelope/selectExternalInputPaths.js.map +1 -1
- package/lib/core/transform/envelope/selectExternalInputPaths.mjs +8 -7
- package/lib/core/transform/envelope/selectExternalInputPaths.mjs.map +1 -1
- package/lib/core/transform/filesystem/TtscTransformFilesystemOperations.d.cts +15 -12
- package/lib/core/transform/filesystem/TtscTransformFilesystemOperations.d.mts +15 -12
- package/lib/core/transform/filesystem/TtscTransformFilesystemOperations.d.ts +15 -12
- package/lib/core/transform/generation/selectTransformAttemptDisposition.d.cts +3 -1
- package/lib/core/transform/generation/selectTransformAttemptDisposition.d.mts +3 -1
- package/lib/core/transform/generation/selectTransformAttemptDisposition.d.ts +3 -1
- package/lib/core/transform/generation/selectTransformAttemptDisposition.js +3 -1
- package/lib/core/transform/generation/selectTransformAttemptDisposition.js.map +1 -1
- package/lib/core/transform/generation/selectTransformAttemptDisposition.mjs +3 -1
- package/lib/core/transform/generation/selectTransformAttemptDisposition.mjs.map +1 -1
- package/lib/core/transform/generation/transformProject.d.cts +9 -7
- package/lib/core/transform/generation/transformProject.d.mts +9 -7
- package/lib/core/transform/generation/transformProject.d.ts +9 -7
- package/lib/core/transform/generation/transformProject.js +14 -9
- package/lib/core/transform/generation/transformProject.js.map +1 -1
- package/lib/core/transform/generation/transformProject.mjs +14 -9
- package/lib/core/transform/generation/transformProject.mjs.map +1 -1
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.d.cts +11 -4
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.d.mts +11 -4
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.d.ts +11 -4
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.js +44 -7
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.js.map +1 -1
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.mjs +44 -7
- package/lib/core/transform/inputs/preparePluginBuildEnvironments.mjs.map +1 -1
- package/lib/core/transform/tracker/broker/WatchBroker.d.cts +14 -4
- package/lib/core/transform/tracker/broker/WatchBroker.d.mts +14 -4
- package/lib/core/transform/tracker/broker/WatchBroker.d.ts +14 -4
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.d.cts +63 -0
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.d.mts +63 -0
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.d.ts +63 -0
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.js +89 -0
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.js.map +1 -0
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.mjs +89 -0
- package/lib/core/transform/tracker/broker/WatchBrokerTransport.mjs.map +1 -0
- package/lib/core/transform/tracker/broker/drainWatchBroker.d.cts +8 -8
- package/lib/core/transform/tracker/broker/drainWatchBroker.d.mts +8 -8
- package/lib/core/transform/tracker/broker/drainWatchBroker.d.ts +8 -8
- package/lib/core/transform/tracker/broker/drainWatchBroker.js +12 -13
- package/lib/core/transform/tracker/broker/drainWatchBroker.js.map +1 -1
- package/lib/core/transform/tracker/broker/drainWatchBroker.mjs +12 -13
- package/lib/core/transform/tracker/broker/drainWatchBroker.mjs.map +1 -1
- package/lib/core/transform/tracker/broker/getWatchBroker.d.cts +18 -15
- package/lib/core/transform/tracker/broker/getWatchBroker.d.mts +18 -15
- package/lib/core/transform/tracker/broker/getWatchBroker.d.ts +18 -15
- package/lib/core/transform/tracker/broker/getWatchBroker.js +87 -17
- package/lib/core/transform/tracker/broker/getWatchBroker.js.map +1 -1
- package/lib/core/transform/tracker/broker/getWatchBroker.mjs +87 -17
- package/lib/core/transform/tracker/broker/getWatchBroker.mjs.map +1 -1
- package/lib/core/transform/tracker/broker/openBrokeredWatch.d.cts +5 -5
- package/lib/core/transform/tracker/broker/openBrokeredWatch.d.mts +5 -5
- package/lib/core/transform/tracker/broker/openBrokeredWatch.d.ts +5 -5
- package/lib/core/transform/tracker/broker/openBrokeredWatch.js +11 -14
- package/lib/core/transform/tracker/broker/openBrokeredWatch.js.map +1 -1
- package/lib/core/transform/tracker/broker/openBrokeredWatch.mjs +11 -14
- package/lib/core/transform/tracker/broker/openBrokeredWatch.mjs.map +1 -1
- package/lib/core/transform/tracker/broker/usesWatchBroker.d.cts +7 -7
- package/lib/core/transform/tracker/broker/usesWatchBroker.d.mts +7 -7
- package/lib/core/transform/tracker/broker/usesWatchBroker.d.ts +7 -7
- package/lib/core/transform/tracker/broker/usesWatchBroker.js +7 -7
- package/lib/core/transform/tracker/broker/usesWatchBroker.mjs +7 -7
- package/lib/core/transform/tracker/broker/watchBrokerSource.d.cts +9 -10
- package/lib/core/transform/tracker/broker/watchBrokerSource.d.mts +9 -10
- package/lib/core/transform/tracker/broker/watchBrokerSource.d.ts +9 -10
- package/lib/core/transform/tracker/broker/watchBrokerSource.js +10 -11
- package/lib/core/transform/tracker/broker/watchBrokerSource.js.map +1 -1
- package/lib/core/transform/tracker/broker/watchBrokerSource.mjs +10 -11
- package/lib/core/transform/tracker/broker/watchBrokerSource.mjs.map +1 -1
- package/lib/core/transform/transformTtsc.d.cts +7 -4
- package/lib/core/transform/transformTtsc.d.mts +7 -4
- package/lib/core/transform/transformTtsc.d.ts +7 -4
- package/lib/core/transform/transformTtsc.js +37 -92
- package/lib/core/transform/transformTtsc.js.map +1 -1
- package/lib/core/transform/transformTtsc.mjs +37 -92
- package/lib/core/transform/transformTtsc.mjs.map +1 -1
- package/lib/core/transform/validation/TtscGenerationProof.d.cts +105 -0
- package/lib/core/transform/validation/TtscGenerationProof.d.mts +105 -0
- package/lib/core/transform/validation/TtscGenerationProof.d.ts +105 -0
- package/lib/core/transform/validation/TtscGenerationProof.js +149 -0
- package/lib/core/transform/validation/TtscGenerationProof.js.map +1 -0
- package/lib/core/transform/validation/TtscGenerationProof.mjs +149 -0
- package/lib/core/transform/validation/TtscGenerationProof.mjs.map +1 -0
- package/lib/core/transform/validation/matchesCachedSource.d.cts +18 -15
- package/lib/core/transform/validation/matchesCachedSource.d.mts +18 -15
- package/lib/core/transform/validation/matchesCachedSource.d.ts +18 -15
- package/lib/core/transform/validation/matchesCachedSource.js +28 -22
- package/lib/core/transform/validation/matchesCachedSource.js.map +1 -1
- package/lib/core/transform/validation/matchesCachedSource.mjs +28 -22
- package/lib/core/transform/validation/matchesCachedSource.mjs.map +1 -1
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.d.cts +3 -2
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.d.mts +3 -2
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.d.ts +3 -2
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.js +4 -4
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.js.map +1 -1
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.mjs +4 -4
- package/lib/core/transform/validation/matchesCompleteInputSnapshot.mjs.map +1 -1
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.d.cts +2 -1
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.d.mts +2 -1
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.d.ts +2 -1
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.js +2 -2
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.js.map +1 -1
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.mjs +2 -2
- package/lib/core/transform/validation/matchesNarrowPersistentInputs.mjs.map +1 -1
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.d.cts +3 -2
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.d.mts +3 -2
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.d.ts +3 -2
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.js +5 -3
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.js.map +1 -1
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.mjs +5 -3
- package/lib/core/transform/validation/matchesUniversalHostInputTrees.mjs.map +1 -1
- package/lib/core/transform/validation/matchesUniversalHostInputs.d.cts +3 -2
- package/lib/core/transform/validation/matchesUniversalHostInputs.d.mts +3 -2
- package/lib/core/transform/validation/matchesUniversalHostInputs.d.ts +3 -2
- package/lib/core/transform/validation/matchesUniversalHostInputs.js +5 -5
- package/lib/core/transform/validation/matchesUniversalHostInputs.js.map +1 -1
- package/lib/core/transform/validation/matchesUniversalHostInputs.mjs +5 -5
- package/lib/core/transform/validation/matchesUniversalHostInputs.mjs.map +1 -1
- package/lib/core/transform/validation/nativeInputPredicatesHold.d.cts +5 -4
- package/lib/core/transform/validation/nativeInputPredicatesHold.d.mts +5 -4
- package/lib/core/transform/validation/nativeInputPredicatesHold.d.ts +5 -4
- package/lib/core/transform/validation/nativeInputPredicatesHold.js +31 -12
- package/lib/core/transform/validation/nativeInputPredicatesHold.js.map +1 -1
- package/lib/core/transform/validation/nativeInputPredicatesHold.mjs +31 -12
- package/lib/core/transform/validation/nativeInputPredicatesHold.mjs.map +1 -1
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.d.cts +2 -1
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.d.mts +2 -1
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.d.ts +2 -1
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.js +2 -2
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.js.map +1 -1
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.mjs +2 -2
- package/lib/core/transform/validation/notificationsProveProgramUnchanged.mjs.map +1 -1
- package/lib/core/transform/watch/notifyWatchInputs.js +3 -0
- package/lib/core/transform/watch/notifyWatchInputs.js.map +1 -1
- package/lib/core/transform/watch/notifyWatchInputs.mjs +3 -0
- package/lib/core/transform/watch/notifyWatchInputs.mjs.map +1 -1
- package/lib/core/turbopack/turbopack.js +2 -1
- package/lib/core/turbopack/turbopack.js.map +1 -1
- package/lib/core/turbopack/turbopack.mjs +2 -1
- package/lib/core/turbopack/turbopack.mjs.map +1 -1
- package/package.json +3 -3
- package/src/core/bun/bun.ts +8 -4
- package/src/core/observer/createInputObserver.ts +6 -5
- package/src/core/observer/openIsolatedRecursiveWatch.ts +11 -12
- package/src/core/transform/cache/TtscCachedProjectTransform.ts +13 -3
- package/src/core/transform/cache/selectCachedGenerationAction.ts +9 -1
- package/src/core/transform/deliverCachedTransform.ts +97 -0
- package/src/core/transform/envelope/selectDeclaredProjectInputKeys.ts +5 -2
- package/src/core/transform/envelope/selectExternalInputPaths.ts +7 -7
- package/src/core/transform/filesystem/TtscTransformFilesystemOperations.ts +15 -12
- package/src/core/transform/generation/selectTransformAttemptDisposition.ts +3 -1
- package/src/core/transform/generation/transformProject.ts +13 -9
- package/src/core/transform/inputs/preparePluginBuildEnvironments.ts +41 -7
- package/src/core/transform/tracker/broker/WatchBroker.ts +15 -4
- package/src/core/transform/tracker/broker/WatchBrokerTransport.ts +82 -0
- package/src/core/transform/tracker/broker/drainWatchBroker.ts +12 -13
- package/src/core/transform/tracker/broker/getWatchBroker.ts +89 -18
- package/src/core/transform/tracker/broker/openBrokeredWatch.ts +11 -14
- package/src/core/transform/tracker/broker/usesWatchBroker.ts +7 -7
- package/src/core/transform/tracker/broker/watchBrokerSource.ts +10 -11
- package/src/core/transform/transformTtsc.ts +36 -92
- package/src/core/transform/validation/TtscGenerationProof.ts +201 -0
- package/src/core/transform/validation/matchesCachedSource.ts +27 -21
- package/src/core/transform/validation/matchesCompleteInputSnapshot.ts +5 -3
- package/src/core/transform/validation/matchesNarrowPersistentInputs.ts +3 -1
- package/src/core/transform/validation/matchesUniversalHostInputTrees.ts +6 -2
- package/src/core/transform/validation/matchesUniversalHostInputs.ts +6 -4
- package/src/core/transform/validation/nativeInputPredicatesHold.ts +36 -14
- package/src/core/transform/validation/notificationsProveProgramUnchanged.ts +3 -1
- package/src/core/transform/watch/notifyWatchInputs.ts +3 -0
- package/src/core/turbopack/turbopack.ts +2 -1
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { PluginBuildEnvironmentReadings } from "ttsc/plugin-source";
|
|
2
|
+
|
|
3
|
+
import type { TtscCachedProjectTransform } from "../cache/TtscCachedProjectTransform";
|
|
4
|
+
import type { TtscTransformCache } from "../cache/TtscTransformCache";
|
|
5
|
+
import { disposeCachedTransform } from "../cache/disposeCachedTransform";
|
|
6
|
+
import { evictGeneration } from "../cache/evictGeneration";
|
|
7
|
+
import { resultFilesystem } from "../cache/resultFilesystem";
|
|
8
|
+
import { envelopeDerivation } from "../envelope/envelopeDerivation";
|
|
9
|
+
import { selectPluginSourceInputs } from "../envelope/selectPluginSourceInputs";
|
|
10
|
+
import { pathIdentityKey } from "../filesystem/pathIdentityKey";
|
|
11
|
+
import { preparePluginBuildEnvironments } from "../inputs/preparePluginBuildEnvironments";
|
|
12
|
+
import { toProjectKey } from "../project/toProjectKey";
|
|
13
|
+
import type { TtscTransformHooks } from "../watch/TtscTransformHooks";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* The shared ownership boundary for generation reuse in every adapter.
|
|
17
|
+
*
|
|
18
|
+
* WARNING (#1712, #1713): a module, a synchronous input-proof transaction, a
|
|
19
|
+
* delivery pass, and a persistent generation have different lifetimes. Keep
|
|
20
|
+
* those distinctions here. Do not add native preparation before every module,
|
|
21
|
+
* keep positive toolchain checks for a whole process, or make Bun's adapter
|
|
22
|
+
* invent its own cache policy. A proven pass shares its first deliveries;
|
|
23
|
+
* persistent/repeated deliveries require new current observations. Incomplete
|
|
24
|
+
* observations can share a coherent local result only inside an explicitly
|
|
25
|
+
* nonwatching pass with actual host-cache withdrawal, never a record or pool.
|
|
26
|
+
*
|
|
27
|
+
* @evidence contracts/common.md#principled-implementation Explicit pass identity, source baseline and first-delivery membership delimit sharing; synchronous transactions independently qualify current native inputs and incomplete local outputs retain stricter lifecycle admission.
|
|
28
|
+
* @evidence contracts/common.md#clear-and-simple-design One core owner supplies the same preparation, pass and fresh-only policies to every adapter instead of separate host-specific caches.
|
|
29
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Missing observation never becomes complete snapshot authority; watching, persistent, repeated and unknown boundaries cannot borrow an incomplete pass result.
|
|
30
|
+
* @evidence contracts/common.md#meaningful-documentation Native context names the four lifetimes and warns against the specific performance and stale-cache regressions they prevent.
|
|
31
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Members delegate native observations to the generation's filesystem and the native environment owner.
|
|
32
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms Members own baseline lookup, batch qualification and admission.
|
|
33
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work Members establish the distinct sharing boundaries.
|
|
34
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The namespace owns no registry; transactions and generations have explicit callers.
|
|
35
|
+
*/
|
|
36
|
+
export namespace TtscGenerationProof {
|
|
37
|
+
/**
|
|
38
|
+
* One synchronous admission after all asynchronous preparation has settled.
|
|
39
|
+
* Never retain this object in a generation or use it after an await.
|
|
40
|
+
*
|
|
41
|
+
* @evidence contracts/common.md#principled-implementation The exact cached owner prevents a proof of another result from supplying authority; optional native verdict is earned only by this synchronous transaction.
|
|
42
|
+
* @evidence contracts/common.md#clear-and-simple-design One transaction carries environment observations and the shared native predicate verdict.
|
|
43
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Absent environment or predicate proof remains absent, never implied success.
|
|
44
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states the no-await lifetime and members distinguish owner, environment and predicate authority.
|
|
45
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation Native identity is retained by the referenced generation, not inferred by this carrier.
|
|
46
|
+
* @evidenceExclude contracts/performance.md#efficient-algorithms This carrier executes no computation.
|
|
47
|
+
* @evidenceExclude contracts/performance.md#reuse-equivalent-work The creating operation and validators own sharing decisions.
|
|
48
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The synchronous caller owns this handle-free carrier.
|
|
49
|
+
*/
|
|
50
|
+
export interface Transaction {
|
|
51
|
+
/** Exact generation being synchronously admitted. */
|
|
52
|
+
readonly cached: TtscCachedProjectTransform;
|
|
53
|
+
|
|
54
|
+
/** Current batch, absent when the pass already owns this input proof. */
|
|
55
|
+
readonly environments?: ReadonlyMap<string, string | undefined>;
|
|
56
|
+
|
|
57
|
+
/** Current native predicate verdict, unbuilt until its first gate. */
|
|
58
|
+
nativePredicates?: boolean;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Prepare native authority only when this delivery needs a new input proof.
|
|
63
|
+
* The caller must create its synchronous transaction after awaiting this.
|
|
64
|
+
*
|
|
65
|
+
* @evidence contracts/common.md#principled-implementation A qualified first-delivery pass already owns environment proof; all other requests prepare actual authority before synchronous admission.
|
|
66
|
+
* @evidence contracts/common.md#clear-and-simple-design One branch delegates native preparation rather than repeating it in adapters.
|
|
67
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Only the existing explicit pass contract permits skipping preparation; no watcher silence or process lifetime substitutes for it.
|
|
68
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states preparation versus transaction ordering.
|
|
69
|
+
* @evidence contracts/portability.md#os-neutral-implementation Preparation uses the actual generation filesystem and native toolchain reader.
|
|
70
|
+
* @evidence contracts/performance.md#efficient-algorithms Qualified first deliveries perform baseline/identity lookups; other deliveries delegate one preparation per unique plugin directory.
|
|
71
|
+
* @evidence contracts/performance.md#reuse-equivalent-work The pass shares its existing first-delivery proof; persistent and repeated deliveries establish new native authority.
|
|
72
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources Native requests belong to their environment owner; no transaction survives this await.
|
|
73
|
+
*/
|
|
74
|
+
export async function prepare(
|
|
75
|
+
cached: TtscCachedProjectTransform,
|
|
76
|
+
file: string,
|
|
77
|
+
epoch: number | undefined,
|
|
78
|
+
): Promise<void> {
|
|
79
|
+
if (!sharesPass(cached, file, epoch))
|
|
80
|
+
await preparePluginBuildEnvironments(
|
|
81
|
+
cached.result,
|
|
82
|
+
resultFilesystem(cached.result),
|
|
83
|
+
cached,
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Start fresh synchronous observation after notification and preparation
|
|
89
|
+
* awaits, sharing actual SDK queries and native predicate replay locally.
|
|
90
|
+
*
|
|
91
|
+
* @evidence contracts/common.md#principled-implementation Current environments are batch-qualified after asynchronous work; a qualified pass needs no redundant native environment observation.
|
|
92
|
+
* @evidence contracts/common.md#clear-and-simple-design One constructor binds observations to their exact generation.
|
|
93
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts No current verdict is retained across deliveries or asynchronous boundaries.
|
|
94
|
+
* @evidence contracts/common.md#meaningful-documentation Native prose identifies the mandatory ordering and synchronous lifetime.
|
|
95
|
+
* @evidence contracts/portability.md#os-neutral-implementation Native observation remains with the environment witness owner and actual generation path identity.
|
|
96
|
+
* @evidence contracts/performance.md#efficient-algorithms Plugin selection is generation-indexed; one batch shares variable hashing and distinct SDK metadata queries.
|
|
97
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only the following synchronous validators borrow this batch; pass sharing uses its independent first-delivery contract.
|
|
98
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources The caller releases the transaction at the end of synchronous admission; no registry or native handle is acquired.
|
|
99
|
+
*/
|
|
100
|
+
export function create(
|
|
101
|
+
cached: TtscCachedProjectTransform,
|
|
102
|
+
file: string,
|
|
103
|
+
epoch: number | undefined,
|
|
104
|
+
): Transaction {
|
|
105
|
+
return {
|
|
106
|
+
cached,
|
|
107
|
+
...(sharesPass(cached, file, epoch)
|
|
108
|
+
? {}
|
|
109
|
+
: {
|
|
110
|
+
environments: PluginBuildEnvironmentReadings.cachedAll(
|
|
111
|
+
selectPluginSourceInputs(cached.result).keys(),
|
|
112
|
+
),
|
|
113
|
+
}),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Whether this module's first delivery belongs to this generation's proven
|
|
119
|
+
* pass. A missing source baseline cannot acquire this permission.
|
|
120
|
+
*
|
|
121
|
+
* @evidence contracts/common.md#principled-implementation Epoch equality, coherent snapshot or admitted local-pass state, a recorded source and an unserved identity are all required.
|
|
122
|
+
* @evidence contracts/common.md#clear-and-simple-design One predicate is shared by async preparation and synchronous source validation.
|
|
123
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts An incomplete ordinary generation or absent module baseline cannot earn pass reuse.
|
|
124
|
+
* @evidence contracts/common.md#meaningful-documentation Prose states the first-delivery and baseline restrictions.
|
|
125
|
+
* @evidence contracts/portability.md#os-neutral-implementation Baselines use the generation's actual identity and compiler project-key policy.
|
|
126
|
+
* @evidence contracts/performance.md#efficient-algorithms Baseline and served-set lookup avoid full input population traversal.
|
|
127
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only first deliveries in the same explicitly declared pass share its proof; repeated and later-pass requests do not.
|
|
128
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The predicate borrows generation state without retaining another owner.
|
|
129
|
+
*/
|
|
130
|
+
export function sharesPass(
|
|
131
|
+
cached: TtscCachedProjectTransform,
|
|
132
|
+
file: string,
|
|
133
|
+
epoch: number | undefined,
|
|
134
|
+
): boolean {
|
|
135
|
+
if (
|
|
136
|
+
epoch === undefined ||
|
|
137
|
+
cached.deliveryEpoch !== epoch ||
|
|
138
|
+
(cached.projectSnapshotComplete !== true &&
|
|
139
|
+
cached.passDeliveryOnly !== true) ||
|
|
140
|
+
(cached.freshDeliveryOnly === true && cached.passDeliveryOnly !== true)
|
|
141
|
+
)
|
|
142
|
+
return false;
|
|
143
|
+
const identities = envelopeDerivation(cached).identityContext;
|
|
144
|
+
const identity = pathIdentityKey(file, identities);
|
|
145
|
+
if (cached.servedFiles?.has(identity)) return false;
|
|
146
|
+
const key = toProjectKey(cached.projectRoot, file, identities);
|
|
147
|
+
return (
|
|
148
|
+
cached.sourceHashes?.[identity] !== undefined ||
|
|
149
|
+
Object.hasOwn(cached.inputHashes, key) ||
|
|
150
|
+
cached.externalInputHashes?.[identity] !== undefined
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Admit and notify a fresh-only local delivery. A coherent pass-only success
|
|
156
|
+
* can keep its result inside this pass after releasing capture resources;
|
|
157
|
+
* every other fresh-only answer is detached before notifying the host.
|
|
158
|
+
* Callback failure always evicts the incomplete owner.
|
|
159
|
+
*
|
|
160
|
+
* @evidence contracts/common.md#principled-implementation Explicit nonwatching, consistent project lifecycle and cache-withdrawal capability are required on every successful incomplete delivery; retention additionally needs the compile's exact pass-only epoch.
|
|
161
|
+
* @evidence contracts/common.md#clear-and-simple-design One owner handles initial and cached fresh-only admission, resource release and host notification.
|
|
162
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts Incomplete output never acquires a persistent record or publication, and failed/unknown/watching capability cannot leave a reusable owner.
|
|
163
|
+
* @evidence contracts/common.md#meaningful-documentation Native paragraphs distinguish local pass retention, resource release and callback failure effects.
|
|
164
|
+
* @evidenceExclude contracts/portability.md#os-neutral-implementation This lifecycle operation delegates native resource release to the generation disposer.
|
|
165
|
+
* @evidence contracts/performance.md#efficient-algorithms Identity/epoch checks and one callback add no input scan; resource disposal visits the fixed tracker population.
|
|
166
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Only coherent locally admitted output in its exact nonwatching pass survives; a later pass or repeated module must obtain another result.
|
|
167
|
+
* @evidence contracts/performance.md#bound-retention-and-release-resources Capture resources are released even when local output is kept; rejection and callback failure detach the owning Promise, and the cache lifecycle bounds retained result lifetime.
|
|
168
|
+
*/
|
|
169
|
+
export function admitFreshOnly(
|
|
170
|
+
cached: TtscCachedProjectTransform,
|
|
171
|
+
cache: TtscTransformCache | undefined,
|
|
172
|
+
key: string,
|
|
173
|
+
generation: Promise<TtscCachedProjectTransform>,
|
|
174
|
+
epoch: number | undefined,
|
|
175
|
+
hooks: TtscTransformHooks | undefined,
|
|
176
|
+
): void {
|
|
177
|
+
if (cached.freshDeliveryOnly !== true) return;
|
|
178
|
+
const authorized =
|
|
179
|
+
hooks?.watching === false &&
|
|
180
|
+
hooks.markVolatile !== undefined &&
|
|
181
|
+
(hooks.project?.watching === undefined ||
|
|
182
|
+
hooks.project.watching === false);
|
|
183
|
+
const retain =
|
|
184
|
+
authorized &&
|
|
185
|
+
epoch !== undefined &&
|
|
186
|
+
cached.deliveryEpoch === epoch &&
|
|
187
|
+
cached.passDeliveryOnly === true;
|
|
188
|
+
disposeCachedTransform(cached);
|
|
189
|
+
if (!retain) evictGeneration(cache, key, generation);
|
|
190
|
+
if (cached.result.type === "success" && !authorized)
|
|
191
|
+
throw new Error(
|
|
192
|
+
"@ttsc/unplugin: plugin input observation is unavailable; fresh output requires an explicitly nonwatching host with supported cache withdrawal. Watching, unknown or contradictory lifecycles cannot safely observe its changes.",
|
|
193
|
+
);
|
|
194
|
+
try {
|
|
195
|
+
hooks?.markVolatile?.();
|
|
196
|
+
} catch (error) {
|
|
197
|
+
evictGeneration(cache, key, generation);
|
|
198
|
+
throw error;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -10,6 +10,7 @@ import { pathIdentityKey } from "../filesystem/pathIdentityKey";
|
|
|
10
10
|
import { hostInputStateHash } from "../inputs/hostInputStateHash";
|
|
11
11
|
import { toProjectKey } from "../project/toProjectKey";
|
|
12
12
|
import { hashText } from "../utils/hashText";
|
|
13
|
+
import { TtscGenerationProof } from "./TtscGenerationProof";
|
|
13
14
|
import { matchesCompleteInputSnapshot } from "./matchesCompleteInputSnapshot";
|
|
14
15
|
import { matchesNarrowPersistentInputs } from "./matchesNarrowPersistentInputs";
|
|
15
16
|
import { nativeInputPredicatesHold } from "./nativeInputPredicatesHold";
|
|
@@ -24,17 +25,19 @@ import { notificationsProveProgramUnchanged } from "./notificationsProveProgramU
|
|
|
24
25
|
* no source comparison. A cache with a delivery epoch can use that comparison
|
|
25
26
|
* alone for a stable generation's first delivery of each module in the current
|
|
26
27
|
* pass, once the pass's own first delivery has proven the whole generation
|
|
27
|
-
* still matches the filesystem.
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
28
|
+
* still matches the filesystem. Incomplete generations cannot claim complete
|
|
29
|
+
* proof. A coherent local success admitted only because its observer was
|
|
30
|
+
* unavailable may share first deliveries in its exact nonwatching pass through
|
|
31
|
+
* TtscGenerationProof; it cannot cross passes or earn persistent authority.
|
|
32
|
+
* Later graph-bearing requests validate the file's derived input set and
|
|
33
|
+
* project membership. A failed result is a diagnostic of the whole loaded
|
|
34
|
+
* program, so its repair cannot be proved by one delivered output's dependency
|
|
35
|
+
* closure. Failed and graph-free envelopes conservatively validate the complete
|
|
36
|
+
* project and out-of-walk snapshots, reusing qualified signatures. A mismatch
|
|
37
|
+
* rejects this generation for the delivery; its caller chooses replacement or
|
|
38
|
+
* capture. Delivered text that differs while the disk still holds the bytes the
|
|
39
|
+
* generation compiled is not one: it is reported and served, since the compile
|
|
40
|
+
* read the disk (samchon/ttsc#1394).
|
|
38
41
|
*
|
|
39
42
|
* Its place in the adapter's invalidation model, and the units beside it, are
|
|
40
43
|
* mapped in the maintainer page
|
|
@@ -42,7 +45,7 @@ import { notificationsProveProgramUnchanged } from "./notificationsProveProgramU
|
|
|
42
45
|
*
|
|
43
46
|
* @evidence contracts/common.md#principled-implementation Delivered source, generation completeness, pass identity and notification authority choose between first-delivery proof, derived-input validation and complete snapshots; divergent editor text never substitutes for compiler disk inputs.
|
|
44
47
|
* @evidence contracts/common.md#clear-and-simple-design This admission boundary chooses the required proof while dedicated validators own membership, universal inputs and content comparisons.
|
|
45
|
-
* @evidence contracts/common.md#prohibited-implementation-shortcuts An incomplete generation cannot
|
|
48
|
+
* @evidence contracts/common.md#prohibited-implementation-shortcuts An incomplete generation cannot claim complete snapshot authority; only separately admitted coherent local success can share first deliveries of its exact nonwatching pass; inherited object members cannot invent a project baseline, and losing watcher proof falls back to recorded-state validation.
|
|
46
49
|
* @evidence contracts/common.md#meaningful-documentation Separate native paragraphs explain disk-versus-delivered authority, epoch qualification, fallback and related maintainer guidance before tags.
|
|
47
50
|
* @evidence contracts/portability.md#os-neutral-implementation Project membership and path identity use recorded compiler case policy and injected native operations; OS names do not certify case sensitivity or watcher capabilities.
|
|
48
51
|
* @evidence contracts/performance.md#bound-retention-and-release-resources
|
|
@@ -52,13 +55,13 @@ import { notificationsProveProgramUnchanged } from "./notificationsProveProgramU
|
|
|
52
55
|
* while validators replace current signature/directory witnesses. No new
|
|
53
56
|
* independent handle or historical epoch collection is acquired here.
|
|
54
57
|
* @evidence contracts/performance.md#efficient-algorithms Every admission first replays all generation-owned typed config predicates; this mandatory cost includes native queries, file bytes or directory membership independently of watcher/epoch qualification.
|
|
55
|
-
*
|
|
58
|
+
* Unsupported fresh-only rejection precedes source baseline work. Baseline-bearing paths
|
|
56
59
|
* hash delivered text and divergent paths read/hash host bytes; unrelated
|
|
57
60
|
* absent outputs can return before that hash after an initial K-output index.
|
|
58
61
|
* Epoch-qualified first checkpoints share the complete proof. Other paths
|
|
59
62
|
* pay derived-input or complete project/external/universal proof costs,
|
|
60
63
|
* including path/byte populations, native observations and clock refresh.
|
|
61
|
-
* @evidence contracts/performance.md#reuse-equivalent-work Typed config predicate replay
|
|
64
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Typed config predicate replay remains mandatory for every delivery and shares only the current synchronous transaction with nested validators; immutable membership is indexed separately. A complete generation earns one whole-snapshot proof per new delivery epoch; later first deliveries share it, while repeated or persistent deliveries revalidate their authoritative dependency scope.
|
|
62
65
|
*/
|
|
63
66
|
export function matchesCachedSource(
|
|
64
67
|
/** Generation retaining recorded baselines and distinct proof authority. */
|
|
@@ -69,9 +72,11 @@ export function matchesCachedSource(
|
|
|
69
72
|
source: string,
|
|
70
73
|
/** Current host pass, or undefined for persistent input validation. */
|
|
71
74
|
epoch: number | undefined,
|
|
75
|
+
proof?: TtscGenerationProof.Transaction,
|
|
72
76
|
): boolean {
|
|
73
|
-
if (!nativeInputPredicatesHold(cached)) return false;
|
|
74
|
-
|
|
77
|
+
if (!nativeInputPredicatesHold(cached, proof)) return false;
|
|
78
|
+
const pass = TtscGenerationProof.sharesPass(cached, file, epoch);
|
|
79
|
+
if (cached.freshDeliveryOnly === true && !pass) return false;
|
|
75
80
|
const identities = envelopeDerivation(cached).identityContext;
|
|
76
81
|
const currentKey = toProjectKey(cached.projectRoot, file, identities);
|
|
77
82
|
const identity = pathIdentityKey(file, identities);
|
|
@@ -102,7 +107,7 @@ export function matchesCachedSource(
|
|
|
102
107
|
if (!outputs.has(identity)) {
|
|
103
108
|
// While the watchers prove the program unchanged, the module is still
|
|
104
109
|
// outside it, and no walk is needed to say so (samchon/ttsc#1398).
|
|
105
|
-
if (notificationsProveProgramUnchanged(cached)) {
|
|
110
|
+
if (notificationsProveProgramUnchanged(cached, proof)) {
|
|
106
111
|
return true;
|
|
107
112
|
}
|
|
108
113
|
// Root discovery deliberately never hashed this unrelated module. Its
|
|
@@ -113,7 +118,7 @@ export function matchesCachedSource(
|
|
|
113
118
|
TRANSFORM_CLOCK_REFERENCE_DIRECTORIES.get(cached),
|
|
114
119
|
resultFilesystem(cached.result),
|
|
115
120
|
);
|
|
116
|
-
return matchesCompleteInputSnapshot(cached);
|
|
121
|
+
return matchesCompleteInputSnapshot(cached, proof);
|
|
117
122
|
}
|
|
118
123
|
}
|
|
119
124
|
if (expected !== hashText(source)) {
|
|
@@ -130,6 +135,7 @@ export function matchesCachedSource(
|
|
|
130
135
|
}
|
|
131
136
|
reportDivergentDelivery(cached, file);
|
|
132
137
|
}
|
|
138
|
+
if (pass) return true;
|
|
133
139
|
if (epoch !== undefined && cached.projectSnapshotComplete === true) {
|
|
134
140
|
if (cached.deliveryEpoch !== epoch) {
|
|
135
141
|
// The pass's first delivery. The generation was settled against an
|
|
@@ -142,7 +148,7 @@ export function matchesCachedSource(
|
|
|
142
148
|
TRANSFORM_CLOCK_REFERENCE_DIRECTORIES.get(cached),
|
|
143
149
|
resultFilesystem(cached.result),
|
|
144
150
|
);
|
|
145
|
-
if (!matchesCompleteInputSnapshot(cached)) {
|
|
151
|
+
if (!matchesCompleteInputSnapshot(cached, proof)) {
|
|
146
152
|
return false;
|
|
147
153
|
}
|
|
148
154
|
cached.deliveryEpoch = epoch;
|
|
@@ -165,7 +171,7 @@ export function matchesCachedSource(
|
|
|
165
171
|
cached.projectMutationTracker !== undefined &&
|
|
166
172
|
cached.hostInputMutationTracker !== undefined
|
|
167
173
|
) {
|
|
168
|
-
const narrow = matchesNarrowPersistentInputs(cached, file);
|
|
174
|
+
const narrow = matchesNarrowPersistentInputs(cached, file, proof);
|
|
169
175
|
if (narrow !== undefined) {
|
|
170
176
|
return narrow;
|
|
171
177
|
}
|
|
@@ -173,5 +179,5 @@ export function matchesCachedSource(
|
|
|
173
179
|
// produced. Losing the proof is not evidence of a change, so fall through
|
|
174
180
|
// to the snapshot the entry still carries.
|
|
175
181
|
}
|
|
176
|
-
return matchesCompleteInputSnapshot(cached);
|
|
182
|
+
return matchesCompleteInputSnapshot(cached, proof);
|
|
177
183
|
}
|
|
@@ -3,6 +3,7 @@ import { resultFilesystem } from "../cache/resultFilesystem";
|
|
|
3
3
|
import { declaredProjectInputKeys } from "../envelope/declaredProjectInputKeys";
|
|
4
4
|
import { envelopeDerivation } from "../envelope/envelopeDerivation";
|
|
5
5
|
import { collectProjectInputSnapshot } from "../project/collectProjectInputSnapshot";
|
|
6
|
+
import type { TtscGenerationProof } from "./TtscGenerationProof";
|
|
6
7
|
import { matchesCachedExternalInputs } from "./matchesCachedExternalInputs";
|
|
7
8
|
import { matchesExternalInputRealpaths } from "./matchesExternalInputRealpaths";
|
|
8
9
|
import { matchesUniversalHostInputEntries } from "./matchesUniversalHostInputEntries";
|
|
@@ -43,7 +44,7 @@ import { walkSnapshotComplete } from "./walkSnapshotComplete";
|
|
|
43
44
|
* target scans, signature entry materialization/adoption and native identity
|
|
44
45
|
* work add population/path/digit costs; unresolved content and predicate
|
|
45
46
|
* replay add bytes/listings. Early rejection skips subsequent domains.
|
|
46
|
-
* @evidence contracts/performance.md#reuse-equivalent-work Typed config
|
|
47
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Typed config predicates remain mandatory on every delivery. An exact-generation synchronous transaction may share their current replay across nested validators, but no pass or notification shortcut authorizes a later delivery to skip them. Qualified separable signatures avoid repeated content reads under the caller's refreshed clock. Successful aggregate proof adopts earned project/external signatures and clears unverified flags; it neither clears recorded changes/failed flags nor makes later quiet notifications sufficient without their other admission conditions.
|
|
47
48
|
*/
|
|
48
49
|
export function matchesCompleteInputSnapshot(
|
|
49
50
|
/**
|
|
@@ -51,8 +52,9 @@ export function matchesCompleteInputSnapshot(
|
|
|
51
52
|
* proof.
|
|
52
53
|
*/
|
|
53
54
|
cached: TtscCachedProjectTransform,
|
|
55
|
+
proof?: TtscGenerationProof.Transaction,
|
|
54
56
|
): boolean {
|
|
55
|
-
if (!nativeInputPredicatesHold(cached)) return false;
|
|
57
|
+
if (!nativeInputPredicatesHold(cached, proof)) return false;
|
|
56
58
|
if (
|
|
57
59
|
cached.projectSnapshotComplete !== true ||
|
|
58
60
|
cached.projectDirectories === undefined
|
|
@@ -72,7 +74,7 @@ export function matchesCompleteInputSnapshot(
|
|
|
72
74
|
hostValidation === undefined ||
|
|
73
75
|
!matchesUniversalHostInputEntries(cached, hostValidation) ||
|
|
74
76
|
!matchesUniversalHostInputProbes(cached, hostValidation) ||
|
|
75
|
-
!matchesUniversalHostInputTrees(cached, hostValidation)
|
|
77
|
+
!matchesUniversalHostInputTrees(cached, hostValidation, proof)
|
|
76
78
|
) {
|
|
77
79
|
return false;
|
|
78
80
|
}
|
|
@@ -5,6 +5,7 @@ import { envelopeDerivation } from "../envelope/envelopeDerivation";
|
|
|
5
5
|
import { selectWatchInputs } from "../envelope/selectWatchInputs";
|
|
6
6
|
import { notificationsProveMembership } from "../tracker/notificationsProveMembership";
|
|
7
7
|
import { reportsMembershipChange } from "../tracker/reportsMembershipChange";
|
|
8
|
+
import type { TtscGenerationProof } from "./TtscGenerationProof";
|
|
8
9
|
import { matchesProvenInput } from "./matchesProvenInput";
|
|
9
10
|
import { matchesUniversalHostInputs } from "./matchesUniversalHostInputs";
|
|
10
11
|
|
|
@@ -49,6 +50,7 @@ export function matchesNarrowPersistentInputs(
|
|
|
49
50
|
cached: TtscCachedProjectTransform,
|
|
50
51
|
/** Delivered file spelling selecting this envelope's dependency closure. */
|
|
51
52
|
file: string,
|
|
53
|
+
proof?: TtscGenerationProof.Transaction,
|
|
52
54
|
): boolean | undefined {
|
|
53
55
|
if (reportsMembershipChange(cached)) {
|
|
54
56
|
return false;
|
|
@@ -61,7 +63,7 @@ export function matchesNarrowPersistentInputs(
|
|
|
61
63
|
if (hostValidation === undefined) {
|
|
62
64
|
return undefined;
|
|
63
65
|
}
|
|
64
|
-
if (!matchesUniversalHostInputs(cached, hostValidation)) {
|
|
66
|
+
if (!matchesUniversalHostInputs(cached, hostValidation, proof)) {
|
|
65
67
|
return false;
|
|
66
68
|
}
|
|
67
69
|
const inputs = selectWatchInputs({
|
|
@@ -7,6 +7,7 @@ import type { TtscCachedProjectTransform } from "../cache/TtscCachedProjectTrans
|
|
|
7
7
|
import { resultFilesystem } from "../cache/resultFilesystem";
|
|
8
8
|
import { pluginSourceHolds } from "../inputs/pluginSourceHolds";
|
|
9
9
|
import { usesPreparedPluginBuildEnvironments } from "../inputs/preparePluginBuildEnvironments";
|
|
10
|
+
import type { TtscGenerationProof } from "./TtscGenerationProof";
|
|
10
11
|
import type { TtscHostInputValidation } from "./TtscHostInputValidation";
|
|
11
12
|
import { trackerProvesInputUnchanged } from "./trackerProvesInputUnchanged";
|
|
12
13
|
|
|
@@ -41,19 +42,22 @@ import { trackerProvesInputUnchanged } from "./trackerProvesInputUnchanged";
|
|
|
41
42
|
* @evidence contracts/common.md#meaningful-documentation Native paragraphs distinguish source notification, environment authority and metadata-qualified digest reuse before param tags.
|
|
42
43
|
* @evidence contracts/portability.md#os-neutral-implementation Supported plugin-source APIs and capability-qualified native trackers own source/toolchain observation without OS-wide watcher assumptions.
|
|
43
44
|
* @evidence contracts/performance.md#bound-retention-and-release-resources One environment witness per current manifest tree is replaced in place; no delivery history is retained.
|
|
44
|
-
* @evidence contracts/performance.md#efficient-algorithms
|
|
45
|
+
* @evidence contracts/performance.md#efficient-algorithms An exact-generation synchronous transaction supplies one current batched environment qualification; otherwise each tree pays the shared environment reader's variable-key construction and native dependency qualification. Qualified silent sources avoid enumeration; other trees enumerate and sort the selected file population, inspect metadata and hash source bytes whenever population, metadata or clock evidence cannot qualify reuse. The synchronous owner can also refresh native environment authority after a mismatch.
|
|
45
46
|
* @evidence contracts/performance.md#reuse-equivalent-work Generation environment witnesses and the owning digest cache share prior proof only while source and toolchain identities remain valid.
|
|
46
47
|
*/
|
|
47
48
|
export function matchesUniversalHostInputTrees(
|
|
48
49
|
cached: TtscCachedProjectTransform,
|
|
49
50
|
validation: TtscHostInputValidation,
|
|
51
|
+
proof?: TtscGenerationProof.Transaction,
|
|
50
52
|
): boolean {
|
|
51
53
|
for (const [directory, digest] of validation.trees) {
|
|
52
54
|
// Read before any proof, so the environment recorded below is one the
|
|
53
55
|
// proof saw or older, never a newer one it did not prove.
|
|
54
56
|
const prepared = usesPreparedPluginBuildEnvironments(cached.result);
|
|
55
57
|
const environment = prepared
|
|
56
|
-
?
|
|
58
|
+
? proof?.cached === cached && proof.environments !== undefined
|
|
59
|
+
? proof.environments.get(directory)
|
|
60
|
+
: PluginBuildEnvironmentReadings.cached(directory)
|
|
57
61
|
: processPluginBuildEnvironment(directory);
|
|
58
62
|
if (environment === undefined) return false;
|
|
59
63
|
if (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TtscCachedProjectTransform } from "../cache/TtscCachedProjectTransform";
|
|
2
|
+
import type { TtscGenerationProof } from "./TtscGenerationProof";
|
|
2
3
|
import type { TtscHostInputValidation } from "./TtscHostInputValidation";
|
|
3
4
|
import { matchesUniversalHostInputEntries } from "./matchesUniversalHostInputEntries";
|
|
4
5
|
import { matchesUniversalHostInputProbes } from "./matchesUniversalHostInputProbes";
|
|
@@ -29,13 +30,14 @@ import { trackerProvesInputUnchanged } from "./trackerProvesInputUnchanged";
|
|
|
29
30
|
* @evidence contracts/portability.md#os-neutral-implementation Filesystem-aware validators use actual tracker delivery capability and exact lexical coverage rather than platform-wide assumptions.
|
|
30
31
|
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The coordinator borrows generation manifests and trackers without retaining a result or acquiring a handle.
|
|
31
32
|
* @evidence contracts/performance.md#efficient-algorithms Every admission first replays all generation-owned typed config predicates; this mandatory cost includes native queries, file bytes or directory membership independently of watcher/epoch qualification. The coverage scan stops at the first unproved input. Each coverage query checks overlapping unproven scopes and sampled events with native path comparisons; fallback adds unresolved bytes, native candidate probes and plugin tree enumeration. Mandatory environment qualification pays its owning dependency and environment-key costs on either route.
|
|
32
|
-
* @evidence contracts/performance.md#reuse-equivalent-work Typed config
|
|
33
|
+
* @evidence contracts/performance.md#reuse-equivalent-work Typed config predicates remain mandatory on every delivery. An exact-generation synchronous transaction may share their current replay across nested validators, but no pass or notification shortcut authorizes a later delivery to skip them. Shared manifests and qualified silent sources avoid repeated content reads only while the owning tree validator also proves unchanged build environment.
|
|
33
34
|
*/
|
|
34
35
|
export function matchesUniversalHostInputs(
|
|
35
36
|
cached: TtscCachedProjectTransform,
|
|
36
37
|
validation: TtscHostInputValidation,
|
|
38
|
+
proof?: TtscGenerationProof.Transaction,
|
|
37
39
|
): boolean {
|
|
38
|
-
if (!nativeInputPredicatesHold(cached)) return false;
|
|
40
|
+
if (!nativeInputPredicatesHold(cached, proof)) return false;
|
|
39
41
|
let notificationsProveAll = true;
|
|
40
42
|
for (const input of validation.covered) {
|
|
41
43
|
if (!trackerProvesInputUnchanged(cached.hostInputMutationTracker, input)) {
|
|
@@ -44,10 +46,10 @@ export function matchesUniversalHostInputs(
|
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
if (notificationsProveAll)
|
|
47
|
-
return matchesUniversalHostInputTrees(cached, validation);
|
|
49
|
+
return matchesUniversalHostInputTrees(cached, validation, proof);
|
|
48
50
|
return (
|
|
49
51
|
matchesUniversalHostInputEntries(cached, validation) &&
|
|
50
52
|
matchesUniversalHostInputProbes(cached, validation) &&
|
|
51
|
-
matchesUniversalHostInputTrees(cached, validation)
|
|
53
|
+
matchesUniversalHostInputTrees(cached, validation, proof)
|
|
52
54
|
);
|
|
53
55
|
}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import type { ITtscCompilerTransformation } from "ttsc";
|
|
2
3
|
|
|
3
4
|
import type { TtscCachedProjectTransform } from "../cache/TtscCachedProjectTransform";
|
|
4
5
|
import { resultFilesystem } from "../cache/resultFilesystem";
|
|
5
6
|
import { envelopeDerivation } from "../envelope/envelopeDerivation";
|
|
6
7
|
import { nativeInputPredicateMatches } from "../inputs/nativeInputPredicateMatches";
|
|
8
|
+
import type { TtscGenerationProof } from "./TtscGenerationProof";
|
|
9
|
+
|
|
10
|
+
// Weakly owned by immutable observation membership, never by current verdict.
|
|
11
|
+
// Keeping this separate from native path derivation also preserves the empty
|
|
12
|
+
// predicate gate's promise to perform no native identity observations.
|
|
13
|
+
const predicateInputs = new WeakMap<
|
|
14
|
+
object,
|
|
15
|
+
Array<[string, ITtscCompilerTransformation.IInputObservation]>
|
|
16
|
+
>();
|
|
7
17
|
|
|
8
18
|
/**
|
|
9
19
|
* Validate every generation-owned native config predicate before cache reuse.
|
|
@@ -16,25 +26,37 @@ import { nativeInputPredicateMatches } from "../inputs/nativeInputPredicateMatch
|
|
|
16
26
|
* @evidence contracts/common.md#prohibited-implementation-shortcuts Metadata and notification shortcuts cannot omit typed config predicates or repair an unstable producer witness.
|
|
17
27
|
* @evidence contracts/common.md#meaningful-documentation The comment identifies generation ownership and the admission shortcuts that must retain this gate.
|
|
18
28
|
* @evidence contracts/portability.md#os-neutral-implementation Relative names are resolved against the recorded project with the filesystem view's path dialect; native identity and encoding belong to the replay operation.
|
|
19
|
-
* @evidence contracts/performance.md#efficient-algorithms
|
|
20
|
-
* @
|
|
21
|
-
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources
|
|
29
|
+
* @evidence contracts/performance.md#efficient-algorithms Immutable observation membership is indexed once, including an empty population. Each new synchronous admission replays only indexed native predicates and stops at the first refusal; nested validators share its verdict without another scan or native query. Empty populations require no native replay context.
|
|
30
|
+
* @evidence contracts/performance.md#reuse-equivalent-work A weak observation index shares immutable membership. Current verdicts belong only to an exact-owner synchronous transaction, never the next delivery or an await.
|
|
31
|
+
* @evidenceExclude contracts/performance.md#bound-retention-and-release-resources The weak index follows immutable observation lifetime; synchronous verdicts and native queries acquire no handle or history.
|
|
22
32
|
*/
|
|
23
33
|
export function nativeInputPredicatesHold(
|
|
24
34
|
cached: TtscCachedProjectTransform,
|
|
35
|
+
proof?: TtscGenerationProof.Transaction,
|
|
25
36
|
): boolean {
|
|
26
37
|
if (cached.result.type === "exception") return false;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
)
|
|
33
|
-
|
|
38
|
+
if (proof?.cached === cached && proof.nativePredicates !== undefined)
|
|
39
|
+
return proof.nativePredicates;
|
|
40
|
+
// Membership is immutable generation data. A positive native verdict is
|
|
41
|
+
// current observation: share it only with nested synchronous validators,
|
|
42
|
+
// never the next delivery, pass or await (#1714).
|
|
43
|
+
const finish = (matches: boolean): boolean => {
|
|
44
|
+
if (proof?.cached === cached) proof.nativePredicates = matches;
|
|
45
|
+
return matches;
|
|
46
|
+
};
|
|
47
|
+
const observations = cached.result.graph?.inputObservations;
|
|
48
|
+
if (observations === undefined) return finish(true);
|
|
49
|
+
let inputs = predicateInputs.get(observations);
|
|
50
|
+
if (inputs === undefined) {
|
|
51
|
+
inputs = Object.entries(observations).filter(
|
|
52
|
+
([, observation]) => (observation.nativePredicates?.length ?? 0) !== 0,
|
|
53
|
+
);
|
|
54
|
+
predicateInputs.set(observations, inputs);
|
|
55
|
+
}
|
|
56
|
+
if (inputs.length === 0) return finish(true);
|
|
34
57
|
const filesystem = resultFilesystem(cached.result);
|
|
35
58
|
const identities = envelopeDerivation(cached).identityContext;
|
|
36
|
-
for (const [name, observation] of
|
|
37
|
-
if ((observation.nativePredicates?.length ?? 0) === 0) continue;
|
|
59
|
+
for (const [name, observation] of inputs) {
|
|
38
60
|
const file = (
|
|
39
61
|
(filesystem.platform ?? process.platform) === "win32"
|
|
40
62
|
? path.win32
|
|
@@ -42,7 +64,7 @@ export function nativeInputPredicatesHold(
|
|
|
42
64
|
).resolve(cached.projectRoot, name);
|
|
43
65
|
for (const predicate of observation.nativePredicates ?? [])
|
|
44
66
|
if (!nativeInputPredicateMatches(file, predicate, filesystem, identities))
|
|
45
|
-
return false;
|
|
67
|
+
return finish(false);
|
|
46
68
|
}
|
|
47
|
-
return true;
|
|
69
|
+
return finish(true);
|
|
48
70
|
}
|
|
@@ -4,6 +4,7 @@ import { TRANSFORM_CLOCK_REFERENCE_DIRECTORIES } from "../clock/TRANSFORM_CLOCK_
|
|
|
4
4
|
import { refreshFilesystemClockReference } from "../clock/refreshFilesystemClockReference";
|
|
5
5
|
import { isProjectWalkPath } from "../project/isProjectWalkPath";
|
|
6
6
|
import { notificationsProveMembership } from "../tracker/notificationsProveMembership";
|
|
7
|
+
import type { TtscGenerationProof } from "./TtscGenerationProof";
|
|
7
8
|
import { matchesUniversalHostInputs } from "./matchesUniversalHostInputs";
|
|
8
9
|
|
|
9
10
|
/**
|
|
@@ -42,6 +43,7 @@ export function notificationsProveProgramUnchanged(
|
|
|
42
43
|
* proof.
|
|
43
44
|
*/
|
|
44
45
|
cached: TtscCachedProjectTransform,
|
|
46
|
+
proof?: TtscGenerationProof.Transaction,
|
|
45
47
|
): boolean {
|
|
46
48
|
if (!notificationsProveMembership(cached)) return false;
|
|
47
49
|
for (const tracker of [
|
|
@@ -88,5 +90,5 @@ export function notificationsProveProgramUnchanged(
|
|
|
88
90
|
TRANSFORM_CLOCK_REFERENCE_DIRECTORIES.get(cached),
|
|
89
91
|
resultFilesystem(cached.result),
|
|
90
92
|
);
|
|
91
|
-
return matchesUniversalHostInputs(cached, cached.hostInputValidation);
|
|
93
|
+
return matchesUniversalHostInputs(cached, cached.hostInputValidation, proof);
|
|
92
94
|
}
|
|
@@ -64,6 +64,9 @@ export function notifyWatchInputs(
|
|
|
64
64
|
// so no persistent cache may keep it.
|
|
65
65
|
if (
|
|
66
66
|
hooks.project !== undefined &&
|
|
67
|
+
// Common delivery already withdrew this host cache. Incomplete local
|
|
68
|
+
// output cannot write a record, so avoid a second withdrawal callback.
|
|
69
|
+
cached.freshDeliveryOnly !== true &&
|
|
67
70
|
!notifyProjectRecord(
|
|
68
71
|
hooks.project,
|
|
69
72
|
cached,
|
|
@@ -171,6 +171,7 @@ export function turbopack(
|
|
|
171
171
|
}
|
|
172
172
|
const hooks: TtscTransformHooks = {
|
|
173
173
|
exactPath: true,
|
|
174
|
+
watching,
|
|
174
175
|
...(addDependency === undefined
|
|
175
176
|
? {}
|
|
176
177
|
: {
|
|
@@ -186,7 +187,7 @@ export function turbopack(
|
|
|
186
187
|
toolDirectory,
|
|
187
188
|
// Turbopack takes no record outside its root, so a watching worker
|
|
188
189
|
// refuses a module it could hand none (samchon/ttsc#1480).
|
|
189
|
-
watching
|
|
190
|
+
watching,
|
|
190
191
|
},
|
|
191
192
|
}),
|
|
192
193
|
...(bindings.markVolatile === undefined
|