Galaxy Shell / docs
Docs / Decisões e planos

Inverted sphere view of the canvas

openspec/specs/inverted-sphere-view/spec.md · Editar no GitHub ↗

Esta página ainda não tem tradução em português. O conteúdo abaixo está em inglês.

Este documento registra decisões, planejamento ou evidências de uma etapa do projeto. Não implica que todos os itens estejam implementados ou validados na versão atual.

Nesta página

Inverted sphere view of the canvas

Purpose

Defines the protected canvas lens setting canvasWarp (off or cylinder), its route, compositor command, lease and rollback, which draws the Canvas through a warped view without moving any window.

Requirements

Requirement: Only the protected settings set canvasWarp

Only the protected settings SHALL set the protected setting canvasWarp ({mode: off|cylinder, angle: 20..90}, off by default) through /api/canvas-warp, and the core SHALL refuse sphere until phase 4 (not landed; the rule binds already). Full text: section Binding contract (from AGENTS.md).

Scenario: Only the protected settings set canvasWarp

  • WHEN a request sets canvasWarp mode to sphere
  • THEN the core refuses it

Requirement: Command canvas_warp and the lease

The core SHALL send the compositor command canvas_warp (capabilities.canvasWarp), which is also a lease: the compositor SHALL turn the warp off 60 s after the last connection that sent it closes. Full text: section Binding contract (from AGENTS.md).

Scenario: Command canvas_warp and the lease

  • WHEN the last connection that sent canvas_warp closes and none sends it again within 60 s
  • THEN the compositor turns the warp off

Requirement: Input follows the drawn lens

Input and visibility SHALL follow the lens of the last drawn frame; in phase 1 a press on a warped window SHALL only focus it. Full text: section Binding contract (from AGENTS.md).

Scenario: Input follows the drawn lens

  • WHEN the user presses on a warped window in phase 1
  • THEN the press only focuses the window

Requirement: No agent reach

No agent tool, scheduled turn, generated HTML or isolated plugin panel SHALL reach the setting, the route or the command. Full text: section Binding contract (from AGENTS.md).

Scenario: No agent reach

  • WHEN an agent tool or generated HTML tries to change canvasWarp
  • THEN it cannot reach the setting, the route or the command

Requirement: Turn the setting off before a rollback

The setting SHALL be turned off before a rollback of the core or the compositor, and before reverting a phase; no saved field or layout depends on the warp or the ring. Full text: section Binding contract (from AGENTS.md).

Scenario: Turn the setting off before a rollback

  • WHEN a rollback of the core or the compositor is planned
  • THEN canvasWarp is turned off first, so the next frame draws flat and the next pointer event maps flat

Requirement: Command validation and lock

The compositor command canvas_warp SHALL refuse an unknown mode and an angle out of range, SHALL move no window, and while locked SHALL be accepted only with a mode other than off, so a core that restarts behind the lock renews the warp and a change to off waits for the unlock. Full text: section Setting, commands, lease and version skew.

Scenario: Command validation and lock

  • WHEN the screen is locked and the core sends canvas_warp with mode off
  • THEN the compositor does not accept it until the unlock

Requirement: Snapshot validation

validState SHALL refuse a canvasWarp capability that is not a boolean, an unknown mode, an angle out of 20..90, a drawn that is not a boolean and an error that is not null or a string. The x and y of a canvas window SHALL stay flat values. Full text: section Setting, commands, lease and version skew.

Scenario: Snapshot validation

  • WHEN a snapshot reports an angle of 95
  • THEN validState refuses it

Requirement: Core sync of the warp

The core SHALL send canvas_warp through syncCanvasWarp after each connect and while the snapshot reports another value, and phase 1 SHALL check that the validState of the core before it accepts a snapshot with the new field and capability, with a test that runs that code. Full text: section Setting, commands, lease and version skew.

Scenario: Core sync of the warp

  • WHEN the core connects to the compositor
  • THEN syncCanvasWarp sends the current setting

Requirement: The ring follows canvasWarp

The ring (phase 3) SHALL have no setting, command or lease of its own and SHALL follow canvasWarp and its lease, so it turns off with the warp. Full text: section Setting, commands, lease and version skew.

Scenario: The ring follows canvasWarp

  • WHEN the lease turns the warp off
  • THEN the ring turns off with it

Status

