# Requirements of draft-fossil-horizon-00, written from the draft text.
# Implemented so far: the horizon member of the cone (§3.3); the §3.1 held
# set (internal/horizon); the content horizon over a store's own manifests
# (§3.2, §4.1-§4.3: internal/content's classification); and its client
# synchronization against a horizon-ignorant peer (§4.4, §4.5, §6.3:
# local classification of what a dense peer sends, no cluster held but
# what a received cluster names fetched, demand fetch and deepen); the
# horizon pragmas with the origin that serves them at the content level
# (§6.1, §6.2, §6.2.1, §6.2.5, §6.4: go-libfossil's handler and client, and
# zit both ways) and the cursor (§6.2.6); and the §5.2 seed's minting,
# holding outside the artifact store and application to the derivation
# (internal/horizon/seed); and the structural horizon end to end (§5, §6.2.2,
# §6.2.3: the store's classification, boundary labels, the seed on the wire,
# re-seeding, fallback, verification and crossing diagnostics, go-libfossil
# and zit both ways); and Appendix A step 6 (§5.5, §5.7, §5.8, §5.9,
# §6.2.4: the merge-base query, deepen, merge and bisect crossings, the
# push-time cancellation check and seed verification, zit both ways where
# zit implements them); and the origin's classification memo (§6.2: kept by
# cone and store prefix, extended by appends, over a reference graph read once
# per store); and a path cone's node elision under either horizon (§3.2,
# §4.1, §5.1, §6.2: the store's classification, the origin's slot walk of
# the trees it keeps, kept with the memo, and the cursor it voids, §6.2.6).
# Rows those cover partly say what they leave out; every
# other row carries a scope note naming the Appendix A step that will cover
# it.
# Skipped, with reasons: 1.2 and 1.3 (design statements that the normative
# sections restate), 3.4 except its two SHOULDs, 5.9 except its SHOULD, 7
# and Appendix B (informative), 9 (IANA).
# Format: <id>\t<section>\t<requirement>[\t<scope note>]
# draft	draft-fossil-horizon-00.txt	332387c274567ed5ccf66f483b94a69d5d78bcd27ddcf04b237f9f1960650783
HZ-1.1-1	1.1	An implementation may provide the content horizon alone; the structural horizon presupposes the content horizon.
HZ-3.1-1	3.1	A horizon names one check-in C by its full artifact hash and one of two held-set rules: descendants (the default), C and every descendant of C; or leaves, those plus, for every childless check-in L not descended from C, every descendant of each nearest common ancestor of L and C, that ancestor included.
HZ-3.1-2	3.1	A client that expects to merge across live branches offline should choose the leaves rule knowingly.
HZ-3.1-3	3.1	The held set is a function of C, the rule and the check-in graph, recomputed by clone and origin from what each holds, and stored by no party.
HZ-3.1-4	3.1	Both rules are stated over P cards alone and yield a set closed under descendants: every child of a check-in in K is in K. Childless means no check-in names it in a P card, open or closed, not the same-branch leaf of repo-state.
HZ-3.2-1	3.2	A horizon is store-adjacent local state: not an artifact, not synchronized, affecting no artifact's bytes or name; its loss reclassifies every elided artifact as a transit phantom and the store heals toward dense.
HZ-3.2-2	3.2	With both a horizon and a path cone, the blobs kept are the intersection of the two keep sets; the check-in manifests held are governed by the horizon alone; sub-manifest nodes by both, the horizon deciding whose trees are held and the path cone eliding within them the nodes no S-card slot that may hold an in-cone path reaches, as the sparse store does; every other structural artifact is held whatever either says.
HZ-3.3-1	3.3	A horizon serializes into the canonical cone form as one member of a distinct kind carrying C's hash and the rule name, canonically, so the cone's digest stays a valid memoization key.
HZ-3.3-2	3.3	A cone with a horizon member is marked with a version distinct from a cone without one, so that an implementation predating this document refuses rather than misreads it.
HZ-3.4-1	3.4	An origin that offers a default C should also report what each rule would hold.	not implemented: the draft defines no message by which an origin reports what each rule would hold
HZ-3.4-2	3.4	Clients should not express a horizon as a count or a date at the protocol layer.
HZ-4.1-1	4.1	A content-horizon clone holds every structural artifact of every age but clusters (under a path cone, of the sub-manifest nodes only those on a path into the cone), every blob an F card of a check-in in the held set names, and elided phantoms for every other blob; it holds, mints and requests no cluster.	covered against a horizon-serving origin, go-libfossil's or zit's, which names no cluster in a clone, pull or sync reply, cursor or not, nor to a gimme; against a horizon-ignorant origin (§6.3) the clone still requests once a cluster that origin names by igot, before it can know it is one. zit answers req-clusters under a horizon pragma with the catalog, which a store served at its horizon never sends
HZ-4.1-2	4.1	Composed with a path cone, a content horizon holds, of every check-in of every age, the sub-manifest nodes reached from the manifest through S-card slots that may hold an in-cone path; the others are elided phantoms, which an origin withholds, every in-cone tree is whole, and an operation needing an elided node (a commit, a listing outside the cone) obtains it as the sparse-cone draft's §5.3 provides.
HZ-4.2-1	4.2	A blob is above the horizon when a check-in in the held set names it, directly or through a sub-manifest; elision is the sparse-cone draft's third phantom class with all of its rules: never spontaneously requested, counted distinctly from damage, reclassified by recomputation.
HZ-4.2-2	4.2	A phantom created because a held artifact arrived as a delta against it is a transit phantom whatever its horizon classification.
HZ-4.3-1	4.3	Derived caches and prefix-anchored checkpoints are horizon-independent: their keys do not incorporate the horizon.
HZ-4.3-2	4.3	The derivation of repository state runs over check-in manifests and control artifacts and reads no sub-manifest node; a content horizon holds every one of them, with or without a path cone, so the derivation is the dense repository's.
HZ-4.4-1	4.4	An operation needing a blob below the horizon resolves the elided phantom by demand fetch, targeted, or by moving C (a deepen).
HZ-4.5-1	4.5	A horizon clone does not hold the clusters it is sent. Against an origin whose replies carry horizon-served it does not request a phantom whose only reference is a cluster artifact; against a horizon-ignorant origin it requests the phantoms a received cluster names, as transit, and classifies what arrives. It requests phantoms named by igot cards, by the P, F and S cards of held artifacts, and by delta sources of held artifacts.
HZ-5.1-1	5.1	A structural-horizon clone holds the manifests and nodes of check-ins in the held set and everything they reach through B and S cards, every control, wiki, ticket, event, forum and attachment artifact, the blobs of the content horizon, elided phantoms for the rest, and the seed, which it keeps from every peer; under a path cone, of those trees' nodes only those on a path into the cone.
HZ-5.1-2	5.1	A clone does not enter the structural horizon against a horizon-ignorant peer.
HZ-5.2-1	5.2.1	The seed is a control artifact minted by the origin whose T cards apply to every entry of K (C, and each check-in of K whose primary parent is not in K) every tag in force there in the dense repository, each with the value the dense derivation holds; its D and U cards are those of Section 5.2.2.
HZ-5.2-2	5.2.2	The origin sets each seed's D card to the latest mtime among the tag events it summarizes, rounded up to a whole second and written with no fractional part (C's own event time, rounded the same way, when it summarizes none); its U card is the origin's own label for the minting implementation, never a user's login; two origins mint the same seed for the same C and state up to the U card. No seed need be dated later than the seed it replaces.	covered but for a seed that summarizes no tag event: go-libfossil mints none and serves the content level (a control artifact needs a T card), where zit mints one of no T card dated at C
HZ-5.2-3	5.2.3	A clone never sends its seed to any peer, private-content synchronization included; it holds the seed private or outside the artifact store and applies it at every open.
HZ-5.2-4	5.2.3	An origin refuses a seed offered to it, and an artifact of the seed's shape arriving by any route but the horizon reply is an ordinary control artifact.
HZ-5.2-5	5.2.4	An origin holding a signing key should sign the seed with the clear-signing envelope.	not yet implemented: go-libfossil signs no artifact; seed.Verifier is where a clear-signature check plugs in
HZ-5.2-6	5.2.4	A clone that knows its origin's public key verifies every seed's signature and discards an unsigned or wrongly signed seed, falling back to the content horizon; a clone with no key accepts an unsigned seed.	covered for the policy through seed.Verifier (no key accepts unsigned; a rejecting key refuses a new seed and discards a held one); no clear-signature verifier ships, as go-libfossil verifies no artifact signature
HZ-5.3-1	5.3	A boundary hash is a P-card parent, not in K, of any check-in manifest the clone holds, a held baseline below C included; a clone classifies a labelled boundary hash as an elided phantom and an unlabelled unheld reference as a transit phantom, which it requests.
HZ-5.3-2	5.3	When a new check-in forks from below the horizon, or a new delta manifest reaches a baseline below it, the origin labels the new parents in the round that delivers the manifest naming them; a clone requests an unheld unlabelled parent, and an origin does not send one it does not keep.
HZ-5.4-1	5.4	A boundary hash should be rendered as the horizon and is never described as damage; verification reports manifests below the horizon as elided, distinctly from damage.
HZ-5.5-1	5.5	An operation needing history below the horizon (a merge base, a symbolic name, a checkout, diff or annotate below C, a bisection) detects the crossing, names the horizon in its diagnostic and offers the stated remedy.	covered for checkout, diff and annotate from a check-in below C, a merge base below C (refused naming the horizon, or asked of the origin and deepened to with a peer) a bisection's good end below C, and a symbolic name on a check-in below C, which resolves to it, each diagnostic naming the horizon and the deepen; annotate walking back past C attributes the lines it reaches there to the oldest held version, as zit's does
HZ-5.5-2	5.5	An implementation never merges against a base it does not hold.
HZ-5.5-3	5.5	Whenever the ancestry of either side of a merge crosses the horizon the clone asks the origin for the base, even when it finds a common ancestor among what it holds, and deepens to the base when it lies below the horizon.
HZ-5.6-1	5.6	A clone requests the seed at each synchronization, naming the seed it holds; the origin replies with a new seed only when it differs, keeping no per-client state, and the clone replaces the seed it holds with the new one whole.
HZ-5.7-1	5.7	A commit from a structural horizon is an ordinary commit: on an existing branch it writes no branch tag; creating a branch it writes the repository-state T cards, the parent branch's cancellation included.
HZ-5.7-2	5.7	An origin should check a pushed cancellation against its own derivation and refuse on disagreement, naming the stale seed and the parent's branch; it admits the check-in when the push or its store carries a control artifact cancelling the parent's branch tag on it.
HZ-5.8-1	5.8	A deepen names an ancestor C' of C, recomputes the held set and synchronizes at C'; nothing held is replaced, and the deepening clone discards the old seed before applying the new one.
HZ-5.8-2	5.8	A deepen that must reach a check-in outside K names as C' a common ancestor of C and that check-in, computed locally or asked of the origin; when none is known it is refused naming the remedy, a fresh clone with an earlier horizon, and C never moves to a check-in that is not its ancestor.
HZ-5.9-1	5.9	An implementation should offer seed verification by deepening as a verification mode.
HZ-6.1-1	6.1	A horizon-scoped request carries at most one pragma horizon <hash> <rule>, may carry path-cone pragmas (the keep set is then the intersection), and adds pragma horizon-structural for the structural horizon; any request may carry pragma horizon-cursor.
HZ-6.2-1	6.2	An origin receiving a horizon pragma computes the held set over the dense graph and restricts the blobs it sends; for a structural request it also restricts manifests and nodes, sends every other structural artifact, the boundary labels and the seed, and bounds the per-round walk.
HZ-6.2-2	6.2	An origin should not send cluster artifacts in reply to a horizon-scoped request.
HZ-6.2-3	6.2.1	An origin does not send, in reply to a horizon-scoped request, a delta whose base is outside the keep set; it sends that artifact in full, may send in-keep-set deltas verbatim, should bound reconstruction per round, and may send a delta verbatim when it cannot reconstruct it.
HZ-6.2-4	6.2.2	For a structural request the origin emits pragma horizon-below for every boundary hash the manifests in the reply introduce, the parents of every check-in manifest a baseline below C included, no later than the reply carrying the first manifest that names it.
HZ-6.2-5	6.2.3	A structural request carries pragma horizon-seed with the held seed or '-'; the origin announces a differing seed with the pragma before its file card; the client verifies the bytes hash to the announced name and parse as a control artifact, drops a card failing either, routes it to its seed holding, and never announces or sends it.
HZ-6.2-6	6.2.3	An origin does not advertise the structural level unless it sends a seed in the same reply or the client's offered seed is the one it would send; because the D card is fixed by the tag events summarized, two mints over unchanged state produce the same name.
HZ-6.2-7	6.2.4	A client may ask pragma horizon-mergebase <primary> <secondary> [<secondary>]; an origin that can answer repeats every hash of the query in the order asked and appends Fossil's pivot of the primary over the secondaries, or '-' when no common ancestor exists, and bounds the ancestry walk; an answer whose hashes do not repeat the query is no answer.
HZ-6.2-16	6.2.4	In a merge the primary is the check-in merged in and the secondaries are the checkout and each plain merge pending in it (not a cherry-pick, backout or integrate); a query carries at most two secondaries and an origin answers none with more, nor one naming a check-in it does not hold.
HZ-6.2-8	6.2.5	An origin emits pragma horizon-served <level> [<url>] in every reply to a horizon request; a client does not enter the structural horizon unless its first reply carried structural, and should report the mode a transfer used.
HZ-6.2-9	6.2	An origin should keep its classification keyed by the cone digest and the store prefix it classified, extend it by the artifacts appended since, and recompute in full only when an appended artifact carries a name a held P, B or S card cited while it was absent.
HZ-6.2-10	6.2	An origin should read each structural artifact's kind and P, B, S, F and A references once per store into a cone-independent graph keyed to the same prefix, extend it by appended artifacts, and classify every cone over that graph.	covered but for the F cards of a horizon's trees, which the first classification of each horizon walks from the store, as zit's does, and later ones extend
HZ-6.2-11	6.2.6	An origin that classified a request emits pragma horizon-cursor <n> in every reply, n its artifact-sequence position through which the reply was served; receiving a cursor it announces no artifact at or below it and every kept artifact above it the request did not name, and after a reclassification, or after an appended tree reaches through an in-cone slot an older node the classification withheld (which it then keeps), answers a request carrying a cursor below the position it recorded once as if it carried none; it announces with igot only in reply to a request that pulls, and a reply to a push-only request announces nothing, cursor or not.
HZ-6.2-14	6.2	When a horizon request also carries path members, the origin withholds at either depth the sub-manifest nodes of the trees it keeps that no S-card slot that may hold an in-cone path reaches, neither sending them in a clone nor answering a request for them; a request without path members receives every node of those trees.
HZ-6.2-15	6.2	Under a content horizon with path members the origin's walk should be kept like the classification: descending only slots that may reach the cone, visiting each node once per bound it is reached under (a last slot's bound its parent's, a wider bound deciding for a narrower), and recording what it walked, so that a later request walks only the trees appended since.
HZ-6.2-12	6.2.6	A client that converged records the last reply's cursor and its own artifact count per origin and sends the cursor on every request to that origin; it may then announce nothing on a pull-only request, must still announce on a request that sends but may announce only artifacts appended after the recorded count, and advances the count only past artifacts the origin holds.
HZ-6.2-13	6.2.6	The cursor changes what is announced, never what is answered: an origin answers a gimme for any kept artifact whatever cursor the request carried, a client requests every phantom it wants as without one, and either side may drop the cursor and fall back to a full announcement.
HZ-6.3-1	6.3	Against a horizon-ignorant peer a content-horizon client classifies locally, stores the blobs above the horizon, records elided phantoms and reports the counts; a structural clone request falls back to the content horizon for that transfer and reports that it did.
HZ-6.3-2	6.3	A store at the structural horizon whose pull or sync replies carry no horizon-served structural falls back to the content horizon at the same C and rule, records that depth, discards its seed, fetches the manifests and nodes below C, and reports that it did.
HZ-6.4-1	6.4	A server over a horizon clone refuses a dense clone request, and a horizon request whose held set is not a subset of its own, with one error card and no content; the requesting client treats that reply as fatal.
HZ-8-1	8	The origin's held-set walk and merge-base query carry the depth and visited-node bounds of any server-side graph walk, and delta inflation on the serve path is bounded by the round's batch limit.
