[ BUG ] --debug leaves an HTML dump in TMPDIR for remote documents
まだ誰も着手していません。
評価
調査の方向性
まず internal/core/usecase/localmd/localmd.go と internal/core/usecase/remotemd/remotemd.go を読み、次に issue にある TMPDIR の再現手順を実行します。デバッグダンプと遅延された一時ファイルのクリーンアップがどのように連動するかを追跡し、出力を意図どおり検査できる状態を維持しながら、remote --debug が孤立したダンプを残さなくなっていることを確認します。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
With --debug, a run against a remote URL leaves an orphaned ghtoc-remote-txt-*.debug.html file in the temporary directory. Nothing ever removes it, so the files accumulate.
RemoteMd downloads the document into a temporary file and delegates to LocalMd. In debug mode LocalMd writes its HTML dump next to the file it was handed, producing <temp>.debug.html. RemoteMd's deferred cleanup removes only the downloaded copy, not the dump.
The dump is also useless where it lands: it is named after a random temporary file, so there is no obvious way to connect it back to the URL that produced it.
To Reproduce
export TMPDIR=/tmp/ghtoc-dbg && mkdir -p "$TMPDIR"
gh-md-toc --debug https://raw.githubusercontent.com/ekalinin/github-markdown-toc.go/master/README.md > /dev/null
ls -1 "$TMPDIR"
Actual:
ghtoc-remote-txt-482196719.debug.html
Expected: nothing left in TMPDIR, or a dump the user can actually find.
Expected behavior
Two reasonable options, and the choice affects whether --debug stays useful for remote input:
- Remove it.
RemoteMddeletes<temp>.debug.htmlalongside the temporary Markdown. Smallest change, but--debugthen produces nothing inspectable for a remote document, which defeats the flag for that input type. - Relocate it. Write the dump into the working directory under a name derived from the URL, for example
README.md.debug.html. Keeps the flag useful and matches what already happens for local files, where the dump lands next to the document and is covered by the*.debug.htmlrule in.gitignore.
Environment (please complete the following information):
- OS: macOS (darwin/arm64), reproduces on any platform
- Version: reproduced at 2.0.1 and on current
master
Additional context
Pre-existing, not introduced by any open pull request.
The same class of bug affected --skip-header, where the dump was named after an internal trimmed copy and stranded in TMPDIR the same way. That one is fixed in #79 by naming the dump after the document the user passed rather than after the internal temporary file. RemoteMd was deliberately left out of that change: its display path is a URL, not a filesystem path, so the same fix does not apply directly and the destination is a real decision rather than a mechanical one.
See internal/core/usecase/localmd/localmd.go (debug dump) and internal/core/usecase/remotemd/remotemd.go (temporary file cleanup).
- 主要言語
- Go
- スター
- 525
- フォーク
- 90
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ekalinin/github-markdown-toc.go のほかの issue
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 45/100
ekalinin/github-markdown-toc.go の issue をすべて見る
似ている issue
-
agent-butler-finding chore
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
jordansmall/spindrift#4146 ·
メンテナーはふだん 1 日以内に返信
-
security
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
IBM/ibmcloud-volume-file-vpc#119 ·
-
security
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
IBM/networking-go-sdk#339 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
kubernetes-sigs/mcp-lifecycle-operator#439 ·
メンテナーはふだん 1 日以内に返信
-
area: global bug dx priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信