fix(docs): resolve docs.getText API errors#349
Merged
allenhutchison merged 4 commits intomainfrom Apr 29, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the documentation for comment retrieval and refines how document content is fetched in DocsService by specifying a detailed fields mask for tabs. It also introduces suggestionsViewMode when reading documents. Feedback includes a recommendation to remove an unnecessary "as any" cast for better type safety and a suggestion to refactor the repeated fields mask into a constant while removing unused fields to improve maintainability and efficiency.
Removed unsupported includeComments parameter from documents.get and refined the field mask to avoid broad 'tabs' request which triggered internal API conflicts. Added PREVIEW_WITHOUT_SUGGESTIONS view mode to getText for cleaner extraction. - Fix DocsService.getText invalid parameter - Use specific field mask for tabs in DocsService - Update documentation to correctly reference drive.getComments - Update test expectations for DocsService
- Extract the tabs field mask to a TABS_FIELD_MASK module export so the three documents.get call sites stay in sync. - Remove the `as any` cast on the getText documents.get call. The googleapis SDK type already accepts suggestionsViewMode (the existing getSuggestions call uses it without a cast); tsc 5.9.3 typechecks cleanly without it. - Update tests to reference the same constant.
Locks in the new behavior so a future regression that drops the narrowed field mask or the PREVIEW_WITHOUT_SUGGESTIONS view mode is caught at PR time rather than only via API errors against real Google Docs.
TS 6 became stricter about implicit rootDir. ts-node compiling scripts/print-scopes.ts against the root tsconfig (which only includes workspace-server/src/) failed with TS5011 — the file is outside the included tree, so TS couldn't infer rootDir. Add scripts/tsconfig.json with an explicit rootDir of "..", and pass --project scripts/tsconfig.json from both call sites (the drift-guard test in feature-config.test.ts and setup-gcp.sh) so ts-node uses it. Verified: full test suite (511 tests, 28 suites) green.
1fae37f to
0026cd3
Compare
This was referenced May 1, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a "comment-specific fields" error in
docs.getTextand tightens thedocuments.getcalls in DocsService.Changes
'tabs'(or'title,tabs') to a specific selection —tabs(tabProperties,documentTab(body,headers,footers,footnotes))— so it doesn't trigger internal API conflicts when combined withincludeTabsContent: true. Applied at all threedocuments.getcall sites inDocsService.ts, extracted to a single exportedTABS_FIELD_MASKconstant.suggestionsViewMode: 'PREVIEW_WITHOUT_SUGGESTIONS'to thegetTextcall so unaccepted suggestion markup doesn't leak into the extracted plain text.drive.getCommentsinstead of the (non-existent)docs.getComments.Tests
replaceTexttests updated to reference the newTABS_FIELD_MASKconstant.getTexttest pinning the refineddocuments.getargs (field mask +suggestionsViewMode) so future regressions are caught at PR time rather than only via API errors against real Docs.Drive-by: unbreak
print-scopes.tsunder TS 6Rolled in here because it's blocking CI on
mainitself after #344 (TS 6 bump) and #347 (drift-guard test) landed in the same window:rootDir. ts-node compilingscripts/print-scopes.tsagainst the root tsconfig (which only includesworkspace-server/src/) failed with TS5011 — the file is outside the included tree, so TS couldn't infer rootDir.scripts/tsconfig.jsonwith explicitrootDir: "..", and pass--project scripts/tsconfig.jsonfrom both call sites (the drift-guard test andsetup-gcp.sh).This unblocks
main's CI as a side effect of merging this PR.