Skip to content

Add check-shell-api and fix the stale declarations - #154

Open
JumpLink wants to merge 8 commits into
mainfrom
feat/check-shell-api
Open

JumpLink wants to merge 8 commits into
mainfrom
feat/check-shell-api

Conversation

@JumpLink

@JumpLink JumpLink commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Stacked on #147, so the diff is the five commits here.

A declaration can outlive the thing it describes: upstream drops a member, the .d.ts still compiles, and it now describes a shell nobody runs. The compiler cannot see that. This adds check-shell-api, which compares every .d.ts with the matching js/ file of a gnome-shell checkout at a tag and fails on what is declared but gone. It is the script behind #147, as @Totto16 suggested there. The last two commits fix everything it finds, so it passes.

git clone --depth 1 --branch 51.beta https://gitlab.gnome.org/GNOME/gnome-shell.git /tmp/gnome-shell
yarn check:shell-api --shell /tmp/gnome-shell --tag 51.beta
yarn test:shell-api

The script (commits 1 and 2)

  • It parses both sides with the TypeScript compiler API, syntax only. typescript is already a dev dependency, and a run takes about two seconds.
  • Members count as defined wherever upstream defines them in the file: class body, this.x = …, GObject properties. A base class and its subclasses are not told apart, because the declarations often flatten them.
  • Findings are split into public and private (leading underscore), public first.
  • It fails on every finding. ignore.json holds the script's own mistakes, each with the reason.
  • It compares names, not signatures, and finds what went stale, not what nobody declared yet (Add report-shell-api and export as type only what the shell keeps private #158). Exports are skipped unless you pass --exports: several .d.ts files export classes that upstream keeps private, and removing an export breaks consumers.

The fixes (commits 3 and 4)

At 51.beta it found 53 declarations in 17 modules, 18 of them public. I checked each against the upstream source: 29 names appear nowhere in js/, and for the other 24 the only hits are in other modules.

39 members are removed: loginManager.canSuspend/suspend (they live in systemActions now), 11 members of _Draggable (the drag moved to a gesture), the Switch motion and release vfuncs, altTab.init/onDestroy (upstream: _init, _onDestroy), and helpers in closeDialog, components, iconGrid, mpris and five status/* modules.

Classes and a file are removed in a separate commit, since it changes what a consumer can import. None of it exists at 51.beta, so an import only moves its error from runtime to the compiler: Animation and AnimatedIcon (Spinner is a plain St.Widget now), and components/telepathyClient with its entry in package.json.

Replacements are not in here. Where upstream moved a handler, the new member is not declared: the script finds what was lost, not what was added.

Checked

11 unit tests, build, type validation, example and prettier:check pass, and check:shell-api reports nothing at 51.beta.

@JumpLink
JumpLink requested review from Totto16 and schnz as code owners October 6, 2026 07:24
@JumpLink
JumpLink added this pull request to stack #146 October 6, 2026 07:36
@JumpLink
JumpLink marked this pull request as draft October 6, 2026 09:09
@JumpLink
JumpLink marked this pull request as ready for review October 6, 2026 11:37
@JumpLink JumpLink changed the title Add check-shell-api to find stale declarations Add check-shell-api and fix the stale declarations Oct 6, 2026
@JumpLink
JumpLink force-pushed the feat/check-shell-api branch from 3f6d542 to c39a352 Compare October 6, 2026 13:15
GNOME 51 moves event handling off actor vfuncs and onto Clutter actions,
gestures and key binding pools. The shell classes stopped overriding
`vfunc_*_event` and grew signal handlers instead. Those vfuncs still
exist on `Clutter.Actor`, so nothing fails to compile. The declarations
just stopped describing the shell.

Checked against gnome-shell at tag 51.beta, module by module, for every
declared name that changed between 50.4 and 51.beta:

  appDisplay    BaseAppView/AppDisplay._onScroll now takes the
                ScrollController signal arguments; _onKeyPressEvent is a
                binding pool closure
  boxpointer    _muteKeys is a KeyController, _muteInput a ClickGesture
  calendar      vfunc_scroll_event -> _onScroll
  dialog        vfunc_event -> KeyController
  layout        HotCorner.vfunc_leave_event is gone
  messageList   URLHighlighter motion/leave -> MotionController;
                Message.vfunc_key_press_event -> _closeIfAllowed
  messageTray   _onNotificationKeyRelease -> binding pool
  modalDialog   vfunc_captured_event is gone
  search        new exported SearchEntry with activate-new-instance
  slider        scroll/key vfuncs -> _onScroll, _moveLeft, _moveRight
  backlight     SliderItem forwards vfunc_navigate_focus
  volume        _handleScrollEvent -> _onScroll + _handleScroll
  switcherPopup key/scroll vfuncs -> _onKeyPress, _onModifierChange,
                _onScroll
  userWidget    new showAvatar/hideAvatar

Everything added here carries `@version 51`, including the handlers
whose arguments 51 reshaped.
Checking these modules against 51.beta turned up a second group. These
names are absent at 50.4 as well, so gnome-shell dropped them in an
earlier cycle and they describe an API no supported shell has.

  appFavorites  _onFavsChanged
  calendar      _dndSwitch, _dndButton and the DoNotDisturbSwitch class
                behind them (the switch moved to quick settings)
  layout        HotCorner._entered, _onCornerEntered, _onCornerLeft,
                _setupFallbackCornerIfNeeded, _pendingLoadBackground
  messageList   URLHighlighter button press/release vfuncs,
                NotificationMessage._getIcon/_onUpdated,
                MediaMessage._secondaryBin/_closeButton
  messageTray   _onNotificationShow
  popupMenu     _motionEvent, _touchDragging
  search        _onPan
  slider        button press/release and touch vfuncs, startDragging,
                _endDragging, _motionEvent, scroll
  switcherPopup vfunc_button_press_event

Slider gains `step(nSteps)` in the same pass. It replaced
`scroll(event)`, `status/volume` calls it, and it was never declared. It
predates 51, so it carries no `@version` tag.

Only modules that GNOME 51 touched are in scope here. The rest of the
package has more of this; the PR description lists it.
Both are wrong at 50.4 as well, so neither is a 51 change. The new
check-shell-api script reported them.

  layout         Monitor.geometryScale is geometry_scale
  switcherPopup  itemEnteredHandler and itemRemovedHandler carry the
                 underscore: _itemEnteredHandler, _itemRemovedHandler
Compares every .d.ts with the matching js/ file of a gnome-shell
checkout at a tag and reports members, classes and files upstream no
longer has. The compiler cannot see these: a dropped member still
type-checks, it just describes a shell nobody runs.

Both sides are parsed with the TypeScript compiler API, syntax only,
so no new dependency. The 53 findings that are known today at 51.beta
sit in a baseline that can only shrink; findings the script gets wrong
go in ignore.json with the reason.

It compares names, not signatures. See scripts/check-shell-api/README.md
for the rules and the limits.
Found by check-shell-api and each one confirmed absent from the js/
file at 51.beta, and from the whole js/ tree where the name is unique.
Most were dropped in earlier cycles, so no supported shell has them.

  loginManager   canSuspend, suspend on both login managers (now in
                 systemActions)
  systemActions  _loginManager
  altTab         onDestroy, init
  closeDialog    _tracked, _onFocusChanged
  components     _sessionUpdated
  dnd            _Draggable pointer and grab handling, fakeRelease,
                 startDrag (the drag moved to a gesture)
  iconGrid       _childAdded, _childRemoved
  mpris          allowed
  popupMenu      Switch motion and release vfuncs, ignoreRelease
  status/*       accessibility _buildItemExtended, brightness slider
                 members, network connectivity helpers, remoteAccess
                 vfunc_event, thunderbolt _source and _ensureSource

The baseline shrinks to the class and file removals of the next commit.
Three findings were the script's own mistake and are ignored with the
reason: the package's components barrel file, and global and config,
which no js file defines.
Separate from the member removals because this changes what consumers
can import. None of it exists at 51.beta, so an import only moves its
failure from runtime to the compiler.

  animation   Animation and AnimatedIcon are gone; Spinner is a plain
              St.Widget with a constructor, vfunc_map, play and stop
  components  telepathyClient was dropped upstream ("components: Drop
              telepathy client"), with its export in package.json

The baseline is now empty: check-shell-api finds nothing at 51.beta.
The stale declarations are fixed in this PR, so nothing is left to
track. --tag is required now that no baseline names it.
@JumpLink
JumpLink force-pushed the feat/check-shell-api branch from c39a352 to ec305f3 Compare October 6, 2026 13:18
Base automatically changed from fix/gnome-51-api-drift to main October 21, 2026 13:26
@Totto16

Totto16 commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

The stack needs to be rebased, but as already said earlier, GitHub stacks are not really 100% production ready, If i try to checkout the stack locally, it doesn't work as i need the branch chore/version-to-since but as I never fetched it and the closing of #156 somehow deleted the reference to this branch, I can't get that git ref xD, so only people who already have the branch from #156 can work on rebasing this stack 😂

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants