Skip to content

read contract: report uncommitted records in the working tree, with branch and base #3160

Closed

Description

@lex00

Part of #3145.

Problem

If work in progress lives as uncommitted files in a work branch's working tree (#3158), readers need to see it. Today chant workspace records reads the working tree, but nothing in the read contract says which records are uncommitted, on which branch, or changed since which commit. hud and studio would each have to diff git themselves, which is the kind of second implementation the read contract exists to prevent.

Proposal

  • records (and status) report, per record, whether it is committed, modified or new in the working tree, and the branch and base commit the working tree is on.
  • A records --uncommitted filter, with a schema'd document, so a UI can show "kept, not yet applied" from chant alone.
  • Reader conformance covers the new fields.

Done when

hud's kept-records view and studio's apply.mjs --records read the uncommitted set from chant instead of from git directly.

Activity

  1. added
    enhancement
    area:workspace
    boundaries
    on Oct 1, 2026
  2. lex00 commented on Oct 3, 2026

    @lex00
    ContributorAuthor

    Design as built in #3292.

    The contract stays at version 1, and the new fields are added within it the way earlier fields were (#2732, #2688). Each record of a working-tree read in git gets worktree, which is committed, modified or new against HEAD. Staged and unstaged changes count the same, and a rename shows as new plus deleted. The document gets checkout: { branch, head, base, baseFrom, deleted }. base is the merge base of head and the target branch, and the target is found the same way the trust policy's base is (--base, else origin/HEAD, main, master). I chose the merge base over the raw target tip because it is the commit applying the branch is measured against.

    records --uncommitted filters to modified and new and sets uncommitted: true. It does not add a separate schema: the records schema requires checkout and the restricted worktree values when uncommitted is true. It refuses --at and --since. Outside git it fails with the existing not-a-git-repository code, so no new reason code was needed. Without --kind, the set has no spec under --uncommitted, because the spec has to be the whole current set.

    status --json gets checkout with branch, head, base and baseFrom. It has no per-record list: records --uncommitted is the place to get that.

    The reader conformance suite has a new command, records --uncommitted, and the workspace the suite generates leaves one proposed decision (fix-002) uncommitted. createConformanceWorkspace() called directly only adds that decision with uncommitted: true, so tests that allocate ids there are not affected.

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

    area:workspaceboundariesenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions