kunibert
All repositories: gitoria
4.7 KB
# Mission K4: git cache and local diff (kunibert#4, step 2)Task (his words, kunibert#1): "basically we want [the consultant] now to build a similar tool with gitoria and hybriel."This step only: Kunibert gets a PR's code with plain git into its own cache and builds the diff itself (no diff API). Gitoria's push API (gitoria#38) is not built yet, so everything runs against a LOCAL stand-in remote. No gitoria, no tickets, no posting.## Read first- /media/STORAGE/projects/kunibert/docs/DESIGN.md (sections 2, 5, 6, 7) and reports/K2-runner.md, reports/K3-memory.md (what exists).- The existing code: tools/runner.hl, lib/runner.hl (git(), the diff/delta part), lib/review-memory.hl. Extend it; keep what works.- /media/STORAGE/projects/hybriel/docs/HL-PRIMER.md, docs/CODE-ORDER.md; /media/STORAGE/projects/hybriel/plugins/proc/server.hl (run), plugins/fs as needed; the hl:proc and hl:fs sections of /media/STORAGE/projects/hybriel/COMPONENTS.md.Copy working shapes from the docs. Not covered → DOCS line in the report; a framework gap → GAP line with a minimal repro, no workaround. Hybriel .hl only, no JavaScript/TypeScript, no Python in lib/ or tools/ (Python only for test fixtures in scratch).## Build1. **Cache**: one bare repo per remote under `<data>/git/<repo-key>.git` (repo-key = URL-safe form of the remote URL). Created on first use (`git init --bare`), reused after.2. **Fetch** with forced refspecs, only the two refs a job needs: `+refs/pull/<N>/head:refs/kunibert/pr/<N>` and `+refs/heads/<base>:refs/kunibert/base/<base>` (assumed names; gitoria will confirm them, keep the ref names in ONE place). `--no-tags`, a timeout, prune not needed. A force-push on the remote must be picked up (forced update).3. **Auth hook**: the remote will be HTTPS with an app token. Put the token handling behind one function that adds it WITHOUT writing it into the repo config, the URL, argv or logs (e.g. `GIT_CONFIG_COUNT`/`GIT_CONFIG_KEY_0=http.extraHeader`/`GIT_CONFIG_VALUE_0` env, or GIT_ASKPASS reading a file); the token comes from a file path argument (`--token-file`). For the local remote it is simply unused. Show with a test that the token string does not appear in the bare repo's config or in the argv.4. **Job checkout**: for each run a fresh detached worktree (or `git archive` export) of the PR head at `<data>/work/<repo-key>/<N>/`, removed after the run (also on failure). The model runs read-only in it; `.kunibert/pr.diff` and `.kunibert/delta.diff` are written there as today. merge-base(base, head) and the delta (last head..new head limited to the PR's files, rename sides, "rewritten" when not an ancestor) are computed in the bare cache, not in a checkout.5. **Size cap** (K2 note): if the PR diff is larger than a constant (e.g. 400 KB), do not call the model; return a clear error JSON `{"error":"diff too large", bytes}` (later: operator alert).6. **CLI**: `tools/runner.hl review-pr <data> <remote-url> <pr-number> <base-branch> [--token-file f] [--threads f] [--force]`; one JSON line out as before. PR key in the memory = the PR number. Keep the existing `review` (local repo) and `reset` commands working.## Proof (fake codex only: NO real codex runs in this mission; use a fake codex on PATH that prints a saved valid output, like K2/K3 did; saved outputs are in /media/STORAGE/claude-scratch/kunibert/K2 and K3)Stand-in remote under /media/STORAGE/claude-scratch/kunibert/K4/ (never a real repo): a bare repo with main and a PR ref `refs/pull/1/head` (planted change), reached via `file://`.- First `review-pr` run: cache created, both refs fetched, worktree made and removed afterwards, pr.diff matches `git diff merge-base..head` of the remote, state for PR 1 stored.- New commit pushed to refs/pull/1/head → second run sees only the delta.- Force-push of refs/pull/1/head (rewrite) → fetch updates, "rewritten" path taken.- Base moved on remote (new commit on main touching other files) → delta "touches none of the PR's files".- Diff over the cap → error JSON, no model call.- Token test from Build 3 (use a dummy token value like `TESTTOKEN123` in a file).- Failure in the middle (fake codex exit 1) → worktree still removed.- The existing K3 fake proofs for `review`/`reset` still pass (or say which you ran).## Limits- No real codex runs. About 60 tool calls. No sudo, no ~/.codex changes, no commits in the kunibert repo, no pushes outside scratch, no network, no tickets, no messages to others. Scratch only under /media/STORAGE/claude-scratch/kunibert/K4/.- Runtime: /media/STORAGE/projects/hybriel/native/zig-out/bin/hybriel, launched from /media/STORAGE/projects/kunibert.- Report: /media/STORAGE/projects/kunibert/reports/K4-gitcache.md (files changed, exact commands, proof output, DOCS/GAP lines, open points). Stop when done or blocked.
Branches
Latest commits
- bd3591c7conductor: gates run on the live day44 binarymre
- 47f747a7records: jukebox #9 fix livemre
- 0a3169fdMerge branch 'vendored-size' into mainKunibert
- e447bb09Vendored size fix: keep renames with an app side whole; type the filter parameter (L10)mre
- 99ccc742Vendored size fix: no renames in the app diff, filter the resumed delta toomre
- 1a52e100|||PR Diff size limit counts only app files when vendored paths are setmre
- 50a1867estatus: jukebox #9mre
- c57484e6log: jukebox #9 diff sizemre
- 795a20carecords: guard fix live (PR 8)mre
- 6981d96fMerge branch 'fresh-on-nocmd' into mainKunibert
- 37c47840runner: one shared prompt for both fresh-session fallbacks (L16)mre
- f945d2e1|||PR runner: a resumed run with no command on a new head gets one fresh session instead of a tool errormre
- 10b2a49estatus: PR 314, guard fix proposedmre
- e73995a3log: hycon PR 314 approved after fresh reviewmre
- f60427falog: hycon PR 314 false tool errormre
- 481974f7log: Hermes accepts PR 259 findingmre
- bb0976acrecords: hycon PR 259 design findingmre
- 5c637c24records: hycon PR 259 false tool errormre
- a344c406log: routger 132 reviewedmre
- 56e70dcbrecords: review time limit 1800 s (routger 132)mre