mcp-gee-sweet 0.9.2.dev323__tar.gz → 0.9.2.dev325__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (260) hide show
  1. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/PKG-INFO +1 -1
  2. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/known-limitations.md +28 -0
  3. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/drive_transfer.md +128 -5
  4. mcp_gee_sweet-0.9.2.dev325/src/mcp_gee_sweet/tools/atomic_write.py +152 -0
  5. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/drive/transfer.py +217 -100
  6. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/drive/test_transfer.py +437 -2
  7. mcp_gee_sweet-0.9.2.dev325/tests/test_atomic_write.py +278 -0
  8. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/uv.lock +9 -9
  9. mcp_gee_sweet-0.9.2.dev323/src/mcp_gee_sweet/tools/atomic_write.py +0 -70
  10. mcp_gee_sweet-0.9.2.dev323/tests/test_atomic_write.py +0 -118
  11. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/cleanup-worktrees.md +0 -0
  12. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/merge-pr.md +0 -0
  13. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/notify-kai.md +0 -0
  14. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/notify-partner.md +0 -0
  15. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/orchestrator.md +0 -0
  16. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/prep-for-pr.md +0 -0
  17. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/qa-kickoff.md +0 -0
  18. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/release.md +0 -0
  19. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/retro.md +0 -0
  20. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/roadmap-status.md +0 -0
  21. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/start-worktree.md +0 -0
  22. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/team-member.md +0 -0
  23. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/commands/verify-pr.md +0 -0
  24. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/settings.json +0 -0
  25. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/team-roles/amy.md +0 -0
  26. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/team-roles/aziz.md +0 -0
  27. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/team-roles/bob.md +0 -0
  28. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/team-roles/dev.md +0 -0
  29. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/team-roles/joy.md +0 -0
  30. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/team-roles/kai.md +0 -0
  31. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.claude/team-roles/qa.md +0 -0
  32. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.dockerignore +0 -0
  33. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  34. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  35. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  36. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.github/dependabot.yml +0 -0
  37. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.github/workflows/ci.yml +0 -0
  38. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.github/workflows/docs.yml +0 -0
  39. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.github/workflows/publish-dev.yml +0 -0
  40. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.github/workflows/release.yml +0 -0
  41. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.gitignore +0 -0
  42. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.pre-commit-config.yaml +0 -0
  43. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/.python-version +0 -0
  44. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/CHANGELOG.md +0 -0
  45. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/CLAUDE.md +0 -0
  46. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/CODE_OF_CONDUCT.md +0 -0
  47. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/CONTRIBUTING.md +0 -0
  48. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/Dockerfile +0 -0
  49. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/LICENSE +0 -0
  50. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/Makefile +0 -0
  51. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/README.md +0 -0
  52. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/SECURITY.md +0 -0
  53. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docker-compose.yml +0 -0
  54. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/assets/logo.png +0 -0
  55. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/auth.md +0 -0
  56. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/client-setup.md +0 -0
  57. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/configuration.md +0 -0
  58. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-async-tool-execution.md +0 -0
  59. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-auth-status-limitation-categories.md +0 -0
  60. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-cache-invalidation.md +0 -0
  61. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-chart-theming.md +0 -0
  62. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-comments-first-class.md +0 -0
  63. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-composite-tools.md +0 -0
  64. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-condition-type-docstring-generation.md +0 -0
  65. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-converted-doc-change-detection.md +0 -0
  66. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-dev-team.md +0 -0
  67. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-docs-formatting.md +0 -0
  68. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-fork.md +0 -0
  69. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-gmail-domain.md +0 -0
  70. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-grid-data-size-cap.md +0 -0
  71. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-local-fs-test-harness.md +0 -0
  72. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-mcp-v2-resource-context-access.md +0 -0
  73. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-pillow-image-dependency.md +0 -0
  74. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-prompt-qa-role.md +0 -0
  75. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-publishing.md +0 -0
  76. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-release-docs-roles.md +0 -0
  77. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-repositioning.md +0 -0
  78. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-response-size-cap-generalization.md +0 -0
  79. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-response-size-cap-reevaluation-519.md +0 -0
  80. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-review-finding-ticket-bar.md +0 -0
  81. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-supports-all-drives-lint-check.md +0 -0
  82. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-sync-folder-recursion.md +0 -0
  83. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-testing.md +0 -0
  84. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/decision-tool-error-visibility.md +0 -0
  85. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/index.md +0 -0
  86. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/decisions/role-file-history.md +0 -0
  87. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/blockquote-representation.md +0 -0
  88. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/borderless-table-columns.md +0 -0
  89. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/doc-revision-export.md +0 -0
  90. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/doc-to-markdown.md +0 -0
  91. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/docs-ast-pipeline.md +0 -0
  92. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/effectiveformat-spike.md +0 -0
  93. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/heading-anchor-resolution.md +0 -0
  94. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/image-conversion.md +0 -0
  95. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/index.md +0 -0
  96. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/local-file-access-policy.md +0 -0
  97. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/markdown-support.md +0 -0
  98. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/module-history.md +0 -0
  99. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/oauth-reauthorize-from-tool-call.md +0 -0
  100. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/phase3-theme-system.md +0 -0
  101. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design/sse-consent-off-event-loop.md +0 -0
  102. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/design.md +0 -0
  103. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/index.md +0 -0
  104. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/notes-read.md +0 -0
  105. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/README.md +0 -0
  106. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/qa-fixture-pixel.png +0 -0
  107. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-d195-create-doc.md +0 -0
  108. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-d196-create-doc.html +0 -0
  109. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-d213-dollar-escape.md +0 -0
  110. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-d226-heading-table.md +0 -0
  111. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc102-image-conversion.html +0 -0
  112. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc103-image-conversion.md +0 -0
  113. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc104-nested-lists.html +0 -0
  114. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc105-nested-lists-gfm.md +0 -0
  115. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc106-nested-lists-4space.md +0 -0
  116. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc135-paragraph-boundary.md +0 -0
  117. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc136-interrupted-block-boundary.md +0 -0
  118. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc137-inline-hr-no-block-ancestor.html +0 -0
  119. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc138-nbsp-spacer-paragraph.md +0 -0
  120. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc141-mismatched-list-tags.html +0 -0
  121. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc142-heading-anchors.md +0 -0
  122. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc144-anchor-in-table-cell.md +0 -0
  123. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures/tc-doc145-anchor-on-first-element.md +0 -0
  124. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/fixtures.template.md +0 -0
  125. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/gmail-test-plan.md +0 -0
  126. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/operations.yaml +0 -0
  127. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/playwright_oauth.md +0 -0
  128. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/.gitkeep +0 -0
  129. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-06-02.md +0 -0
  130. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-06-14.md +0 -0
  131. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-06-17.md +0 -0
  132. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-06-18.md +0 -0
  133. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-06-21-drive-discovery.md +0 -0
  134. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-06-21-sheets-delete-clear.md +0 -0
  135. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-06-28.md +0 -0
  136. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-07-04-docs.md +0 -0
  137. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-07-04-drive-smoke.md +0 -0
  138. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-07-04-infra.md +0 -0
  139. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-07-04-sheets_read.md +0 -0
  140. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-07-04.md +0 -0
  141. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/results/2026-09-04.md +0 -0
  142. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/retro-v0.8.0.md +0 -0
  143. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/retro-v0.9.0.md +0 -0
  144. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/run.md +0 -0
  145. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/runs/README.md +0 -0
  146. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/runs/v0.8.0.md +0 -0
  147. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/runs/v0.8.1.md +0 -0
  148. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/runs/v0.9.0.md +0 -0
  149. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/setup.md +0 -0
  150. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/calendar.md +0 -0
  151. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/docs_content.md +0 -0
  152. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/docs_layout.md +0 -0
  153. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/docs_style.md +0 -0
  154. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/docs_tables.md +0 -0
  155. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/drive_activity.md +0 -0
  156. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/drive_files.md +0 -0
  157. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/drive_sharing.md +0 -0
  158. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/gmail.md +0 -0
  159. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/infra.md +0 -0
  160. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/sheets_charts.md +0 -0
  161. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/sheets_mgmt.md +0 -0
  162. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/sheets_read.md +0 -0
  163. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/qa/tests/sheets_write.md +0 -0
  164. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/roadmap.md +0 -0
  165. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/style-guide.md +0 -0
  166. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/docs/tools.md +0 -0
  167. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/mkdocs.yml +0 -0
  168. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/pyproject.toml +0 -0
  169. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/pyrightconfig.json +0 -0
  170. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/scripts/check_supports_all_drives.py +0 -0
  171. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/scripts/gen_tool_docs.py +0 -0
  172. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/scripts/lane_context_hook.py +0 -0
  173. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/scripts/oauth_setup.py +0 -0
  174. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/scripts/qa_cancel_insert_local_images.py +0 -0
  175. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/scripts/qa_gmail_fixtures.py +0 -0
  176. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/scripts/setup_team.sh +0 -0
  177. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/scripts/write_team_mcp_configs.sh +0 -0
  178. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/server.json +0 -0
  179. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/.env.template +0 -0
  180. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/__init__.py +0 -0
  181. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/auth.py +0 -0
  182. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/cache.py +0 -0
  183. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/http_transport.py +0 -0
  184. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/reauth.py +0 -0
  185. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/server.py +0 -0
  186. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/sse_shutdown.py +0 -0
  187. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/__init__.py +0 -0
  188. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/cache.py +0 -0
  189. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/calendar.py +0 -0
  190. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/concurrency.py +0 -0
  191. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/__init__.py +0 -0
  192. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/anchors.py +0 -0
  193. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/ast.py +0 -0
  194. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/ast_to_markdown.py +0 -0
  195. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/comments.py +0 -0
  196. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/content.py +0 -0
  197. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/doc_to_ast.py +0 -0
  198. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/editing.py +0 -0
  199. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/emitter.py +0 -0
  200. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/html_parser.py +0 -0
  201. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/images.py +0 -0
  202. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/indices.py +0 -0
  203. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/layout.py +0 -0
  204. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/markdown_export.py +0 -0
  205. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/named_ranges.py +0 -0
  206. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/style.py +0 -0
  207. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/docs/tables.py +0 -0
  208. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/drive/__init__.py +0 -0
  209. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/drive/activity.py +0 -0
  210. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/drive/files.py +0 -0
  211. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/drive/sharing.py +0 -0
  212. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/gmail.py +0 -0
  213. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/pagination.py +0 -0
  214. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/response_limits.py +0 -0
  215. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/sheets/__init__.py +0 -0
  216. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/sheets/data.py +0 -0
  217. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/sheets/helpers.py +0 -0
  218. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/src/mcp_gee_sweet/tools/sheets/structure.py +0 -0
  219. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/__init__.py +0 -0
  220. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/conftest.py +0 -0
  221. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/drive/__init__.py +0 -0
  222. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/drive/test_activity.py +0 -0
  223. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/drive/test_files.py +0 -0
  224. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/drive/test_sharing.py +0 -0
  225. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/fakes.py +0 -0
  226. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/integration/__init__.py +0 -0
  227. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/integration/conftest.py +0 -0
  228. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/integration/test_local_fs_harness.py +0 -0
  229. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/sheets/__init__.py +0 -0
  230. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/sheets/test_data.py +0 -0
  231. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/sheets/test_helpers.py +0 -0
  232. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/sheets/test_structure.py +0 -0
  233. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_auth.py +0 -0
  234. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_cache.py +0 -0
  235. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_calendar.py +0 -0
  236. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_check_supports_all_drives.py +0 -0
  237. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_concurrency.py +0 -0
  238. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_anchors.py +0 -0
  239. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_comments.py +0 -0
  240. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_content.py +0 -0
  241. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_core.py +0 -0
  242. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_editing.py +0 -0
  243. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_images.py +0 -0
  244. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_indices.py +0 -0
  245. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_layout.py +0 -0
  246. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_markdown_export.py +0 -0
  247. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_named_ranges.py +0 -0
  248. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_revision_export.py +0 -0
  249. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_style.py +0 -0
  250. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_docs_tables.py +0 -0
  251. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_gen_tool_docs.py +0 -0
  252. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_gmail.py +0 -0
  253. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_lane_context_hook.py +0 -0
  254. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_qa_gmail_fixtures.py +0 -0
  255. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_reauth.py +0 -0
  256. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_response_limits.py +0 -0
  257. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_server.py +0 -0
  258. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_server_json.py +0 -0
  259. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_sse_shutdown.py +0 -0
  260. {mcp_gee_sweet-0.9.2.dev323 → mcp_gee_sweet-0.9.2.dev325}/tests/test_team_mcp_configs.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: mcp-gee-sweet
3
- Version: 0.9.2.dev323
3
+ Version: 0.9.2.dev325
4
4
  Summary: MCP server for Google Workspace — Sheets, Drive, Docs (HTML or Markdown), and Calendar.
5
5
  Project-URL: Homepage, https://github.com/khuisman/mcp-gee-sweet
6
6
  Project-URL: Bug Tracker, https://github.com/khuisman/mcp-gee-sweet/issues
@@ -238,3 +238,31 @@ refused everywhere, which means the same names are refused as path separators on
238
238
 
239
239
  **Workaround:** Rename the file or folder in Drive (or locally). For a single file,
240
240
  `download_file` with a full file path as `local_path` downloads it under that name.
241
+
242
+ ### Downloads replace the local file rather than rewriting it
243
+
244
+ **What:** `download_file`, `download_folder`, and `sync_folder` write a download to a temporary
245
+ `.gee-sweet-partial-*` file next to the destination, then rename it over the old file. The
246
+ replacement is a new file, so:
247
+
248
+ - It keeps the old file's permission bits, and its owner and group only when the server may set
249
+ them (running as root, as the Docker image does). Running as a regular user, a file owned by
250
+ someone else becomes owned by the server's user; its group is kept if the server's user
251
+ belongs to that group. ACLs, extended attributes (macOS Finder tags,
252
+ the quarantine flag), and the creation time aren't carried over.
253
+ - Another hard link to the old file keeps the old content.
254
+ - The server needs write permission on the destination's *folder*, not just on the file. A
255
+ writable file inside a read-only folder can't be downloaded over.
256
+ - A FIFO or socket at the destination is refused instead of written to. A device such as
257
+ `/dev/null` is still written directly.
258
+
259
+ A download the server is killed partway through leaves its `.gee-sweet-partial-*` file behind.
260
+ `sync_folder` and `upload_local_folder` never upload one and list it under `skipped`; they
261
+ don't delete it, since it may belong to a download that's still running.
262
+
263
+ **Why:** Writing into the existing file left a truncated file behind when a download failed
264
+ partway, with a fresh mtime that made `sync_folder` upload it over the intact Drive copy (#844).
265
+ A rename means the destination only ever holds the old content or the complete new content.
266
+
267
+ **Workaround:** Re-apply ACLs, tags, or ownership after downloading, if they matter. Delete a
268
+ leftover `.gee-sweet-partial-*` file once no download into that folder is running.
@@ -656,7 +656,7 @@ Unit tests: `tests/drive/test_transfer.py -k TestDownloadFile` — 10 passed (in
656
656
  > `download_file(file_id="qa-bogus-file-id", local_path="/tmp/qa-d277/dangling/")`
657
657
 
658
658
  **Checks**
659
- - Raises `ValueError` `local_path '/tmp/qa-d277/dangling/' has a non-directory path component at '/tmp/qa-d277/dangling'`, with no Drive 404.
659
+ - Raises `ValueError` `local_path '/tmp/qa-d277/dangling/' has a symlink to a missing target at '/tmp/qa-d277/dangling'`, with no Drive 404. (Before #895 the message said `non-directory path component`.)
660
660
  - The symlink is unchanged, and `/tmp/qa-d277/missing-target` was **not** created.
661
661
 
662
662
  **Teardown**
@@ -664,6 +664,57 @@ Unit tests: `tests/drive/test_transfer.py -k TestDownloadFile` — 10 passed (in
664
664
 
665
665
  **Result (2026-10-03) ✅ PASS** — via an isolated service-account sandbox (PR #855). Raised `ValueError` `local_path '…/dangling/' has a non-directory path component at '…/dangling'`, with no 404. The symlink was intact and `missing-target` did not exist afterwards.
666
666
 
667
+ **Result (2026-10-11) ✅ PASS** — Sky, PR #1001 round 1 (`499aa59`), OAuth. Raised `ValueError` `local_path '/tmp/qa-d277/dangling/' has a symlink to a missing target at '/tmp/qa-d277/dangling'`, with no 404. The symlink was intact and `missing-target` did not exist.
668
+
669
+ ---
670
+
671
+ ### TC-D284: Local destination checks for `download_file`, `download_folder`, and `sync_folder`: trailing `/.`, dangling symlinks, files in the path (issue #874, via #895) ⚠️ local-filesystem
672
+
673
+ **Background:** #855 added a local-path check to `download_file` that runs before any Drive request. #874 found gaps in it. `Path()` drops a trailing `/.`, so `newdir/.` wrote a *file* named `newdir`, and `report/.` overwrote an existing `report` file. A dangling symlink at a plain file destination was followed, which created its missing target. And when the cause was the trailing separator, the error didn't say so. `download_folder` and `sync_folder` ran a bare `mkdir -p` on `local_path` and leaked a raw `NotADirectoryError`/`FileExistsError`. `sync_folder` also missed a dangling symlink where a Drive subfolder was to be created. The race this check can lose (a file created at the path during the Drive metadata call) can't be timed through the tool surface; it's unit-tested in `TestDownloadFile::test_*_created_during_metadata_call_raises_valueerror`.
674
+
675
+ **Setup**
676
+ > 1. Call `create_folder(name="qa-284", parent_folder_id="{FOLDER_ID}")`; call the returned ID `{F}`. Call `create_folder(name="sub", parent_folder_id="{F}")`.
677
+ > 2. Run `rm -rf /tmp/qa-284 && mkdir -p /tmp/qa-284/sync && printf 'hello' > /tmp/qa-284/hello.txt && printf 'keep me' > /tmp/qa-284/report && printf x > /tmp/qa-284/clash && ln -s /tmp/qa-284/missing-a /tmp/qa-284/out.bin && ln -s /tmp/qa-284/missing-b /tmp/qa-284/dangling-dir && ln -s /tmp/qa-284/missing-c /tmp/qa-284/sync/sub`.
678
+ > 3. Call `upload_local_file(local_path="/tmp/qa-284/hello.txt", parent_folder_id="{F}")`; call the returned ID `{H}`.
679
+
680
+ **Steps**
681
+ > 1. `download_file(file_id="{H}", local_path="/tmp/qa-284/newdir/.")`, then `ls -la /tmp/qa-284/newdir/`.
682
+ > 2. `download_file(file_id="{H}", local_path="/tmp/qa-284/report/.")`, then `cat /tmp/qa-284/report`.
683
+ > 3. `download_file(file_id="{H}", local_path="/tmp/qa-284/report/")`.
684
+ > 4. `download_file(file_id="{H}", local_path="/tmp/qa-284/out.bin")`, then `ls -la /tmp/qa-284/`.
685
+ > 5. `download_folder(folder_id="{F}", local_path="/tmp/qa-284/clash/sub")`.
686
+ > 6. `download_folder(folder_id="{F}", local_path="/tmp/qa-284/dangling-dir")`.
687
+ > 7. `sync_folder(folder_id="{F}", local_path="/tmp/qa-284/clash/sub", direction="download")`.
688
+ > 8. `sync_folder(folder_id="{F}", local_path="/tmp/qa-284/sync", direction="download", recursive=true)`, then `ls -la /tmp/qa-284/ /tmp/qa-284/sync/`.
689
+ > 9. (PR #1001 QA round 1) Repeat step 8 with `dry_run=true`.
690
+
691
+ **Checks**
692
+ - Step 1: succeeds. `local_path` is `/tmp/qa-284/newdir/hello.txt`; `newdir` is a directory holding `hello.txt`.
693
+ - Step 2: raises `ValueError` `local_path '/tmp/qa-284/report/.' has a non-directory path component at '/tmp/qa-284/report'; local_path ends in a path separator or '.', which makes it a directory target. Remove that ending to write a file at that path instead`. `report` still reads `keep me`.
694
+ - Step 3: the same `ValueError` and hint as step 2, for `'/tmp/qa-284/report/'`.
695
+ - Step 4: raises `ValueError` `local_path '/tmp/qa-284/out.bin' has a symlink to a missing target at '/tmp/qa-284/out.bin'`. `out.bin` is still a symlink and `/tmp/qa-284/missing-a` doesn't exist.
696
+ - Step 5: raises `ValueError` `local_path '/tmp/qa-284/clash/sub' has a non-directory path component at '/tmp/qa-284/clash'`. No `NotADirectoryError`. `clash` still contains `x`.
697
+ - Step 6: raises `ValueError` `local_path '/tmp/qa-284/dangling-dir' has a symlink to a missing target at '/tmp/qa-284/dangling-dir'`. `missing-b` doesn't exist.
698
+ - Step 7: the same `ValueError` as step 5, with `local_path '/tmp/qa-284/clash/sub'`. No `NotADirectoryError`.
699
+ - Step 8: returns normally (no `FileExistsError`). `downloaded` is `["hello.txt"]`, and `failed` is `[{"name": "sub/", "error": "cannot create local folder 'sub': a symlink to a missing target already exists at this path"}]`. `sync/sub` is still a symlink and `missing-c` doesn't exist.
700
+ - Step 9: `failed` is empty. `actions` holds `hello.txt` as `skip` (`in sync`) and `{"name": "sub/", "action": "conflict", "reason": "cannot create local folder 'sub': a symlink to a missing target already exists at this path"}`.
701
+
702
+ **Teardown**
703
+ `delete_file` on `{F}`. `rm -rf /tmp/qa-284`.
704
+
705
+ **Result (2026-10-11) ✅ PASS** — Sky, PR #1001 round 1 (`499aa59`), OAuth, throwaway `qa-284` folder under `TEST_FOLDER_ID`.
706
+ - **Step 1:** `local_path` `/tmp/qa-284/newdir/hello.txt`, 5 B; `newdir` is a directory holding `hello.txt`.
707
+ - **Steps 2–3:** both raised the expected `ValueError` with the trailing-ending hint; `report` still reads `keep me`.
708
+ - **Step 4:** `has a symlink to a missing target at '/tmp/qa-284/out.bin'`; link intact, `missing-a` absent.
709
+ - **Steps 5, 7:** `has a non-directory path component at '/tmp/qa-284/clash'`, no `NotADirectoryError`; `clash` still holds `x`.
710
+ - **Step 6:** `has a symlink to a missing target at '/tmp/qa-284/dangling-dir'`; `missing-b` absent.
711
+ - **Step 8:** `downloaded: ["hello.txt"]`, `failed` exactly the expected `sub/` entry; `sync/sub` still a dangling symlink, `missing-c` absent.
712
+
713
+ The case passes. Extra probe: the same step-8 call with `dry_run=true` listed only `hello.txt: download` and nothing for `sub/`, so the preview doesn't show the failure the real run reports (sent back on the PR).
714
+
715
+ **Result (2026-10-11) ✅ PASS** — Sky, PR #1001 round 2 (`a0955ce`), OAuth, after reconnecting to the fix. Fresh `qa-284` folder and fixtures; steps 1–8 gave the same results as round 1.
716
+ - **Step 9:** `failed` empty; `actions`: `hello.txt` `skip` (`in sync`), and `sub/` `conflict` with `cannot create local folder 'sub': a symlink to a missing target already exists at this path`.
717
+
667
718
  ---
668
719
 
669
720
  ## `download_folder`
@@ -1791,7 +1842,7 @@ Unit tests: full suite 1883 passed / 3 skipped; ruff clean. Fast-path re-verific
1791
1842
 
1792
1843
  ### TC-D279: downloads write to a temp file and rename it into place; a leftover temp file is never uploaded (issue #844) ⚠️ local-filesystem ⚠️ destructive
1793
1844
 
1794
- **Background:** `sync_folder`, `download_file`, and `download_folder` used to stream straight into the destination. A download that failed partway left a truncated file with a current mtime, so the next bidirectional sync read it as locally newer and uploaded it over the intact Drive copy. Every download now goes through `_write_atomically`: it writes a sibling `.gee-sweet-partial-<16 hex>` file, stamps `sync_folder`'s Drive mtime on it, and renames it onto the destination only when complete. A temp file survives only a hard kill mid-write, and `sync_folder` and `upload_local_folder` skip one. The failure path itself (a dropped connection mid-download) can't be triggered through the tool surface; it's unit-tested in `tests/drive/test_transfer.py::TestSyncFolderFailedDownloadLeavesNoPartial`, `TestDownloadToolsFailedDownloadLeavesNoPartial`, and `TestWriteAtomically`. This case checks the success path through the new write, the mode and mtime it leaves, and the leftover-temp-file skip.
1845
+ **Background:** `sync_folder`, `download_file`, and `download_folder` used to stream straight into the destination. A download that failed partway left a truncated file with a current mtime, so the next bidirectional sync read it as locally newer and uploaded it over the intact Drive copy. Every download now goes through `_write_atomically`: it writes a sibling `.gee-sweet-partial-<16 hex>` file, stamps `sync_folder`'s Drive mtime on it, and renames it onto the destination only when complete. A temp file survives only a hard kill mid-write, and `sync_folder` and `upload_local_folder` never upload one. Since #895 they list it under `skipped`; before that it appeared in no result list. The failure path itself (a dropped connection mid-download) can't be triggered through the tool surface; it's unit-tested in `tests/drive/test_transfer.py::TestSyncFolderFailedDownloadLeavesNoPartial`, `TestDownloadToolsFailedDownloadLeavesNoPartial`, and `TestWriteAtomically`. This case checks the success path through the new write, the mode and mtime it leaves, and the leftover-temp-file skip.
1795
1846
 
1796
1847
  **Setup**
1797
1848
  > 1. Call `create_folder(name="qa-279", parent_folder_id="{FOLDER_ID}")`; call the returned ID `{F}`.
@@ -1810,11 +1861,11 @@ Unit tests: full suite 1883 passed / 3 skipped; ruff clean. Fast-path re-verific
1810
1861
  > 8. Make a read-only local copy: `printf 'protected' > /tmp/qa-279/ro.bin && chmod 444 /tmp/qa-279/ro.bin && chmod 4644 /tmp/qa-279/dl/big.bin`. Call `download_file(file_id="{BIG}", local_path="/tmp/qa-279/ro.bin")`. Then call `download_file(file_id="{BIG}", local_path="/tmp/qa-279/dl/big.bin")` and run `ls -la /tmp/qa-279/ /tmp/qa-279/dl/ && cat /tmp/qa-279/ro.bin`. (Not as root: root can write a `0444` file.)
1811
1862
 
1812
1863
  **Checks**
1813
- - Step 1: `downloaded` is `["big.bin"]`. `uploaded` is empty, and `.gee-sweet-partial-0123456789abcdef` appears in no result list. `failed` is empty.
1864
+ - Step 1: `downloaded` is `["big.bin"]`. `uploaded` is empty, `skipped` is `[".gee-sweet-partial-0123456789abcdef"]` (#895), and `failed` is empty.
1814
1865
  - Step 2: `big.bin` is 3000000 bytes, its md5 matches setup step 3's `md5_checksum`, its mode is still `-rw-r-----` (the replaced file's mode is kept), and its mtime matches setup step 3's `modified_time` to the second (local time vs UTC aside). The only `.gee-sweet-partial-*` file in the directory is the planted `…0123456789abcdef`; no new one was left behind.
1815
1866
  - Step 3: `{F}` holds exactly one file, `big.bin`. No `.gee-sweet-partial-*` file was uploaded.
1816
- - Step 4: `big.bin` in `skipped`; `uploaded` and `downloaded` empty (the restamped mtime round-trips, as in #346).
1817
- - Step 5: `uploaded` lists only `big.bin` (a second copy, since `skip_if_exists=false`); the planted temp file is not uploaded and not in `failed`. `list_files` shows two `big.bin` and no `.gee-sweet-partial-*`.
1867
+ - Step 4: `skipped` is `[".gee-sweet-partial-0123456789abcdef", "big.bin"]`; `uploaded` and `downloaded` empty (the restamped mtime round-trips, as in #346).
1868
+ - Step 5: `uploaded` lists only `big.bin` (a second copy, since `skip_if_exists=false`); the planted temp file is not uploaded, is not in `failed`, and is listed in `skipped` (#895). `list_files` shows two `big.bin` and no `.gee-sweet-partial-*`.
1818
1869
  - Step 6: succeeds with `size_bytes` 3000000. The directory still holds only `big.bin` and the planted temp file.
1819
1870
  - Step 7: `downloaded` is `["big.bin"]` and `failed` has one duplicate-filename entry for the second `big.bin` (PR #351). `/tmp/qa-279/dl/` holds only `big.bin`, 3000000 bytes, and no `.gee-sweet-partial-*` file.
1820
1871
  - Step 8 (PR #884 QA round 1): the first `download_file` fails with a permission error. `ro.bin` still reads `protected`, still `-r--r--r--`, and no `.gee-sweet-partial-*` file is in `/tmp/qa-279/`. The second call succeeds, and `dl/big.bin` is `-rw-r--r--`: the setuid bit is not carried onto the new content.
@@ -1837,6 +1888,78 @@ The case passes, but the PR goes back for a regression this case doesn't cover:
1837
1888
  - **Step 8, `ro.bin`:** `download_file` failed with `[Errno 13] Permission denied: '/tmp/qa-279/ro.bin'`. `ro.bin` still reads `protected`, still `-r--r--r--`, and there's no `.gee-sweet-partial-*` in `/tmp/qa-279/`.
1838
1889
  - **Step 8, `dl/big.bin` (`chmod 4644` first):** succeeded, `size_bytes` 3000000, and the file is now `-rw-r--r--`: setuid dropped.
1839
1890
 
1891
+ **Result (2026-10-11) ✅ PASS** — Sky, PR #1001 round 1 (`499aa59`), OAuth, throwaway `qa-279` folder under `TEST_FOLDER_ID`. Drive `big.bin`: 3000000 B, `modified_time` `03:54:22Z`.
1892
+ - **Step 1:** `downloaded: ["big.bin"]`, `skipped: [".gee-sweet-partial-0123456789abcdef"]`; `uploaded`, `failed` empty.
1893
+ - **Step 2:** 3000000 B, md5 matches, mode `-rw-r-----` kept, mtime `20:54:22-0700` (= `03:54:22Z`). Only the planted temp file present.
1894
+ - **Step 3:** one file, `big.bin`.
1895
+ - **Step 4:** `skipped: [".gee-sweet-partial-0123456789abcdef", "big.bin"]`, nothing transferred.
1896
+ - **Step 5:** `uploaded: ["big.bin"]`, `skipped: [".gee-sweet-partial-0123456789abcdef"]`, `failed` empty; `list_files` shows two `big.bin`, no temp file.
1897
+ - **Step 6:** `size_bytes` 3000000; directory still holds only `big.bin` and the planted temp file.
1898
+ - **Step 7:** `downloaded: ["big.bin"]`, one duplicate-filename `failed` entry; `dl/` holds only `big.bin`, 3000000 B.
1899
+ - **Step 8:** `ro.bin` refused with `[Errno 13] Permission denied`, still `protected` and `-r--r--r--`, no temp file; `dl/big.bin` succeeded and is `-rw-r--r--` (setuid dropped).
1900
+
1901
+ ---
1902
+
1903
+ ### TC-D285: Temp-file names on Drive, device and FIFO destinations, and a kept owner group (issue #887, via #895) ⚠️ local-filesystem ⚠️ destructive
1904
+
1905
+ **Background:** #887 lists follow-ups to the temp-file-and-rename download from #844 (TC-D279). Only the local side filtered the temp name, so a Drive file named `.gee-sweet-partial-<16 hex>` downloaded, became invisible locally, and downloaded again on every sync. Such a name is now refused as a local filename, like `..`. The rename also broke non-regular destinations. `/dev/null` failed, since a temp file can't be created in `/dev`. A FIFO was replaced by a regular file. Now a device is written directly, as the old `open("wb")` did, and a FIFO is refused without blocking. The replacement file now also takes the replaced file's group when the process may set it. A directory at a file's destination is refused before the download starts (PR #1001 QA round 1). The fsync, the fd-leak fix, owner changes (root only), and the group-only fallback for a file another user owns aren't observable through the tool surface; they're unit-tested in `tests/test_atomic_write.py`.
1906
+
1907
+ **Setup**
1908
+ > 1. Call `create_folder(name="qa-285", parent_folder_id="{FOLDER_ID}")`; call the returned ID `{F}`.
1909
+ > 2. Run `rm -rf /tmp/qa-285 && mkdir -p /tmp/qa-285/src /tmp/qa-285/sync /tmp/qa-285/dl && printf 'payload' > /tmp/qa-285/src/.gee-sweet-partial-0123456789abcdef && printf 'hello' > /tmp/qa-285/src/hello.txt && mkfifo /tmp/qa-285/pipe && ln -s /dev/null /tmp/qa-285/null-link`.
1910
+ > 3. Call `upload_local_file(local_path="/tmp/qa-285/src/.gee-sweet-partial-0123456789abcdef", parent_folder_id="{F}")` and `upload_local_file(local_path="/tmp/qa-285/src/hello.txt", parent_folder_id="{F}")`; call the second ID `{H}`.
1911
+ > 4. Run `printf x > /tmp/qa-285/ref && ls -l /tmp/qa-285/ref` to see the group a new file in that folder gets. Pick a different group you belong to (`id -Gn`), call it `{G}`, and run `printf old > /tmp/qa-285/owned.txt && chgrp {G} /tmp/qa-285/owned.txt && ls -l /tmp/qa-285/owned.txt`.
1912
+
1913
+ **Steps**
1914
+ > 1. `sync_folder(folder_id="{F}", local_path="/tmp/qa-285/sync", direction="download")`, then `ls -la /tmp/qa-285/sync/`.
1915
+ > 2. `sync_folder(folder_id="{F}", local_path="/tmp/qa-285/sync", direction="download", dry_run=true)`.
1916
+ > 3. `download_folder(folder_id="{F}", local_path="/tmp/qa-285/dl")`, then `ls -la /tmp/qa-285/dl/`.
1917
+ > 4. `download_file(file_id="{H}", local_path="/dev/null")`.
1918
+ > 5. `download_file(file_id="{H}", local_path="/tmp/qa-285/null-link")`, then `ls -la /tmp/qa-285/`.
1919
+ > 6. `download_file(file_id="{H}", local_path="/tmp/qa-285/pipe")` (it must return promptly, not hang), then `ls -la /tmp/qa-285/`.
1920
+ > 7. `download_file(file_id="{H}", local_path="/tmp/qa-285/owned.txt")`, then `ls -l /tmp/qa-285/owned.txt && cat /tmp/qa-285/owned.txt`.
1921
+ > 8. (PR #1001 QA round 1) `sync_folder(folder_id="{F}", local_path="/tmp/qa-285/src", direction="upload", dry_run=true)`. The temp name exists on both sides here.
1922
+ > 9. (PR #1001 QA round 1) Run `mkdir -p /tmp/qa-285/dirsync/hello.txt`, then `sync_folder(folder_id="{F}", local_path="/tmp/qa-285/dirsync", direction="download")`, then `ls -la /tmp/qa-285/dirsync/`.
1923
+ > 10. (PR #1001 QA round 1) `create_folder(name=".gee-sweet-partial-0123456789abcdef", parent_folder_id="{F}")`; call the returned ID `{P}`. `upload_local_file(local_path="/tmp/qa-285/src/hello.txt", parent_folder_id="{P}")`. Then `sync_folder(folder_id="{F}", local_path="/tmp/qa-285/sync", direction="download", recursive=true, dry_run=true)`.
1924
+ > 11. (PR #1001 QA round 2) Run `mkdir -p /tmp/qa-285/probe && printf '# probe' > /tmp/qa-285/src/probe.md && mkfifo /tmp/qa-285/probe/probe.md.xlsx`. Call `upload_local_file(local_path="/tmp/qa-285/src/probe.md", parent_folder_id="{F}", convert=true)`; call the returned ID `{D}`. Then `download_file(file_id="{D}", local_path="/tmp/qa-285/probe/", export_format="xlsx")`. A Doc can't be exported as xlsx, so a Drive error here means the export ran before the destination check.
1925
+
1926
+ **Checks**
1927
+ - Step 1: `downloaded` is `["hello.txt"]`. `failed` has one entry, named `.gee-sweet-partial-0123456789abcdef`, whose error says the name is reserved for this server's temporary download files. `sync/` holds only `hello.txt`.
1928
+ - Step 2: `actions` has an `unsafe_name` entry for `.gee-sweet-partial-0123456789abcdef` (the same reason) and a `skip` for `hello.txt`.
1929
+ - Step 3: `downloaded` is `["hello.txt"]`, and `failed` has one entry for the temp-file name, saying it can't be used as a local filename. `dl/` holds only `hello.txt`.
1930
+ - Step 4: succeeds with `size_bytes` 0 (as `/dev/null` reports it). No `.gee-sweet-partial-*` error.
1931
+ - Step 5: succeeds the same way. `null-link` is still a symlink to `/dev/null`, and no `.gee-sweet-partial-*` file is in `/tmp/qa-285/`.
1932
+ - Step 6: fails promptly with an error saying the destination isn't a regular file. `pipe` is still a FIFO (`p` in `ls -la`), and no `.gee-sweet-partial-*` file is in `/tmp/qa-285/`.
1933
+ - Step 7: succeeds. `owned.txt` reads `hello` and its group is still `{G}`.
1934
+ - Step 8: `actions` has an `unsafe_name` entry for `.gee-sweet-partial-0123456789abcdef` with the reserved-name reason, not `skip` / `drive only, upload direction`.
1935
+ - Step 9: `downloaded` is empty. `failed` has an entry for `hello.txt` whose error says the destination is a directory and names `/tmp/qa-285/dirsync/hello.txt`, not a `.gee-sweet-partial-*` file, plus the reserved-name entry from step 1. `dirsync/hello.txt` is still an empty directory and no `.gee-sweet-partial-*` file is in `dirsync/`.
1936
+ - Step 10: `failed` is empty. `actions` still has the `unsafe_name` entry for the reserved-name *file*, and also `.gee-sweet-partial-0123456789abcdef/hello.txt` as `download`: a folder with the reserved name is synced like any other, with no `unsafe_name` entry for the folder.
1937
+ - Step 11: raises `[Errno 22] destination exists but isn't a regular file` naming `/tmp/qa-285/probe/probe.md.xlsx`, not Drive's `HttpError 400 … conversion is not supported`. `probe.md.xlsx` is still a FIFO.
1938
+
1939
+ **Teardown**
1940
+ `delete_file` on `{F}`. `rm -rf /tmp/qa-285`.
1941
+
1942
+ **Result (2026-10-11) ✅ PASS** — Sky, PR #1001 round 1 (`499aa59`), OAuth, macOS, throwaway `qa-285` folder under `TEST_FOLDER_ID`. New files in `/tmp/qa-285` get group `wheel`; `{G}` was `staff`.
1943
+ - **Step 1:** `downloaded: ["hello.txt"]`; `failed` one entry for `.gee-sweet-partial-0123456789abcdef`, `name is reserved for this server's temporary download files; not synced`. `sync/` holds only `hello.txt`.
1944
+ - **Step 2:** `actions`: `unsafe_name` for the temp name (same reason), `skip` (`in sync`) for `hello.txt`.
1945
+ - **Step 3:** `downloaded: ["hello.txt"]`; `failed` one entry, `… can't be used as a local filename: name is reserved …`. `dl/` holds only `hello.txt`.
1946
+ - **Steps 4–5:** both returned `size_bytes` 0; `null-link` still → `/dev/null`, no temp file.
1947
+ - **Step 6:** returned at once with `[Errno 22] destination exists but isn't a regular file`; `pipe` still `prw-r--r--`, no temp file.
1948
+ - **Step 7:** succeeded; `owned.txt` reads `hello`, group still `staff`.
1949
+
1950
+ The case passes. Extra probe: `sync_folder(local_path="/tmp/qa-285/src", direction="upload", dry_run=true)`, where the temp name exists on both sides, reported `skip` / `drive only, upload direction`, which is false, and never mentions the local leftover (sent back on the PR).
1951
+
1952
+ **Result (2026-10-11) ✅ PASS** — Sky, PR #1001 round 2 (`a0955ce`), OAuth, macOS, after reconnecting to the fix. Fresh `qa-285` folder and fixtures; steps 1–7 gave the same results as round 1 (`owned.txt` group still `staff`).
1953
+ - **Step 8:** `.gee-sweet-partial-0123456789abcdef` is `unsafe_name` with the reserved-name reason, no longer `skip` / `drive only`.
1954
+ - **Step 9:** `downloaded` empty; `failed` has the reserved-name entry and `hello.txt`: `[Errno 21] destination is a directory: '/tmp/qa-285/dirsync/hello.txt'`, with no temp-file name. `dirsync/hello.txt` is still an empty directory, and there's no temp file.
1955
+ - **Step 10:** `failed` empty; `actions` has `unsafe_name` for the reserved-name file and `.gee-sweet-partial-0123456789abcdef/hello.txt` as `download`, with no `unsafe_name` entry for the folder.
1956
+
1957
+ The case passes. Extra probe (sent back on the PR): a Doc exported with `download_file` to a *directory* target holding a FIFO at the export's filename isn't checked before the export. Explicit `local_path=".../explicit.xlsx"` (a FIFO) with `export_format="xlsx"` raised `EINVAL` with no Drive call. `local_path=".../probe/"` with `export_format="xlsx"` (FIFO at `probe/qa-probe.xlsx`) returned Drive's `HttpError 400 … conversion is not supported`, so the export ran first. With `export_format="txt"` (FIFO at `probe/qa-probe.txt`), the call raised `EINVAL`. It runs the same path, so the export had already been fetched by then.
1958
+
1959
+ **Result (2026-10-11) ✅ PASS** — Sky, PR #1001 round 3 (`8e5e87d`), OAuth, after reconnecting to the fix. Step 11 only (the fix touches only `download_file`'s directory-target branch); fresh `qa-285` folder.
1960
+ - **Step 11:** raised `[Errno 22] destination exists but isn't a regular file: '/tmp/qa-285/probe/probe.md.xlsx'`, not Drive's `HttpError 400`. `probe.md.xlsx` is still a FIFO.
1961
+ - Extra: the same call with `export_format="txt"` (FIFO at `probe/probe.md.txt`) raised the same `EINVAL`. With no blocker, `download_file(local_path="/tmp/qa-285/ok/", export_format="txt")` still wrote `ok/probe.md.txt` (8 B, `probe`).
1962
+
1840
1963
  ---
1841
1964
 
1842
1965
  ## `list_revisions`
@@ -0,0 +1,152 @@
1
+ """Atomic local-file writes, shared by every Drive download (drive/transfer.py)
2
+ and the response-cap local_path dump (response_limits.py). Lives at the tools/
3
+ level so both can import it: transfer.py already imports response_limits."""
4
+
5
+ import contextlib
6
+ import errno
7
+ import os
8
+ import re
9
+ import secrets
10
+ import stat
11
+ from collections.abc import Callable
12
+ from pathlib import Path
13
+ from typing import BinaryIO
14
+
15
+ # Every download, and every response-cap local_path write (#958), writes to a
16
+ # sibling temp file with this name and renames it onto the destination only once
17
+ # complete (_write_atomically, #844). A temp file only outlives its write when
18
+ # the process is killed mid-write; sync_folder and upload_local_folder never
19
+ # upload one and list it under 'skipped', and a Drive file with such a name is
20
+ # refused as a local filename (#887). No part of the destination's name is embedded, so the temp name
21
+ # can't exceed the filesystem's name-length limit.
22
+ _PARTIAL_DOWNLOAD_PREFIX = ".gee-sweet-partial-"
23
+ _PARTIAL_DOWNLOAD_RE = re.compile(r"\.gee-sweet-partial-[0-9a-f]{16}")
24
+
25
+
26
+ def _is_partial_download(name: str) -> bool:
27
+ """Whether `name` is a temp file _write_atomically left behind."""
28
+ return _PARTIAL_DOWNLOAD_RE.fullmatch(name) is not None
29
+
30
+
31
+ def _write_atomically(
32
+ dest: Path, write: Callable[[BinaryIO], object], mtime: float | None = None
33
+ ) -> None:
34
+ """Run `write` against a sibling temp file, then rename it onto `dest`.
35
+
36
+ `dest` only ever holds its previous content or the complete new content.
37
+ Writing straight into `dest` left a truncated file behind when a download
38
+ failed partway, with a current mtime that made sync_folder treat it as the
39
+ newer copy and upload it over the intact Drive file (#844). `mtime`, when
40
+ given, is stamped on the temp file before the rename, so a failed restamp
41
+ also leaves `dest` untouched. The temp file is removed on any failure. It's
42
+ fsynced before the rename and the directory after it, so a power loss can't
43
+ leave `dest` empty or truncated either (#887).
44
+
45
+ A symlink at `dest` is written through, as the old `open("wb")` did: the
46
+ temp file goes next to the link's target and replaces the target. The new
47
+ file gets the mode a fresh `open("wb")` would (0o666 less the umask), or the
48
+ replaced file's permission bits when there was one (never its
49
+ setuid/setgid/sticky bits, which an in-place write would have cleared), and
50
+ the replaced file's owner and group when this process may set them (root,
51
+ e.g. the Docker image writing into a bind mount). Nothing else on the old
52
+ inode carries over (ACLs, xattrs, creation time), and a hard link to it
53
+ keeps the old content; see docs/known-limitations.md.
54
+
55
+ A rename needs write permission on the directory, not the file, so an
56
+ existing file this process couldn't open for writing is refused up front
57
+ with the same PermissionError `open("wb")` raised; otherwise a file the
58
+ user made read-only would be silently replaced (PR #884 QA round 1).
59
+
60
+ A character or block device at `dest` (e.g. /dev/null) can't be renamed
61
+ over, so it's written directly, as `open("wb")` did, and `mtime` isn't
62
+ stamped on it. A directory, FIFO, or socket is refused (_check_destination)
63
+ before `write` runs, so a download isn't streamed only to fail at the
64
+ rename, and a FIFO is never replaced or blocked on (#887).
65
+ """
66
+ target = Path(os.path.realpath(dest)) if dest.is_symlink() else dest
67
+ target_st = _check_destination(target)
68
+ if target_st is not None and _is_device(target_st):
69
+ with open(target, "wb") as fh:
70
+ write(fh)
71
+ return
72
+ tmp = target.with_name(_PARTIAL_DOWNLOAD_PREFIX + secrets.token_hex(8))
73
+ fd = os.open(tmp, os.O_WRONLY | os.O_CREAT | os.O_EXCL | getattr(os, "O_BINARY", 0), 0o666)
74
+ try:
75
+ try:
76
+ fh = os.fdopen(fd, "wb")
77
+ except BaseException:
78
+ os.close(fd)
79
+ raise
80
+ with fh:
81
+ write(fh)
82
+ fh.flush()
83
+ os.fsync(fh.fileno())
84
+ if target_st is not None:
85
+ _copy_owner_and_mode(tmp, target_st)
86
+ if mtime is not None:
87
+ os.utime(tmp, (mtime, mtime))
88
+ os.replace(tmp, target)
89
+ except BaseException:
90
+ with contextlib.suppress(OSError):
91
+ os.unlink(tmp)
92
+ raise
93
+ _fsync_directory(target.parent)
94
+
95
+
96
+ def _is_device(st: os.stat_result) -> bool:
97
+ return stat.S_ISCHR(st.st_mode) or stat.S_ISBLK(st.st_mode)
98
+
99
+
100
+ def _check_destination(dest: Path) -> os.stat_result | None:
101
+ """Raise if _write_atomically can't write `dest`; else its stat, or None if absent.
102
+
103
+ Callers that fetch content before writing (a Workspace export) call this
104
+ first too, so a bad destination fails before the round trip. Raises
105
+ IsADirectoryError for a directory, OSError(EINVAL) for a FIFO or socket,
106
+ and PermissionError for a file this process can't open for writing (a
107
+ rename only needs directory permission, so without this a read-only file
108
+ would be silently replaced; PR #884 QA round 1). A symlink is followed.
109
+ """
110
+ try:
111
+ st = dest.stat()
112
+ except FileNotFoundError:
113
+ return None
114
+ if stat.S_ISDIR(st.st_mode):
115
+ raise IsADirectoryError(errno.EISDIR, "destination is a directory", str(dest))
116
+ if not stat.S_ISREG(st.st_mode) and not _is_device(st):
117
+ raise OSError(errno.EINVAL, "destination exists but isn't a regular file", str(dest))
118
+ if not os.access(dest, os.W_OK):
119
+ raise PermissionError(errno.EACCES, os.strerror(errno.EACCES), str(dest))
120
+ return st
121
+
122
+
123
+ def _copy_owner_and_mode(tmp: Path, old: os.stat_result) -> None:
124
+ """Give `tmp` the replaced file's owner, group, and permission bits.
125
+
126
+ Owner and group are best effort: only root can give a file away, and
127
+ anyone else can only pick a group they belong to. When the full chown is
128
+ refused, the group alone is still tried (PR #1001 QA round 1). chown runs
129
+ before chmod because it can clear bits that chmod then sets.
130
+ """
131
+ if hasattr(os, "chown"):
132
+ tmp_st = os.stat(tmp)
133
+ if (tmp_st.st_uid, tmp_st.st_gid) != (old.st_uid, old.st_gid):
134
+ try:
135
+ os.chown(tmp, old.st_uid, old.st_gid)
136
+ except OSError:
137
+ if tmp_st.st_gid != old.st_gid:
138
+ with contextlib.suppress(OSError):
139
+ os.chown(tmp, -1, old.st_gid)
140
+ os.chmod(tmp, old.st_mode & 0o777)
141
+
142
+
143
+ def _fsync_directory(directory: Path) -> None:
144
+ """Persist a rename inside `directory`. Best effort: Windows can't open a
145
+ directory, and some filesystems refuse to fsync one; the rename itself has
146
+ already happened either way."""
147
+ with contextlib.suppress(OSError):
148
+ dfd = os.open(directory, os.O_RDONLY)
149
+ try:
150
+ os.fsync(dfd)
151
+ finally:
152
+ os.close(dfd)