oficina / docs Public

Live push 1b: a resume's tag comes in a header, never the query string (#175 approval, note 6)

The cursor tag is an unkeyed digest of the row's plaintext, and
since=&tag= put it in the URL, which access logs keep: on a sealed
instance a log reader could confirm a guess at a small row. A resume now
names it in a Docs-Seq-Tag request header (or Last-Event-ID <seq>.<tag>,
also a header); a tag in the query string is not read. Spec §3.1 amended.

Tests: TestPushFramesCarryTheRowsTag and TestPushRestoredLogIsDetected
send the header (both failed against the query-reading code), and a tag
in the query string is shown to be ignored.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 985bb4585ad5642e6538279bf9815f76e9e9ac2c parent dc12ebe
3 files changed, +19 −6
  • docs/superpowers/specs/2026-11-26-live-push-design.md +5 −1
  • internal/docs/push_test.go +10 −3
  • internal/docs/stream.go +4 −2
diff --git a/docs/superpowers/specs/2026-11-26-live-push-design.md b/docs/superpowers/specs/2026-11-26-live-push-design.md
index 60574dc..daa3576 100644
--- a/docs/superpowers/specs/2026-11-26-live-push-design.md
+++ b/docs/superpowers/specs/2026-11-26-live-push-design.md
@@ -308,7 +308,11 @@ bytes; branch review #175, finding 3, below).
- push and own frames carry `id: <seq>.<tag>`;
- fetch responses carry `Docs-Seq-Tag` for the row their `Docs-Seq` names;
- a resume names its cursor's tag (`Last-Event-ID: <seq>.<tag>`, which
- `EventSource` sends by itself, or `since=<seq>&tag=<tag>`);
+ `EventSource` sends by itself, or `since=<seq>` with a `Docs-Seq-Tag`
+ request header). Never in the query string: access logs keep URLs, and
+ the tag is an unkeyed digest of the row's plaintext, so on a sealed
+ instance a log reader could confirm a guess at a small row (branch
+ review #175, approval note 6);
- the stream answers `resync` and ends when the row it holds at that seq
has another tag or is missing, and when the cursor is ahead of the log;
- a cursor without a tag is checked by seq and epoch only.
diff --git a/internal/docs/push_test.go b/internal/docs/push_test.go
index 4828d86..eb0aaed 100644
--- a/internal/docs/push_test.go
+++ b/internal/docs/push_test.go
@@ -1184,7 +1184,7 @@ func TestPushFramesCarryTheRowsTag(t *testing.T) {
t.Fatalf("Docs-Seq-Tag %q, want %q", got, pushTag(1, u))
}
f.post(f.cookies, f.update(2, "next"), "")
- good := f.open(f.cookies, "?push=1&since=1&tag="+pushTag(1, u), nil)
+ good := f.open(f.cookies, "?push=1&since=1", map[string]string{"Docs-Seq-Tag": pushTag(1, u)})
good.hello(t)
if fr := good.next(t); fr.event != "push" || fr.id != "2" {
t.Fatalf("resume with the right tag: %+v", fr)
@@ -1194,11 +1194,18 @@ func TestPushFramesCarryTheRowsTag(t *testing.T) {
if fr := viaHeader.next(t); fr.event != "push" || fr.id != "2" {
t.Fatalf("resume by Last-Event-ID seq.tag: %+v", fr)
}
- bad := f.open(f.cookies, "?push=1&since=1&tag=0000000000000000", nil)
+ bad := f.open(f.cookies, "?push=1&since=1", map[string]string{"Docs-Seq-Tag": "0000000000000000"})
bad.hello(t)
if fr := bad.next(t); fr.event != "resync" {
t.Fatalf("resume with a wrong tag: %+v, want resync", fr)
}
+ // Never in the query string, where access logs keep it (#175 approval,
+ // finding 6): a tag there is not read.
+ query := f.open(f.cookies, "?push=1&since=1&tag=0000000000000000", nil)
+ query.hello(t)
+ if fr := query.next(t); fr.event != "push" || fr.id != "2" {
+ t.Fatalf("a tag in the query string was read: %+v", fr)
+ }
}
// #175 finding 3, the restore it is for: the database and the file beside
@@ -1257,7 +1264,7 @@ func TestPushRestoredLogIsDetected(t *testing.T) {
for k := 6; k <= 7; k++ {
f.post(f.cookies, f.update(k, fmt.Sprint("after", k)), "")
}
- s := f.open(f.cookies, "?push=1&since=5&tag="+tag, nil)
+ s := f.open(f.cookies, "?push=1&since=5", map[string]string{"Docs-Seq-Tag": tag})
_, seq, _ := s.hello(t)
if seq != 5 {
t.Fatalf("the restored log is at %d, want 5 (the case the seq check cannot see)", seq)
diff --git a/internal/docs/stream.go b/internal/docs/stream.go
index 11fe4eb..d3a3947 100644
--- a/internal/docs/stream.go
+++ b/internal/docs/stream.go
@@ -162,13 +162,15 @@ func (h *handlers) stream(w http.ResponseWriter, r *http.Request) {
// own reconnects) wins over since; garbage in either is a 400, as
// parseSince answers. With neither, it starts at the current seq.
// A cursor may name its row's tag (<seq>.<tag> in Last-Event-ID, or
- // since=<seq>&tag=<tag>), which the stream checks below.
+ // since=<seq> with a Docs-Seq-Tag request header), which the stream
+ // checks below. Never in the query string: access logs keep it, and the
+ // tag is an unkeyed digest of the row (#175 approval, finding 6).
start, resume, tag := current, false, ""
if push {
raw := r.Header.Get("Last-Event-ID")
if raw == "" {
raw = r.URL.Query().Get("since")
- tag = r.URL.Query().Get("tag")
+ tag = r.Header.Get("Docs-Seq-Tag")
}
if raw != "" {
seqText, rawTag, _ := strings.Cut(raw, ".")