mirror of
https://github.com/morluto/rea.git
synced 2026-11-08 07:46:28 +00:00
fix(environment): weigh an update's derived changes when a later write replaces it, and reset collection spellings
- An update's effect is now every field it sent or changed, derived ones included. A later write replaces it only by overwriting all of them, and an increment adds to its field rather than overwriting it. A PATCH that renames and bumps a version stays confirmed after a PUT that renames but keeps the version. - The entity-level and collection-level records of what each write changed are kept apart, each forgotten when its own target is checked. - A reset or load starts from the collection spellings of the state it installs, as a fresh store does, rather than keeping those of the state it replaced. The verdicts over the 50 captures are unchanged plan by plan, and the smoke applies all 31 served write tools. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1d1c478764
commit
dc5e2aadff
8 files changed
+209
-85
No files matched your search
@@ -24,13 +24,12 @@ import {
|
||||
isAbsence,
|
||||
servedLine,
|
||||
succeeded,
|
||||
supersede,
|
||||
withBodies,
|
||||
writtenFieldChecks,
|
||||
SimulatedState,
|
||||
WriteEffects,
|
||||
type CheckOutcome,
|
||||
type CheckedLines,
|
||||
type WrittenEntities,
|
||||
type TouchedTargets,
|
||||
type ServedLine,
|
||||
} from "./environmentStateWriteChecks.js";
|
||||
@@ -90,7 +89,7 @@ export class EnvironmentStateWriteSimulation {
|
||||
readonly #observations = new Set<number>();
|
||||
readonly #taint: WriteTaint;
|
||||
readonly #touched: TouchedTargets = new Map();
|
||||
readonly #writtenSince: WrittenEntities = new Map();
|
||||
readonly #effects = new WriteEffects();
|
||||
readonly #lastCheck = new Map<string, number>();
|
||||
/** The earliest modelled write to each target since its last check. */
|
||||
readonly #touchedSince = new Map<string, number>();
|
||||
@@ -231,7 +230,7 @@ export class EnvironmentStateWriteSimulation {
|
||||
result.entity.id,
|
||||
);
|
||||
if (result.kind === "applied" && result.entity !== undefined)
|
||||
supersede(this.#touched, this.#writtenSince, write.tool, result);
|
||||
this.#effects.supersede(this.#touched, write.tool, result);
|
||||
for (const target of result.targets) {
|
||||
// A recorded outcome replaces the entity's values, not its collection's membership.
|
||||
if (result.kind === "observed") {
|
||||
@@ -377,7 +376,7 @@ export class EnvironmentStateWriteSimulation {
|
||||
if (!pass && view.shape === "item") this.#adopt(view, record);
|
||||
for (const key of keys) {
|
||||
this.#touched.delete(key);
|
||||
this.#writtenSince.delete(key);
|
||||
this.#effects.checked(key);
|
||||
this.#touchedSince.delete(key);
|
||||
this.#lastCheck.set(key, index);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user