
Real Interview Questions for the Cloud Engineer at Xero
NewInterview Q&A
Q&A-1Review React Hooks and how they work?
Reported in Xero Software Engineer Interview (Accepted Offer): They took an interview, followed by a code review
The 90-second answer
Hooks let a function component keep state and run side effects without a class. React stores hook state against the component instance, in call order, and hands it back on the next render. That order is the whole contract. Call the same hooks, in the same order, on every render, at the top level of the component or a custom hook.
useState returns a value and a setter. The setter does not mutate the value you read in that render. It queues an update, React re-renders, and you get a new value. useEffect runs after paint, and only when its dependency array changes. useMemo and useCallback cache a value or function between renders. useRef holds a mutable box that survives renders without triggering one.
Why order matters
React has no names for your hooks. On each render it walks a linked list on the fiber and matches the first useState call to slot 0, the second to slot 1, and so on. Break the order and every slot after it gets the wrong value.
| Render | Calls in order | Slots after render |
|---|---|---|
| 1 | useState(count) then useEffect(fetch) | slot 0 = 0, slot 1 = effect |
| 2, same order | useState(count) then useEffect(fetch) | slot 0 = 1 after click, slot 1 = effect |
| 2, conditional | useEffect(fetch) only, because a flag hid the state call | slot 0 now holds the effect, slot 1 is gone. State is corrupted. |
That is why the Rules of Hooks exist. They are not style. They keep the slot mapping valid. ESLint react-hooks/rules-of-hooks catches most violations in CI, which matters in a large codebase where a conditional hook can pass local testing and break only on a rare branch.
// React 18, checked against the current docs
function InvoiceList({ orgId }: { orgId: string }) {
const [invoices, setInvoices] = useState<Invoice[]>([]);
useEffect(() => {
const controller = new AbortController();
fetch(`/api/orgs/${orgId}/invoices`, { signal: controller.signal })
.then((r) => r.json())
.then(setInvoices)
.catch((err) => {
if (err.name !== "AbortError") throw err;
});
return () => controller.abort(); // cleanup on orgId change or unmount
}, [orgId]);
return <ul>{invoices.map((i) => <li key={i.id}>{i.id}</li>)}</ul>;
}The cleanup function is the part candidates miss. Without it, a fast orgId switch leaves two fetches in flight. The slower one can resolve last and overwrite the list for the wrong org. With AbortController, the first request is cancelled when the effect re-runs.
Failure modes I watch for
Stale closures. An effect with an empty dependency array captures the values from the first render. If it reads orgId but omits it from the array, it keeps fetching for the original org. The fix is to list every reactive value the effect uses, or move the logic into a custom hook so the dependency is visible at the call site.
Infinite loops. Calling a setter unconditionally inside an effect that depends on the state it sets re-renders, re-runs the effect, and loops. Derive the value during render instead, or guard the update.
Expensive work on every render. useMemo helps when the calculation is genuinely costly, for example filtering 10,000 invoice lines. It does not help for cheap work, and it adds a comparison cost on each render. I measure before adding it.
For a cloud engineer reviewing frontend code, the hooks questions I ask are practical. Is data fetching tied to a cleanup, so navigation does not leak requests? Are custom hooks extracting shared logic, such as auth or pagination, instead of copy-pasting effects across pages? And does the component still work when the API behind it is slow, because the effect handles loading and error states rather than assuming the fetch resolves before unmount?
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-2Explain .NET controllers and services and DI concepts?
Reported in Xero Software Engineer Interview (Accepted Offer): They took an interview, followed by a code review
The 90-second answer
A controller is the HTTP adapter. It binds the request, calls one service method, and maps the result to a status code and body. It should not contain business rules, SQL, or calls to third parties. A service owns the use case: validation that needs domain knowledge, orchestration across repositories and external clients, transactions, and domain invariants. Dependency injection is how the controller gets that service without constructing it, and how the container controls its lifetime.
At Xero scale that separation matters in review. If I see a controller opening a DbContext, building an HTTP client, or checking if (invoice.Status == ...) before calling a repository, the change is hard to test and hard to reason about under load. I would ask for the logic to move into a service with a narrow interface.
// Program.cs, .NET 8
builder.Services.AddScoped<IInvoiceService, InvoiceService>();
builder.Services.AddScoped<IInvoiceRepository, InvoiceRepository>();
builder.Services.AddHttpClient<IPaymentGateway, StripeGateway>();
builder.Services.AddControllers();
[ApiController]
[Route("invoices")]
public sealed class InvoicesController(IInvoiceService invoices) : ControllerBase
{
[HttpPost("{id:guid}/issue")]
public async Task<IActionResult> Issue(Guid id, CancellationToken ct)
{
var invoice = await invoices.IssueAsync(id, ct);
return invoice is null ? NotFound() : Ok(invoice);
}
}
public interface IInvoiceService
{
Task<InvoiceDto?> IssueAsync(Guid id, CancellationToken ct);
}
public sealed class InvoiceService(
IInvoiceRepository repo,
IPaymentGateway gateway) : IInvoiceService
{
public async Task<InvoiceDto?> IssueAsync(Guid id, CancellationToken ct)
{
var invoice = await repo.GetAsync(id, ct);
if (invoice is null || invoice.Status != InvoiceStatus.Draft) return null;
invoice.Issue(); // domain invariant lives here, not in the controller
await repo.SaveAsync(invoice, ct);
return InvoiceDto.From(invoice);
}
}Constructor injection with primary constructors keeps dependencies explicit in the signature. That is the first thing I check in a code review: I can see the cost of the class from its constructor, and I can substitute a fake in a unit test without a container.
Lifetimes decide behaviour under concurrency
| Lifetime | One instance per | Use for | Risk if misused |
|---|---|---|---|
Singleton | application | stateless config, caches, HttpClient via IHttpClientFactory | shared mutable state, captive dependencies |
Scoped | request | DbContext, services that hold request state | leaking across requests if registered as singleton |
Transient | each resolution | lightweight, stateless workers | repeated allocation in a tight loop |
The classic failure is a singleton service that injects a scoped DbContext. It works in a smoke test, then fails in production with Cannot resolve scoped service from root provider or, worse, reuses one context across concurrent requests and corrupts tracking. I catch that in review by checking the registration graph, and in tests by building the provider with ValidateScopes() and ValidateOnBuild() in Development.
What I look for beyond the happy path
Services should depend on abstractions for anything that crosses a boundary: repositories, clocks, ID generators, and HTTP clients. That lets a test pin time to a fixed instant and assert the invoice number sequence without waiting or mocking the network. It also makes timeouts and retries explicit at the client registration, not buried in business code.
Two review questions I ask regularly: does this service method do one state change, and can it be called twice safely? If IssueAsync is invoked after a client retry, the Status != Draft guard returns null instead of issuing twice. And does the controller return a problem body with a stable code, rather than leaking an exception message? That keeps clients branching on contract, not on stack traces.
I would not use DI to hide a god object. If a service needs six dependencies, that is a signal to split it. The container should make the design visible, not make a tangled graph compile.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-3How do you think about testing?
Reported in Xero Senior Software Engineer Interview (Accepted Offer): It's quite easy
The 90-second answer
I test by risk, not by layer quota. For a cloud platform at Xero, the expensive failures are not a typo in a handler. They are a migration that drops a column, an IAM policy that lets a service read a bucket it should not, a queue that silently loses invoice events, or a Terraform change that looks fine in plan and deletes a production resource on apply. So I ask first: what breaks, how would we notice, and what is the cheapest test that catches it before a customer does?
That gives me four bands. Fast unit tests for pure logic, with no AWS calls. Integration tests against real dependencies in ephemeral environments, because mocks hide the failures that matter in the cloud. Contract and infrastructure tests for APIs, queues, and Terraform. And a small number of production checks, synthetic transactions and load tests, for the paths where a local pass proves nothing about scale or permissions.
How I would apply it in practice
For application code, I keep the pyramid but flatten the top. Unit tests run in under a second and cover pricing, tax, and reconciliation rules where a wrong answer is a financial error. Integration tests use Testcontainers or an ephemeral stack per pull request, not shared dev environments, so a test that passes on Tuesday cannot depend on state left by a colleague on Monday. I mock at the AWS boundary only for failure injection, timeouts and throttling, because that is where retry and backoff logic needs proof.
For infrastructure, Terraform tests run on every plan. They assert the properties that cause incidents: encryption at rest, versioning on buckets holding financial data, no public ACLs, and tags that route cost and ownership. A plan that would replace a DynamoDB table or an RDS instance fails the build unless the change carries an explicit approval label.
# bucket.tftest.hcl, run with: terraform test
run "financial_bucket_is_locked_down" {
command = plan
assert {
condition = aws_s3_bucket.invoices.versioning[0].enabled == true
error_message = "Invoice bucket must have versioning enabled"
}
assert {
condition = aws_s3_bucket_public_access_block.invoices.block_public_acls == true
error_message = "Invoice bucket must block public ACLs"
}
}Contract tests sit between services. If the billing service publishes InvoiceIssued to a queue, the consumer team gets a schema check in CI, not a surprise at 2 a.m. I use JSON Schema or OpenAPI validation on the producer side and a consumer-driven test on the other, so a field rename breaks the build of the team that made it.
| Risk | Test that catches it | Where it runs | Signal if it fails |
|---|---|---|---|
| Wrong tax calculation | Unit test with golden files | Pull request, <1 s | Build fails, no deploy |
| Queue message lost on retry | Integration test with real queue, kill consumer mid-processing | Ephemeral env per PR | Duplicate or missing event in test DB |
| Bucket made public by Terraform | terraform test assertion above | Plan stage | Apply blocked |
| API field renamed | Contract test, producer and consumer | CI on both repos | Version bump required |
| IAM policy too broad | Policy simulation in CI, deny-by-default check | Plan stage | Diff shows s3:* on * |
| Slow query under load | Load test at 3x peak, p99 budget 250 ms | Nightly, staging | Alert before prod |
Failure modes I design for
Flaky tests are a signal, not noise. If an integration test fails 1 in 20 runs, at 200 runs a day that is 10 false alarms a day and the team stops trusting the suite within a week. I quarantine after two flakes, fix the race or the shared state, and track flake rate as a metric. I do not chase a coverage percentage. A suite at 85% coverage that never tests a rollback is weaker than one at 60% that tests the rollback, the retry, and the permission boundary.
I also test the unhappy path explicitly. A dependency timing out should produce a 503 with a retryable code, not a 500 and a stack trace. A duplicate webhook delivery should be idempotent. I inject those faults in staging with a chaos tool on a schedule, for example terminating a container mid-request or adding 500 ms latency to a downstream call, and I check that alerts fire and the system degrades rather than corrupts data.
The synthetic transaction at the end matters for a SaaS with financial data. After each deploy I run a scripted flow, create a contact, issue an invoice, record a payment, check the ledger balances, and tear it down. If that fails, the deploy rolls back automatically. It costs a few seconds and catches the class of bug that unit tests cannot, a broken permission or a missing migration in the real account.
If an interviewer pushes me, I would say where I would not spend effort: exhaustive UI tests for an internal admin tool, or mocking every AWS service in unit tests. Both give a green build and a false sense of safety. I would rather have fewer tests, each tied to a named failure, and a clear answer to the question: what did this test last save us from?
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-4How do you update the DELETE endpoint so it returns immediately?
Reported in Xero Lead Engineer Interview (No Offer): I applied online
The 90-second answer
Change the contract from synchronous deletion to asynchronous acceptance. The endpoint marks the resource deleted, records the work to do, and returns 202 Accepted before any slow downstream cleanup runs. The client polls or receives a webhook when deletion finishes.
That only works if the first response is already consistent. I would write a tombstone in the same transaction as the outbox record, so a crash after the 202 cannot lose the job and a crash before it cannot leave a half deleted resource visible to reads.
// ASP.NET Core, .NET 8
[HttpDelete("{id}")]
public async Task<IActionResult> Delete(
string id,
CancellationToken ct)
{
var result = await _store.RequestDeleteAsync(id, ct);
// RequestDeleteAsync: in one DB transaction, set deleted_at,
// insert one outbox row (type=DeleteResource, id=id) if not present.
return result switch
{
DeleteOutcome.Accepted =>
Accepted(new { id, status = "deleting" }),
DeleteOutcome.AlreadyDeleting =>
Accepted(new { id, status = "deleting" }),
DeleteOutcome.NotFound =>
NoContent(), // idempotent: already gone is the desired state
_ => Problem(statusCode: 503, title: "delete_unavailable")
};
}The worker consumes the outbox, publishes to Azure Service Bus, and performs the expensive steps: removing blobs, purging search indexes, notifying downstream services, and applying retention rules. Each step is idempotent, keyed by the resource id, so a redelivery after a worker crash does not double delete or fail on a missing blob.
Why 202, and when not to use it
204 No Content promises the resource is gone when the response arrives. That is fine when deletion is a single indexed row update, typically under 20 ms. It breaks when deletion fans out to storage, search, caches, and other services, where p99 can climb past seconds and a timeout leaves the client unsure whether the delete happened.
| Contract | Response | Client sees | Use when |
|---|---|---|---|
| Synchronous | 204 | Gone now | One store, fast, no fan-out |
| Asynchronous | 202 + status: deleting | Gone soon, check status | Fan-out, large payloads, downstream cleanup |
| Asynchronous, unknown id | 204 or 202 | Desired state reached or in progress | DELETE must stay idempotent |
RFC 9110 treats DELETE as idempotent. A retry should not create a second effect or a different error. Returning 204 for an already deleted id and 202 for one in progress both satisfy that, provided the body and status are documented and clients branch on the status field rather than assuming 202 always means new work.
Reads, retries, and failure modes
Reads must honour the tombstone immediately, even though cleanup lags. GET /resources/{id} returns 404 once deleted_at is set, and list queries filter it out. Otherwise a client that received 202 can still read data it was told is being deleted, which fails audit checks at a company like Xero where financial records have retention obligations. Hard purge then happens later, or never for records under legal hold. The tombstone carries purge_after so the worker can skip held records instead of deleting them.
Three failures I would name in the interview:
- Worker dies after deleting blobs but before acknowledging the message. Service Bus redelivers. The worker checks for the blob by name and treats
NotFoundas success. - Outbox publisher dies after the transaction commits. A relay polls the outbox table every second and publishes unpublished rows. Without it, the
202is a lie. - Poison message loops forever. After five deliveries the message moves to a dead-letter queue with the exception and resource id. An alert fires on dead-letter depth above zero, because silent loss means storage bills for data the API says is deleted.
For scale, label the figures as an example: if the worker takes 300 ms per resource and the queue holds 10,000 deletes after a bulk import cleanup, one worker drains it in about 50 minutes. Scaling to 10 workers cuts that to roughly 5 minutes, provided the downstream stores tolerate the write rate. That arithmetic is what decides whether 202 is acceptable to the client or whether the endpoint needs a bulk delete job with progress reporting instead.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-5Merge overlapping intervals in an array of start and end times and return a clean set of non-overlapping intervals?
Reported in Xero Software Engineer Interview Guide
The 90-second answer
Sort by start time, then sweep once while keeping the current merged interval. Sorting is the whole trick. Once sorted, any interval that overlaps the current one must appear next to it, so a single pass suffices.
Assumptions I would state first: intervals are closed, so [1,4] and [4,5] touch at 4 and merge into [1,5], matching the usual LeetCode convention. If the caller wants touching intervals kept separate, the overlap test changes from start <= current_end to start < current_end. Empty input returns an empty list. I would not mutate the caller's list in place unless asked.
# Python 3.11, checked against the standard library only
def merge(intervals: list[list[int]]) -> list[list[int]]:
if not intervals:
return []
ordered = sorted(intervals, key=lambda iv: (iv[0], iv[1]))
merged = [ordered[0][:]]
for start, end in ordered[1:]:
last = merged[-1]
if start <= last[1]: # overlaps or touches the current block
last[1] = max(last[1], end)
else:
merged.append([start, end])
return mergedWorked trace for [[1,3],[2,6],[8,10],[15,18],[9,11]]:
| Step | Sorted interval | merged after step | Decision |
|---|---|---|---|
| 1 | [1,3] | [[1,3]] | seed the current block |
| 2 | [2,6] | [[1,6]] | 2 <= 3, extend end to max(3,6) |
| 3 | [8,10] | [[1,6],[8,10]] | 8 > 6, start a new block |
| 4 | [9,11] | [[1,6],[8,11]] | 9 <= 10, extend end to 11 |
| 5 | [15,18] | [[1,6],[8,11],[15,18]] | 15 > 11, new block |
Result: [[1,6],[8,11],[15,18]].
Complexity and why sorting dominates
Sorting costs O(n log n) time and O(n) extra space for the sorted copy and output. The sweep is O(n). Total: O(n log n) time, O(n) space. That is optimal for comparison-based sorting because the output order depends on start times, so you cannot avoid ordering them. If intervals arrived already sorted, for example from a calendar service that emits bookings in order, the sweep alone is O(n) and no sort is needed. I would ask whether that guarantee exists before paying for the sort.
Edge cases an interviewer will probe
| Case | Input | Output | Why |
|---|---|---|---|
| Nested interval | [[1,10],[2,3]] | [[1,10]] | max(10,3) keeps the outer end, the inner one adds nothing |
| Duplicate intervals | [[2,4],[2,4]] | [[2,4]] | second copy overlaps, end unchanged |
| Disjoint, unsorted | [[5,7],[1,2]] | [[1,2],[5,7]] | sort fixes the order before the sweep |
| Single interval | [[3,3]] | [[3,3]] | zero-length interval is valid, seed returns it |
| Invalid interval | [[5,2]] | raise ValueError | start > end is a caller bug, silently swapping hides it |
The nested case is where a common bug appears: extending with last[1] = end instead of max(last[1], end) shrinks [1,10] to [1,3] when [2,3] arrives. The trace above catches it because the end must never move backwards.
Follow-ups I would expect
If asked to merge without sorting, I would say it is impossible in general without extra structure, because an interval far later in the array can overlap an earlier one. If asked for a streaming version where intervals arrive one at a time, I would keep merged blocks in a balanced tree keyed by start and merge neighbours on insert, giving O(log n) per insert. If asked about very large inputs, say 10 million intervals, I would flag memory: the sorted copy plus output roughly triples the footprint, so I would sort in place if mutation is allowed, or process in chunks if the source is sorted upstream.
I would close by naming the one-line invariant: after sorting, the current block's end is the furthest reach of everything merged so far, and every later interval either extends that reach or starts fresh.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-6Design a high-load distributed system?
Reported in Design a High-Load Distributed System
The 90-second answer
I would clarify before drawing anything: what is the read to write ratio, what latency and consistency does the business need, and is the load steady or bursty? For Xero I would assume a multi-tenant accounting workload. Reads dominate, writes are invoices, contacts and bank feed transactions, and a tenant must never see another tenant's data. Hypothetical figures for this design: 20,000 requests per second at peak, 95% reads, p99 under 200 ms for a read, and eventual consistency acceptable for search and reporting but not for a ledger balance.
The shape is stateless compute in front of managed state, with queues absorbing bursts so a spike does not become a database outage.
How the pieces earn their place
| Layer | Choice | Why it is there |
|---|---|---|
| Read path | CDN for static assets, cache for hot tenant reads | Removes repeat work before it reaches the database |
| API tier | Stateless .NET services behind an ALB, autoscaled on CPU and request queue | Any instance can die and be replaced without session loss |
| Write path | API validates, writes to the database in a transaction, publishes an event to a queue | The user gets a fast ack, downstream jobs retry independently |
| Database | Relational store partitioned by tenant, read replicas for reporting | Tenant queries stay bounded and a large tenant cannot scan the whole table |
| Ingestion | Bank feeds land in a queue, workers process per tenant in order | A partner sending 6 hours of transactions at once does not block interactive traffic |
Worked numbers
At 20,000 rps with 95% reads, that is 19,000 reads per second. If the cache holds the working set for the most active tenants and hits 90% of the time, the database sees about 1,900 reads per second plus 1,000 writes. That fits a primary with two read replicas in this hypothetical. Without the cache, the same load needs roughly ten times the database capacity and connection pool. The cache is not an optimisation here, it is what keeps the connection pool from saturating. I would size the pool from the database side, for example 100 connections per replica, and cap the API tier so instances times pool per instance stays below that.
Failure modes I would name unprompted
Cache stampede: a popular invoice expires and 500 concurrent requests miss at once. I would use request coalescing in the API tier and a short stale-while-revalidate window, so one request rebuilds the entry while others serve the stale copy.
Hot tenant: one accounting firm with 10,000 clients generates a disproportionate share of traffic. Partitioning by tenant and rate limiting per tenant at the edge stops that tenant from starving others, and I would alert on per-tenant request share, not just global load.
Queue backlog: workers fall behind after a feed outage. I would alert on queue age, oldest message waiting, rather than queue depth alone, and scale workers on that metric. Dead letter queues capture poison messages after a fixed retry count so one malformed transaction does not block a tenant's feed.
What I would build first in code
Autoscaling tied to a queue metric, in Terraform, because CPU alone misses a queue driven workload:
resource "aws_appautoscaling_policy" "workers" {
name = "scale-on-queue-age"
policy_type = "TargetTrackingScaling"
resource_id = aws_appautoscaling_target.workers.resource_id
scalable_dimension = aws_appautoscaling_target.workers.scalable_dimension
service_namespace = aws_appautoscaling_target.workers.service_namespace
target_tracking_scaling_policy_configuration {
target_value = 120 # seconds of oldest message age
customized_metric_specification {
metric_name = "ApproximateAgeOfOldestMessage"
namespace = "AWS/SQS"
statistic = "Maximum"
}
}
}Trade-offs and when I would not use this
I am accepting eventual consistency for read replicas and search indexes. If a user writes an invoice and immediately reads it back, the read must go to the primary or wait for replication, otherwise they see a missing invoice and file a bug. I would route reads of just-written resources by a version or tenant flag to the primary for a short window.
I would not add a service mesh, a custom cache cluster, or sharding across regions on day one. Managed cache, managed queues and a single region with three Availability Zones cover this load with far less operational surface. Cross-region active-active only enters the conversation if the latency budget or data residency rules for AU and NZ customers demand it, and then the cost is conflict handling for writes, which this design deliberately avoids by keeping one primary per tenant.
The interview follow-up I expect is about data. My answer there: tenant ID on every row and every query, tested with integration tests that attempt cross-tenant access, because a cache key or a missing filter is the fastest way to turn a scaling success into a privacy incident.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-7Tell me about a time you handled conflict and resolved problems?
Reported in Xero Software Engineer interview: live coding and a role closed after ...
I would use a disagreement over how we migrated a stateful service to Kubernetes, because it was technical, it had a deadline, and neither side was obviously wrong.
At my previous employer we ran a .NET order-processing worker on EC2 behind SQS. The platform team wanted it on EKS in six weeks to align with the company standard. My team owned the service and pushed back. The worker held in-flight orders in local memory during a 90 second drain, and our p99 processing time was 40 ms with a 20 connection pool to RDS. On EKS with default termination grace of 30 seconds, we would kill workers mid-order and duplicate charges downstream.
The conflict escalated in a design review. Platform said we were blocking the standard. We said they were accepting data loss. I asked for 48 hours to test both positions instead of arguing from assumptions.
What I did
I wrote down the decision criteria with both leads: zero lost orders in a load test, drain under 120 seconds, and rollback in under 10 minutes. Then I ran the same replay of 10,000 queued messages against EC2 and against EKS with a custom preStop hook that stopped polling SQS, waited for in-flight work, and only then exited.
The first EKS run lost 312 orders. With the hook and terminationGracePeriodSeconds: 150, it lost none, and drain took 94 seconds. That changed the conversation. Platform accepted the longer grace period as an exception for stateful workers, documented in the platform standard. We accepted a hard migration date and owned the hook as a reusable Helm chart.
| Test | Lost orders / 10,000 | Drain time | Rollback |
|---|---|---|---|
| EC2 baseline | 0 | 61 s | AMI swap, 8 min |
| EKS, defaults | 312 | 30 s (forced kill) | Helm rollback, 6 min |
| EKS, preStop hook | 0 | 94 s | Helm rollback, 6 min |
We shipped in week five. In the first month, duplicate processing stayed at zero and the chart was adopted by two other teams with SQS consumers.
What I learned to do differently
I started that review defending my team. The turning point was naming the criteria before proposing a solution, and letting a replay decide. If the hook had failed, I would have escalated with the numbers and asked for either a longer timeline or a redesign to make the worker stateless, rather than shipping a migration that lost orders.
If an interviewer asks how I handle a conflict with a person rather than a technical position, I separate the two. I state the other person's constraint in terms they would recognise, I ask what evidence would change my mind, and I commit to a test with a date. That keeps it from becoming a contest about who spoke last.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-8Why do you want to work at Xero?
Reported in Xero Software Engineer Interview Guide
The 90-second answer
"I have spent the last four years on cloud work for a multi-tenant product, and the part I keep choosing is the unglamorous bit: making deployments boring. At my current company I owned the pipeline for a service that handled invoicing data for about 40,000 businesses. Small numbers compared with Xero, but the same constraint. A bad migration does not just break a page, it corrupts records people use for tax. That is why I applied here. From your public engineering posts and the values material I read before applying, Xero seems to treat that constraint as a design input, not an afterthought. I want to work where that is the default, and where the platform team is expected to make it easier for product teams to do the right thing."
That works because it gives a reason tied to work the candidate has actually done, and it leaves room for the interviewer to test it. It does not claim to know Xero's internal systems.
| Time | What to say | What it proves |
|---|---|---|
| 0 to 20 seconds | The work you want more of, in one sentence | You have a direction, not just a job search |
| 20 to 50 seconds | One concrete example from your own team, with your own figures | You can be probed and hold up |
| 50 to 80 seconds | Why Xero, based on public material you read | You did the homework and can name a source |
| 80 to 90 seconds | What you would want to own first | You are thinking about contribution, not fit in the abstract |
The example to have ready
Keep the figures yours, and say so. For instance: "In my last role, deploys took about 45 minutes and rollbacks were manual. I moved us to canary releases with automated rollback on error rate. Median deploy time fell to about 12 minutes, and we had two rollbacks in six months instead of roughly one a month." Those numbers are illustrative of the shape, not a claim about Xero. The interviewer will ask how you measured error rate, what threshold triggered the rollback, and what happened when the canary passed but a downstream job failed. Have those answers ready or do not use the story.
Where this pitch does not fit
This framing suits a candidate who wants platform and reliability work at a larger, regulated-feeling SaaS company. It would be the wrong pitch if you actually want early-stage product building, where you would be writing features end to end and accepting more ambiguity about whether the product should exist. It would also be wrong if your real motivation is location, salary, or a specific team you have not researched. Interviewers hear that quickly. A second credible framing is narrower: you want to work on data residency and audit tooling specifically, because you built retention controls before. Pick the one that matches your history. Do not blend both.
How this answer goes wrong
Generic praise is the common failure. "I love the values, I love the culture, I love the product" gives the interviewer nothing to follow up on, so they move on unconvinced. A second failure is borrowing a value word and using it as a slogan. If you say you care about customer obsession, be ready to describe a time you told a product manager no because the change would have put customer data at risk, and what you offered instead. A third failure is asserting facts about Xero you cannot source. If you mention a migration, a region, or a tool, be able to say where you read it. Guessing about a company's infrastructure in a motivation answer reads as carelessness, which is a poor first impression for a cloud role.
If they push on values, answer with behaviour. Name one value you have seen in your own work, describe what you did, and say what you would do differently now. That is harder to fake than enthusiasm, and it is what a hiring manager is actually listening for.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-9How do you approach test coverage?
Reported in Xero Software Engineer Interview (Accepted Offer): They took an interview, followed by a code review
The 90-second answer
I treat coverage as a signal for untested risk, not a target to hit. I start from what can hurt us if it breaks: money movement, tenant isolation, tax calculations, and infrastructure changes that can take a service down. For those paths I want branch coverage and a test that fails when the logic changes. For everything else I accept lower coverage if the code is simple, well typed, and covered by an integration or contract test at the boundary.
In practice I look at three numbers in CI: coverage on changed lines, branch coverage on critical modules, and mutation score on the logic I care about most. A team-wide line number, say 80%, tells me little. A diff that adds 200 lines with 40% coverage on the new branches tells me exactly where to push back in review.
How I decide where to spend effort
| Area | Example at Xero scale | Test I expect | Coverage bar I use |
|---|---|---|---|
| Money and ledger logic | invoice totals, FX rounding, reconciliation matching | unit tests with property cases for rounding and edge amounts | branch coverage above 90% on the module, mutation tested |
| Tenant isolation | middleware that sets tenant context from auth claims | integration test with two tenants hitting the same endpoint | every branch that can leak or cross tenants covered |
| API contract | .NET service consumed by React front end | contract test plus a thin integration test against a real database in CI | request and error paths covered, not every getter |
| Infrastructure as code | Terraform or CDK for queues, policies, alarms | terraform test or CDK assertions, plus a deploy to an ephemeral stack | policy and wiring assertions, not line coverage |
| Glue and plumbing | logging setup, DI registration, health checks | one smoke test per wiring path | low bar, but no untested wiring for a new dependency |
That split keeps the suite fast. Unit tests run in seconds. Integration tests run against containers or ephemeral AWS resources and run on the pull request only for the services they touch. If the full suite takes 25 minutes, people stop running it locally and coverage becomes theatre.
A concrete example
Say I add retry logic to a worker that processes bank feed items. Line coverage can reach 100% with a happy path test and still miss the bug that matters: a duplicate delivery after a timeout. I write the test around the branch that decides whether an item was already processed.
[Fact]
public async Task ProcessAsync_DuplicateDelivery_ReturnsExistingResult()
{
var store = new InMemoryFeedItemStore();
var service = new FeedItemProcessor(store, new FakeClock());
var first = await service.ProcessAsync("item-123", CancellationToken.None);
var second = await service.ProcessAsync("item-123", CancellationToken.None);
Assert.Equal(first.ResultId, second.ResultId);
Assert.Single(store.ProcessedItems);
}Then I run mutation testing on that processor in the nightly build. If a mutant flips the duplicate check and no test fails, the coverage number was lying. I fix the test, not the mutant, and I keep the mutation run out of the pull request gate because it is slow. Hypothetical figures from our kind of codebase: a nightly mutation run on one service might take 40 minutes and kill 78% of mutants. That is useful signal for the next sprint. It would be a poor gate for a hotfix.
Gates and failure modes
I gate on changed code. The CI job fails if new or modified lines drop below about 80% line coverage or 70% branch coverage, with an exemption path for generated code and pure configuration. I also track the trend per service. A slow slide from 85% to 72% over six months matters more than one pull request at 78%.
Coverage fails in predictable ways. Teams add tests that assert nothing, so the number climbs and defects do not fall. I check for that by reviewing whether tests assert state, not just that code ran. Flaky integration tests get quarantined with a ticket and a 48 hour fix window, because a flaky gate trains people to click retry. And coverage tools can mislead on async code and on infrastructure code, where a line executed is not a behaviour verified. For Terraform I care whether the test asserts the queue has a dead letter queue and the alarm threshold, not whether every block was visited.
If an interviewer asks about 100% coverage, my answer is that I would not chase it. The last 10% usually buys tests for code that should be deleted or simplified. I would rather spend that time on a load test for a queue consumer, a chaos test for a dependency timeout, or a contract test that stops a breaking API change reaching the React client. Coverage tells me where I have no evidence. It does not tell me the evidence is good.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Q&A-10Describe your real-world experience with system architecture and cloud services?
Reported in Xero Software Engineer Interview Guide
The 90-second answer
I would anchor it in one system I owned end to end, then show the decisions around it. My most recent example was a multi-tenant SaaS platform on AWS serving small businesses, with .NET services behind an API gateway, PostgreSQL for transactional data, Redis for caching, SQS for async work, and S3 for documents. Tenancy was the central constraint. Every table carried a tenant_id, every query was scoped by it, and I added a database check constraint plus integration tests that tried cross-tenant reads and expected them to fail. That mattered more than any scaling trick, because a single missing filter would leak one customer's invoices to another.
The second constraint was traffic shape. Reads dominated. Reporting queries ran against a read replica, writes went to the primary, and anything expensive, like generating a PDF statement, went through a queue so the API could return in under 200 ms while the worker finished in seconds. I also owned the infrastructure as code in Terraform, the deployment pipeline, and the design reviews where I mentored two engineers on trade-offs like queue versus direct call.
The shape of the system
| Component | Choice | Reason | Failure mode I planned for |
|---|---|---|---|
| --- | --- | --- | --- |
| --- | --- | --- | --- |
| --- | --- | --- | --- |
| Database | RDS PostgreSQL, one primary plus replica | Strong consistency for money data, replica for reports | Replica lag: I served reads that needed freshness from the primary and showed lag in internal dashboards |
| Cache | Redis with 60 s TTL on reference data | Cut repeated lookups for tax rates and account lists | Stale cache after a write: I invalidated on write and versioned keys by tenant |
| Async work | SQS with a dead letter queue after 5 attempts | PDF generation and bank imports took 3 to 30 s | Poison message blocking a queue: DLQ alarm paged us, and the worker logged tenant and job id for replay |
| Documents | S3 with per-tenant prefixes and signed URLs | Cheap storage, access checked in the API before a URL was issued | Expired or shared URL: URLs lived for 5 minutes and were never stored in the database |
| Infrastructure | Terraform, autoscaling groups, alarms on p99 latency and queue depth | Repeatable environments and a clear link between code and cost | Pool saturation: connection count per instance was capped so 40 instances could not exhaust the database |
A worked trace
A user opens a dashboard. The gateway authenticates the token and adds tenant_id to the request context. The API checks Redis for the tenant's chart of accounts. On a miss it queries the replica, caches the result for 60 s, and returns. If the user then asks for a statement PDF, the API writes a job to SQS and returns 202 with a job id. The worker renders the PDF, uploads it to S3 under that tenant's prefix, and marks the job complete. The client polls the job endpoint and receives a signed URL. Each step has a trace id, so when a customer reports a missing PDF I can follow one id from gateway to worker to S3.
Numbers I used to size it
In that example, roughly 20,000 active tenants generated about 40 million API calls a day, peaking near 900 requests per second. Reads were about 92% of traffic. That ratio justified the replica and the cache before I considered sharding, which I did not need. For cost, moving PDF generation off the request path let me run the API on smaller instances and scale workers separately, which cut the monthly compute bill by about a third in our internal estimate. I treated those figures as workload specific and re-measured after each change, because a cache hit rate dropping from 85% to 60% would have changed the answer.
What I would do differently
I would add per-tenant rate limits earlier. One tenant's bulk import once pushed queue depth high enough to delay other tenants' webhooks, and the fix was a separate queue for bulk work plus a per-tenant concurrency cap in the worker. I would also test restore from backup in the pipeline rather than quarterly by hand, since an untested restore is a guess. That is the pattern I bring to a new team: name the constraint first, tenant isolation, traffic shape, or compliance, then pick the smallest architecture that survives its failure modes, and write down what would make me change it.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.
Curated: · Written: · Reviewed: