Skip to content

fix(manifest): declare copy-mode settings keys (#16) - #17

Merged
Xuepoo merged 2 commits into
mainfrom
fix/declared-settings
Oct 19, 2026
Merged

Xuepoo merged 2 commits into
mainfrom
fix/declared-settings

Conversation

@Xuepoo

@Xuepoo Xuepoo commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Priority: P1 | Area: plugin | Labels: fix,P1,area:plugin | Milestone: v0.1.0 | RFC: N/A | Task: N/A

Closes #16

Summary

Activation on Bitty 0.0.24 failed with E_SETTINGS_UNDECLARED: lua/copy-mode/init.lua read row_count and max_bytes through bitty.settings.get, but bitty-plugin.toml had no [settings] table, so activation aborted and bitty-terminal.copy-mode:open was never registered.

  • Declare exactly the two keys the entry point reads, with kinds and defaults matching current behavior: row_count = { type = "int", default = 10 }, max_bytes = { type = "int", default = 4096 }.
  • Wrap settings reads in a guarded pcall; a denied read (or absent settings bridge) keeps activation alive on the shipped defaults and records one bounded diagnostic (settings_denied, settings_diagnostic, at most 160 bytes) instead of aborting or failing silently.
  • Pin bitty-plugin-sdk to f6fc2f763aa398c0b9bb33fadfe06f0b86dbc0d2, the merge commit of PR #152 (CTX-1225), whose manifest linter accepts [settings] and whose MockHost enforces declared keys. The previous 3ea8e58 pin was the merge commit of PR #155 (which contains #152's f6fc2f76 as its parent); pinning #152 directly keeps the provenance exact and drops the unrelated #155 surface. The older d915535 (PR #144) predates [settings] and rejected the section.
  • Add tests/settings-declarations.test.ts: static parity between setting("<key>", ...) call sites and manifest declarations (fails with the declarations removed — verified red: 4 failing tests), declared defaults matching DEFAULT_ROW_COUNT/DEFAULT_MAX_BYTES, activation registering and dispatching open, and the denied-read diagnostic path.
  • Sync README, TODO, and repo.toml (stale compat bitty >=0.5 line corrected to >=0.0.24,<0.1).

Note: #14 documents the compat-floor failure and is already closed by #15; it is a different root cause, so this PR closes #16 instead.

Review follow-up (F1)

The independent review found the SDK provenance claim wrong: 3ea8e58 is the merge commit of PR #155, not PR #152. PR #152 merged as f6fc2f76, which is 3ea8e58's parent. This head pins f6fc2f76 directly, so the claim matches the commit and the lockfile hash was regenerated. The bitty-plugin.toml header no longer cites d915535 as the linter pin, and README, TODO, repo.toml, and the live-parity comment carry the corrected attribution.

Verification

  • just check green: prettier, markdownlint 0 issues, metadata, hygiene, portable paths, plugin lint 0 errors / 1 pre-existing high-risk warning, luaparse, lua-control, bun test 56 pass / 0 fail.
  • gitleaks detect --source . — no leaks.
  • Red probe: removing [settings] from the manifest fails the new regression (4 fail), then restored.

Activation failed with E_SETTINGS_UNDECLARED because init.lua read row_count and max_bytes while the manifest had no [settings]; the open command was never registered.

Declare exactly the two read keys (int, defaults 10 and 4096), catch denied reads and fall back to the shipped defaults with one bounded diagnostic, pin bitty-plugin-sdk 3ea8e58 for [settings] linting plus the MockHost declared-key gate, and add static/runtime regressions that fail without the declarations.
@Xuepoo Xuepoo added this to the v0.1.0 milestone Oct 19, 2026
@Xuepoo Xuepoo added P1 fix Bug fix area:plugin Plugin manifest and runtime surface labels Oct 19, 2026
The SDK pin cited 3ea8e58 as PR #152's merge commit, but that SHA is the
merge commit of PR #155; PR #152 merged as f6fc2f76, which 3ea8e58 only
contains as its parent. Pin f6fc2f76 so the provenance claim matches the
settings-lint and MockHost declared-key surface the plugin needs, and
regenerate the lockfile integrity hash.

Mirror the corrected attribution in README, repo.toml, TODO, the manifest
header, and the live-parity comment; the manifest header no longer cites
d915535 as the linter pin.
@Xuepoo
Xuepoo merged commit 1309bfc into main Oct 19, 2026
7 checks passed
@Xuepoo
Xuepoo deleted the fix/declared-settings branch October 19, 2026 07:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:plugin Plugin manifest and runtime surface fix Bug fix P1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

copy-mode activation fails with E_SETTINGS_UNDECLARED: manifest has no [settings]

1 participant