Skip to content

approaching workable amounts of diffs internally - #3

Closed
sidkmenon wants to merge 6 commits into
mainfrom
stack/5-tui
Closed

sidkmenon wants to merge 6 commits into
mainfrom
stack/5-tui

Conversation

@sidkmenon

Copy link
Copy Markdown
Contributor

No description provided.

sidkmenon and others added 6 commits September 13, 2026 02:50
The fold hook is still a JSON-RPC 2.0 server on loopback HTTP with the
same `summarize` method, params and errors. The client is now a plain
reqwest POST with a hand-built request and response envelope, so the
later built-in summarizer shares one HTTP stack. The hook's interface to
`DiffResult` is unchanged.

Written with AI assistance (Claude Code).

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzHbAqhxaLKNQbYyqfCyTp
Agent-Session: 0de57442-ad9b-4c99-960e-4974e629b71d
Agent-Session: e046556c-20f0-4bba-832b-b6784a7783c5
Agent-Session: 0025c2a5-4c51-4e7e-be92-b0659a205823
`--format ndjson` now writes protocol v3: a start record with per-side
file identity (path, oid, mode), one file record per diff holding each
side's text and a strict tree of regions, and a complete footer. Leaves
come from the row alignment, folds from the parse. Each fold records the
fold the matcher paired it with both ways, if any, and the projection
numbers regions densely as it builds them: a region whose partner is
already numbered shares that id. `Pairing` moves to its own module so
line layout can use it for run sides without depending on the protocol.
The previous stream, its writer, and `--format json` with the domain-object
encoding behind it are removed; the fold hook has no caller until it
returns as a fold mutation. Errors stay `anyhow::Error` until the writer
turns one into a wire record.

In this layer `visible` equals `textual`, `aborted` is never set,
`syntax` is always empty, and `fold_state_id` equals `alignment_id`.
The Python streaming checker is removed.

Written with AI assistance (Claude Code).

Agent-Session: 8837929e-0118-489c-9648-e47c1831ee8c
Agent-Session: 0025c2a5-4c51-4e7e-be92-b0659a205823
Agent-Session: 4a8f6ee6-1693-4de3-9993-b9f5914cdd09
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzHbAqhxaLKNQbYyqfCyTp
Agent-Session: 8761954a-0023-463e-996c-7c9fbabdef69
Agent-Session: 30956777-ac82-4a2b-9b52-dbfb517b52ee
When the structural matcher gives up on a parsed file (graph limit or
parse-error limit), the engine still collects each side's folds and
enclosing headers from the parse before taking the line diff. Folds on
such a fallback pair through the line alignment: by aligned header line
with matching tags, then by the most aligned body lines without crossing
an existing pair. Fallback folds are collected with no partner, and both
folds of each pair then record the other as partner, just as the syntax
matcher's pairs do, so the projection numbers every file's pairs the same
way. The parse-error fallback numbers both sides' syntax together, since
partners are keyed by syntax id and the parser leaves every node the same
placeholder id.
The projection lays fallback rows out on the same alignment, with each
changed block re-paired from whichever end reads alike, so an edited
signature sits beside the old one.

Written with AI assistance (Claude Code).

Agent-Session: 8837929e-0118-489c-9648-e47c1831ee8c
Agent-Session: 0025c2a5-4c51-4e7e-be92-b0659a205823
Agent-Session: 4a8f6ee6-1693-4de3-9993-b9f5914cdd09
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzHbAqhxaLKNQbYyqfCyTp
Agent-Session: 8761954a-0023-463e-996c-7c9fbabdef69
Agent-Session: 30956777-ac82-4a2b-9b52-dbfb517b52ee
Configuration now resolves through figment: bundled defaults, the global
file (`$XDG_CONFIG_HOME/diffr/config.toml` or `--config`), the
repository's `diffr.toml`, `DIFFR_*` variables, then `--set key=value`.
A schemars JSON Schema describes every setting. `diffr config schema`,
`show` and `set` print or edit it; bare `diffr config` launches the
terminal frontend's settings screen. The `[diff]` table holds the engine
limits (with `DFT_*` variables and flags on top), and `[theme]` names
the frontend theme. Fallback reasons point at the config keys.

