#314 Forward deployed engineer interviews 5.9 min
One Codebase, Many Customers: Config Without Leaks
Customer B got customer A's webhook address and secret reference. The bug was one line.
Run both loaders
Copy the code folder first. Run python run.py. Find the lines for the private copy and the shared defaults. You should see 0 leaked settings for the private copy, 8 for the shared defaults, and the defaults themselves now saying region: us-east.
A hint
Look at which customers have leaks in the list.
Fix the shared loader
In loader.py, in load_shared, change merge(DEFAULTS, CUSTOMERS[name]) to merge(deepcopy(DEFAULTS), CUSTOMERS[name]). Predict the new leak counts, then run python run.py. With this change both loaders show 0 leaked settings and the defaults still say eu-west. What did the one change do?
A hint
That makes load_shared the same as load_safe.
Try a shallow copy
Restore loader.py, then in load_shared change merge(DEFAULTS, CUSTOMERS[name]) to merge(dict(DEFAULTS), CUSTOMERS[name]). Predict how many settings leak, and whether the defaults say us-east at the end, then run it. With this change the shared loader leaks 5 settings and the defaults say eu-west. Why do some settings still leak? Then restore loader.py to merge(DEFAULTS, CUSTOMERS[name]) in load_shared, because the next exercise needs the original.
A hint
A shallow copy only shares the nested objects.
Change the load order
In run.py swap the two entries in the for loop tuple so that load_shared comes first and load_safe second. Predict what the private copy loader reports now, then run it. With this change the shared loader still leaks 8 settings, but the private copy loader leaks 12. What does that say about testing in one order only?
A hint
The defaults are already changed by the time the safe loader starts.
These tasks are for you to try on your own machine. Nothing is checked or saved.
What this does not show
Made-up customers and settings; secrets are only reference names. One kind of leak (a shared default that is changed), one load order, safe loader first. The check only compares settings that exist in the defaults, and the expected values are built by the same copy and merge.
Up next in Forward deployed engineer interviews
More in Forward deployed engineer interviews
- #302 Forward Deployed Engineer Interview: What Is Tested
- #303 The FDE Decomposition Round: Vague Ask to a Plan
- #304 Scope an AI Pilot: Metric, Baseline and Stop Rule
- #305 Retry a Flaky API Without Duplicates: Idempotency Keys
- #306 Webhooks Done Right: Signatures, Retries and Replays
- #307 Schema Drift: Map a Customer's Data and Catch Changes
Related videos
- #302 Forward Deployed Engineer Interview: What Is Tested Forward deployed engineer interviews
- #303 The FDE Decomposition Round: Vague Ask to a Plan Forward deployed engineer interviews
- #305 Retry a Flaky API Without Duplicates: Idempotency Keys Forward deployed engineer interviews
- #306 Webhooks Done Right: Signatures, Retries and Replays Forward deployed engineer interviews
