Skip to content

[Changelog] Move the nightly lifecycle into cli.py auto-bump and sync uv.lock - #5867

Closed
hujc7 wants to merge 26 commits into
isaac-sim:developfrom
hujc7:jichuanh/changelog-auto-bump
Closed

hujc7 wants to merge 26 commits into
isaac-sim:developfrom
hujc7:jichuanh/changelog-auto-bump

Conversation

@hujc7

@hujc7 hujc7 commented May 29, 2026 •

Copy link
Copy Markdown
Collaborator

Description

The nightly workflow duplicates the compiler's output paths in shell. When the compiler gains another output, that staging list can miss it; version bumps also leave workspace pins in uv.lock behind.

This moves compilation, lock synchronization, staging, bot commits, and push retries into cli.py auto-bump. The workflow supplies the target branch and credentials. Files reported by compilation and lock synchronization determine what is staged, including consumed fragments and outputs outside source/.

Behavior

  1. Compile managed packages independently, publishing healthy packages while returning a failure for unsuccessful ones. Rollback preserves pre-compile file contents, including local edits and fragments deleted before a later failure.
  2. Update only editable workspace members' version pins in uv.lock. Validate the complete parsed result and restrict text changes to version lines. Refuse membership changes requiring a reviewed uv lock; missing lockfiles remain a no-op.
  3. Retry non-fast-forward pushes by fetching the target branch and rebasing the generated commit. Dry runs write nothing and do not commit or push.
  4. Provide sync-lock and sync-lock --check for manual repair and drift detection. Accept dotted fragment slugs under the documented Git branch-name rules; collect Unicode PR paths without Git quoting.

Code organization

Module Responsibility
versions.py Version values and bump arithmetic
fragments.py Filenames, content validation, aggregation, consumption
packages.py Package/root manifests and changelog output
checks.py PR diffs and fragment policy
paths.py Shared repository layout
lockfile.py Workspace pin inspection and repair
gitrepo.py Git operations
autobump.py Nightly lifecycle
cli.py Argument parsing and command dispatch

Existing class imports from packages and Git imports from autobump remain available. The tool requires only the Python standard library; no runtime dependencies were added. No package versions or lockfile contents are changed by this PR.

Validation

  1. uv run --no-project --with pytest python -m pytest tools/changelog/ -q — 176 passed. Consolidated overlapping tests from the previous 184-case suite and extended existing cases for distinct regressions.
  2. Five self-review regression cases failed before their fixes and passed afterward: Unicode PR paths, partial fragment/skip deletion, preservation of uncommitted edits, unexpected lock metadata changes, and a registry block sharing an editable member's name and version.
  3. uv run --frozen isaaclab -f — passed, including repository pre-commit checks.
  4. Compatibility imports passed in both module loading orders; auto-bump --help passed with site-packages disabled.
  5. Real Git lifecycle tests use temporary local bare remotes. No production nightly workflow was dispatched during this update.

Type of change

  1. Bug fix
  2. New maintenance command
  3. Internal refactor

Release backport

  • Backport this pull request to the active release branch after it merges into develop

The scheduled workflow is read from the default branch, then checks out each target branch's tooling. Deploy the auto-bump command to target branches before adopting the updated workflow on the default branch. For a branch storing versions in config/extension.toml, port Package.toml_path, current_version, and write_version together. This update was validated on develop; a release-specific port requires its own validation.

Checklist

  • Read the contribution guidelines
  • Ran repository pre-commit checks
  • Updated tool help and module documentation
  • Added or extended regression coverage
  • Existing contributor entry is present

No source/<package>/ files changed, so package changelog fragments are not required.

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Isaac Lab Review Bot

Verdict: ✅ LGTM

This PR correctly addresses the producer/consumer drift class of bug that caused the 2026-05-29 nightly failure.

What I Checked

Area Status
CLI subcommand implementation ✅ Correct
Error handling ✅ Robust
Replaces workflow steps properly ✅ Yes
Test coverage ✅ Excellent (7 scenarios)

Strengths

  1. Drift-proof by construction — Package.compile() returning (compiled, touched) means the staging set is derived from what cli.py actually wrote, not a duplicated glob in YAML.

  2. Clean architecture — GitRepo (subprocess wrapper with typed exceptions) and AutoBumpRun (orchestrator) have clear single responsibilities.

  3. Robust race handling — The 3-retry push loop with fetch+rebase on NonFastForward handles concurrent commits gracefully without spinning forever.

  4. Partial success semantics — One broken package does not block healthy packages from shipping; exit code reflects failures appropriately.

  5. Comprehensive tests — All 7 scenarios exercise real tempdir repos with bare-remote pushes, no mocking subprocess. This catches integration issues the PR gate would miss with unit-only tests.

Minor Notes (not blocking)

  • _extract_version_from_diff gracefully returns "?" on parse failure — appropriate for informational commit messages.
  • Bot identity hardcoded as class constants is intentional (public values, per the design doc).

No issues found. Ready for human reviewer sign-off.


Reviewed at HEAD: 15e9d206bfeb8fe53f865510399398ad92835f36

@hujc7 hujc7 mentioned this pull request Jul 26, 2026
7 tasks
@hujc7
hujc7 force-pushed the jichuanh/changelog-auto-bump branch 2 times, most recently from 73ba95a to 4c1748c Compare July 26, 2026 12:07
@hujc7 hujc7 mentioned this pull request Jul 26, 2026
3 tasks done
@hujc7
hujc7 marked this pull request as ready for review July 26, 2026 18:41
@hujc7
hujc7 requested a review from a team July 26, 2026 18:41
@greptile-apps

greptile-apps Bot commented Jul 26, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR centralizes the nightly changelog lifecycle in the Python tooling.

  • Splits package, lockfile, and auto-bump behavior into dedicated modules.
  • Adds exact touched-path staging, bot commits, push retry, and uv.lock synchronization.
  • Extends fragment filename handling and adds regression and integration coverage.

Confidence Score: 3/5

The PR is not yet safe to merge because a failed manual compile can still destroy a maintainer's pre-existing unstaged edits.

The manual compile path permits a dirty working tree and rolls tracked files back with git checkout --, so a partial compile failure replaces existing working-tree contents with their index versions.

Files Needing Attention: tools/changelog/cli.py, tools/changelog/autobump.py

Important Files Changed

Filename Overview
tools/changelog/autobump.py Adds the Git-backed nightly orchestration, clean-tree precondition, rollback support, exact staging, commit creation, and push retry.
tools/changelog/cli.py Refactors command handling and adds auto-bump and lock synchronization, while the manual compile rollback can still overwrite pre-existing working-tree edits.
tools/changelog/packages.py Extracts the changelog domain model and expands fragment filename and package compilation behavior.
tools/changelog/lockfile.py Adds surgical workspace-member version synchronization for uv.lock.
tools/changelog/test/test_auto_bump.py Adds coverage for clean-tree ownership, rollback, staging, committing, and push retry behavior.
uv.lock Synchronizes workspace-member versions with their package manifests.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    CLI[cli.py auto-bump] --> Run[AutoBumpRun.run]
    Run --> Compile[Compile package fragments]
    Compile --> Sync[Sync uv.lock]
    Sync --> Stage[Stage reported touched paths]
    Stage --> Commit[Create bot commit]
    Commit --> Push[Push target branch]
    Push -->|Non-fast-forward| Rebase[Fetch and rebase]
    Rebase --> Push
Loading

Reviews (3): Last reviewed commit: "Assume a clean checkout in auto-bump; sy..." | Re-trigger Greptile


def _stage_and_commit(self, touched: list[Path]) -> None:
"""Stage exactly ``touched`` and commit it as the bot."""
self.repo.add(touched)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Existing index entries get committed

When auto-bump runs from a checkout containing unrelated staged changes, GitRepo.add(touched) adds to the existing index and the subsequent plain git commit commits the entire index, causing those unrelated changes to be pushed under the bot identity despite the contract to commit exactly the compiler-reported paths.

Comment thread tools/changelog/cli.py Outdated
Comment on lines 147 to 153
# ``CompileFailed`` wraps a failure that happened after the compile had
# already written; this command has nothing to stage, so it is reported
# exactly like a failure that happened before the first write.
except (Package.CompileFailed, OSError, ValueError) as e:
print(f" ERROR ({pkg.name}): {e}", file=sys.stderr)
failures.append((pkg.name, str(e)))
continue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Failed compiles retain partial writes

When Package.compile writes the changelog and then fails while updating the version or deleting fragments, this handler records CompileFailed and continues without restoring e.written, causing the command to exit nonzero while leaving an inconsistent package that can later generate a duplicate changelog entry.

@isaaclab-review-bot isaaclab-review-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isaac Lab Review Bot

Summary

This PR moves the nightly changelog commit/push lifecycle out of workflow YAML and into a new auto-bump subcommand, splitting the former 1553-line cli.py into packages.py (domain model), lockfile.py (uv.lock member pins), autobump.py (git + lifecycle orchestration), and a slimmer cli.py. The central idea — the staging set is produced by the compiler (touched paths) rather than described by a glob in YAML — is sound and directly addresses the class of bug described in the PR body. The LockFile surgical version rewrite is well-scoped, with assert_repairable() enforcing the narrowness rather than merely documenting it, and the branch-agnostic Package.toml_path resolution keeps the tool cherry-pickable to release branches. Fragment slug rules are now pinned against git check-ref-format, which is a nice way to keep the documented convention and the implementation from drifting. Remaining concerns are small and localized: the commit step trusts the ambient index, and the standalone compile command does not roll back a partially applied compile the way auto-bump does.

Architecture impact

Layering is clean and acyclic (cli → autobump → {lockfile, packages}), and flat sibling modules match the existing tools/template/ convention so script-mode execution works with no sys.path shim. Nested helper types (GitRepo.NonFastForward, LockFile.Error, LockFile.Drift) follow the repo's preference for nesting self-contained helpers. GitRepo is a thin, testable subprocess boundary rather than a mocked abstraction, which keeps the tests honest. Scope is confined to tools/changelog/ plus one AGENTS.md doc update; no public Isaac Lab API is affected. The one architectural coupling worth noting is that AutoBumpRun builds its commit from the process-wide git index, so the 'stage exactly what was reported, nothing else' contract holds only when the index starts clean.

Test coverage

Coverage is substantially expanded (~90 → ~170 tests) and generally well targeted: the staging contract is asserted against what Package.compile reports rather than a hardcoded file list, fragment deletions are verified as staged (not just unlinked), push retry/exhaustion is exercised against a real bare-repo remote, partial-failure isolation is covered, and the uv.lock path covers the rewrite, block scoping for duplicate names, membership guards, idempotence, and the no-lock release-branch shape. The new conftest helpers keep fixtures asking Package.toml_path instead of hardcoding a layout, which is what makes the suite survive a cherry-pick. Two gaps are worth closing: the dry-run test does not assert the working tree is unmodified, and the writing (--check-less) sync-lock CLI path is only covered at the model level.

Implementation verdict

Minor fixes needed. Posted 4 actionable findings inline.

The PR exceeded the automated context budget, so some file content was truncated.

Automated comment-only review; human maintainers own approval decisions.

Comment thread tools/changelog/autobump.py Outdated
"""
self._run(
"-c",
f"user.name={author_name}",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Warning — Commit picks up any pre-existing staged changes

git commit commits the whole index, not only the paths passed to GitRepo.add(). AutoBumpRun never verifies the index is clean before staging, so if a maintainer runs auto-bump locally with anything already staged, that unrelated change silently lands in the bot commit and is pushed — which contradicts the stated contract that the commit carries exactly what the compile reported. CI checkouts are clean so this is not a nightly-path bug, but the local invocation is a documented use of the subcommand. Either assert a clean index up front and fail with a clear message, or build the commit through a temporary index containing only touched.

Comment thread tools/changelog/cli.py Outdated
dry_run=args.dry_run,
)
except (FileNotFoundError, ValueError) as e:
# ``CompileFailed`` wraps a failure that happened after the compile had

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Suggestion — compile leaves a partially applied compile on disk

Package.CompileFailed specifically signals a failure that occurred after the compile had already written. auto-bump uses that signal to roll back, but cmd_compile only records the failure and moves on, so a maintainer running cli.py compile --all can be left with a changelog entry written, the version bumped, and the fragments not yet consumed — re-running then duplicates the entry. The inline comment explains that this handler has nothing to stage, which is true, but staging and rollback are separate concerns. Consider restoring the paths carried by CompileFailed here (or making Package.compile transactional for all callers) so both entry points leave the tree in a consistent state.

assert autobump.AutoBumpRun.AUTHOR_NAME not in authors
# Fragment must still be on disk — dry-run is a preview, not a commit.
assert frag.exists()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Suggestion — Dry-run test does not assert the working tree is untouched

test_auto_bump_dry_run_does_not_commit checks only that no bot commit reached the remote and that the fragment still exists. A regression that wrote the bumped version or prepended the changelog entry, but still skipped commit and push and left fragments in place, would pass. Since --dry-run is documented as 'compile without writing', assert that too — e.g. snapshot the version file and CHANGELOG.rst before the run, or assert git status --porcelain is empty afterwards. Seeding a drifting uv.lock in the same test would additionally cover the lock-sync dry-run branch.


def test_sync_lock_check_reports_drift_and_exits_non_zero(tmp_path, monkeypatch, capsys):
"""``sync-lock --check`` must render the drift it found and fail.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Suggestion — The writing sync-lock command handler is untested

Both cmd_sync_lock tests pass check=True. LockFile.sync() is well covered at the model level, but nothing asserts that the default cli.py sync-lock invocation actually reaches it, so a handler or parser regression turning the write path into a no-op would go unnoticed — and that path is the one AGENTS.md now tells contributors to run after a manual version edit. A short test that invokes the handler with check=False against a drifted workspace and asserts both the rewrite and a zero exit code would close this.

@hujc7 hujc7 changed the title [Changelog] Move nightly commit/push lifecycle into cli.py auto-bump subcommand [Changelog] Move the nightly lifecycle into cli.py auto-bump and sync uv.lock Jul 27, 2026
@hujc7

hujc7 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

@greptileai review

Since your last pass the branch has changed substantially — please weight these:

  • New Changelog class owning both halves of the CHANGELOG.rst header invariant (strict anchor + the self-heal that runs before it). The self-heal was previously written out three times.
  • New FragmentFilename; slug rules are intended to equal git check-ref-format --branch minus /, pinned by a differential test against real git.
  • New RootPackage modelling the repo-root pyproject; LockFile now holds one.
  • GitRepo.add returns what it staged; commit and has_staged_changes are scoped to those paths.

Both findings from your previous review are fixed and covered: the commit now uses a pathspec so a pre-existing index entry cannot ride along, and cmd_compile rolls back a half-applied compile the way auto-bump does.

Comment on lines +479 to +480
self.repo.fetch(self.remote, f"refs/heads/{self.branch}")
self.repo.rebase("FETCH_HEAD")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Staged entries block push retry

When an unrelated change is already staged and the remote branch advances before the bot pushes, the path-scoped commit leaves that entry in the index and this unconditional rebase runs with a dirty index, causing Git to reject the rebase and abort the auto-bump instead of retrying the push.

Comment thread tools/changelog/cli.py Outdated
Comment on lines +146 to +154
except Package.CompileFailed as e:
# Failed after writing, so the package is left announcing a
# version that never landed over a fragment that was never
# consumed — and a re-run would compile that fragment into a
# duplicate entry. ``auto-bump`` rolls this back; the manual
# path has to as well.
print(f" ERROR ({pkg.name}): {e}", file=sys.stderr)
failures.append((pkg.name, str(e)))
GitRepo(REPO_ROOT).restore(e.written)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Rollback discards existing edits

When a maintainer has unstaged edits to a changelog or version file and a manual compile fails after overwriting it, this rollback passes the path to GitRepo.restore, whose checkout replaces the working-tree file with the index copy, silently deleting the maintainer's pre-compile edits.

@hujc7

hujc7 commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator Author

@greptileai review

@hujc7
hujc7 force-pushed the jichuanh/changelog-auto-bump branch 2 times, most recently from 74f0edd to 953ea6f Compare July 27, 2026 15:14
@AntoineRichard

Copy link
Copy Markdown
Collaborator

hujc7 added 6 commits July 31, 2026 01:24
The nightly changelog cron's wedge mode on 2026-05-29 (workflow's
git-add glob missing pyproject.toml after isaac-sim#5785 added the pyproject
write path) was a producer/consumer drift bug between cli.py and
nightly-changelog.yml. The two surfaces carried duplicated knowledge of
which files cli.py touches, and the YAML side never got the memo when
the producer grew a new write site.

Lift the entire post-compile lifecycle (stage, commit, rebase-on-conflict
loop, push) out of inline shell in the workflow and into a new
``cli.py auto-bump`` subcommand. The orchestrator derives its staging
set from each ``Package.compile`` return value, so the glob is an
in-process list of files cli.py just wrote — drift is impossible by
construction. The workflow shrinks to one ``python3 cli.py auto-bump``
call (follow-up on main once this lands on develop and release).

Changes:

- ``Package.write_changelog_entry`` and ``Package.write_version`` now
  return the list of paths they wrote (empty in dry-run).
- ``Package.compile`` returns ``(compiled, touched)`` — the existing
  truthy/falsy semantics carry through ``cmd_compile``'s ``any_compiled``
  tracking.
- New ``GitRepo`` class: thin subprocess wrapper around the ``git`` CLI
  with one nested exception (``NonFastForward``) for the policy decision
  the orchestrator cares about.
- New ``AutoBumpRun`` class: end-to-end lifecycle owner. Hardcoded bot
  identity (deterministic public values, not secrets), three-retry push
  loop with fetch+rebase on conflict, partial-success across packages.
- New ``cmd_auto_bump`` handler + subparser.

Tests in tools/changelog/test/test_auto_bump.py cover seven scenarios
against a tempdir working tree + bare-repo remote with no GitHub
interaction:

- Happy path commits and pushes.
- pyproject.toml staging regression (today's bug class).
- Non-fast-forward push → rebase loop → second push succeeds.
- Exhausted retries raise GitError.
- Partial success: one bad package, one good; healthy commit ships,
  exit 1.
- Dry-run skips commit/push entirely.
- No fragments is a clean no-op.

Workflow YAML on main consumes the new subcommand in a follow-up PR.
The nightly bumps each package's version metadata file, but uv.lock
pins those same workspace members by version. Left behind, every
`uv sync --locked` / `--frozen` consumer fails with "the lockfile needs
to be updated" until a human re-locks by hand.

Add a LockFile class that rewrites only the workspace members' own
version lines -- no network, no resolution, no third-party churn -- and
call it from AutoBumpRun once every package has compiled. uv.lock is a
single repo-level artifact pinning all members at once, so the sync is
global rather than per-package. The written path joins the same
touched-paths manifest the compiler feeds, which is what gets the lock
staged and committed alongside the bump it belongs to, in one commit,
with no separate `git add` to keep in step.

That matters because uv.lock sits at the repo root, outside source/, so
no `git add source/...` glob can reach it at all -- the second instance
of the producer/consumer drift the auto-bump subcommand removes.

The sync refuses to touch a lock whose membership no longer matches
[tool.uv.sources]: a package added or removed brings dependency edges a
version rewrite cannot invent, and needs a real `uv lock` with a
reviewed diff. That failure reds the tile but does not block the
commit, since such a lock was already stale before the run started and
wedging the nightly would strand every package's changelog.

Measured on develop: the surgical rewrite takes `uv lock --check` from
exit 1 to exit 0 with an 8-line diff, where a full `uv lock` rewrites
3136 lines of marker-expansion churn that no reviewer would read in an
unattended 5 AM commit.

Carries the uv.lock sync from isaac-sim#6727, restructured as a class and folded
into the auto-bump lifecycle per the review discussion there.
Branch-state compatibility tests surfaced two holes in the auto-bump
staging contract, both silent and both able to survive review.

Fragment deletions were missing from the manifest. `Package.compile`
consumes fragments by unlinking them, but reported only the files it
wrote, so `AutoBumpRun` staged the changelog entry and the version bump
while leaving the deletions unstaged. The commit would land without
them, the fragments would return on the next checkout, and the next
nightly would recompile them into a duplicate entry and a second
version bump -- every night. The old inline shell got this right only
incidentally, via a blanket `git add --update -- source/`. The delete
helpers now return the paths they removed and `compile` reports them,
including the skip-only cleanup path that produces no bump at all.

Unstaged deletions also left the working tree dirty, which aborts the
`git rebase` in the push-retry loop; reverting the fix reds the two
race-resolution tests as well.

`GitRepo.add` now tolerates a path that is gone and was never tracked.
`git add` fails the whole invocation with "pathspec did not match any
files" in that case, which would take the entire staging step down over
one stray file.

Separately, every git call now runs with `-c color.ui=false`. git drops
colour for a pipe by default, but `color.ui = always` in a developer or
runner config overrides that, and the escapes break line-prefix
matching: `-version = "1.2.3"` arrives as `\x1b[31m-version = ...`, so
the commit body degrades to `- pkg: ? → ?`. The same escapes threaten
the `[rejected]` scan that drives non-fast-forward retry, which today
survives only because it uses a substring test rather than a prefix.

Tests now commit and push a baseline before running. Production runs
against a checkout where every manifest and pending fragment is already
tracked; leaving the fixture untracked changed what was under test and
was what let the deletion bug hide. It also made "file absent from the
pushed tree" pass vacuously when nothing was pushed, so the assertions
now anchor on the package being present first.
cli.py had grown to 1553 lines holding three unrelated concerns. Move it
to the layering the dependencies already implied:

  cli.py       command handlers, argument parser, entry point   (462)
  autobump.py  nightly compile/sync/stage/commit/push lifecycle (307)
  lockfile.py  uv.lock member version pins                      (250)
  packages.py  versions, fragments, packages, PR diffs          (885)

The direction is acyclic -- cli imports autobump, autobump imports
lockfile and packages -- which is what forced the shape. Extracting the
lifecycle alone was not possible: cli needs AutoBumpRun for its command
handler while AutoBumpRun needs Package, so the domain model had to move
down rather than the orchestration move out.

Flat modules beside cli.py, matching tools/template/. The workflow runs
`python3 tools/changelog/cli.py`, and script mode puts only the script's
own directory on sys.path, so siblings import with no configuration; a
nested package would need sys.path juggling or a `-m` invocation, which
is exactly the workflow-side knowledge this series removes.

cli.py re-exports the domain names so `import cli` remains the single
entry point for the tool and its tests. No test file changed.
Cherry-picking the series onto release/3.0.0-beta2 and running it there
turned up four tests that only passed because they assumed develop's
layout.

The lockfile fixture wrote member versions to pyproject.toml under a
[project] table. On a branch whose Package reads config/extension.toml
that lookup returns None, no targets resolve, and the lock looks
permanently in sync -- so every drift assertion would have passed
vacuously rather than failed loudly.

The multi-file write test used config/extension.toml as its synthetic
second write site, which *is* the real version file on release. It would
have collided with it instead of exercising a second site.

The layout rule now lives once, in test/conftest.py, and both modules
ask it. Keeping two copies of "where does this branch put a version"
is the same duplication-drift this series exists to remove.
An external review of the branch found six defects, each reproduced and
now covered by a regression test verified to fail without its fix.

`git ls-files` is read with `-z`. Under the default `core.quotePath` git
C-quotes any path holding a non-ASCII byte, so a fragment named
`josé-fix.rst` came back as `"jos\303\251-fix.rst"`, failed the
comparison, and had its deletion dropped from the staging set -- the
duplicate-entry, double-bump failure this series exists to prevent, via
the very code added to prevent it.

The lock is now reconciled on every run rather than only when a package
bumped. Previously a membership mismatch reported failure once and then
went quiet, because the next night had no fragments, exited early, and
never looked at the lock. A run that only re-points the lock gets a
commit subject that says so instead of claiming to compile fragments.

`LockFile.rewrite` is scoped to the editable members' `[[package]]`
blocks by position. Keying on name alone would rewrite a registry
package that shares a workspace member's name, moving a third-party pin
away from the hashes and source metadata recorded beside it.

`LockFile.check` runs behind the same membership and TOML guards as
`sync`, so `sync-lock --check` can no longer report "in sync" for a lock
that `assert_repairable` would reject, nor leak a parser traceback.

`Package.compile` hands back what it wrote when it fails partway. A
failure after the changelog write previously discarded those paths, and
the unstaged residue aborts the rebase in the push-retry loop. Only a
genuinely half-applied compile is wrapped; failing before the first
write keeps its original exception type.

The retry fetches `refs/heads/<branch>` rather than a bare name, which a
same-named tag would otherwise win, rebasing onto an unrelated commit
while the push targeted the branch.

Push rejection is detected from `--porcelain`'s column-zero `!` flag
instead of scanning human output for "[rejected]": the prose is
translated, the flag is not.

Reviewer notes not adopted: `ClassVar` was suggested for the new class
constants, but `AutoBumpRun` and `LockFile` are plain classes, not
dataclasses, where the annotation carries no meaning.
hujc7 added 7 commits July 31, 2026 01:24
The rule was described as mirroring `git check-ref-format`, which is the
raw refname check and is more permissive than intended -- it accepts a
leading `-`. The rule actually implemented, and the one wanted, is
`git check-ref-format --branch`: the names git will let you give a
branch. That is the point, since the convention contributors are given
is "name the fragment after your branch". `git branch -- -foo` fails for
the same reason the gate rejects `-foo.rst`.

Adds a differential test that asks git directly across a corpus of
slugs and asserts our answer matches, rather than restating the rules a
third time. `/` is the single deliberate divergence -- git allows it in
a branch, a filename cannot contain it -- and has its own test saying
so. Verified the guard bites: allowing a leading dash fails the test and
names the input that diverged.

The rule is reimplemented in Python only because validating every
fragment through a subprocess would be absurd; the test is what keeps
the copy honest.
Re-running the release-branch proof against current code turned up
twelve tests still building packages with a literal
`(root / "pyproject.toml").write_text(...)`. The earlier portability
commit had only migrated the two files added by this series; test_parse,
test_validate and test_integration predate it and kept the assumption.

They now go through `conftest.write_version_file`, so the whole suite
asks the code under test where a version lives instead of asserting it.
References to the repo-root `pyproject.toml` are left alone: that is the
workspace declaration, which is the same filename on every branch.

Verified on release/3.0.0-beta2 with its own layout ported in:
169 passed, 1 skipped (the uv.lock gate, correctly skipped), and
`auto-bump --dry-run` clean against that branch's real packages.
Both review bots landed on the same two gaps.

`git commit` commits the whole index, so anything already staged in the
caller's checkout rode along under the bot identity -- contradicting the
contract that the commit carries exactly what the compile reported. CI
checkouts are clean, so this was never a nightly-path bug, but the
subcommand is documented for local use and the contract should hold
because of how the command is built rather than because of where it
happens to run. `commit` now names the paths, and `add` returns the ones
it actually staged so the two cannot disagree -- a path filtered out by
`add` has nothing to commit, and naming it would abort the commit.

`cmd_compile` recorded a `CompileFailed` and moved on. That signal
exists precisely because the compile had already written, so the manual
path could leave an entry announcing a version that never landed over a
fragment that was never consumed; re-running then compiled it a second
time. auto-bump already rolled this back. Now both entry points do.

Tests: the dry run asserts the working tree is unchanged rather than
only that no commit was pushed -- a regression that wrote the bump and
then skipped the commit would have passed -- and seeds a drifting lock
so the lock-sync dry-run branch is covered in the same run. Adds the
writing `sync-lock` path, which AGENTS.md now points contributors at and
which was only covered at the model level. Each verified to fail without
its fix.
Three pieces of knowledge were written out more than once. Each is the
duplication this series exists to remove, and each was inside its own
code.

The header invariant had two halves and only one was shared. The strict
anchor lived in a module constant that the compiler and the gate both
imported -- its comment even said "so the two cannot drift" -- while the
self-heal that runs first was spelled out separately in the compiler,
the gate, and a test. Change the repair in one and the gate and the
compiler disagree about which files are acceptable: a fragment passes at
PR time and then wedges the nightly, or is rejected for a shape the
compiler handles fine. `Changelog` now owns both halves and answers
`has_valid_header()` for everyone. CHANGELOG.rst was also the only file
this tool touches with no model of its own.

Where a package keeps its fragments was built three ways: as a Path on
the model, and twice as an f-string, because the PR gate matches
git-diff output and needs the repo-relative text form. Same location,
two representations -- now derived from one.

Which files in a fragment directory are not fragments was stated in
three places. A second sentinel added to the walker but not the gate
would make them disagree about what a directory contains.

Adds a test asserting the gate and the compiler accept the same
self-healed file, verified to fail if `has_valid_header` stops
normalising first.
Reviews kept surfacing failure modes reachable only from a working tree
auto-bump will never see -- a maintainer's staged edit riding along in
the bot commit, a retained index entry blocking the retry rebase, a
rollback stepping on uncommitted work. Each had a defensive fix, and
each fix cost more than the case was worth.

State the precondition instead. The nightly workflow always hands this
command a fresh checkout, so it asserts that once and refuses to run
otherwise. That deletes the pathspec-scoped commit and the scoped
staged-changes check added for those cases, and it turns local misuse
into one obvious error rather than a commit that quietly carries someone
else's work. The other subcommands keep no such precondition; `compile`,
`check` and `sync-lock` are maintainer tools legitimately run on a dirty
tree.

Also syncs uv.lock, which was left out earlier on the reasoning that the
nightly would heal it once the workflow switch landed. It will, but the
install-CI suite runs `uv lock --check` on every PR and that gate is red
on develop today -- two PRs and a merge away from being healed. The diff
is nine version lines, produced by this PR's own `sync-lock`, and takes
`uv lock --check` from exit 1 to exit 0.

Two things the PR was saying that were not true:

- Five places claimed `Package.toml_path` resolves the branch layout, so
  the same code is correct on either. It does not: `current_version` and
  `write_version` are `[project]`-scoped too. Three coordinated edits, not
  one -- which matters because a cherry-pick is the remaining manual step
  in the plan, and that sentence told whoever does it to change one file.
- Both dry-run lock tests seeded the lock *in sync*, so `sync()` returned
  at its "nothing to do" guard and never reached the write-suppression
  branch. The docstring claimed the opposite. The fixture can now seed a
  stale pin, and the second test -- whose assertions were a strict subset
  of the first's -- is gone.
The workflow file on this branch was two fixes behind the copy that
actually runs. It still carried `git add source/*/changelog.d/ ...` --
the glob whose drift bricked the cron on 2026-05-29 -- and the
`always()` guard that isaac-sim#5859 replaced. Inert while the cron reads the
default branch, but release branches become the default branch, so a
release cut from here would have carried both regressions back.

Rebased on the running copy and finished the job: the compile and
commit/push steps collapse into one `cli.py auto-bump` call. The file no
longer contains a `git add`, a commit message, a bot identity, or any
statement about which files the compiler writes -- which is the point,
since that duplicated knowledge is what went stale twice. It keeps what
is genuinely the workflow's: the schedule, the branch list, the
checkout, and the App token.

`--event-name` is not passed; cli.py reads GITHUB_EVENT_NAME, which
Actions exports into every step.

Adds a second guard. The existing one checks that the target branch has
`tools/changelog/cli.py` at all; a branch predating this subcommand
passes that and then dies on an argparse error deep in the run, after
the checkout and the token mint. The new step runs `auto-bump --help`
and fails with a message naming the fix. It sits after `setup-python`
rather than beside the file check, because the tool needs 3.11+ for
`tomllib` and the runner's default interpreter may be older -- verified
by running the probe under 3.10, where it fails on the import.

Net 45 insertions, 89 deletions against the running copy.
The nightly commits uv.lock unreviewed, so a rewrite that produced a
malformed or mis-pinned lock would surface at whoever next ran uv sync
rather than in this job. The rewrite's own block-index scoping is what
could be wrong, so it cannot serve as its own witness.

Re-derive the outcome from the produced text before it reaches disk: it
must parse as TOML, keep the line and package counts, and move exactly
the pins the drift report named. Pins are compared position-wise, since
a lock may carry two blocks under one name -- an editable member and a
registry release -- and rewriting the wrong one yields a valid file with
the right name, line count and package count.
@hujc7
hujc7 force-pushed the jichuanh/changelog-auto-bump branch from f066b5b to 56909b6 Compare July 31, 2026 08:25
@hujc7

hujc7 commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 15, 2026
@hujc7

hujc7 commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator Author

Reviving this @kellyguo11 @StafaH

@hujc7

hujc7 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 16, 2026
@hujc7

hujc7 commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

run-ci

@isaaclab-bot isaaclab-bot Bot added ci:run-docker Trigger the on-demand Docker and GPU CI workflow and removed ci:run-docker Trigger the on-demand Docker and GPU CI workflow labels Sep 16, 2026
@kellyguo11 kellyguo11 closed this Sep 29, 2026
StafaH pushed a commit that referenced this pull request Sep 30, 2026
…ck in sync (#8118)

## Summary

- Replaces the custom changelog compiler with towncrier and `uv
version`: `tools/changelog/cli.py` shrinks from 1,146 to ~320 lines and
compiles today's pending fragments to the same versions and entries.
- Keeps `uv.lock` in step with the nightly version bumps, so a clean
checkout's first `uv run` no longer rewrites it.

# Description

- **Fragments:** one `<slug>.<type>.rst` per entry type (`added`,
`changed`, `deprecated`, `removed`, `fixed`) holding only `* ` bullets;
an empty `<slug>.minor` / `<slug>.major` raises the bump; `<slug>.skip`
is unchanged. The check rejects the old `<slug>[.minor|.major].rst`
format. The nightly still splits old-format fragments merged before this
change or without re-running CI, in a marked workaround section of
`cli.py` that never overwrites an existing fragment; delete that section
once none are pending.
- **`cli.py check`** (pre-commit and the fragment-check job): each
changed package must add a valid fragment and may not change a pending
one; every `CHANGELOG.rst` keeps the `.. towncrier release notes start`
marker line; each local package must be in `uv.lock` at its
`pyproject.toml` version. The rest of the lock is not resolved, so
unrelated dependency drift never fails a PR.
- **`cli.py compile`** (nightly): runs only on a clean checkout. Per
package, `uv version --bump` + `towncrier build`, then one `uv lock` on
the uv pinned in the Docker images. If the re-lock fails or would change
anything but local packages' versions, nothing is committed that night.
`compile` stages exactly its outputs and reports any other changed file.
- **Nightly:** compiles only branches carrying
`tools/changelog/towncrier.toml`; release branches pick the change up by
backport.
- **`isaaclab_tasks_experimental`** gains a `CHANGELOG.rst`, so its
pending fragments now compile.
- **`uv.lock`** is re-locked once: 9 local package pins had fallen
behind their `pyproject.toml`.
- Supersedes #5867.

**Before / after**, for a PR that adds a feature and a fix with a minor
bump.

Before: one file,
`source/isaaclab/changelog.d/add-foo-sensor.minor.rst`:
```rst
Added
^^^^^

* Added :class:`~isaaclab.sensors.FooSensor` for per-link foo readings.

Fixed
^^^^^

* Fixed contact sensor reset behavior when only a subset of environments was reset.
```
After: one file per type, plus an empty tier file:
```text
# source/isaaclab/changelog.d/add-foo-sensor.added.rst
* Added :class:`~isaaclab.sensors.FooSensor` for per-link foo readings.

# source/isaaclab/changelog.d/add-foo-sensor.fixed.rst
* Fixed contact sensor reset behavior when only a subset of environments was reset.

# source/isaaclab/changelog.d/add-foo-sensor.minor
(empty)
```
Both compile to the same `CHANGELOG.rst` entry: the check rejects the
first in new PRs, and the nightly splits any already merged into the
second.

Verified in a scratch clone of `develop`: `compile` produced the old
tool's versions for all 9 packages with pending fragments,
byte-identical `CHANGELOG.rst` entries for 7 and the same bullets in
fragment-name order (instead of merge order) for 2, consumed every
fragment, staged only its outputs, and changed only version lines in
`uv.lock`.
CI also runs a unit test with the real uv and towncrier.

## Type of change

- New feature (non-breaking change which adds functionality)
- Bug fix (non-breaking change which fixes an issue)
- Documentation update

## Release backport

- [x] <!-- backport-active-release --> Backport this pull request to the
active release branch after it merges into `develop`

## Screenshots

Not applicable.

## Checklist

Docker and GPU tests run on demand. Push the commits you want tested,
then
comment `run-ci` on the pull request.

- [x] I have read and understood the [contribution
guidelines](https://isaac-sim.github.io/IsaacLab/main/source/refs/contributing.html)
- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) on
the changed files
- [x] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] I have added a `.skip` changelog fragment for each package whose
`CHANGELOG.rst` gained the marker; the tooling itself is outside the
source packages
- [x] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants