Skip to content

Commit 3267655

Browse files
docs(frontend): note LazyMap has() LRU caveat + BSL headers on util tests (review feedback)
- LazyMap: document that only get() refreshes LRU recency, not has(). - Add the BSL copyright header to bounded-array.test.ts and lazy-map.test.ts for consistency with the other added test files. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent ad2b4ac commit 3267655

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

frontend/src/utils/bounded-array.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/**
2+
* Copyright 2026 Redpanda Data, Inc.
3+
*
4+
* Use of this software is governed by the Business Source License
5+
* included in the file https://github.com/redpanda-data/redpanda/blob/dev/licenses/bsl.md
6+
*
7+
* As of the Change Date specified in that file, in accordance with
8+
* the Business Source License, use of this software will be governed
9+
* by the Apache License, Version 2.0
10+
*/
11+
112
import { describe, expect, test } from 'vitest';
213

314
import { boundedAppend, pruneMapToKeys, trimToLast } from './bounded-array';

frontend/src/utils/lazy-map.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
/**
2+
* Copyright 2026 Redpanda Data, Inc.
3+
*
4+
* Use of this software is governed by the Business Source License
5+
* included in the file https://github.com/redpanda-data/redpanda/blob/dev/licenses/bsl.md
6+
*
7+
* As of the Change Date specified in that file, in accordance with
8+
* the Business Source License, use of this software will be governed
9+
* by the Apache License, Version 2.0
10+
*/
11+
112
import { describe, expect, test } from 'vitest';
213

314
import { LazyMap } from './lazy-map';

frontend/src/utils/lazy-map.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class LazyMap<K, V> extends Map<K, V> {
1717
* @param defaultCreate factory for missing values.
1818
* @param maxSize when set, the map behaves as a bounded LRU cache: accessing a key marks it
1919
* most-recently-used and inserting beyond `maxSize` evicts the least-recently-used entry.
20-
* Unbounded when omitted (original behaviour).
20+
* Recency is refreshed by `get()` only — `has()` does not bump it. Unbounded when omitted.
2121
*/
2222
constructor(defaultCreate: (key: K) => V, maxSize?: number) {
2323
super();

0 commit comments

Comments
 (0)