Skip to content

fix: chunk-and-summarize execution, gemini-3.5-flash context window, and Phase 3/4 checklist fixes - #9

Merged
getdownandcode merged 2 commits into
mainfrom
fix/phase-3-4-review-fixes
Sep 17, 2026
Merged

getdownandcode merged 2 commits into
mainfrom
fix/phase-3-4-review-fixes

Conversation

@getdownandcode

@getdownandcode getdownandcode commented Sep 17, 2026 •

Copy link
Copy Markdown
Owner

Summary

This PR addresses all outstanding items from the consolidated Phase 3 & 4 review checklist and resolves issue #8.

Checklist Status & Direct Answers to Review

1. Phase 3 Review Items (PR #5)

Confirmed landed on main in commit 9e6721f (PR #5) prior to this PR:

  • Empty / safety-filtered response guard: Handled in GeminiProvider._generate_with_retry (resp.text == None raises ProviderUnavailable with finish_reason threaded) and CachedProvider.generate (if response.text.strip(): cache.set(...)).
  • Config CLI root cause fix: cli.py (config show and config set) derives settable/showable fields dynamically via dataclasses.fields(config_mod.GitmateConfig).
  • Cache short-circuit test: test_cache_consulted_before_generate asserts len(provider.calls) == 1.
  • Fast retries: fast_retries fixture sets wait_none() to avoid delays in unit tests.

2. Live template_version Cache Key Wiring

  • In fallback.py:L299-312, CachedProvider is instantiated with template_version=active_template.version_key.
  • version_key dynamically reads the version: <v> header from the live template file (e.g. commit_conventional:v1) via PromptTemplate.version_key (prompt.py:L39-41).
  • Verified by tests: test_template_version_bump_invalidates_cache_key in tests/test_prompt.py and test_template_version_bump_misses_old_entry in tests/test_providers.py.

3. Module Boundary Separation (chunking.py vs fallback.py)

  • Extracted LLM-dependent patch chunking (chunk_patch_text) and chunk summarization (summarize_omitted_diffs) into a dedicated src/gitmate/chunking.py module.
  • src/gitmate/fallback.py maintains its original responsibility: pure, deterministic zero-LLM heuristic fallback generation (generate_fallback_message) plus the top-level orchestration workflow (generate_commit_message).
  • Added unit tests in tests/test_chunking.py.

4. plan.md History & .gitignore

  • Confirmed via git log: plan.md was accidentally placed into .gitignore in the repository's initial scaffold commit 0c8cc10bd1. Because of this, previous phase updates to plan.md existed only on the local filesystem and were never committed to git.
  • Removed plan.md from .gitignore and committed it into the repo, updating all stale Anthropic SDK references (lines 15, 57, 63, 90) to align with AGENTS.md and Gemini default.

5. gemini-3.5-flash Context Window & Aliases

  • Registered "gemini-3.5-flash": 1_048_576 in DEFAULT_MODEL_CONTEXT_WINDOWS with a clarifying comment noting gemini-3.5-flash-lite is the default.
  • Added RetryableError = RetryableProviderError alias in src/gitmate/providers/base.py.
  • Documented DEFAULT_TEMPLATE_OVERHEAD = 500 calibration (~206–330 tokens measured from real templates).

Test Suite

  • 163 tests passing (100% pass rate).
  • Ruff check, ruff format, and mypy strict clean.
  • All GitHub Actions CI checks passing.

Closes #8

Amar K P added 2 commits September 17, 2026 13:29
…ecklist discrepancies

- Implement _chunk_patch_text and summarize_omitted_diffs in fallback.py to chunk and summarize BudgetDecision.omitted_diffs when strategy is BudgetStrategy.NEEDS_CHUNKING, merging summaries into the final commit prompt
- Add gemini-3.5-flash to DEFAULT_MODEL_CONTEXT_WINDOWS in config.py with comment noting gemini-3.5-flash-lite remains default
- Add RetryableError alias for RetryableProviderError in providers/base.py
- Calibrate DEFAULT_TEMPLATE_OVERHEAD (500 tokens) against shipped templates (~206-330 tokens)
- Update plan.md to remove stale Anthropic references and align with AGENTS.md and Phase 4 chunk-and-summarize delivery
- Add tests in test_config.py, test_orchestrator.py, and test_providers.py
- Closes #8
…hunking.py

- Move chunk_patch_text and summarize_omitted_diffs to src/gitmate/chunking.py to cleanly separate LLM-dependent chunking logic from deterministic zero-LLM fallback.py
- Re-export helpers in fallback.py for backward compatibility
- Add dedicated test suite in tests/test_chunking.py (4 new tests, 163 total passing)
@getdownandcode
getdownandcode merged commit c0cee82 into main Sep 17, 2026
2 checks passed
getdownandcode added a commit that referenced this pull request Sep 19, 2026
…d orchestrator consolidation

- #1 (Blocker): Fail loud with exit code 1 on git errors, budget cap breaches, and gh CLI errors across pr-summary and changelog CLI commands.
- #2: Prevent duplicate printing when no changes/commits exist by early returning None.
- #3: Route diagnostic warnings, budget alerts, and error messages to stderr console (err_console) to keep stdout clean for Unix piping.
- #4: Correctly parse and surface breaking changes (exclamation mark and BREAKING CHANGE: footers) in conventional commits and templates.
- #5: Bump changelog template to version 2, including from_ref..to_ref range and explicit release headers.
- #6: Support --title (-t) flag in pr-summary and propagate gh pr create failures.
- #7: Remove dead head argument from fallback PR summary.
- #8: Consolidate duplicate budget checking, safe telemetry recording, and heuristic token counters into orchestrator.py.
- #9: Enforce strict type hints with CommitLogEntry in fallback.py.
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.

fix: chunk-and-summarize execution, gemini-3.5-flash window, and Phase 3/4 checklist discrepancies

1 participant