Skip to content

fix: suppress control_after_generate when widget input is linked - #10219

Open
artokun wants to merge 5 commits into
Comfy-Org:mainfrom
artokun:fix/subgraph-promoted-control-after-generate
Open

artokun wants to merge 5 commits into
Comfy-Org:mainfrom
artokun:fix/subgraph-promoted-control-after-generate

Conversation

@artokun

@artokun artokun commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • When an external node is connected to a SubgraphNode input, suppress the interior's control_after_generate combo widget on the promoted view
  • The external node owns the value, so the interior control should not be active or visible

Problem

Promoted subgraph widgets (Int, seed, float) expose the interior node's control_after_generate widget regardless of connection state. When an external node drives the input, the user sees two independent controls — one on the external node and one on the promoted widget — with potentially conflicting modes (e.g. external is "fixed" but promoted shows "randomize").

Solution

Override linkedWidgets on PromotedWidgetView to return undefined when the corresponding SubgraphNode input has an active link. This hides the control combo from the promoted widget when the value is externally driven.

Video of Fix

Screen.Recording.2026-03-17.at.4.15.30.PM.mov

Test plan

┆Issue is synchronized with this Notion page by Unito

@coderabbitai

coderabbitai Bot commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Detects when a widget's value is driven by an external link (including subgraph-promoted inputs), prevents applying control widgets in those cases, omits controlWidget for linked slots in the Vue renderer, and adds unit and browser tests verifying control_after_generate behavior across direct and subgraph scenarios.

Changes

Cohort / File(s) Summary
Core logic
src/scripts/widgets.ts
Add SUBGRAPH_INPUT_ID and exported isControlExternallyDriven(node, targetWidget); integrate check into addValueControlWidgets to skip applying control widgets when the widget is externally driven, with traversal to resolve links that originate from subgraph inputs.
Renderer
src/renderer/extensions/vueNodes/components/NodeWidgets.vue
When slotMetadata?.linked is truthy, set SimplifiedWidget.controlWidget to undefined so linked/promoted inputs do not render a control widget.
Unit tests
src/scripts/widgets.test.ts
New Vitest suite for isControlExternallyDriven() covering no-link, direct-link, subgraph-interior with external link, and subgraph-interior without external link; uses testing Pinia and subgraph fixtures.
Browser tests
browser_tests/tests/subgraphControlAfterGenerate.spec.ts
New Playwright @subgraph spec exercising suppression and resumption of control_after_generate on nodes and subgraph interiors, validating unchanged values while linked and +1 increments after disconnecting and invoking afterQueued.
Config
knip.config.ts
Add src/zod.gen.ts to packages/ingest-types workspace entry list (now includes src/index.ts and src/zod.gen.ts).

Sequence Diagram(s)

sequenceDiagram
  participant UI as UI (Widget)
  participant Node as Node
  participant Graph as Graph
  participant Subgraph as SubgraphNode

  UI->>Node: render request → ask if control applies
  Node->>Graph: inspect input links for targetWidget
  Graph-->>Node: link info (none | direct | from SubgraphInput)
  alt link originates from SubgraphInput
    Node->>Subgraph: map link to promoted input / check parent links
    Subgraph-->>Node: external linkage present? (yes|no)
  end
  Node-->>UI: isControlExternallyDriven = true|false
  alt externally driven
    UI-->>UI: set controlWidget = undefined (omit control)
  else not externally driven
    UI-->>UI: attach controlWidget (apply control_after_generate)
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Poem

🐰 I hopped through nodes and followed strings,
I watched each seed and clipped its wings,
If links come in, I hide the fuss,
When freed — +1 hops back to us,
Tiny paws, syncing all the things 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The knip.config.ts change appears unrelated to the control_after_generate suppression objective and may represent scope creep outside the linked issue requirements. Clarify whether the knip.config.ts entry addition is intentional or accidental; consider moving it to a separate PR if unrelated to issue #10218.
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: suppressing control_after_generate when a widget input is linked externally.
Description check ✅ Passed The description includes summary, problem statement, solution, and test plan sections aligned with the template, though the template's 'What' and 'Breaking/Dependencies' fields are not explicitly formatted.
Linked Issues check ✅ Passed The PR addresses issue #10218 by adding logic to suppress control_after_generate when widget inputs are linked, implementing the core requirement to prevent conflicting controls on promoted subgraph widgets.
End-To-End Regression Coverage For Fixes ✅ Passed PR title contains bug-fix language ('fix'), introduces new Playwright test spec at browser_tests/tests/subgraphControlAfterGenerate.spec.ts covering control_after_generate suppression behavior with comprehensive E2E test scenarios.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

