MapColonies / MapColonies/config

The Foundation: Continuous Polling & Jitter Loop

Open
#125 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.