Skip to content

Re-arm the tracked Docs revision after comment writes; one CHANGELOG entry per PR; 3.4.3 - #144

Merged
ElliotDrel merged 1 commit into
mainfrom
t3code/release-readiness
Sep 2, 2026
Merged

Re-arm the tracked Docs revision after comment writes; one CHANGELOG entry per PR; 3.4.3#144
ElliotDrel merged 1 commit into
mainfrom
t3code/release-readiness

Conversation

@ElliotDrel

Copy link
Copy Markdown
Collaborator

Fix: comment tools left the tracked Docs revision stale

addComment, replyToComment, resolveComment, updateComment and deleteComment each advance the Docs revisionId while Drive modifiedTime stays identical. Measured live on 2026-09-02: modifiedTime 2026-09-02T19:53:11.311Z before and after all comment operations, Drive version 3 -> 4, Docs revisionId changed each time.

The read tracker compares only modifiedTime, so after any comment operation the next appendText / replaceDocumentWithMarkdown went out with the pre-comment writeControl.requiredRevisionId. Google returned 400 and the tool reported "This document (...) changed since you last read it" even though nobody else touched the document.

Each comment tool now calls refreshTrackedRevisionAfterComment() after its Drive write succeeds (dist/tools/docs/comments/trackedRevision.js, backed by the new readTracker.refreshRevision()). The content snapshot and modifiedTime baseline are kept, so the read-before-write and content-change guards are untouched. A failed probe keeps the old revision, logs a warning, and leaves the comment result as-is, so the guard still fails closed. Untracked documents are never probed.

Not covered here, follow-up issue to be filed: a collaborator's comment made in the Docs UI moves the revision the same way and nothing in-process can see it, so the next write still reports the conflict until the document is read again.

CHANGELOG: one entry per merged PR, package.json 3.0.0 -> 3.4.3

CHANGELOG.md is restructured per the new convention: one entry per merged pull request or standalone direct commit, each with its own semantic version (2.0.1 for #81 through 3.4.2 for #143, and 3.4.3 for this PR). Every existing paragraph is preserved verbatim; entry order matches git log --first-parent v2.0.0..main. RELEASING.md documents the per-PR convention and now says the validate job checks the #50 gate itself (since 3.3.3).

Testing

  • tests/commentRevisionRefresh.test.js: for each of the five tools, a tracked doc gets exactly one documents.get({fields: 'revisionId'}) probe and the tracker revision advances with content kept; untracked docs are not probed; a failing probe keeps the old revision and warns; resolveComment refreshes even when verification says the resolve did not persist; a failed comment write never probes.
  • live/missions/verify-comment-collateral.mjs now drives all five comment tools and asserts a body write succeeds after each with no re-read. PASS live 2026-09-02 (15 calls, only the intended onCollateral='block' refusal, 1/1 cleaned up, sandbox empty after).
  • npm run test:ci: 96 suites, 1419 passed, 2 skipped. npm audit --omit=dev: 0. npm pack --dry-run: 185 files, 396.6 kB. npm run live-coverage: 31 driven live / 129 unit only / 2 blocked by design.

🤖 Generated with Claude Code

…entry per PR; 3.4.3

Fix: addComment, replyToComment, resolveComment, updateComment and deleteComment
each advance the Docs revisionId while Drive modifiedTime stays unchanged
(measured live). The read tracker compares only modifiedTime, so the next
body write went out with the pre-comment writeControl.requiredRevisionId and
Google refused it as "changed since you last read it" with no external edit.
Each comment tool now refreshes the tracked revision after its Drive write
succeeds (readTracker.refreshRevision + comments/trackedRevision.js); the
content snapshot and modifiedTime baseline are kept, and a failed probe keeps
the old revision so the guard still fails closed.

CHANGELOG.md is restructured to one entry per merged PR / direct commit with
its own semantic version (2.0.1 .. 3.4.3); package.json moves 3.0.0 -> 3.4.3;
RELEASING.md documents the per-PR convention.

Tests: tests/commentRevisionRefresh.test.js; live/missions/verify-comment-collateral.mjs
now drives all five comment tools and asserts a body write succeeds after each
(PASS live 2026-09-02, sandbox empty after cleanup). live-coverage: 31/129/2.

Co-Authored-By: Claude Code <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: b012f710-7721-453c-aad2-3625a0f9eb37

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ElliotDrel
ElliotDrel merged commit 665a605 into main Sep 2, 2026
3 checks passed
@ElliotDrel
ElliotDrel deleted the t3code/release-readiness branch September 2, 2026 20:09

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7a384e9659

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +27 to +28
const res = await docs.documents.get({ documentId, fields: 'revisionId' });
refreshRevision(documentId, res?.data?.revisionId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve concurrency protection when refreshing revisions

When a collaborator changes the document body before this documents.get completes, the returned revision can include both the local comment and that external edit. Replacing the tracked revision with it while retaining the old content snapshot implicitly accepts the collaborator's change; if Drive's modifiedTime is still lagging—as guardMutation explicitly allows for—the next write carries this newly accepted revision and can overwrite content without reporting a conflict. Refreshing the revision therefore needs to verify that the body still matches the tracked snapshot, or require a reread when it cannot make that guarantee.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant