Skip to content

Rewrite configuration to use Pydantic. Make error messages more user-friendly. Allow retrying inputs in the wizard. Improve configuration documentation. - #50

Merged
eyarz merged 6 commits into
datreeio:masterfrom
rudolfbyker:dev/pydantic
Aug 2, 2026
Merged

eyarz merged 6 commits into
datreeio:masterfrom
rudolfbyker:dev/pydantic

Conversation

@rudolfbyker

@rudolfbyker rudolfbyker commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

This PR makes configuration cleaner, safer and more understandable.
It also prevents the wizard from crashing when you make typos.

This is technically a breaking change, but since this repo is currently broken anyway, and it's not being released under any kind of semantic versioning, I think it's fine, and a step in the right direction.

Copilot AI review requested due to automatic review settings July 24, 2026 13:45
@rudolfbyker
rudolfbyker requested a review from eyarz as a code owner July 24, 2026 13:45

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

This PR refactors configuration handling to use Pydantic models for validation and normalization, updates the interactive wizard to reprompt on invalid values, and refreshes configuration documentation and examples to match the new schema.

Changes:

  • Introduces Pydantic-based config models with validation, case-insensitive keys, and improved error formatting.
  • Updates the configuration wizard to validate inputs and reprompt only invalid fields, and writes config via yaml.safe_dump.
  • Adds tests covering hostname validation, secret redaction in validation errors, and wizard reprompt behavior; updates README/config examples and dependency list.

Reviewed changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/test_wizard.py Adds a regression test to ensure wizard validation errors are shown and only invalid fields are reprompted.
tests/test_config.py Adds tests for hostname validation and ensuring validation errors do not leak rejected secret values.
src/jira_backup/_wizard.py Reworks wizard flow to validate with Pydantic and reprompt invalid fields; writes config safely.
src/jira_backup/_config.py Replaces TypedDict config with Pydantic models, validation, case-insensitive key normalization, and formatted errors.
src/jira_backup/_backup.py Updates runtime config usage from dict access to typed model fields; adds --config and friendlier config-load failure handling.
README.md Updates configuration documentation and examples for the new schema and --config option.
pyproject.toml Adds Pydantic v2 dependency.
config.yaml Removes tracked config file (previously contained guidance inline).
config.example.yaml Adds a new example config matching the Pydantic schema.
.gitignore Ignores config.yaml to reduce the chance of committing secrets.
Comments suppressed due to low confidence (1)

src/jira_backup/_wizard.py:85

  • input_boolean() currently treats any unrecognized input as False (because parse_boolean() only recognizes truthy values). This can silently misconfigure booleans when a user mistypes; it should reprompt until the user answers y/n (or equivalent).
def parse_boolean(s: str) -> bool:
    return s.lower() in ("yes", "true", "t", "1", "y")


def input_boolean(q: str) -> bool:
    return parse_boolean(input(f"{q} (y/n) "))

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/jira_backup/_backup.py Outdated
Comment thread src/jira_backup/_config.py
Comment thread README.md
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@eyarz
eyarz merged commit b182367 into datreeio:master Aug 2, 2026
3 of 4 checks passed
@rudolfbyker
rudolfbyker deleted the dev/pydantic branch August 5, 2026 12:41
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.

3 participants