Skip to content

rewrite: Scope scan dependency analysis to a movable suffix - #455

Merged
halfline merged 5 commits into
mainfrom
publish/rewrite-scan-onto-movable-scope-20260822T022717Z
Aug 22, 2026
Merged

rewrite: Scope scan dependency analysis to a movable suffix#455
halfline merged 5 commits into
mainfrom
publish/rewrite-scan-onto-movable-scope-20260822T022717Z

Conversation

@halfline

Copy link
Copy Markdown
Owner

git-stage-batch rewrite scan snapshots the full BASE..HEAD range and
computes backward-commutation dependency evidence for every commit in it
before a plan can move, split, reorder, or integrate any unit, and plan
validation replays the same range to confirm every unit is conserved. There is
no way to scope that analysis, or a plan's mutability, to a suffix of history,
so a large BASE..HEAD range pays full analysis cost across every unit even
when the intent is to fold only a handful of recent commits into history that
already sits still.

This pull request adds an --onto option, mirroring git rebase --onto:
callers may supply an older frozen base separately from the existing
(renamed) movable-base positional argument. BASE..HEAD is still snapshotted
and fully replayed for validation, but real dependency evidence and a plan's
split, reorder, and donor freedom are restricted to MOVABLE_BASE..HEAD.
Commits in the pinned prefix BASE..MOVABLE_BASE may only be kept, reworded,
or receive movable units through INTEGRATE; plan validation and offline lint
both reject SPLIT, REORDER, and donor use of a pinned commit.

The change threads a new movable_base field through the snapshot schema
(bumping its version), range resolution, dependency analysis, and the
snapshot cache key, and adds test coverage, command-guide and man-page
documentation, and translations for the new option and error strings in every
maintained catalog.

Validation:

  • uv run pytest -n auto
  • uv run ruff check src tests scripts
  • uv run python scripts/check_translations.py
  • uv run python scripts/check_dead_code.py
  • uv run python scripts/check_type_hygiene.py
  • uv run mypy

`git-stage-batch rewrite scan` snapshots the full `BASE..HEAD` range and
computes backward-commutation dependency evidence for every commit in it
before a plan can move, split, reorder, or integrate any unit. Plan
validation replays every commit in that same range to confirm every unit is
conserved.

There is no way to scope that dependency analysis, or a plan's mutability,
to a suffix of history. A large `BASE..HEAD` range pays full O(N^2)
analysis cost across every unit even when the intent is to fold a handful
of recent commits into history that already sits still. There is also no
way to express "fold only recent commits without disturbing older ones" as
a first-class scan mode: every commit in range is treated as equally
movable.

This commit lays the groundwork for scoping a scan to a movable suffix,
mirroring `git rebase --onto`: a caller may supply an older frozen base
separately from the existing movable-base argument, so `BASE..HEAD` is
still snapshotted and fully replayed for validation, but real dependency
evidence and split/reorder/donor freedom are restricted to
`MOVABLE_BASE..HEAD`. Commits in the pinned prefix `BASE..MOVABLE_BASE` may
only be kept, reworded, or used as an integrate target. The change threads
a new `movable_base` field through the snapshot schema (bumping its
version), range resolution, dependency analysis, the snapshot cache key,
and plan validation and lint.

Subsequent commits will add test coverage for the new `--onto` option,
update docs/commands.md and the man page to describe it, and translate the
new strings.
`git-stage-batch rewrite scan` accepts an `--onto` option that captures the
whole `BASE..HEAD` range but restricts backward-commutation dependency
evidence, and a plan's split/reorder/donor freedom, to the movable suffix
`MOVABLE_BASE..HEAD`. Commits in the pinned prefix `BASE..MOVABLE_BASE` may
only be kept, reworded, or receive movable units through INTEGRATE, and
`--onto` requires an explicit movable-base argument.

The project lacks coverage proving any of that behavior actually holds.
Without it, `--onto` argument dispatch, the split between pinned and
movable dependency evidence, and the rejection of SPLIT, REORDER, and donor
use of a pinned commit could regress silently, as could the still-allowed
REWORD and INTEGRATE-target cases for a pinned commit.

This commit continues the series by adding tests that exercise the new
`--onto` command-line dispatch and its required-argument error, the
movable-scope split in dependency analysis, and the plan validation and
lint rules that restrict operations on pinned source commits.

Subsequent commits will document the new option in docs/commands.md and the
man page, and translate the new strings.
`git-stage-batch rewrite scan` accepts an `--onto` option, and the command
guide still describes only the plain positional excluded-boundary form
used when the whole range is movable.

Users reading the command guide cannot find how to snapshot an older frozen
base while restricting real dependency evidence and plan mutability to a
movable suffix of history, or what the pinned prefix between that frozen
base and the movable base is still allowed to do.

This commit addresses that by describing the `--onto` option and the
positional argument's new movable-base role, the required-argument
restriction, and the KEEP/REWORD/INTEGRATE-only treatment of pinned
commits, alongside the existing description of the JSON snapshot and
dependency-graph fields.

Subsequent commits will describe the same option in the installed man page
and translate the new strings.
`git-stage-batch rewrite scan` accepts an `--onto` option, and the command
guide describes it, while installed rewrite help still shows only the plain
positional excluded-boundary form.

Terminal users cannot find the `--onto` syntax, its required-argument
restriction, or the KEEP/REWORD/INTEGRATE-only treatment of pinned commits
at the point of use.

This commit advances public documentation by adding the `--onto` synopsis
entry, its scan-options description, and the pinned-commit restriction to
the rewrite manual source, matching the command guide.

The final commit will translate the new command-line help and error strings
into every maintained catalog.
`git-stage-batch rewrite scan` accepts an `--onto` option, described in the
command guide and installed manual, and its command-line help, positional
description, and required-argument error currently fall back to English in
every localized catalog.

Localized sessions using `--onto` see untranslated help text and error
messages even though the rest of the rewrite scan workflow is translated,
and the catalog synchronization check fails for four new messages.

This commit completes the series by translating the `--onto` help text, the
renamed positional's help text, the required-argument error, and the
movable-base range error in every maintained catalog.

The scan and validation workflow now scopes dependency analysis and plan
mutability to a movable suffix of history, with coverage, documentation,
and translations that match the plain excluded-boundary form it already
supported.
@halfline
halfline merged commit e94d02e into main Aug 22, 2026
12 checks passed
@halfline
halfline deleted the publish/rewrite-scan-onto-movable-scope-20260822T022717Z branch August 22, 2026 11:59
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