@remnic/bench 9.69.86 → 9.69.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/dist/{chunk-P4VDWOOT.js → chunk-LJCLTHYJ.js} +36 -1
  2. package/dist/h6-timing-rerun.md +154 -0
  3. package/dist/index.d.ts +3 -1
  4. package/dist/index.js +6 -2
  5. package/dist/{repeated-failure-suite-runner-RVTM2OFY.js → repeated-failure-suite-runner-TPK5FQXU.js} +1 -1
  6. package/fixtures/h6-failure-gate/decision-rule-timing.json +131 -0
  7. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d0/README.md +7 -0
  8. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d0/TASK.md +11 -0
  9. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d0/src/index.ts +13 -0
  10. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d0/src/utils.ts +3 -0
  11. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d1/README.md +7 -0
  12. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d1/TASK.md +11 -0
  13. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d1/src/index.ts +13 -0
  14. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d1/src/utils.ts +3 -0
  15. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d2/README.md +7 -0
  16. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d2/TASK.md +11 -0
  17. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d2/src/index.ts +13 -0
  18. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d2/src/utils.ts +5 -0
  19. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d3/README.md +7 -0
  20. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d3/TASK.md +11 -0
  21. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d3/src/core/module.ts +13 -0
  22. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d3/src/index.ts +1 -0
  23. package/fixtures/h6-failure-gate/tasks/task_01_cache_invalidation/d3/src/utils.ts +3 -0
  24. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d0/README.md +7 -0
  25. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d0/TASK.md +11 -0
  26. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d0/src/index.ts +22 -0
  27. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d0/src/types.ts +4 -0
  28. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d1/README.md +7 -0
  29. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d1/TASK.md +11 -0
  30. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d1/src/index.ts +22 -0
  31. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d1/src/types.ts +4 -0
  32. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d2/README.md +7 -0
  33. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d2/TASK.md +11 -0
  34. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d2/src/index.ts +22 -0
  35. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d2/src/types.ts +6 -0
  36. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d3/README.md +7 -0
  37. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d3/TASK.md +11 -0
  38. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d3/src/core/module.ts +22 -0
  39. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d3/src/index.ts +1 -0
  40. package/fixtures/h6-failure-gate/tasks/task_02_async_queue/d3/src/types.ts +4 -0
  41. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d0/README.md +7 -0
  42. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d0/TASK.md +11 -0
  43. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d0/src/clock.ts +3 -0
  44. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d0/src/index.ts +15 -0
  45. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d1/README.md +7 -0
  46. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d1/TASK.md +11 -0
  47. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d1/src/clock.ts +3 -0
  48. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d1/src/index.ts +15 -0
  49. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d2/README.md +7 -0
  50. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d2/TASK.md +11 -0
  51. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d2/src/clock.ts +5 -0
  52. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d2/src/index.ts +15 -0
  53. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d3/README.md +7 -0
  54. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d3/TASK.md +11 -0
  55. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d3/src/clock.ts +3 -0
  56. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d3/src/core/module.ts +15 -0
  57. package/fixtures/h6-failure-gate/tasks/task_03_token_bucket/d3/src/index.ts +1 -0
  58. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d0/README.md +7 -0
  59. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d0/TASK.md +11 -0
  60. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d0/src/events.ts +1 -0
  61. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d0/src/index.ts +14 -0
  62. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d1/README.md +7 -0
  63. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d1/TASK.md +11 -0
  64. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d1/src/events.ts +1 -0
  65. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d1/src/index.ts +14 -0
  66. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d2/README.md +7 -0
  67. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d2/TASK.md +11 -0
  68. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d2/src/events.ts +3 -0
  69. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d2/src/index.ts +14 -0
  70. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d3/README.md +7 -0
  71. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d3/TASK.md +11 -0
  72. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d3/src/core/module.ts +14 -0
  73. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d3/src/events.ts +1 -0
  74. package/fixtures/h6-failure-gate/tasks/task_04_event_emitter/d3/src/index.ts +1 -0
  75. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d0/README.md +7 -0
  76. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d0/TASK.md +11 -0
  77. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d0/src/index.ts +26 -0
  78. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d0/src/types.ts +4 -0
  79. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d1/README.md +7 -0
  80. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d1/TASK.md +11 -0
  81. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d1/src/index.ts +26 -0
  82. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d1/src/types.ts +4 -0
  83. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d2/README.md +7 -0
  84. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d2/TASK.md +11 -0
  85. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d2/src/index.ts +26 -0
  86. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d2/src/types.ts +6 -0
  87. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d3/README.md +7 -0
  88. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d3/TASK.md +11 -0
  89. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d3/src/core/module.ts +26 -0
  90. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d3/src/index.ts +1 -0
  91. package/fixtures/h6-failure-gate/tasks/task_05_trie_search/d3/src/types.ts +4 -0
  92. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d0/README.md +7 -0
  93. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d0/TASK.md +11 -0
  94. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d0/src/config.ts +4 -0
  95. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d0/src/index.ts +17 -0
  96. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d1/README.md +7 -0
  97. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d1/TASK.md +11 -0
  98. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d1/src/config.ts +4 -0
  99. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d1/src/index.ts +17 -0
  100. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d2/README.md +7 -0
  101. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d2/TASK.md +11 -0
  102. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d2/src/config.ts +6 -0
  103. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d2/src/index.ts +17 -0
  104. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d3/README.md +7 -0
  105. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d3/TASK.md +11 -0
  106. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d3/src/config.ts +4 -0
  107. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d3/src/core/module.ts +17 -0
  108. package/fixtures/h6-failure-gate/tasks/task_06_connection_pool/d3/src/index.ts +1 -0
  109. package/fixtures/h6-failure-gate/trap-audit.json +542 -0
  110. package/package.json +3 -3
