@lmzhen/dsh-evolution-state-domain 0.3.74 → 0.3.76
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 +2 -0
- package/lib/index.js +21 -4
- package/package.json +3 -9
- package/lib/invariant.js +0 -8
- package/lib/types/invariant.d.ts +0 -5
package/README.md
CHANGED
|
@@ -26,3 +26,5 @@ Independent of request-prefix construction. This package does not alter the asse
|
|
|
26
26
|
- P2-4 (v15): the live pending table is BOUNDED — resolved (approved/rejected) records are kept to the most recent `PENDING_RESOLVED_CAP` (200, seam constant in `evolution-state-storage`); the oldest by `resolvedAt` are deleted on resolve. The audit ARCHIVE sidecar that the json provider maintains beyond the cap is json-specific (the domain seam has no sidecar facility) — resolved records past the cap are gone, not archived.
|
|
27
27
|
- V25-11 (v25): the review-state table is likewise BOUNDED — `REVIEW_STATE_SESSION_CAP` (500, seam constant) rows keyed by session; on every save the least-recently-active sessions (provider-stamped `updatedAt`) are pruned (delete failures warn and retry on the next save). The stamp is stripped on read, so the consumer-facing record shape is unchanged.
|
|
28
28
|
|
|
29
|
+
**Runtime invariant:** No companion is published. The platform auto-assembles nothing and the family mounts no `<pkg>/invariant` cordis row, so a companion here would never execute (v37 S2.1 / I-3).
|
|
30
|
+
|
package/lib/index.js
CHANGED
|
@@ -82,12 +82,28 @@ const EVOLUTION_DOMAIN = defineDomain({
|
|
|
82
82
|
* Bounded open() retry (rc.42 audit P1-4, package-private): a rejected open
|
|
83
83
|
* used to poison the shared `opening` promise forever, so one transient
|
|
84
84
|
* backend failure (lock, busy) took the provider down until process restart.
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
* later call start a fresh budget.
|
|
85
|
+
* Only transient failures retry (v37 S2.5): a deterministic failure surfaces
|
|
86
|
+
* at once instead of re-running the whole-domain loadAll three times, and the
|
|
87
|
+
* cleared promise lets a later call start a fresh budget.
|
|
88
88
|
*/
|
|
89
89
|
const OPEN_MAX_ATTEMPTS = 3;
|
|
90
90
|
const OPEN_RETRY_BASE_MS = 100;
|
|
91
|
+
/** Retry cannot heal these — the stored record or the medium fails its own
|
|
92
|
+
* schema/version, or the backend cannot serve the domain at all. Both storage
|
|
93
|
+
* vocabularies (DomainError, StorageError) carry the code as stable API. */
|
|
94
|
+
const DETERMINISTIC_OPEN_CODES = new Set([
|
|
95
|
+
"invalid-record",
|
|
96
|
+
"malformed-medium",
|
|
97
|
+
"version-mismatch",
|
|
98
|
+
"facet-unsupported",
|
|
99
|
+
"backend-not-found",
|
|
100
|
+
"closed"
|
|
101
|
+
]);
|
|
102
|
+
function isTransientOpenFailure(error) {
|
|
103
|
+
if (typeof error !== "object" || error === null) return true;
|
|
104
|
+
const code = error.code;
|
|
105
|
+
return typeof code !== "string" || !DETERMINISTIC_OPEN_CODES.has(code);
|
|
106
|
+
}
|
|
91
107
|
function apply(ctx) {
|
|
92
108
|
let domain = null;
|
|
93
109
|
let opening = null;
|
|
@@ -102,7 +118,8 @@ function apply(ctx) {
|
|
|
102
118
|
return await facility.open(EVOLUTION_DOMAIN);
|
|
103
119
|
} catch (error) {
|
|
104
120
|
lastError = error;
|
|
105
|
-
if (
|
|
121
|
+
if (!isTransientOpenFailure(error) || attempt === OPEN_MAX_ATTEMPTS) break;
|
|
122
|
+
await new Promise((resolve) => setTimeout(resolve, OPEN_RETRY_BASE_MS * 2 ** (attempt - 1)));
|
|
106
123
|
}
|
|
107
124
|
throw lastError;
|
|
108
125
|
})();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-state-domain",
|
|
3
3
|
"description": "storage-domain provider for evolution state (community build)",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.76",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -18,10 +18,6 @@
|
|
|
18
18
|
"types": "./lib/types/index.d.ts",
|
|
19
19
|
"default": "./lib/index.js"
|
|
20
20
|
},
|
|
21
|
-
"./invariant": {
|
|
22
|
-
"types": "./lib/types/invariant.d.ts",
|
|
23
|
-
"default": "./lib/invariant.js"
|
|
24
|
-
},
|
|
25
21
|
"./package.json": "./package.json"
|
|
26
22
|
},
|
|
27
23
|
"files": [
|
|
@@ -33,16 +29,14 @@
|
|
|
33
29
|
"zod": "^4.4.3"
|
|
34
30
|
},
|
|
35
31
|
"peerDependencies": {
|
|
36
|
-
"@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
|
|
37
32
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
38
33
|
"@deepseek-ai/dsh-storage-domain": "^0.1.5-rc.2",
|
|
39
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.3.
|
|
34
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.3.76"
|
|
40
35
|
},
|
|
41
36
|
"devDependencies": {
|
|
42
|
-
"@deepseek-ai/dsh-invariants": "^0.1.5-rc.2",
|
|
43
37
|
"@deepseek-ai/dsh-storage-domain": "^0.1.5-rc.2",
|
|
44
38
|
"@deepseek-ai/dsh-storage": "^0.1.5-rc.2",
|
|
45
39
|
"@deepseek-ai/dsh-storage-json": "^0.1.5-rc.2",
|
|
46
|
-
"@lmzhen/dsh-evolution-state-storage": "^0.3.
|
|
40
|
+
"@lmzhen/dsh-evolution-state-storage": "^0.3.76"
|
|
47
41
|
}
|
|
48
42
|
}
|
package/lib/invariant.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
//#region lib/types/invariant.js
|
|
2
|
-
const PACKAGE_NAME = "@lmzhen/dsh-evolution-state-domain";
|
|
3
|
-
const name = "evolution-state-domain-invariant";
|
|
4
|
-
const inject = ["invariants"];
|
|
5
|
-
const install = () => {};
|
|
6
|
-
const apply = (ctx) => Promise.resolve(ctx.invariants.register(PACKAGE_NAME, install));
|
|
7
|
-
//#endregion
|
|
8
|
-
export { apply, inject, name };
|
package/lib/types/invariant.d.ts
DELETED