Skip to content

Fixes GRE-799: stream authoritative job snapshots - #1255

Merged
poitee merged 3 commits into
mainfrom
gre-799-job-ws-snapshots
Oct 27, 2026
Merged

poitee merged 3 commits into
mainfrom
gre-799-job-ws-snapshots

Conversation

@poitee

@poitee poitee commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

An admitted job socket now sends the public snapshot, including the one queued at subscribe, and later commits on that job. A terminal snapshot is the last data frame, then the socket closes 1000. Logout closes 1008 Session revoked and sends nothing further. A missing or foreign job upgrades and closes 1008 Job not found without subscribing. HEAD for those callers stays 404.

Summary

GET /ws/jobs/{id} keeps the GRE-798 admission checks. After read_public accepts, the pump sends the same public JSON as read-one, with updated_at removed. done, error, and cancelled are followed by close 1000. Revocation and open-socket expiry close 1008. A lagged mailbox or a stopped jobs service closes 1011. A missing or foreign job never calls subscribe.

The route still mounts only when desktop_rebuild is compiled and PP_DESKTOP_REBUILD is exactly 1 or true.

Definition of done

See the definition of done.

  • One job, under about 1,500 lines. Work for other tickets is noted on those tickets.
  • Unslop pass run on code, comments and docs. No filler comments, dead code or speculative abstractions.
  • Docs updated in this PR, or the PR changes no behavior, setup or interface.
  • Reviewed by a different model vendor than the author, on the exact head commit, with CI green.

Evidence

Local checks used CARGO_TARGET_DIR=/persist/targets/gre-799-job-ws and CARGO_BUILD_JOBS=2.

Feature on:

cargo test -p pp-api --locked --manifest-path rust/Cargo.toml --features desktop_rebuild --test jobs_http -- --test-threads=2

16 passed.

Feature off:

cargo test -p pp-api --locked --manifest-path rust/Cargo.toml --test jobs_http job_ws_ -- --test-threads=2

4 passed. Each job_ws_ filter is the 404 stub.

Clippy -D warnings for pp-api --all-targets was clean with --features desktop_rebuild and without it.

The later commit only documents the logout admit window. It does not change the pump.

Declined nits

Sol approved the behavior. Council approved the same head. These stay out of this slice so the scored commit stays 040279eb.

  • admit stays on the async worker. Moving it into spawn_blocking is a larger pump change, and this route is not mounted.
  • The 100 ms prepare wait sleeps on the job condvar. Nothing calls with_wait(Duration::ZERO). A longer poll would still hold one blocking thread per open socket. That cost belongs with the slice that mounts the route.
  • Foreign GET already closes 1008 through close_missing, and missing HEAD stays 404. Open-socket expiry and owner-stop use the same close_reason match. Updating sessions.expires_at cannot fire StreamClose::Expired, because the stream keeps the expiry copied at subscribe.
  • send_close does not wait for the peer close. The tests read the close frame from a client that does not answer it. A one second drain would stall every close in those tests. The web client closes itself when it sees a terminal snapshot.
  • The logout sentence in docs/gre-799-jobs-http.md stays the revocation contract. The pump comment on this head states that a snapshot admitted before logout can still be written, and that nothing admitted after revocation is sent. Claude scored that gap a nit.
  • docs/gre-798-jobs-http.md stays the GRE-798 slice note. It already points snapshots and the 1008 close at docs/gre-799-jobs-http.md.
  • Unreachable admit returns, the second copy of the terminal status list, and the Admission wording stay as they are.

Council review

Rounds: 1

Delegate Round 1
Claude Opus 5.5 9/10 APPROVE
Grok 4.7 9/10 APPROVE
Qwen3.8-Flash 9/10 APPROVE

Scored head: 040279ebc899c6fbee2bc702153f1b78c0445cd5.

Exemption

Exemption: none

Reviewed with sol-loop: 1 round with Claude Opus 5.5 on xhigh. Sol verdict: approved.

Created with Grok 4.7 in T3 Code.

An admitted /ws/jobs/{id} socket sends the public read-one snapshot, then later commits. A terminal snapshot is followed by close 1000. Logout closes 1008 Session revoked and sends nothing further. A missing or foreign job upgrades and closes 1008 Job not found. HEAD stays 404 and does not subscribe.
A new upgrade with an already expired session stays HTTP 401. Close 1008 Session expired is for a socket that is already open.
A snapshot admitted before logout can still be written after logout returns. The next close is 1008, and no frame admitted after revocation is sent.
@poitee
poitee merged commit 8d39772 into main Oct 27, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant