@lmzhen/dsh-evolution-replay 0.3.82 → 0.3.83

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 CHANGED
@@ -1,4 +1,4 @@
1
- # @deepseek-ai/dsh-evolution-replay
1
+ # @lmzhen/dsh-evolution-replay
2
2
 
3
3
  Replay/A-B evaluation primitives for evolution plans
4
4
 
@@ -8,7 +8,7 @@ Replay/A-B evaluation primitives for evolution plans
8
8
 
9
9
  #### What the model sees
10
10
 
11
- `@deepseek-ai/dsh-evolution-replay` registers no direct prompt or tool schema itself. Model-visible effects are owned by the packages that consume this service.
11
+ `@lmzhen/dsh-evolution-replay` registers no direct prompt or tool schema itself. Model-visible effects are owned by the packages that consume this service.
12
12
 
13
13
  #### Token effect
14
14
 
package/lib/index.js CHANGED
@@ -96,10 +96,13 @@ var EvolutionReplayDriver = class EvolutionReplayDriver {
96
96
  backfilled = false;
97
97
  /** FLOW6-6 (v43): the backfill source was unreadable (newer format or corrupt
98
98
  * bytes) — carried into every comparison so an empty leaderboard is never
99
- * presented as "nothing was recorded". */
99
+ * presented as "nothing was recorded". PLAN S5.1 (2026-09-16): this holds the
100
+ * most recent READ's verdict, not the first one — {@link EvolutionReplayDriver.markSourceReadable}
101
+ * clears it on a later clean read, so the qualification reflects the present
102
+ * instead of latching for the driver lifetime. */
100
103
  sourceCorrupt = false;
101
104
  /** V26-05 (v25): plan ids recorded live BEFORE the backfill settled. A
102
- * plan-applied landing inside the one-shot `loadActivity` read window is
105
+ * plan-applied landing inside the one-shot `loadActivityState` read window is
103
106
  * recorded live AND persisted into the sidecar the backfill is reading —
104
107
  * `backfill()` drops those ids so the event is not counted twice.
105
108
  *
@@ -195,11 +198,27 @@ var EvolutionReplayDriver = class EvolutionReplayDriver {
195
198
  /**
196
199
  * FLOW6-6 (v43): mark the backfill source unreadable. Set by `apply()` when
197
200
  * the activity sidecar carries bytes this build cannot read; the qualification
198
- * then travels with every comparison.
201
+ * then travels with every comparison — until a later read says otherwise
202
+ * (see {@link EvolutionReplayDriver.markSourceReadable}).
199
203
  */
200
204
  markSourceUnreadable() {
201
205
  this.sourceCorrupt = true;
202
206
  }
207
+ /**
208
+ * PLAN S5.1 (2026-09-16, audit P2-18): the counterpart clear — `apply()` calls
209
+ * this on every successful read whose bytes ARE the current format
210
+ * (`loadActivityState` answered `corrupt: false`), so the
211
+ * {@link ReplayResult.sourceCorrupt} qualification follows the CURRENT read
212
+ * state. Before this the flag latched for the driver lifetime: a repaired
213
+ * sidecar plus an io reload (HMR / plugin restart) backfilled the full
214
+ * history while `compare()` kept asserting "NOT the recorded history" — a
215
+ * permanent report claim contrary to fact. The corruption verdict is
216
+ * per-read; the past corruption itself stays observable through the warn
217
+ * `apply()` emits at mark time.
218
+ */
219
+ markSourceReadable() {
220
+ this.sourceCorrupt = false;
221
+ }
203
222
  compare(weights = this.weights) {
204
223
  const result = comparePlans([...this.plans], clampReplayWeights(weights, this.weights));
205
224
  if (!this.sourceCorrupt) return {
@@ -229,7 +248,7 @@ function apply(ctx, rawConfig = {}) {
229
248
  if (loaded.corrupt) {
230
249
  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
250
  driver.markSourceUnreadable();
232
- }
251
+ } else driver.markSourceReadable();
233
252
  driver.backfill(loaded.records);
234
253
  }).catch((error) => {
235
254
  ioCtx.logger.warn(`evolution-replay: activity sidecar backfill skipped (${error instanceof Error ? error.message : String(error)})`);
@@ -45,8 +45,11 @@ export interface ReplayResult {
45
45
  plans: ReplayPlan[];
46
46
  report: string;
47
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. */
48
+ * format at the most recent backfill read — `plans` is then NOT the
49
+ * recorded history, and the report says so. PLAN S5.1 (2026-09-16): the
50
+ * flag tracks the CURRENT read state, so a later clean read (the sidecar
51
+ * was repaired and an io reload re-read it) clears the qualification —
52
+ * it never outlives the condition it describes. */
50
53
  sourceCorrupt?: boolean | undefined;
51
54
  }
52
55
  export interface ReplayWeights {
@@ -82,10 +85,13 @@ export declare class EvolutionReplayDriver {
82
85
  private backfilled;
83
86
  /** FLOW6-6 (v43): the backfill source was unreadable (newer format or corrupt
84
87
  * bytes) — carried into every comparison so an empty leaderboard is never
85
- * presented as "nothing was recorded". */
88
+ * presented as "nothing was recorded". PLAN S5.1 (2026-09-16): this holds the
89
+ * most recent READ's verdict, not the first one — {@link EvolutionReplayDriver.markSourceReadable}
90
+ * clears it on a later clean read, so the qualification reflects the present
91
+ * instead of latching for the driver lifetime. */
86
92
  private sourceCorrupt;
87
93
  /** V26-05 (v25): plan ids recorded live BEFORE the backfill settled. A
88
- * plan-applied landing inside the one-shot `loadActivity` read window is
94
+ * plan-applied landing inside the one-shot `loadActivityState` read window is
89
95
  * recorded live AND persisted into the sidecar the backfill is reading —
90
96
  * `backfill()` drops those ids so the event is not counted twice.
91
97
  *
@@ -132,9 +138,23 @@ export declare class EvolutionReplayDriver {
132
138
  /**
133
139
  * FLOW6-6 (v43): mark the backfill source unreadable. Set by `apply()` when
134
140
  * the activity sidecar carries bytes this build cannot read; the qualification
135
- * then travels with every comparison.
141
+ * then travels with every comparison — until a later read says otherwise
142
+ * (see {@link EvolutionReplayDriver.markSourceReadable}).
136
143
  */
137
144
  markSourceUnreadable(): void;
145
+ /**
146
+ * PLAN S5.1 (2026-09-16, audit P2-18): the counterpart clear — `apply()` calls
147
+ * this on every successful read whose bytes ARE the current format
148
+ * (`loadActivityState` answered `corrupt: false`), so the
149
+ * {@link ReplayResult.sourceCorrupt} qualification follows the CURRENT read
150
+ * state. Before this the flag latched for the driver lifetime: a repaired
151
+ * sidecar plus an io reload (HMR / plugin restart) backfilled the full
152
+ * history while `compare()` kept asserting "NOT the recorded history" — a
153
+ * permanent report claim contrary to fact. The corruption verdict is
154
+ * per-read; the past corruption itself stays observable through the warn
155
+ * `apply()` emits at mark time.
156
+ */
157
+ markSourceReadable(): void;
138
158
  compare(weights?: ReplayWeights): ReplayResult;
139
159
  }
140
160
  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.82",
4
+ "version": "0.3.83",
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.82",
31
- "@lmzhen/dsh-evolution-core": "^0.3.82"
30
+ "@lmzhen/dsh-evolution-activity": "^0.3.83",
31
+ "@lmzhen/dsh-evolution-core": "^0.3.83"
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.82",
38
- "@lmzhen/dsh-evolution-core": "^0.3.82"
37
+ "@lmzhen/dsh-evolution-activity": "^0.3.83",
38
+ "@lmzhen/dsh-evolution-core": "^0.3.83"
39
39
  }
40
40
  }