Migrate os-me Store git calls to OsGit resolve and History #1596

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

Problem

plugins/os-me/lib/os_me/store.rb runs git rev-parse HEAD and git log -1 --format=%H -- FILE through its own Open3 helper. The Stop hook reaches it (record_prediction, CliAppender, os-me append, AppendStamp, Provenance), and so does os-me score.

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-08. Use Repository#resolve("HEAD") and History#last_commit_touching(path). Store raises on failure today: keep that (the messages raise OsGit::Error). The Stop hook keeps its current failure behavior at the edge.

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 store path with commits, when provenance is recorded, then it holds the same HEAD sha and last-commit sha as before.
  2. Given a store file with no commit, when provenance is recorded, then the behavior is the same as before.
  3. Given git fails, when Store reads a revision, then it raises, as before.
  4. Given the os-me provenance tests (rows G-184 to G-186), when they run, then they use OsGit::Testing::ScratchRepo and pass.
  5. Given row G-046 and the test rows G-184 to G-186, 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.
  6. 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: private Open3 helper for two git reads ← no shared history message ← DESIGN (docs/os-git/call-site-checklist.md group A-08)
  • 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: plugins/os-me/lib/os_me/store.rb
  • Session: 1a5b2630-09c9-46cb-aee4-a5a98e2e7d24
  • Transcript: /home/jared/.claude/projects/-home-jared-dev-cc-os/1a5b2630-09c9-46cb-aee4-a5a98e2e7d24.jsonl
## Problem `plugins/os-me/lib/os_me/store.rb` runs `git rev-parse HEAD` and `git log -1 --format=%H -- FILE` through its own `Open3` helper. The Stop hook reaches it (`record_prediction`, `CliAppender`, `os-me append`, `AppendStamp`, `Provenance`), and so does `os-me score`. 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-08. Use `Repository#resolve("HEAD")` and `History#last_commit_touching(path)`. `Store` raises on failure today: keep that (the messages raise `OsGit::Error`). The Stop hook keeps its current failure behavior at the edge. 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 store path with commits, when provenance is recorded, then it holds the same HEAD sha and last-commit sha as before. 2. Given a store file with no commit, when provenance is recorded, then the behavior is the same as before. 3. Given git fails, when `Store` reads a revision, then it raises, as before. 4. Given the os-me provenance tests (rows G-184 to G-186), when they run, then they use `OsGit::Testing::ScratchRepo` and pass. 5. Given row G-046 and the test rows G-184 to G-186, 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`. 6. 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: private Open3 helper for two git reads ← no shared history message ← DESIGN (docs/os-git/call-site-checklist.md group A-08) - 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: plugins/os-me/lib/os_me/store.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: OsMe::Store uses resolve and History#last_commit_touching; both error messages kept. os-me loads OsGit by path source.

Evidence: main ea19631d. os-me 438 runs, 0 failures. Rows G-046, G-184 to G-186 marked.

Follow-ups: #1630 os-git link setup on a new machine (ticket-skeptic verdict).

## Resolution **Done:** OsMe::Store uses resolve and History#last_commit_touching; both error messages kept. os-me loads OsGit by path source. **Evidence:** main ea19631d. os-me 438 runs, 0 failures. Rows G-046, G-184 to G-186 marked. **Follow-ups:** #1630 os-git link setup on a new machine (ticket-skeptic verdict).
jared closed this issue 2026-11-06 22:05:58 +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#1596
No description provided.