You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Resolve all 8 open SonarCloud findings in src/gmail-ai-classifier/src/github-sync.js via real, behavior-preserving fixes (no blanket suppressions), keeping the Node/Jest test suite green.
Finding → fix mapping
S7773 ×2 (Number.isNaN): isNaN(remoteTs) / isNaN(localTs) → Number.isNaN(...) (inputs are Date#getTime() numbers, so identical).
S7784 ×2 (deep clone): JSON.parse(JSON.stringify(x)) → shallow spread copy { ...x } before delete _sha. Avoids structuredClone (not available in the Apps Script V8 runtime) while removing the flagged pattern; behavior identical (only top-level _sha removed, output JSON unchanged).
S3800 ×1 (consistent return type): executeGitHubCommit returns true | false | 'IDEMPOTENT_SKIP'. Unify to boolean — idempotent skip returns true. Caller appendMarkdownEntryToGitHubRepo already collapses both success cases to true, so its external behavior is unchanged; the now-dead || result === 'IDEMPOTENT_SKIP' guard is simplified.
src/gmail-ai-classifier/src/github-sync.js — apply the 6 fixes above
Tests to Write/Update
src/gmail-ai-classifier/tests/gitHubSync.test.js — update the "handles 200 with idempotent skip" assertion to reflect the unified boolean return (true); all other tests are behavior-preserving and must stay green.
Notes on approach
Most changes are behavior-preserving refactors validated by the existing suite (TDD Phase-2 exception). The only observable-contract change is S3800's return-type unification, covered by the updated idempotent-skip test.
Test Command
npm test (Jest + coverage); lint via npm run check.
Dev-Lead: Progress (in progress — not yet durable)
Provisional. Nothing is pushed yet; the automation posts the authoritative
completion record (with PR number + head SHA) after the push. Treat the notes
below as intent, not delivered results.
Plan Execution (intended)
All 8 SonarCloud findings in src/gmail-ai-classifier/src/github-sync.js addressed with real, behavior-preserving fixes — no blanket NOSONAR, no structuredClone (unavailable in the Apps Script V8 runtime):
S7773 ×2 → Number.isNaN(...)
S7784 ×2 → shallow spread copy { ...obj } + delete _sha (removes the JSON.parse(JSON.stringify()) pattern without structuredClone; identical output)
S3800 ×1 → executeGitHubCommit now returns a consistent boolean (idempotent skip returns true); caller appendMarkdownEntryToGitHubRepo already collapsed both success cases, so external behavior is unchanged
src/gmail-ai-classifier/src/github-sync.js: the 6 fixes above
src/gmail-ai-classifier/tests/gitHubSync.test.js: updated the idempotent-skip test to assert the unified boolean return (the only observable-contract change)
Local check output (provisional — not the pushed run)
npm test → all suites green
npm run check → prettier OK; eslint 0 errors (pre-existing warnings only, unrelated files)
.dev-lead lint → all checks passed
github-sync.js cov → 100% stmts / 100% branch / 100% funcs / 100% lines
Notes
Only github-sync.js (the SonarCloud-scanned .js) was changed; gitHubSync.gs is out of scope and left untouched.
structuredClone was deliberately avoided as it is a host-provided global not present in the GAS V8 runtime; the spread-copy fix preserves behavior in both Node and GAS.
Most changes are behavior-preserving refactors (TDD Phase-2 exception); the S3800 return-type unification is covered by the updated idempotent-skip test.
The implementation for issue #577 is durable: commits are pushed and a pull request is open. This record is backed by verifiable artifacts you can confirm in one click.
Review happens on the PR. Acceptance criteria and test results are evidenced by the PR's diff and CI checks — not asserted here. If a later stage fails, this claim is retracted in place.
Activity
don-petry commentedon Sep 8, 2026
Dev-Lead Implementation Plan
Issue: #577 — SonarCloud: JavaScript/TypeScript code quality
Scope
Resolve all 8 open SonarCloud findings in
src/gmail-ai-classifier/src/github-sync.jsvia real, behavior-preserving fixes (no blanket suppressions), keeping the Node/Jest test suite green.Finding → fix mapping
Number.isNaN):isNaN(remoteTs)/isNaN(localTs)→Number.isNaN(...)(inputs areDate#getTime()numbers, so identical).JSON.parse(JSON.stringify(x))→ shallow spread copy{ ...x }beforedelete _sha. AvoidsstructuredClone(not available in the Apps Script V8 runtime) while removing the flagged pattern; behavior identical (only top-level_sharemoved, output JSON unchanged).executeGitHubCommitreturnstrue | false | 'IDEMPOTENT_SKIP'. Unify toboolean— idempotent skip returnstrue. CallerappendMarkdownEntryToGitHubRepoalready collapses both success cases totrue, so its external behavior is unchanged; the now-dead|| result === 'IDEMPOTENT_SKIP'guard is simplified.refreshed && refreshed.updatedAt && ...→refreshed?.updatedAt && .....includes):rawContent.indexOf(entryMd.trim()) !== -1→rawContent.includes(entryMd.trim()).replaceAll):topic.replace(/-/g, ' ')→topic.replaceAll('-', ' ').Implementation Checklist
src/gmail-ai-classifier/src/github-sync.js— apply the 6 fixes aboveTests to Write/Update
src/gmail-ai-classifier/tests/gitHubSync.test.js— update the "handles 200 with idempotent skip" assertion to reflect the unified boolean return (true); all other tests are behavior-preserving and must stay green.Notes on approach
Most changes are behavior-preserving refactors validated by the existing suite (TDD Phase-2 exception). The only observable-contract change is S3800's return-type unification, covered by the updated idempotent-skip test.
Test Command
npm test(Jest + coverage); lint vianpm run check.don-petry commentedon Sep 8, 2026
Dev-Lead: Progress (in progress — not yet durable)
Plan Execution (intended)
All 8 SonarCloud findings in
src/gmail-ai-classifier/src/github-sync.jsaddressed with real, behavior-preserving fixes — no blanketNOSONAR, nostructuredClone(unavailable in the Apps Script V8 runtime):Number.isNaN(...){ ...obj }+delete _sha(removes theJSON.parse(JSON.stringify())pattern withoutstructuredClone; identical output)executeGitHubCommitnow returns a consistentboolean(idempotent skip returnstrue); callerappendMarkdownEntryToGitHubRepoalready collapsed both success cases, so external behavior is unchangedrefreshed?.updatedAt && ...rawContent.includes(...)topic.replaceAll('-', ' ')Files touched (this workspace, not yet pushed)
src/gmail-ai-classifier/src/github-sync.js: the 6 fixes abovesrc/gmail-ai-classifier/tests/gitHubSync.test.js: updated the idempotent-skip test to assert the unified boolean return (the only observable-contract change)Local check output (provisional — not the pushed run)
Notes
github-sync.js(the SonarCloud-scanned.js) was changed;gitHubSync.gsis out of scope and left untouched.structuredClonewas deliberately avoided as it is a host-provided global not present in the GAS V8 runtime; the spread-copy fix preserves behavior in both Node and GAS.don-petry commentedon Sep 8, 2026
Dev-Lead: Implementation Complete — PR #578
The implementation for issue #577 is durable: commits are pushed and a pull request is open. This record is backed by verifiable artifacts you can confirm in one click.
cb53ffb262a8fc3c550e05c74236819441d8168fReview happens on the PR. Acceptance criteria and test results are evidenced by the PR's diff and CI checks — not asserted here. If a later stage fails, this claim is retracted in place.
don-petry commentedon Sep 15, 2026
SonarCloud Audit (2026-09-15): still open — 8 finding(s), worst severity
MAJOR.don-petry commentedon Sep 22, 2026
SonarCloud Audit (2026-09-22): still open — 8 finding(s), worst severity
MAJOR.don-petry commentedon Sep 29, 2026
SonarCloud Audit (2026-09-29): still open — 8 finding(s), worst severity
MAJOR.feat: implement issue #577 — SonarCloud: JavaScript/TypeScript code q…