-
Notifications
You must be signed in to change notification settings - Fork 599
feat(docs write): pre-flight orphan-comment check on --replace --markdown #691
Copy link
Copy link
Open
Labels
P3Low-risk cleanup, docs, polish, ergonomics, or speculative feature.Low-risk cleanup, docs, polish, ergonomics, or speculative feature.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Metadata
Metadata
Assignees
Labels
P3Low-risk cleanup, docs, polish, ergonomics, or speculative feature.Low-risk cleanup, docs, polish, ergonomics, or speculative feature.clawsweeper:needs-live-reproClawSweeper needs live local, crabbox, or manual validation to confirm this issue.ClawSweeper needs live local, crabbox, or manual validation to confirm this issue.clawsweeper:needs-maintainer-reviewClawSweeper marked this issue as needing maintainer review before automation.ClawSweeper marked this issue as needing maintainer review before automation.clawsweeper:needs-product-decisionClawSweeper marked this issue as needing a product or behavior decision.ClawSweeper marked this issue as needing a product or behavior decision.clawsweeper:no-new-fix-prClawSweeper does not recommend queueing a new automated fix PR for this issue.ClawSweeper does not recommend queueing a new automated fix PR for this issue.impact:otherThis issue has meaningful maintainer-visible impact outside the owned taxonomy.This issue has meaningful maintainer-visible impact outside the owned taxonomy.issue-rating: 🐚 platinum hermitGood issue quality with a plausible reproduction path needing some confirmation.Good issue quality with a plausible reproduction path needing some confirmation.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Motivation
A full-body markdown rewrite (
gog docs write --replace --markdown --file=...) silently leaves any comment anchored to a phrase that disappears from the body as "orphaned". The comment is still attached to the file but is no longer anchored to live content, which is invisible until a reader notices. For docs collaborating with reviewers, this is a credibility leak: their notes effectively vanish.The Docs API already returns
quotedFileContentoncomments.list, so a pre-flight check is straightforward: for every open comment, look up its quote, normalise whitespace + HTML entities, and check whether it survives in the incoming body.Pairs with
docs comments locate— the orphan check islocateapplied per open comment. If feat(docs comments): add locate subcommand to resolve a comment to a body range #687 ships, the implementation reduces to "for each open comment, call locate, treatorphaned: trueas a would-orphan hit". Reusing the locate path keeps the normalisation rules consistent (a comment that survives--check-orphansis also resolvable bylocateafter the write). If feat(docs comments): add locate subcommand to resolve a comment to a body range #687 has not landed yet, this issue can still ship with the normalisation logic inlined; refactor when feat(docs comments): add locate subcommand to resolve a comment to a body range #687 lands.Repro
Proposed surface
Default behaviour change candidate: warn-on-orphan (with
--allow-orphansto silence), or strict block-on-orphan (with--allow-orphansto override). Pick whichever fits the project's policy on backward-compat.The pre-flight logic:
comments.listfor the doc, includingquotedFileContent.quotedFileContent.value, HTML-entity-decode it, normalise whitespace.Exit code 5 (or another well-defined non-zero) when orphans would happen and
--allow-orphanswas not given.Acceptance criteria
',",&).--allow-orphansproceeds silently.--tab=resolution.References
comments.listresponse (quotedFileContent.value): https://developers.google.com/workspace/drive/api/reference/rest/v3/comments/listgog drive comments list --include-quoted -j --all; this issue lifts that into the write path.