Doc status: partly landed. Landed: phase 1 (cylinder, setting canvasWarp). Not landed: exact input (phase 2), the ring (3), the sphere (4), live check (5). The GLES lens (canvas_warp.frag, the GLES warp pipeline and element) was removed on 2026-11-11 (step 7 of openspec/changes/archive/2026-11-10-gles-removal-plan/design.md): the lens is drawn only by the plain scene of the wgpu renderer (plain_warp.rs, canvas_warp.wgsl), canvas_warp.rs keeps the CPU maps and the setting, and the fallback build that drew the canvas flat was deleted at step 8. Where this doc names canvas_warp.frag, GlassPipeline or DepthPipeline of the GLES scene, it describes the design and the removed code. Checked 2026-11-11.

Setting, commands, lease and version skew

  • Protected setting canvasWarp in the core state: {mode: "off" | "cylinder" | "sphere", angle: 20..90}, default {mode: "off", angle: 60}. Route /api/canvas-warp in web-shell/core/server.js, in the pattern of /api/canvas-sharp-zoom-enabled. The control is in the protected HeroUI settings dialog and shows only when the compositor reports the capability. sphere is refused until phase 4.
  • Compositor command canvas_warp {mode, angle}. Serde refuses an unknown mode and an angle out of range. It moves no window. While locked, allowed_while_locked (desktop.rs:376-392) accepts it only with a mode other than off, as it accepts only the renewals CanvasEnabled {enabled: true} and WorkspaceOutputsEnabled {enabled: true}. So a core that restarts behind the lock renews the warp, and a change to off waits for the unlock. The comment in allowed_while_locked names the new case.
  • The core sends it through syncCanvasWarp in web-shell/core/smithay.js, in the pattern of syncCanvasSharpZoom (smithay.js:842): after each connect and while the snapshot reports another value.
  • Snapshot: capabilities.canvasWarp (boolean) and canvasWarp {mode, angle, drawn, error}. validState (smithay.js, next to the checks of canvasSharpZoom at about line 456) refuses a capability that is not a boolean, an unknown mode, an angle out of 20..90, a drawn that is not a boolean and an error that is not null or a string. x and y of a canvas window stay flat values; the desktop_state tool description says so.
  • Lease: the compositor turns the warp off when the last control connection that sent canvas_warp closes and no connection sends it again within 60 s, with a second instance of the Lease of the canvas lease (canvas.rs:561-600): a command with mode off calls Lease::disable(), and any other mode calls Lease::enable(connection); closed and expired run the grace timer. Reason: after a rollback to a core that does not know the command, nothing could turn the warp off, and the user would have no control for it. The 60 s keeps the warp through a core restart.
  • Before a rollback of the core or the compositor, turn the setting off, as for canvasSharpZoom (AGENTS.md).
  • Phase 1 checks that the validState of the core on main before phase 1 (the core that a rollback returns to) accepts a snapshot with the new top-level field and capability, with a test that runs that code (as the canvas loader test does). If it does not, the rollback order of the canvas applies.
  • No agent tool, scheduled turn, generated HTML or isolated plugin panel reaches the route, the command or the setting.
  • The ring (phase 3) has no setting, command or lease of its own. It follows canvasWarp and its lease; its capability and snapshot field are in "The ring (phase 3)".

Rollback

  • Turn the setting off: the next frame draws flat, and the next pointer event maps flat. No data changes.
  • Revert a phase: turn the setting off first. No saved field or layout depends on the warp or the ring. If the setting stays on and the new core is gone, the lease turns the warp off after 60 s, and the ring turns off with it (the unwrap rule).

Binding contract (from AGENTS.md)

This section holds, word for word, the rule that AGENTS.md kept for this feature until 2026-11-10, when AGENTS.md was reduced to the short invariants (openspec/changes/audit-2026-11-10/design.md, F10). It binds exactly as AGENTS.md does; AGENTS.md keeps the short invariant and points here. Change both in the same commit.

  • Canvas lens (openspec/specs/inverted-sphere-view/spec.md, phase 1): only the protected settings set the protected setting canvasWarp ({mode: off|cylinder, angle: 20..90}, off by default) through /api/canvas-warp; the core refuses sphere until phase 4. The core sends the compositor command canvas_warp (capabilities.canvasWarp), which is also a lease: the compositor turns the warp off 60 s after the last connection that sent it closes. Input and visibility follow the lens of the last drawn frame; in phase 1 a press on a warped window only focuses it. No agent tool, scheduled turn, generated HTML or isolated plugin panel reaches the setting, the route or the command. Turn the setting off before a rollback of the core or the compositor.