Skip to content

JS API: Rename the u2 Component.run scope helper to runInScope - #4015

Merged
alex-aprm merged 1 commit into
masterfrom
claude/u2-run-collision
Aug 31, 2026
Merged

JS API: Rename the u2 Component.run scope helper to runInScope#4015
alex-aprm merged 1 commit into
masterfrom
claude/u2-run-collision

Conversation

@alex-aprm

Copy link
Copy Markdown
Collaborator

The failure

Compute and DevTools are the two remaining packages failing to build on this error (both via libraries/compute-utils):

libraries/compute-utils/old-views/src/function-view.ts(774,16)
TS2416: Property 'run' in type 'FunctionView' is not assignable to
        the same property in base type 'ViewBase'

The u2 refactor put a scope helper on the Component base:

run<T>(fn: () => T): T { return Scope.runWith(this.scope, fn); }

Every view and widget inherits it, so any subclass with its own run() stops matching.

Why rename this side rather than FunctionView

No signature satisfies both — a subclass may drop parameters but cannot return Promise<void> where the base returns T. One of the two names has to move, and publication status decides which:

version in repo on npm consequence of renaming
FunctionView.run (compute-utils) 1.46.9 1.46.9 published breaks callers outside this repo; also marked @stability Stable
Component.run (u2) unpublisheddatagrok-api on npm is 1.27.9 (pre-u2); @datagrok-libraries/u2 returns 404 costs nothing outside this repo

The new, unreleased, generically-named helper should yield to the released API.

Scope and precision

Every Component.run call passes an arrow, so .run(( selects them exactly. 52 call sites across 25 files, plus three error strings naming the helper.

The other run methods are deliberately untouched, checked by hand:

action.run(this)              runner.run(this.func, values, abort, …)
host.run(name)                host.run(DELETE)
_verbs.run(name)              action.run()

Verified afterwards that no .run(( remains and all six of the above survive.

Verification

function-view.ts compiled against the current js-api sources:

TS2416
before 1 — function-view.ts(774,16)
after 0

FunctionView.run() is unchanged, so compute-utils' public API is preserved.

Note on #4010

This also removes the need for the Tutorial.runstart() rename that already merged. I renamed on the consumer side there without checking npm — @datagrok-libraries/tutorials is published at 1.7.8, so that change did alter a published API. Impact is small in practice (external tutorials implement the protected _run() hook rather than calling run()), but Tutorial.run could be restored on top of this if the published name matters.

Generated with Claude Code

The u2 refactor put run<T>(fn) on the Component base. Every view and
widget inherits it, so any subclass with its own run() stopped matching
the base signature:

  TS2416: Property 'run' in type 'FunctionView' is not assignable to
  the same property in base type 'ViewBase'

That is what breaks the Compute and DevTools package builds, both via
FunctionView in libraries/compute-utils.

No signature satisfies both, so one of the two names has to move. It
should be this one. FunctionView.run is marked stability Stable and
ships in @datagrok-libraries/compute-utils 1.46.9 on npm, so renaming it
breaks callers outside this repo. Component.run is unpublished:
datagrok-api on npm is 1.27.9, which predates u2, and
@datagrok-libraries/u2 is not on npm at all. Renaming the helper costs
nothing outside this repository.

Every Component.run call passes an arrow, so `.run((` selects them
exactly. The other run methods are untouched, verified by hand:
action.run(this), runner.run(this.func, ...), host.run(name),
host.run(DELETE) and _verbs.run(name).

52 call sites across 25 files, plus three error strings that name the
helper.

Verified against function-view.ts compiled on the current js-api
sources: TS2416 at 774,16 before, none after, with FunctionView.run
left alone.

This also removes the need for the Tutorial.run rename that already
landed; Tutorial.run could be restored if the published name matters.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@alex-aprm alex-aprm added the claude Pull request created by claude label Aug 31, 2026
@alex-aprm
alex-aprm merged commit df99aba into master Aug 31, 2026
19 of 21 checks passed
@alex-aprm
alex-aprm deleted the claude/u2-run-collision branch August 31, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude Pull request created by claude

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant