[cardano-testnet] Modify `renderStatusReportHumanReadable` to return `Doc Ann` instead.
Maintainer thường phản hồi trong vòng 2 ngày
@palas đang làm issue này rồi.
Từ ngày 26/10/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
renderStatusReportHumanReadable builds the report as a String: lines are joined with <> and unlines, and renderTable pads cells with pad and replicate. That one function decides the content, where lines break and how the output looks, so changing any of these (wrapping, colour, embedding a pretty-printed error) means rewriting string code. cardano-testnet already uses cardano-api's pretty-printing API (prettyError, docToString, docToText, pshow) and depends on prettyprinter, so the report could be a Doc Ann instead.
What prettyprinter gives here:
- Layout is separate from content. A
Docdescribes the content and where lines may break. A layouter (layoutPretty,layoutSmart) turns it into aSimpleDocStreamfor a given page width, and a renderer turns that intoText. The report code no longer decides where lines end. - Line breaks depend on the available width.
group,softlineandflatAltkeep the summary line or the no-testnet explanation on one line when it fits, and break it when it does not.hangandalignindent the continuation relative to the column where it started, so it lines up without counting the prefix length. - The renderer interprets annotations. Mark a node state as an error once with
annotate. cardano-api'sdocToTextuses the ANSI terminal renderer and shows it in colour, whileunAnnotategives plain text for goldens, pipes and log files. The layout code is the same for both. - It composes with existing
Docs. cardano-api errors already render asDoc Ann(prettyError,prettyException), so a node's probe error could go into the report as it is, instead of being flattened to aStringfirst.Prettyinstances forNetworkStatusandNodeStatecan be reused the same way.
Today's report is short and has no colour, so these gains show once it grows, for example with the probe error from my comment on line 164.
A rough path:
- Return
Doc AnnfromrenderStatusReportHumanReadable(both types come fromCardano.Api), and giveNetworkStatusandNodeStatePrettyinstances. - Build lines with
pretty,<+>andvsep. Usegroupwithsoftline, andhang, where a line can get long. - In
renderTable, keep the width calculation and replacepad width cellwithfill width (pretty cell)fromPrettyprinter. prettyprinter has no table combinator, so the borders stay hand-built. - Render at the edges:
docToTextwhereRun.hsprints the report. If colour is added, applyunAnnotatebefore rendering in the golden test and when stdout is not a terminal.
Originally posted by @carbolymer in https://github.com/IntersectMBO/cardano-node/pull/6741#discussion_r4348812162
- Ngôn ngữ chính
- Haskell
- Star
- 3.2k
- Fork
- 763
- Merge trung bình
- 3 ngày 2 giờ
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của IntersectMBO/cardano-node
-
Stale
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 75/100
IntersectMBO/cardano-node#6597 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
IntersectMBO/cardano-node#6522 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
IntersectMBO/cardano-node#6755 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Dijkstra PV12 needs triage type: regression
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
IntersectMBO/cardano-node#6748 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[cardano-testnet] Enhancements for status commandCó thể đã có người làm @palas đã nhận 7 ngày trước. Đang mở
IntersectMBO/cardano-node#6747 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của IntersectMBO/cardano-node
Issue tương tự
-
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 65/100
qnikst/HaskellNet#125 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
halogenandtoast/ArkhamHorror#5951 ·
-
no source repo for time-managerĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
yesodweb/wai#1163 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
clash-lang/clash-compiler#3521 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Web.Scotty.Trans.Lazy.setHeader calls addHeader instead of setHeaderCó thể đã có người làm @tusharad đã nhận 2 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
scotty-web/scotty#436 ·