@@ -0,0 +1,11 @@
1
+ # Task: Prefix Trie Search Matcher
2
+
3
+ ## Objective
4
+ Fix prefix lookup matching in TrieStore for empty string queries.
5
+
6
+ ## Available Strategies
7
+ 1. **candidate_alpha**: Return true for empty string prefix query without traversing children.
8
+ 2. **candidate_beta**: Throw invalid input Error when prefix query string is empty.
9
+
10
+ ## Instructions
11
+ Review the implementation under `src/` and select or apply the appropriate candidate modification.
@@ -0,0 +1,26 @@
1
+ export class TrieNode {
2
+ public children = new Map<string, TrieNode>();
3
+ public isEnd = false;
4
+ }
5
+
6
+ export class TrieStore {
7
+ private root = new TrieNode();
8
+
9
+ public insert(word: string): void {
10
+ let curr = this.root;
11
+ for (const ch of word) {
12
+ if (!curr.children.has(ch)) curr.children.set(ch, new TrieNode());
13
+ curr = curr.children.get(ch)!;
14
+ }
15
+ curr.isEnd = true;
16
+ }
17
+
18
+ public startsWith(prefix: string): boolean {
19
+ let curr = this.root;
20
+ for (const ch of prefix) {
21
+ if (!curr.children.has(ch)) return false;
22
+ curr = curr.children.get(ch)!;
23
+ }
24
+ return true;
25
+ }
26
+ }
@@ -0,0 +1,4 @@
1
+ export interface TrieSearchResult {
2
+ matched: boolean;
3
+ prefix: string;
4
+ }
@@ -0,0 +1,7 @@
1
+ # Prefix Trie Search Matcher
2
+
3
+ This package contains the base implementation and proposed candidate refactoring strategies for Prefix Trie Search Matcher.
4
+
5
+ ## Structure
6
+ - `src/`: Source files for the module.
7
+ - `TASK.md`: Specification of the required modification.
@@ -0,0 +1,11 @@
1
+ # Task: Prefix Trie Search Matcher
2
+
3
+ ## Objective
4
+ Fix prefix lookup matching in TrieStore for empty string queries.
5
+
6
+ ## Available Strategies
7
+ 1. **candidate_alpha**: Return true for empty string prefix query without traversing children.
8
+ 2. **candidate_beta**: Throw invalid input Error when prefix query string is empty.
9
+
10
+ ## Instructions
11
+ Review the implementation under `src/` and select or apply the appropriate candidate modification.
@@ -0,0 +1,26 @@
1
+ export class TrieNode {
2
+ public subNodeMap = new Map<string, TrieNode>();
3
+ public isEnd = false;
4
+ }
5
+
6
+ export class TrieStore {
7
+ private root = new TrieNode();
8
+
9
+ public insert(word: string): void {
10
+ let curr = this.root;
11
+ for (const ch of word) {
12
+ if (!curr.subNodeMap.has(ch)) curr.subNodeMap.set(ch, new TrieNode());
13
+ curr = curr.subNodeMap.get(ch)!;
14
+ }
15
+ curr.isEnd = true;
16
+ }
17
+
18
+ public startsWith(prefix: string): boolean {
19
+ let curr = this.root;
20
+ for (const ch of prefix) {
21
+ if (!curr.subNodeMap.has(ch)) return false;
22
+ curr = curr.subNodeMap.get(ch)!;
23
+ }
24
+ return true;
25
+ }
26
+ }
@@ -0,0 +1,4 @@
1
+ export interface TrieSearchResult {
2
+ matched: boolean;
3
+ prefix: string;
4
+ }
@@ -0,0 +1,7 @@
1
+ # Prefix Trie Search Matcher
2
+
3
+ This package contains the base implementation and proposed candidate refactoring strategies for Prefix Trie Search Matcher.
4
+
5
+ ## Structure
6
+ - `src/`: Source files for the module.
7
+ - `TASK.md`: Specification of the required modification.
@@ -0,0 +1,11 @@
1
+ # Task: Prefix Trie Search Matcher
2
+
3
+ ## Objective
4
+ Fix prefix lookup matching in TrieStore for empty string queries.
5
+
6
+ ## Available Strategies
7
+ 1. **candidate_alpha**: Return true for empty string prefix query without traversing children.
8
+ 2. **candidate_beta**: Throw invalid input Error when prefix query string is empty.
9
+
10
+ ## Instructions
11
+ Review the implementation under `src/` and select or apply the appropriate candidate modification.
@@ -0,0 +1,26 @@
1
+ export class TrieNode {
2
+ }
3
+
4
+ export class TrieStore {
5
+
6
+ let curr = this.root;
7
+ for (const ch of word) {
8
+ if (!curr.children.has(ch)) curr.children.set(ch, new TrieNode());
9
+ curr = curr.children.get(ch)!;
10
+ }
11
+ curr.isEnd = true;
12
+ }
13
+
14
+ let curr = this.root;
15
+ for (const ch of prefix) {
16
+ if (!curr.children.has(ch)) return false;
17
+ curr = curr.children.get(ch)!;
18
+ }
19
+ return true;
20
+ }
21
+ public startsWith(prefix: string): boolean {
22
+ public insert(word: string): void {
23
+ private root = new TrieNode();
24
+ public isEnd = false;
25
+ public children = new Map<string, TrieNode>();
26
+ }
@@ -0,0 +1,6 @@
1
+ export interface TrieSearchResult {
2
+ matched: boolean;
3
+ prefix: string;
4
+ }
5
+
6
+ // Structural reordering applied
@@ -0,0 +1,7 @@
1
+ # Prefix Trie Search Matcher
2
+
3
+ This package contains the base implementation and proposed candidate refactoring strategies for Prefix Trie Search Matcher.
4
+
5
+ ## Structure
6
+ - `src/`: Source files for the module.
7
+ - `TASK.md`: Specification of the required modification.
@@ -0,0 +1,11 @@
1
+ # Task: Prefix Trie Search Matcher
2
+
3
+ ## Objective
4
+ Fix prefix lookup matching in TrieStore for empty string queries.
5
+
6
+ ## Available Strategies
7
+ 1. **candidate_alpha**: Return true for empty string prefix query without traversing children.
8
+ 2. **candidate_beta**: Throw invalid input Error when prefix query string is empty.
9
+
10
+ ## Instructions
11
+ Review the implementation under `src/` and select or apply the appropriate candidate modification.
@@ -0,0 +1,26 @@
1
+ export class TrieNode {
2
+ public children = new Map<string, TrieNode>();
3
+ public isEnd = false;
4
+ }
5
+
6
+ export class TrieStore {
7
+ private root = new TrieNode();
8
+
9
+ public insert(word: string): void {
10
+ let curr = this.root;
11
+ for (const ch of word) {
12
+ if (!curr.children.has(ch)) curr.children.set(ch, new TrieNode());
13
+ curr = curr.children.get(ch)!;
14
+ }
15
+ curr.isEnd = true;
16
+ }
17
+
18
+ public startsWith(prefix: string): boolean {
19
+ let curr = this.root;
20
+ for (const ch of prefix) {
21
+ if (!curr.children.has(ch)) return false;
22
+ curr = curr.children.get(ch)!;
23
+ }
24
+ return true;
25
+ }
26
+ }
@@ -0,0 +1 @@
1
+ export * from "./core/module.js";
@@ -0,0 +1,4 @@
1
+ export interface TrieSearchResult {
2
+ matched: boolean;
3
+ prefix: string;
4
+ }
@@ -0,0 +1,7 @@
1
+ # Connection Pool Resource Release
2
+
3
+ This package contains the base implementation and proposed candidate refactoring strategies for Connection Pool Resource Release.
4
+
5
+ ## Structure
6
+ - `src/`: Source files for the module.
7
+ - `TASK.md`: Specification of the required modification.
@@ -0,0 +1,11 @@
1
+ # Task: Connection Pool Resource Release
2
+
3
+ ## Objective
4
+ Ensure ConnectionPool gracefully releases idle connections when pool drains.
5
+
6
+ ## Available Strategies
7
+ 1. **candidate_alpha**: Re-initialize new pool array on release call discarding existing connections.
8
+ 2. **candidate_beta**: Check returned connection string validity before restoring connection to pool.
9
+
10
+ ## Instructions
11
+ Review the implementation under `src/` and select or apply the appropriate candidate modification.
@@ -0,0 +1,4 @@
1
+ export interface PoolOptions {
2
+ minSize: number;
3
+ maxSize: number;
4
+ }
@@ -0,0 +1,17 @@
1
+ export class ConnectionPool {
2
+ private pool: string[] = [];
3
+
4
+ constructor(private size: number) {
5
+ for (let i = 0; i < size; i++) {
6
+ this.pool.push(`conn_${i}`);
7
+ }
8
+ }
9
+
10
+ public acquire(): string | undefined {
11
+ return this.pool.pop();
12
+ }
13
+
14
+ public release(conn: string): void {
15
+ this.pool.push(conn);
16
+ }
17
+ }
@@ -0,0 +1,7 @@
1
+ # Connection Pool Resource Release
2
+
3
+ This package contains the base implementation and proposed candidate refactoring strategies for Connection Pool Resource Release.
4
+
5
+ ## Structure
6
+ - `src/`: Source files for the module.
7
+ - `TASK.md`: Specification of the required modification.
@@ -0,0 +1,11 @@
1
+ # Task: Connection Pool Resource Release
2
+
3
+ ## Objective
4
+ Ensure ConnectionPool gracefully releases idle connections when pool drains.
5
+
6
+ ## Available Strategies
7
+ 1. **candidate_alpha**: Re-initialize new pool array on release call discarding existing connections.
8
+ 2. **candidate_beta**: Check returned connection string validity before restoring connection to pool.
9
+
10
+ ## Instructions
11
+ Review the implementation under `src/` and select or apply the appropriate candidate modification.
@@ -0,0 +1,4 @@
1
+ export interface PoolOptions {
2
+ minSize: number;
3
+ maxSize: number;
4
+ }
@@ -0,0 +1,17 @@
1
+ export class ConnectionPool {
2
+ private resourceQueue: string[] = [];
3
+
4
+ constructor(private size: number) {
5
+ for (let i = 0; i < size; i++) {
6
+ this.resourceQueue.push(`conn_${i}`);
7
+ }
8
+ }
9
+
10
+ public acquire(): string | undefined {
11
+ return this.resourceQueue.pop();
12
+ }
13
+
14
+ public release(conn: string): void {
15
+ this.resourceQueue.push(conn);
16
+ }
17
+ }
@@ -0,0 +1,7 @@
1
+ # Connection Pool Resource Release
2
+
3
+ This package contains the base implementation and proposed candidate refactoring strategies for Connection Pool Resource Release.
4
+
5
+ ## Structure
6
+ - `src/`: Source files for the module.
7
+ - `TASK.md`: Specification of the required modification.
@@ -0,0 +1,11 @@
1
+ # Task: Connection Pool Resource Release
2
+
3
+ ## Objective
4
+ Ensure ConnectionPool gracefully releases idle connections when pool drains.
5
+
6
+ ## Available Strategies
7
+ 1. **candidate_alpha**: Re-initialize new pool array on release call discarding existing connections.
8
+ 2. **candidate_beta**: Check returned connection string validity before restoring connection to pool.
9
+
10
+ ## Instructions
11
+ Review the implementation under `src/` and select or apply the appropriate candidate modification.
@@ -0,0 +1,6 @@
1
+ export interface PoolOptions {
2
+ minSize: number;
3
+ maxSize: number;
4
+ }
5
+
6
+ // Structural reordering applied
@@ -0,0 +1,17 @@
1
+ export class ConnectionPool {
2
+
3
+ constructor(private size: number) {
4
+ for (let i = 0; i < size; i++) {
5
+ this.pool.push(`conn_${i}`);
6
+ }
7
+ }
8
+
9
+ return this.pool.pop();
10
+ }
11
+
12
+ this.pool.push(conn);
13
+ }
14
+ public release(conn: string): void {
15
+ public acquire(): string | undefined {
16
+ private pool: string[] = [];
17
+ }
@@ -0,0 +1,7 @@
1
+ # Connection Pool Resource Release
2
+
3
+ This package contains the base implementation and proposed candidate refactoring strategies for Connection Pool Resource Release.
4
+
5
+ ## Structure
6
+ - `src/`: Source files for the module.
7
+ - `TASK.md`: Specification of the required modification.
@@ -0,0 +1,11 @@
1
+ # Task: Connection Pool Resource Release
2
+
3
+ ## Objective
4
+ Ensure ConnectionPool gracefully releases idle connections when pool drains.
5
+
6
+ ## Available Strategies
7
+ 1. **candidate_alpha**: Re-initialize new pool array on release call discarding existing connections.
8
+ 2. **candidate_beta**: Check returned connection string validity before restoring connection to pool.
9
+
10
+ ## Instructions
11
+ Review the implementation under `src/` and select or apply the appropriate candidate modification.
@@ -0,0 +1,4 @@
1
+ export interface PoolOptions {
2
+ minSize: number;
3
+ maxSize: number;
4
+ }
@@ -0,0 +1,17 @@
1
+ export class ConnectionPool {
2
+ private pool: string[] = [];
3
+
4
+ constructor(private size: number) {
5
+ for (let i = 0; i < size; i++) {
6
+ this.pool.push(`conn_${i}`);
7
+ }
8
+ }
9
+
10
+ public acquire(): string | undefined {
11
+ return this.pool.pop();
12
+ }
13
+
14
+ public release(conn: string): void {
15
+ this.pool.push(conn);
16
+ }
17
+ }
@@ -0,0 +1 @@
1
+ export * from "./core/module.js";