Support Future-Dated Changes in an HR System's Employee Update Function
Company: Rippling
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: medium
Interview Round: Onsite
In an AI-assisted coding round you work in an existing HR system. One of its functions changes an employee's record, and today every change takes effect immediately. Modify it so that a change can also be scheduled with an effective date in the future: before that date, the employee's record must still show the old values, and from that date on it must show the new ones. The format is the same as in an AI-assisted phone screen: explain your approach first, then implement it, and finally run a few test cases. When asked which design they preferred, the interviewer left the choice to the candidate, so choosing and defending a design is part of the task.
The report does not show the existing code. For practice, assume a record holds fields such as `title`, `department`, `manager_id` and `salary`, and that the function looks like `update_employee(employee_id, changes)`, where `changes` maps field names to new values. Adapt the design to the real code.
### Clarifying Questions
- Which reads must respect effective dates: only "the record today", or also "the record as of" any past or future date?
- Can several future changes be pending for one employee, touching the same field or different fields?
- Can a scheduled change be edited or cancelled before it takes effect?
- If an immediate change hits a field that already has a pending future change, which value should win once the future date arrives?
- Can a change be backdated to a date in the past?
- Is the effective date a calendar date, and in which time zone does a day start? Does a change dated today apply at once?
- Does anything else (payroll, notifications, access rights) need to react when a change takes effect?
### Part 1 — Choose the data model
Decide how scheduled changes are stored and how the record for a given date is computed. Compare at least two designs and pick one.
```hint What one change touches
Consider two pending changes on different dates that touch different fields, plus an immediate change made in between, and check what each design shows on each date.
```
#### What This Part Should Cover
- At least two candidate designs and the trade-off between them
- How the record as of a date is computed when several changes exist, and in what order they apply
- Behavior when a pending change is cancelled or overlaps another change
### Part 2 — Change the function and the reads
Implement the modified update function and the read path, so that existing callers that pass no date keep their current behavior.
```hint Today is just a date
Think about whether the existing immediate update can become a special case of the new path, so that there is one code path to test.
```
#### What This Part Should Cover
- Backward compatibility for current callers
- Validation of the effective date and of the fields being changed
- Cost of reads and writes as the number of changes per employee grows
### Part 3 — Test it
Write and run the test cases that show the change works.
```hint Walk the calendar
List the dates just before, on and after each effective date, and the combinations of pending changes that could interact.
```
#### What This Part Should Cover
- Boundary tests around effective dates
- Interacting changes: same field, different fields, cancellation, an immediate change between scheduling and the effective date
- Unchanged behavior for existing immediate updates
### What a Strong Answer Covers
- An approach explained before implementation, with a deliberate design choice and its trade-offs, since the interviewer did not pick one
- A model in which independent changes cannot overwrite each other, with a correct "as of a date" read
- Policies for conflicts, cancellation, backdating and time zones raised with the interviewer rather than silently assumed
- Backward compatibility and validation
- Tests at date boundaries and for interacting changes
- Awareness of side effects that must happen when a change takes effect
### Follow-up Questions
- Payroll must be notified on the day a change takes effect, even if nobody reads the record. How do you trigger that?
- HR corrects a salary change that took effect last month and needs an audit trail of what the system showed before the correction. How does your model change?
- Thousands of changes are scheduled for the first day of a month. What happens to reads and side effects at that moment?
- How would you show HR every pending change for an employee and let them cancel one?
Overview: Modify an HR system's employee update function so that changes can be scheduled for a future effective date, explaining the design before implementing and testing it. It tests effective-dated data modeling, as-of-date reads, interleaved and cancelled changes, backward compatibility and boundary tests.
Read the full Rippling Software Engineer interview experience this question came from