fix: Bitbucket Data Center integration hardening (v2.40.0)#24
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
get_pr_diffnow sendsAccept: text/plain→ real unified diff instead of the JSON diff modelwhoamiresolves the user from theX-AUSERNAMEheader (DC has no/users/me); login probe gates onapplication-propertiesonly, so a valid login never prints a false failureload_bitbucket_configfalls back to~/.c3/config.jsonwhen the project has no active account; newc3 bitbucket login --globalUnicodeEncodeError/mojibake on WindowsUser-Agentderived from installed package version (was hardcoded2.30.0)--global, account precedence, upgrade-safety note_caphard-clamps a single over-long lineAccount 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 crashesstatus.Tests
New/updated: header-based
whoami(+ empty-header case),text/plaindiff negotiation, dynamicUser-Agent, project→home config-fallback precedence,_capsingle-line clamp.ruff check .clean; bitbucket + config + claude_md suites green locally.Release
Version bumped to
2.40.0inpyproject.tomlandcli/c3.py. After merge, tagv2.40.0triggersrelease.yml(Trusted Publishing → PyPI + GitHub Release).🤖 Generated with Claude Code