PRD: read-only imports — repos grant read-only code access to other repos #260
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Cloonar/coding-lab#260
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?
Problem Statement
An instance runs against exactly one repo. When that repo's code depends on a sibling repo the operator also manages in lab — a shared library, an API server the repo is a client of, a protocol definition — the agent codes against that sibling from memory. It guesses signatures, invents endpoints, and drifts from the real API, because the container runner (ADR-0052) deliberately closed the hole through which a host-run agent could once see other repos' worktrees and bares. The operator has no supported way to hand an instance the code of a second repo, and the unsupported way (host runner + full host access) gives up isolation entirely.
Solution
A repo declares read-only imports: other lab repos whose code its instances may read. At every spawn, lab fetches each import's reference repo and materializes a snapshot of
origin/<default>(no.git) into a per-run directory outside the worktree, mounted read-only into the container at a host-identical path. The generated context file tells the agent each import's name, path, and snapshotted commit./pull-baserefreshes the snapshots in place and reports what changed in its injected digest. The grant is directional, consumer-declared, flat, and code-only — controlled re-opening of exactly the hole ADR-0052 closed, along the read-only-mount contract ADR-0053 reserved for it.User Stories
origin/<default>at spawn, so that the agent reads the sibling as it exists now, not as lab last saw it./pull-baseto re-materialize every import alongside the base merge, so that one command freshens my whole world./pull-basedigest to include what changed in each import, so that my context layer stays honest about what moved under me.Implementation Decisions
origin/<default>'s tree (no.git) into a destination directory, return the snapshotted commit; idempotent in-place re-materialization for refresh. All fetch/branch git ops stay on the reference repo, never a checkout.origin/<default>of the target; no ref pinning./pull-basefetches every import, re-materializes each snapshot in place, and includes per-import changes in the injected digest. No other refresh trigger;/clearis untouched.Testing Decisions
/pull-baseextension gets tests for import refresh and digest content alongside the existing pull tests.Out of Scope
labctlnever reads an import's issues or PRs..git, no log/blame; the snapshot is a tree./clear/ New conversation.Further Notes
Closing as done. The full PRD was implemented as one slice in #261, merged via PR #264 (commit 8516358's sibling
8bf9c86,feat(imports): consumer-declared read-only repo snapshots mounted into every spawn). The decisions are recorded in ADR-0063 (docs/adr/0063-read-only-imports.md) and CONTEXT.md defines the read-only import term.