Gurjit Chahal

Engineering notes

How I think through systems.

Short notes on decisions I have made while building workflow-heavy products. Each one covers the constraint, the options I considered, and why I chose the final approach.

01

The job was to return one eventual recommendation without holding the agent inside a single screen or request.

Read AI Customer Support Assistant

Why I used long polling for AI recommendations

A normal synchronous request was the simplest option, but AI response time could outlast a comfortable UI wait. Holding the request open would tie navigation to the model and make a slow dependency feel like a frozen support tool.

WebSockets and server-sent events were worth considering. Both can deliver updates efficiently, but this workflow did not need a continuous stream. It needed the final state of a known request. A persistent connection would add connection recovery, routing, and operational work without changing the agent experience much.

Long polling fit the shape of the problem. The UI could start a request, move on, and ask for its state later. Existing HTTP authentication and monitoring still applied. The cost was more request traffic, so polling had to be bounded, stop on terminal states, and back off when the result was not ready.

Choose communication patterns around the interaction, not trendiness.

Model pending and terminal states before writing the loading UI.

A simpler protocol still needs limits, correlation, and cleanup.

02

A free slot is not stored as one fact. It is calculated from rules that can disagree with each other.

Read WhatNow Scheduling Platform

A scheduling engine is a policy engine

Recurring hours are only the starting point. A real answer also depends on one-off overrides, blocked time, service duration, daily limits, existing appointments, and the visitor's time zone. Putting all of that into a calendar component makes the behavior difficult to test and nearly impossible to reuse.

I kept the policies separate and composed them when generating availability. The database stores durable rules and appointments in UTC. The scheduling layer applies those rules and checks overlaps. The interface only asks for valid choices and renders them in the visitor's local time.

Payments add another state machine. A browser redirect is not confirmation, and a webhook can be delivered more than once. Booking finalization belongs on the server, behind provider verification and an idempotency-aware boundary. Calendar and email work happen after the appointment is valid.

Store source rules, then calculate availability from them.

Keep time-zone conversion at clear system boundaries.

Treat redirects and webhooks as messages, not proof.

03

Models are useful for suggestions. They are a poor place to hide scoring, validation, or user consent.

Read Resume Studio

Put deterministic boundaries around AI

In Resume Studio, the baseline match score is deterministic. The same resume and job posting produce the same result. That makes the score explainable, testable, and useful as a reference before and after an edit.

The model proposes structured changes instead of returning a replacement document. Each suggestion is reconciled with the current draft, tied to a section or role, and checked for unsupported claims. The user sees the before and after text and decides whether to apply it.

This takes more work than dropping generated text into an editor. It also creates a much clearer ownership model. Deterministic code owns the rules, AI supplies a bounded suggestion, and the user owns the final document.

Keep reproducible decisions outside the model.

Validate structure and evidence before showing output.

Make AI changes reviewable, reversible, and optional.