Skip to content

feat(sheets): add updateRecords operation for key-column-based row updates#61

Merged
AojdevStudio merged 1 commit intomainfrom
feature/gdrive-22-sheets-update-records
Mar 28, 2026
Merged

feat(sheets): add updateRecords operation for key-column-based row updates#61
AojdevStudio merged 1 commit intomainfrom
feature/gdrive-22-sheets-update-records

Conversation

@AojdevStudio
Copy link
Copy Markdown
Owner

Summary

Closes #55 | Linear: GDRIVE-22

Implements sheets.updateRecords — update Google Sheet rows by matching a key column value. Enables writing tracking/status data back to a contact sheet after campaign execution.

What Changed

The core implementation (module function, SDK spec/runtime/types, unit tests) was already in place. This PR completes the legacy handler layer:

src/sheets/sheets-schemas.ts

  • Added updateRecords to SheetsOperationEnum
  • Added UpdateEntrySchema (validates { key, values } entries)
  • Added SheetsUpdateRecordsSchema (spreadsheetId, range, keyColumn, updates, optional sheetName)
  • Added SheetsUpdateRecordsSchema to SheetsToolSchema discriminated union

src/sheets/sheets-handler.ts

  • Added UpdateRecordsArgs type alias
  • Added case 'updateRecords' dispatch in the switch statement
  • Added handleUpdateRecords function — reads sheet, locates key column, iterates updates, matches rows by key, writes individual cells, returns { updated, notFound, errors, message }

Acceptance Criteria

  • AC-1: Matches rows by key column value and updates only the specified columns in matched rows
  • AC-2: Returns a result summary: { updated: number, notFound: string[], errors: string[] }
  • AC-3: Does not modify rows that do not match any provided key value

Testing

  • All 568 tests pass across 50 test suites
  • npm run type-check clean (no errors)
  • Existing unit tests in src/modules/sheets/__tests__/updateRecords.test.ts cover key column matching and notFound reporting

…dates

Wire updateRecords into sheets-schemas.ts (Zod schema + operation enum)
and sheets-handler.ts (case dispatch + handler function). The core
implementation in src/modules/sheets/update.ts, SDK spec/runtime/types,
and unit tests already existed — this completes the legacy handler layer.

- SheetsUpdateRecordsSchema: validates spreadsheetId, range, keyColumn,
  updates (array of {key, values}), optional sheetName
- handleUpdateRecords: reads sheet, matches key column, updates individual
  cells per matched row, returns {updated, notFound, errors, message}
- All 568 tests pass, type-check clean

Closes #55
Related to GDRIVE-22
@linear
Copy link
Copy Markdown

linear Bot commented Mar 28, 2026

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 28, 2026

Warning

Rate limit exceeded

@AojdevStudio has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 0 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 10 minutes and 0 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1e060772-a6bb-4723-967f-ce59a0cedaff

📥 Commits

Reviewing files that changed from the base of the PR and between c00e424 and ddcd66e.

📒 Files selected for processing (2)
  • src/sheets/sheets-handler.ts
  • src/sheets/sheets-schemas.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/gdrive-22-sheets-update-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.

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

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 ddcd66e Commit Preview URL

Branch Preview URL
Mar 28 2026, 08:23 PM

@github-actions
Copy link
Copy Markdown

📊 Type Coverage Report

Type Coverage: 98.62%

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

@github-actions
Copy link
Copy Markdown

🔒 Security Scan Summary

Generated on: Sat Mar 28 20:24:53 UTC 2026
Commit: ba04176

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

Copy link
Copy Markdown

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

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: ddcd66e1bf

ℹ️ 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".

continue; // skip unknown columns
}

const cellRef = `${sheetPrefix}${columnIndexToLetter(colIndex)}${rowIndex + 1}`;
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 Use range origin when building update cell references

handleUpdateRecords computes each target cell as columnIndexToLetter(colIndex) plus rowIndex + 1, which treats the fetched data as if it always starts at A1. For valid inputs like range: 'Contacts!C5:H', this writes to A2, B2, etc. instead of the intended columns/rows under C5, causing updates to land in the wrong part of the sheet and potentially overwrite unrelated data.

Useful? React with 👍 / 👎.

@github-actions
Copy link
Copy Markdown

Performance Comparison Report

Operation Performance

Operation Baseline Avg Current Avg Change Status
listFiles 95.0ms 51.6ms -45.7% 🚀 IMPROVEMENT
readFile 180.0ms 95.0ms -47.2% 🚀 IMPROVEMENT
createFile 250.0ms 152.1ms -39.2% 🚀 IMPROVEMENT
cacheOperation 45.0ms 48.0ms 6.7% ✅ OK

Memory Usage

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

Summary

  • 🚀 Improvements: 3
  • ❌ Regressions: 0

Performance report generated by Claude Code

@AojdevStudio AojdevStudio merged commit 4d47a08 into main Mar 28, 2026
29 checks passed
@AojdevStudio AojdevStudio deleted the feature/gdrive-22-sheets-update-records branch March 28, 2026 20:30
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.updateRecords — update Sheet rows by key column match

1 participant