Skip to content

fix(scripts): never abandon a detached local commit; model the dry-run relock after a nested server bump - #1450

Merged
ErikBjare merged 3 commits into
masterfrom
fix/bump-submodules-detached-head-dry-relock
Sep 17, 2026
Merged

ErikBjare merged 3 commits into
masterfrom
fix/bump-submodules-detached-head-dry-relock

Conversation

@ErikBjare

Copy link
Copy Markdown
Member

Follow-up to #1447 for the two Codex findings that arrived after it merged.

  • Detached local commit abandoned (P1): the preflight table flagged a submodule detached at a commit not on origin/master as DIVERGED and promised not to move it, but ff_master only checked the local master branch — git checkout master then dropped the commit. Now refuses any HEAD with commits outside origin/master.
  • Dry-run relock after a nested server bump (P2): when step 1 would commit a nested pointer in aw-server-rust, the real run relocks aw-tauri to a commit that does not exist yet; the dry run reported the old lock as aligned and left both the lock commit and the aw-tauri pointer out of the plan. It now says "would relock aw-tauri to it" and counts aw-tauri as moved.

Verified on a scratch clone (aw-core detached on an empty local commit → left alone; synthetic aw-webui commit under aw-server-rust → "would relock", 2-pointer bundle plan) and on the real bundle (every submodule HEAD identical before/after --dry-run).

…n relock after a nested server bump

Follow-up to #1447 (Codex findings that landed after the merge):
- a clean submodule detached at a commit not on origin/master was flagged
  DIVERGED in the preflight table ("will NOT be moved") but ff_master
  only checked the local master branch, so `checkout master` abandoned
  the commit. ff_master now refuses any HEAD with commits outside
  origin/master.
- under --dry-run, a nested pointer bump inside aw-server-rust means the
  real run relocks aw-tauri to a server commit that does not exist yet;
  the preview reported the old lock as aligned and omitted both the lock
  commit and the aw-tauri pointer. It now says so and counts aw-tauri as
  moved.

Verified on a scratch clone: aw-core detached on a local commit is left
alone; a synthetic aw-webui commit under aw-server-rust yields "would
relock" and a 2-pointer bundle plan. The real bundle moves nothing.
@ErikBjare

Copy link
Copy Markdown
Member Author

@greptileai review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 17, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-17T16:09:26.579076Z 01ce54e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 111485560e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

elif [ "$PAIR_FIXED" = 1 ]; then
echo " aw-tauri or aw-server-rust is skipped/held; judging the lock at the pointers to be committed (aw-tauri ${TAURI_REV:0:7}, aw-server-rust ${SERVER_SHA:0:7})"
if lock_at_server; then LOCK_ALIGNED=1; echo " aligned"; fi
elif [ "$DRY" = 1 ] && dry_bumped aw-server-rust; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Honor --no-push when previewing nested server bumps

When the script is invoked with both --dry-run and --no-push, a nested change in aw-server-rust enters this branch before the existing PUSH=0 check. It therefore reports that the lock and aw-tauri pointer would be committed and marks the pair aligned, while an actual --no-push run skips relocking because the newly created server commit is local-only, leaving both bundle pointers out. Require pushing in this branch or process the PUSH=0 case first so the preview matches the requested mode.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Confirmed and fixed in f517178: the preview branch now also requires PUSH=1, so --dry-run --no-push falls through to the existing "cargo can only relock to a revision on GitHub" warning, matching what the real --no-push run does. Verified on the scratch clone in both modes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Correction to my previous reply: f517178 was not enough — with the preview branch skipped, the chain reached lock_at_server (judged at the old origin/master revision) and reported "already aligned", while the real --no-push run fails alignment against the new local commit and withholds both pointers. 01ce54e handles a dry-bumped aw-server-rust before that check in both modes: with pushing, "would relock"; under --no-push, the same refusal the real run gives, and both pointers stay out of the plan. Verified on the scratch clone: --dry-run --no-push now shows the warning and no bundle commit; --dry-run shows the relock and a 2-pointer plan.

@greptile-apps

greptile-apps Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge; the prior dry-run --no-push discrepancy is fully addressed and no new actionable issue was found.

