Ratchet git_gate coverage to >=90% (ADR 0004) #298

Open
didericis-claude wants to merge 1 commits from ratchet-git-gate-90 into ratchet-egress-core-90
Collaborator

Stacked on #297 (base = ratchet-egress-core-90). Fourth per-module ratchet under ADR 0004.

Summary

Covers two previously-untested halves of git_gate.py:

  • git_gate_render_gitconfig (pure renderer) — empty entries, insteadOf URL, scheme override, RemoteKey ssh-alias with and without a non-default port, and newline-injection rejection via _gitconfig_validate_value.
  • Dynamic gitea deploy-key lifecycle (forge provisioner mocked) — _provision_dynamic_key writes the key + key-id files, strips .git from owner/repo, builds the proposal title, and raises on a missing token; revoke_git_gate_provisioned_keys revokes when the id-file is present and skips static-provider entries / missing id-files / raises on missing token.

Coverage

Module Before After
git_gate.py 70% (unit) / 80% (combined) 99%

13 new tests; full suite (1442) passes; pyright clean; pylint 10.00.

Stacked on #297 (base = `ratchet-egress-core-90`). Fourth per-module ratchet under ADR 0004. ## Summary Covers two previously-untested halves of `git_gate.py`: - **`git_gate_render_gitconfig`** (pure renderer) — empty entries, `insteadOf` URL, scheme override, `RemoteKey` ssh-alias with and without a non-default port, and newline-injection rejection via `_gitconfig_validate_value`. - **Dynamic gitea deploy-key lifecycle** (forge provisioner mocked) — `_provision_dynamic_key` writes the key + key-id files, strips `.git` from owner/repo, builds the proposal title, and raises on a missing token; `revoke_git_gate_provisioned_keys` revokes when the id-file is present and skips static-provider entries / missing id-files / raises on missing token. ## Coverage | Module | Before | After | |---|---|---| | `git_gate.py` | 70% (unit) / 80% (combined) | **99%** | 13 new tests; full suite (1442) passes; pyright clean; pylint 10.00.
didericis-claude added 1 commit 2026-06-25 22:11:22 -04:00
test(git-gate): ratchet git_gate coverage to >=90%
test / unit (pull_request) Successful in 43s
test / integration (pull_request) Successful in 17s
test / coverage (pull_request) Successful in 58s
lint / lint (push) Successful in 1m53s
5365a7a852
Fourth per-module ratchet under ADR 0004. Cover the pure
`git_gate_render_gitconfig` renderer (empty entries, insteadOf URL,
scheme override, RemoteKey ssh alias with/without non-default port,
newline-injection rejection) and the dynamic gitea deploy-key
lifecycle with the forge provisioner mocked:

- `_provision_dynamic_key`: writes key + key-id files, strips `.git`
  from owner/repo, builds the proposal title; missing token raises.
- `revoke_git_gate_provisioned_keys`: revokes a gitea key when the
  id-file is present, skips static-provider entries and missing
  id-files, raises on a missing token.

bot_bottle/git_gate.py: 70% -> 99% (unit only). Two remaining partial
branches are inner conditionals on the alias/owner-repo paths.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NkwFXLFff9PYPy4wgVBJp9
Some checks are pending
test / unit (pull_request) Successful in 43s
test / integration (pull_request) Successful in 17s
test / coverage (pull_request) Successful in 58s
lint / lint (push) Successful in 1m53s
This pull request can be merged automatically.
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin ratchet-git-gate-90:ratchet-git-gate-90
git checkout ratchet-git-gate-90
Sign in to join this conversation.