Skip to content

fix(evolution): run rolling branch on latest main - #8

Merged
jhinpan merged 2 commits into
mainfrom
fix/evolution-sync-main
Jul 22, 2026
Merged

fix(evolution): run rolling branch on latest main#8
jhinpan merged 2 commits into
mainfrom
fix/evolution-sync-main

Conversation

@jhinpan

@jhinpan jhinpan commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • fetch and rebase bot/evolution onto the latest protected main before every refresh
  • preserve rolling discovery watermarks while guaranteeing controller/tests are current
  • fail safely on rebase conflicts instead of running stale automation
  • add a real bare-remote/worktree integration test proving state survives and new main code is present

Verification

  • python3 tests/test_evolution.py
  • python3 scripts/validate.py
  • git diff --check

Found by the live cron double-check: after PR #7 merged, the third scheduled-equivalent run still executed the old hardcoded-count test because daily_worker.py cloned the rolling branch without synchronizing main.

Summary by Sourcery

Ensure the evolution rolling branch is rebased onto the latest main before each daily run and covered by an integration test.

Bug Fixes:

  • Prevent the evolution rolling branch from running with stale controller code and tests by rebasing it onto the latest protected main before refresh.

Enhancements:

  • Refactor daily worker Git operations into helper functions for configuring bot identity and synchronizing a clone with its base branch.

Tests:

  • Add an integration-style test that verifies rolling worker state is preserved while the branch is rebased onto the latest main commit.

@gemini-code-assist

Copy link
Copy Markdown

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@sourcery-ai

sourcery-ai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Reviewer's Guide

Ensure the rolling bot/evolution branch is always rebased onto the latest main before each run, centralizing git identity/sync logic and adding an integration-style test that verifies state preservation and up-to-date controller code.

Sequence diagram for updated daily_worker run with rolling branch rebase

sequenceDiagram
    participant Scheduler
    participant daily_worker as run_daily
    participant GitRepo as git_clone
    participant BotIdentity as _configure_bot_identity
    participant SyncBase as _sync_with_base
    participant Git as git

    Scheduler->>daily_worker: run_daily(args)
    daily_worker->>GitRepo: git clone args.source_url
    daily_worker->>BotIdentity: _configure_bot_identity(clone)
    BotIdentity->>Git: git config user.name
    BotIdentity->>Git: git config user.email

    daily_worker->>SyncBase: _sync_with_base(clone, base, branch, source_branch)
    alt source_branch != branch
        SyncBase->>Git: git switch -c branch
    else source_branch == branch
        SyncBase->>Git: git fetch origin +base:refs/remotes/origin/base
        SyncBase->>Git: git rebase origin/base
    end

    daily_worker-->>Scheduler: result dict
Loading

File-Level Changes

Change Details Files
Add an integration-style test that simulates a bare remote and rolling branch to verify rebasing behavior and state preservation.
  • Create a temporary repo/remote/clone layout with main and bot/evolution branches
  • Commit and push a persistent state file on the rolling branch and a controller fix on main
  • Clone the rolling branch, run the sync helpers, and assert that state is preserved while controller changes from main are present
  • Verify HEAD is on bot/evolution and has origin/main as an ancestor
tests/test_evolution.py
Refactor daily worker to configure bot identity via a helper and ensure rolling branch clones are rebased onto the latest base branch before running.
  • Extract git identity configuration into a dedicated _configure_bot_identity helper
  • Introduce a _sync_with_base helper that rebases the rolling branch onto origin/ when source and target branches match
  • Call the new helpers from run_daily instead of inlining the git config/branch-switch logic
  • Fetch the latest base branch from origin before rebase to avoid running on stale main
scripts/evolve/daily_worker.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@jhinpan
jhinpan merged commit b4ef908 into main Jul 22, 2026
3 checks passed
@jhinpan
jhinpan deleted the fix/evolution-sync-main branch July 22, 2026 23:49
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