cubelet: add diagnostic context to newExt4RawByReflinkCopy errors#237
Conversation
|
/cubebot review |
|
Claude finished @fslongjin's task in 3m 23s —— View job Code Review
Overall: This is a clean, well-structured change that adds valuable diagnostic context to an otherwise opaque error path. The design choices (suffix approach, single-line format, best-effort stats) are all sound. Below are my findings. Positive
Issues1. No unit tests for the new helpers (should fix) The three new unexported helpers ( 2. Deferred error path missing diagnostics (minor, consider) At err = fmt.Errorf("newExt4RawByReflinkCopy failed:%s", err)If all commands succeed but the post-validation check fails, the error is still opaque. This is a different failure mode (not a command failure), so it may warrant different diagnostics, but as-is it's inconsistent with the new command-failure path. Consider appending at least target file stats here too, or adding a comment explaining why it's omitted. 3. The PR description notes the format is "single line" so log pipelines don't split it. However, 4. In SummaryThe change is well-designed and ready to ship with one recommended addition: unit tests for the new helpers (issue #1). The other items are minor observations for potential follow-up. |
Implements proposal (2) from TencentCloud#235. On failure the error now appends step index, the failing argv, elapsed time, target/base file stats, and free space: newExt4RawByReflinkCopy failed:<stderr> [step=3/4 cmd="e2fsck -fy ..." elapsed=812ms target=size=... base=size=... free=...B] Diagnostic is a suffix on the existing prefix so any string-matching caller is unaffected. Stat/statfs errors are reported inline rather than failing the diagnostic. Adds unit tests for describeStorageFailure / describeFile / describeFreeBytes covering the missing-file, empty-path, valid-stat, statfs-error, and full-format-output cases. Signed-off-by: Wayland Yang <[email protected]>
f5c4c69 to
0fd59e9
Compare
|
/cubebot review |
|
Claude finished @kinwin-ustc's task in 1m 6s —— View job Code ReviewOverviewThis PR adds diagnostic context to error messages from Strengths
Issues1. fmt.Fprintf(&b, " free=%s", describeFreeBytes(path.Dir(target)))
In practice, callers always pass absolute paths, so this is unlikely to trigger. 2. Deferred post-validation error still opaque (shell.go:103) err = fmt.Errorf("newExt4RawByReflinkCopy failed:%s", err)The 3. Stderr newlines can break single-line goal (pre-existing) The PR's stated single-line format is a good goal, but Test AssessmentThe six new test functions provide solid coverage:
One minor note on the existing test: SummaryThe diagnostic helpers are well-designed, well-tested (the unit tests cleanly address the main feedback from the initial review), and the backward-compatible format is the right choice. Issue #1 ( |
Add the v0.2.2 release blog post in both English and Simplified Chinese. Highlights covered: - Protocol-level E2B compatibility: default sandbox port moved to 49983 to align with the E2B sandbox protocol; default-port source unified in CubeMaster. - Seven recurring stability fixes from the v0.1.x era: nil-deref panic in cubecli exec on stdin EOF (TencentCloud#188), .env port placeholders in deploy scripts (TencentCloud#210), idempotent template-image jobs (TencentCloud#227), configurable storage cmd timeout (TencentCloud#236), structured storage failure diagnostics (TencentCloud#237), PVM ext4 artifact runtime-file consolidation (TencentCloud#282), and a smaller (4G to ~100M) quick-start template image. - First batch of CVE remediations for the 0.2 series: vmm-sys-util 0.11.x to 0.12.1 closing CVE-2023-50711, with bytes / env_logger upgraded in the same PR (TencentCloud#267); time crate upgrade deliberately deferred (CVE-2026-25727 vector unreachable in Cube). - Phase-1 community contribution program now live: Troubleshooting, Use Cases, and Integrations doc tracks. File names follow the YYYY-MM-DD-slug.md convention required by docs/zh/guide/maintainer/blog.md. Cross-language files share the same slug. Frontmatter uses only documented fields (title/date/author/ description/featured/weight). Signed-off-by: caoqianyun <[email protected]>
* docs(blog): bump welcome post weight to 2 Demote the welcome post to weight: 2 so the v0.2.2 release post (added in the next commit) can take the top featured slot. Welcome post stays featured but renders below release news, which is the more time-sensitive content for landing visitors. Signed-off-by: caoqianyun <[email protected]> * docs(blog): add v0.2.2 release post (en/zh) Add the v0.2.2 release blog post in both English and Simplified Chinese. Highlights covered: - Protocol-level E2B compatibility: default sandbox port moved to 49983 to align with the E2B sandbox protocol; default-port source unified in CubeMaster. - Seven recurring stability fixes from the v0.1.x era: nil-deref panic in cubecli exec on stdin EOF (#188), .env port placeholders in deploy scripts (#210), idempotent template-image jobs (#227), configurable storage cmd timeout (#236), structured storage failure diagnostics (#237), PVM ext4 artifact runtime-file consolidation (#282), and a smaller (4G to ~100M) quick-start template image. - First batch of CVE remediations for the 0.2 series: vmm-sys-util 0.11.x to 0.12.1 closing CVE-2023-50711, with bytes / env_logger upgraded in the same PR (#267); time crate upgrade deliberately deferred (CVE-2026-25727 vector unreachable in Cube). - Phase-1 community contribution program now live: Troubleshooting, Use Cases, and Integrations doc tracks. File names follow the YYYY-MM-DD-slug.md convention required by docs/zh/guide/maintainer/blog.md. Cross-language files share the same slug. Frontmatter uses only documented fields (title/date/author/ description/featured/weight). Signed-off-by: caoqianyun <[email protected]> --------- Signed-off-by: caoqianyun <[email protected]>
Implements proposal (2) from #235.
What it does
When
newExt4RawByReflinkCopyfails, the returned error now appends a single-line diagnostic suffix:Fields: command index (1-of-N), the failing argv, elapsed time, target/base file stats (size or "missing"), and free bytes on the target's volume.
Format choices
"newExt4RawByReflinkCopy failed:<stderr>"prefix.\ndon't separate the diagnostic from the underlying error.stat/statfserrors are reported inline ("stat err=<msg>") instead of failing the diagnostic itself; the caller already has a real error to return.Out of scope (deliberately)
newExt4BaseRawandnewExt4RawByCopyhave the same opaque-error shape and would benefit from the samedescribeStorageFailurehelper, but the issue namednewExt4RawByReflinkCopyspecifically. Happy to extend to the other two in a follow-up if you'd like.Tested
go vet ./storage/...— cleango build ./storage/...— cleangofmt -l— cleanRelated
newExt4RawByReflinkCopyfails with "bad magic number in superblock" under N=100 concurrent spawn #235cmdTimeout): storage: make cmdTimeout configurable via plugin config #236