Skip to content
zit Artifact [5ba418801d]
Login

Artifact [5ba418801d]

Artifact 5ba418801d1fbf9242ca585e1904a84d55b83a9686cbf9374b832bef776efb96:

Manifest of check-in [5ba418801d] - Add zit open: clone→working-tree path, proven by e2e chain and fossil smoke scenario

`zit clone` builds a repository file and nothing else. The checkout it left behind was the same UNBORN record `init` writes (`version == ""`, branch `trunk`), with no managed set and no files, and there was no way to turn it into a usable tree: `zit update` accepts only a literal 40/64-hex check-in ID, so a freshly cloned tree could not name its own tip. Clone was a dead end.

`zit open` is the second half of fossil's own clone+open UX. It resolves the tip of the main branch out of this repository's derived state and hands materialization to the SAME `update.applyCheckin` engine every other working-tree move rides — journal-armed, transactional, rollback-safe. Tip resolution is the only work that is open's own; everything else is wiring.

What changed:

- `cli.parseOpenArgs` / `OpenArgs` / `OpenResult`: an operand-free surface. `-h`/`--help` is the only accepted token and wins over every other token; a bare `-x` is an unknown option, anything else an extra argument. The verb takes no operand by design — it derives its target from the repository. - `main.runOpen` plus the `open` entries in the `Verb` enum, the dispatch switch, and the `verb_help` table, so the verb is added in one place and the total switch stays total. `runOpen` writes NO checkout record and NO managed set of its own: `init` already wrote the unborn record, an absent managed set already reads as the empty set, and the update engine stays the single writer of the born record. A second writer of that bootstrap state would only be a second thing to keep in sync. - `main.openApplyFail`: one arm per `update.ApplyError` variant and no `else`, so a new variant fails the compile and forces a decision, mirroring `updateApplyFail`. `SymlinkUnsupported` / `InvalidPath` / `ReservedPath` are raised while planning the TARGET manifest and are reachable on a perfectly intact repository, so they get honest prose instead of a corruption claim. - `update.planUpdate`: an UNBORN record now takes the same arm as an absent one. Unborn is the normal state of every fresh repository, so without this the first `update` after a clone handed `""` to `buildPlan`, failed `artifact.validateName("")`, and reported `CurrentStateInvalid` — a clean, correct tree diagnosed as broken. A record that names no check-in but claims a merge parent or a pending special operation stays incoherent and is still `CurrentStateInvalid`. - BORN-ness, not presence, is the "already open" signal. A presence-based gate would have rejected a clone followed by an open on every clone, the primary path the verb exists to serve.

Test evidence (all run in this worktree after absorbing the sibling P3-F4 commit 281c0ed815, which arrived during this step and was merged by hand in `src/e2e.zig` — both sides had appended the identical P3-F4 block, so the duplicate was dropped):

- `zig build test` — green, including new `update_test.zig` coverage of the unborn-record arm and its incoherent-record rejections. - `zig build e2e` — green, including the P3-F3 block: clone → open → byte-identical tree → update → commit round-trip; a plain clone's unborn checkout tolerated by `update`; an untracked file in the way failing the open and materializing nothing; re-opening an already-open tree refused with no change; a repository with no check-in reported rather than failed; outside a repository failing with the not-a-repo diagnostic (exit 1); unknown option and positional as usage errors (exit 2); and the verb present in top-level help with one help text behind both `--help` and `help open`. - `zig build smoke` — green, with the new S6 scenario (§3.7/§4): `zit clone` + `zit open` against a REAL fossil server materializes the committed bytes byte-for-byte. This is the cross-implementation proof that the new path produces a working tree fossil itself agrees with. - `zig fmt --check .`, `zig build`, and `zig build dst` (6 seeds x 1000 steps) also green.

No borrowed technique in this change. No new file: the work lands entirely in existing modules. by dmestas on 2026-07-18 23:11:56.


C Add\szit\sopen:\sclone→working-tree\spath,\sproven\sby\se2e\schain\sand\sfossil\ssmoke\sscenario\n\n`zit\sclone`\sbuilds\sa\srepository\sfile\sand\snothing\selse.\sThe\scheckout\sit\sleft\nbehind\swas\sthe\ssame\sUNBORN\srecord\s`init`\swrites\s(`version\s==\s""`,\sbranch\n`trunk`),\swith\sno\smanaged\sset\sand\sno\sfiles,\sand\sthere\swas\sno\sway\sto\sturn\sit\ninto\sa\susable\stree:\s`zit\supdate`\saccepts\sonly\sa\sliteral\s40/64-hex\scheck-in\sID,\nso\sa\sfreshly\scloned\stree\scould\snot\sname\sits\sown\stip.\sClone\swas\sa\sdead\send.\n\n`zit\sopen`\sis\sthe\ssecond\shalf\sof\sfossil's\sown\sclone+open\sUX.\sIt\sresolves\sthe\ntip\sof\sthe\smain\sbranch\sout\sof\sthis\srepository's\sderived\sstate\sand\shands\nmaterialization\sto\sthe\sSAME\s`update.applyCheckin`\sengine\severy\sother\nworking-tree\smove\srides\s—\sjournal-armed,\stransactional,\srollback-safe.\sTip\nresolution\sis\sthe\sonly\swork\sthat\sis\sopen's\sown;\severything\selse\sis\swiring.\n\nWhat\schanged:\n\n-\s`cli.parseOpenArgs`\s/\s`OpenArgs`\s/\s`OpenResult`:\san\soperand-free\ssurface.\n\s\s`-h`/`--help`\sis\sthe\sonly\saccepted\stoken\sand\swins\sover\severy\sother\stoken;\n\s\sa\sbare\s`-x`\sis\san\sunknown\soption,\sanything\selse\san\sextra\sargument.\sThe\sverb\n\s\stakes\sno\soperand\sby\sdesign\s—\sit\sderives\sits\starget\sfrom\sthe\srepository.\n-\s`main.runOpen`\splus\sthe\s`open`\sentries\sin\sthe\s`Verb`\senum,\sthe\sdispatch\n\s\sswitch,\sand\sthe\s`verb_help`\stable,\sso\sthe\sverb\sis\sadded\sin\sone\splace\sand\sthe\n\s\stotal\sswitch\sstays\stotal.\s`runOpen`\swrites\sNO\scheckout\srecord\sand\sNO\smanaged\n\s\sset\sof\sits\sown:\s`init`\salready\swrote\sthe\sunborn\srecord,\san\sabsent\smanaged\sset\n\s\salready\sreads\sas\sthe\sempty\sset,\sand\sthe\supdate\sengine\sstays\sthe\ssingle\swriter\n\s\sof\sthe\sborn\srecord.\sA\ssecond\swriter\sof\sthat\sbootstrap\sstate\swould\sonly\sbe\sa\n\s\ssecond\sthing\sto\skeep\sin\ssync.\n-\s`main.openApplyFail`:\sone\sarm\sper\s`update.ApplyError`\svariant\sand\sno\s`else`,\n\s\sso\sa\snew\svariant\sfails\sthe\scompile\sand\sforces\sa\sdecision,\smirroring\n\s\s`updateApplyFail`.\s`SymlinkUnsupported`\s/\s`InvalidPath`\s/\s`ReservedPath`\sare\n\s\sraised\swhile\splanning\sthe\sTARGET\smanifest\sand\sare\sreachable\son\sa\sperfectly\n\s\sintact\srepository,\sso\sthey\sget\shonest\sprose\sinstead\sof\sa\scorruption\sclaim.\n-\s`update.planUpdate`:\san\sUNBORN\srecord\snow\stakes\sthe\ssame\sarm\sas\san\sabsent\n\s\sone.\sUnborn\sis\sthe\snormal\sstate\sof\severy\sfresh\srepository,\sso\swithout\sthis\n\s\sthe\sfirst\s`update`\safter\sa\sclone\shanded\s`""`\sto\s`buildPlan`,\sfailed\n\s\s`artifact.validateName("")`,\sand\sreported\s`CurrentStateInvalid`\s—\sa\sclean,\n\s\scorrect\stree\sdiagnosed\sas\sbroken.\sA\srecord\sthat\snames\sno\scheck-in\sbut\sclaims\n\s\sa\smerge\sparent\sor\sa\spending\sspecial\soperation\sstays\sincoherent\sand\sis\sstill\n\s\s`CurrentStateInvalid`.\n-\sBORN-ness,\snot\spresence,\sis\sthe\s"already\sopen"\ssignal.\sA\spresence-based\sgate\n\s\swould\shave\srejected\sa\sclone\sfollowed\sby\san\sopen\son\severy\sclone,\sthe\sprimary\spath\n\s\sthe\sverb\sexists\sto\sserve.\n\nTest\sevidence\s(all\srun\sin\sthis\sworktree\safter\sabsorbing\sthe\ssibling\sP3-F4\ncommit\s281c0ed815,\swhich\sarrived\sduring\sthis\sstep\sand\swas\smerged\sby\shand\sin\n`src/e2e.zig`\s—\sboth\ssides\shad\sappended\sthe\sidentical\sP3-F4\sblock,\sso\sthe\nduplicate\swas\sdropped):\n\n-\s`zig\sbuild\stest`\s—\sgreen,\sincluding\snew\s`update_test.zig`\scoverage\sof\sthe\n\s\sunborn-record\sarm\sand\sits\sincoherent-record\srejections.\n-\s`zig\sbuild\se2e`\s—\sgreen,\sincluding\sthe\sP3-F3\sblock:\sclone\s→\sopen\s→\n\s\sbyte-identical\stree\s→\supdate\s→\scommit\sround-trip;\sa\splain\sclone's\sunborn\n\s\scheckout\stolerated\sby\s`update`;\san\suntracked\sfile\sin\sthe\sway\sfailing\sthe\sopen\n\s\sand\smaterializing\snothing;\sre-opening\san\salready-open\stree\srefused\swith\sno\schange;\n\s\sa\srepository\swith\sno\scheck-in\sreported\srather\sthan\sfailed;\soutside\sa\n\s\srepository\sfailing\swith\sthe\snot-a-repo\sdiagnostic\s(exit\s1);\sunknown\soption\n\s\sand\spositional\sas\susage\serrors\s(exit\s2);\sand\sthe\sverb\spresent\sin\stop-level\n\s\shelp\swith\sone\shelp\stext\sbehind\sboth\s`--help`\sand\s`help\sopen`.\n-\s`zig\sbuild\ssmoke`\s—\sgreen,\swith\sthe\snew\sS6\sscenario\s(§3.7/§4):\s`zit\sclone`\s+\n\s\s`zit\sopen`\sagainst\sa\sREAL\sfossil\sserver\smaterializes\sthe\scommitted\sbytes\n\s\sbyte-for-byte.\sThis\sis\sthe\scross-implementation\sproof\sthat\sthe\snew\spath\n\s\sproduces\sa\sworking\stree\sfossil\sitself\sagrees\swith.\n-\s`zig\sfmt\s--check\s.`,\s`zig\sbuild`,\sand\s`zig\sbuild\sdst`\s(6\sseeds\sx\s1000\ssteps)\n\s\salso\sgreen.\n\nNo\sborrowed\stechnique\sin\sthis\schange.\sNo\snew\sfile:\sthe\swork\slands\sentirely\sin\nexisting\smodules.\n
D 2026-07-18T23:11:56.449
F .fossil-settings/ignore-glob 3580f973d7097226f91a27c7b61ec13d9d07880d95549f9b90ce86da5d867a23
F LICENSE 702ae7ff835a2a971dae11c5cae039803bf394b77a6d8ec9f18693e449eaaf26
F README.md 62e1f936cc2ea0e33d717539bdffd6126a639843069bd6256359f2b15cb06232
F build.zig 4bc7076a0a8ae829e0860d78027c84f78a3cb40fb2733891a16ac1ebed18715d
F build.zig.zon 0eade544d4d7fc5a620348c6f29cc9219ff8c6d6377a05e756ca89860a524781
F docs/rfcs/draft-fossil-artifact-format-00.txt a6d542a5effeb41d0ea1e916058ccdc0a5819787f167ef1ebad7814f5680e7ad
F docs/rfcs/draft-fossil-delta-format-00.txt d8025d6d75322e33887c3334a4b9cc729960028b3c994ed01e5a474e4b388fd2
F docs/rfcs/draft-fossil-repo-state-00.txt fd413bcb28001a8a07009ca0c769cfe666394ba79dd4f14a6461f2b592049595
F docs/rfcs/draft-fossil-sync-protocol-00.txt aa55791464a54ef4b651df8780ba5c46e95c723c7997d09a5b727fef658f920a
F src/annotate.zig 0a6b6728099e63c84681d1e5228ebb45fafb55d65df1720358247fd6e6532c63
F src/artifact.zig c630afd9fbbcfaccd7b823105b4d05db1dc85b6af03080a6d58635ed064672ca
F src/artifact_fuzz.zig 8bb359ddfe790818e109a1dd7ac0c1b5cec1a8fdc556f37e73504cdb7f933e17
F src/artifact_test.zig da999476660f7e6e1f50ed9da5c30f1c83d6b358e2cfcd265c6932959c85bdd1
F src/bisect.zig 7bfc45d3e0e339017826941463cc4e9118892d2898fbcd319e6e6ca85c4d3301
F src/checkout.zig ac48e76f22c8065f70d2a827ae00ffb99887af80950a93c1a3451a9a1ad0f403
F src/cli.zig ae2ec7787850f9969ba32c4d0453e5eb1359eefe25f1cc2b252ecd95735840f6
F src/container.zig cef1028531f2763f94248b761c8779a1884e44bb854b8c45617494e3ead40e61
F src/container_test.zig a013652b1ed181161d3ad8fc9d8f052f7c27b61e129662632ceaf8cf189445ec
F src/delta.zig e8f3a6297d47549aea146222732ccf514c39688414f0a74ba396ac91066686f3
F src/delta_fuzz.zig 9e0d8dbb8c82ca0ba1a80974c076e74e4f37072b21a10812efd5539875904719
F src/delta_test.zig b18d97e117dce8fbcc05bff6f6954effdb946bab6d36337efbe5ef64d10646a0
F src/dst.zig 66f7e5b264ded6a4ec82645e87e9780b344ff23360242e263c29415163b25501
F src/e2e.zig 252ecef77b7d79bc84c6df152d1d18e4ea128b08f009b721a479f10b4afa3677
F src/extras.zig b8b36b7d6a3d348eeaf733124e671de1dba0bd4fe3cf2acd35268dfb3cf6acfb
F src/fuzz_tests.zig 7194e723225d467cf43d60210bf96860e8c248a7ae63413b70c61ea9349d291d
F src/logstore.zig a26e7b006f335b0bbb9bb41ac702ea42fab1c5b4ce9b13c7d25a89c84197aed0
F src/logstore_benchmark.zig e245474e1cc4f10617866f718aab3958f13b256c609b3e5fd562f500668388c0
F src/logstore_fuzz.zig 67b7bda806397f92c3b07c94854d9fafca56710090071a1c1c8ec94d137408f8
F src/logstore_test.zig a9baaee2cf009c988832d3632f52a1eeabf36afd52c891315f7673ce28442533
F src/main.zig 314bfb1148cf1b60d78a37e7f21b69531c4b4f5dde16905ea89c411d3214399d
F src/managed.zig 81ccc2d6321fe3dff91f653305ae4e73bea0b3fae7db2ab2f0cf168d9518d601
F src/merge3.zig 22c24bbea4b5fa79879c984b8208e6b0b17b4837977ac36b79821648a4f900bd
F src/pack.zig 0ea96cb540b3f43f6ff8ce95a3044ce939879bc6f9bf0eb82b26aab4089009c7
F src/packaging_test.zig 0697e7e19ac575d0b09f957256a90de524192b03128b15210bd37fec767097a4
F src/repocache.zig aae232a6b1b86e27c5242c0ee17ce9f2544299d99cf4936d8c2c9000e3166884
F src/repoimage.zig 7d2dc2f3c145e10e2d9ba6997705fd61a0cc0aedde8e171c253163d1279ccdd5
F src/repository.zig 6d41e75aafeddf6d6f0e0b04d280402354f2e8ee046d3027162733947a199176
F src/repository_test.zig 329c0fdfc9a84f96a94afbc5e7df5f7b2ef81651413e728ebf886e143ff5df5c
F src/repostate.zig 72b063c9b779b6154940abc31c26644346d8ff9aca1ff8c7b6d0f47672ab90ec
F src/repostate_test.zig 0645afa55d528f74e6cd1c84fc49568fff8c9c55956db30d48c4390f7a142599
F src/repoview.zig ec2958e1e8fd955c761d240ab80c3b3f62e3473991713c25ed5a603df984e403
F src/rfc_vectors/artifact_a1_1_sha1_manifest.txt 82d8fc78b3fbf85efe80cb05e79db40c910bf0551e55b728c6f9c2ca7a42ddb6
F src/rfc_vectors/artifact_a1_2_sha3_technote.txt 832e850f83aab2e2a754aa97591109f7f05fb41e4126c7e71c88a59d6d17e55d
F src/rfc_vectors/artifact_a3_rcard_manifest.txt 47e412ef211f095e93275fadf527909e581eef42357d8437fc7e299bfc3e62a7
F src/rfc_vectors/sync_a1_round1_reply.txt 638813029b10f81303b88859279afb17095d7c779c993f4267870909acabbeb9
F src/rfc_vectors/sync_a1_round2_file_cards.txt 4fa397741f7521cc4181d5d6b04dc143187f57602384eaa688552115ecda27c2
F src/rfc_vectors/sync_a1_round2_reply.txt af956808190c79b37a384041690c36b78845b471d6c6c01d1cced6e3ee92e6b1
F src/rfc_vectors/sync_a2_reply.txt aa130a127cde210f793c7842960083c765e0ffc7b673374fabc8f0edfe03d763
F src/root.zig a2a13d28a5e50138557966adf64bbe121a4a70a4de0e2933f395e30924f9140a
F src/serve.zig baa76b81f5cc21322e85f3d390b533c828c969f6d10580b5e8aa1f339202d945
F src/sim/faulty_file.zig 8e8a0325d0e987d1dd306588f910af5302e6456561eefae92c73c424fc1a9c94
F src/sim/gen.zig 0e237af570a73bc78e9a717a8ea59867611deb2348287765826ea4ff1942528b
F src/sim/net.zig 8fb057012ce0a33f67c928cd696bc2761fea8ba4012b2daa33871b2ba5dfe772
F src/sim/oracle.zig 04b81d9472a0529d9e9d030779304c3d6c930f4db20b800ae3f9cbc5c178969a
F src/sim/storage_sweep.zig 5472d632347079fb5c7e7ae300b46c6e8202b91202b1c51b181dd3c7bab8a306
F src/sim/sync_gen.zig 238d46942915b5c0e989dfc738b5927b5228468ea123e6f17b6fb593aa5cbf6e
F src/sim/sync_sweep.zig 5458a84be08823d2d0fc9464665f1c3f3f26563185dc9ae24cf73259faa5d40e
F src/smoke.zig d3aecf12565618a6b678eeff534230c88dbe5a02486beafcdbdf1eac9b258292
F src/storage.zig 512205eb629d5af8d50ad336f1ef49f53b455abd52ee2f9b56d20893cafad39f
F src/storage_benchmark.zig 871f00fef1a34a0b2ee7b9656a217a0cf52949fdd710b642a44dc6bf12d6866e
F src/sync.zig b04119b2679887c6705ed4831899ca1911ca20afe0bac865022ac8b7ad879194
F src/sync_benchmark.zig 9a4542401c880750ff6565a2ca9f1d116341d1c5af704ef4a05c2732eeec8849
F src/sync_driver.zig 722ed498ea6b76900661a085d4257e51f6416d43ac1185e8ac15140de265f67e
F src/sync_driver_test.zig b50450d2938fc60aa90cd9067fc45141a965b63dc2194f42d5109919e380d7df
F src/sync_fuzz.zig 3f419ec3e3c0b4ecf99376e46d111c4fae9826d08f9968e649ffdf84d10f9e61
F src/sync_test.zig b47b05d3defeef61a02c9c9817b66288c48430713737c946734dba151bb17e7e
F src/transport.zig 4652b2ab7f43ccd8af5ca6ef7604f8e7cd28353450b1ec90d206b881308f8b5f
F src/undo.zig 2e213cbe02118e37b11554620b285deae5dbf5b4d8009ae6dc229b84375b7591
F src/update.zig 0103da3d0ea12ce5710fd4268f432a52a0fb07ea7cb2ebe14af6e52395eb598c
F src/update_test.zig c06e5fb6da0b1b7aa055fb2398bd03844e0dbec67ed97905135db1dffb8a2a14
F src/warmread_benchmark.zig 9421986d49deff3f720e491fb6d1c7162dc9322f4e67dd14198820c3992dc02a
P 02d993f8608a97e2e78002fc8d7d1c4a7d76065e4b9c8e64100c075f9594bd68
R 584e8476401a125ac6c5f96f209abbe4
U dmestas
Z 8e8f80f5c59fb3bd23091c9a93e6a8b9