BEHAVIOR LAB / MOCK 06

Golden-Master Modernization

Reconstruct an opaque reimbursement engine from observed inputs and outputs, preserve money behavior, add effective-dated corrections, and cut over without a big-bang bet.

30 MINUTES 16 INTERVIEWER TURNS FULL Q & A INTERACTIVE LAB

The problem on the whiteboard

Read this once, then begin aloud. Spend the first two minutes establishing contract, actors, risk and what must remain authoritative.

Design ReimburseX, a replacement for a black-box reimbursement binary. The legacy interface accepts trip days, miles traveled and receipt amount and returns an exact monetary reimbursement. You have 30 million historical request/response pairs and temporary access to the legacy oracle, but no source code. The replacement must reproduce current behavior, support reviewed effective-dated corrections, shadow safely, explain divergences and cut over incrementally.
Central design thesis

Separate behavior preservation from policy improvement. A golden-master corpus and differential harness certify compatibility; a versioned policy engine introduces deliberate corrections only through explicit, effective-dated change records.

Scope before components

These are supplied mock numbers for sizing and follow-ups. Say your assumptions before using them.

History 30M labeled calls spanning 8 years; three observable inputs + decimal output
Traffic 50k requests/day · 40 RPS peak · p99 < 120 ms
Parity ≥99.99% exact-cent match on in-scope traffic before cutover
Money No floating point; replayable calculation and immutable decision ledger
Migration 12-week oracle window; shadow → canary → route by cohort → retire

Actors

  • Employee or upstream expense system
  • Finance reviewer investigating mismatch
  • Policy owner approving correction
  • Migration engineer running differential tests
  • Auditor replaying a decision
  • Support operator handling appeal

Functional scope

  • Historical profiling and golden-master corpus
  • Boundary and metamorphic test generation
  • Versioned deterministic reimbursement evaluation
  • Shadow comparison, mismatch triage and replay
  • Effective-dated corrections and staged routing

Explicitly out

  • Inventing missing employee/department inputs
  • Using future claims to answer past requests
  • Automatic policy changes from a model
  • General travel booking
  • Destructive big-bang cutover

A traceable end-to-end path

Name the authoritative state, derived projections, asynchronous boundaries and the exact point where a business decision becomes durable.

Golden-Master Modernization reference architecture Six stage architecture from Request edge through Shadow compare. Request edge idempotency Normalizer decimal + date Policy router effective version Deterministic engine explainable rules Decision ledger immutable cents Shadow compare legacy vs new audit · policy · metrics · lineage
01 Request edge idempotency
02 Normalizer decimal + date
03 Policy router effective version
04 Deterministic engine explainable rules
05 Decision ledger immutable cents
06 Shadow compare legacy vs new

Keys that preserve history

The table is logical, not a mandate for one database. Choose physical stores after access patterns, transactions, retention and rebuildability are clear.

Entity Primary / unique key Important fields and purpose
InputCase (case_id) days, miles, receipt_cents, observed_at, source, fingerprint
OracleObservation (case_id, oracle_version) output_cents, called_at, environment, response_hash
GoldenExample (corpus_version, example_id) case_id, stratum, boundary_tags, expected_cents
PolicyVersion (policy_id, version) effective_from/to, rule_bundle_hash, state, approvers
Decision (tenant_id, request_id) input_hash, policy_version, output_cents, explanation_hash, state
ShadowComparison (request_id, candidate_version) legacy_cents, candidate_cents, delta, mismatch_class
Correction (correction_id) rationale, affected_domain, effective_date, approvals, rollout_state
Appeal (appeal_id) decision_id, claimant_reason, evidence, resolution, adjusted_decision_id
POST /v1/reimbursements

Idempotency-Key + observed/effective date + three inputs

200 {decisionId,amountCents,policyVersion}
GET /v1/decisions/{id}

Replay inputs, rule trace and hashes subject to role

200 {explanation}
POST /v1/corpora/{id}/evaluate

Run candidate bundle against frozen golden set

202 {evaluationRun}
GET /v1/comparisons?class=&delta=&cursor=

Mismatch workbench with sampled cases

200
POST /v1/policies/{id}/versions

Create draft effective-dated rule bundle

201 {version}
POST /v1/appeals

Reference original decision; never mutate it

201 {appealId}

The complete mock interview

Answers are written in a speakable first-person style. Turn on Practice Mode to hide them, answer aloud, then reveal one at a time.

INTERVIEWER

Design the replacement.

CANDIDATE

Candidate · clear top-down answerI would build two things. A compatibility engine matches what the old system does today. A policy engine handles intentional changes later. Keeping them separate lets us migrate safely without treating every old bug as a forever rule.

Why this mattersThis gives the interviewer a map before any boxes appear, and it makes the system's most important trust decision explicit.

INTERVIEWER

Clarify requirements and unknowns.

CANDIDATE

Candidate · clear top-down answerThe API takes days, miles, receipt amount, and decision date. It must return the exact amount, validation result, policy version, and explanation. The same request ID must never create two payments. We need to learn how old cases were sampled before trusting the data.

Why this mattersA narrow first release keeps the design realistic. It also shows which tempting features can wait without weakening the core product.

INTERVIEWER

Estimate scale and the parity claim.

CANDIDATE

Candidate · clear top-down answerTraffic is small, so servers are easy to size. Correctness is hard. A 99.99% target means at most one wrong result in 10,000, but observing zero errors in only 10,000 samples does not prove that target. A rough zero-failure confidence rule needs about 30,000 independent examples for a 0.01% upper error bound. Even then, random tests can miss rare money and date boundaries, so we need risk-based slices as well as a global number.

Why this mattersThe calculation is not about perfect forecasting. It identifies the part most likely to run out of capacity or delay users.

INTERVIEWER

How do you construct a golden master?

CANDIDATE

Candidate · clear top-down answerA golden master is a trusted set of inputs and old-system outputs. I would include common cases, rare cases, values near thresholds, date periods, and error cases. We keep both traffic-weighted samples and evenly spread boundary samples.

Why this mattersA random sample mostly proves common behavior. Boundary and risk slices make rare but expensive rules visible before the replacement handles money.

INTERVIEWER

Data model and API semantics?

CANDIDATE

Candidate · clear top-down answerThe main records are normalized input, old-system observation, golden example, approved policy version, decision, comparison result, and appeal. Money is stored as integer cents. A decision points to the exact input and policy version. The API uses a request key so a retry returns the same decision; reusing that key with different input is an error rather than a second payment.

Why this mattersThe API follows the user journey and makes slow work visible. A client should never hold one request open for a long job.

INTERVIEWER

Walk the production architecture.

CANDIDATE

Candidate · clear top-down answerA request is authenticated, normalized, and checked for a duplicate key. We choose the approved policy for the business date, run fixed rules, and save the decision, explanation, and pending payment message in one database transaction. A worker sends payment afterward. If the receiver times out, we look up the business key before retrying, because a timeout does not tell us whether money moved.

Why this mattersTracing one real request proves the boxes connect. It also exposes where we acknowledge success and where a retry may begin.

INTERVIEWER

Deep dive: infer behavior without overfitting.

CANDIDATE

Candidate · clear top-down answerWe start with readable rule guesses, test them on cases that were not used to create the guess, and actively query examples that separate competing rules. Related-value tests check properties such as “more miles should not reduce payment” unless evidence proves an exception. I keep a private final test set so repeated tuning cannot slowly overfit the benchmark.

Why this mattersThe deep dive starts only after the basic path is clear. Use one concrete example, then state the speed-versus-correctness choice.

INTERVIEWER

Deep dive: effective dates and intentional corrections.

CANDIDATE

Candidate · clear top-down answerEach policy says when it applies. A correction is a new approved version with an impact report, not an edit to old history. If the business allows retroactive changes, we create adjustment decisions that point to the old decision.

Why this mattersBusiness date and decision time are different. New versions and explicit adjustments preserve what was paid, why it was paid, and what changed later.

INTERVIEWER

Consistency, idempotency and failure semantics?

CANDIDATE

Candidate · clear top-down answerThe request key maps to one normalized input. Reusing it with different input is an error. Saving the decision and its outgoing message together prevents a crash from losing payment work or creating a second logical payment.

Why this mattersUse immediate agreement only for decisions that cannot be ambiguous. Let rebuildable views catch up and always show their freshness.

INTERVIEWER

Failure injection: the oracle produces different cents for the same inputs after a weekend release.

CANDIDATE

Candidate · clear top-down answerIf the old system changes, we create a new observed era instead of mixing outputs. We freeze promotion, compare before and after on a carefully chosen panel, and ask owners whether the change was intentional or a regression.

Why this mattersA failure answer should name the uncertain state first. Then explain how the system learns the truth before it repeats an action.

INTERVIEWER

How do shadow traffic and cutover work?

CANDIDATE

Candidate · clear top-down answerFirst replay old cases. Then mirror live traffic while the old system remains the only payment authority. Next enable small stable user groups, compare every result and side effect, and expand only while slice-level money and error checks pass. One route switch sends a group back to the old system. We keep that rollback path until in-flight work is settled and the agreed retention window ends.

Why this mattersOnly one system may move money for a request. Shadowing compares safely; cohort cutover and one route switch make expansion and retreat controlled.

INTERVIEWER

Failure injection: mismatches concentrate on receipts ending .49 and .99.

CANDIDATE

Candidate · clear top-down answerA high overall match can hide a bad group. If mismatches cluster around .49 and .99, stop rollout, test those endings closely, inspect rounding order, and use integer cents everywhere. Fix the rule and rerun both the boundary group and the full suite.

Why this mattersA global percentage can hide a systematic financial bug. Slice-level gates turn the suspicious endings into a release blocker instead of averaging them away.

INTERVIEWER

Security and privacy?

CANDIDATE

Candidate · clear top-down answerSend only the needed numeric inputs into the rules engine and keep employee identity outside when possible. Encrypt each customer's records with separate keys, separate policy authors from approvers, restrict golden datasets, and log every policy change and export. Test files use masked or synthetic data, and support tools must not reveal receipts or identities to people without case-level permission.

Why this mattersSecurity belongs in keys, tokens, workers, and logs. It is not a single box added to the diagram at the end.

INTERVIEWER

Observability and evaluation?

CANDIDATE

Candidate · clear top-down answerMeasure latency and availability, but also exact-cent match, total financial difference, errors by boundary group and policy era, appeals, and rollback readiness. Alert on a bad slice even when the global number still looks good.

Why this mattersMetrics should cover user speed, system safety, and result quality. Rollout starts read-only and earns stronger automation with evidence.

INTERVIEWER

Trade-offs and traps?

CANDIDATE

Candidate · clear top-down answerReadable rules take more work than a flexible model, but money needs exact and explainable behavior. The core trade-off is matching old behavior versus fixing it; separate compatibility and correction lanes make that choice explicit.

Why this mattersEvery design choice has a cost. Name the simpler alternative and explain which requirement makes the added complexity worth it.

INTERVIEWER

Give me your one-minute close.

CANDIDATE

Candidate · clear top-down answerIn short: learn old behavior from a carefully chosen golden set, run deterministic integer-money rules, choose one approved policy by business date, and save one repeat-safe decision. Shadow traffic and slice-level checks make cutover safe.

Why this mattersThe recap should repeat the user flow, the main trust rule, the hardest failure, and the most important trade-off—not every component.

Two places to earn the strong hire

