Skip to content

refactor(vim): make SUPPORTED_VERSIONS the single source of truth for the host gate #1597

Description

@dev-addous

Before submitting

  • I have searched existing issues and this is not a duplicate
  • I understand that PRs will be rejected if the linked issue does not have status:approved

Problem or opportunity

The set of verified Pi hosts is currently known in three places and nothing keeps them in sync:

  • lib/vim-editor-adapter.ts holds it privately for the identity gate (SUPPORTED_VERSIONS);
  • extensions/gentle-shell.ts repeats it inside resolveVimRuntime() in the bundled-graph branch;
  • and repeats it again in the installed-pair branch.

After #1582 narrowed the list to {"0.99.1"}, an edit that touches only one or two of those sites changes behaviour silently: a host can be admitted by the gate while one resolver path refuses to certify it, or the reverse. The failure mode is quiet — the adapter is designed to fail closed, so a mismatch degrades Vim to ordinary editing instead of reporting the inconsistency.

@dnlrsls suggested this as a smaller follow-up on the superseded #1572 ("the single-source-of-truth refactor for SUPPORTED_VERSIONS, which could go in a smaller follow-up").

Proposed outcome

Export the verified-host list from lib/vim-editor-adapter.ts as the single source of truth, and have both resolveVimRuntime() branches read it instead of restating the versions. No behaviour change: the admitted set stays {"0.99.1"} and every identity proof is untouched (host package name, matching CustomEditor/Editor classes, prototype chain, bundled VERSION).

A unit assertion that the gate and both resolver branches consult the same list would keep the invariant enforced rather than merely documented.

Alternatives considered

  • Leaving the three sites duplicated and relying on review. That is the current state, and the drift is silent by design (fail-closed), which is why the inconsistency is worth removing rather than documenting.
  • Moving resolveVimRuntime() into the adapter module. Bigger than needed: the resolver depends on the extension's CustomEditor subclass identity, so it belongs where it is.

Additional context

The change shipped as one part of #1572, which was closed as superseded by #1582 and #1594; this refactor is the piece the maintainer flagged as still worth carrying, and it is independent of the peer-dependency work. Happy to open the small PR once the issue is approved.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status:needs-reviewAwaiting maintainer review/approvaltype:refactorCode refactoring without behavior change

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions