Skip to content

feat: implement issue #442 — SonarCloud modernization (1/3): src/ app code - #465

Merged
don-petry merged 70 commits into
mainfrom
dev-lead/issue-442-20260721-1926
Aug 2, 2026
Merged

feat: implement issue #442 — SonarCloud modernization (1/3): src/ app code#465
don-petry merged 70 commits into
mainfrom
dev-lead/issue-442-20260721-1926

Conversation

@don-petry

@don-petry don-petry commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

User description

Closes #442

Implemented by dev-lead agent. Please review.

Summary by CodeRabbit

  • New Features

    • Added tools to rebuild configured Gmail-to-Drive documents by clearing existing content and reprocessing labeled messages.
    • Rebuild operations support batching across executions and handle execution limits and errors.
  • Bug Fixes

    • Improved handling of missing calendar and deployment values without changing valid falsy values.
    • Improved validation for unsupported blob inputs and tightened email-header parsing.
  • Tests

    • Expanded coverage for calendar-to-sheet synchronization, full resynchronization, deletions, formula handling, and default configurations.

CodeAnt-AI Description

Add resumable document rebuilds and harden calendar synchronization

What Changed

  • Added a rebuild workflow that clears configured documents and moves processed emails back for reprocessing, with batching and saved progress so large rebuilds can resume after time limits
  • Calendar synchronization now falls back to the default configuration when multi-calendar settings are empty, removes stale or empty sheet rows, and supports full resyncs for one or all configurations
  • Spreadsheet values with leading whitespace or control characters before formula symbols are escaped to prevent unintended formulas
  • Missing configuration values, unsupported attachment inputs, and long-running syncs now fail or pause more predictably with clear warnings
  • Added coverage for rebuilds, resyncs, malformed configurations, formula protection, and iteration limits

Impact

✅ Resumable large-document rebuilds
✅ Fewer calendar sync failures from empty or malformed settings
✅ Safer calendar data in spreadsheets

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Copilot AI review requested due to automatic review settings July 21, 2026 19:36
@don-petry
don-petry requested a review from a team as a code owner July 21, 2026 19:36
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@don-petry, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 11068a3e-b1e6-46e8-9036-023c0ab83ed3

📥 Commits

Reviewing files that changed from the base of the PR and between 67e7cd6 and 1140146.

📒 Files selected for processing (2)
  • src/calendar-to-sheets/tests/index.test.js
  • src/gmail-to-drive-by-labels/code.gs
📝 Walkthrough

Walkthrough

The changes modernize several JavaScript idioms, expand calendar-to-sheets tests, add Gmail-to-Drive document rebuilding, adjust Node.js test exports, and update repository guidance and workflow configuration.

Changes

Application idiom modernization

Layer / File(s) Summary
Calendar defaults and utility validation
src/calendar-to-briefing-doc/src/index.js, src/deploy/index.js, src/gas-utils.js
Calendar and deployment code use nullish-aware handling. Utility code uses node:crypto, revised email-header patterns, and TypeError for unsupported blobs.

Calendar-to-sheets testing and exports

Layer / File(s) Summary
Calendar-to-sheets behavior coverage
src/calendar-to-sheets/tests/index.test.js
Tests cover full resync, default configuration, row deletion, formula sanitization, and header setup.
Calendar-to-sheets test exports
src/calendar-to-sheets/code.gs
A duplicate export assignment limits the effective module interface and omits sanitization, checkpoint, and full-resync helpers.

Gmail-to-Drive document rebuilding

Layer / File(s) Summary
Document rebuild orchestration
src/gmail-to-drive-by-labels/code.gs
rebuildAllDocs() processes configured documents and reports incomplete rebuilds.
Stateful document rebuild execution
src/gmail-to-drive-by-labels/code.gs
rebuildDoc(config) clears documents, restores Gmail labels, persists progress, handles limits and errors, and reports status.
Gmail rebuild test exports
src/gmail-to-drive-by-labels/code.gs
Node.js exports expose rebuild and email-processing entry points.

Repository guidance and workflow maintenance

Layer / File(s) Summary
Review guidance and workflow settings
AGENTS.md, .gitignore, .github/workflows/dependabot-rebase.yml
Review-thread resolution guidance was added, .dev-lead/ was ignored, and a duplicate workflow concurrency block was added.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant RebuildAllDocs
  participant RebuildDoc
  participant Gmail
  participant Drive
  RebuildAllDocs->>RebuildDoc: rebuild configured document
  RebuildDoc->>Drive: clear document
  RebuildDoc->>Gmail: restore processed threads to trigger labels
  RebuildDoc-->>RebuildAllDocs: return rebuild status
Loading

Possibly related PRs

Suggested labels: dev-lead

Suggested reviewers: donpetry-bot

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR violates #442 by changing .gs files, adding tests, and adding Gmail rebuild logic instead of only listed behavior-preserving idiom updates. Revert unrelated .gs, workflow, documentation, and test additions; update only the issue-listed src/index.js files with the required SonarCloud idioms.
Out of Scope Changes check ⚠️ Warning The PR includes unrelated workflow, documentation, ignore-file, test, and .gs changes outside the linked issue scope. Remove the unrelated workflow, documentation, ignore-file, test, and .gs changes from this PR.
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the issue and the main change: SonarCloud modernization of the src application code.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-442-20260721-1926

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.

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

Copy link
Copy Markdown

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 modernizes several JavaScript files by introducing optional chaining, nullish coalescing, and other ES features. However, several critical issues were identified: the use of toSorted() will cause runtime errors in the Google Apps Script (GAS) V8 environment, which does not support ES2023 features. Additionally, using replaceAll with a global regular expression is redundant and less compatible than replace, and a ternary operator can be further simplified using nullish coalescing.

Comment thread src/calendar-to-sheets/src/index.js Outdated
Comment thread src/gmail-to-drive-by-labels/src/index.js Outdated
Comment thread src/gmail-to-drive-by-labels/src/index.js Outdated
Comment thread src/gas-utils.js Outdated
Comment thread src/calendar-to-briefing-doc/src/index.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Implements the “SonarCloud modernization (1/3)” work for core src/ app code, focusing on behavior-preserving idiom updates across multiple script modules and their Node/Jest test layer.

Changes:

  • Modernizes several idioms (e.g., Date.now(), optional chaining / nullish coalescing, node: built-in imports, simplified regex char classes).
  • Updates Gmail-to-Drive-by-labels logic to use newer idioms for subjects, timestamping, and sorting, plus adjusts a related Date-mocking test.
  • Applies minor API-safety cleanup in deploy helpers (?? null).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/gmail-to-drive-by-labels/tests/code.test.js Updates Date mocking to support production code moving to Date.now().
src/gmail-to-drive-by-labels/src/index.js SonarCloud-style idiom changes (subject defaulting, timestamping, sorting, elapsed-time tracking).
src/gas-utils.js Modernizes crypto import and string cleanup; refines error type for invalid blobs.
src/deploy/index.js Uses nullish coalescing for catalog lookup fallback.
src/calendar-to-sheets/src/index.js Updates row-deletion ordering logic with a non-mutating sort approach.
src/calendar-to-briefing-doc/src/index.js Replaces manual null checks with optional chaining / nullish coalescing.
Comments suppressed due to low confidence (1)

