Read-only imports: consumer-declared read-only repo snapshots mounted into every spawn #261
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab#261
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
PRD: #260
What to build
The full read-only-imports feature as one slice, end-to-end: a repo's settings gain an Imports section declaring other lab repos its instances may read; every spawn of that repo (all run kinds, by construction) fetches each import's reference repo, materializes a snapshot of
origin/<default>(no.git) into a per-run directory outside the worktree, and mounts it read-only at a host-identical path in the container runner (best-effort write-protected on the host runner). Any import fetch failure refuses the spawn before the claim, naming the target. The generated context file lists each import (name, absolute path, snapshotted commit) and marks it a read-only snapshot outside the working repo./pull-basere-materializes every import in place and includes per-import changes in its injected digest. Deleting a repo is blocked while importers reference it, naming the importers. CONTEXT.md gains the read-only import term and an ADR records the decisions.Grant semantics per the PRD: directional, consumer-declared, flat (no transitivity, mutual imports legal, self-import rejected at save), lab-repo targets only, always
origin/<default>, no ref pinning, no tracker access (run token stays single-repo).Acceptance criteria
origin/<default>'s tree (no.git) to a destination dir, return the snapshotted commit; idempotent in-place re-materialization — integration tests with real bare repos (fresh materialize, upstream change, upstream file deletion, fetch failure)chmod a-w/pull-baserefreshes every import in place and its digest reports per-import changes (tests alongside existing pull tests)Blocked by
None - can start immediately
Agent Brief
Category: enhancement
Summary: Read-only imports, end-to-end — a repo declares other lab repos whose code its instances may read; every spawn materializes a read-only snapshot of each import outside the worktree, refuses before the claim on fetch failure, and
/pull-baserefreshes the snapshots.PRD #260 is the authoritative decision record (grant semantics, materialization, refresh, out-of-scope list). This brief is the working contract; where they seem to differ, ask before diverging.
Current behavior:
An instance sees exactly one repo. The containerized runner (ADR-0052) deliberately closed the hole through which a host-run agent could read other repos' worktrees and bares, so agents code against sibling repos from memory — guessing signatures and endpoints. No "imports" concept exists anywhere today: no store relation, no API field, no settings section, no domain term. The container runner currently mounts exactly one thing read-only (the agent-tools image, an image-type mount); every bind mount is read-write — there is no read-only bind machinery yet. This feature introduces the first.
Desired behavior:
origin/<default>'s tree (no.git) into the per-run directory outside the worktree. Fetches may run in parallel to keep spawn latency flat.chmod a-w)./pull-basere-materializes every import in place and reports per-import changes in its injected digest. No other refresh trigger;/clearuntouched.Key interfaces:
origin/<default>'s tree (no.git) to a destination directory, return the snapshotted commit — idempotent for in-place re-materialization (upstream file deletions must disappear from the snapshot). All git ops stay on the reference repo, never a checkout. Follow the git layer's existing real-bare-repo integration-test prior art.:robind in the inventory). Dev images already treat lab's mount points as reserved per the pin in ADR-0053 "Per-repo dev images", so no container-contract renegotiation./pull-baserefresh of each import plus per-import digest lines.ADR citation precision (the PRD's shorthand is slightly off — cite the pins, not imagined titles): ADR-0052 is "Containerized runner" (closed the hole); ADR-0053 is "Per-repo dev images" (contains the pin reserving read-only mounts for future imports); ADR-0062 is "Schedules" (contains the spawn-parity pin). There is no standalone mount-contract or spawn-parity ADR.
Acceptance criteria:
chmod a-w/pull-baserefreshes every import in place and its digest reports per-import changes, tested alongside the existing pull testsOut of scope:
labctlnever reads an import's issues or PRs.git, no log/blame/clear/ New conversation