Tracking issue for review findings on PR #584 that are real but out of scope for that PR's minimal review-fix pass. PR #584 fixed the concrete correctness bugs inline (409 retry, tagging-status gating, concurrency lock, content-extraction gating, Base64 round-trip validation, mojibake heuristic narrowing, retention exemption, etc.); the items below are larger refactors to schedule separately.
1. Extract drive-ai-ingester logic into a testable src/index.js
AGENTS.md requires each GAS script to keep code.gs/config.gs as thin entry points and extract Node-testable logic into src/<script>/src/index.js using a service-injection pattern, with Jest coverage — mirroring gmail-ai-classifier. drive-ai-ingester currently keeps analyzeDocumentWithAi, applyDualLayerTagsToDriveFile, extractFileContentText, extractJsonSubstring, parseRetryDelayMs, getNotePathForDomain, formatDriveIngestionEntry, and the GitHub sync helpers inside Code.gs/GitHubSync.gs. Also rename Code.gs/Config.gs to lowercase to match the repo convention.
2. Centralize GitHub repo coordinates in config.gs
GITHUB_REPO_OWNER/GITHUB_REPO_NAME are defined as module constants in gmail-ai-classifier/src/index.js and duplicated as literals in gitHubSync.gs / drive-ai-ingester/GitHubSync.gs. Move them to config.gs (or a single shared source) and reference from all URL builders so the duplicates cannot drift.
Sources: gemini-code-assist, coderabbitai, cubic review comments on PR #584.
Tracking issue for review findings on PR #584 that are real but out of scope for that PR's minimal review-fix pass. PR #584 fixed the concrete correctness bugs inline (409 retry, tagging-status gating, concurrency lock, content-extraction gating, Base64 round-trip validation, mojibake heuristic narrowing, retention exemption, etc.); the items below are larger refactors to schedule separately.
1. Extract
drive-ai-ingesterlogic into a testablesrc/index.jsAGENTS.md requires each GAS script to keep
code.gs/config.gsas thin entry points and extract Node-testable logic intosrc/<script>/src/index.jsusing a service-injection pattern, with Jest coverage — mirroringgmail-ai-classifier.drive-ai-ingestercurrently keepsanalyzeDocumentWithAi,applyDualLayerTagsToDriveFile,extractFileContentText,extractJsonSubstring,parseRetryDelayMs,getNotePathForDomain,formatDriveIngestionEntry, and the GitHub sync helpers insideCode.gs/GitHubSync.gs. Also renameCode.gs/Config.gsto lowercase to match the repo convention.2. Centralize GitHub repo coordinates in
config.gsGITHUB_REPO_OWNER/GITHUB_REPO_NAMEare defined as module constants ingmail-ai-classifier/src/index.jsand duplicated as literals ingitHubSync.gs/drive-ai-ingester/GitHubSync.gs. Move them toconfig.gs(or a single shared source) and reference from all URL builders so the duplicates cannot drift.Sources: gemini-code-assist, coderabbitai, cubic review comments on PR #584.