| 1 | # The web UI (web/): the export contract the publisher, the receiver |
| 2 | # and the server share, the server, and the receiver. Their tests run |
| 3 | # here, in the packages' unit builds (nix/packages.nix). |
| 4 | { |
| 5 | pkgs, |
| 6 | packages, |
| 7 | ... |
| 8 | }: |
| 9 | { |
| 10 | # The projection over the shared fixture, which holds every disclosure |
| 11 | # rule: what reaches export.json, hidden projects' edges, a knot that |
| 12 | # waits on a hidden knot marked with waiting_on_hidden alone, the field |
| 13 | # gone once its one hidden blocker is done, the display mapping. The |
| 14 | # content digest; strict reading of export.json, with |
| 15 | # nothing after its document; each of VerifyManifest's steps, in order; |
| 16 | # the manifest's grammar and its agreement with export.json; the |
| 17 | # streaming body check; bundle acceptance against real git, refusing |
| 18 | # wrong tips, prerequisites, extra refs, corrupt objects and a header |
| 19 | # past its bound, writing a commit-graph git verifies, and serving no |
| 20 | # commit main does not reach, nor one named in the other object |
| 21 | # format's length, alone or among several; git's |
| 22 | # output read within its limit, with git stopped past it or when its |
| 23 | # reader stops early; and the receiver's state directory. For the state |
| 24 | # directory: uploads private to the receiver and generations readable |
| 25 | # by every user, whatever its umask; readers holding |
| 26 | # a generation through activations, every file of a generation synced |
| 27 | # before high-water names it, a repository a crash interrupted built |
| 28 | # again, recovery checking a generation before it activates it and |
| 29 | # keeping one whose check git did not finish, and injected sweep and |
| 30 | # swap failures, reported apart from the commit. The publisher's pass |
| 31 | # uploading to the real receiver with its token, the real valley-web |
| 32 | # serving what it activated, a pass with another token refused as |
| 33 | # unauthenticated while the edge keeps serving, and a pass after |
| 34 | # anyone's grant is withdrawn taking the project off the edge. go vet |
| 35 | # runs after them. |
| 36 | web-unit = packages.web.unit; |
| 37 | |
| 38 | # Read access, which the publisher reads its consents through: both |
| 39 | # consents read out of real commits under the real schemas, an explicit |
| 40 | # empty reader set and an empty scope letting no one read, anyone's |
| 41 | # restrictions, no principal name special, a policy for another project |
| 42 | # and a grant for another identity covering nothing, other destinations' |
| 43 | # grants and expired principals' left out, policy/web never read, tree |
| 44 | # entries with a directory part or named twice refused before anything |
| 45 | # is copied out, a directory named twice on the way to a document |
| 46 | # refused, redeclared definitions widening nothing, a field spelled in |
| 47 | # another case than the schema's refused, and the coverage report over a |
| 48 | # real valley, with the registry read at its ref. go vet runs after them. |
| 49 | readaccess-unit = packages.readaccess.unit; |
| 50 | |
| 51 | # The server and valley-web over the shared fixture, uploaded to a real |
| 52 | # store, and real git. The plan page's reading order, its free to start |
| 53 | # legend, its one card of ready changes, and the export's age, marked |
| 54 | # stale after five minutes; a knot's body and comments, with the edited |
| 55 | # one marked; a hidden project answering every route exactly as a |
| 56 | # missing one, though its repository is in the generation; a blocked |
| 57 | # knot's chip naming its published blockers and, once, unpublished |
| 58 | # work; projects |
| 59 | # named source, knots and web-export served on every route, and their |
| 60 | # roots redirected to their trees, while the server's own paths under |
| 61 | # /-/ are never a project's; a commit |
| 62 | # main's tip does not reach, and every other object ID or name, refused |
| 63 | # with the one 404; hostile README, file, file name, commit subject and |
| 64 | # knot text rendered inert, and large and binary files not shown; a |
| 65 | # reference into the hidden project naming nothing of it; a directory |
| 66 | # past MaxRead listed in part, and a 5 MiB commit message ending its |
| 67 | # page of history early; the directories along a path sharing one |
| 68 | # MaxRead; the older links of history showing every commit once through |
| 69 | # a merge whose lines run across pages, and every link of a page past |
| 70 | # MaxFrontier lines, or one ended before a merge past MaxLeftToShow, |
| 71 | # reaching every commit; a merge whose parents pass a record of git log |
| 72 | # shown, first on a page and further down, with its first MaxParents |
| 73 | # followed; a source request's git slot held for a bound of its own from |
| 74 | # admission, through a slow export read and its git, answering 503 and |
| 75 | # giving back its slot, and given back before it renders; a SHA-256 |
| 76 | # project served by full commit IDs alone; a file of MaxFile newlines shown to MaxLines; |
| 77 | # a chain of knots near the graph's limit shown to MaxPlanDepth, with |
| 78 | # the plan's structure built once; the policy on every response, |
| 79 | # admitting the page's inline stylesheet and script by their hashes; a |
| 80 | # request keeping its generation while another activates; an export |
| 81 | # read once per generation, however many requests wait for it, across |
| 82 | # activations; a load started only by a request taking a loader slot, |
| 83 | # with requests that wait for one ending at their deadline or when |
| 84 | # their reader goes away, leaving no load behind and holding no |
| 85 | # generation; a load reading export.json from a slow pipe stopped part |
| 86 | # way once its one request's deadline passes, caching nothing and |
| 87 | # giving back its generation; a flood during a load keeping |
| 88 | # MaxLoadWaiting requests waiting and answering the rest 503, with the |
| 89 | # server's goroutines and open files bounded; source requests past |
| 90 | # MaxGit and MaxWaiting answering 503, with an activation while they |
| 91 | # wait and a deadline that covers the wait; a request held past its |
| 92 | # deadline before it renders answering 503; a page past MaxResponse on |
| 93 | # a knot, and past a smaller bound on a file, a directory, a page of |
| 94 | # history and the plan, answering the one short page that says it is |
| 95 | # too large; readers that never read holding no git slot and no |
| 96 | # generation, and, asking for more than MaxBuffered in large pages of |
| 97 | # three sizes, holding no more of the heap than it and no more than |
| 98 | # MaxLarge, their pages' starts counted, with a large page it has no |
| 99 | # room for answering 503 while the plan, a knot and a directory still |
| 100 | # render; and valley-web run as a process of its own, serving and |
| 101 | # stopping on SIGTERM, and serving every page from a state directory |
| 102 | # the receiver wrote under umask 0077 and that reads as another |
| 103 | # user's, with nothing in it writable. go vet runs after them. |
| 104 | web-server-unit = packages.valley-web.unit; |
| 105 | |
| 106 | # The receiver, valley-web-receive, run as a process of its own over the |
| 107 | # shared fixture's export, signed now, and real git. Each step of the |
| 108 | # upload activating the export, which the real valley-web, a process of |
| 109 | # its own over the same state directory, serves; the manifest posted |
| 110 | # again and the commit made again refused as replayed. A request without |
| 111 | # the token, with another, in another scheme or twice refused as |
| 112 | # unauthenticated, whatever it asks, staging nothing. Stale, early, |
| 113 | # foreign-key and foreign-destination manifests refused, an older |
| 114 | # manifest than the one staged superseded, with its bodies, and a commit |
| 115 | # of a sequence never staged refused as no-manifest. Bodies with a hash |
| 116 | # mismatch, a size mismatch with and without a length, a |
| 117 | # Content-Encoding, or an undeclared hash refused; a body cut off half |
| 118 | # way leaving nothing in staging, its commit refused as incomplete with |
| 119 | # the active export as it was, and the body sent whole then activating. |
| 120 | # A body past --max-body and bodies past --max-upload refused as |
| 121 | # too-large before anything is staged, and an upload at both caps |
| 122 | # accepted. Every request slot held by a stalled upload, the next |
| 123 | # request answered 503 and one without the token still unauthenticated, |
| 124 | # while valley-web serves every page; the receiver taking uploads again |
| 125 | # once the stalled ones go away. A clean stop on SIGTERM, and a usage |
| 126 | # error, a token file it cannot use and verifiers it cannot read refused |
| 127 | # without printing the token. go vet runs after them. |
| 128 | web-receiver-unit = packages.valley-web-receive.unit; |
| 129 | |
| 130 | # The edge's container image, unpacked as a container runtime would: |
| 131 | # valley-web and valley-web-receive at /bin, each pointing at a program |
| 132 | # the image holds, with the git each runs held too; both users and their |
| 133 | # group in /etc/passwd and /etc/group; /var/lib/valley-web the image's |
| 134 | # one volume, owned by the receiver's user and group with mode 0750; and |
| 135 | # the image running as valley-web unless told otherwise, starting no |
| 136 | # program of its own. |
| 137 | web-image = pkgs.runCommand "valley-web-image" { |
| 138 | nativeBuildInputs = [ pkgs.jq ]; |
| 139 | image = packages.valley-web-image; |
| 140 | } (builtins.readFile ./web-image.sh); |
| 141 | } |