Skip to content

fix: keep GSConnect loading on GNOME 51 (clipboard final-type) - #89

Merged
hanthor merged 1 commit into
projectbluefin:mainfrom
mrbobbytables:fix/gsconnect-gnome51-clipboard
Sep 18, 2026
Merged

hanthor merged 1 commit into
projectbluefin:mainfrom
mrbobbytables:fix/gsconnect-gnome51-clipboard

Conversation

@mrbobbytables

Copy link
Copy Markdown
Contributor

Summary

Resolves #88.

On GNOME 48+ and GNOME 51 (GJS 1.84+), GjsPrivate.DBusImplementation is a final GType. In GSConnect's vendored extension code (src/shell/clipboard.js:64), registering GSConnectShellClipboard as a subclass of GjsPrivate.DBusImplementation throws:

Cannot inherit from a final type

Because extension.js imports clipboard.js at module load, this exception aborts extension initialization and leaves GSConnect in State: ERROR instead of ACTIVE.

Solution

In scripts/build-gnome-extensions.sh, patch GSConnect's src/shell/clipboard.js before meson install by wrapping the class registration in a try/catch block. If GjsPrivate.DBusImplementation cannot be subclassed, it degrades gracefully to an inert portal stub (Clipboard = class { destroy() {} }) and logs a warning, allowing GSConnect to load cleanly and enter ACTIVE state. Verify that the installed extension in shell/clipboard.js contains the guard.

Also:

  • Documented the GSConnect GNOME 51 clipboard guard in docs/skills/desktop-contract.md and regenerated the skill catalog.
  • Added unit tests in tests/test_gnome_extensions.py.

Validation

  • just check passes with all 21 unit tests.
  • just check-parity passes.
  • pre-commit run --all-files passes.
  • Validated JavaScript syntax with node --check.

— hive: backend=copilot model=gemini-3.8-flash

🐝 Hive Agent: contributor | SHA: e9a220d

On GNOME 48+ / GNOME 51, GjsPrivate.DBusImplementation became a final
GType. GSConnect's shell/clipboard.js registers GSConnectShellClipboard
as a subclass of GjsPrivate.DBusImplementation, throwing "Cannot inherit
from a final type" during module load. This causes the entire extension
to fail initialization and enter ERROR state instead of ACTIVE.

Wrap GSConnectShellClipboard class registration in try/catch in
scripts/build-gnome-extensions.sh, falling back to an inert portal stub.
Verify after meson install that the installed clipboard.js carries the
guard. Update desktop-contract skill documentation and skill catalog,
and add unit tests in tests/test_gnome_extensions.py.

Fixes projectbluefin#88

Assisted-by: Gemini 3.8 Flash via GitHub Copilot
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: mrbobbytables <mrbobbytables@users.noreply.github.com>

@hanthor hanthor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The failure-gated approach is the right call — a try/catch around registerClass rather than a GNOME version check means nothing is dropped on shells where DBusImplementation is still subclassable, and the fallback's surface (destroy()) matches the only two uses in the module (new Clipboard() in watchService, _portal.destroy() in the vanish handler). extension.js imports the namespace, not the class, so the stub cannot leak out of shell/clipboard.js. I ran the extracted heredoc against the real pinned submodule (dd1349de, matching .gitmodules) and it applies cleanly.

Three things before this lands.

1. The node --check in the new test does not check what it looks like it checks.

The test writes the patched output to clipboard.js and runs node --check on it. Node parses a .js file as ambiguous/CommonJS and does not resolve ESM export bindings, so a structurally broken module passes. If I mutate the patch so it emits let _unused_Clipboard; while still assigning to Clipboard, both new tests stay green. The same bytes named .mjs:

$ node --check clipboard.mjs
export { Clipboard };
         ^^^^^^^^^
SyntaxError: Export 'Clipboard' is not defined in module

The correctly patched file passes as .mjs. Please name the temp file clipboard.mjs (or pass --input-type=module) — that turns a decorative assertion into a real one.

2. The same final-type subclass exists in two files this PR does not patch.

src/service/utils/dbus.js:60  class Interface extends GjsPrivate.DBusImplementation
src/wl_clipboard.js:60        class GSConnectShellClipboard extends GjsPrivate.DBusImplementation

(components/notification.js only instantiates DBusImplementation, which is fine for a final type.)

utils/dbus.js is imported by service/manager.js, plugins/mpris.js and components/notification.js — that is the GSConnect daemon, running under the same GJS as the shell. If DBusImplementation really is final on GJS 1.84, that module throws on load too, and the extension reaching State: ACTIVE would be a false green while device pairing and MPRIS stay broken. If the daemon is known to work on GNOME 51, then the premise needs re-stating, because the two cases should behave the same.

Could you say which you observed? A journal excerpt from the gsconnect daemon on a GNOME 51 box would settle it.

3. Worth stating in the commit message: on GNOME 51 the catch branch is always taken.

This is not a rare degradation on exotic shells — on Utah's shipping platform it is the default path, so clipboard sync through the shell portal is off for every user, announced only by a console.warn in the journal. That may well be the right trade against a dead extension, but "keep GSConnect loading" undersells it; the body should say clipboard sync is disabled on GNOME 48+.

Minor: the patch is not idempotent — a second run exits 1 with no longer matches expected DBusImplementation class structure. Fail-loud and the container build runs once, so this is fine as-is; just noting it in case the script ever gets re-entered.

Test counts I measured: base 3162105 → Ran 19 tests … OK; this PR → Ran 21 tests … OK (skipped=1). The skip is the submodule-gated test; just check inits submodules first so it does run in CI. With the submodule populated locally, both new tests pass.


Generated by Claude Code

@hanthor hanthor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Re-checked against today's main (a851627): this now merges clean and touches only build-gnome-extensions.sh, its test, and the skill doc — the live-kernel.py revert that #94's review flagged is gone, so that concern is closed.

The fix itself is the right shape for a vendored extension: the patch is anchored on both the class opener and the exact closing lines, refuses loudly if upstream moves them (a submodule bump can't silently drop it), and the install step asserts the guard is present in the installed shell/clipboard.js. Degrading the clipboard portal to an inert object is the honest fallback — GjsPrivate.DBusImplementation is final on GJS 1.84+, so there is no subclass to register, and the alternative is the whole extension in State: ERROR, which is what run 35159067119 shows today.

This is the first half of getting the LUKS E2E green (#88); #94 then reports search-light in the same run, and #46 is its guard.


Generated by Claude Code

@hanthor
hanthor merged commit 68d0432 into projectbluefin:main Sep 18, 2026
castrojo pushed a commit that referenced this pull request Sep 18, 2026
* test(e2e): report every failing extension, not just the first

The six-phase LUKS end-to-end test has never passed in CI -- seven runs,
every one red -- and run 35159067119 shows it clears all six phases and dies
on one assertion:

    extension gsconnect@andyholmes.github.io: state=ERROR
    gnome-shell[2744]: Extension gsconnect@andyholmes.github.io:
      Error: Cannot inherit from a final type
    FAIL: extension gsconnect@andyholmes.github.io did not reach ACTIVE

That is the GNOME 51 break #88 describes, and PR #89 fixes it. The problem
this commit addresses is what happens next: the loop called fail() on the
first bad extension, so search-light was never evaluated. Its guard (PR #46,
open since 2026-09-06) is also absent from main, so it is very likely broken
too -- and the way the test is written, the only way to find out is to fix
GSConnect, wait another ~35 minutes, and be told about the second one.

This is the same shape as the failures 718d4e4 and 60e6a6e kept hitting in
the factory: each defect hidden behind the one before it, one full run per
layer. A check whose job is to report what is broken should report all of it.

The loop now records each failure and continues, prints them together, and
fails once with the count. Unreadable state stays fatal for the reason the
existing comment gives -- a check that cannot run reads as green, and did
exactly that once. Per-extension screenshot names so two failures in one run
do not overwrite each other's evidence.

Nothing is weakened: every case that failed before still fails. Verified by
splicing the real block into a harness with stubbed helpers and driving all
four states -- both ACTIVE exits 0; both ERROR reports both and exits 1; one
ERROR reports that one and exits 1; unreadable reports both and exits 1.
23 unit tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6BYLUD6KBzF8rBFXKjP7M

* Drop the Search Light extension, which GNOME 51 cannot load

The ISO end-to-end test has failed on utah and utah-nvidia since GSConnect
was fixed, on the next extension in line:

    Extension search-light@icedman.github.com:
      TypeError: this.set_shader_source is not a function
    FAIL: extension search-light@icedman.github.com did not reach ACTIVE
      on GNOME 51 (state=ERROR)

GNOME 51 removed the Clutter shader API the extension's blur effect calls.
Rather than carry a fork of the effect, the extension goes: the submodule,
its schema compile in build-gnome-extensions.sh, its entry in the source
and installed extension checks, and its uuid in the e2e default list.

Common still ships /etc/dconf/db/distro.d/05-bluefin-searchlight-extension,
which holds only the extension's own settings (shortcut, colours, size), so
the Containerfile removes it after copying Common in and the desktop
contract no longer lists it. Nothing enables the extension anywhere in this
tree, so no enabled-extensions key changes.

just check's source-mode extension contract now reports eight extensions
declaring GNOME 51.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6BYLUD6KBzF8rBFXKjP7M

* Give the OGC kernel a KMS display, so gaming flavors reach a desktop

The gaming and nvidia-gaming ISO end-to-end runs fail earlier than the
extension check, in the live session:

    graphical.target: active
    gdm.service: active
    FAIL: no gnome-shell running for liveuser

with a black screenshot. The two serial logs explain it. main's kernel
prints

    [drm] Initialized simpledrm 1.0.0 for simple-framebuffer.0 on minor 0

and the OGC kernel (7.1.8-ogc1) prints no [drm] Initialized line at all.
install-ogc-kernel.sh starts from x86_64 defconfig, which enables DRM and
i915 only, so on any GPU that is not an Intel iGPU, QEMU's stdvga included,
the kernel has no KMS device. GDM starts, mutter has nothing to open, and
no shell ever runs. The installed system would behave the same way.

The script now enables SYSFB_SIMPLEFB and DRM_SIMPLEDRM, which turn the
EFI/VESA framebuffer into an unaccelerated KMS device on any hardware, and
DRM_VIRTIO_GPU and DRM_BOCHS as modules for VMs. DRM_SIMPLEDRM joins the
required_config list checked after olddefconfig, after install and on
cache extraction, with a require_config gate that names it if olddefconfig
drops it. Editing the script changes the kernel-cache tag, so CI rebuilds
the cache before the next gaming image.

Native drivers for real gaming GPUs (amdgpu, xe) are left out on purpose:
they need linux-firmware in the image, which #97 records as missing. The
kernel-cache skill records the diagnosis and where to look first.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W6BYLUD6KBzF8rBFXKjP7M

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

fix: GSConnect clipboard fails to load on GNOME 51

2 participants