Findings

  1. P2 No-push preview overstates changes

Summary

This PR makes submodule bumping safer and improves the accuracy of dry-run planning.

  • Refuses to fast-forward a submodule when its current HEAD contains commits absent from origin/master, preventing detached local work from being abandoned.
  • Models the future aw-server-rust commit and corresponding aw-tauri relock when previewing nested bumps.
  • Makes --dry-run --no-push withhold both coupled pointers, matching real-run behavior.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[Inspect submodule HEAD] --> B{HEAD has commits outside origin/master?}
    B -->|Yes| C[Warn and leave submodule unchanged]
    B -->|No| D[Fast-forward safely]
    D --> E{Dry nested aw-server-rust bump?}
    E -->|No| F[Perform normal lock-alignment checks]
    E -->|Yes| G{Push enabled?}
    G -->|Yes| H[Plan server commit and aw-tauri relock]
    G -->|No| I[Keep server and aw-tauri pointers out of bundle]
Loading

Reviews (2) · Last reviewed commit: "fix(scripts): under --dry-run --no-push ..."

Comment thread scripts/bump-submodules.sh Outdated
Comment on lines +423 to +428
elif [ "$DRY" = 1 ] && dry_bumped aw-server-rust; then
# Step 1 would commit a nested pointer in aw-server-rust, so the real
# run relocks to a commit that does not exist yet.
echo " [dry-run] aw-server-rust would get a new commit (nested bump); would relock aw-tauri to it and commit the lock"
LOCK_ALIGNED=1
DRY_BUMPED="$DRY_BUMPED aw-tauri"

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.

P2 No-push preview overstates changes

When --dry-run and --no-push are combined with a nested aw-server-rust bump, this branch marks the lock aligned and aw-tauri moved before considering that pushing is disabled. The preview therefore includes both pointers, while the equivalent real run skips relocking and excludes them, making the plan inaccurate.

Suggested change
elif [ "$DRY" = 1 ] && dry_bumped aw-server-rust; then
# Step 1 would commit a nested pointer in aw-server-rust, so the real
# run relocks to a commit that does not exist yet.
echo " [dry-run] aw-server-rust would get a new commit (nested bump); would relock aw-tauri to it and commit the lock"
LOCK_ALIGNED=1
DRY_BUMPED="$DRY_BUMPED aw-tauri"
elif [ "$DRY" = 1 ] && dry_bumped aw-server-rust; then
# Step 1 would commit a nested pointer in aw-server-rust, so the real
# run relocks to a commit that does not exist yet unless pushing is disabled.
if [ "$PUSH" = 0 ]; then
warn "skipped: cargo can only relock to a revision on GitHub, and --no-push would leave the new aw-server-rust commit local-only"
else
echo " [dry-run] aw-server-rust would get a new commit (nested bump); would relock aw-tauri to it and commit the lock"
LOCK_ALIGNED=1
DRY_BUMPED="$DRY_BUMPED aw-tauri"
fi

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 01ce54e: a dry-bumped aw-server-rust is handled before the lock check in both modes — with pushing, "would relock aw-tauri"; under --no-push, the same refusal the real run gives (cargo can only relock to a revision on GitHub) and both pointers stay out of the plan. Verified on a scratch clone with a synthetic nested aw-webui commit: --dry-run --no-push shows the warning and no bundle commit.

…ng, like the real relock

Under --dry-run --no-push a nested aw-server-rust bump previewed a lock
commit and an aw-tauri pointer move that a real --no-push run cannot
make (cargo can only relock to a revision on GitHub). The preview now
falls through to the same warning.
… the relock refusal, not the stale lock

The previous commit only skipped the relock preview; the chain then
reached lock_at_server, judged at the old origin/master revision, and
reported the lock as already aligned. The real --no-push run relocks
against the new local commit, fails, and withholds both pointers. The
preview now says the same.
@ErikBjare

Copy link
Copy Markdown
Member Author

@greptileai review

@ErikBjare
ErikBjare merged commit 5b6a438 into master Sep 17, 2026
6 of 20 checks passed
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