Automation

Configuration drift

Compare two flat configuration maps before reconciling a service.

In production

Desired versus actual config drift is how silent misconfig ships. Missing keys are drift too.

What it must return

Report keys that differ or exist on only one side, using the structure the examples show.

  • Return sorted keys that are missing on either side or have unequal JSON scalar values. Missing is different from a present None. Values have consistent types when a key exists in both maps.
  • Do not mutate input values. Use the Python standard library only.

Edge cases

  • Inspect the union of keys.
  • Membership checks come before value compares.
  • Do not mutate either mapping.

Signature

config_drift(desired, actual)

Hints

  1. Second hint

  2. A partial sketch

The reference solution opens after the last hint.

solution.py · Python

Loading editor…

Changed and extra

desired

{
  "replicas": 3,
  "region": "us"
}

actual

{
  "replicas": 2,
  "region": "us",
  "debug": true
}

Expected

[
  "debug",
  "replicas"
]

Each run uses a fresh Python runtime in this browser, with a 3-second limit and a Stop button. The first run downloads the runtime. 0 of 8 in Automation passed in Python on this device.

Next: Duplicate webhook deliveries