Written with AI assistance (Claude Code).

Agent-Session: 0de57442-ad9b-4c99-960e-4974e629b71d
Agent-Session: e046556c-20f0-4bba-832b-b6784a7783c5
Agent-Session: 0025c2a5-4c51-4e7e-be92-b0659a205823
Agent-Session: 8837929e-0118-489c-9648-e47c1831ee8c
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzHbAqhxaLKNQbYyqfCyTp
Agent-Session: 4a8f6ee6-1693-4de3-9993-b9f5914cdd09
Agent-Session: 8761954a-0023-463e-996c-7c9fbabdef69
Agent-Session: 30956777-ac82-4a2b-9b52-dbfb517b52ee
Agent-Session: 01a09f1b-2525-74e3-99d4-f1bdcbec53e6
The v3 stream now runs a registry of mutations between projection and
output. File mutations set a manifest entry's visibility from its
category (git's `diffr-classify`, `linguist-generated`, then built-in
path rules) and language. Fold mutations collapse deleted bodies, long
removed stretches and test bodies, bundle docstrings with their
functions through `fold_state_id`, group related regions, and fill
pseudocode labels from the built-in Gemini summarizer and the JSON-RPC
hook, which is now a fold mutation. After mutations `stats.visible` is
recounted, and a run-level failure stops the stream with
`complete.aborted`. The `folds.*` and `summarize.*`
config tables, `-U` defaulting to `folds.context_lines`, and function
and module fold tags in the bundled queries come with it.

Written with AI assistance (Claude Code).

Agent-Session: 0de57442-ad9b-4c99-960e-4974e629b71d
Agent-Session: e046556c-20f0-4bba-832b-b6784a7783c5
Agent-Session: 0025c2a5-4c51-4e7e-be92-b0659a205823
Agent-Session: 8837929e-0118-489c-9648-e47c1831ee8c
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzHbAqhxaLKNQbYyqfCyTp
Agent-Session: 4a8f6ee6-1693-4de3-9993-b9f5914cdd09
Agent-Session: 8761954a-0023-463e-996c-7c9fbabdef69
Agent-Session: 30956777-ac82-4a2b-9b52-dbfb517b52ee
Agent-Session: 01a09f1b-2525-74e3-99d4-f1bdcbec53e6
The TUI now reads per-side region trees: rows zip by `alignment_id`,
folds open and close by `fold_state_id`, collapsed regions show their
header then a pseudocode band, and hidden files show a "Load diff"
placeholder. Counts come from `stats.visible`. Colours come from
tree-sitter capture names, which `--syntax` adds to the stream
(including line-diff fallbacks, whose language is guessed from the
path), through bundled Helix-style themes. `diffr config` opens a
searchable settings screen. The PTY launch integration test and its
fixtures are removed.

Written with AI assistance (Claude Code).

Agent-Session: 0de57442-ad9b-4c99-960e-4974e629b71d
Agent-Session: e046556c-20f0-4bba-832b-b6784a7783c5
Agent-Session: 0025c2a5-4c51-4e7e-be92-b0659a205823
Agent-Session: 8837929e-0118-489c-9648-e47c1831ee8c
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzHbAqhxaLKNQbYyqfCyTp
Agent-Session: 4a8f6ee6-1693-4de3-9993-b9f5914cdd09
Agent-Session: 8761954a-0023-463e-996c-7c9fbabdef69
Agent-Session: 30956777-ac82-4a2b-9b52-dbfb517b52ee
Agent-Session: 01a09f1b-2525-74e3-99d4-f1bdcbec53e6
@sidkmenon sidkmenon closed this Sep 16, 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.

1 participant