These mechanisms are the interview’s differentiators. Be able to redraw each from memory and defend its failure behavior.

01

Deep dive A · Golden-master matrix

Traffic-weighted examples protect business impact; boundary and counterfactual probes protect rare rule edges. Both are required.

  1. Historical frequency sample
  2. Time-epoch stratification
  3. Threshold ±1 probes
  4. Decimal-ending strata
  5. Held-out certification corpus
02

Deep dive B · Policy time

Immutable decisions reference one immutable rule bundle. New rules alter future or explicit adjustment decisions, never history in place.

  1. Transaction vs valid time
  2. Non-overlapping approved intervals
  3. Correction impact simulation
  4. Adjustment links original
  5. Rollback affects future routing

Revise, do not hand-wave

When the interviewer injects a fault, restate the violated assumption, change state or protocol, and name the new invariant.

Injection Recovery mechanism Tempting wrong answer
01Oracle changes Version observations by epoch Blend incompatible labels
02Duplicate request Idempotency key + input hash Double payment
03Floating rounding Integer cents/rational intermediate Tolerance hides cents
04Shadow adapter down Customer path succeeds; retry/coverage gap Couple availability
05Boundary mismatch Slice gate and active probes Aggregate parity
06Policy overlap Serializable interval constraint Ambiguous version

Calculate before you provision

Use orders of magnitude to expose the bottleneck. State what this simple model omits.

Parity confidence lab

With zero observed mismatches, estimate the rough 95% upper error bound. Stratification is still required.

Rule-of-three upper mismatch rate — Change an input to recalculate.
History
—
Boundary
—
Held-out
—
Shadow
—

Prove quality in production

A system is incomplete without observable user outcomes, staged deployment, rollback and an answer to “how will we know?”

Scoreboard

  • Exact-cent match by stratum
  • Signed financial delta
  • Shadow coverage/gap age
  • Appeal overturn rate
  • Decision replay success
  • Cohort rollback readiness

Rollout ladder

  1. 01 Profile and freeze historical data
  2. 02 Active oracle boundary probing
  3. 03 Offline differential certification
  4. 04 100% asynchronous shadow
  5. 05 Stable low-risk canary cohorts
  6. 06 Progressive authority + retained replay

Corrections worth memorizing

Use these as flash cards. The right column is the compact sentence you want available under pressure.

Trap Better move
Random split only Hold out strata, time and boundaries.
Tolerance for cents Require exact money semantics.
Unobservable features Use only contract inputs/context.
One parity number Slice by epoch, boundary and impact.
Rewrite past result Append adjustment decision.
Big-bang migration Shadow and route stable cohorts.

Vocabulary without fog

Define the term, then connect it to a concrete invariant in this design. Avoid dropping vocabulary as a substitute for reasoning.

Golden master
Frozen inputs and expected outputs defining observed compatibility.
Oracle
Legacy system queried to observe behavior without seeing implementation.
Metamorphic test
Related inputs whose output relationship reveals boundaries or invariants.
Characterization test
Test recording what a legacy system does, even before why is known.
Bitemporal
Tracking both valid business time and knowledge/transaction time.
Shadow traffic
Run candidate beside production without using its result.
Differential test
Execute two implementations on the same input and compare.
Rule of three
With zero failures in n trials, rough 95% upper failure rate is 3/n.

Close with a decision, not a component list

ReimburseX learns with evidence but runs deterministically. Immutable, stratified golden corpora capture observed legacy epochs, boundaries, errors and metamorphic probes. A compiled, integer-money policy engine selects an approved effective-dated bundle and writes an immutable idempotent decision plus explanation. Shadow comparison is asynchronous and sliced by risk; deliberate corrections have their own approvals and expected mismatches. We progress from replay to shadow to stable cohorts with financial guardrails and rollback. Historical decisions remain untouched; appeals and adjustments form a traceable ledger.

Rehearse again