-
Notifications
You must be signed in to change notification settings - Fork 599
feat(docs comments): add locate subcommand to resolve a comment to a body range #687
Copy link
Copy link
Open
Labels
P2Normal priority bug or improvement with limited blast radius.Normal priority bug or improvement with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for 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.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.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: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Metadata
Metadata
Assignees
Labels
P2Normal priority bug or improvement with limited blast radius.Normal priority bug or improvement with limited blast radius.clawsweeper:fix-shape-clearClawSweeper found a clear likely implementation shape for this issue.ClawSweeper found a clear likely implementation shape for 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.clawsweeper:source-reproClawSweeper found a high-confidence source-level issue reproduction.ClawSweeper found a high-confidence source-level issue reproduction.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: 🦞 diamond lobsterVery strong issue quality with high-confidence source-level or clear reproduction.Very strong issue quality with high-confidence source-level or clear reproduction.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Motivation
A comment carries
quotedFileContent.value(the literal text the comment was anchored to at creation time). To act surgically on a comment ("delete the text the reviewer flagged", "wrap it in a hyperlink"), the script needs(startIndex, endIndex)in the current doc body. Today every consumer has to roll this resolution themselves, including HTML-entity unescaping (Drive sometimes returns",&,',·,>,<) and whitespace normalisation.This is the load-bearing primitive for any "comments to automated edits" workflow.
Depends on
find-rangeprimitive —comments locateisfind-rangeapplied to the comment'squotedFileContent.valuewith whitespace normalisation + HTML-entity unescaping turned on by default. Without feat(docs): add find-range primitive that maps text to Document index ranges #682, this command duplicates the same walk-and-index logic; with feat(docs): add find-range primitive that maps text to Document index ranges #682 it is a thin specialisation.Consumed by
docs write --check-orphans— the orphan pre-flight runscomments locateper open comment and treatsorphaned: trueas a "would orphan" hit. Sharing the locate path between the two commands keeps the normalisation rules consistent (a comment that survives--check-orphansis also resolvable bylocateafter the write).Repro
Proposed surface
JSON output:
{ "commentId": "AAAA...", "matches": [ {"startIndex": 1234, "endIndex": 1267, "tabId": "kix.abc"} ], "orphaned": false, "quote": "the literal text the comment was anchored to" }Returns
orphaned: trueand an emptymatchesarray when the quoted text no longer appears in the body.Acceptance criteria
",&,',·etc.) without manual decoding.--tabresolution.References
comments.getresponse shape: https://developers.google.com/workspace/drive/api/reference/rest/v3/comments/getquotedFileContentfield: same page