Skip to content

fix: Bitbucket Data Center integration hardening (v2.40.0)#24

Merged
drknowhow merged 1 commit into
mainfrom
fix/bitbucket-dc-2.40.0
Jun 25, 2026
Merged

fix: Bitbucket Data Center integration hardening (v2.40.0)#24
drknowhow merged 1 commit into
mainfrom
fix/bitbucket-dc-2.40.0

Conversation

@drknowhow

Copy link
Copy Markdown
Owner

Summary

Fixes seven issues found in a live PR-lifecycle evaluation against a Bitbucket Data Center server, plus a version bump to 2.40.0 and docs. The Bitbucket integration was previously validated only against Cloud-style assumptions.

# Sev Fix
1 High get_pr_diff now sends Accept: text/plain → real unified diff instead of the JSON diff model
2 High whoami resolves the user from the X-AUSERNAME header (DC has no /users/me); login probe gates on application-properties only, so a valid login never prints a false failure
3 Med load_bitbucket_config falls back to ~/.c3/config.json when the project has no active account; new c3 bitbucket login --global
4 Med ASCII output + UTF-8 stdout/stderr reconfigure → no more cp1252 UnicodeEncodeError/mojibake on Windows
5 Low User-Agent derived from installed package version (was hardcoded 2.30.0)
6 Low Docs: --global, account precedence, upgrade-safety note
7 Low _cap hard-clamps a single over-long line

Account resolution precedence

Project .c3/config.json → global ~/.c3/config.json → defaults. The PAT always stays in the OS keyring. Path.home() is guarded so a home-less env never crashes status.

Tests

New/updated: header-based whoami (+ empty-header case), text/plain diff negotiation, dynamic User-Agent, project→home config-fallback precedence, _cap single-line clamp. ruff check . clean; bitbucket + config + claude_md suites green locally.

Release

Version bumped to 2.40.0 in pyproject.toml and cli/c3.py. After merge, tag v2.40.0 triggers release.yml (Trusted Publishing → PyPI + GitHub Release).

🤖 Generated with Claude Code

Fixes seven issues found in a live PR-lifecycle evaluation against a
Bitbucket Data Center server, plus a version bump and docs.

- get_pr_diff requests Accept: text/plain so it returns a unified diff
  instead of Bitbucket's JSON diff model (Issue 1)
- whoami resolves the user from the X-AUSERNAME response header (DC has
  no /users/me); the login probe gates on application-properties only so
  a valid login never prints a false failure (Issue 2)
- load_bitbucket_config falls back to ~/.c3/config.json when the project
  has no active account; add `c3 bitbucket login --global` (Issue 3)
- ASCII output + UTF-8 stdout/stderr reconfigure so Bitbucket output no
  longer mojibakes or crashes on Windows cp1252 consoles (Issue 4)
- User-Agent derived from the installed package version, not hardcoded
  2.30.0 (Issue 5)
- _cap hard-clamps a single over-long line as a final guard (Issue 7)
- docs: --global flag, account-resolution precedence, and an
  upgrade-safety note re: pip ~-prefixed backup dirs (Issue 6)

Tests: header-based whoami, text/plain diff negotiation, dynamic
User-Agent, project->home config fallback precedence, and the _cap
single-line clamp. ruff clean; bitbucket + config + claude_md suites green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@drknowhow drknowhow merged commit 8fa80dc into main Jun 25, 2026
11 checks passed
@drknowhow drknowhow deleted the fix/bitbucket-dc-2.40.0 branch June 25, 2026 18:16
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