Migrate pb-mirror and decision-model git calls to OsGit #1599

Closed
opened 2026-11-06 16:53:36 +00:00 by jared · 1 comment
Owner

Problem

ruby-gems/pb-mirror/lib/pb_mirror/gitignore_manager.rb runs rev-parse --is-inside-work-tree and check-ignore -q (with a fallback that parses .gitignore when not in a repository). ruby-gems/decision-model/lib/decision/model/evals/git_revision.rb runs rev-parse HEAD and returns nil on failure. These files are in the ruby-gems repository, not in cc-os.

Design: docs/os-git/use-cases-and-domain.md (design) and docs/os-git/call-site-checklist.md (call sites). Settled decisions are in design section 1 (docs/os-git/use-cases-and-domain.md): the gem lives in plugins/os-git with a path: source; git-context and os:worktree merge into os-git; old wrappers go only after all references are updated; design order is use-cases, objects, interfaces; os-context and os-vault become Ruby; ticket tracking stays out of os-git.

Reproduce

n/a: migration of existing call sites; behavior stays the same unless a criterion says otherwise.

Approach

Group A-14. Add os-git to each gem by a path: source (the user's ruling: path sources now, on one machine). Use Repository#ignored? and Repository.find for pb-mirror. Use Repository#resolve("HEAD") for decision-model; it returns nil for an unresolvable HEAD. Commit in the ruby-gems repository with explicit paths. airtable-api/tools/commit_context (G-072) belongs to the git-context ticket (#1591).

Mark every row in the checklist from the Done column as it is replaced. Mark the matching test rows in the same change. Run bin/refresh-plugins after changes to SKILL.md, hooks, or CLIs.

Required work: none beyond the acceptance criteria.

Acceptance criteria

  1. Given a path matched by .gitignore, when pb-mirror checks it, then it reports ignored, and when the directory is not a repository, then the fallback still parses .gitignore.
  2. Given a repository with a commit, when GitRevision reads HEAD, then it returns the sha; given no repository, then it returns nil.
  3. Given each gem's test suite, when it runs, then it passes.
  4. Given rows G-073 and G-074, when the ticket closes, then each row is marked - [x] with Replaced by filled in, or marked out of scope with a reason, in docs/os-git/call-site-checklist.md.
  5. Given the touched code, when it is searched for Open3, system(, %x, backticks, and git argv, then no git call remains outside OsGit adapters, except sites marked out of scope with a reason.

Blocking edges

Blocked by the core ticket (#1588).

Origin

  • Trigger: User request in session 1a5b2630-09c9-46cb-aee4-a5a98e2e7d24 on 2026-11-06: one os-git gem for all local git work in cc-os and the user's projects.
  • Improvised this session: none
  • Chain: single git calls in two gems ← no shared git gem ← DESIGN (docs/os-git/call-site-checklist.md group A-14)
  • Root candidate: none found; searched open issues for git, worktree, octokit, ruby port, python, statusline, reset --hard. Related but not a match: #845, #853, #857, #1527, #1554.
  • Where: ruby-gems/pb-mirror/lib/pb_mirror/gitignore_manager.rb, ruby-gems/decision-model/lib/decision/model/evals/git_revision.rb
  • Session: 1a5b2630-09c9-46cb-aee4-a5a98e2e7d24
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/1a5b2630-09c9-46cb-aee4-a5a98e2e7d24.jsonl
## Problem `ruby-gems/pb-mirror/lib/pb_mirror/gitignore_manager.rb` runs `rev-parse --is-inside-work-tree` and `check-ignore -q` (with a fallback that parses `.gitignore` when not in a repository). `ruby-gems/decision-model/lib/decision/model/evals/git_revision.rb` runs `rev-parse HEAD` and returns `nil` on failure. These files are in the `ruby-gems` repository, not in cc-os. Design: `docs/os-git/use-cases-and-domain.md` (design) and `docs/os-git/call-site-checklist.md` (call sites). Settled decisions are in design section 1 (`docs/os-git/use-cases-and-domain.md`): the gem lives in `plugins/os-git` with a `path:` source; `git-context` and `os:worktree` merge into `os-git`; old wrappers go only after all references are updated; design order is use-cases, objects, interfaces; `os-context` and `os-vault` become Ruby; ticket tracking stays out of `os-git`. ## Reproduce n/a: migration of existing call sites; behavior stays the same unless a criterion says otherwise. ## Approach Group A-14. Add `os-git` to each gem by a `path:` source (the user's ruling: path sources now, on one machine). Use `Repository#ignored?` and `Repository.find` for pb-mirror. Use `Repository#resolve("HEAD")` for decision-model; it returns `nil` for an unresolvable HEAD. Commit in the `ruby-gems` repository with explicit paths. `airtable-api/tools/commit_context` (G-072) belongs to the git-context ticket (#1591). Mark every row in the checklist from the `Done` column as it is replaced. Mark the matching test rows in the same change. Run `bin/refresh-plugins` after changes to `SKILL.md`, hooks, or CLIs. Required work: none beyond the acceptance criteria. ## Acceptance criteria 1. Given a path matched by `.gitignore`, when pb-mirror checks it, then it reports ignored, and when the directory is not a repository, then the fallback still parses `.gitignore`. 2. Given a repository with a commit, when `GitRevision` reads HEAD, then it returns the sha; given no repository, then it returns `nil`. 3. Given each gem's test suite, when it runs, then it passes. 4. Given rows G-073 and G-074, when the ticket closes, then each row is marked `- [x]` with `Replaced by` filled in, or marked out of scope with a reason, in `docs/os-git/call-site-checklist.md`. 5. Given the touched code, when it is searched for `Open3`, `system(`, `%x`, backticks, and `git` argv, then no git call remains outside `OsGit` adapters, except sites marked out of scope with a reason. ## Blocking edges Blocked by the core ticket (#1588). ## Origin - Trigger: User request in session 1a5b2630-09c9-46cb-aee4-a5a98e2e7d24 on 2026-11-06: one os-git gem for all local git work in cc-os and the user's projects. - Improvised this session: none - Chain: single git calls in two gems ← no shared git gem ← DESIGN (docs/os-git/call-site-checklist.md group A-14) - Root candidate: none found; searched open issues for git, worktree, octokit, ruby port, python, statusline, reset --hard. Related but not a match: #845, #853, #857, #1527, #1554. - Where: ruby-gems/pb-mirror/lib/pb_mirror/gitignore_manager.rb, ruby-gems/decision-model/lib/decision/model/evals/git_revision.rb - Session: 1a5b2630-09c9-46cb-aee4-a5a98e2e7d24 - Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/1a5b2630-09c9-46cb-aee4-a5a98e2e7d24.jsonl
Author
Owner

Resolution

Done: pb-mirror GitignoreManager uses Repository.find and #ignored?, keeping the .gitignore fallback. decision-model GitRevision uses Repository.find and #resolve. Both gems take os_git by path source; each gemspec lists it. os-me lock updated.

Evidence: pb-mirror dcfaf10: 57 runs, 0 failures, 1 skip. decision-model b4090d1: 318 runs, 0 failures. os-me suite 438 runs, 0 failures. Grep for Open3, system(, %x, backticks in the touched code is clean.

Follow-ups: none: neither gem was pushed; os_git is not published, so a consumer outside this machine needs its own path source, as the user's path-source ruling accepts

## Resolution **Done:** pb-mirror GitignoreManager uses Repository.find and #ignored?, keeping the .gitignore fallback. decision-model GitRevision uses Repository.find and #resolve. Both gems take os_git by path source; each gemspec lists it. os-me lock updated. **Evidence:** pb-mirror dcfaf10: 57 runs, 0 failures, 1 skip. decision-model b4090d1: 318 runs, 0 failures. os-me suite 438 runs, 0 failures. Grep for Open3, system(, %x, backticks in the touched code is clean. **Follow-ups:** none: neither gem was pushed; os_git is not published, so a consumer outside this machine needs its own path source, as the user's path-source ruling accepts
jared closed this issue 2026-11-06 23:40:55 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jared/cc-os#1599
No description provided.