Skip to content

Distinguish develop-behind from diverged in the branch check - #432

Merged
ptr727 merged 3 commits into
developfrom
audit-branch-direction-fix
Jul 25, 2026
Merged

Distinguish develop-behind from diverged in the branch check#432
ptr727 merged 3 commits into
developfrom
audit-branch-direction-fix

Conversation

@ptr727

@ptr727 ptr727 commented Jul 25, 2026

Copy link
Copy Markdown
Owner

What

The audit.py branch-drift check split by direction: a path develop still holds at the merge-base is a genuine forward-sync ("develop lacks"); a path both branches moved off the base is diverged and reported as "changed on both main and develop … develop may already supersede main."

Why

Surfaced by the PlexCleaner convergence (ptr727/PlexCleaner#880): the check flagged 4 workflow files as "develop lacks (forward-sync needed)" when develop was actually ahead (it carried the release-task re-vendor #882 that main lacked). The old logic only tested main != develop among main-side changes, never whether develop was behind or ahead, so a both-changed file read as a develop deficit. Forward-syncing per that framing would have reverted develop's work.

Verification

  • python3 spec/audit.py --selftest PASS; spec/validate.py OK.
  • Live: PlexCleaner's 4 workflow files now report as diverged (accurate) instead of develop lacks.

🤖 Generated with Claude Code

ptr727 and others added 2 commits July 24, 2026 17:55
Two kinds of Python need different project-type requirements: utility
code (as in PlexCleaner) can and should carry unit tests and coverage,
while codegen/boilerplate that runs during another tool's build to emit
generated source (ESPHome codegen producing enriched C++) has no tests
and no coverage and needs only the linter. Capture the work to add a
linter-only Python type, and record that ESPHome-Config's +python
reclassification is deferred until it exists.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The branch-drift check flagged every path where main changed since the
merge-base and main != develop as "develop lacks (forward-sync needed)",
without testing direction. A path both branches moved (main's Dependabot
pin plus develop's own re-vendor) landed in that set even though develop
supersedes main, so the audit told a converging repo to forward-sync
files that would have reverted its work. Split the set: a path develop
still holds at the merge-base is a genuine forward-sync; a path both
branches moved is diverged and reported as such (develop may already
supersede main), never as a develop deficit.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 25, 2026 02:11

Copilot AI 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.

Pull request overview

Updates the spec/audit.py branch-drift logic to correctly distinguish when develop is genuinely behind main versus when both branches have changed since the merge-base, preventing misleading “forward-sync needed” findings in diverged cases.

Changes:

  • Split branch-drift reporting into two buckets: behind (develop still at merge-base) vs diverged (both branches moved off merge-base).
  • Add a clearer DRIFT finding message for diverged paths to prompt reconciliation before promotion.
  • Extend the README backlog with an item proposing a linter-only Python project type for codegen/boilerplate use cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
spec/audit.py Refines branch-drift detection to report directionally-correct findings (behind vs diverged) based on merge-base comparisons.
README.md Adds a TODO/backlog item describing a potential new “linter-only Python” project type.

Comment thread spec/audit.py Outdated
Comment thread spec/audit.py Outdated
Address the review: tighten the inline comment to one sentence per line
per the comment-hygiene rule, and move the behind-vs-diverged logic into
a pure classify_branch_drift() helper exercised by a selftest fixture
that covers modify/add/delete on main plus a develop-only change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 25, 2026 02:29

Copilot AI 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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@ptr727
ptr727 merged commit 9c2cd89 into develop Jul 25, 2026
7 checks passed
@ptr727
ptr727 deleted the audit-branch-direction-fix branch July 25, 2026 02:49
ptr727 added a commit that referenced this pull request Jul 25, 2026
…) (#434)

## Promote develop to main

Four doc/spec-only changes, all squashed to develop and Copilot-clean:

- **#430** - README backlog: refresh the stale README + evaluate a
lower-maintenance structure.
- **#431** - README backlog: a linter-only Python type
(codegen/boilerplate: no tests/coverage, linter only) distinct from the
utility `python` type; ESPHome-Config `+python` deferred until it
exists.
- **#432** - `audit.py` branch check now splits "develop genuinely
behind" (forward-sync) from "changed on both / develop may supersede",
with a `classify_branch_drift()` helper + selftest. Surfaced by the
PlexCleaner convergence, where develop was ahead but read as a
forward-sync gap.
- **#433** - canonical `build-release-task.yml` artifact-delete uses the
`if ! …; then` form instead of a force-success tail (matches the listing
step; write-safety compliant). Changes the `github-release` verbatim
region → fleet re-vendors next cycle.

No code/workflow changes to the hub's own pipeline - documentation and
spec only, so no release fires on merge.

## Verification

- `spec/validate.py` OK; `spec/audit.py --selftest` PASS.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
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.

2 participants