MapColonies / MapColonies/config
The Foundation: Continuous Polling & Jitter Loop
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
### Description:
Implement the ChangeDetector module and the foundational RolloutStateMachine. This slice establishes the core continuous polling mechanism using a recursive setTimeout loop that checks for configuration changes via If-None-Match (ETag) HTTP headers. To prevent cluster thundering herds, the polling interval must apply a +/- 15% randomized jitter. Update the BaseOptions API contract to accept pollIntervalMs, disableHotReload, and the onChange callback. When a change (200 OK) is detected, the SDK should deliver the payload directly to the onChange callback and update its internal ETag state.
### Acceptance criteria
- [ ] BaseOptions accepts the new parameters (pollIntervalMs, disableHotReload, onChange).
- [ ] Passing disableHotReload: true completely disables the polling loop.
- [ ] The polling mechanism uses recursive setTimeout with +/- 15% randomized jitter (verified via vi.useFakeTimers()).
- [ ] Detecting a 200 OK response successfully triggers the onChange callback with the new configuration.
### Blocked by:
None - can start immediately
User stories covered: 1, 2, 3, 10
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the ChangeDetector, RolloutStateMachine, and BaseOptions entry points, then trace the existing configuration request path. Use vi.useFakeTimers() to verify recursive polling, jitter, and the disabled-hot-reload case; done means the onChange callback receives a 200 OK payload and ETag state updates.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100