Skip to content

Add Override, to replace the task which provides a key - #6

Open
sengjea wants to merge 1 commit into
masterfrom
override-bindings
Open

sengjea wants to merge 1 commit into
masterfrom
override-bindings

Conversation

@sengjea

@sengjea sengjea commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Tasks often create things for themselves, such as clients of other services, which leaves a graph with no way to give it fakes in a test. An input wrapped in Override replaces the task providing its key, which does not run, instead of being a duplicate binding.

A plain input for a provided key is still an error, so a key is only ever replaced on purpose. Overriding a key no task provides, or only some of the keys a task provides, is an error too, as is overriding a key twice. An absent override replaces the task with a failure. Overrides are part of the Binder returned from Run, and inputs only a replaced task needed are no longer required. Graph.Check validates overrides.

Skipped tasks are not signalled by the tasks they depend on, which would otherwise block on a channel with no receiver.

taskgraphtest's Test and Suite take Overrides, those of a Test replacing those of its Suite for the same key.

Tasks often create things for themselves, such as clients of other
services, which leaves a graph with no way to give it fakes in a test.
An input wrapped in Override replaces the task providing its key, which
does not run, instead of being a duplicate binding.

A plain input for a provided key is still an error, so a key is only ever
replaced on purpose. Overriding a key no task provides, or only some of
the keys a task provides, is an error too, as is overriding a key twice.
An absent override replaces the task with a failure. Overrides are part
of the Binder returned from Run, and inputs only a replaced task needed
are no longer required. Graph.Check validates overrides.

Skipped tasks are not signalled by the tasks they depend on, which would
otherwise block on a channel with no receiver.

taskgraphtest's Test and Suite take Overrides, those of a Test replacing
those of its Suite for the same key.
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