{"slug": "how-applyos-keeps-ai-feedback-tied-to-the-right-resume-version", "title": "How ApplyOS keeps AI feedback tied to the right resume version", "summary": "Software engineer Najib Oladosu built Job Fit in ApplyOS, a resume-to-job-description comparison feature that ties each AI analysis result to the exact saved resume version it evaluated. The implementation, in Next.js, TypeScript and Supabase PostgreSQL, treats uploads as immutable snapshots, creates edited copies as new rows in a resume_versions table, and enforces version numbering with a transaction-level advisory lock and unique constraint. A unique constraint on (application_id, resume_version_id) anchors each stored analysis to its inputs, and the server rejects unreadable edited versions rather than falling back to the original upload.", "body_md": "Originally published on the ApplyOS blog by Najib Oladosu, a software engineer based in Nigeria.\n\nAn AI response can read well and still be attached to the wrong input.\n\nImagine uploading a resume, checking it against a job description, then saving an edited version. When you return to the feedback screen, which version does that feedback describe?\n\nThat question shaped how I built Job Fit in [ApplyOS](https://www.applyos.io/). The feature compares a saved resume with an application's job description. To make the feedback useful, I need to keep the result connected to the exact resume that went into the request.\n\nThis article walks through the current implementation in Next.js, TypeScript and Supabase PostgreSQL. The screenshots use demonstration records. Their scores are examples, not hiring predictions.\n\nI separate the uploaded document, a saved resume version and the analysis result.\n\nThat gives the result a clear identity:\n\n``` php\nApplication + saved resume version -> Job Fit result\n```\n\nA document ID alone isn't enough. Two edited resumes can come from the same upload while saying different things. An application ID alone isn't enough either, because one application can be evaluated against several saved resumes.\n\nThe upload becomes the original version. Edited copies are new rows in `resume_versions`, rather than updates to the original content.\n\nThe database backs up that rule. A trigger rejects changes to snapshot fields such as the saved editor content, source document and version number. Some metadata can still change, such as whether an edited version is starred. Deleting a document also has its own lifecycle; \"immutable snapshot\" doesn't mean the record exists forever.\n\nVersion numbering happens in PostgreSQL too. The insertion trigger takes a transaction-level advisory lock for the document before choosing its next number. This serializes number allocation for simultaneous saves of that document. A unique constraint on document ID and version number is an additional check.\n\nI put these rules in the database because uploads and saves can come from more than one interface. Each client shouldn't have to invent its own versioning rules.\n\nThe Job Fit interface sends all three identifiers. This is the request shape used in the component:\n\n```\nbody: JSON.stringify({\n    applicationId: application.id,\n    documentId: selectedDocumentId,\n    resumeVersionId: selectedVersionId,\n})\n```\n\nThe server checks authentication, reads the application and document, and checks that they belong to the current user. It then looks up the requested version within that document and checks its owner too.\n\nThe text sent to the model comes from that version's saved editor content. If the version uses the older block format, the route converts those blocks instead. Only the original version can fall back to the source document's parsed or extracted text.\n\nThat last boundary matters. Falling back to the upload for an empty edited version would evaluate different content from the content the person selected. The route returns an error for an unreadable edited version instead.\n\nOlder callers that omit the version ID deliberately use the original upload. That compatibility choice is explicit in the route.\n\nThe analysis table has a unique constraint on `(application_id, resume_version_id)`. The route uses that pair when it writes the pending state, stores a successful result or records a failed model call.\n\nHere is a shortened excerpt of the successful write:\n\n```\n.upsert(\n    {\n        ...analysisIdentity,\n        analysis_result: analysis,\n        analysis_status: 'success',\n        summary_generated_at: completedAt,\n        updated_at: completedAt,\n    },\n    { onConflict: 'application_id,resume_version_id' },\n)\n```\n\nThe identity object also includes the document ID. Database access policies check that the application and resume version belong to the signed-in user and that the version belongs to the named document.\n\nThis design stores one current result for each application and saved-version pair. Running it again updates that result. It isn't a history of every model response.\n\nThe API also distinguishes a model result from a saved result: if analysis finishes but persistence fails, it returns a save error. A successful model call alone doesn't mean the work is safely stored.\n\nThe interface lets the person choose the document and saved version. Within an application's Job Fit view, successful results are cached by version ID. Selecting a version chooses its matching result; a newly saved version doesn't automatically inherit the previous version's cached feedback.\n\nThe important interaction is simple: choose the resume you mean, inspect its feedback, edit it, then run Job Fit on the new saved version when you're ready.\n\nThe repository has unit checks for converting saved editor content into readable text, including block boundaries, invalid input and the older block format. Those checks help verify the text-building step. They don't prove the accuracy of the model's advice or every browser and database interaction.\n\nFor changes to this workflow, the regression cases I want to exercise include switching between two saved versions, rejecting a version from another document, rejecting another user's resources, and preserving the correct identity when a model call or save fails.\n\nThere are further boundaries to make explicit. The analysis key doesn't include a snapshot of the job description. If that description changes, the application ID still refers to the same application. A job-description revision and a record of the model and prompt used would give the result a more complete account of its inputs. I also want to test what happens when the selected version changes while a request is still running.\n\nThese are separate questions from resume versioning. Naming them keeps the engineering claim honest.\n\nBefore improving a prompt, I ask whether the application can explain the input behind its answer.\n\nWhich record was read? Which saved version? Who owns it? Was the result stored successfully? What should happen if the input changes?\n\nThose questions apply to document summaries, recommendations and other AI-assisted workflows. Clear data relationships give the person a better chance of understanding what the software actually evaluated.\n\nThese links point to the source revision used for this article:\n\nI'm **Najib Oladosu**, a Nigeria-based backend-first, full-stack software engineer working with Python, TypeScript, APIs and AI integrations. I'm available for remote engineering roles and scoped product work.", "url": "https://wpnews.pro/news/how-applyos-keeps-ai-feedback-tied-to-the-right-resume-version", "canonical_source": "https://dev.to/najiboladosu/how-applyos-keeps-ai-feedback-tied-to-the-right-resume-version-93f", "published_at": "2026-11-20 14:11:13+00:00", "updated_at": "2026-11-20 14:14:01.732525+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-products", "ai-tools", "developer-tools"], "entities": ["ApplyOS", "Job Fit", "Najib Oladosu", "Next.js", "TypeScript", "Supabase", "PostgreSQL"], "also_reported_by": [], "takeaway": "Keying each AI analysis to a unique (application_id, resume_version_id) pair, with immutable resume snapshots and a Postgres advisory lock for version numbering, prevents feedback from being attached to the wrong resume version.", "recommendation": {"advice": "Store AI results against the exact input version ID with a unique constraint, and return an error rather than silently falling back to a different source when the selected version is unreadable.", "playbook": "output-verification", "playbook_url": "https://wpnews.pro/playbooks/output-verification"}, "alternates": {"html": "https://wpnews.pro/news/how-applyos-keeps-ai-feedback-tied-to-the-right-resume-version", "markdown": "https://wpnews.pro/news/how-applyos-keeps-ai-feedback-tied-to-the-right-resume-version.md", "text": "https://wpnews.pro/news/how-applyos-keeps-ai-feedback-tied-to-the-right-resume-version.txt", "jsonld": "https://wpnews.pro/news/how-applyos-keeps-ai-feedback-tied-to-the-right-resume-version.jsonld"}}