A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
fix: preserve scoped Undo errors and numeric score geometry
Amruth Pillai6ba2416b0421
diff --git a/apps/mobile/scripts/application-review.test.mjs b/apps/mobile/scripts/application-review.test.mjsindex 85913e90f..fa44188f1 100644--- a/apps/mobile/scripts/application-review.test.mjs+++ b/apps/mobile/scripts/application-review.test.mjs@@ -3,6 +3,9 @@ import assert from "node:assert/strict";import { readFileSync } from "node:fs";import { createRequire } from "node:module";import { test } from "node:test";+import { i18n } from "@lingui/core";++i18n.loadAndActivate({ locale: "en-US", messages: {} });const root = new URL("../../..", import.meta.url).pathname;const serverRequire = createRequire(root + "/apps/server/package.json");@@ -44,7 +47,11 @@ const empty = { answers: [], checklist: [], questions: [], evidence: {}, ticks:function load(data, overrides = {}) {const saves = [];const dependencies = {- "@lingui/core/macro": { plural: (n, forms) => forms.other.replace("#", String(n)) },+ "@lingui/core": { i18n },+ "@lingui/core/macro": {+ ph: (named) => Object.values(named)[0],+ plural: (n, forms) => forms.other.replace("#", String(n)),+ },"@lingui/react/macro": { useLingui: () => ({ t: tag }) },"@tanstack/react-query": { useQueryClient: () => ({}), useMutation: () => ({}) },"expo-clipboard": {},diff --git a/apps/mobile/scripts/applications-summary.test.mjs b/apps/mobile/scripts/applications-summary.test.mjsindex 76804cb31..9d1a373b5 100644--- a/apps/mobile/scripts/applications-summary.test.mjs+++ b/apps/mobile/scripts/applications-summary.test.mjs@@ -907,6 +907,7 @@ queryClient.clear();"@reactive-resume/utils/timezone": load("../../../packages/utils/src/timezone.ts", { zod }),});const stageActions = load("features/applications/stage-actions.ts", {+ "@/features/applications/error": { applicationError: (error) => error.message },"@reactive-resume/schema/applications/next-step": domainNextStep,"@lingui/core/macro": { t: String, plural: (value, forms) => forms.other.replace("#", String(value)) },"@tanstack/react-query": { useQueryClient: () => client },@@ -1031,6 +1032,7 @@ queryClient.clear();(id) => client.getQueryData(listKey)?.find((row) => row.id === id),);const stageActions = load("features/applications/stage-actions.ts", {+ "@/features/applications/error": { applicationError: (error) => error.message },"@reactive-resume/schema/applications/next-step": domainNextStep,"@lingui/core/macro": { t: String, plural: (value, forms) => forms.other.replace("#", String(value)) },"@tanstack/react-query": { useQueryClient: () => client },diff --git a/apps/mobile/scripts/experience.test.mjs b/apps/mobile/scripts/experience.test.mjsindex efcd048b4..83be2fac8 100644--- a/apps/mobile/scripts/experience.test.mjs+++ b/apps/mobile/scripts/experience.test.mjs@@ -413,12 +413,28 @@ const laneQuery = {// Offer hints for Next step: none known unless a case sets them.let offerHint;let stageUndo;+let stageToastScope = "fixture";+const stageToastOwner = load("features/applications/stage-actions.ts", {+ "./queries": { stageScope: () => stageToastScope },+ "./lane-queries": laneQuery,+ "./lanes": lanes,+ "./stages": stages,+ "@tanstack/react-query": {},+ "@reactive-resume/schema/applications/stage-baselines": {},+ "@/auth/session": {},+ "@/features/applications/error": { applicationError: () => "Link unavailable" },+ "@/features/career/hooks": {},+ "@/features/career/undo": {},+});const stageActionsStub = {useOfferHints: () => undefined,offerHintFor: () => offerHint,- useStageMovedToast: () => (moved, lane, _schedule, undo) => {- stageUndo = undo;- calls.push({ moved: moved.id, lane: lane.category });+ useStageMovedToast: () => {+ const moved = stageToastOwner.useStageMovedToast();+ return (...args) => {+ moved(...args);+ stageUndo = calls.at(-1).undo;+ };},acceptedStage: () => null,};@@ -452,6 +468,8 @@ let applicationDocuments = [];let rejectDocumentLink = false;let creatingApplicationLetter = false;let stageUpdate = (input) => calls.push(input);+let stageUpdateAsync = (input) =>+ new Promise((resolve, reject) => stageUpdate(input, { onSuccess: resolve, onError: reject }));const { StageStepper, NextStepCard, WhatYouSent } = load("features/application-detail/sections.tsx", {"@reactive-resume/schema/applications/outcomes": outcomesDomain,"@reactive-resume/schema/applications/document-suggestions": suggestionsDomain,@@ -494,7 +512,13 @@ const { StageStepper, NextStepCard, WhatYouSent } = load("features/application-d"@/features/applications/stage-actions": stageActionsStub,"@/features/applications/stages": stages,"@/features/applications/queries": {- useApplicationMutations: () => ({ update: { isPending: false, mutate: (...args) => stageUpdate(...args) } }),+ useApplicationMutations: () => ({+ update: {+ isPending: false,+ mutate: (...args) => stageUpdate(...args),+ mutateAsync: (...args) => stageUpdateAsync(...args),+ },+ }),},"./calendar": nativeInterviewCalendar,"@/features/reminders": {@@ -544,20 +568,26 @@ stageUpdate = (input, callbacks) => {tree = render(StageStepper, { application });control(tree, "Change lane").onChange("interview");assert.equal(typeof stageUndo, "function");-stageUndo();+await stageUndo();assert.deepEqual(calls.at(-1), { message: "Link unavailable" }, "Detail Undo failure remains visible");stageUpdate = (input) => calls.push(input);// A Move sheet can outlive its row snapshot. Resolve the inverse from the cache when its action dispatches.{- const { QueryClient } = mobileRequire("@tanstack/react-query");+ const { QueryClient, MutationObserver } = mobileRequire("@tanstack/react-query");const queryClient = new QueryClient();const listKey = ["applications", "stage-fixture"];const queryBoundary = {applicationsListQueryKey: () => listKey,applicationDetailQueryKey: (id) => ["application", id],useApplications: () => ({ data: [application], isPending: false, refetch: async () => {} }),- useApplicationMutations: () => ({ update: { isPending: false, mutate: (...args) => stageUpdate(...args) } }),+ useApplicationMutations: () => ({+ update: {+ isPending: false,+ mutate: (...args) => stageUpdate(...args),+ mutateAsync: (...args) => stageUpdateAsync(...args),+ },+ }),};const stageActions = load("features/applications/stage-actions.ts", {"./queries": queryBoundary,@@ -567,6 +597,7 @@ stageUpdate = (input) => calls.push(input);"@tanstack/react-query": { useQueryClient: () => queryClient },"@reactive-resume/schema/applications/stage-baselines": {},"@/auth/session": { getServer: () => "fixture" },+ "@/features/applications/error": { applicationError: () => "Link unavailable" },"@/features/career/hooks": {},"@/features/career/undo": {},});@@ -587,7 +618,7 @@ stageUpdate = (input) => calls.push(input);"./views": { ApplicationsViewFrame: "ApplicationsViewFrame" },"@/features/application-detail/hooks": { useNow: () => new Date(), useUserTime: () => time },"@/features/application-detail/sheets": { CloseSheet: "CloseSheet", MarkAppliedSheet: "MarkAppliedSheet" },- "@/features/applications/error": { applicationError: () => "Stage unavailable" },+ "@/features/applications/error": { applicationError: () => "Link unavailable" },"@/features/applications/lane-queries": laneQuery,"@/features/applications/lanes": lanes,"@/features/applications/list": { filterApplications: (rows) => rows },@@ -618,15 +649,102 @@ stageUpdate = (input) => calls.push(input);} finally {mock.timers.reset();}- stageUndo();+ await stageUndo();assert.deepEqual(calls.filter((call) => call?.id === application.id).at(-1), {id: application.id,status: "closed",closedReason: "withdrew",});- assert.deepEqual(calls.at(-1), { message: "Stage unavailable" }, "Board Undo failure remains visible");+ assert.deepEqual(calls.at(-1), { message: "Link unavailable" }, "Board Undo failure remains visible");++ // Real observer detachment models the useMutation subscription removed when either screen unmounts.+ async function undoAfterUnmount(move, scenario) {+ reset();+ stageToastScope = "fixture";+ stageUndo = undefined;+ let pending;+ let rejectUndo;+ let started;+ const undoStarted = new Promise((resolve) => (started = resolve));+ const observer = new MutationObserver(queryClient, {+ retry: false,+ mutationFn: (input) =>+ input.status === "interview"+ ? Promise.resolve(input)+ : new Promise((_resolve, reject) => {+ rejectUndo = reject;+ started();+ }),+ });+ const detach = observer.subscribe(() => {});+ stageUpdate = (input, options) => {+ calls.push(input);+ pending = observer.mutate(input, options);+ void pending.catch(() => {});+ };+ stageUpdateAsync = (input) => {+ calls.push(input);+ pending = observer.mutate(input);+ return pending;+ };+ move();+ if (scenario === "switch-forward") stageToastScope = "another-account";+ await pending;+ if (scenario === "switch-forward") {+ assert.equal(stageUndo, undefined, "An old account's late move cannot show an actionable toast");+ detach();+ return;+ }+ assert.equal(typeof stageUndo, "function");+ if (scenario === "switch-before") {+ stageToastScope = "another-account";+ const writes = calls.filter((call) => call?.id).length;+ await stageUndo();+ assert.equal(calls.filter((call) => call?.id).length, writes, "Old account's toast cannot dispatch Undo");+ detach();+ return;+ }+ const completion = stageUndo();+ await undoStarted;+ detach();+ if (scenario === "switch-during") stageToastScope = "another-account";+ rejectUndo(new Error("Offline"));+ await pending.catch(() => {});+ await completion;+ assert.equal(+ calls.filter((call) => call?.message === "Link unavailable").length,+ scenario === "same-account" ? 1 : 0,+ "Undo failure survives observer unmount, without leaking notices into another account",+ );+ }+ for (const scenario of ["same-account", "switch-during", "switch-before", "switch-forward"]) {+ await undoAfterUnmount(+ () => control(render(StageStepper, { application }), "Change lane").onChange("interview"),+ scenario,+ );+ await undoAfterUnmount(() => {+ let view = render(board);+ nodes(view)+ .find((node) => node.type?.name === "Column")+ .props.onMove(application);+ view = render(board);+ mock.timers.enable({ apis: ["setTimeout"] });+ try {+ nodes(view)+ .find((node) => node.type?.name === "MoveSheet")+ .props.onPick("interview");+ mock.timers.tick(1);+ } finally {+ mock.timers.reset();+ }+ }, scenario);+ }+ stageToastScope = "fixture";queryClient.clear();stageUpdate = (input) => calls.push(input);+ stageUpdateAsync = (input) =>+ new Promise((resolve, reject) => stageUpdate(input, { onSuccess: resolve, onError: reject }));+ console.log("PASS real mutation observers retain detail/board Undo errors after unmount and fence account changes");}for (const [resumeId, coverLetterId] of [diff --git a/apps/mobile/scripts/toast.test.mjs b/apps/mobile/scripts/toast.test.mjsindex cda5dfdf5..1124204c0 100644--- a/apps/mobile/scripts/toast.test.mjs+++ b/apps/mobile/scripts/toast.test.mjs@@ -125,17 +125,24 @@ retry.props.onPress();assert.equal(attempts, 2, "A synchronous failure permits retry");assert.equal(find(Toaster(), "Pressable"), undefined);+let actionRuns = 0;showToast({message: "Moved to Offer",- action: { label: "Add the offer's terms", onPress() {} },+ action: { label: "Add the offer's terms", onPress: () => actionRuns++ },undo() {},});const responsive = find(Toaster(), "Animated.View");assert.equal(responsive.props.style.maxWidth, "100%", "Toast is bounded by the available phone width");assert.equal(responsive.props.style.flexWrap, "wrap", "Enlarged controls can move onto another line");assert.equal(find(responsive, "Text").props.style.width, "100%", "Message leaves controls their own line");-const responsiveControl = find(responsive, "Pressable").props.style({ pressed: false });-assert.equal(responsiveControl.flexShrink, 1, "Long translated control text can wrap within its row");-assert.equal(responsiveControl.maxWidth, "100%");-assert.ok(responsiveControl.minHeight >= 44, "Wrapping retains the control's touch target");-find(responsive, "Pressable").props.onPress();+const responsiveControls = responsive.props.children.flat(Infinity).filter((node) => node?.type === "Pressable");+assert.equal(responsiveControls.length, 2, "Both the action and Undo are visible");+for (const control of responsiveControls) {+ const style = control.props.style({ pressed: false });+ assert.equal(style.flexShrink, 1, "Both controls let long translated text wrap within its row");+ assert.equal(style.maxWidth, "100%");+ assert.ok(style.minHeight >= 44, "Both controls retain their touch target when wrapping");+}+responsiveControls[0].props.onPress();+responsiveControls[0].props.onPress();+assert.equal(actionRuns, 1, "The action callback runs once, even before the toast re-renders");diff --git a/apps/mobile/src/features/application-detail/sections.tsx b/apps/mobile/src/features/application-detail/sections.tsxindex 8127a9688..3f68c7ebd 100644--- a/apps/mobile/src/features/application-detail/sections.tsx+++ b/apps/mobile/src/features/application-detail/sections.tsx@@ -124,10 +124,7 @@ export function StageStepper({ application, onMarkApplied, onCloseLane, onSchedu(entry) => entry.type === "interview" && new Date(entry.at).getTime() > Date.now(),);stageMoved(application, target, scheduled ? undefined : onSchedule, () =>- update.mutate(- { id: application.id, ...undoLaneInput(lane, application, lanes.supported) },- { onError: (error) => showToast({ message: applicationError(error) }) },- ),+ update.mutateAsync({ id: application.id, ...undoLaneInput(lane, application, lanes.supported) }),);},onError: (error) => showToast({ message: applicationError(error) }),diff --git a/apps/mobile/src/features/applications-board/board-screen.tsx b/apps/mobile/src/features/applications-board/board-screen.tsxindex b2053e08e..fe7141bd4 100644--- a/apps/mobile/src/features/applications-board/board-screen.tsx+++ b/apps/mobile/src/features/applications-board/board-screen.tsx@@ -179,10 +179,7 @@ function Board() {onSuccess: () => {const from = resolveLane(laneQuery.lanes, before);stageMoved(application, lane, undefined, () =>- update.mutate(- { id: application.id, ...undoLaneInput(from, before, laneQuery.supported) },- { onError: (error) => showToast({ message: applicationError(error) }) },- ),+ update.mutateAsync({ id: application.id, ...undoLaneInput(from, before, laneQuery.supported) }),);},onError: (error) => {diff --git a/apps/mobile/src/features/applications/stage-actions.ts b/apps/mobile/src/features/applications/stage-actions.tsindex 1b3c272da..a11cd5ad1 100644--- a/apps/mobile/src/features/applications/stage-actions.ts+++ b/apps/mobile/src/features/applications/stage-actions.ts@@ -14,6 +14,7 @@ import { getLaneLabel, laneInput, resolveLane } from "./lanes";import { applicationDetailQueryKey, applicationsListQueryKey, stageScope, useApplicationMutations } from "./queries";import { getClosedReasonLabel } from "./stages";import { getServer, useSession } from "@/auth/session";+import { applicationError } from "@/features/applications/error";import { useOffers } from "@/features/career/hooks";import { withUndo } from "@/features/career/undo";import { routes } from "@/routes";@@ -142,17 +143,30 @@ export const offerHintFor = (hints: ReadonlyMap<string, OfferHint> | undefined,*/export function useStageMovedToast() {const router = useRouter();+ const scope = stageScope();// `onSchedule`: after a move to Interview, offer to schedule one (the caller passes it only when none is coming up).// `onUndo`: moves it back; shown beside Schedule it or Add the offer's terms when those apply.return (application: Pick<ApplicationSummary, "id">,lane: ApplicationLane,onSchedule?: () => void,- onUndo?: () => void,- ) =>+ onUndo?: () => Promise<unknown>,+ ) => {+ if (scope !== stageScope()) return;showToast({message: t`Moved to ${getLaneLabel(lane)}`,- ...(onUndo ? { undo: onUndo } : {}),+ ...(onUndo+ ? {+ undo: async () => {+ if (scope !== stageScope()) return;+ try {+ await onUndo();+ } catch (error) {+ if (scope === stageScope()) showToast({ message: applicationError(error) });+ }+ },+ }+ : {}),...(lane.category === "interview" && onSchedule? { action: { label: t`Schedule it`, onPress: onSchedule } }: {}),@@ -166,6 +180,7 @@ export function useStageMovedToast() {}: {}),});+ };}/**diff --git a/apps/web/src/features/ats-checker/checker.tsx b/apps/web/src/features/ats-checker/checker.tsxindex f342e2e3e..e065f2822 100644--- a/apps/web/src/features/ats-checker/checker.tsx+++ b/apps/web/src/features/ats-checker/checker.tsx@@ -417,7 +417,7 @@ function Result({ result, file, signedIn, importError, onFix, onReset }: ResultPclassName="score-ring score-ring-reveal grid size-[84px] shrink-0 place-items-center rounded-full"style={{- "--ring-value": `${i18n.number(report.score)}%`,+ "--ring-value": `${report.score}%`,"--ring-color": `var(--${tone})`,} as CSSProperties}diff --git a/apps/web/src/features/resume/preview/localization.test.tsx b/apps/web/src/features/resume/preview/localization.test.tsxindex 4a2c27e9c..c810ece4d 100644--- a/apps/web/src/features/resume/preview/localization.test.tsx+++ b/apps/web/src/features/resume/preview/localization.test.tsx@@ -9,6 +9,7 @@ import { ResumePreviewLoader } from "./preview.shared";import { LevelDisplay } from "@/components/level/display";import { FindingRow } from "@/features/ats-checker/report/finding-row";import { JdCoverage } from "@/features/ats-checker/report/jd-coverage";+import { getLocaleMessages } from "@/libs/locale";vi.mock("./pdfjs", () => ({AnnotationMode: {},@@ -129,3 +130,15 @@ it("formats Arabic ATS evidence, keyword totals and skill names without changingexpect(markup).toContain("Fictional 2026 evidence");expect(finding.evidence.page).toBe(7);});++it("uses the Arabic catalog for both digits in the accessible level label", async () => {+ const catalog = await getLocaleMessages("ar-SA");+ expect(catalog.locale).toBe("ar-SA");+ i18n.loadAndActivate(catalog);+ const markup = renderToStaticMarkup(+ <I18nProvider i18n={i18n}>+ <LevelDisplay level={3} type="circle" icon="circle" />+ </I18nProvider>,+ );+ expect(markup).toContain('aria-label="المستوى ٣ من ٥"');+});diff --git a/tests/e2e/specs/locale-responsive.spec.ts b/tests/e2e/specs/locale-responsive.spec.tsindex 8beb62691..cf06f5349 100644--- a/tests/e2e/specs/locale-responsive.spec.ts+++ b/tests/e2e/specs/locale-responsive.spec.ts@@ -1,5 +1,30 @@import { expect, test } from "../fixtures/test";+test("Arabic public checker keeps score geometry numeric while its label is localized", async ({ page }) => {+ await page.emulateMedia({ reducedMotion: "reduce" });+ // Enter through a live client route so the prerender's upload input cannot be replaced during file selection.+ await page.goto("/auth/login?locale=ar-SA");+ await expect(page.getByRole("textbox").first()).toBeVisible();+ await page.locator('a[href="/"], a[href="/?locale=ar-SA"]').first().click();+ await page.locator('a[href^="/ats-checker"]').first().click();+ await page.locator('input[type="file"]').setInputFiles("apps/web/public/templates/pdf/onyx.pdf");+ const ring = page.locator(".score-ring");+ await expect(ring).toBeVisible();+ await expect(ring).toHaveAttribute("aria-label", /[٠-٩]+/);+ await expect(ring).not.toHaveAttribute("aria-label", /[0-9]/);+ await expect+ .poll(() =>+ ring.evaluate((element) => Number.parseFloat(getComputedStyle(element).getPropertyValue("--ring-value"))),+ )+ .toBeGreaterThan(0);+ const value = await ring.evaluate((element) => (element as HTMLElement).style.getPropertyValue("--ring-value"));+ expect(value).toMatch(/^\d+(?:\.\d+)?%$/);+ expect(Number.parseFloat(value)).toBeGreaterThan(0);+ await expect+ .poll(() => ring.evaluate((element) => getComputedStyle(element).getPropertyValue("--ring-value")))+ .toBe(value);+});+test("Arabic Insights localizes pipeline figures and weekly dates", async ({ authPage: page }) => {for (const status of ["applied", "offer"] as const) {await expect(