Skip to content

0.18 PR7: reject known-but-unsupported options - #34

Merged
ildella merged 3 commits into
masterfrom
fix-unsupported-options
Nov 24, 2026
Merged

ildella merged 3 commits into
masterfrom
fix-unsupported-options

Conversation

@ildella

@ildella ildella commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Plan: /home/della/.opencode/plan/pipelean-0.18.md §PR 7. Follows #33 (drop/onUndefined), now on master.

What

No known option is silently ignored any more. New assertUnsupportedOptions(opts, keys, label) in src/shared.js (guard is !== undefined, message ${label}() does not support the "${key}" option), applied to:

API rejected
scan / reduce / scanSync / reduceSync (via planFold) take, total, onProgress, onUndefined
findSync onProgress, onUndefined
filter / filterSync onUndefined (was forwarded to the series engine and inert)
enrich / enrichSync signal, pause, pauseOnErrors, onSourceError, onProgress, take, total, onUndefined — rejected, never forwarded
join same 8 keys, rejected before any branch starts
  • recover keeps its dedicated messages on enrich and join (tested explicitly).
  • series / mapSeries untouched: new tests prove they still accept take, total, onProgress, onUndefined, signal.
  • Rejection happens at construction, so the curried forms fail at build time too.
  • Full allowlist of unknown options is deliberately deferred to 0.19.

Notes

  • src/enrich.js was at the 180-line gate: the recover block plus the new lifecycle assertion moved to a new src/enrich-options.js (enrich.js now 176 lines). No lint rule disabled.
  • The 8-key lifecycle list lives in src/run.js (LIFECYCLE_OPTIONS), shared by enrich and join; FOLD_UNSUPPORTED is a strict subset local to planFold (folds do accept signal/pause/pauseOnErrors/onSourceError).
  • filterSync names itself in the message, consistent with findSync/enrichSync/join.
  • Verified enrich's internal fold call passes only {strategy, onError?, onFailure?}, so the fold guard cannot fire from inside enrich.

Tests

New tests/unsupported-options.test.js, 25 cases, including a branch spy proving join rejects before starting work. No existing test changed. Mutation-checked: disabling the planFold guard fails the 4 fold tests, disabling the join guard fails all 8 join tests.

Gates (local)

yarn lint exit 0 · yarn vitest run 76 files / 1075 tests passed · yarn check exit 0 (0 clones, knip clean).

Known-but-inert options are a trap: the caller believes the run was
configured and gets silence instead. Add assertUnsupportedOptions and use
it wherever an option is accepted by the signature but can never apply:

- folds (scan/reduce/scanSync/reduceSync) reject take, total, onProgress
  and onUndefined from planFold;
- findSync rejects onProgress and onUndefined;
- filter/filterSync reject onUndefined, which was previously forwarded to
  the series engine and silently inert;
- enrich/enrichSync and join reject the whole run lifecycle before doing
  any work: enrich at pipeline construction, join before its first branch.

The lifecycle list lives in run.js because it is the engine's contract;
enrich option validation moved to enrich-options.js so enrich.js stays
under the 180-line gate. recover keeps its dedicated per-API message.

Only a real value is rejected: an explicit undefined is treated as
omitted. This is a curated list of known options, not the 0.19 allowlist.
One table per consumer: folds, filter/filterSync, findSync, enrich and
join each reject every unsupported key with its exact message. join is
asserted against a branch spy to prove rejection happens before any
branch starts; enrich is asserted at construction, with no operation run.

The valid side is covered too: owned options keep working on every API,
series/mapSeries still accept the core run options untouched, and every
known key passed as undefined is not rejected.
Add an 'Unsupported options' section under shared behavior with an
options x consumer matrix marking the rejected cells, plus per-API notes
on filter, findSync, folds, enrich, join and the sync twins. The recover
messages stay documented as their own case; anchors are unchanged.
@ildella
ildella marked this pull request as ready for review November 24, 2026 15:56
@ildella
ildella merged commit ec31215 into master Nov 24, 2026
1 check passed
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.

1 participant