🎨 Storybook: loading Building...

@github-actions

github-actions Bot commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright: ⏳ Running...

@artokun
artokun marked this pull request as draft March 17, 2026 22:26
@artokun artokun changed the title fix: suppress control_after_generate on linked promoted widgets fix: suppress control_after_generate when widget input is linked Mar 17, 2026
@artokun
artokun marked this pull request as ready for review March 17, 2026 23:23

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@browser_tests/tests/subgraphControlAfterGenerate.spec.ts`:
- Around line 50-53: The current guard uses test.skip when setup is falsy which
masks failures; replace the test.skip(...) branches with an immediate test
failure by throwing an Error (e.g., throw new Error('Could not create Int
nodes') ) or calling the test runner's fail mechanism so the test fails fast;
update both occurrences that check the setup variable (the blocks using "if
(!setup) { test.skip(...)" ) to throw an Error with a clear message instead of
skipping.
- Around line 39-43: The test currently finds controlWidget via
targetWidget?.linkedWidgets?.find(...) and silently skips configuration if it's
missing; update the test to assert that controlWidget exists before mutating it
(e.g., throw or use your test framework's expect) so the test fails if the
'control_after_generate' linked widget isn't present; apply the same presence
assertion and configuration for the other occurrence around the code referenced
at lines 111-115. Ensure you reference the variables controlWidget,
targetWidget, linkedWidgets and the widget name 'control_after_generate' when
adding the assertion.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8758c4a1-5bca-4a2b-847f-5e936520eef0

📥 Commits

Reviewing files that changed from the base of the PR and between 3bd8963 and 778e6bc.

📒 Files selected for processing (4)
  • browser_tests/tests/subgraphControlAfterGenerate.spec.ts
  • src/renderer/extensions/vueNodes/components/NodeWidgets.vue
  • src/scripts/widgets.test.ts
  • src/scripts/widgets.ts

coderabbitai[bot]
coderabbitai Bot previously approved these changes Mar 17, 2026
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Mar 18, 2026
@artokun
artokun requested a review from a team March 18, 2026 03:31
@artokun
artokun force-pushed the fix/subgraph-promoted-control-after-generate branch from f8038f5 to 97c74e6 Compare March 20, 2026 00:32

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/scripts/widgets.ts (1)

82-82: Import the canonical subgraph-input constant instead of redefining -10.

LiteGraph already has an authoritative SUBGRAPH_INPUT_ID; duplicating the raw value here makes this check drift-prone if that constant ever changes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/scripts/widgets.ts` at line 82, Remove the locally redefined constant
"const SUBGRAPH_INPUT_ID = -10" and instead import the canonical
SUBGRAPH_INPUT_ID from the LiteGraph library where it is exported, then update
any uses to reference the imported symbol; this ensures you rely on the
authoritative constant (replace the local definition with an import of
SUBGRAPH_INPUT_ID and keep usages unchanged).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@browser_tests/tests/subgraphControlAfterGenerate.spec.ts`:
- Around line 9-87: Add a new test that reproduces the promoted-subgraph
regression by creating a promoted subgraph input, ensuring the
control_after_generate widget is present when unlinked, then linking an external
Int node to that promoted input and asserting the promoted input's
control_after_generate disappears (no control widget or controlConfigured
becomes false), then disconnect the link, run the promoted input's
widget.afterQueued (or call applyWidgetControl indirectly by awaiting
comfyPage.nextFrame and invoking widget.afterQueued), and assert the
control_after_generate reappears; use the same helpers/symbols from the file
(window.app!.canvas.graph!, LiteGraph.createNode, node.connect/disconnect,
widget.linkedWidgets, widget.afterQueued, comfyPage.nextFrame) and mirror the
existing test structure for setup, value checks, and assertions.

---

Nitpick comments:
In `@src/scripts/widgets.ts`:
- Line 82: Remove the locally redefined constant "const SUBGRAPH_INPUT_ID = -10"
and instead import the canonical SUBGRAPH_INPUT_ID from the LiteGraph library
where it is exported, then update any uses to reference the imported symbol;
this ensures you rely on the authoritative constant (replace the local
definition with an import of SUBGRAPH_INPUT_ID and keep usages unchanged).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 52abc167-734a-4086-8e92-611ceaa202d9

📥 Commits

Reviewing files that changed from the base of the PR and between 7ebc017 and 97c74e6.

📒 Files selected for processing (5)
  • browser_tests/tests/subgraphControlAfterGenerate.spec.ts
  • knip.config.ts
  • src/renderer/extensions/vueNodes/components/NodeWidgets.vue
  • src/scripts/widgets.test.ts
  • src/scripts/widgets.ts
✅ Files skipped from review due to trivial changes (1)
  • src/scripts/widgets.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/renderer/extensions/vueNodes/components/NodeWidgets.vue

coderabbitai[bot]
coderabbitai Bot previously approved these changes Mar 20, 2026
@artokun
artokun force-pushed the fix/subgraph-promoted-control-after-generate branch 5 times, most recently from e8b2bee to 8d5ac09 Compare March 26, 2026 16:36
@artokun

artokun commented Mar 26, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@artokun
artokun force-pushed the fix/subgraph-promoted-control-after-generate branch from 8d5ac09 to b7770a1 Compare March 27, 2026 13:29
@artokun

artokun commented Mar 27, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Mar 27, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@artokun
artokun force-pushed the fix/subgraph-promoted-control-after-generate branch from b7770a1 to 3d9d123 Compare March 30, 2026 14:03
@artokun

artokun commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@artokun
artokun force-pushed the fix/subgraph-promoted-control-after-generate branch 4 times, most recently from 7b89585 to 31cadfc Compare April 6, 2026 23:16
@artokun
artokun force-pushed the fix/subgraph-promoted-control-after-generate branch 6 times, most recently from 28222a4 to 1adfb6d Compare April 7, 2026 22:43
artokun added 5 commits April 13, 2026 09:33
When an external node is connected to a SubgraphNode input, the
promoted widget's control_after_generate combo should not be active
since the external node owns the value. The interior node's control
widget was being exposed via linkedWidgets delegation regardless of
connection state.

Fixes Comfy-Org#10218
Hide the control widget UI (NodeWidgets.vue) and skip its execution
(isControlExternallyDriven in widgets.ts) when the widget's input has
an active link. For subgraph interior nodes, traces the link chain
through SubgraphInput to the SubgraphNode to detect external links.

Fixes Comfy-Org#10218
…enerate

Exercises the subgraph boundary path in isControlExternallyDriven() by
converting a KSampler to a subgraph, linking an external Int node to
the promoted seed input, and verifying control_after_generate is
suppressed while linked and resumes after disconnect.
The rebase conflict resolution incorrectly took the pre-extraction
version. Restored main's refactored version which delegates to
useProcessedWidgets composable.
@artokun
artokun force-pushed the fix/subgraph-promoted-control-after-generate branch from 1adfb6d to 231c19a Compare April 13, 2026 16:36
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Apr 13, 2026

@mrseek-reviews mrseek-reviews Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: request changes. The new definition-wide ownership check freezes an unlinked sibling instance, and the promoted browser fixture does not create the seed boundary it asserts.

  • [P1] I reproduced the shared-definition regression through the production widget callback collector. A linked host stops an unlinked sibling's incrementing seed. Removing only the new guard makes the same check pass.
  • [P1] I traced the promoted browser arrangement to a missing seed input. It fails its external-link precondition before reaching the intended regression assertions.

The inline comments also cover nested ownership, the unimplemented presentation policy, test placement and discriminating cases, type/lookup simplifications, the lint failure, and the individual comment deletions.

Findings without an inline location
  • [P2] I found superseding ownership work in #15972, reviewed at its current head. Its widgetControlSystem collects link-fed host WidgetIds and skips those targets, and its nested-promotion tests advance only the authoritative outer host while preserving inner/source values. It removes the per-control callbacks this PR guards. Please coordinate the suppression and useful regressions there rather than preserve a second definition-wide control policy. I read its production and test patches; I did not execute a combined branch or prove a combined-build failure.
Existing feedback, independently checked
  • Confirmed: the canonical-constant finding remains open. constants.ts exports SUBGRAPH_INPUT_ID, and SubgraphInputNode uses it for the origin ID. The new local -10 declaration duplicates that contract. I would import the canonical constant rather than keep the copy.
  • Confirmed in part: the promoted-boundary test request now has a third case, but the conversion creates inputs from existing boundary links, not the unlinked seed widget. The new inline fixture finding explains why that case does not yet exercise the requested boundary.
  • Addressed: the control-existence request now has a controlConfigured assertion in all three cases. I agree with the author's response.
  • Addressed: the fail-instead-of-skip request now fails null setup before its narrowing return. I found no remaining skip and agree with the author's response.
Verification and limits

I reviewed this head against the actual PR base and installed this branch's frozen-lockfile dependencies.

  • pnpm dlx node@24 node_modules/vitest/vitest.mjs run src/scripts/widgets.test.ts passed all four tests.
  • Focused real-graph probes under Node 24 produced three failures and one passing lifecycle control. The nested linked seed changed from 42 to 43; the unlinked sibling stayed at 42; the linked promoted view still returned control_after_generate. Repeated connect/disconnect/reconnect behavior passed for one root-level instance.
  • The shared-instance probe passed when an in-memory transform removed only the new execution guard. That isolates the newly introduced freeze; it is not a claim that a full base build was tested.
  • pnpm exec playwright test --list subgraphControlAfterGenerate discovered three tests. I did not start a backend or execute browser tests in this review round. The seed-fixture failure is source-traced; visible rendering is traced from the real getter through getControlWidget to WidgetInputNumber, not browser-captured.
  • Scoped ESLint failed the browser fixture import. It ignores src/scripts, so I do not count that as a source lint pass. Default oxlint reported no issues on the one nonignored file; forcing coverage of the ignored source files could not load eslint-plugin-playwright, including under Node 24. Source lint remains unverified. Fallow is not available in this checkout.
  • The saved CI snapshot contained successful Socket checks, a skipped backport check, and a successful CodeRabbit status. It contained no successful required typecheck, lint, or regression-test result for this head. I did not trigger CI.
Coverage and consolidation

I ran standard-depth correctness, maintainability, and tests lanes over the entire three-file diff. All applicable standard specialist lenses ran, including history/regression analysis, real-consumer ownership probes, no-comments, type discipline, test-value/mocking analysis, Playwright structure/flakiness checks, and the requested Playwright-writing conventions. No lane or changed file was skipped. The comment inventory contains 21 blocks; each has its own deletion suggestion.

The REST overlap snapshot inspected all open PR file lists for the original contract set. I checked the relevant policy changes in #15972, #23187, #11364, #18448, #10227, and #10232, and the remaining matched hunks for conflicting behavior. Only #15972 supplied a confirmed superseding control policy. A supplemental scan for additional rendering/execution dependencies exhausted the ordinary GitHub quota before completing, so that expanded overlap check is incomplete. REST does not expose review-thread resolution state; I assessed every saved review comment instead of assuming resolved threads were absent.

I combined duplicate alias findings, the visibility-test gap with the presentation finding, the nested-test gap with the nested ownership defect, and raw browser-value accessor duplication with moving hook checks down to Vitest. I retained the separate wrong-slot and before-generation falsifiers. I rejected new comments about missing control preconditions and skipping because the current source contradicts those claims, as detailed above. No owner-authored feedback required a skill-gap report.

Comment on lines +190 to +192
const seedInputIndex = sgNode.inputs?.findIndex(
(inp: { name: string }) => inp.name === 'seed'
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Build a seed boundary before connecting the external Int

I traced this conversion against the default workflow. The KSampler's seed is an unlinked widget, while conversion builds subgraph inputs from existing boundary links. Auto-promoting that widget does not create a seed boundary input or an interior SubgraphInput → seed link. This lookup therefore returns -1, the connection below is skipped, and hasExternalLink fails before any suppression assertion runs. This is source-traced, not a browser-run result.

Please replace this arrangement with a minimal workflow asset containing the real interior boundary link and corresponding host input. Keep the hard setup assertions. This requires a JSON asset and spec changes, so I cannot supply a self-contained inline replacement.

Comment thread src/scripts/widgets.ts
Comment on lines +123 to +129
for (const parentNode of rootGraph._nodes) {
if (
parentNode.isSubgraphNode?.() &&
parentNode.subgraph === graph
) {
const sgNodeInput = parentNode.inputs?.[i]
if (sgNodeInput?.link != null) return true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] Keep control ownership specific to the current subgraph instance

I reproduced a regression with two instances of the same subgraph definition: one input is linked and the other is unlinked with increment selected. executeWidgetsCallback(collectAllNodes(rootGraph), 'afterQueued', {}) now leaves the unlinked host's value at 42. Removing only this new guard in memory makes that same check pass. This scan returns true as soon as any host is linked, so an unrelated sibling disables local control too.

Please resolve ownership and update the authoritative value for the current host/path, and retain a regression with one linked and one unlinked instance. Replacing the condition with an all-hosts check would still mix the two instances. I cannot give a self-contained suggestion because the callback/execution context and the host-owned value update span files.

@@ -0,0 +1,299 @@
import { expect } from '@playwright/test'

import { comfyPageFixture as test } from '../fixtures/ComfyPage'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Use the required E2E fixture alias

The scoped ESLint run fails here with no-restricted-imports: browser tests must use the @e2e/ alias.

Suggested change
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
import { comfyPageFixture as test } from '@e2e/fixtures/ComfyPage'

Comment on lines +62 to +67
await comfyPage.page.evaluate((id) => {
const node = window.app!.canvas.graph!.getNodeById(id)
for (const widget of node?.widgets ?? []) {
widget.afterQueued?.({})
}
}, setup.targetId)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Move hook-only execution checks to the existing Vitest suite

These browser cases invoke afterQueued themselves, so they exercise neither queue dispatch nor control rendering. The same real graph objects and control constructors can prove linked suppression and disconnect restoration in widgets.test.ts. The current four unit cases only test classification and stay green if the new execution guard is deleted. Three frontend boots and an extra workflow load do not add browser-specific evidence here.

Move the direct and promoted hook outcomes to Vitest, delete the two hook-only browser cases, and keep one real promoted hide/disconnect/show UI composition. That also removes the four raw root-widget readers duplicating NodeReference.getWidget / NodeWidgetReference.getValue; use those accessors if a root-value read remains in the UI case. This relocation spans test files and needs real fixture construction, so I cannot provide a self-contained line substitution.

resetSubgraphFixtureState()
})

describe('isControlExternallyDriven', () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Include one before-generation composition check in the hook coverage

All new execution assertions call afterQueued. Moving the guard into only that hook would pass them while allowing linked seeds to change for Comfy.WidgetControlMode='before'. The four classifier tests do not construct either execution hook.

When moving the real hook outcomes into this suite, add one before-mode row. Invoke the initial before hook to pass its intentional first-generation skip, then verify a later linked call leaves the value unchanged and disconnect restores incrementing. No topology × mode cross-product is needed. The real setting/control fixture and the browser-to-unit relocation span files, so this needs more than an inline substitution.

Comment thread src/scripts/widgets.ts
// Check if the link originates from a SubgraphInputNode
const link = graph._links?.get(input.link) ?? graph.links?.[input.link]
if (!link || link.origin_id !== SUBGRAPH_INPUT_ID) {
// Regular node with a direct external link — externally driven

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Nit: Remove this redundant comment

I would delete this narration. The comment repeats the function result for the branch. The repository asks for this information in names and executable behavior rather than parallel prose.

Suggested change
// Regular node with a direct external link — externally driven

Comment thread src/scripts/widgets.ts
Comment on lines +110 to +111
// Interior node linked to SubgraphInput — check whether the
// SubgraphNode's corresponding input has an external link.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Nit: Remove this redundant comment

I would delete this narration. The block narrates the following Subgraph input and parent input lookup. The repository asks for this information in names and executable behavior rather than parallel prose.

Suggested change
// Interior node linked to SubgraphInput — check whether the
// SubgraphNode's corresponding input has an external link.

Comment thread src/scripts/widgets.ts
// Interior node linked to SubgraphInput — check whether the
// SubgraphNode's corresponding input has an external link.
if (!graph.isRootGraph && 'inputs' in graph) {
// graph is a Subgraph; find SubgraphInput slot index from link

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Nit: Remove this redundant comment

I would delete this narration. The comment says graph is a Subgraph while the next line casts a hand-declared shape. The repository asks for this information in names and executable behavior rather than parallel prose.

Suggested change
// graph is a Subgraph; find SubgraphInput slot index from link

Comment thread src/scripts/widgets.ts
for (let i = 0; i < subgraphInputs.length; i++) {
const sgInput = subgraphInputs[i]
if (sgInput.linkIds?.includes(link.id)) {
// Found the SubgraphInput slot — check parent SubgraphNode instances

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Nit: Remove this redundant comment

I would delete this narration. The comment repeats the membership condition and following parent loop. The repository asks for this information in names and executable behavior rather than parallel prose.

Suggested change
// Found the SubgraphInput slot — check parent SubgraphNode instances

Comment thread src/scripts/widgets.ts
Comment on lines +236 to +239
// Skip when the widget's value is driven by an external link.
// For regular nodes: input has a non-subgraph link.
// For subgraph interior nodes: trace up to the SubgraphNode and
// check if its corresponding input has an external link.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P3] Nit: Remove this redundant comment

I would delete this narration. Four lines repeat what the named isControlExternallyDriven guard encapsulates. The repository asks for this information in names and executable behavior rather than parallel prose.

Suggested change
// Skip when the widget's value is driven by an external link.
// For regular nodes: input has a non-subgraph link.
// For subgraph interior nodes: trace up to the SubgraphNode and
// check if its corresponding input has an external link.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Promoted subgraph widget doesn't mirror control_after_generate from source

3 participants