mrmrs-fad256
mrmrs-fad256Openinto main
2 commits · 6 files · +4 added · ~2 modified · 8 behind main · Seen by zach 14 days ago
Description
task_loop: shallow_worker_branch_refresh_v1 (fresh shallow worker -> task branch -> first parent refresh, Oak vs Git, HTTP request counts)
Problem
- On hosted oak.space, a fresh
oak clone --shallowworker spends ~180 s on its first parent refresh (switch -c,fetch,agent state --refresh). - The cause is the client walking every main ancestor with one sequential POST /commits/info per commit.
- This branch adds loopback, reproducible evidence comparing Oak with competent Git on the same task, judged by an independent final-state oracle.
Scenario contract (new immutable name, ADR-0005)
- Untimed setup, per COMMITS:SEED fixture:
- Build a deterministic merge-history Git repo.
- Import it with the fixed
--oak-serve-bininto an owned loopbackoak serve, then push. - Serve a bare copy with GitHTTPServer.
- Put both servers behind RequestCountingProxy.
- Oak cell
shallow.*:clone --shallow --allow-legacy-scope, thenswitch -c task, thenfetch. Each step is timed separately.- A separate
shallow.branch_create_repeat_localrow runs a secondswitch -cin the refreshed worker to isolate local switch cost.
- A separate
- Oak cell
shallow_pull.*: a freshclone --shallow, thenswitch -c task, thenpull(branch with no new work, main unchanged). Comparing it with theshallow.*cell shows whether first-refresh ancestry work lands in switch, fetch, or pull. - Git cell
shallow.*:clone --depth 1, thenswitch -c task, thenfetch. - Git cell
warm_worktree.*:worktree add -b task … origin/main, thenfetch, starting from an untimed warm full clone. That is a different starting state and is labeled as such. - Per-step fields: elapsed_ms, returncode, http_request_count, http_commits_info_request_count, http_requests_by_method, network_wire_bytes/connections, injected_request_delay_ms, oracle_passed.
- Unobserved values are null, never 0 (ADR-0002); an unframable stream gives null counts.
- Oracle:
- The task branch head must equal the server's main. For Oak this is read from the branch API; for Git, from the bare repo's rev-parse.
- The worktree tree hash must equal the fixture model's tree.
- Oak state is read from .oak/oak.db query-only (current_branch, branch_heads, commit rows, ancestry gaps), not from CLI output.
- Every row carries
serve_depth_behavior(observed from stored commit rows after clone) andhosted_equivalent: false. - Subjects and serve binary are parameters. The run holds measurement_lock("task_loop").
Fixture seeds
- merge-history-v1-c1000-s1: git head ed3b72471b73274cdf80f542e7b5835faf6badc2, 66 merges (6.6%), 374 files.
- merge-history-v1-c2000-s2 (held out): git head 4ebc5f93e4a0d170f28d847df7e76c7b573166e1, 112 merges (5.6%).
Files
- scripts/oakbench/merge_history_fixture.py
- scripts/oakbench/httpcount.py
- scripts/oakbench/shallow_refresh.py
- scripts/task_loop.py (new campaign plus --shallow-refresh-fixtures and --injected-request-delay-ms)
- tests/test_shallow_refresh.py (24 tests)
- README.md
Limitations
- Oak 0.103.0
oak serveignores pulldepth(serve.rs pull handler). On current Serve,--shallowstores full history and the ancestor backfill does not occur (serve_depth_ignored). Rows against such a Serve are a fidelity baseline, not the hosted result. The real before/after needs the depth-honoring Serve build (a separate oak/oak lane). - Local Serve lacks the bounded integrity preflight, so clone needs --allow-legacy-scope.
- Loopback only. OS cache state is warm or unknown. The injected delay is a fixed per-request sleep in the proxy, not netem.
- The Git warm_worktree cell starts from a pre-existing full clone, so it is not the same starting state as a fresh shallow worker.
- Raw results are kept outside the repo (ADR-0003).
Commits2
- 085949193d78 mrmrs 1 month ago
- 186ae84b74bd mrmrs 1 month ago
README.mdmodifiedView file
@@ -383,6 +383,43 @@
383383
--results /abs/worker-owned/materialization-ab/results384384
```385385
386+
Fresh shallow worker -> named task branch at current `main` -> first parent387+
refresh, Oak versus Git, with per-step HTTP request counts:388+
389+
```bash390+
python3 scripts/task_loop.py \391+
--config /abs/path/subjects.toml --subjects git,oak_baseline,oak_candidate \392+
--oak-serve-bin /abs/immutable/fixed-oak-serve \393+
--scenarios shallow_worker_branch_refresh_v1 \394+
--shallow-refresh-fixtures 1000:1,2000:2 \395+
--runs 7 --randomize-subject-order --injected-request-delay-ms 0 \396+
--workdir /abs/worker-owned/shallow-refresh/work \397+
--results /abs/worker-owned/shallow-refresh/results398+
```399+
400+
Each `COMMITS:SEED` fixture is a deterministic merge-history Git repo401+
(`oakbench/merge_history_fixture.py`, ~5-7% two-parent merges). During untimed402+
setup it is imported into an owned loopback `oak serve` and a bare Git repo on403+
`GitHTTPServer`. Both sit behind `oakbench/httpcount.py` proxies that frame404+
HTTP/1.x requests: rows carry `http_request_count`,405+
`http_commits_info_request_count` and wire bytes, and all are null when the406+
stream could not be framed. The Oak cell times `clone --shallow` ->407+
`switch -c task` -> `fetch`. It then records a separate408+
`shallow.branch_create_repeat_local` row, which isolates local switch cost in409+
the already-refreshed worker. A second Oak cell, `shallow_pull.*`, repeats410+
the fresh clone and `switch -c task`, then runs `pull` instead of `fetch`.411+
Together the two cells show which command pays for the first-refresh412+
ancestry work. The Git cells are `clone --depth 1` ->413+
`switch -c` -> `fetch`, plus `warm_worktree.*`, which starts from an untimed414+
warm full clone. That is a different starting state and is labeled as such.415+
The oracle reads `.oak/oak.db` query-only (or `git rev-parse`), requires the416+
task branch head to equal the server's `main`, and requires the worktree to417+
hash to the fixture model's tree. Rows record `serve_depth_behavior`: a Serve418+
that ignores `--shallow` depth yields `serve_depth_ignored`, and such rows are419+
a fidelity baseline, not hosted-equivalent evidence (`hosted_equivalent` is420+
always false on loopback). `--injected-request-delay-ms` is a fixed per-request421+
sleep in the proxy, not a shaped network.422+
386423
Add `--oak-serve-source /abs/read-only/exact-head-checkout` when that immutable387424
checkout is retained; otherwise rows explicitly record that only the supplied388425
source head and binary hash were available for provenance.scripts/oakbench/httpcount.pyaddedView file
Loading diff…
scripts/oakbench/merge_history_fixture.pyaddedView file
Loading diff…
scripts/oakbench/shallow_refresh.pyaddedView file
Loading diff…
scripts/task_loop.pymodifiedView file
Loading diff…
tests/test_shallow_refresh.pyaddedView file
Loading diff…