brodieG / unitizer

Easy R Unit Tests
Other
39 stars 6 forks source link

State Tracking for Reference Objects #191

Open brodieG opened 7 years ago

brodieG commented 7 years ago

Currently we're resetting state without checking whether the state should be from a reference or a new object. This is an issue with deleted items for which clearly the state must be reference. In theory, could resolve this by merging states prior to browsing, and re-assigning all the state indices in reference objects.

brodieG commented 7 years ago

Was this not addressed in mergeStates? See also #197. Leaving open until we confirm.

brodieG commented 7 years ago

So, mergeStates just handles the compressed version of state that is kept with the unitizer objects for display purposes in diffs. What we're talking about here is the actual state (pre-compression), which we only have for new evaluations in global$tracking.

As such, we probably don't have a good way of setting actual state for either deleted objects or in review mode.

The current implementation is probably all bad since it is attempting to use reference indices against our new target objects. Instead, it should probably use zero state? Not ideal, because this may cause deleted tests to behave differently than how they are stored (e.g. a deleted test requires loading of a library, but the library load happens in a non-deleted test).

Thinking about it a bit more, zero env seems an okay solution for review tests, and maybe use the last state for deleted tests? Maybe need to warn about / document someplace what's happening here? Basically we don't have a good way of re-creating the reference state. All we have is the compressed version that can tell us if there are obvious state differences, but that isn't enough to actually recreate the state.