Skip to content

[CTX-0107] docs(extensibility): give every catalog entry four contract axes - #199

Merged
Xuepoo merged 3 commits into
mainfrom
ctx-0107/component-catalog-contracts
Nov 19, 2026
Merged

Xuepoo merged 3 commits into
mainfrom
ctx-0107/component-catalog-contracts

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

Finishes the contract work for bitty#2114 items 1 and 2 in the extension
component catalog (extensibility/extension-component-catalog-candidate.md).

Every entry (E-1 edge band, E-2 pill row, E-3 tooltip/detail fallback, E-4 modal
sheet, E-5 status strip) now carries the four required axes as distinct
labelled fields
, where it previously carried them as prose that overlapped:

  • Scene shape — the v1 node composition plus the UI_MAX_DEPTH (16), node
    (2048), and text (256 KiB) ceilings that apply, and per-rung bounds for E-3.
  • Style hooks — only the token namespaces a plugin may own, per the theme
    token contract. fg/bg select from the closed five-name band table
    (foreground, background, cursor, selection, accent); border_token
    admits six content.*/state.* names and refuses border.*/chrome.*. No
    entry presents a Core-owned border./chrome./content./state. token as a
    plugin hook. A new residual 14 records that plugin.<name>.* — the one
    namespace a plugin may define — is unreachable from any scene field.
  • Accessibility notes — the semantics role the accessibility baseline
    requires for that surface (text, list, button, "bar / rail" read-only
    with tab-order exclusion, "modal overlay" focus confinement) plus the boundary
    the build cannot cross, since v1 has no role/name/state field.
  • Headed example — the runnable-shaped listing plus the plugin path that
    ships the shape, or an explicit statement that no shipped consumer and no
    accepted contract exist (E-3 rung 4, E-4 modality).

