@lmzhen/dsh-evolution-replay 0.3.81 → 0.3.82
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/index.js +29 -4
- package/lib/types/index.d.ts +14 -0
- package/package.json +5 -5
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import z from "@deepseek-ai/schemastery";
|
|
2
2
|
import { clampedNumber, evolutionHome, evolutionIoAdapter } from "@lmzhen/dsh-evolution-core";
|
|
3
|
-
import {
|
|
3
|
+
import { loadActivityState } from "@lmzhen/dsh-evolution-activity";
|
|
4
4
|
//#region lib/types/index.js
|
|
5
5
|
/**
|
|
6
6
|
* Replay/A-B evaluation for evolution plans.
|
|
@@ -94,6 +94,10 @@ var EvolutionReplayDriver = class EvolutionReplayDriver {
|
|
|
94
94
|
maxPlans;
|
|
95
95
|
/** V25-01 (v25): backfill-once latch — see {@link EvolutionReplayDriver.backfill}. */
|
|
96
96
|
backfilled = false;
|
|
97
|
+
/** FLOW6-6 (v43): the backfill source was unreadable (newer format or corrupt
|
|
98
|
+
* bytes) — carried into every comparison so an empty leaderboard is never
|
|
99
|
+
* presented as "nothing was recorded". */
|
|
100
|
+
sourceCorrupt = false;
|
|
97
101
|
/** V26-05 (v25): plan ids recorded live BEFORE the backfill settled. A
|
|
98
102
|
* plan-applied landing inside the one-shot `loadActivity` read window is
|
|
99
103
|
* recorded live AND persisted into the sidecar the backfill is reading —
|
|
@@ -188,8 +192,25 @@ var EvolutionReplayDriver = class EvolutionReplayDriver {
|
|
|
188
192
|
plansSnapshot() {
|
|
189
193
|
return [...this.plans];
|
|
190
194
|
}
|
|
195
|
+
/**
|
|
196
|
+
* FLOW6-6 (v43): mark the backfill source unreadable. Set by `apply()` when
|
|
197
|
+
* the activity sidecar carries bytes this build cannot read; the qualification
|
|
198
|
+
* then travels with every comparison.
|
|
199
|
+
*/
|
|
200
|
+
markSourceUnreadable() {
|
|
201
|
+
this.sourceCorrupt = true;
|
|
202
|
+
}
|
|
191
203
|
compare(weights = this.weights) {
|
|
192
|
-
|
|
204
|
+
const result = comparePlans([...this.plans], clampReplayWeights(weights, this.weights));
|
|
205
|
+
if (!this.sourceCorrupt) return {
|
|
206
|
+
...result,
|
|
207
|
+
sourceCorrupt: false
|
|
208
|
+
};
|
|
209
|
+
return {
|
|
210
|
+
...result,
|
|
211
|
+
sourceCorrupt: true,
|
|
212
|
+
report: "The activity sidecar could not be read as the current format (corrupt bytes or a newer writer) — this leaderboard is NOT the recorded history, and an empty list does not mean nothing happened.\n" + result.report
|
|
213
|
+
};
|
|
193
214
|
}
|
|
194
215
|
};
|
|
195
216
|
const name = "evolution-replay";
|
|
@@ -204,8 +225,12 @@ function apply(ctx, rawConfig = {}) {
|
|
|
204
225
|
ctx.inject(["evolutionIo"], (ioCtx) => {
|
|
205
226
|
const ioRegistry = ioCtx.evolutionIo;
|
|
206
227
|
const io = evolutionIoAdapter(() => ioRegistry.provider());
|
|
207
|
-
|
|
208
|
-
|
|
228
|
+
loadActivityState(evolutionHome(), io).then((loaded) => {
|
|
229
|
+
if (loaded.corrupt) {
|
|
230
|
+
ioCtx.logger.warn("evolution-replay: the activity sidecar could not be read as the current format (corrupt bytes or a newer writer) — the leaderboard backfilled from it is INCOMPLETE; the writer quarantines those bytes on its next append");
|
|
231
|
+
driver.markSourceUnreadable();
|
|
232
|
+
}
|
|
233
|
+
driver.backfill(loaded.records);
|
|
209
234
|
}).catch((error) => {
|
|
210
235
|
ioCtx.logger.warn(`evolution-replay: activity sidecar backfill skipped (${error instanceof Error ? error.message : String(error)})`);
|
|
211
236
|
});
|
package/lib/types/index.d.ts
CHANGED
|
@@ -44,6 +44,10 @@ export interface ReplayResult {
|
|
|
44
44
|
margin: number | null;
|
|
45
45
|
plans: ReplayPlan[];
|
|
46
46
|
report: string;
|
|
47
|
+
/** FLOW6-6 (v43): the activity sidecar could not be read as the current
|
|
48
|
+
* format when this leaderboard was backfilled — `plans` is then NOT the
|
|
49
|
+
* recorded history, and the report says so. */
|
|
50
|
+
sourceCorrupt?: boolean | undefined;
|
|
47
51
|
}
|
|
48
52
|
export interface ReplayWeights {
|
|
49
53
|
accepted: number;
|
|
@@ -76,6 +80,10 @@ export declare class EvolutionReplayDriver {
|
|
|
76
80
|
private readonly maxPlans;
|
|
77
81
|
/** V25-01 (v25): backfill-once latch — see {@link EvolutionReplayDriver.backfill}. */
|
|
78
82
|
private backfilled;
|
|
83
|
+
/** FLOW6-6 (v43): the backfill source was unreadable (newer format or corrupt
|
|
84
|
+
* bytes) — carried into every comparison so an empty leaderboard is never
|
|
85
|
+
* presented as "nothing was recorded". */
|
|
86
|
+
private sourceCorrupt;
|
|
79
87
|
/** V26-05 (v25): plan ids recorded live BEFORE the backfill settled. A
|
|
80
88
|
* plan-applied landing inside the one-shot `loadActivity` read window is
|
|
81
89
|
* recorded live AND persisted into the sidecar the backfill is reading —
|
|
@@ -121,6 +129,12 @@ export declare class EvolutionReplayDriver {
|
|
|
121
129
|
* @internal Exported for this package's own tests only.
|
|
122
130
|
*/
|
|
123
131
|
plansSnapshot(): ReplayPlan[];
|
|
132
|
+
/**
|
|
133
|
+
* FLOW6-6 (v43): mark the backfill source unreadable. Set by `apply()` when
|
|
134
|
+
* the activity sidecar carries bytes this build cannot read; the qualification
|
|
135
|
+
* then travels with every comparison.
|
|
136
|
+
*/
|
|
137
|
+
markSourceUnreadable(): void;
|
|
124
138
|
compare(weights?: ReplayWeights): ReplayResult;
|
|
125
139
|
}
|
|
126
140
|
export declare const name = "evolution-replay";
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-replay",
|
|
3
3
|
"description": "Replay/A-B evaluation primitives for evolution plans (community build)",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.82",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -27,14 +27,14 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
30
|
-
"@lmzhen/dsh-evolution-activity": "^0.3.
|
|
31
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
30
|
+
"@lmzhen/dsh-evolution-activity": "^0.3.82",
|
|
31
|
+
"@lmzhen/dsh-evolution-core": "^0.3.82"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@deepseek-ai/cordis": "^4.0.1"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@lmzhen/dsh-evolution-activity": "^0.3.
|
|
38
|
-
"@lmzhen/dsh-evolution-core": "^0.3.
|
|
37
|
+
"@lmzhen/dsh-evolution-activity": "^0.3.82",
|
|
38
|
+
"@lmzhen/dsh-evolution-core": "^0.3.82"
|
|
39
39
|
}
|
|
40
40
|
}
|