Skip to content

fix: actor set-value KEY with no value doesn't delete the record - #1336

Open
kuntal1461 wants to merge 1 commit into
apify:masterfrom
kuntal1461:fix/actor-set-value-delete-record
Open

fix: actor set-value KEY with no value doesn't delete the record#1336
kuntal1461 wants to merge 1 commit into
apify:masterfrom
kuntal1461:fix/actor-set-value-delete-record

Conversation

@kuntal1461

Copy link
Copy Markdown

Fixes #1193.

What changed and why

  • src/commands/actor/set-value.ts: replace value || process.stdin with value ?? cachedStdinInput

    • || coerced both undefined (omitted arg) and "" (explicit empty) to the already-drained process.stdin stream, so the deletion check on lines 64–70 never fired
    • ?? (nullish coalescing) preserves "" as a deletion sentinel and passes undefined through to cachedStdinInput for the piped-stdin case
    • process.stdin is drained by readStdin() at entrypoint load time; cachedStdinInput is the correct pre-buffered source (same pattern used by actor push-data)
  • test/e2e/commands/actor/set-value.test.ts: add regression tests for the two broken cases

    • delete record when no value or stdin is provided
    • set record from piped stdin
    • strengthen existing set-value test to assert file content

Regression introduced by

Commit 28959631 (#760, "move away from oclif") removed ignoreStdin: true from the args but did not update the process.stdin fallback to use cachedStdinInput.

Install size impact

No new dependencies. cachedStdinInput is already exported from src/entrypoints/_shared.ts.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ultra-review] actor set-value KEY with no value does not delete the record

2 participants