Also new: a "Style hooks: the token boundary every entry inherits" section and an
"Accessibility: the roles the baseline requires" section so the per-entry fields
have one shared source instead of being re-derived five times; two new rows in
Affected contracts (theme token contract, accessibility baseline, chrome surface
contract); and an Adoption section whose first line states that the bar
migration (bitty#2114 item 3) is the remaining residual.

Why

The issue asked for a catalogued contract per pattern, not a summary of shipped
compositions. Three things were missing before this PR: a style hook never said
which token namespace the plugin owns (so a Core chrome token could be read as a
plugin hook), an accessibility note never named the role the baseline requires
(so a band could be read as contributing to an accessibility tree), and no
example said which plugin ships the shape. On top of that, roughly a dozen
caller-evidence file:line pins had drifted and no longer resolved.

Item 3 — bar migrated onto catalog entries (dogfood) — is out of scope here
and stays a residual; the doc says so in one line at the top of Adoption so the
issue can be narrowed rather than re-derived.

Evidence

Caller evidence re-verified against bitty-terminal/bitty-plugins ce49705
(plugins/bar at a00f2697) and bitty-terminal/bitty origin/main 0e92f6fa:

Entry Verified caller evidence today
E-1 bar/lua/bar/init.lua:4336 (group_node), :4453 (render_bar), :4467-:4472 (omit empty groups), :4746 (mount); file-manager/lua/file-manager/init.lua:38 + mount at :224 (at the collection's pinned 38ee03b0; :311 at that repository's later head); devtools/lua/devtools/view.lua:45 + mount at :400
E-2 bar/lua/bar/init.lua:99-:103 (surface comment), :104 (M.CAPSULE_PAD), :111-:113 (token constants), :1945 (segment shape), :1966-:1990 (atom conversion + per-capsule region); :95 (M.MAX_WORKSPACES = 16)
E-3 bar/lua/bar/init.lua:1576 (hover_binding), :4701-:4745 (hover state), :4718-:4735 (bounded tooltip update), :4754 (retained overlay mount), :4963-:5002 (enter/leave dispatcher), :1989 (inline suffix), :169 (HOVER_DETAIL_MAX_BYTES = 256), :4937-:4960 (notify fallback); only on_hover assignment in the collection is :4326
E-4 git-panel/lua/git-panel/init.lua:660/:680/:689; history/lua/history/init.lua:809/:840; palette/lua/palette/init.lua:225/:230/:480; help/lua/help/init.lua:477/:492-:498. No shipped modal sheet — recorded as a gap
E-5 bar/lua/bar/init.lua:139-:144 (groups/anchors), :145-:155 (default plan), :156-:159 (single-space join), :2168 (clock), :2808 (network), :2968-:3810 (bluetooth/backlight/idle/microphone), :4453-:4479 (strip assembly), :529 (empty-band sentinel)

Bridge pins corrected against bitty origin/main 0e92f6fa:
UI_SLOTS ui.rs:183, UiSlot::ALL :143, statusline rejection test
:1545-:1566 (was :1455-:1470), UI_V1_NODE_KINDS :209,
UI_V1_EXCLUDED_NODE_KINDS :212, excluded-kind refusal :951 (was :922),
UI_MAX_DEPTH :215, UI_MAX_NODES :218, UI_MAX_TEXT_BYTES :221,
UI_MAX_BLOCKS :225, UI_MAX_AGGREGATED_TEXT_BYTES :233,
UI_HOVER_PHASE_ARG :309, UI_HOVER_QUEUE_MAX :323,
UI_MAX_THEME_TOKEN_BYTES :254; UI_STYLE_FIELDS ui_style.rs:279-:290,
caps :295/:300/:305/:320/:329/:340, wrapper accounting :257-:260
(was :93-:105), width/height refusals :879/:902; scope selector
services.rs:6782-:6795 with Band at :6792-:6793, ui_style_ignored
:6797 (was :6754); column-band root gate band_slots.rs:241-:246;
rich reader kinds ui_rich.rs:151-:161, band-only field rejection :554-:570,
gap kind refusal :475-:478 (was :460); constrain_width
bitty-rich/src/scene.rs:619, constrain_height :640.

Gate exit codes, run from inside the worktree (bun 1.4.5 at
/home/fuyu/.local/share/bun/bin, no bun segfault encountered):

Gate Exit
just fmt-check 0
just markdownlint 0
just links 0
just metadata 0
just language 0
just agents 0
just hygiene 0
just svg 0
just actionlint 0
just check (whole recipe) 0
own anchor check (9 fragments incl. #e-1..#e-5 inbound from the deprecated catalog) 0

No shipped verification is claimed: the headed examples are listings, not headed
test results, and the doc says so in each entry.

Related #2114

…t axes

The extension component catalog carried scene shape, style hooks, and
accessibility notes in prose that overlapped each other, and it named the
shipped caller only inside a separate evidence field. That left three gaps
against bitty#2114: a style hook never said which token namespace a
plugin may own, an accessibility note never named the semantics role the
baseline requires, and no example said which plugin ships the shape.

Every entry (E-1 to E-5) now carries four distinct labelled fields:

- Scene shape: the node composition plus the UI_MAX_DEPTH, node, and text
  ceilings that apply to it, with the pins re-read at bitty 0e92f6fa.
- Style hooks: only the token namespaces a plugin may own. fg/bg select
  from the closed five-name band table; border_token admits six
  content.*/state.* names; no Core-owned border./chrome./content./state.
  token is presented as a plugin hook, and plugin.<name>.* is recorded as
  unreachable (residual 14).
- Accessibility notes: the role the accessibility baseline requires for
  that surface and the boundary the build cannot cross.
- Headed example: the runnable-shaped listing plus the plugin path that
  ships it, or an explicit statement that no shipped consumer exists.

Also re-pins every caller-evidence file:line against bitty-plugins
ce49705 (bar a00f2697) and bitty origin/main 0e92f6fa, since the earlier
pins had drifted: file-manager's mount is at :311 not :222,
ui_style_ignored is at services.rs:6797 not :6754, the statusline
rejection test is at ui.rs:1545-1566 not :1455-1470, and UI_MAX_* moved
one line each.

Adds an Adoption section whose first line states that the bar migration
(bitty#2114, item 3) is the remaining residual, so the issue can be
narrowed instead of re-derived.

Related #2114
@Xuepoo Xuepoo added docs Documentation P2 Priority: medium area:plugins labels Nov 19, 2026
…ection commit

The E-1 caller evidence pointed at file-manager/lua/file-manager/init.lua:311,
which is where the ui.mount call sits at that submodule's current head
(e40eeff). The catalog cites the plugin collection at bitty-plugins ce49705,
whose file-manager pointer is 38ee03b0, and at that commit the mount is at
:224. Re-point the four occurrences and say which commit the pin follows, so
a reader can reproduce the line without guessing which checkout is meant.

Related #2114

@Xuepoo Xuepoo left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Independent review (Bitty blitz guard tick, head 25c85d5)

Read-only review of extensibility/extension-component-catalog-candidate.md at
25c85d5b (+544/−200) against bitty origin/main 0e92f6fa and
bitty-plugins ce49705 (plugins/bar a00f2697, devtools 88acd1d6,
file-manager e40eeff with 38ee03b0 in history). No file edited, nothing
pushed, no document change proposed in this review.

1. Coverage — PASS

All five entries carry all four axes as distinct bold-labelled fields on their
own line, each present for every pattern (no axis missing, none folded into
another field's prose):

Entry Scene shape Style hooks Accessibility notes Headed example
E-1 :505 :541 :561 :601
E-2 :667 :690 :721 :743
E-3 :807 :832 :868 :890
E-4 :986 :1005 :1035 :1061
E-5 :1144 :1166 :1191 :1212

Each carries bounds inline (depth-16 / 2048-node / 256 KiB), so the "Scene shape
with the real bounds" part of the ask is met inside the field rather than
deferred.

2. Evidence reality — PASS

Fourteen pins sampled across the five patterns; every cited line contains what
the entry says it contains, at the cited revision.

Core (0e92f6fa, via git show): UI_MAX_DEPTH = 16 ui.rs:215,
UI_MAX_NODES = 2048 :218, UI_MAX_TEXT_BYTES = 256*1024 :221,
UI_MAX_BLOCKS :225, 2 MiB :233, UI_SLOTS :183, UiSlot::ALL :143,
node kinds :209/:212, UI_HOVER_QUEUE_MAX :323, token cap :254,
UI_STYLE_FIELDS: [&str; 10] ui_style.rs:279-290, caps :295/:300/:305/
:320/:329/:340, wrapper accounting :257-260, constrain_width
bitty-rich/src/scene.rs:619, services.rs:6782 scope selector with Band at
:6792, ui_style_ignored :6797, band_slots.rs:241-246, ui_rich.rs:151-161
(9 kinds), :554 band-only field rejection, :475-478 gap refusal — all match.

Plugins: bar/lua/bar/init.lua:104 M.CAPSULE_PAD, :111-113 token constants,
:139-159 groups/anchors/plan/join, :169 HOVER_DETAIL_MAX_BYTES = 256,
:529 hidden sentinel, :1945 CAPSULE_PAD .. label .. CAPSULE_PAD, :1966
segment_atom, :1989 atom.hover_suffix, :2168 clock, :2808 network,
:2968 bluetooth…:3810 microphone, :4313-4320 detail fallback,
:4326 the only on_hover assignment in the collection, :4336 group_node,
:4453 render_bar, :4467-4472 omit-empty-groups, :4746 band mount,
:4718-4735/:4726 bounded tooltip update, :4754 retained overlay mount,
:4936-4961 detail command, :4963-5002 enter/leave dispatcher. E-4:
git-panel:680 acquire / :689 update / :660 release,
history:809/:840, palette:225/:230/:480 poll,
help:470/:477/:492-498 present.show/present.hide. devtools/view.lua:45
M.SLOT, :400 mount.

File-manager pin: :38 M.SLOT = "bottom" and :224 pcall(ui.mount, M.SLOT, component) both confirmed at 38ee03b0, and the entry discloses the pin at the
citation ("Both file-manager and devtools are pinned at the commits the
collection records … the file-manager mount moves in later commits", :588-591).
The later head does move it (e40eeff: :311) exactly as stated — the disclosed
pin is accepted.

Minor drift, non-blocking (fix while touching the file): hover_binding is
1577, not :1576; the overlay-capture state rule is band_slots.rs:225
(:226 is Tabline | Terminal => NeverPresented); constrain_height is 641
(:640 is #[must_use]); the inverted-range refusal Err is ui_style.rs:903
(:902 is the if).

3. Truthfulness of "not shipped" / "not accepted" — FAIL (E-3 rung 4); PASS (E-4)

E-4 holds. Grepping plugins/*/lua finds no scrim, backdrop, focus trap, or
stacking tier; no style =, min_width, or max_width anywhere (residual 10
holds); composer and dashboard are additional overlay.acquire callers but are
Core-modal presentation, so "no shipped plugin implements a modal sheet" is
truthful. The three substitutes in :1017-1021 are correctly scoped.

E-3 rung 4 does not hold, and it fails in the form the guard cares about — a
"not shipped / nothing exists" claim contradicted by shipped code in the same
collection:

  • :814 says rung 4 is a Gap: "no anchoring, offset, placement, or per-item
    geometry exists".
  • Residual 2 (:1445-1448) repeats it: "no anchoring, offset, placement, or
    per-item geometry exists … Region ids give a stable identity, not a rectangle a
    plugin can position against".
  • The security table (:1338) generalises it: "no pattern reads or sets absolute
    positions".

Shipped counter-evidence at 0e92f6fa: crates/bitty-lua/src/host.rs:2506-2513
declares ui_targets_session_start(overlay_handle, width, anchors: &[(u16, u16)], commands), documented at :2475-2476 as "anchors are viewport-local (x, y)
cells"; host.rs:7306 exposes ui.targets as a readonly Lua table and :7187
wires session_start; crates/bitty-runtime/src/plugin_runtime/services.rs:3139-3192
maps each caller anchor to Point::new(anchor.0, anchor.1) and allocates a label
at that point on the caller's overlay handle (panel targets substitute the Core
rect); ui.targets.snapshot rows carry rect (host.rs:2395). Consumer at
collection rev ce49705: plugins/beacon/lua/beacon/init.lua:686-697 reads
row.rect[1]/row.rect[2] into anchors[i] = { x = …, y = … }, then :732
calls bitty.ui.targets.session_start(handle, cfg_viewport_width, anchors, commands)
and repaints the overlay at those points. So per-item geometry does reach
plugins, plugins do supply absolute viewport coordinates, and one ships today.

The gap is real in the narrower sense — there is no plugin-authored popup with
its own content, no trigger-relative anchoring, no offset/placement policy — but
the entry states the absence categorically and misses the one shipped mechanism
that provides positioning. Requested change: restate rung 4 as partial, Core
hint-labels only
(anchored Core-allocated labels over overlay, no
plugin-authored popup body, no trigger-relative anchoring), cite
host.rs:2475-2476/:2506, services.rs:3139-3192, and beacon/init.lua:686-697/:732,
and correct residual 2 and the "no ambient geometry" row. Do not delete the gap;
narrow it.

4. Boundary rules — PASS

The style-hook table (:261-264) restricts fg/bg to the five band-surface names
and border_token to six content.*/state.* names, and states in :268-274 that
these are selections from a host-owned table, never ownership — verified exactly
against ui_style.rs:348 ("The set is closed and holds only content.*/state.*
tokens") and :388-393 (the six spellings, character for character). No
Core-owned border.*/chrome.*/content.*/state.* token is offered as
something a plugin defines; plugin.<name>.* is recorded as unreachable
(residual 14, :1513-1521) rather than invented into a field.

Slot and node claims stay inside the closed surface: slots are the seven of
ui.rs:183, examples use only Text/Row/Column, statusline appears only as
retired, and the five v1-excluded kinds appear only as refusals (ui.rs:212).
No research repository, no internal record number (CTX-…, W-…), and no
coverage ledger appears anywhere in the file.

Frontmatter is valid for document_type: specification with status: draft
both members of the gate's enums (.github/scripts/check-docs.mjs:88-112);
candidate is not a legal value in this repository's status enum, so draft is
the candidate spelling and the H1 block says "draft candidate" (:14). The
deprecated pointer uses status: deprecated, so the pair reads correctly.

5. Gates and anchors — PASS

just check from the lane worktree, bun 1.4.5 at /home/fuyu/.local/share/bun/bin:

Recipe Exit
just fmt-check (prettier 3.9.6, all files formatted) 0
just markdownlint (113 files, 0 issues) 0
just links (113 files, no network) 0
just metadata 0
just language 0
just agents 0
just hygiene 0
just svg / just actionlint 0
just check (whole recipe) 0

Anchors: the document emits four fragments — #style-hooks-the-token-boundary-every-entry-inherits,
#accessibility-the-roles-the-baseline-requires,
#width-hooks-what-the-landed-table-does-not-unlock, #residuals — all resolving
to its own headings. The deprecated catalog sends five inbound fragments
(ui-component-catalog-candidate.md:28-32, #e-1-edge-band … #e-5-status-strip)
and all five resolve to the ## E-n headings. The links recipe validates
fragments on Markdown targets (.github/scripts/check-docs.mjs:477-481), so the
green run is the proof, not an assumption.

Blocking

  1. E-3 rung 4 absence claim (:814), residual 2 (:1445-1448), and the "no ambient
    geometry" row (:1338) are contradicted by shipped bitty.ui.targets.snapshot /
    ui.targets.session_start and by beacon in this collection. Narrow the rung
    to "Core hint-labels only" and cite the mechanism.

Non-blocking nits

  1. hover_binding :1576 → :1577; band_slots.rs:226 → :225;
    scene.rs:640 → :641; ui_style.rs:902 → :903.

VERDICT: CHANGES-REQUESTED

…boundary

- E-3 rung 4 no longer claims no geometry exists. Core hands a plugin
  viewport-local (x, y) anchors over the targeting path
  (crates/bitty-lua/src/host.rs:2475-:2476, :2506-:2512;
  plugin_runtime/services.rs:3176-:3189), and beacon is a shipped consumer
  (lua/beacon/init.lua:693-:695, :732). Rung 4 is now "Core-computed hint
  labels only, no plugin-side placement".
- Residual 2 keeps the missing primitive but names the real boundary: no
  plugin-side placement, offset, or z-order, and no per-frame or ambient
  geometry channel.
- The "No ambient geometry" security row now says geometry is opt-in through
  the targeting session instead of asserting it never reaches a plugin.
- The catalog table and composition register availability cells say the same.
- hover_binding repinned :1576 -> :1577 (bar/lua/bar/init.lua).
- band_slots :226, bitty-rich/src/scene.rs:640 and ui_style.rs:902 re-checked
  against origin/main 0e92f6fa and left unchanged: the doc already cited the
  NeverPresented arm, the constrain_height fn, and the Err return.
@Xuepoo

Xuepoo commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Second commit b394f66 — E-3 rung 4 corrected to the real boundary

Re-verified every cited line against bitty origin/main 0e92f6fa and
bitty-plugins ce49705 before editing. The substantive defect reproduces. The
paths in the report have since moved, so the new text cites the current ones.

1. Substantive: the false categorical geometry claim — resolved

The claim was wrong. A plugin has no ambient or per-frame geometry channel and
cannot place an arbitrary node, but Core does hand it viewport-local (x, y)
anchors:

Evidence Location at 0e92f6fa
"anchors are viewport-local (x, y) cells" crates/bitty-lua/src/host.rs:2475-:2476
ui_targets_session_start(overlay_handle, width, anchors, commands) crates/bitty-lua/src/host.rs:2506-:2512
snapshot row carries rect: Option<(u16, u16, u16, u16)> crates/bitty-lua/src/host.rs:166-:167, :2395
Lua ui.targets.session_start wiring crates/bitty-lua/src/host.rs:7187, :7233
label point taken from the caller's anchor crates/bitty-runtime/src/plugin_runtime/services.rs:3176-:3189 (:3183, :3186)
shipped consumer bitty-plugins lua/beacon/init.lua:693-:695, :732 (row passthrough at :758)

Path note: at 0e92f6fa the trait lives in crates/bitty-lua/src/host.rs, not
crates/bitty-runtime/src/registry/host.rs; the Lua session_start key is at
:7187 and the call at :7233 (not :7306).

Changed in the three named places, plus the cells that repeated the claim:

  • E-3 rung 4 — Gap: no anchoring, offset, placement, or per-item geometry exists → Partial: Core-computed hint labels only, no plugin-side placement,
    with the anchor path and the beacon consumer cited by file:line, and a
    paragraph naming the boundary as placement, not geometry.
  • Residual 2 — kept, re-worded. It now records that Core hands anchors over
    ui.targets.session_start and that beacon consumes them, and states what is
    genuinely missing: plugin-side placement, offset, z-order, and any per-frame or
    ambient geometry channel.
  • "No ambient geometry" row — now says geometry is opt-in through the
    targeting session and Core places the label, instead of implying no rectangle
    reaches a plugin.

Also narrowed where the same absolute claim had leaked: the on_hover
interaction text (no pointer coordinates, rather than "no coordinates ever"),
"Rung 4 has no shape to bound" → no plugin-authored shape, the
composition-register and catalog availability cells, the headed example's "no
shipped consumer", and the "avoid leaking geometry to plugins" open point.

E-4's not shipped / not accepted markers are untouched.

2. Drift: hover_binding :1576 → :1577 — resolved

bar/lua/bar/init.lua:1577 is function M.hover_binding(region); :1576 is the
last comment line. Repinned in all three places that cited it (catalog table,
Caller evidence, Headed example).

3-5. Drifts that did not reproduce — no change, verified

  • band_slots :225 → :226: the document already pinned :226
    (band_slots.rs:163-165, :226, and :226 again in E-4). At 0e92f6fa,
    crates/bitty-runtime/src/runtime/band_slots.rs:226 is
    UiSlot::Tabline | UiSlot::Terminal => SlotStateRule::NeverPresented, while
    :225 is the Overlay arm — :226 is the correct pin for the
    NeverPresented claim.
  • bitty-rich/src/scene.rs:640 → :641 "for the fn": :639 is #[must_use],
    :640 is pub const fn constrain_height(self, rows: u16) -> u16, and :641 is
    the first body line. The document cites :640 and names the fn in the same
    clause, so the pin is already on the fn.
  • ui_style.rs:902 → :903 "for the if that returns Err": the if spans
    :898-:901 and :902 is return Err(UiStyleError::HeightRangeInverted {;
    :903 is min: self.min_height_cells,. :902 mirrors the width pin at :879
    (return Err(UiStyleError::WidthRangeInverted {), so both stay as they are.

Gates

  • just check from the worktree: exit 0 — fmt-check, markdownlint, links,
    metadata, language, agents, hygiene, svg, actionlint. No step needed the
    standalone-binary workaround.
  • Anchor check: no heading renamed; all four internal fragments (#residuals,
    #width-hooks-what-the-landed-table-does-not-unlock,
    #style-hooks-the-token-boundary-every-entry-inherits,
    #accessibility-the-roles-the-baseline-requires) resolve, and the links gate
    agrees.
  • Push: 25c85d5..b394f66, fast-forward, no force; origin had not moved.

@Xuepoo
Xuepoo merged commit db0076a into main Nov 19, 2026
4 checks passed
@Xuepoo
Xuepoo deleted the ctx-0107/component-catalog-contracts branch November 19, 2026 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:plugins docs Documentation P2 Priority: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant