Skip to content

refactor: directional update advice in workspace version mismatch error#107

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/workspace-version-mismatch-advice
May 18, 2026
Merged

refactor: directional update advice in workspace version mismatch error#107
Jammy2211 merged 1 commit into
mainfrom
feature/workspace-version-mismatch-advice

Conversation

@Jammy2211
Copy link
Copy Markdown
Collaborator

Summary

Replaces the git clone --branch <version> advice in WorkspaceVersionMismatchError with directional advice that points users to update whichever side is older.

  • Workspace newer than librarypip install --upgrade <lib>==<workspace_version> where <lib> is derived from the workspace folder name (autolens_workspaceautolens, autogalaxy_workspaceautogalaxy, autofit_workspaceautofit, ...).
  • Library newer than workspacecd <workspace_root> && git pull origin main.
  • Unparseable version strings → both options shown as a fallback.

Drops the git clone --branch <version> <workspace-repo-url> instruction since we no longer publish workspace version branches. The workspace_version_check: False bypass instructions and the main-branch IMPORTANT note are preserved unchanged.

API Changes

None — public API surface (WorkspaceVersionMismatchError, check_version) is unchanged. Only the error message text is modified, plus four new private helpers (_parse_version, _library_name_from_workspace, _update_library_block, _update_workspace_block).
See full details below.

Test Plan

  • python -m pytest test_autoconf/test_workspace.py -q — all 14 tests pass
  • Triggering a mismatch where workspace is newer prints the pip install --upgrade ... block
  • Triggering a mismatch where library is newer prints the cd ... && git pull origin main block
Full API Changes (for automation & release notes)

Changed Behaviour

  • autoconf.workspace.WorkspaceVersionMismatchError message text now gives directional update advice instead of a re-clone instruction. Class, exception type, and check_version signature are unchanged.

Added (private)

  • autoconf.workspace._parse_version(version_string) — parses YYYY.M.D.R into a tuple of ints, returns None on failure.
  • autoconf.workspace._library_name_from_workspace(workspace_root) — strips trailing _workspace from the folder name, returns None if absent.
  • autoconf.workspace._update_library_block(library_name, target_version) — formats the pip-upgrade advice.
  • autoconf.workspace._update_workspace_block(workspace_root) — formats the git-pull advice.

Migration

None required — the change is purely cosmetic from any caller's perspective.

🤖 Generated with Claude Code

Replaces the `git clone --branch <version>` instruction in
WorkspaceVersionMismatchError with advice that points users to update
whichever side is older: pip install --upgrade <lib>==<workspace_version>
when the workspace is newer, or `cd <ws> && git pull origin main` when
the library is newer. Library package name (autolens, autogalaxy, autofit,
...) is derived from the workspace folder name. Drops the --branch
<version> reference since we no longer publish workspace version branches.
@Jammy2211 Jammy2211 added the pending-release PR queued for the next release build label May 18, 2026
@Jammy2211 Jammy2211 merged commit 58c696d into main May 18, 2026
6 checks passed
@Jammy2211 Jammy2211 deleted the feature/workspace-version-mismatch-advice branch May 18, 2026 10:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending-release PR queued for the next release build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant