One capture session, two components, one frame sequence
An observatory runs a capture session per camera each night. The session’s acquisition panel and its file recorder both number the frames they take, and every frame a camera takes needs its own number. Like the lesson’s budget, the sequence is one instance that several callers must share, and the question is again who shares it. Each level starts from the previous level’s finished code, so you can begin at any of them.
A teammate’s pull request adds an archive index: the first time any session needs a first frame, it reads every camera’s last frame from the tape and keeps them, for every session the process will ever open. The observatory’s capture service runs for weeks, opening sessions night after night, and the reprocessing pipeline, a separate process, also saves frames to the archive. You are reviewing the pull request.
From the second night on, sessions number frames the archive already holds, and the files overwrite the earlier nights’ frames. Frames the reprocessing pipeline saved are overwritten too.
Reproduce Archive: north 36. Night one: session a on north saves 37 and 38. Night two, same process: session b on north takes a panel frame. It should be 39. Today it is 37.
Acceptance criteria Every session’s first frame is one past the archive’s last frame for its camera at that moment, including frames saved by earlier sessions in this process and by other processes. A session that takes no frames reads nothing, and a camera nobody captures with is never read. SINGLETON-101’s and 102’s rules still hold: one sequence per session, shared by its panel and recorder; independent sessions; an unknown camera rejected at open. Keep the index only if it is right for every session it answers; otherwise remove it. Notes Cases print each frame, then the archive’s reads per camera, joined by “ | ”. “external north 50” in a case is another process saving frame 50 on north. The checker fills the archive before each case, in the same process: as for the capture service, nothing it remembers from an earlier case is still true.