Skip to content

fix(docs): resolve docs.getText API errors#349

Merged
allenhutchison merged 4 commits intomainfrom
adh/fix/docs-get-text-error
Apr 29, 2026
Merged

fix(docs): resolve docs.getText API errors#349
allenhutchison merged 4 commits intomainfrom
adh/fix/docs-get-text-error

Conversation

@allenhutchison
Copy link
Copy Markdown
Contributor

@allenhutchison allenhutchison commented Apr 29, 2026

This PR fixes a "comment-specific fields" error in docs.getText and tightens the documents.get calls in DocsService.

Changes

  1. Refine the tabs field mask from the broad '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 with includeTabsContent: true. Applied at all three documents.get call sites in DocsService.ts, extracted to a single exported TABS_FIELD_MASK constant.
  2. Add suggestionsViewMode: 'PREVIEW_WITHOUT_SUGGESTIONS' to the getText call so unaccepted suggestion markup doesn't leak into the extracted plain text.
  3. Update SKILL.md to point users at drive.getComments instead of the (non-existent) docs.getComments.

Tests

  • Existing replaceText tests updated to reference the new TABS_FIELD_MASK constant.
  • New assertion in the first getText test pinning the refined documents.get args (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.ts under TS 6

Rolled in here because it's blocking CI on main itself after #344 (TS 6 bump) and #347 (drift-guard test) landed in the same window:

  • 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.
  • Added a small scripts/tsconfig.json with explicit rootDir: "..", and pass --project scripts/tsconfig.json from both call sites (the drift-guard test and setup-gcp.sh).

This unblocks main's CI as a side effect of merging this PR.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

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.

Comment thread workspace-server/src/services/DocsService.ts Outdated
Comment thread workspace-server/src/services/DocsService.ts Outdated
allenhutchison and others added 4 commits April 29, 2026 11:30
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.
@allenhutchison allenhutchison force-pushed the adh/fix/docs-get-text-error branch from 1fae37f to 0026cd3 Compare April 29, 2026 18:39
Copy link
Copy Markdown
Contributor

@abhipatel12 abhipatel12 left a comment

Choose a reason for hiding this comment

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

LGTM!

@allenhutchison allenhutchison merged commit 29e99c8 into main Apr 29, 2026
14 checks passed
@allenhutchison allenhutchison deleted the adh/fix/docs-get-text-error branch April 29, 2026 23:42
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.

2 participants