Each module here takes the candidate documents
../answer/gather.zig produced and turns them into
one shape: a set, a count, finished bytes, or a record stream.
They are siblings rather than one switch because they differ in what they accumulate, not in how they walk — the walk is shared, which is why no two faces can prune differently or disagree about which document is live.
fold.ziganswers as a set or a count. It is the fold face — a set of paths (-l) or a count of matching lines (-c), sharded over cores above the parallel floor.-vis answered as the set-complementlines(f) − matching(f)so the trigram index stays sound and only candidate files run the matcher.present.ziganswers as finished bytes. It holds the rendered faces: the defaultpath:textline search, its shared-memory sibling above the transport floor (same bytes, different carrier), and the native definition-first--rankview.stream.ziganswers as records. It holds the per-line faces: the in-process FFI'sMatchRecordstream (rg's line model,-A/-B/-Ccontext windows, the-mcap, parallel shards reassembled in doc order) and the early-halting-qexistence probe that stops at the first admitted match. It ownsLineWalk, the single line-splitting authority.render.ziganswers as the byte frame. It is the warmlinesrenderer: the defaultpath:text/-npath:line:textframe, produced through the cold engine's ownEmitterandbinary.handleBinary— byte-parity by construction, never a re-derived formatter. It is also home tofanRenderand thepar_min_bytesfloor: above it, every warm face shards its scan over cores through the one sharedkernel/math/parallel.zigprimitive, byte-identical to the serial core below it.
render_test.zig sits beside its subject.
present.zig formats nothing itself: it gathers warm documents and hands
them to a renderer the cold path owns — render.zig (which drives the
cold engine's own Emitter) for the default presentation, ranked.renderLive
for --rank.
So byte-parity with a piped cold run is a property of construction rather than of a second formatter that could drift from the first.
\n terminates a line — a body ending in \n has no phantom final
line.
The -q probe, the record stream, the context planner, and
corpus.gatedLineCount all count that same split through LineWalk, so
none of them can drift from the others by re-deriving the walk locally.