fix(observe): replace undefined-sentinel with boolean flags in withBatch and withDeduplicateData#127
Merged
Merged
Conversation
…tch and withDeduplicateData withBatch dropped batched `undefined` values via `pendingValue !== undefined` guard; withDeduplicateData failed to deduplicate repeated `undefined` via `lastValue === undefined` sentinel. Both now use dedicated boolean flags. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…undefined U must not include undefined because undefined is reserved as the skip sentinel. Type test verifies that explicit U = T | undefined is rejected at compile time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
krisnye
added a commit
that referenced
this pull request
Jun 24, 2026
…ype param
withFilter gained U extends {} | null in #127; useDragTransaction's unconstrained
T no longer satisfies it. Constraining T here aligns the type throughout the
call chain and reflects the genuine semantic — a transaction arg of undefined
makes no sense.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
krisnye
added a commit
that referenced
this pull request
Jun 24, 2026
* fix(ci): extend gate to cover all published downstream packages The CI gate only checked @adobe/data; data-lit's type error introduced in #127 was invisible to CI and reached main undetected. Two jobs now: - data: existing @adobe/data typecheck + lint + test (unchanged) - packages: depends on data; rebuilds @adobe/data for dist/, then builds (tsc -b) and tests all @adobe/data-* packages. data-persistence uses test:node to avoid the Playwright browser requirement in CI. Also fixes the latent data-lit error: useDragTransaction<T> now constrains T extends {} | null to satisfy withFilter's U bound (tightened in #127). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix(data-persistence): open node-fs files with O_RDWR|O_CREAT, not a+ "a+" (append+read) ignores the position argument on writes — every handle.write() lands at EOF regardless of the offset passed. This made writeAt semantically equivalent to appendAt, so all conformance tests that write at a non-zero offset failed. O_RDWR|O_CREAT (read+write, create-if-missing, never truncate) is the correct flag set: positions are honoured on write, the file is created on first open, and existing content is never clobbered. These tests were never run in CI before the packages job was added in this branch, so the bug went undetected since #102. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Two
observeoperators usedundefinedas a "not yet emitted" sentinel, which caused silent data loss whenundefinedwas a legitimate value.withBatch— the microtask flush guardif (pendingValue !== undefined)silently dropped any batched emission ofundefined. Fixed by replacing with ahasPendingValue: booleanflag.withDeduplicateData— the first-emission checklastValue === undefinedwould fail to deduplicate repeatedundefinedemissions ifundefinedbypassed theT extends Dataconstraint (e.g. viaanyor generics). Fixed by replacing with anotified: booleanflag, matching the pattern already used inwithDeduplicate,withCache, andwithOptional.Both fixes follow the existing convention in the package: track emission state with a boolean, never overload the data slot.
Related PRs
None.