Skip to content

Commit d0de8ff

Browse files
committed
refactor(config): move resolveDynamicPoolBounds below moduleName
Place the resolver helper after the moduleName constant, matching the ConfigurationMigrations/ErrorUtils convention (imports → moduleName → helpers/types → public API). No behavior change. Add a near-ceiling acceptance test: poolMinSize = MAX_SAFE_INTEGER - 1 derives a safe maximum of MAX_SAFE_INTEGER.
1 parent dfb8139 commit d0de8ff

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

‎src/utils/ConfigurationValidation.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import { configurationLogPrefix } from './ConfigurationUtils.js'
2323
import { formatFieldErrorsSummary, mapZodIssuesToFieldErrors } from './FieldError.js'
2424
import { assertIsJsonObject, clone, isEmpty, isNotEmptyArray } from './Utils.js'
2525

26+
const moduleName = 'ConfigurationValidation'
27+
2628
/**
2729
* Resolve the pool bounds of a dynamic-pool worker configuration.
2830
* A dynamic pool needs both bounds strictly ordered (min < max), and
@@ -108,8 +110,6 @@ const resolveDynamicPoolBounds = (
108110
return worker
109111
}
110112

111-
const moduleName = 'ConfigurationValidation'
112-
113113
/**
114114
* Phase of the validation pipeline that produced a failure.
115115
* - `remap`: deprecated-key sweep (collisions, non-object intermediates)

‎tests/utils/ConfigurationValidation.test.ts‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,21 @@ await describe('ConfigurationValidation', async () => {
728728
)
729729
})
730730

731+
await it('should derive a safe maximum from a minimum at the safe-integer ceiling', () => {
732+
const parsed = buildMinimalConfiguration({
733+
worker: {
734+
poolMinSize: Number.MAX_SAFE_INTEGER - 1,
735+
processType: 'dynamicPool',
736+
},
737+
})
738+
const result = validateConfiguration(parsed, 'bounds-near-ceiling.json')
739+
const worker = result.worker
740+
assert.ok(worker)
741+
assert.strictEqual(worker.poolMinSize, Number.MAX_SAFE_INTEGER - 1)
742+
assert.strictEqual(worker.poolMaxSize, Number.MAX_SAFE_INTEGER)
743+
assert.ok(Number.isSafeInteger(worker.poolMaxSize))
744+
})
745+
731746
await it('should derive the maximum from a minimum above the CPU default', () => {
732747
const min = DEFAULT_POOL_MAX_SIZE + 1
733748
const parsed = buildMinimalConfiguration({

0 commit comments

Comments
 (0)