Skip to content

Fetch milestones after search input#151

Open
subhajitlucky wants to merge 1 commit into
zigcBenx:masterfrom
subhajitlucky:fetch-milestones-async-48
Open

Fetch milestones after search input#151
subhajitlucky wants to merge 1 commit into
zigcBenx:masterfrom
subhajitlucky:fetch-milestones-async-48

Conversation

@subhajitlucky
Copy link
Copy Markdown

Fixes #48.

Summary

  • prompts for a milestone search term before fetching manual milestone choices
  • sends the search term to the GitLab milestones API instead of preloading every active milestone
  • falls back to the full active milestone list when the search has no matches
  • adds regression tests for query encoding and fallback behavior

Verification

  • python3 -m unittest tests.test_milestones -v
  • python3 -m unittest discover -v
  • python3 -m compileall gitHappens.py tests
  • git diff --check

Copilot AI review requested due to automatic review settings May 12, 2026 14:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates milestone selection to avoid preloading all active milestones by first prompting for a search term and querying GitLab’s milestones API with that term, with a fallback to the full active milestone list when the search yields no results (Fixes #48).

Changes:

  • Add a milestone search prompt before manual milestone selection and pass the query to the GitLab milestones API.
  • Implement fallback behavior to fetch the full active milestone list when the search returns no matches.
  • Add regression tests covering query encoding and fallback behavior.

Reviewed changes

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

File Description
gitHappens.py Adds search-aware milestone fetching and integrates a manual search prompt + fallback.
tests/test_milestones.py Adds unit tests for milestone query encoding and fallback selection logic.
tests/__init__.py Adds tests package marker for test discovery/imports.

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

Comment thread tests/test_milestones.py
Comment on lines +35 to +40
sys.modules["inquirer"] = inquirer_stub

spec = importlib.util.spec_from_file_location("gitHappens_under_test", root / "gitHappens.py")
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
Comment thread tests/test_milestones.py
Comment on lines +11 to +23
root = Path(__file__).resolve().parents[1]
config_dir = root / "configs"
config_dir.mkdir(exist_ok=True)
(config_dir / "config.ini").write_text(
"[DEFAULT]\n"
"base_url=https://gitlab.example\n"
"group_id=42\n"
"custom_template=Custom\n"
"GITLAB_TOKEN=test-token\n"
"squash_commits=true\n"
"delete_branch_after_merge=true\n",
encoding="utf-8",
)
Comment thread tests/test_milestones.py
Comment on lines +24 to +27
(config_dir / "templates.json").write_text(
'{"templates": [], "reviewers": []}',
encoding="utf-8",
)
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.

Fetch milestones async

2 participants