Skip to content

batch: Reuse attribution source mappings#103

Merged
halfline merged 2 commits into
mainfrom
batch/reuse-attribution-source-mappings
Jun 7, 2026
Merged

batch: Reuse attribution source mappings#103
halfline merged 2 commits into
mainfrom
batch/reuse-attribution-source-mappings

Conversation

@halfline

@halfline halfline commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Batch ownership attribution compares a file against the worktree
and projects stored batch metadata onto the resulting attribution
units.

When a file belongs to an active batch, each attribution unit
opens the same batch source and rebuilds the same
source-to-worktree mapping. Large files with many units can make
show or auto-advance spend most of their time repeating that
comparison.

These commits address that repeated work by opening each relevant
batch source once per file attribution build, keeping its mapping
alive with the rest of the file-scoped resources, and sharing the
mapping between batch unit enumeration and ownership checks. A
regression test pins the mapping reuse behavior.

halfline added 2 commits June 6, 2026 22:21
Batch ownership attribution compares a file against the worktree and
projects stored batch metadata onto the resulting attribution units.

When a file belongs to an active batch, each attribution unit opens the
same batch source and rebuilds the same source-to-worktree mapping. Large
files with many units can make show or auto-advance spend most of their
time repeating that comparison.

This commit addresses that repeated work by opening each relevant batch
source once per file attribution build, keeping its mapping alive with the
rest of the file-scoped resources, and sharing the mapping between batch
unit enumeration and ownership checks.

The next commit will add a regression test for the mapping reuse behavior.
Batch attribution now reuses file-scoped batch source mappings while
assigning ownership to attribution units.

The project does not pin that behavior with a regression test. Later
changes can reintroduce per-unit mapping rebuilds without changing
ownership results, which makes the problem visible only on larger files.

This commit addresses that by adding an ownership test that builds a file
with multiple attribution units and verifies that attribution creates one
baseline mapping and one batch-source mapping.

The attribution performance fix is now covered by tests.
@halfline halfline merged commit c09299b into main Jun 7, 2026
2 of 3 checks passed
@halfline halfline deleted the batch/reuse-attribution-source-mappings branch June 7, 2026 03:08
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