- Notifications
You must be signed in to change notification settings - Fork 1
Add session ID crypto, refactor chat memory, deduplication, simple analytics#21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
020bc46
fix(ingestion): reindex chunks on metadata drift
WilliamAGH b8be796
fix(health): prevent stuck Qdrant DOWN state
WilliamAGH 70a8b1c
refactor(chat): unify session state updates atomically
WilliamAGH de8de1d
fix(web): harden exception detail building for nulls
WilliamAGH 7851c46
fix(rate-limit): preserve failure streak counters
WilliamAGH 4f3966c
fix(embedding): align dimension defaults and hints
WilliamAGH 2fa2b02
fix(frontend): strengthen session ID generation
WilliamAGH 1a2e141
chore(format): apply spotless formatting leftovers
WilliamAGH bf29e08
test(frontend): deduplicate session test timer setup
WilliamAGH 5cb023c
feat(analytics): add Simple Analytics via Vite transformIndexHtml plugin
WilliamAGH ae6e4ce
fix(health): prevent checkInProgress stuck and startup race in Extern…
WilliamAGH fecd724
fix(web): extract session validation message constants in ChatController
WilliamAGH d036370
fix(ingestion): rename banned abbreviation doc to pageDocument in Chu…
WilliamAGH 36f5c63
refactor(ingestion): extract shared metadataText helper to DocumentFa…
WilliamAGH c967883
fix(chat): replace unused lambda param with underscore in ChatMemoryS…
WilliamAGH 60f0226
test(web): extract constants and rename generic variables in session …
WilliamAGH 8fe7868
test(health): add retry-gate and backoff progression tests for Extern…
WilliamAGH 2f990c2
test(ingestion): add Base64 metadata round-trip and drift detection t…
WilliamAGH 24261e3
chore(spotbugs): suppress CRLF_INJECTION_LOGS for ExternalServiceHealth
WilliamAGH File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' | ||
| import { generateSessionId } from './session' | ||
| describe('generateSessionId', () => { | ||
| beforeEach(() => { | ||
| vi.useFakeTimers() | ||
| vi.setSystemTime(new Date('2026-02-09T12:00:00.000Z')) | ||
| }) | ||
| afterEach(() => { | ||
| vi.useRealTimers() | ||
| vi.restoreAllMocks() | ||
| vi.unstubAllGlobals() | ||
| }) | ||
| it('uses crypto.randomUUID when available', () => { | ||
| vi.stubGlobal('crypto', { | ||
| randomUUID: () => 'uuid-test-value', | ||
| } as unknown as Crypto) | ||
| const sessionId = generateSessionId('chat') | ||
| expect(sessionId).toBe('chat-1770638400000-uuid-test-value') | ||
| }) | ||
| it('uses crypto.getRandomValues when randomUUID is unavailable', () => { | ||
| vi.stubGlobal('crypto', { | ||
| getRandomValues: (randomBytes: Uint8Array) => { | ||
| randomBytes.fill(15) | ||
| return randomBytes | ||
| }, | ||
| } as unknown as Crypto) | ||
| const sessionId = generateSessionId('chat') | ||
| const sessionParts = sessionId.split('-') | ||
| const randomSuffix = sessionParts[sessionParts.length - 1] | ||
| expect(randomSuffix).toHaveLength(32) | ||
| expect(/^[0-9a-f]+$/.test(randomSuffix)).toBe(true) | ||
| }) | ||
| it('falls back to padded Math.random output when crypto is unavailable', () => { | ||
| vi.stubGlobal('crypto', undefined) | ||
| vi.spyOn(Math, 'random').mockReturnValue(0) | ||
| const sessionId = generateSessionId('chat') | ||
| const sessionParts = sessionId.split('-') | ||
| const randomSuffix = sessionParts[sessionParts.length - 1] | ||
| expect(sessionId.endsWith('-')).toBe(false) | ||
| expect(randomSuffix).toHaveLength(12) | ||
| expect(randomSuffix).toBe('000000000000') | ||
| }) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2 src/main/java/com/williamcallahan/javachat/config/AppProperties.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3 src/main/java/com/williamcallahan/javachat/config/QdrantHealthIndicator.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 49 additions & 31 deletions
80 src/main/java/com/williamcallahan/javachat/service/ChatMemoryService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 22 additions & 6 deletions
28 src/main/java/com/williamcallahan/javachat/service/ChunkProcessingService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4 src/main/java/com/williamcallahan/javachat/service/DocsIngestionService.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15 src/main/java/com/williamcallahan/javachat/service/DocumentFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.