Skip to content

feat(vim): epic charter and versioned semantic contract v1 (refs OpenCoven/psyche-build#222) - #296

Closed
CompleteDotTech wants to merge 2 commits into
OpenCoven:mainfrom
CompleteDotTech:psyche/issue-222-vim-epic-contract
Closed

feat(vim): epic charter and versioned semantic contract v1 (refs OpenCoven/psyche-build#222)#296
CompleteDotTech wants to merge 2 commits into
OpenCoven:mainfrom
CompleteDotTech:psyche/issue-222-vim-epic-contract

Conversation

@CompleteDotTech

@CompleteDotTech CompleteDotTech commented Aug 30, 2026

Copy link
Copy Markdown
Member

Outcome

Focused, additive epic-contract slice for #222 (psyche-no8,
comprehensive opt-in Vim support across Psyche; canonical outcome
#246). It delivers the one versioned semantic contract the five
slices share, plus the epic charter:

Scope and boundaries

Risk class

  • R1 — documentation or isolated tests: one pure, additive TS module (no I/O, no
    runtime consumers), one test file, two docs files. No product behavior,
    authority, persistence, or transport path is changed. Slices that later wire the
    contract into product behavior own the corresponding R3 review for their surfaces.

Validation and evidence

Exact commands, run from the worktree on branch psyche/issue-222-vim-epic-contract
(head e190cf7, parented on origin/main f12b753):

Command Observed result
npx pnpm install --frozen-lockfile exit 0 — Done in 752ms using pnpm v10.34.5
npx pnpm exec vitest --run __tests__/vimSemanticContract.test.ts exit 0 — Test Files 1 passed (1), Tests 37 passed (37)
npx pnpm exec tsc --noEmit exit 0 — clean (full src tree)
npx pnpm exec tsc -p tsconfig.test.json --noEmit exit 0 — clean (src + __tests__)
git diff --check exit 0 — clean

One intermediate test run failed (1/36) during development: the new duplicate-case
rule correctly rejected two fixtures sharing editor-command-line::<Enter> in one
set; the test data was split into two sets and all tests then passed.

Explicit gaps (not run here): real Vim/Neovim/tmux smoke sessions and tmux-dependent
repository gates (no tmux on this host; they belong to #227's acceptance matrix);
iOS/Swift and physical hardware-keyboard evidence (no Xcode/iOS tooling here);
desktop Tauri/cargo and browser automation (no cargo/rust here — CI supplies the
runners). This slice is isolated module evidence, not a user-path proof.

Working record

docs/working-records/issue-222-vim-epic-contract.md
outcome, scope/boundaries, risk class, exact commands/results, exact head SHA, test
counts, proof gaps, rollback.

Generated outputs

None touched; no generator run. src/utils/generated-agents-doc.ts,
native/desktop/psyche-build-tauri/web/*.bundle.js, native/ios/Psyche.xcodeproj/**,
generated Info.plist, and dist/** are unchanged.

Security and privacy

  • No credentials, tokens, private keys, raw prompts, unrestricted terminal output,
    private repository contents, environment dumps, private URLs, or unredacted personal
    paths are included in this PR or its files.
  • The contract hardens the failure direction: malformed fixtures/ops/payloads fail
    closed (TypeError) instead of guessing, chrome-scoped ops are unreachable while
    chrome mode is inactive, pending/unsupported sequences can never fall through into a
    PTY or text input, and persistence ops must route through
    host-authority paths rather than executing from editor shortcuts.

Review focus

  • Whether the v1 op vocabulary and bounded contexts faithfully cover the approved
    design's chrome table, editor practical-parity surface, and bounded Ex command set
    without overreach into [psyche-no8.1] Vim Slice 1: shared contract and desktop reference #223's machine implementation.
  • The chrome-mode guard invariants: terminal-passthrough classification while
    inactive; consumed-without-side-effect behavior for unmapped keys while active;
    fail-closed assertChromeOpReachable.
  • The host-authority routing invariant on persistence ops and the guarded (request-only)
    nature of chrome close.
  • Bounded-payload completeness (counts, patterns, args, messages, registers, set sizes).

Release and support impact

None on current behavior: the feature remains opt-in by default and this slice adds no
runtime code path, no persisted-format change, and no public API surface beyond the new
module. The epic is post-release work (canonical outcome #246);
support-matrix claims are unaffected until platform slices land behind their acceptance
gates.

Refs #222

…#222)

Additive epic-contract slice for the comprehensive opt-in Vim support epic
(Bead psyche-no8):

- docs/vim/VIM-EPIC-CHARTER.md: objective, invariants (opt-in, byte-exact
  terminal passthrough outside explicit chrome mode, host-authority routing
  for consequential actions), contract-surface ownership map, slice map for
  OpenCoven#223-OpenCoven#227 with bead acceptance criteria and current status, acceptance
  order note, and the post-release/OpenCovengh-246 disposition.
- src/vim/semanticContract.ts: versioned v1 semantic contract - typed
  semantic-op union (motion/edit/search/ex/chrome/persistence/accessibility),
  bounded contexts and payloads, validateOpFixture()/validateOpFixtures()
  fail-closed validators, chromeModeGuard() classifying every event as
  terminal passthrough while chrome mode is inactive, and
  assertChromeOpReachable() fail-closed execution gate.
- __tests__/vimSemanticContract.test.ts: 37 tests covering the validator and
  guard, including chrome-mode-off passthrough, unknown-op rejection, and
  bounded-payload rejection.

Verification: vitest 37/37, tsc --noEmit clean, tsc -p tsconfig.test.json
--noEmit clean, git diff --check clean.

Refs OpenCoven#222
@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

@CompleteDotTech is attempting to deploy a commit to the 0xBuns Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds the v1, versioned Vim semantic contract module plus supporting documentation, establishing a shared vocabulary/fixture validator and chrome-mode guard that future platform adapters can implement consistently for the #222 epic.

Changes:

  • Introduces src/vim/semanticContract.ts defining v1 contexts, op vocabulary, bounded payload limits, strict fixture validation, and a chrome-mode guard.
  • Adds a focused Vitest suite validating validator/guard invariants and failure-closed behavior.
  • Documents the epic charter and captures an execution/verification working record for #222.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/vim/semanticContract.ts New v1 semantic contract: vocabulary, bounds, strict validators, and chrome-mode guard utilities.
tests/vimSemanticContract.test.ts New test suite covering validation rules and chrome-mode guard invariants.
docs/vim/VIM-EPIC-CHARTER.md Epic charter documenting invariants, ownership boundaries, and slice map for the Vim epic.
docs/working-records/issue-222-vim-epic-contract.md Working record capturing scope, risk class, commands run, results, and rollback plan.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +146 to +152
/**
* One normalized key input: the platform-agnostic key name (case-sensitive,
* e.g. `h`, `G`, `Enter`, `Esc`, `F6`) plus the active modifier chord, and —
* for terminal-originated events — the exact byte sequence that carried it.
* Raw platform events never reach this contract directly; adapters normalize
* first (raw event -> normalized key token -> semantic state machine).
*/
Comment on lines +503 to +512
function validateBoundedString(
value: unknown,
field: string,
maxLength: number,
allowEmpty = false,
): asserts value is string {
if (typeof value !== 'string' || (!allowEmpty && value.length === 0) || value.length > maxLength) {
invalid(`${field} must be a string of length 1..${maxLength}`);
}
}
@CompleteDotTech
CompleteDotTech marked this pull request as ready for review August 30, 2026 14:50
@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
psyche-build-docs Ready Ready Preview Aug 30, 2026 3:02pm

Request Review

@BunsDev

BunsDev commented Aug 31, 2026

Copy link
Copy Markdown
Member

Closing as superseded by the canonical semantic core already on main. This PR introduces an incompatible second vim/v1 action schema and has unresolved normalization/binding contradictions; preserve the charter discussion only.

@BunsDev BunsDev closed this Aug 31, 2026
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.

3 participants