CLI-728 Queue analysis findings in a local file and drain them through the background telemetry flush#501
Conversation
75510b2 to
1fafd36
Compare
737f5ac to
afa14a4
Compare
7fd8aa8 to
b23eef1
Compare
afa14a4 to
c1f0a37
Compare
3549305 to
070e1d6
Compare
c1f0a37 to
13eaff9
Compare
…h the background telemetry flush
070e1d6 to
5040206
Compare
Code Review ✅ Approved 6 resolved / 6 findingsImplements local queuing and background telemetry flushing for analysis findings, resolving issues with file management, path handling, and identification consistency. No remaining issues identified. ✅ 6 resolved✅ Bug: flushFindings drops unsent findings permanently on timeout/error
✅ Quality: TELEMETRY_DIR constant is unused and statically computed
✅ Quality: Re-append of unsent findings on send failure is untested
✅ Edge Case: Non-null assertion on optional installationId may emit empty id
✅ Edge Case: Orphaned .sending files are never recovered, losing findings
...and 1 more resolved from earlier reviews OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change:
Was this helpful? React with 👍 / 👎 | Gitar |
|



Summary
TELEMETRY_ENDPOINTandTELEMETRY_API_KEYfrom module-level constants insrc/telemetry/index.tsto exported constants insrc/lib/config-constants.tsso they can be shared across telemetry modulessrc/telemetry/findings.tswith three exports:appendFinding(payload)— fire-and-forget low-level write: creates the telemetry dir if missing, appends one JSON line to~/.sonar/sonarqube-cli/telemetry/findings.ndjson, silently swallows all I/O errorsemitSecretsFindings(callerCommand, auth, issues, durationMs)— higher-level helper that gates onisTelemetryEnabled, resolves identity fields from state/auth, and callsappendFinding()per issue; call sites added in CLI-730flushFindings(deadline)— atomically renamesfindings.ndjson→findings.<uuid>.sending, drops events older than 7 days, POSTs one event per HTTP call, deletes the.sendingfile in afinallyblock; a worker that loses the rename race exits immediatelyflushTelemetry()insrc/telemetry/index.tsto callflushFindings(deadline)after the existingstate.telemetry.events[]drainSummary by Gitar
timedhelper insrc/lib/timed.tsto measure execution duration of asynchronous tasks.AnalysisFindingEventPayloadandStoredFindingEventtosrc/lib/state.tsfor structured finding data.getTelemetryDir()insrc/lib/config-constants.tsto centralize the location for telemetry artifacts.tests/unit/telemetry/findings.test.ts.tests/unit/telemetry/telemetry.test.ts.timed()helper intests/unit/lib/timed.test.ts.This will update automatically on new commits.