Skip to content

Bug: Indexed date is displayed thousands of years in the future #3603

Closed

Description

@yannickmonney

Indexed date is displayed thousands of years in the future

Severity: P2. Reproduced locally at 44e0dcf254975286c0e9dea443b5cd1ca6b23347.

Users cannot tell when source content was indexed or judge whether search is current. The same shared component affects Documents table/preview and Knowledge entries table/details.

Expected: The Indexed dialog displays the real completed indexing date in the viewer's locale/timezone.

Actual: The shared badge assumes epoch seconds although every current backend producer supplies epoch milliseconds, multiplying the timestamp twice.

Reproduction:

  1. Open the Indexed status badge on a document or knowledge entry that has completed indexing.
  2. For an indexing time of 2026-09-28T10:00:00.000Z, the backend stores and sends ragIndexedAt=1790589600000 (milliseconds).
  3. RagStatusBadge multiplies that value by 1000 before constructing Date; the formatter receives +058711-07-12T16:00:00.000Z. The Indexed dialog consequently shows year 58711 rather than 2026.

Source:

Local proof:

A fresh jsdom render of the actual RagStatusBadge with the current backend timestamp shape passed assertions that the formatter receives timestamp * 1000 and the dialog contains the expanded future date, not the 2026 date. Source tracing confirms Date.now() -> rag_indexed_at_ms -> unchanged document/knowledge-entry view -> indexedAt prop. Existing component tests passed but provide legacy second-unit fixtures.

it('interprets the current backend millisecond timestamp as seconds and displays year 58711', () => {
  vi.stubGlobal('fetch', vi.fn(() => { throw new Error('Unexpected network'); }));
  // indexUploadedFile writes Date.now(); both document views and knowledge-entry
  // listings pass rag_indexed_at_ms through unchanged as ragIndexedAt.
  const indexedAtMs = Date.parse('2026-09-28T10:00:00.000Z');
  render(<RagStatusBadge status="completed" indexedAt={indexedAtMs} documentId="fixture-doc" />);
  fireEvent.click(screen.getByRole('button'));
  const receivedDate = formatDate.mock.calls[0][0];
  expect(receivedDate.getTime()).toBe(indexedAtMs * 1000);
  expect(receivedDate.getUTCFullYear()).toBeGreaterThan(58000);
  expect(screen.getByRole('dialog')).toHaveTextContent(receivedDate.toISOString());
  expect(screen.getByRole('dialog')).not.toHaveTextContent('2026-09-28');
});

Frozen, test-specific command:

PATH=/Users/yannick/.npm/_npx/22f2fe8d8bc13000/node_modules/.bin:$PATH bunx vitest run --config /Users/yannick/.codex/notes/tale-100-findings/knowledge-proof/vitest.ui.config.ts indexed-date.test.tsx

Limits: Actual React component in jsdom; date formatting is replaced with an ISO formatter to expose the exact Date argument. No real browser or production interaction. Backend unit flow is verified from producer and projection source, not a live full-stack indexing job.

Dedup: Searched the 931-issue local catalog for indexing/RAG date/timestamp terms; no match. Related exclusions: #3142 closed Postgres-port audit ledger; title search result only; #2075 closed execution date-range end-day filter.

Acceptance: Use the shared epoch-millisecond contract at this display boundary. Regress with a current backend millisecond value in every affected badge surface, and keep missing-date behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions