going through warp’s policy assignment take-home
lagos
I went through Warp's policy assignment take-home this week. Once I actually sat down with it, it was less daunting than I thought.

The Problem
Warp is basically the system that manages a company's people stuff: payroll, benefits, time off, app access, compliance training, all of it. Every one of those needs some kind of policy that decides who gets what.
- If you've been there 2 years, you get better vacation.
- If you're in California, you sign the meal break policy.
- If you're in engineering, you get GitHub access.
The company writes rules. Employees fall under whatever rules apply to them. The ask: design the system that works all of that out and keeps it correct.
A Rule Is Not a Policy
What unlocked it for me was separating "rule" from "policy". I kept mixing those up at first.
A policy is the actual thing, like Senior Vacation.
A rule is the condition that decides when someone gets it, like "tenure ≥ 2 years → Senior Vacation".
Once that split was clear in my head, the rest of the problem got a lot less scary. In the final design, three things do almost all the work: the policy, the rule, and the slot the rule competes for, like vacation or app access. Every rule reads the same way:

Stripped down, a rule in the data model is just this:
RULE {
uuid slot_id
string condition_type
json condition_value
int priority
uuid policy_id
}
Which Rule Wins
The part that made me think hardest was conflicts. What happens when two rules both apply to the same employee for the same slot? Say someone's tenure rule says Senior Vacation, but their employment type rule says Standard Vacation. Which one wins?
My first instinct was some kind of hierarchy, like department always beats tenure. I built that out and it broke immediately. I tested it against a different slot, app access instead of vacation, and the ordering that made sense for one didn't make sense for the other at all.
There's no universal answer to "which attribute matters more", because that isn't a technical question. It's a business one, and it's different for every policy category. Trying to hardcode it was wrong from the start.
What actually works is three steps:
- A priority number on the rule itself, set by whoever created it. That number is the business judgment, already written down. No need to re-derive it with clever logic every time.
- If two rules tie on priority, the more specific rule wins. It's basically the same idea CSS uses for competing selectors. Funny how that showed up here.
- If it's a real tie with no clear winner, don't fail silently. Pick something deterministic so the employee still has an actual policy, and flag it loudly for a human to sort out.

That last step felt important. I almost went with "just fail", until I realized that just recreates the "employee has nothing" problem I'd already decided was bad.
When Things Change
The other part that clicked was reconciliation: what happens when things change after the fact. Someone switches departments, crosses a tenure threshold, or gets added to a group.
Department and group changes are easy once you see it. They're just a write to some table, so you hook a recheck onto the write itself. Instant.
Tenure was the one that tripped me up. My first idea was keeping a running counter of every employee's tenure, going up every day. Then I realized: I already have hire_date. Tenure is just today minus hire_date. I don't need to store or count anything. That alone killed the idea of looping through every employee every day just to check who crossed a threshold.
So instead: work out the exact date someone will hit the threshold, once, at onboarding, and schedule an event for that date. No polling, no daily scan. Just a future date sitting there waiting to fire.

It felt obvious in hindsight, but it took a while to get there.
Everything Ended Up Eager
One thing I didn't expect: every trigger in the system ended up eager. It recomputes and stores the result the moment something changes, instead of waiting for someone to ask.
I went looking for a case where lazy loading (only compute when requested) made sense, and couldn't find one. Every reconciliation path I built already had a natural moment to recompute. I didn't set out to build an all-eager system. I just kept testing cases, and that's where it landed.
What's Left
I still want to spend more time on the UX side, like what onboarding actually looks like for an admin, and on the architecture itself. I landed on Postgres as the source of truth, append-only so history doesn't get wiped, with Redis caching the hot reads.
But the core resolution and reconciliation logic feels solid. More importantly, I can explain why every piece of it is there, which is the part I care about most.
Fun problem. I'm writing up the full design doc next and submitting it, but I wanted to get this down while the thinking was still fresh.
The full design doc is here: https://github.com/abubakar2906/warp-policy-assignment
older: what really happens after you click pay
first published on medium.