Skip to content

feat(sheets): add readAsRecords operation#57

Merged
AojdevStudio merged 3 commits intomainfrom
feature/gdrive-17-read-as-records
Mar 28, 2026
Merged

feat(sheets): add readAsRecords operation#57
AojdevStudio merged 3 commits intomainfrom
feature/gdrive-17-read-as-records

Conversation

@AojdevStudio
Copy link
Copy Markdown
Owner

@AojdevStudio AojdevStudio commented Mar 28, 2026

Summary

Implements sheets.readAsRecords — reads a Google Sheet range and returns data as an array of keyed objects using the first row as column headers. Foundational for mail-merge style outreach workflows.

Closes #50
Resolves GDRIVE-17

Changes

  • readAsRecords function in src/modules/sheets/read.ts
  • ReadAsRecordsResult type exported from module index (src/modules/sheets/index.ts)
  • SDK spec entry in src/sdk/spec.ts (sheets section)
  • SDK runtime registration in src/sdk/runtime.ts
  • 4 unit tests in src/modules/sheets/__tests__/readAsRecords.test.ts

Acceptance Criteria

  • AC-1: Returns an array of objects where keys are column headers from the first row and values are corresponding cell data
  • AC-2: Handles edge cases: empty sheet (no headers) throws descriptive error; sparse rows fill missing values with null
  • AC-3: SDK spec and runtime registration follow existing sheets operation pattern

Test Evidence

PASS src/modules/sheets/__tests__/readAsRecords.test.ts
  readAsRecords
    ✓ zips headers with rows into keyed objects
    ✓ returns empty records for header-only sheet
    ✓ maps sparse rows to null for missing values
    ✓ throws on empty sheet (no headers)

Test Suites: 50 passed, 50 total
Tests: 568 passed, 572 total (4 skipped)

TypeScript type-check: no errors.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added linear scale question type for enhanced form surveys.
  • Updates

    • Simplified form question API: parameters now use flat structure instead of nested objects.
    • Updated response structure for question addition operations.
  • Chores

    • Configured version control to exclude Obsidian vault files.
    • Updated documentation with integration configuration details.

… type names

Bug 1: Spec advertised nested { formId, question: { title, type } } but handler
expects flat { formId, title, type, required, ... }. Fixed spec to match handler.

Bug 2: Spec used SHORT_ANSWER/PARAGRAPH/SCALE but handler expects
TEXT/PARAGRAPH_TEXT/LINEAR_SCALE. Fixed spec to use correct type names.

Also fixed listTools.ts which used 'questionType' (wrong param name) and 'SCALE'.

Added Linear team ID to CLAUDE.md for future reference.
Implements sheets.readAsRecords — reads a Google Sheet range and returns
data as an array of keyed objects using the first row as column headers.

- readAsRecords function in src/modules/sheets/read.ts
- ReadAsRecordsResult type exported from module index
- SDK spec entry in src/sdk/spec.ts (sheets section)
- SDK runtime registration in src/sdk/runtime.ts
- 4 unit tests covering: keyed objects, header-only, sparse rows, empty sheet

AC-1: Returns array of objects with column headers as keys ✓
AC-2: Handles edge cases (empty sheet throws, sparse rows use null) ✓
AC-3: SDK spec and runtime follow existing sheets operation pattern ✓

Closes #50
@linear
Copy link
Copy Markdown

linear Bot commented Mar 28, 2026

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 28, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cdabdc2a-ea04-45c7-8a7b-220e26225757

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
📝 Walkthrough

Walkthrough

The PR updates the forms.addQuestion operation across SDK specification and tool metadata, flattening its input structure from a nested question object to individual flat fields and introducing LINEAR_SCALE as a question type. Additionally, .gitignore is updated to exclude Obsidian vault content, and CLAUDE.md adds a Linear team integration note.

Changes

Cohort / File(s) Summary
Configuration & Documentation
.gitignore, CLAUDE.md
Added .obsidian/ to ignore patterns and appended Linear integration reference specifying team ID and issue prefix GDRIVE-.
Forms API Specification
src/sdk/spec.ts
Updated sdk.forms.addQuestion input contract from nested question: QuestionSpec to flat fields (title, type, optional required, options, scale bounds/labels). Return type changed from { formId, questionId, title, type } to { formId, title, type, message }. Introduced LINEAR_SCALE question type variant.
Tool Definition
src/tools/listTools.ts
Synchronized forms.addQuestion tool metadata with spec changes: updated parameter structure, expanded QuestionType enum documentation to include all seven types, and replaced example to demonstrate LINEAR_SCALE with explicit scaleMin/scaleMax values.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hop, hop! A flatter path appears,
No nested boxes, questions clear—
Linear scales now take their place,
While Obsidian hides from trace.

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (3 warnings)

Check name Status Explanation Resolution
Title check ⚠️ Warning The PR title describes 'feat(sheets): add readAsRecords operation' but the changes primarily involve updates to forms.addQuestion specifications and documentation, with only indirect sheets-related changes. Revise the title to reflect the actual primary changes: 'feat(forms): update addQuestion operation spec with flat parameter structure' or include forms changes in the title.
Linked Issues check ⚠️ Warning The PR claims to address issue #50 (sheets.readAsRecords implementation) but the changeset shows no sheets.readAsRecords implementation—only forms.addQuestion spec updates and .gitignore/documentation changes. Provide the actual sheets.readAsRecords implementation files or clarify whether this PR should address issue #50 at all. Verify all coding requirements from #50 are present.
Out of Scope Changes check ⚠️ Warning The changes to forms.addQuestion in src/sdk/spec.ts and src/tools/listTools.ts appear out of scope relative to the stated objective of implementing sheets.readAsRecords for issue #50. Remove the forms.addQuestion changes from this PR or update the PR objectives to include forms operation updates and link to corresponding issues.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/gdrive-17-read-as-records

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 and usage tips.

@github-actions
Copy link
Copy Markdown

📊 Type Coverage Report

Type Coverage: 98.61%

This PR's TypeScript type coverage analysis is complete.
Check the full report in the workflow artifacts.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 28, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
gdrive-mcp b537a20 Commit Preview URL

Branch Preview URL
Mar 28 2026, 07:21 PM

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/tools/listTools.ts (1)

141-145: Missing scaleMinLabel and scaleMaxLabel parameters in signature.

The signature omits scaleMinLabel?: string and scaleMaxLabel?: string which are present in src/sdk/spec.ts (line 300) and the implementation at src/modules/forms/questions.ts. This inconsistency may mislead agents using this tool discovery resource.

♻️ Proposed fix to include all LINEAR_SCALE parameters
       {
         name: 'addQuestion',
-        signature: 'addQuestion({ formId: string, title: string, type: QuestionType, required?: boolean, options?: string[], scaleMin?: number, scaleMax?: number })',
+        signature: 'addQuestion({ formId: string, title: string, type: QuestionType, required?: boolean, options?: string[], scaleMin?: number, scaleMax?: number, scaleMinLabel?: string, scaleMaxLabel?: string })',
         description: 'Add a question to a form. QuestionType: TEXT | PARAGRAPH_TEXT | MULTIPLE_CHOICE | CHECKBOX | DROPDOWN | LINEAR_SCALE | DATE | TIME',
         example: 'forms.addQuestion({ formId: "abc123", title: "Your rating", type: "LINEAR_SCALE", scaleMin: 1, scaleMax: 5 })',
       },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/tools/listTools.ts` around lines 141 - 145, The tool signature for
addQuestion in src/tools/listTools.ts is missing the optional scaleMinLabel?:
string and scaleMaxLabel?: string parameters used by the LINEAR_SCALE question
type; update the signature string for the entry with name 'addQuestion' to
include scaleMinLabel?: string and scaleMaxLabel?: string (matching the
parameters defined in src/sdk/spec.ts and the implementation in
src/modules/forms/questions.ts) so tool discovery reflects the actual API.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/tools/listTools.ts`:
- Around line 141-145: The tool signature for addQuestion in
src/tools/listTools.ts is missing the optional scaleMinLabel?: string and
scaleMaxLabel?: string parameters used by the LINEAR_SCALE question type; update
the signature string for the entry with name 'addQuestion' to include
scaleMinLabel?: string and scaleMaxLabel?: string (matching the parameters
defined in src/sdk/spec.ts and the implementation in
src/modules/forms/questions.ts) so tool discovery reflects the actual API.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: cc775817-050b-4016-92dc-b3ed9794633f

📥 Commits

Reviewing files that changed from the base of the PR and between c4be21f and eb7f712.

📒 Files selected for processing (4)
  • .gitignore
  • CLAUDE.md
  • src/sdk/spec.ts
  • src/tools/listTools.ts

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 28, 2026

🔒 Security Scan Summary

Generated on: Sat Mar 28 19:22:11 UTC 2026
Commit: 0971c29

Scan Results

  • SAST Analysis: success
  • Dependency Scan: success
  • Secret Scan: success
  • Docker Security Scan: success
  • License Scan: success

Summary

  • Total scans: 5
  • Critical issues: 0
  • Overall status: ✅ PASS

Recommendations

  1. Review all failed scans and address critical issues
  2. Update dependencies with known vulnerabilities
  3. Ensure no secrets are committed to the repository
  4. Follow Docker security best practices
  5. Review license compliance for all dependencies

Security report generated by Claude Code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 28, 2026

Performance Comparison Report

Operation Performance

Operation Baseline Avg Current Avg Change Status
listFiles 95.0ms 48.1ms -49.4% 🚀 IMPROVEMENT
readFile 180.0ms 92.4ms -48.7% 🚀 IMPROVEMENT
createFile 250.0ms 144.4ms -42.2% 🚀 IMPROVEMENT
cacheOperation 45.0ms 41.0ms -8.8% 🚀 IMPROVEMENT

Memory Usage

  • Baseline: 45.2 MB
  • Current: 4.41 MB
  • Change: -90.2%

Summary

  • 🚀 Improvements: 4
  • ❌ Regressions: 0

Performance report generated by Claude Code

Updates @hono/node-server, express-rate-limit, hono, and path-to-regexp
to patched versions to address high-severity CVEs reported by npm audit.
@github-actions
Copy link
Copy Markdown

📊 Type Coverage Report

Type Coverage: 98.61%

This PR's TypeScript type coverage analysis is complete.
Check the full report in the workflow artifacts.

@AojdevStudio AojdevStudio merged commit b8a24aa into main Mar 28, 2026
32 of 33 checks passed
@AojdevStudio AojdevStudio deleted the feature/gdrive-17-read-as-records branch March 28, 2026 19:38
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.

sheets.readAsRecords — read Sheet as array of keyed objects

1 participant