Files
claude code agent 8ad42a1a45 fix(logs): seed reconnect boundary state from resume params; extract+test since parser (F10,F11)
F10: the content-exact reconnect dedup rebuilt boundaryLines only from lines
     surviving the current batch, so after one reconnect at a shared timestamp it
     forgot the dropped line — a SECOND reconnect at the same nanosecond then
     re-emitted both as duplicates. Seed lastTimestamp/boundaryLines from
     skipUntilTimestamp/skipBoundaryContents so the boundary set accumulates all
     lines ever seen at the resume ts. Regression test (fails before, passes after).
F11: extract rfc3339ToUnixNanoSince into a testable logHelper module (sinceTimestamp.ts)
     and cover it (standard ns, no fraction, sub-9 pad, >9 truncate); the controller
     imports the single shared function.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 20:42:32 +03:00

32 lines
1.0 KiB
TypeScript

import { rfc3339ToUnixNanoSince } from './sinceTimestamp';
// Integer Unix seconds of the shared second-precision prefix, computed the same
// way the parser does (Date.parse of the "...:05Z" prefix, in UTC).
const unix = Math.floor(Date.parse('2024-01-01T00:00:00Z') / 1000);
describe('rfc3339ToUnixNanoSince', () => {
it('keeps a standard fixed-width nanosecond fraction', () => {
expect(rfc3339ToUnixNanoSince('2024-01-01T00:00:00.000000005Z')).toBe(
`${unix}.000000005`
);
});
it('emits a zero fraction when the timestamp has no fractional part', () => {
expect(rfc3339ToUnixNanoSince('2024-01-01T00:00:00Z')).toBe(
`${unix}.000000000`
);
});
it('right-pads a sub-nanosecond-width fraction to 9 digits', () => {
expect(rfc3339ToUnixNanoSince('2024-01-01T00:00:00.5Z')).toBe(
`${unix}.500000000`
);
});
it('truncates a fraction longer than 9 digits to nanosecond precision', () => {
expect(rfc3339ToUnixNanoSince('2024-01-01T00:00:00.1234567890123Z')).toBe(
`${unix}.123456789`
);
});
});