src/gmail-to-drive-by-labels/src/index.js:313

  • Array.prototype.toSorted() is ES2023, but the repo targets ES2022 (project-context.md:29). Please avoid toSorted here and use slice().sort(...) (or [...threads].sort(...)) to preserve ES2022 compatibility.
  return threads.toSorted(function (a, b) {
    const aMessages = a.getMessages()
    const bMessages = b.getMessages()
    const aLastDate = aMessages[aMessages.length - 1].getDate().getTime()
    const bLastDate = bMessages[bMessages.length - 1].getDate().getTime()

Comment thread src/gmail-to-drive-by-labels/src/index.js Outdated
Comment thread src/calendar-to-sheets/src/index.js Outdated
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) July 21, 2026 19:48
@github-actions

Copy link
Copy Markdown
Contributor

CI Failure: SonarCloud Code Analysis

Step: SonarCloud Quality Gate
Root cause: Lint/style

This PR is a static-analysis/code-quality check (SonarCloud), so it falls in the same bucket as ESLint/ruff-style failures rather than a test or build break. No GitHub Actions run logs are attached to this check (it runs as an external quality gate), and gh pr diff shows the change is a broad style-modernization refactor (optional chaining, node:crypto, Date.now(), simplified regexes, TypeError instead of Error). Quality gate failures on this kind of diff are typically triggered by new code smells, a security hotspot flag on the modified regex patterns (e.g. the \s+\s changes in src/gas-utils.js), or insufficient coverage/duplication thresholds on the newly touched lines.

Suggested fix: Open the SonarCloud dashboard link below, find the specific failing Quality Gate condition (new code coverage, duplications, or code smells/security hotspots) and resolve the flagged lines — pay particular attention to the regex edits in src/gas-utils.js and src/gmail-to-drive-by-labels/src/index.js, as regex pattern changes commonly trigger Sonar security-hotspot review.

View run logs

@don-petry
don-petry disabled auto-merge July 21, 2026 19:57
@don-petry
don-petry enabled auto-merge (squash) July 21, 2026 20:05
@don-petry
don-petry disabled auto-merge July 21, 2026 20:08
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead Fix CI — failed

PR: #465 | SHA: 3c0ad689d27e9d4cbe68bfd4135fdcb67830fb5d
Engine invocation failed (exit 1)

@codeant-ai

codeant-ai Bot commented Aug 2, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed 67e7cd6 Aug 02, 2026 · 09:34 09:35
✅ Incremental review completed 4202c0f Aug 02, 2026 · 04:04 04:04
✅ Reviewed your PR 0accb8b Aug 02, 2026 · 02:03 02:05

@codeant-ai codeant-ai Bot added the size:S This PR changes 10-29 lines, ignoring generated files label Aug 2, 2026
@don-petry
don-petry disabled auto-merge August 2, 2026 02:04
Comment thread src/gmail-to-drive-by-labels/src/index.js Outdated
donpetry-bot and others added 6 commits August 2, 2026 09:34
…ub (#474)

* chore: sync 1 org-standard workflow stub(s) from petry-projects/.github

* chore: dev-lead update (review-changes) [skip ci-relay]

* fix(bot): address bot feedback [skip ci-relay]

---------

Co-authored-by: donpetry-bot <281750570+donpetry-bot@users.noreply.github.com>
…n group across 1 directory (#469)

chore(deps-dev): bump fast-uri

Bumps the npm_and_yarn group with 1 update in the / directory: [fast-uri](https://github.com/fastify/fast-uri).


Updates `fast-uri` from 3.1.2 to 3.1.4
- [Release notes](https://github.com/fastify/fast-uri/releases)
- [Commits](fastify/fast-uri@v3.1.2...v3.1.4)

---
updated-dependencies:
- dependency-name: fast-uri
  dependency-version: 3.1.4
  dependency-type: indirect
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: petry-projects-dependabot-automrg[bot] <270452309+petry-projects-dependabot-automrg[bot]@users.noreply.github.com>
…ub (#479)

* chore: sync 4 org-standard workflow stub(s) from petry-projects/.github

* chore: sync 4 org-standard workflow stub(s) from petry-projects/.github

* chore: sync 4 org-standard workflow stub(s) from petry-projects/.github

* chore: sync 4 org-standard workflow stub(s) from petry-projects/.github
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — rebase (applied)

Rebase completed and pushed.

@don-petry
don-petry enabled auto-merge (squash) August 2, 2026 09:34
@codeant-ai codeant-ai Bot added size:XL This PR changes 500-999 lines, ignoring generated files and removed size:S This PR changes 10-29 lines, ignoring generated files labels Aug 2, 2026
Comment thread .github/workflows/dependabot-rebase.yml Outdated
@don-petry
don-petry disabled auto-merge August 2, 2026 09:37

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/deploy/index.js (1)

318-319: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Copy the original error text without reparsing it as HTML.

The browser decodes the data-copy value before Line 319 reads this.dataset.copy. Line 319 then assigns the original error text to innerHTML, so an error such as <b>failed</b> is copied as failed instead of the original text. This also creates an unnecessary HTML parsing sink.

Write this.dataset.copy directly. Add a regression test for literal angle-bracket text.

Proposed fix
-    ` onclick="var d=document.createElement('div');d.innerHTML=this.dataset.copy;navigator.clipboard.writeText(d.textContent).catch(()=>{})">` +
+    ` onclick="navigator.clipboard.writeText(this.dataset.copy).catch(()=>{})">` +
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/deploy/index.js` around lines 318 - 319, Update the copy button’s inline
onclick handler to pass this.dataset.copy directly to
navigator.clipboard.writeText, removing the temporary element and innerHTML
parsing. Add a regression test covering error text with literal angle brackets,
such as “<b>failed</b>”, and verify the exact original text is copied.
🧹 Nitpick comments (2)
src/gmail-to-drive-by-labels/code.gs (2)

418-419: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Correct the misleading comment.

allThreads is a snapshot returned by processedLabel.getThreads(). It does not shrink while the loop runs. The loop indexes the snapshot, which is correct, but the comment states the opposite and may cause a wrong "fix" later.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/gmail-to-drive-by-labels/code.gs` around lines 418 - 419, Update the
comment above the batch-processing loop to accurately state that allThreads is a
fixed snapshot from processedLabel.getThreads() and does not shrink during
iteration; document that indexing the snapshot from the appropriate loop
position is intentional.

350-352: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Use Date.now() and a nullish default for batchSize.

config.batchSize || 250 replaces an explicit 0 with 250. Use ?? so an explicit value is honored. The linked issue also asks for Date.now() in Gmail-to-Drive code.

♻️ Proposed idiom updates
-  var BATCH_SIZE = config.batchSize || 250; // Process threads in batches (default: 250)
-  var startTime = new Date().getTime();
+  var BATCH_SIZE = config.batchSize ?? 250; // Process threads in batches (default: 250)
+  var startTime = Date.now();

Apply the same change to the elapsed-time check at line 425.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/gmail-to-drive-by-labels/code.gs` around lines 350 - 352, In the
Gmail-to-Drive processing flow, update the BATCH_SIZE initialization to use a
nullish fallback so an explicit config.batchSize of 0 is preserved, and replace
the start-time timestamp creation with Date.now(). Apply Date.now() consistently
in the elapsed-time check around the processing loop as well.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/dependabot-rebase.yml:
- Around line 46-49: Remove the later duplicate workflow-level concurrency
mapping in the workflow, keeping the earlier concurrency block with the required
group and cancel-in-progress settings as the sole definition.

In `@src/calendar-to-sheets/code.gs`:
- Around line 510-513: Remove the later duplicate module.exports assignment and
preserve the earlier export object containing fullResyncCalendarToSheetGAS,
sanitizeValue, and the checkpoint helpers. Ensure the Node test exports continue
to expose all symbols defined in the original module.exports assignment.

In `@src/calendar-to-sheets/tests/index.test.js`:
- Around line 1122-1284: Format the added test blocks in
src/calendar-to-sheets/tests/index.test.js using the repository’s Prettier
configuration, including the other noted additions, so all prettier/prettier
lint errors are resolved. Run Prettier on the complete test file and commit the
resulting formatting changes without altering test behavior.

In `@src/gmail-to-drive-by-labels/code.gs`:
- Around line 308-464: Remove the duplicated top-level rebuildAllDocs and
rebuildDoc declarations added after the existing definitions, preserving the
original implementations earlier in the file. Leave the .gs file otherwise
unchanged, including its existing formatting and behavior.
- Around line 393-398: Update both duplicated rebuildDoc clear-document error
handlers to preserve stateKey and signal failure by returning false (or
propagating the error), rather than deleting the state key and returning true.
Ensure rebuildAllDocs does not treat a failed clear_doc phase as successfully
rebuilt and that the next run retries the phase.

---

Outside diff comments:
In `@src/deploy/index.js`:
- Around line 318-319: Update the copy button’s inline onclick handler to pass
this.dataset.copy directly to navigator.clipboard.writeText, removing the
temporary element and innerHTML parsing. Add a regression test covering error
text with literal angle brackets, such as “<b>failed</b>”, and verify the exact
original text is copied.

---

Nitpick comments:
In `@src/gmail-to-drive-by-labels/code.gs`:
- Around line 418-419: Update the comment above the batch-processing loop to
accurately state that allThreads is a fixed snapshot from
processedLabel.getThreads() and does not shrink during iteration; document that
indexing the snapshot from the appropriate loop position is intentional.
- Around line 350-352: In the Gmail-to-Drive processing flow, update the
BATCH_SIZE initialization to use a nullish fallback so an explicit
config.batchSize of 0 is preserved, and replace the start-time timestamp
creation with Date.now(). Apply Date.now() consistently in the elapsed-time
check around the processing loop as well.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9c65c584-1c70-4c79-a2eb-305ae4b2db73

📥 Commits

Reviewing files that changed from the base of the PR and between 4202c0f and 67e7cd6.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • .github/workflows/dependabot-rebase.yml
  • .gitignore
  • AGENTS.md
  • src/calendar-to-briefing-doc/src/index.js
  • src/calendar-to-sheets/code.gs
  • src/calendar-to-sheets/tests/index.test.js
  • src/deploy/index.js
  • src/gas-utils.js
  • src/gmail-to-drive-by-labels/code.gs
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/calendar-to-briefing-doc/src/index.js
  • src/gas-utils.js

Comment thread .github/workflows/dependabot-rebase.yml Outdated
Comment thread src/calendar-to-sheets/code.gs Outdated
Comment thread src/calendar-to-sheets/tests/index.test.js
Comment thread src/gmail-to-drive-by-labels/code.gs Outdated
Comment thread src/gmail-to-drive-by-labels/code.gs Outdated
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) August 2, 2026 09:43
@don-petry
don-petry disabled auto-merge August 2, 2026 09:43
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) August 2, 2026 09:47
@don-petry
don-petry disabled auto-merge August 2, 2026 09:48
@sonarqubecloud

sonarqubecloud Bot commented Aug 2, 2026

Copy link
Copy Markdown

@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (no-changes)

No changes were needed for this PR.

@don-petry
don-petry enabled auto-merge (squash) August 2, 2026 09:49

@donpetry-bot donpetry-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Automated review — APPROVED ✓

Risk: MEDIUM
Reviewed commit: 114014607898e5edfc87479f9f3e7d1dbcdbbd56
Review mode: triage-approved (single reviewer)

Summary

Behavior-preserving SonarCloud modernization of src/ app code (optional chaining, nullish coalescing, node:crypto, TypeError, S8786 regex simplification) plus ~400 lines of new Jest coverage for calendar-to-sheets resync/iteration-limit/formula-injection paths. One intentional logic improvement in rebuildDoc: on document-clear failure it now preserves the state key and throws (fail-loud, retry next run) instead of silently marking the rebuild done. Triage assessment confirmed.

Linked issue analysis

Closes #442 (SonarCloud modernization 1/3: src/ app code). The enumerated fixes are covered: gas-utils.js (node:crypto, TypeError, super-linear regex simplification — the \s+ → \s change is match-equivalent since greedy .+ absorbs extra whitespace), calendar-to-briefing-doc (optional chaining / ?? defaults), deploy/index.js (?? null). The gmail-to-drive and calendar-to-sheets idiom items from the issue checklist were absorbed into the base branch via the 2026-08-02 rebase; the passing SonarCloud quality gate on this PR confirms no remaining flagged issues.

Findings

No blocking findings.

  • Secret scan: run_secret_scanning MCP tool unavailable in this environment; gitleaks CI check is green and the diff contains no credential-like content.
  • rebuildDoc error handling (code.gs): changing silent-success-on-error to throw is a genuine behavior change, but it is a correctness improvement (prior code could mark a rebuild done after failing to clear the doc). State key retention enables retry on the next scheduled run.
  • Formula-injection tests: new tests correctly verify sanitization of leading whitespace/control chars before formula metacharacters — security-positive coverage.
  • Nit (non-blocking): the test name 'eventToRow does not sanitize values with formula chars not at effective start' is now duplicated in calendar-to-sheets/tests/index.test.js (Jest runs both; consider renaming one in a follow-up).
  • Review threads: all 0 threads unresolved — CodeRabbit's 5 actionable comments from the 2026-08-02 review were addressed by dev-lead commits (67e7cd6, f0a4899) and resolved.

CI status

All checks green at 114014607898e5edfc87479f9f3e7d1dbcdbbd56: build-and-test, Node.js Tests, coverage, Playwright UI Tests, CodeQL (actions/js-ts/python), SonarCloud Quality Gate (passed, 0 security hotspots), Secret scan (gitleaks), agent-shield, autofix, dependency-audit (npm audit clean).


Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

@don-petry
don-petry merged commit e44d9ef into main Aug 2, 2026
27 checks passed
@don-petry
don-petry deleted the dev-lead/issue-442-20260721-1926 branch August 2, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL This PR changes 500-999 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SonarCloud modernization (1/3): src/ app code

4 participants