ipal-doctor: never write first-seen dates when CI is set

The CLI ignored CI (writeSeen was only !sites && !json); docs and comments
already said "not in CI". shouldWriteSeen() + test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-11-24 00:01:18 +01:00
co-authored by Claude Opus 5.5
parent 36f8f69f82
commit 5cd0224ebd
2 changed files with 19 additions and 2 deletions
+10 -1
View File
@@ -6,7 +6,7 @@ import { afterAll, afterEach, beforeAll, describe, expect, test, vi } from 'vite
import type { DoctorConfig, DoctorReport } from '../src/modules/doctor/types.js'
import { expandSites, parseDoctorArgs, runDoctorCli } from '../src/modules/doctor/cli.js'
import { expandSites, parseDoctorArgs, runDoctorCli, shouldWriteSeen } from '../src/modules/doctor/cli.js'
import { formatDriftTable, formatReport } from '../src/modules/doctor/format.js'
import { bareHost, parseEnvFile, readAuditSkips } from '../src/modules/doctor/project.js'
import { planSkills } from '../src/modules/doctor/rules/agents.js'
@@ -452,3 +452,12 @@ describe('the reference site', () => {
for (const setting of Object.values(config.rules ?? {})) {expect(setting.reason?.trim()).toBeTruthy()}
})
})
describe('ipal-doctor: first-seen dates', () => {
test('are written only outside CI, and never with --json or --sites', () => {
expect(shouldWriteSeen({}, {})).toBe(true)
expect(shouldWriteSeen({}, { CI: 'true' })).toBe(false)
expect(shouldWriteSeen({ json: true }, {})).toBe(false)
expect(shouldWriteSeen({ sites: 'clients/*' }, {})).toBe(false)
})
})