fix: actor set-value KEY with no value doesn't delete the record - #1336
Open
kuntal1461 wants to merge 1 commit into
Open
fix: actor set-value KEY with no value doesn't delete the record#1336kuntal1461 wants to merge 1 commit into
kuntal1461 wants to merge 1 commit into
Conversation
Fixes apify#1193. `value || process.stdin` coerced both the omitted-arg case (undefined) and the explicit-empty-string case ("") to the already-drained process.stdin stream, so the deletion check never fired. Replace with `value ?? cachedStdinInput` to use the pre-buffered stdin and preserve the empty-string sentinel for deletion.
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.
Fixes #1193.
What changed and why
src/commands/actor/set-value.ts: replacevalue || process.stdinwithvalue ?? cachedStdinInput||coerced bothundefined(omitted arg) and""(explicit empty) to the already-drainedprocess.stdinstream, so the deletion check on lines 64–70 never fired??(nullish coalescing) preserves""as a deletion sentinel and passesundefinedthrough tocachedStdinInputfor the piped-stdin caseprocess.stdinis drained byreadStdin()at entrypoint load time;cachedStdinInputis the correct pre-buffered source (same pattern used byactor push-data)test/e2e/commands/actor/set-value.test.ts: add regression tests for the two broken casesRegression introduced by
Commit
28959631(#760, "move away from oclif") removedignoreStdin: truefrom the args but did not update theprocess.stdinfallback to usecachedStdinInput.Install size impact
No new dependencies.
cachedStdinInputis already exported fromsrc/entrypoints/_shared.ts.