Skip to content

3.0.3#153

Merged
rcaloras merged 9 commits into
masterfrom
3.0.3-dev
Apr 15, 2026
Merged

3.0.3#153
rcaloras merged 9 commits into
masterfrom
3.0.3-dev

Conversation

@rcaloras
Copy link
Copy Markdown
Owner

No description provided.

rcaloras and others added 9 commits April 15, 2026 09:55
- New validation.py with validate_email, validate_username, validate_password
  functions matching server constraints (username 1-39 chars, alphanumeric +
  underscores/hyphens; email format + domain dot; password min 8 chars)
- get_new_user_information() now re-prompts per field on invalid input
  rather than sending bad data to the API
- Added password confirmation prompt with mismatch re-prompt loop
- 19 unit tests for validators, 7 integration-style tests for the full
  registration prompt flow

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add _extract_error_message() helper that surfaces plain text server
  responses, falls back to DRF JSON extraction, then to a generic string
- register_user(), login_user(), register_system() now print clean messages
  for 409/422 (server text) and 401 (hardcoded "Incorrect username or
  password."); all other status codes also attempt extraction before
  falling back to a generic message
- Fix typo: "Lets retry" -> "Let's retry"
- 17 new tests covering extraction logic and all three call sites

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add type annotations to all functions and tricky variables across all
  source files using from __future__ import annotations for Python 3.9+
  compatibility with X | None and list[X] syntax
- Use TypeVar on Serializable.from_JSON/from_JSON_list so subclass calls
  return the correct type (e.g. LoginResponse.from_JSON returns LoginResponse)
- Add mypy and ruff configs to pyproject.toml; add dev dependency group
  with mypy, ruff, types-requests, types-python-dateutil
- Fix real bugs caught by mypy: get_mac_address variable type reuse,
  get_user_information_and_login returning None instead of (None, None, None),
  SystemPatch.__str__ concatenating nullable fields, traceback.format_exc
  called with wrong signature, missing return in get_system_information
- Clean up stale/duplicate imports, unused variables, == None comparisons,
  star imports replaced with explicit imports throughout

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Asserts are stripped in optimized mode (-O) and give unhelpful errors.
Replace with proper if-guards that exit gracefully with a user-facing
message, matching the existing error handling style in the file.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Install .[dev] in CI to pull in mypy, ruff, and type stubs
- Run ruff and mypy as steps before pytest on every push
- Consolidate separate access_token/system_name None checks into one guard

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tions

The mac fingerprint used to identify a system with the server was
recomputed from uuid.getnode() on every run and never persisted, so any
drift (multi-interface boxes, VPN/Docker churn, random-mac fallbacks)
caused get_system_information to 404 and forced a duplicate registration
under a new name. This was most commonly hit on routine `bashhub update`
runs, where update_system_info 404s on PATCH and the installer falls
through to bashhub setup.

Treat ~/.bashhub/config as the source of truth for the mac. On any
successful server interaction (register, PATCH, or name-fallback
resolve), pin the agreed-on value into config so future runs read it
back instead of recomputing. Add a name-fallback self-heal to both
update_system_info and handle_system_information using the server's
existing GET ?mac=&name= fallback and PATCH-with-mac-in-body support —
no server changes needed.

Plan and follow-ups (py-machineid adoption, explicit-confirm name
reclaim) captured in docs/tasks/mac-fingerprint-stabilization-plan.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@rcaloras rcaloras merged commit c3259dc into master Apr 15, 2026
3 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