Archive: a segment damaged before its first event reads as an empty one
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- go
調査の方向性
Start by tracing how readRecordsWith in core/session/archive/reader.go reports truncation through Page and Earlier in core/session/archive/read.go, then check replay callers in core/session/archive/replay.go and the pre-first-record branch in core/sessionapi/export.go. The issue leaves open whether to propagate the flag or return an error for damage before the first event, so check the compatibility implications for callers outside this repo. Add the garbage-first-bytes test expecting HTTP 500, and update the export comments and docs/session-export.md once the behavior is settled.
索引モデルが issue の本文から書いたものです。
説明
Split out of the #1830 review.
What happens
readRecordsWith (core/session/archive/reader.go) reports a torn tail or an
undecodable line as truncated=true, err=nil — a property of the data, not a
failure. Page then discards that flag (_, err := readSegment(...) in
core/session/archive/read.go:57), so no caller above it can tell a damaged
segment from a complete one.
For the paging endpoints that is the intended, documented behaviour: serve the
readable prefix. But a segment damaged before its first event has no readable
prefix, so it contributes nothing and is indistinguishable from an empty archive:
segment -> 39 bytes of non-zstd garbage GET /v1/export 200 application/x-ndjson ""
segment -> symlink loop (ELOOP) GET /v1/export 500 {"error":"archive read failed"}
Only a segment that cannot be opened produces an error today. GET /v1/export
(#1830) documents this as the tolerated case, and docs/session-export.md says an
export is not a way to detect a corrupt archive — but "nothing happened this month"
and "this month will not decode" really are different answers, and a backup/export
consumer is exactly who wants to tell them apart.
What to do
Hand truncated up from Page/Earlier, or distinguish "torn before the first
event in a non-empty file" from "torn tail" and return that as an error. Then
handleExport's pre-first-record branch catches it and answers 500, and the
claims in core/sessionapi/export.go and docs/session-export.md can be
strengthened back.
This is an archive-package change with paging and replay as callers, which is why
it is not in #1830. core/ is consumed outside this repo, so a signature change
needs the usual care.
Scope
core/session/archive/{reader,read,replay}.gocore/sessionapi/export.gocomments +docs/session-export.mdonce it lands- a test with a segment whose first bytes are garbage, asserting 500 rather than an empty 200
Refs #1810, #1830
Assisted-By: Claude (Anthropic AI) [email protected]
- 主要言語
- Go
- スター
- 31
- フォーク
- 49
- 平均マージ
- 9時間 43分
- マージ済み PR(30日)
- 367
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rossoctl/cortex のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
bug laptop
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
rossoctl/cortex の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
taskmanager: a failed v1alpha1 backup leaves the partial backup behind対応中かも @arshil42 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 80/100
ether/etherpad-go#571 ·
メンテナーはふだん 1 日以内に返信
-
labeler: read a limit above math.MaxInt as math.MaxInt in nonNegative (CodeQL alerts #20 and #21)オープンcost:approved factory:queued factory:tracking priority:p2 rank:12 ready-for-doing task:approved tokens:50k
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
sisaku-security/sisakulint#860 · コメント 2 件 ·