Documentation
¶
Overview ¶
Package fixture builds realistic on-disk fixtures for TCP-01 tests: a primary worktree with its `.git` common directory, a `.taskman/` intent store and a `<git-common-dir>/taskman/` state dir with a valid receipt chain. It is test support only (imported by `_test.go` files); it never touches a real repository and every path it writes is under a temp directory the caller owns. It also provides the byte/mode/mtime tree snapshot used to prove that read commands modify nothing (AS-07).
Index ¶
- Constants
- func ApplyReceipt(t *testing.T, r *Repo, seq uint64)
- func AssertUntouched(t *testing.T, r *Repo, stateBefore, intentBefore []Entry, what string)
- func Commit(t *testing.T, r *Repo, kind string)
- func CommitPosts(t *testing.T, r *Repo, kind, requestID string, posts map[string][]byte)
- func Dep(local string) ticket.Dependency
- func GateDep(local, gate string) ticket.Dependency
- func GenesisValue(t *testing.T, r *Repo) wire.Value
- func HeadValue(primary string, lastSeq uint64, last wire.Digest, generation uint64, ...) wire.Value
- func PlantReceipt(t *testing.T, r *Repo, seq uint64)
- func PolicyBytes() []byte
- func PolicyValue() wire.Value
- func QueueBytes() []byte
- func QueueValue() wire.Value
- func ReceiptValue(seq uint64, prev *wire.Digest, kind string, headGeneration uint64) wire.Value
- func SameTree(a, b []Entry) bool
- func TempDirOutside(t *testing.T) string
- func Ticket(local string) *ticket.Record
- func TicketID(local string) string
- func Write(t *testing.T, path string, data []byte)
- func WriteIntent(t *testing.T, r *Repo, tickets ...*ticket.Record)
- func WriteState(t *testing.T, r *Repo)
- type Entry
- type Repo
Constants ¶
const ( QueueID = "queue:acme:main" RepoID = "repo:acme" Prefix = "AT" Actor = "russell" Timestamp = "2026-09-06T12:00:00Z" )
Queue identity shared by every fixture.
Variables ¶
This section is empty.
Functions ¶
func ApplyReceipt ¶
ApplyReceipt is the writer's last §5.2 effect for a receipt PlantReceipt left pending: it renames the head to name receipt seq, which must be lastSeq+1. Together the two simulate a writer caught inside, then leaving, the REDO_PENDING window (CTS-V0-006).
func AssertUntouched ¶
AssertUntouched fails the test when the state dir, the intent dir or the lock path changed relative to the snapshots taken before a read, or when a lock file appeared.
func Commit ¶
Commit appends one receipt of the given kind to the chain and advances head.json, simulating a committed transaction (test-only; the real commit protocol is TCP-02's).
func CommitPosts ¶
CommitPosts is test-only fixture assembly: receipt bytes and projections are written directly, without simulating durability or granting writer authority.
func Dep ¶
func Dep(local string) ticket.Dependency
Dep builds a COMPLETED dependency edge on a local token.
func GateDep ¶
func GateDep(local, gate string) ticket.Dependency
GateDep builds a GATE_PASSED dependency edge.
func GenesisValue ¶
GenesisValue builds the minimal experimental J1 genesis, supplying actual retained VERSION blob bytes. Existing intent fixtures remain projections; callers needing a full ledger must post tickets in later receipts.
func HeadValue ¶
func HeadValue(primary string, lastSeq uint64, last wire.Digest, generation uint64, initSha wire.Digest) wire.Value
HeadValue builds head.json for the fixture queue.
func PlantReceipt ¶
PlantReceipt writes a receipt file at seq without touching head.json (a pending redo at lastSeq+1, or a fork at lastSeq+2).
func PolicyValue ¶
PolicyValue is a valid taskman-policy/0 with one required COMMAND gate `verify` and serialFallback BLOCK.
func QueueValue ¶
QueueValue is a valid taskman-queue/0 for the fixture queue.
func ReceiptValue ¶
ReceiptValue builds a receipt of the given kind at seq with prev.
func TempDirOutside ¶
TempDirOutside returns a resolved temp directory that is neither inside the repository nor inside the state dir (a legal `--staging`).
func Ticket ¶
Ticket returns a minimal valid OPEN, AUTONOMOUS, QUALIFIED record for the local token, at revision 1. Callers mutate the struct before encoding.
func WriteIntent ¶
WriteIntent writes queue.json, policy.json and the given tickets.
func WriteState ¶
WriteState initialises the state dir with VERSION, an INIT receipt at seq 1 and a matching head.json. This is fixture construction, not a writer.
Types ¶
type Repo ¶
type Repo struct {
Root string // resolved absolute path of the primary worktree
CommonDir string // <Root>/.git
StateDir string // <Root>/.git/taskman
IntentDir string // <Root>/.taskman
}
Repo is a fixture repository on disk.
func TempRepo ¶
TempRepo creates a primary worktree with a `.git` directory under a symlink-resolved temp path (macOS's /var is a symlink; the §3.4 resolver records the canonical path, so Root equals it). `head.primaryWorktree` is a PathText bounded to 4096 bytes (§2). It removes everything at test cleanup.