SUBS-027: submodule state model — four records (parent pin, sub synth-branch, parent wtlog, sub wtlog) and one dirtiness classifier

Submodule consistency today is recomputed ad-hoc per verb by re-parsing the parent tree + .gitmodules; this ticket pins it to FOUR cheap reflog/wtlog records and one shared classifier, so be status/head/get/post all judge "dirty" the same way. The model also fixes SUBS-026 (the ahead-of-pin case reads clean) by giving status a record to compare against. See Submodules, Store.

Input

Context

Four records describe a mounted sub's state; each lives in a known file, no tree walk needed:

Goals

Constraints

WIP

Design decisions

Coherent ⟺ all agree: R1.hash == R2.hash == R4.base, the sub file-scan matches R4.base, R2.<parent/branch> == R3.branch, and R4 is title-bound (not a bare ?#hash). THREE orthogonal axes; only the first is "dirty":

Dirtiness scale — un-recorded FORWARD state a POST must capture; a 2-bit mask, RECURSIVE (a node carries the bit if it OR any descendant does):

Stale axis — checkout is OFF the pin but NOT forward; GET/PATCH resolve it, POST never does:

Record-health — orthogonal to both; the pin/anchor plumbing itself is broken:

Recursive verb semantics — the recursion is RETURN-CODE driven; the parent inspects each sub and decides:

So a healthy post drives R4→R2→R1 bottom-up; a healthy get drives R1→R4 top-down.

TODOs

Blockers and bummers

Outcome