Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
022eeef
refactor: use sharded WAL
BioPhoton Jan 27, 2026
a66acf4
refactor: wip
BioPhoton Jan 27, 2026
a4eb05c
Merge branch 'refs/heads/main' into feat/utils/sharded-profiling
BioPhoton Jan 28, 2026
6d9d5c1
refactor: wip
BioPhoton Jan 28, 2026
6387ccc
refactor: wip
BioPhoton Jan 28, 2026
02b9da8
refactor: wip
BioPhoton Jan 28, 2026
6b638d9
refactor: wip
BioPhoton Jan 28, 2026
cdb745b
refactor: wip
BioPhoton Jan 28, 2026
ed64102
refactor: wip
BioPhoton Jan 28, 2026
4950ca0
refactor: wip
BioPhoton Jan 30, 2026
0a37c3c
refactor: wip
BioPhoton Jan 31, 2026
af5b8d2
refactor: wip
BioPhoton Jan 31, 2026
35063f7
refactor: wip
BioPhoton Jan 31, 2026
f958a3e
Merge branch 'refs/heads/main' into feat/utils/sharded-profiling
BioPhoton Jan 31, 2026
13529fc
refactor: wip
BioPhoton Jan 31, 2026
8c3171e
refactor: wip
BioPhoton Jan 31, 2026
5c644c2
refactor: wip
BioPhoton Jan 31, 2026
96ccaa9
refactor: wip
BioPhoton Jan 31, 2026
c726123
refactor: wip
BioPhoton Jan 31, 2026
bb150e3
refactor: wip
BioPhoton Jan 31, 2026
ba87d94
refactor: wip
BioPhoton Jan 31, 2026
4f01e32
refactor: wip
BioPhoton Jan 31, 2026
b74bdc2
refactor: wip
BioPhoton Jan 31, 2026
3ba8619
refactor: wip
BioPhoton Jan 31, 2026
9ed836c
refactor: wip
BioPhoton Jan 31, 2026
d8978e1
refactor: wip
BioPhoton Jan 31, 2026
1321cbe
refactor: wip
BioPhoton Jan 31, 2026
f44086c
refactor: wip
BioPhoton Jan 31, 2026
6567601
refactor: wip
BioPhoton Jan 31, 2026
6a83e93
refactor: wip
BioPhoton Jan 31, 2026
9fce5e5
refactor: wip
BioPhoton Jan 31, 2026
b801d91
refactor: wip
BioPhoton Jan 31, 2026
b16ded4
refactor: wip
BioPhoton Jan 31, 2026
6e3445a
refactor: wip
BioPhoton Jan 31, 2026
76f4bca
refactor: wip
BioPhoton Feb 1, 2026
beef91c
Update profiler.md
BioPhoton Feb 1, 2026
e03a7ac
Update profiler-node.ts
BioPhoton Feb 1, 2026
7dac14c
Update packages/utils/docs/profiler.md
BioPhoton Feb 1, 2026
2c97026
refactor: wip
BioPhoton Feb 1, 2026
920b233
refactor: wip
BioPhoton Feb 1, 2026
7512bd5
refactor: wip
BioPhoton Feb 1, 2026
202134d
refactor: wip
BioPhoton Feb 1, 2026
46f69d5
refactor: wip
BioPhoton Feb 1, 2026
244dca8
refactor: wip
BioPhoton Feb 1, 2026
6bee2c7
refactor: wip
BioPhoton Feb 1, 2026
55b26fe
refactor: wip
BioPhoton Feb 1, 2026
cc7b98b
refactor: wip
BioPhoton Feb 1, 2026
e4f41d8
refactor: wip
BioPhoton Feb 1, 2026
a85bf52
refactor: wip
BioPhoton Feb 1, 2026
b5a0c7b
refactor: wip
BioPhoton Feb 1, 2026
b41e6c1
refactor: wip
BioPhoton Feb 1, 2026
6b200cc
Update packages/utils/src/lib/performance-observer.ts
BioPhoton Feb 1, 2026
956fdca
Update packages/utils/src/lib/errors.ts
BioPhoton Feb 1, 2026
243e105
fix(utils): add path traversal validation for ShardedWal groupId (#1232)
Copilot Feb 1, 2026
9daa856
docs(utils): clarify buffered mode implementation in PerformanceObser…
Copilot Feb 2, 2026
df0a281
refactor: add flag to process buffered events only once
BioPhoton Feb 3, 2026
54195ec
refactor: refactor sharded wal to handle coordinator
BioPhoton Feb 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: wip
  • Loading branch information
BioPhoton committed Jan 28, 2026
commit 6387ccc274cdd340a41c316d8d450037c108a954
41 changes: 21 additions & 20 deletions packages/utils/src/lib/process-id.unit.test.ts
Original file line number Diff line number Diff line change
@@ -1,46 +1,43 @@
import {
WAL_ID_PATTERNS,
getUniqueReadableInstanceId,
getUniqueRunId,
} from './process-id.js';
import { WAL_ID_PATTERNS, getUniqueTimeId } from './process-id.js';
import { getShardId } from './wal-sharded.js';

describe('getUniqueReadableInstanceId', () => {
describe('getShardId (formerly getUniqueReadableInstanceId)', () => {
it('should generate shard ID with readable timestamp', () => {
const result = getUniqueReadableInstanceId();
const result = getShardId();

expect(result).toMatch(WAL_ID_PATTERNS.INSTANCE_ID);
expect(result).toStartWith('20231114-221320-000.');
});

it('should generate different shard IDs for different calls', () => {
const result1 = getUniqueReadableInstanceId();
const result2 = getUniqueReadableInstanceId();
const result1 = getShardId();
const result2 = getShardId();

expect(result1).not.toBe(result2);
expect(result1).toStartWith('20231114-221320-000.');
expect(result2).toStartWith('20231114-221320-000.');
});

it('should handle zero values', () => {
const result = getUniqueReadableInstanceId();
const result = getShardId();
expect(result).toStartWith('20231114-221320-000.');
});

it('should handle negative timestamps', () => {
const result = getUniqueReadableInstanceId();
const result = getShardId();

expect(result).toStartWith('20231114-221320-000.');
});

it('should handle large timestamps', () => {
const result = getUniqueReadableInstanceId();
const result = getShardId();

expect(result).toStartWith('20231114-221320-000.');
});

it('should generate incrementing counter', () => {
const result1 = getUniqueReadableInstanceId();
const result2 = getUniqueReadableInstanceId();
const result1 = getShardId();
const result2 = getShardId();

const parts1 = result1.split('.');
const parts2 = result2.split('.');
Expand All @@ -53,18 +50,22 @@ describe('getUniqueReadableInstanceId', () => {
});
});

describe('getUniqueRunId', () => {
describe('getUniqueTimeId (formerly getUniqueRunId)', () => {
it('should work with mocked timeOrigin', () => {
const result = getUniqueRunId();
const result = getUniqueTimeId();

expect(result).toBe('20231114-221320-000');
expect(result).toMatch(WAL_ID_PATTERNS.GROUP_ID);
});

it('should be idempotent within same process', () => {
const result1 = getUniqueRunId();
const result2 = getUniqueRunId();
it('should generate new ID on each call (not idempotent)', () => {
const result1 = getUniqueTimeId();
const result2 = getUniqueTimeId();

expect(result1).toBe(result2);
// Note: getUniqueTimeId is not idempotent - it generates a new ID each call
// based on current time, so results will be different
expect(result1).toMatch(WAL_ID_PATTERNS.GROUP_ID);
expect(result2).toMatch(WAL_ID_PATTERNS.GROUP_ID);
// They may be the same if called within the same millisecond, but generally different
});
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{"cat":"blink.user_timing","ph":"i","name":"write-test:test-operation:start","pid":10001,"tid":1,"ts":1700000005000000,"args":{"detail":"{\"devtools\":{\"track\":\"Test\",\"dataType\":\"track-entry\"}}"}}
{"cat":"blink.user_timing","ph":"b","name":"write-test:test-operation","id2":{"local":"0x1"},"pid":10001,"tid":1,"ts":1700000005000001,"args":{"data":{"detail":"{\"devtools\":{\"track\":\"Test\",\"dataType\":\"track-entry\"}}"}}}
{"cat":"blink.user_timing","ph":"e","name":"write-test:test-operation","id2":{"local":"0x1"},"pid":10001,"tid":1,"ts":1700000005000002,"args":{"data":{"detail":"{\"devtools\":{\"track\":\"Test\",\"dataType\":\"track-entry\"}}"}}}
{"cat":"blink.user_timing","ph":"i","name":"write-test:test-operation:end","pid":10001,"tid":1,"ts":1700000005000003,"args":{"detail":"{\"devtools\":{\"track\":\"Test\",\"dataType\":\"track-entry\"}}"}}
{"cat":"blink.user_timing","ph":"i","name":"write-test:test-operation:start","pid":10001,"tid":1,"ts":1700000005000000,"args":{"detail":{"devtools":{"track":"Test","dataType":"track-entry"}}}}
{"cat":"blink.user_timing","ph":"b","name":"write-test:test-operation","id2":{"local":"0x1"},"pid":10001,"tid":1,"ts":1700000005000001,"args":{"data":{"detail":{"devtools":{"track":"Test","dataType":"track-entry"}}}}}
{"cat":"blink.user_timing","ph":"e","name":"write-test:test-operation","id2":{"local":"0x1"},"pid":10001,"tid":1,"ts":1700000005000002,"args":{"data":{"detail":{"devtools":{"track":"Test","dataType":"track-entry"}}}}}
{"cat":"blink.user_timing","ph":"i","name":"write-test:test-operation:end","pid":10001,"tid":1,"ts":1700000005000003,"args":{"detail":{"devtools":{"track":"Test","dataType":"track-entry"}}}}
299 changes: 0 additions & 299 deletions packages/utils/src/lib/profiler/folder.int.test.ts

This file was deleted.

Loading