topoSort skipped a dependency whose producer was the node itself, so a step with needs: ['user'] and provides: ['user'] booted and read, at request time, a value nobody had written. That need now counts as missing unless the token is seeded (req, params).
How it interacts with CARD-18 (GitHub #35). The issue says "unless the token is seeded or provided by another node". Since the one-producer rule, the second half cannot happen: another node providing the token fails boot as provided twice first. So the only exemption left is a seed. A seeded self-need (e.g. a step that needs and provides params) still boots, because the step reads the seed from the context before its output is merged over it.
Overrides. They do not exempt the node. applyOverrides runs after finalizeGraph, and only replaces a runner, so the graph check sees the same node. A test overriding a self-dependent node now fails boot too, which I think is right (production would fail the same way), but it is a judgement call worth a look.
Breaking. Apps with such a node now fail createApp. CHANGELOG entry at the end of ### Breaking, with the migration step: drop the token from the node's needs, or move the producing work into a separate provider or step.
Tests: test/graph.test.ts (self-dependency throws unless seeded) and test/one-producer.test.ts (app-level, with and without an override). Both failing tests failed on develop and pass with the fix.
Fixes GitHub #43.
`topoSort` skipped a dependency whose producer was the node itself, so a step with `needs: ['user']` and `provides: ['user']` booted and read, at request time, a value nobody had written. That need now counts as missing unless the token is seeded (`req`, `params`).
**How it interacts with CARD-18 (GitHub #35).** The issue says "unless the token is seeded or provided by another node". Since the one-producer rule, the second half cannot happen: another node providing the token fails boot as `provided twice` first. So the only exemption left is a seed. A seeded self-need (e.g. a step that needs and provides `params`) still boots, because the step reads the seed from the context before its output is merged over it.
**Overrides.** They do not exempt the node. `applyOverrides` runs after `finalizeGraph`, and only replaces a runner, so the graph check sees the same node. A test overriding a self-dependent node now fails boot too, which I think is right (production would fail the same way), but it is a judgement call worth a look.
**Breaking.** Apps with such a node now fail `createApp`. CHANGELOG entry at the end of `### Breaking`, with the migration step: drop the token from the node's `needs`, or move the producing work into a separate provider or step.
Tests: `test/graph.test.ts` (self-dependency throws unless seeded) and `test/one-producer.test.ts` (app-level, with and without an override). Both failing tests failed on develop and pass with the fix.
Ran: lint (0 errors), format:check, typecheck, `npm test` (1163 passed), complexity:check, test:deno (63 passed), test:bun (52 passed), test:edge (PASS).
topoSort validated each need with producedBy.has(key), and the visit
skipped a dependency whose producer was the node itself. So a step with
needs: ['user'] and provides: ['user'], and nothing else providing user,
passed the graph check and booted. At request time it read a value
nobody had written, where every other missing dependency fails at boot.
The check now treats a node's own token as missing unless it is seeded.
The issue also allowed "provided by another node", but since CARD-18
(GitHub #35) a token has exactly one producer, so a second node that
provides it fails boot on its own; the self-producer is the only
producer there can be. A seeded token (req, params) still satisfies the
need, because the step reads the seed from the context before its
output is merged over it. The visit keeps skipping the node itself for
that case, so it is not reported as a cycle.
overrides do not exempt the node. They replace a runner after
finalizeGraph has run topoSort, and change no needs, so the graph check
sees the same node either way.
BREAKING CHANGE: an app with a node that needs a token only it
provides now fails createApp with "missing dependency: <token> needed
by <node> — it provides '<token>' itself". Remove the token from the
node's needs, or move the work that produces it into a separate
provider or step.
Refs: GitHub #43
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
A node that needs the token it provides is a cycle of one, so say so in
the same words as every other cycle (`cycle detected: a -> a`), and name
the token and the fix:
cycle detected: auth -> auth (it needs 'user', which only it provides).
Remove 'user' from its needs, or move the work that produces 'user'
into a step it needs.
"missing dependency … it provides it itself" pointed the reader at a
missing producer, when the producer is there and the problem is the
loop.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes GitHub #43.
topoSortskipped a dependency whose producer was the node itself, so a step withneeds: ['user']andprovides: ['user']booted and read, at request time, a value nobody had written. That need now counts as missing unless the token is seeded (req,params).How it interacts with CARD-18 (GitHub #35). The issue says "unless the token is seeded or provided by another node". Since the one-producer rule, the second half cannot happen: another node providing the token fails boot as
provided twicefirst. So the only exemption left is a seed. A seeded self-need (e.g. a step that needs and providesparams) still boots, because the step reads the seed from the context before its output is merged over it.Overrides. They do not exempt the node.
applyOverridesruns afterfinalizeGraph, and only replaces a runner, so the graph check sees the same node. A test overriding a self-dependent node now fails boot too, which I think is right (production would fail the same way), but it is a judgement call worth a look.Breaking. Apps with such a node now fail
createApp. CHANGELOG entry at the end of### Breaking, with the migration step: drop the token from the node'sneeds, or move the producing work into a separate provider or step.Tests:
test/graph.test.ts(self-dependency throws unless seeded) andtest/one-producer.test.ts(app-level, with and without an override). Both failing tests failed on develop and pass with the fix.Ran: lint (0 errors), format:check, typecheck,
npm test(1163 passed), complexity:check, test:deno (63 passed), test:bun (52 passed), test:edge (PASS).9420f3feebto0ba15b7862