Skip to content

Bad code: split command witness storage out of text authority #170

Description

@flyingrobots

Problem

PR #169 intentionally keeps the #168 hardening small by storing pendingCommandEvent and lastCommandEvent on WorkspaceTextAuthorityOpened. That is acceptable for the narrow slice, but it makes text authority carry command-witness state alongside host materialization, pending intent, receipt, obstruction, and cache posture.

That coupling should not become the permanent home for command provenance.

Why It Matters

Text authority should describe the Echo/materialization posture of the opened buffer. Command provenance is a witnessed command stream keyed by request/client sequence and receipt identity. As :why, Echo History, historical preview, and agent witnesses grow, command events need their own buffer-scoped store or witness log rather than accumulating on authority as ad hoc fields.

Desired Direction

Introduce a focused command witness/provenance store, likely buffer-scoped, that owns:

  • planned command events keyed by request id;
  • settlement enrichment by receipt/admission evidence;
  • last meaningful command lookup for :why;
  • history drawer summaries and later detail views;
  • honest unavailable/obstructed posture for unsupported commands.

WorkspaceTextAuthorityOpened should keep only the minimal references it needs, such as pending request id and receipt/materialization posture.

Acceptance Sketch

  • Command events are stored outside WorkspaceTextAuthorityOpened.
  • :why, footer, Echo History, and witness CLI read through the command witness store.
  • Non-Vim and stale editor state cannot mutate or impersonate stored command events.
  • Buffer switching preserves command witnesses with the buffer record.
  • Tests cover request-id lookup, receipt enrichment, and last meaningful command selection.

Scope Guard

This is not a request to expand command coverage or build a new UI. It is a storage-boundary cleanup after #169.

Related: #168, #131, PR #169.

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

    bad-codeKnown implementation debt or code structure that should be improved

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions