Skip to content

Template 0.1.20: lock files, no lost workflow pushes, fresh JupyterLab launch - #37

Merged
IvanHCenalmor merged 1 commit into
mainfrom
claude/template-0.1.20
Nov 4, 2026
Merged

IvanHCenalmor merged 1 commit into
mainfrom
claude/template-0.1.20

Conversation

@IvanHCenalmor

Copy link
Copy Markdown
Collaborator

Summary

Template 0.1.20. Design note: .tools/docs/migration_0_1_20.md.

1. Lost workflow pushes (race between the two update workflows)

A push that touches both src/ and notebooks/ starts Updates on src change and Updates on notebook change. Each checks out the triggering commit, so the second one to commit was behind main and its push was rejected (non-fast-forward). The notebook workflow then ran "Revert user commit that broke requirements" (its condition was any failure) and created a revert of the user's merge; only a second rejected push stopped it (CellMigrationLab/LabChronicle runs 41727822989 and 41800906840).

  • Both workflows commit inline and, on a rejected push, git rebase --autostash onto the latest branch and push again (5 attempts; a conflict stops with ::error:: and pushes nothing). stefanzweifel/git-auto-commit-action is removed.
  • The revert runs only when the conda test failed, on top of the latest branch, with -m 1 only for a merge commit.
  • Separate concurrency groups (a shared group keeps one waiting run, so a third push cancelled the other workflow's run).

2. Lock files

  • New .tools/python/lock_requirements.py (uv==0.13.3, uv pip compile --universal) writes requirements*.lock.txt next to each requirements file: every package with its exact version for Windows, macOS and Linux (versions only, no hashes).
  • Conda packages of environment.yaml constrain the resolution and are not emitted; per-OS files are constrained by the main lock; index lines (CUDA) are kept.
  • A fingerprint header rewrites a lock only when its inputs change. A failure is a warning: the stale lock is removed and the installer falls back to the plain file.
  • Used by the notebook workflow (after the merge), test_conda_environment.sh (plus a pip check warning), post_install.sh / .bat and bump_constructor.py (bundles the locks).

3. Launcher

  • launch_jupyter.py asks to press Enter when JupyterLab stops (--no-wait skips it); the Windows menu command ends with & exit, so the window closes.
  • Every launch gets a new, empty --LabApp.workspaces_dir (removed afterwards): only the app's Welcome notebook opens, no notebooks of other apps. Settings and themes are kept.

Migration v0_1_19_to_v0_1_20.py

Surgical and idempotent; replaces a file only when it is still the 0.1.19 template file, otherwise SKIPPED with the reason; keeps line endings; never deletes.

Test plan

  • pytest tests/ on Linux (WSL): 204 passed; tests/smoke/post_install_hosts.py passes; ruff and mypy clean. On Windows the same 55 bash/Linux-only tests fail as on main, none new.
  • Workflow commit/revert steps run with bash and real git against a local origin that moves during the run (rebased push, conflict, revert of a merge and of a plain commit).
  • Real uv 0.13.3 lock of LabChronicle's requirements installs into Python 3.11 with pip; pip check clean.
  • menuinst 2.3.1 renders the Windows .bat ending with Welcome.ipynb & exit; post_install.bat lock selection tested in real cmd.
  • Windows: launch an app, check the window closes after Enter and only the Welcome notebook opens.
  • macOS: same (Terminal may show [Process completed] depending on its profile).
  • A real GitHub Actions run and an installer build in an app after the sync (run Updates on notebook change once to create the locks).

🤖 Generated with Claude Code

…b launch

Workflow race (update_on_notebook_change.yml / update_on_src_change.yaml):
- Both workflows commit inline and, when the push is rejected because the
  branch moved, rebase onto it (git rebase --autostash) and push again
  (5 attempts). stefanzweifel/git-auto-commit-action is no longer used.
- The revert of a user commit runs only when the conda test failed, on top
  of the latest branch, with -m 1 only for a merge commit.
- Each workflow has its own concurrency group (a shared group kept only one
  waiting run, so a third push cancelled the other workflow's run).

Lock files:
- New .tools/python/lock_requirements.py (uv==0.13.3, uv pip compile
  --universal) writes requirements*.lock.txt next to each requirements file:
  every package with its exact version, versions only. Conda packages of
  environment.yaml are constraints, not emitted. A fingerprint header keeps
  the lock unchanged until its inputs change. A failure is a warning and
  removes the stale lock.
- The notebook workflow runs it after the merge; test_conda_environment.sh,
  post_install.sh / .bat and bump_constructor.py use the lock when present.

Launcher:
- launch_jupyter.py asks to press Enter when JupyterLab stops (--no-wait to
  skip) and gives JupyterLab a new, empty workspaces_dir at every launch, so
  only the app's Welcome notebook opens.
- notebook_launcher.json: the Windows command ends with "& exit" so the cmd
  window closes after Enter.

Migration v0_1_19_to_v0_1_20.py (surgical, idempotent, skips customised
files), tests (workflow steps run with real git against a moving origin,
lock script, bump_constructor, launcher, migration, chain) and the design
note .tools/docs/migration_0_1_20.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@IvanHCenalmor
IvanHCenalmor merged commit 1a12399 into main Nov 4, 2026
4 checks passed
@IvanHCenalmor
IvanHCenalmor deleted the claude/template-0.1.20 branch November 4, 2026 11:27
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