fix(ui): preserve application drafts and recovery states
This commit is contained in:
@@ -53,4 +53,18 @@ Observed Discovery normal push2026-10-12 22:49:31.085724UTC proves localHEAD=ori
|
||||
|
||||
| P7-05 Offers | `c723a4e3032185da623d81ace241eec748506fc7` | [Results](p7-05/evidence/offers-results.json):9/1,new4native,backend6,app/browser types/lint/build PASS;14images reviewed/14scans0/15qualified. Hygiene PASS/normal push directly verified2026-10-13 11:19:57UTC, cleanlocalHEAD=origin=live/main unchanged. +7/0frontend696/93/browser267 derived only; Reminders next/main unchanged |
|
||||
|
||||
| P7-05 Reminders | Actual hash follows observed normal push | [Results](p7-05/evidence/reminders-results.json):17/3,new6native,backend6,app/browser types/lint/build PASS;17images reviewed/17scans0/114qualified. Final hygiene/normal push pending. +10/+1frontend706/94/browser273 derived only; all4P7-05domains implemented CONDITIONAL GO; P7-06 next/main unchanged |
|
||||
| P7-05 Reminders | `627955afa989d32fefa53f15da9ef3e0abf27038` | [Results](p7-05/evidence/reminders-results.json):17/3,new6native,backend6,app/browser types/lint/build PASS;17images reviewed/17scans0/114qualified. Hygiene PASS; normal push directly verified2026-10-13 11:49:32.473200UTC, clean localHEAD=origin=live development/main unchanged. +10/+1frontend706/94/browser273 derived only; all4P7-05domains implemented CONDITIONAL GO; P7-06 embedded forms next |
|
||||
|
||||
### P7-06 entry and commit boundaries
|
||||
|
||||
[P7-06 entry](p7-06/evidence/entry.json) records the actual preceding Reminders push. The fresh embedded-forms baseline is39/3 (assets18+overlay18+helper3), executed2026-10-13 11:39:16.918910–11:39:27.061883UTC at HEADc723a4e with uncommitted Reminders; all seven captured relevant sources remained unchanged through the run. This is separate from the later clean627955a push receipt. No P7-06 implementation commit, native acceptance or whole-suite rerun is claimed at entry.
|
||||
|
||||
Use exactly three sequential implementation commits: embedded Application forms, inbox/read review, then compose/send. Optional P7-06F remains DEFERRED until mode→draft/review action and fallback have an explicit product decision. Existing compose identity/save/delivery findings remain a prerequisite at the third boundary.
|
||||
|
||||
### P7-06 forms candidate gate — no implementation hash assigned
|
||||
|
||||
[Bounded forms report](p7-06/FORMS.md): first embedded-forms slice CONDITIONAL GO pending final static/push; overallP7-06 ongoing. Latest54/4 units/backend30 no-build pass. Current buildxyh9FYyySEw1uIao4DveJ native8/1 retains only unchanged strict language-save204→HTTP500 EN (RD11); keyboard PageDown passes. Fresh current Jobs5/P2-D01ordinary1 give14pass/1fail of15; previous-build CV4/Career11 give29pass/1fail relevant30 with as-run qualifiers. No rerun/waiver, new axe total, commit hash or push receipt is invented. Ten new frontend cases/zero suites derive716/94 and nine native cases derive282 cases only. Final static/hygiene/source-export/push evidence is pending. Keep the three approved sequential boundaries and production NO-GO.
|
||||
|
||||
### Final P7-06 embedded-forms observation
|
||||
|
||||
Final embedded-forms implemented scope is **CONDITIONAL GO**, normal push pending. The matching aggregate/generation repair resolves the reviewed cross-job draft leak: ordinary parent RED18/1, latest affected **55/4 PASS** and actual SPA/heldB/exact two-job readback PASS. Final parent build9sM6acEkOGxgN5fTRZXdE has **9PASS/1FAIL of10** (unchanged strict actual NB language204→500/RD11); fresh Jobs5/P2-D01ordinary1 give **15PASS/1FAIL of16**, qualified earlier CV4/Career11 give **30PASS/1FAIL relevant31**. Backend30 sameDLL/no-build; app/browser types/lint/build PASS. All23/111 current forms PNGs actually reviewed, 55 recorded axe scans0/741 (current22/154+Jobs8/89; earlierCV12/121+Career13/377), full incomplete contexts pending human qualification. See [portable forms result](p7-06/evidence/forms-results.json). +11frontend/0suites derives **717/94**; +10browser derives **283**, no integrated run. All57 groups56PARTIAL/C11DEFERRED and32routes, P513withheld/06Fdeferred/main unchanged/productionNO-GO. Inbox/read and compose/send remain; Phase8 not started.
|
||||
|
||||
@@ -154,3 +154,19 @@ Read-only connected-code inspection confirms existing CorrespondenceInboxPage up
|
||||
### P7-05 Reminders finite evidence
|
||||
|
||||
[Reminders results](p7-05/evidence/reminders-results.json) repair reproduced duplicateheldPATCHs, toast-only local failure, host-locale dates, localeGET and managedfocus/reflow in the existing owner. Old GET-only retry/movedfocus behaviors already passed RED and remain. Explicit captured write Retry does not prove network-uncertain event deduplication; lastwriter/date/DST obligations remain. Clear shows existing Shellpoll lag; generated English reasons inNB go toP7-11, customfallback staysraw. New17all-enabledscans0/114 retain full contrast/heading-context requirements; no human/device/output/wholePRES debt closes.
|
||||
|
||||
The normal Reminders627955a push was directly verified2026-10-13 11:49:32.473200UTC with clean localHEAD=origin=live development and unchanged local/origin/live main27657f3. This closes only the predecessor push status; the finite debt above remains.
|
||||
|
||||
### P7-06 embedded-forms entry dependencies
|
||||
|
||||
[Entry evidence](p7-06/evidence/entry.json) records the fresh39/3 pre-change affected baseline atc723a4e with uncommitted Reminders; it is not a clean627955a baseline. Read-only connected-code review identifies mutation errors hiding loaded dirty controls/history, missing initial GET Retry, locale-triggered reads, dirty Restore without confirmation and AI Apply during parent Save losing edits while a mutable action can misattribute the suggestion. Meaningful RED, synchronous captured-operation guards and finite native recovery/preservation proof are required before first-slice acceptance. No repair or runtime acceptance is claimed here. Bodyless restore/noExpectedVersion and RD21 remain preserved contract/debt, not hidden concurrency repair. Keep the seven-section workspace/table/renderer and the later compose dependency above; optional06F remains DEFERRED pending its action/fallback decision.
|
||||
|
||||
### P7-06 forms candidate and retained failures
|
||||
|
||||
[Forms report](p7-06/FORMS.md) records meaningful initial18pass/8fail RED, the scoped ambiguous old error locator, two GREEN-only identity additions, actual visual creation/attachment feedback defect and strengthened48pass/1fail RED before latest54/4 GREEN. Repairs keep loaded drafts/history and explicit read/mutation recovery, synchronous captured Save/AI/Restore ownership and keyed job disposal. Existing CV duplicate association semantics require explicit attachment recovery using the same created ID; no transaction/distributed-idempotency claim. Latest region/H3/Tooltip semantics have current native PageDown proof. First forms slice CONDITIONAL GO pending final static/push; overallP7-06 ongoing.
|
||||
|
||||
The real native language save produced HTTP500 on repeated locale attempts with the unchanged DLL; earlier9/9 does not close RD11. Latest17:14:27–17:16:29UTC native8/1 retains only the strict real-account EN language-save204 expectation receiving500; no rerun or waiver. Fresh current Jobs5/P2-D01ordinary1 give14pass/1fail of15; previous-build CV4/Career11 extend to29pass/1fail relevant30 with as-run qualifiers. The separate controlled503 case only proves local draft/Toast/exact-language Retry with unchanged account language; original real204 assertions remain. Keep RD11 diagnosis at P7-09. Prior55 scans0/749 full vectors and22/110 actual earlier image inspections remain qualified; no new axe totals are inferred. Generated Tailoring English titles/details in NB and raw history source/action enums go to P7-11; user text stays verbatim. RD21, translation-dependent frame reload, attachment ID0, AI-text freshness, human/device/zoom/fonts/photo/print/provider/release conditions and later compose dependency remain; no whole PRES status or production gate closes.
|
||||
|
||||
### Final P7-06 embedded-forms observation
|
||||
|
||||
Final embedded-forms implemented scope is **CONDITIONAL GO**, normal push pending. The matching aggregate/generation repair resolves the reviewed cross-job draft leak: ordinary parent RED18/1, latest affected **55/4 PASS** and actual SPA/heldB/exact two-job readback PASS. Final parent build9sM6acEkOGxgN5fTRZXdE has **9PASS/1FAIL of10** (unchanged strict actual NB language204→500/RD11); fresh Jobs5/P2-D01ordinary1 give **15PASS/1FAIL of16**, qualified earlier CV4/Career11 give **30PASS/1FAIL relevant31**. Backend30 sameDLL/no-build; app/browser types/lint/build PASS. All23/111 current forms PNGs actually reviewed, 55 recorded axe scans0/741 (current22/154+Jobs8/89; earlierCV12/121+Career13/377), full incomplete contexts pending human qualification. See [portable forms result](p7-06/evidence/forms-results.json). +11frontend/0suites derives **717/94**; +10browser derives **283**, no integrated run. All57 groups56PARTIAL/C11DEFERRED and32routes, P513withheld/06Fdeferred/main unchanged/productionNO-GO. Inbox/read and compose/send remain; Phase8 not started.
|
||||
|
||||
@@ -167,4 +167,16 @@ Implemented P7-03 scope is **CONDITIONAL GO**. The normal import/history push `5
|
||||
|
||||
### P7-05 Reminders and checkpoint disposition
|
||||
|
||||
[Reminders results](p7-05/evidence/reminders-results.json): J01/J02/J09/W11 unchanged groups/reasons/query/date/body/event/route and owner boundaries; capturedwrite versusGET-only retry, held single mutation and focus. Fresh17/3/new6native/backend6/types/lint/build pass;17actual image reviews/17all-enabledscans0/114 qualified. All57 remain56 PARTIAL/C11 DEFERRED/32routes. Generated reason localisation→P7-11; polling/network-uncertain write/DST/manual obligations retained. P7-05 implemented CONDITIONAL GO/hygienePASS+pushpending;706/94/browser273 derived only. P7-06 entry must preserve loaded dirty forms/frozen history and repair confirmed compose identity/save races at its approved boundary.
|
||||
[Reminders results](p7-05/evidence/reminders-results.json): J01/J02/J09/W11 unchanged groups/reasons/query/date/body/event/route and owner boundaries; capturedwrite versusGET-only retry, held single mutation and focus. Fresh17/3/new6native/backend6/types/lint/build pass;17actual image reviews/17all-enabledscans0/114 qualified. All57 remain56 PARTIAL/C11 DEFERRED/32routes. Generated reason localisation→P7-11; polling/network-uncertain write/DST/manual obligations retained. P7-05 implemented CONDITIONAL GO/hygienePASS; normal627955a push directly verified2026-10-13 11:49:32.473200UTC, clean localHEAD=origin=live/main unchanged.706/94/browser273 remain derived only.
|
||||
|
||||
### P7-06 embedded-forms entry
|
||||
|
||||
[Entry evidence](p7-06/evidence/entry.json) retains fresh39/3 affected baseline atc723a4e with uncommitted Reminders and seven unchanged captured sources. W01/W05–W10 retain the seven-section workspace, one CV variant, letter source/action and additive owned history, bodyless restore without ExpectedVersion (RD21), the two-answer Notes encoding/clear behavior and frozen package bytes. Loaded dirty controls/history, initial read Retry, locale-only no-read behavior, dirty Restore confirmation and captured/synchronous Save–AI review protection are first-slice acceptance requirements, not established fixes. M01–M06 inbox/provider/draft/send contracts remain for the next two sequential boundaries; known compose identity/save races must be repaired there. All57 statuses/32routes and manual/provider/output/release conditions remain unchanged; no P7-06 runtime acceptance is claimed at entry.
|
||||
|
||||
### P7-06 embedded forms — CONDITIONAL GO, final static/push pending
|
||||
|
||||
[Forms report](p7-06/FORMS.md) records loaded-draft/history recovery, five GET Retry owners without locale asset reads, dirty Restore confirmation, captured Save/AI action and keyed job-identity/unmount guards. Explicit attachment recovery reuses the created CV ID without another duplicate; the existing duplicate endpoint initially retains both association IDs, so no atomicity/idempotency claim is made. W01/W05–W08 package/Notes/letter/history contracts and bodyless restore/noExpectedVersion remain. Latest54/4 units/backend30 no-build pass; current buildxyh9FYyySEw1uIao4DveJ native8/1 retains only strict language-save204→HTTP500 EN (RD11), with PageDown passing. Current Jobs5/P2-D01ordinary1 give14pass/1fail of15; previous-build CV4/Career11 extend to29pass/1fail relevant30 with as-run qualifiers/actual prior PDF200. First forms slice CONDITIONAL GO pending final static/push; overallP7-06 ongoing. Prior55 scans0/749 and actual22/110 earlier image inspections remain qualified; no latest axe total or push is inferred. Derived716/94 frontend/282browser cases do not establish integrated totals; all57 statuses/32routes, manual/provider/output/production gates remain unchanged.
|
||||
|
||||
### Final P7-06 embedded-forms observation
|
||||
|
||||
Final embedded-forms implemented scope is **CONDITIONAL GO**, normal push pending. The matching aggregate/generation repair resolves the reviewed cross-job draft leak: ordinary parent RED18/1, latest affected **55/4 PASS** and actual SPA/heldB/exact two-job readback PASS. Final parent build9sM6acEkOGxgN5fTRZXdE has **9PASS/1FAIL of10** (unchanged strict actual NB language204→500/RD11); fresh Jobs5/P2-D01ordinary1 give **15PASS/1FAIL of16**, qualified earlier CV4/Career11 give **30PASS/1FAIL relevant31**. Backend30 sameDLL/no-build; app/browser types/lint/build PASS. All23/111 current forms PNGs actually reviewed, 55 recorded axe scans0/741 (current22/154+Jobs8/89; earlierCV12/121+Career13/377), full incomplete contexts pending human qualification. See [portable forms result](p7-06/evidence/forms-results.json). +11frontend/0suites derives **717/94**; +10browser derives **283**, no integrated run. All57 groups56PARTIAL/C11DEFERRED and32routes, P513withheld/06Fdeferred/main unchanged/productionNO-GO. Inbox/read and compose/send remain; Phase8 not started.
|
||||
|
||||
@@ -13,8 +13,8 @@ The entry commit is `b5319981ad3d1bd635daff861453d23c0de5320b` on `codex/ui-rede
|
||||
| [P7-02](p7-02/README.md) | Onboarding and Career overview/evidence | Entryad7b419 pushed/verified; bounded onboarding CONDITIONAL GO32/13/4+types/lint/build/13 actual PNG inspections, hygiene PASS and d21501aa push verified23:55:12UTC. Separate SQLite evidence-list repair91 guards/HTTP1/Release passed, pushed01281f52/direct receipt00:06:47UTC with unfinished Career work preserved. Career affected46/3/native14/preservation2/types/lint/build and actual22-image review pass; implemented checkpoint CONDITIONAL GO with99 incompletes/manual gates. Career final hygiene PASS (four commands0,9docs347links0errors); normally pushed8b4d5c2/direct localHEAD=origin=live receipt05:51:04UTC, clean worktree/main unchanged |
|
||||
| [P7-03](p7-03/README.md) | Career structured editing and import review | Source-ID and structured-editor commits pushed; final import/history runtime/design CONDITIONAL GO: affected76/6, native35, backend98/seeder24, types/lint/build PASS;33/54 final images inspected. Import17 scans0/302, editor13 scans0/377, Career22 scans0/99 retained. Final staged hygiene PASS; normal push5d6e3235 directly verified17:28:54UTC with clean worktree/main unchanged. RD21/human/provider/output gates remain;57/32 unchanged |
|
||||
| [P7-04](p7-04/README.md) | CV library and public entry | Implemented CONDITIONAL GO; library fcacae7 push verified. Public affected38/3/native8/types/lint/build and fresh fidelity16/36+8/24 PASS;18 images actually reviewed, frame-tested12/manual gates retained. Public final hygiene PASS/normal push bfa0ab6 directly verified22:24:44UTC, clean main unchanged |
|
||||
| [P7-05](p7-05/README.md) | Discovery, Companies, Offers and Reminders | Entry bfa0ab6 verified; Discovery21/1,new8+existing4native/backend14/types/lint/build pass;18 actual PNG reviews/qualified81+52incompletes. Discovery implemented CONDITIONAL GO, hygiene PASS/normal push34a4d6d verified; Companies30/4,new6+old2+named4native/backend2/types/lint/build pass;20actual PNG reviews/qualified91+163incompletes. Companies implemented CONDITIONAL GO, hygiene PASS/normal pusha8aba85 verified; Offers9/1,new4native/backend6/types/lint/build pass;14actual PNG reviews/15incompletes qualified. Offers implemented CONDITIONAL GO, hygiene PASS/normal pushc723a4e verified; Reminders17/3,new6native/backend6/types/lint/build pass;17actual PNG reviews/114incompletes qualified. P7-05 implemented CONDITIONAL GO, hygiene PASS/Reminders normal push pending; P7-06 next |
|
||||
| P7-06 | Remaining Application forms and global correspondence | Existing seven-section workspace, immutable packages and draft/send owners; planned |
|
||||
| [P7-05](p7-05/README.md) | Discovery, Companies, Offers and Reminders | Entry bfa0ab6 verified; Discovery21/1,new8+existing4native/backend14/types/lint/build pass;18 actual PNG reviews/qualified81+52incompletes. Discovery implemented CONDITIONAL GO, hygiene PASS/normal push34a4d6d verified; Companies30/4,new6+old2+named4native/backend2/types/lint/build pass;20actual PNG reviews/qualified91+163incompletes. Companies implemented CONDITIONAL GO, hygiene PASS/normal pusha8aba85 verified; Offers9/1,new4native/backend6/types/lint/build pass;14actual PNG reviews/15incompletes qualified. Offers implemented CONDITIONAL GO, hygiene PASS/normal pushc723a4e verified; Reminders17/3,new6native/backend6/types/lint/build pass;17actual PNG reviews/114incompletes qualified. P7-05 implemented CONDITIONAL GO, hygiene PASS/normal push627955a directly verified11:49:32UTC, clean localHEAD=origin=live/main unchanged; P7-06 next |
|
||||
| [P7-06](p7-06/README.md) | Remaining Application forms and global correspondence | Overall ongoing; [embedded forms](p7-06/FORMS.md) CONDITIONAL GO pending final static/push. Entry39/3/latest54/4 units/backend30 no-build retained. Current native8/1 has only unchanged strict language-save204→HTTP500 EN (RD11); current Jobs5/P2-D01ordinary1 give14pass/1fail of15. Previous-build CV4/Career11 give29pass/1fail relevant30 with as-run qualifiers. PageDown passes; no rerun/waiver or new axe/push claim. Derived716/94 frontend/282browser cases only;57/32 unchanged. Inbox/read review then compose/send remain separate sequential commits |
|
||||
| P7-06F | Deferred `followMode` reviewed composer | Optional separately reviewed mail slice; **DEFERRED** until mode→draft/review action and fallback are explicitly decided |
|
||||
| P7-07 | Documents owner-scoped index | Authenticated metadata-only paginated backend projection first; source destinations from P7-04/06; planned |
|
||||
| P7-08 | Existing notifications and operations | Existing store and real destinations; new enabled producers require F20 recovery evidence; planned |
|
||||
@@ -56,3 +56,7 @@ Implemented P7-03 scope is **CONDITIONAL GO**. The normal import/history push `5
|
||||
### P7-04 library finite disposition
|
||||
|
||||
[Library results](p7-04/evidence/library-results.json) record fresh affected38/4 (+12/0), ordinary native8, existing editor/gallery consumer4 with actual PDF200, unchanged-binary backend72 and types/lint/build PASS on _fYf-IvM_ULd3ZPdUW-8h. All19 final PNGs actually reviewed; finite root overflow0. Library19 all-enabled scans0/64 and editor12 retained-scope scans0/122 remain contextually qualified: badge/overlap/modal portals, disabled Undo/Redo wrappers and obscured print headings retain M09/M11/manual requirements. Server template names/categories remain English metadata in NB and are P7-11 localisation residual. Meaningful unit/native RED and peer fixes preserve draft/error/current-locale/managed-focus behavior; no assertion/rule waiver. Implemented library CONDITIONAL GO with final hygiene/push pending; public entry/full P7-04 pending. All57 statuses/32 routes unchanged; frontend660/93/browser241/backend1,034 derived only, full573/89/backend1,033/sidecar49 inherited until P7-12. RD21/canonical concurrency, old orphan/frozen/output/provider/human/release debt remains; P5-13 withheld/main NO-GO/Phase8 separate.
|
||||
|
||||
### Final P7-06 embedded-forms observation
|
||||
|
||||
Final embedded-forms implemented scope is **CONDITIONAL GO**, normal push pending. The matching aggregate/generation repair resolves the reviewed cross-job draft leak: ordinary parent RED18/1, latest affected **55/4 PASS** and actual SPA/heldB/exact two-job readback PASS. Final parent build9sM6acEkOGxgN5fTRZXdE has **9PASS/1FAIL of10** (unchanged strict actual NB language204→500/RD11); fresh Jobs5/P2-D01ordinary1 give **15PASS/1FAIL of16**, qualified earlier CV4/Career11 give **30PASS/1FAIL relevant31**. Backend30 sameDLL/no-build; app/browser types/lint/build PASS. All23/111 current forms PNGs actually reviewed, 55 recorded axe scans0/741 (current22/154+Jobs8/89; earlierCV12/121+Career13/377), full incomplete contexts pending human qualification. See [portable forms result](p7-06/evidence/forms-results.json). +11frontend/0suites derives **717/94**; +10browser derives **283**, no integrated run. All57 groups56PARTIAL/C11DEFERRED and32routes, P513withheld/06Fdeferred/main unchanged/productionNO-GO. Inbox/read and compose/send remain; Phase8 not started.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# P7-05 — Discovery, Companies, Offers and Reminders
|
||||
|
||||
**P7-05 implemented scope CONDITIONAL GO; all four domains implemented, final Reminders hygiene PASS/normal push pending.** Follow the exact [approved handoff](../../phase-6/p6-05/PHASE7_HANDOFF.md#migration-order-and-commit-boundaries): Discovery, Companies, Offers, then Reminders as four separate normal development commits.
|
||||
**P7-05 implemented scope CONDITIONAL GO; all four domains implemented, final Reminders hygiene PASS/normal push verified.** Follow the exact [approved handoff](../../phase-6/p6-05/PHASE7_HANDOFF.md#migration-order-and-commit-boundaries): Discovery, Companies, Offers, then Reminders as four separate normal development commits.
|
||||
|
||||
[Entry evidence](evidence/entry.json) records the actual bfa0ab6 public push, clean direct development equality/main unchanged and13 exact committed source baselines. P7-04 implemented scope is CONDITIONAL GO: affected38/3/public native8/fidelity16/36+8/24/types/lint/build/static checks pass;18 public PNGs actually inspected. Sandbox frame-tested12 and separate settings incompletes223 remain. Whole frontend573/89/backend1,033/sidecar49 are inherited; frontend673/93/browser249/backend1,034 are derived expectations, not integrated reruns.
|
||||
|
||||
@@ -65,7 +65,7 @@ Unit RED1/8 becomes9/1; a test-only narrow Intl.Locale mock type was corrected w
|
||||
|
||||
## Reminders implemented result and P7-05 disposition
|
||||
|
||||
**Reminders and implemented P7-05 scope CONDITIONAL GO; hygiene PASS/normal push pending.** [Reminders entry](evidence/reminders-entry.json) carries the actual verified Offers pushc723a4e. [Finite results](evidence/reminders-results.json): fresh **17/3 frontend**, **6 ordinary native**, **6 unchanged-backend**, app/browser TypeScript, lint and build pass. New10/+1suite gives **706/94 frontend derived only**; new6 gives **273 browser derived only**. P7-05 adds33 cases/1suite and24 ordinary browser cases across four domains; no integrated totals until P7-12. Latest whole573/89/backend1,033/sidecar49 stay inherited, backend1,034 derived.
|
||||
**Reminders and implemented P7-05 scope CONDITIONAL GO; hygiene PASS/normal push627955a verified.** [Reminders entry](evidence/reminders-entry.json) carries the actual verified Offers pushc723a4e. [Finite results](evidence/reminders-results.json): fresh **17/3 frontend**, **6 ordinary native**, **6 unchanged-backend**, app/browser TypeScript, lint and build pass. New10/+1suite gives **706/94 frontend derived only**; new6 gives **273 browser derived only**. P7-05 adds33 cases/1suite and24 ordinary browser cases across four domains; no integrated totals until P7-12. Latest whole573/89/backend1,033/sidecar49 stay inherited, backend1,034 derived.
|
||||
|
||||
Existing four groups, server reason precedence, group order,14-day query and workflow destinations remain. Shared H2/header, named stable region, H3 groups with readable counts, H4 named articles, tokens, wrapping chips and actions replace one-off presentation. Canonical statuses and dates follow current UI language; translated controls include their visible text in contextual accessible names. Custom fallback text remains verbatim; generated serverEnglish reasons in Bokmål are explicit P7-11 residual localisation work.
|
||||
|
||||
@@ -79,4 +79,4 @@ Meaningful RED2/8 includes3 actual PATCHs for each held+3/+7/clear, unreachable
|
||||
|
||||
All four approved P7-05 domains are now implemented as separate coherent commits: Discovery34a4d6d, Companiesa8aba85, Offersc723a4e and this Reminders boundary. Proceed to P7-06 embedded forms, then inbox/read, then compose/send. Existing seven-section workspace remains; confirmed recovery/dirty/delivery safety findings are entry dependencies for the affected owner, not permission for a framework or schema rewrite.
|
||||
|
||||
[Final finite hygiene](evidence/reminders-static-checks.json) passed four raw commands at2026-10-13 11:48:26–28UTC,12documents/437links0errors,57groups/32routes. Final staged whitespace follows staging; normal Reminders push receipt follows observation in P7-06 entry.
|
||||
[Final finite hygiene](evidence/reminders-static-checks.json) passed four raw commands at2026-10-13 11:48:26–28UTC,12documents/437links0errors,57groups/32routes. The normal Reminders push `627955afa989d32fefa53f15da9ef3e0abf27038` was directly verified at2026-10-13 11:49:32.473200UTC: localHEAD=origin=live development, clean worktree, local/origin/live main unchanged `27657f31131cd95d42f0e1290853ec9c9b3959a4`. The actual receipt is retained in finite results and [P7-06 entry](../p7-06/evidence/entry.json); no new runtime or human acceptance follows from the push.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"checkpoint": "P7-05",
|
||||
"slice": "Reminders",
|
||||
"recordedUtc": "2026-10-13T11:48:25.399199+00:00",
|
||||
"acceptance": "REMINDERS_AND_P7_05_IMPLEMENTED_SCOPE_CONDITIONAL_GO_HYGIENE_PASS_NORMAL_PUSH_PENDING",
|
||||
"acceptance": "REMINDERS_AND_P7_05_IMPLEMENTED_SCOPE_CONDITIONAL_GO_HYGIENE_PASS_NORMAL_PUSH_VERIFIED",
|
||||
"entryReceipt": {
|
||||
"checkpoint": "P7-05",
|
||||
"slice": "Reminders",
|
||||
@@ -2192,7 +2192,7 @@
|
||||
"freshIntegratedAcceptance": "P7-12 pending"
|
||||
},
|
||||
"preservation": "All57 remain56 PARTIAL/C11 DEFERRED;32 routes. J01/J02/J09/W11 four groups, owner read/write, captured-date/error/read recovery and context/focus supported; no query/calendar/schema/API/history meaning/model/renderer/production change.",
|
||||
"remaining": "P7-06 onward pending; confirmed embeddedforms/compose safety findings must be repaired at their approved boundaries. Human AT/device/realzoom/fontphoto/provider/release obligations remain;P5-13 withheld/P7-06Fdeferred/Phase8separate/mainunchanged/productionNO-GO.",
|
||||
"remaining": "P7-06 entry recorded; embedded forms ongoing, then separate inbox/read and compose/send boundaries. No P7-06 runtime acceptance claimed by this predecessor report. Confirmed embeddedforms/compose safety findings must be repaired at their approved boundaries. Human AT/device/realzoom/fontphoto/provider/release obligations remain;P5-13 withheld/P7-06Fdeferred/Phase8separate/mainunchanged/productionNO-GO.",
|
||||
"staticChecks": {
|
||||
"schemaVersion": 1,
|
||||
"checkpoint": "p7-05",
|
||||
@@ -2297,5 +2297,105 @@
|
||||
"Static evidence is not runtime/manual/device/provider/production acceptance."
|
||||
]
|
||||
},
|
||||
"peerReview": "Bounded read-only connected-contract review found no material introduced issue; local mutex is not distributed idempotency."
|
||||
"peerReview": "Bounded read-only connected-contract review found no material introduced issue; local mutex is not distributed idempotency.",
|
||||
"push": {
|
||||
"observedUtc": "2026-10-13T11:49:32.473200+00:00",
|
||||
"branch": "codex/ui-redesign-phase4",
|
||||
"head": "627955afa989d32fefa53f15da9ef3e0abf27038",
|
||||
"originDevelopment": "627955afa989d32fefa53f15da9ef3e0abf27038",
|
||||
"liveDevelopment": "627955afa989d32fefa53f15da9ef3e0abf27038",
|
||||
"main": "27657f31131cd95d42f0e1290853ec9c9b3959a4",
|
||||
"originMain": "27657f31131cd95d42f0e1290853ec9c9b3959a4",
|
||||
"liveMain": "27657f31131cd95d42f0e1290853ec9c9b3959a4",
|
||||
"workingTreeClean": true,
|
||||
"pendingPaths": [],
|
||||
"commands": [
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"branch",
|
||||
"--show-current"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "codex/ui-redesign-phase4\n",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
},
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"rev-parse",
|
||||
"HEAD"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "627955afa989d32fefa53f15da9ef3e0abf27038\n",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
},
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"rev-parse",
|
||||
"origin/codex/ui-redesign-phase4"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "627955afa989d32fefa53f15da9ef3e0abf27038\n",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
},
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"rev-parse",
|
||||
"main"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "27657f31131cd95d42f0e1290853ec9c9b3959a4\n",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
},
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"rev-parse",
|
||||
"origin/main"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "27657f31131cd95d42f0e1290853ec9c9b3959a4\n",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
},
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"ls-remote",
|
||||
"origin",
|
||||
"refs/heads/codex/ui-redesign-phase4",
|
||||
"refs/heads/main"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "627955afa989d32fefa53f15da9ef3e0abf27038\trefs/heads/codex/ui-redesign-phase4\n27657f31131cd95d42f0e1290853ec9c9b3959a4\trefs/heads/main\n",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
},
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"status",
|
||||
"--porcelain=v1"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
# P7-06 — Embedded Application forms
|
||||
|
||||
**Embedded forms: CONDITIONAL GO; normal development push pending.** Latest affected55/4 PASS, native9/1 and15/1 final-build consumers retain the strict real-account language-save HTTP500 failure (RD11); it is not waived or rerun to replace the result. Overall P7-06 remains ongoing. This is the first of exactly three sequential P7-06 commits: embedded forms → inbox/read review → compose/send. No implementation hash or push receipt is assigned here. Optional P7-06F remains DEFERRED until its action/fallback decision exists.
|
||||
|
||||
The [entry](evidence/entry.json) retains the actual627955a Reminders receipt and the earlier fresh39/3 baseline atc723a4e with uncommitted Reminders work. Seven relevant captured sources remained unchanged through that baseline. The clean receipt and pre-change run are separate observations.
|
||||
|
||||
## Bounded repairs and preserved behavior
|
||||
|
||||
The existing `ApplicationAssets.tsx` owner retains loaded controls, dirty drafts and owned history after failed mutations. Its five initial reads expose explicit GET Retry; changing UI language retranslates without another asset GET or write. Archive Retry repeats the captured archive read; failed mutations remain deliberate original actions rather than an automatic replay.
|
||||
|
||||
Dirty Restore uses the shared confirmation and a synchronous mutation mutex; Cancel makes zero restore POSTs. AI Apply stays blocked while the parent Save is busy, and suggestion source/action is captured so changing the current action cannot relabel an earlier result. Five job-ID keyed children and unmount guards dispose old-job state and prevent old completions from copying into a new job, redirecting or invoking its saved callback.
|
||||
|
||||
The existing CV duplicate endpoint preserves `JobApplicationId` on both variants before explicit attachment. Consequently, a newer GET projection can differ from stale UI association state. When creation succeeds but attachment fails, the candidate retains that exact created ID and offers explicit attachment recovery, normalizing to one associated variant without another duplicate. This is finite local recovery, not transactionality or distributed idempotency. Actual image034 exposed misleading “could not create” copy after successful creation; the feedback now distinguishes attachment failure.
|
||||
|
||||
The shared RichText Tooltip is hidden only when Popper marks its reference hidden. Application forms, CV Editor and Career remain its three consumers. Final dialog work uses `DialogContent` as a named region with `tabIndex=0`, H3 subheads and both Restore Tooltips with `describeChild`, replacing the owner generic-label semantics. Latest native evidence proves keyboard PageDown scrolling. Updated scan totals are not inferred from this source change.
|
||||
|
||||
Retain the seven-section workspace, table, Router/history/aliases and renderer. One CV variant, letter source/action and additive owned history, bodyless restore/noExpectedVersion, the two-answer Notes encoding/clear behavior, P2-D01 frozen package bytes and archived binaries remain unchanged. No backend or schema contract was changed; RD21 last-writer/partial-write limits remain.
|
||||
|
||||
## Unit evidence and count provenance
|
||||
|
||||
| Observation | Executed outcome | Qualification |
|
||||
|---|---|---|
|
||||
| Pre-change baseline,11:39:16–27UTC |39/3: assets18+overlay18+helper3; no failed/pending/todo | Exact frozen entry capsule; not a clean627955a baseline |
|
||||
| Eight strengthened cases,12:07:57–12:08:04UTC |Assets26:18 pass/8 fail | Meaningful RED for the existing defects; raw command/report retained in `forms/unit-red` |
|
||||
| First candidate |46/47, then47/3 after scoping an old assertion | The global error locator became ambiguous because the AI read failure is now visible; the assertion retains its original intent rather than hiding the error |
|
||||
| Two keyed-identity cases |49/3: assets28+overlay18+helper3 | GREEN-only additions; do not claim those two reproduced RED |
|
||||
| Creation/attachment copy correction,16:56:29–48UTC |48 pass/1 fail | Strengthened existing assertion after actual visual review; raw prefix `p706-forms-copy-attachment-red-20261013-review-20261013T165629Z` |
|
||||
| Corrected copy plus named controls |54/4 | Raw GREEN prefix `p706-forms-copy-attachment-green-20261013-20261013T170047Z` |
|
||||
| Latest semantic candidate,17:09:04.624961–17:09:20.681746UTC |54/4: affected49/3 plus existing named controls5/1; zero failed/pending/todo | Raw prefix `p706-forms-final-semantics-green-20261013-20261013T170904Z`; no complete slice acceptance |
|
||||
|
||||
Raw prefixes above are under `.artifacts/phase7/current/unit`; each retains its JSON report, command and log. Ten new frontend cases/zero new suites derive **716/94**, not a fresh full frontend run. The five named-control cases already belong to the inherited whole suite and are not counted again. Nine new ordinary native cases (eight original plus a separate controlled503 case) derive **282 browser cases**, not an integrated total or282 fresh passes. Latest full573/89 frontend, backend1,033 and sidecar49 remain inherited; backend1,034 remains derived only.
|
||||
|
||||
## Native, backend and consumer evidence
|
||||
|
||||
| Run | Outcome | Retained limit |
|
||||
|---|---|---|
|
||||
| Native attempt1 |1 pass/7 fail | Exact failing traces/source/export in `.artifacts/phase7/p7-06/forms/attempt-1-F7dRaRLWo_pjz6zoPoAPk` |
|
||||
| Native attempt2 |6 pass/2 fail | Exact capsule `attempt-2-_Hza-JrlN1-7iFYcv7mKU`; failures remain recorded |
|
||||
| Native attempt3,16:48:57.993686–16:50:58.615845UTC |9/9 pass | Earlier candidate capsule `.artifacts/phase7/p7-06/forms/final/results.json`, SHA256 `4da6523e909f0a69cfead47e73cd094bb391b37d181e7efd05b5421919f6e322`; does not validate later semantic changes |
|
||||
| Native attempt4,17:02:34–17:04:33UTC |8 pass/1 fail | Known real language-save HTTP500; `attempt-4-7rHcRydumjgHBrGRn7NZA/results.json`, SHA256 `5268cfd446ba5b91917c2ccc30c786584eb8d497278373f397a2e6d2c0501de1` |
|
||||
| Latest semantic native,17:14:27.950279–17:16:29.233143UTC |8 pass/1 fail of9 | Build `xyh9FYyySEw1uIao4DveJ`; only unchanged strict real-account language-save204 expectation receives HTTP500 on EN (RD11). Keyboard PageDown scrolling passes; no rerun/waiver |
|
||||
| Fresh current Jobs,17:19:43.987302–17:21:24.862279UTC |5 pass | Same current build; retained seven-section workspace consumer proof |
|
||||
| Fresh current P2-D01,17:21:24.868267–17:21:36.805313UTC |1 ordinary pass | Same current build; native frozen-document preservation remains ordinary |
|
||||
| Earlier RichText/workspace consumers,16:41:46–16:45:50UTC |Jobs5/P2-D01 ordinary1/CV4/Career11 pass | Previous build/as-run source evidence; actual CV PDF200 and unchanged RichText bytes through those lanes. CV4/Career11 are not relabelled as fresh current-build runs |
|
||||
| Existing backend asset/package subset,16:18:00.184066–16:18:03.191603UTC |30/30, no-build | Same verified unchanged Release DLL; raw `.artifacts/phase7/current/backend-career/p706-forms-20261013T161800Z/command.json` and `career.trx`. No backend rebuild/full rerun |
|
||||
|
||||
Fresh final current-build evidence is **14 pass/1 fail of15** (forms8/1+Jobs5+P2-D01ordinary1). Including previous-build CV4 and Career11 gives **29 pass/1 fail of30 relevant cases**, with those build/source qualifiers retained. Repeated earlier Jobs/P2-D01 runs are not added again. Latest actual frontend remains54/4 at17:09UTC; these are finite affected/consumer counts, not whole-suite acceptance.
|
||||
|
||||
All native cases remain ordinary: no skip, expected failure, weakened real204 assertion, automatic retry or disabled rule is used. Actual HTTP500 occurred on repeated locale attempts with the unchanged DLL; the latest sole failure is EN. A passing run does not close RD11; retain diagnosis at P7-09. The separate controlled503 case proves only local dirty-draft retention, Toast feedback, exact language Retry and unchanged account language. It does not repair or replace the original real204 test.
|
||||
|
||||
The latest dialog semantics now have current-build native PageDown and workspace/frozen-document evidence, qualified by the retained RD11 failure. Final static/hygiene and current source/export evidence must be finalized before the normal development commit/push; no push hash or receipt is claimed here. The first forms slice is CONDITIONAL GO on that finite scope, while complete workflow human/device/provider/output and production acceptance remain unavailable.
|
||||
|
||||
## Visual/accessibility evidence and retained debt
|
||||
|
||||
The operator actually displayed/reviewed **all22 current forms PNGs** from `.artifacts/phase7/p7-06/forms/final-verified`:22/110 total images, with88 other retained images. Current creation-success/attachment-failure feedback now correctly describes the attachment failure. The earlier22/110 review that exposed the incorrect copy remains a separate observation; repeated images are not additional cases. Full-page sticky composites and the long360×5288 image scaled to139×2048 do not prove every pixel, viewport occlusion, real zoom or a physical device. Textarea autosizing remains; no short screenshot is substituted for long-form evidence.
|
||||
|
||||
Final verified capsule `.artifacts/phase7/p7-06/forms/final-verified/results.json` has SHA256 `28da994d574e819208d65edc756fac13eca0597a9d622bcd47a3eb488db7eea4`; captured `ApplicationAssets.tsx` has SHA256 `d3be34c85fd4ab8984356f5fdc8a5b741590120e4253f97246bf870486d027c1`. These identify the current reviewed evidence/source; final portable/static records and normal push observation remain separately pending.
|
||||
|
||||
Prior triage contains **55 scans,0 violations/749 incompletes**: new22 default+target-size0/162; Jobs8 WCAG0/89; CV12 WCAG0/121; Career13 default+target-size0/377. Exact vectors remain in `.artifacts/phase7/p7-06/forms/axe-triage-prior.json`, SHA256 `f24695b6deaa30798672f4c0485fb68fa536877da14fa1c4006df1fddf7f279a`. Contrast623 includes unknown ratio0 contexts and526 overlap-labelled contexts with empty related nodes; span-label, hidden-modal and frame-tested contexts retain their own conditions. Empty related nodes/ratio0 do not establish a cause, contrast ratio or AT acceptance.
|
||||
|
||||
Latest contextual triage is `.artifacts/phase7/p7-06/forms/axe-triage-final.json`, referenced by the [portable result](evidence/forms-results.json). The current forms **21 scans0/147** and Jobs **8 scans0/89** join earlier qualified CV12/121 and Career13/377, totaling **54 scans0/734**. Four Restore span labels and three DialogContent generic labels disappear across matched scans. The remaining eight-node reduction comes from the missing second real-locale capture after HTTP500, not improved contrast. Forty-two other generic span labels remain; modal/background, sandbox-frame and unknown contrast contexts still require manual qualification. No rule was disabled and no incomplete was treated as a pass.
|
||||
|
||||
The portable result verifies453 saved file references, all six pre-native sources,74 current export files and the unchanged backend DLL. A failed collector attempt with incorrectly named source paths remains an incomplete ignored `final-semantic` folder; it performed no tests and is not an acceptance capsule. `final-verified` is authoritative for this final observation. Current [static checks](evidence/forms-static-checks.json) and the separately observed successor push receipt complete the bounded evidence record.
|
||||
|
||||
## Parent aggregate identity repair after review
|
||||
|
||||
Read-only review found that the keyed answers child could still receive A's aggregate while navigating to B. This inherited parent gap allowed editing one B field to retain and later save A's other field. The original child-only tests supplied already-correct B props and did not cover that transition. A new ordinary parent/router test exposes the actual received props: its first run is18 passing/1 failing, with `43|Saved answer|Saved recruiter message` incorrectly present while B's GET is held.
|
||||
|
||||
The aggregate now projects only data whose ID matches the current job, the answers editor waits for that aggregate, and read generations invalidate previous job/locale/unmounted completions. Same-job refresh still retains the current editor and its dirty state. The unchanged18 parent tests plus the new case pass; all affected assets28/parent19/helper3/namedcontrols5 yield **55/4** at21:15:52.411907–21:16:08.617731UTC. An intermediate52/3 run accidentally named a nonexistent helper file; it did execute those52 cases and is retained, but is not evidence for the helper3. This one addition derives **717/94 frontend**, replacing716/94 only as a derived count.
|
||||
|
||||
A tenth native case exercises actual command-palette SPA navigation, a held B aggregate, absence of foreign draft fields, explicit one-field B save and real-HTTP readback of both jobs. Its final execution, export/source/static/push observations remain pending. Ten new ordinary cases would derive **283 browser**, without claiming an integrated run. Previous55-scan and latest54-scan observations above identify their actual earlier source/export; they do not prove this later parent change.
|
||||
|
||||
Generated Tailoring titles/details remain server English in Bokmål; raw version source/action enums remain P7-11 localisation residuals. User-authored text is not automatically translated. Existing frame-level translation-dependent reload, attachment ID0 and AI-text freshness remain separately scoped. RD21, M01–M12 human reader/device/software keyboard/zoom, fonts/photo/native print/other-browser/provider/release requirements stay open. All57 groups remain56 PARTIAL/PRES-C11 DEFERRED and32 routes; P5-13 remains withheld,06F deferred, production NO-GO/main27657f3 unchanged and Phase8 separate. Inbox/read review and confirmed compose safety work remain the next two sequential boundaries.
|
||||
|
||||
The first parent-change native observation is retained in `forms/attempt-6-parent-9sM6acEkOGxgN5fTRZXdE/results.json` (SHA25627517dce65e6b68e1d9c1268776df9ddc458b063701a076437ce20da2bb9d1f0):7 pass/3 fail at21:17:34.149961–21:19:12.484298UTC. The new fixture incorrectly expected201 when the company already existed (the endpoint correctly returned200); it now reuses the owned company ID and retains the job201 assertion. The frozen dialog check set scrollTop0 while keyboard PageDown animation was still running, observed8 and failed; it now verifies keyboard Home returns0 after actual PageDown. Neither changes frozen byte/persistence assertions. The third failure remains strict real locale204→500. Corrected test-only execution is pending; no failed run is discarded.
|
||||
|
||||
Final parent-source forms run at21:19:34.115654–21:21:37.836490UTC is **9 pass/1 fail of10**, retaining the ordinary first-Bokmål204→500 test. The new same-document navigation and exact two-job readback case passes; PageDown→Home and frozen HTML/file bytes pass. All23 current forms PNGs were actually displayed/reviewed, including the held B empty editor and saved B ownership views and the failed actual-language screenshot. Earlier22-image reviews remain separate. Affected and integrated counts remain distinct: latest frontend55/4; final count derivation717/94 and283 browser only.
|
||||
|
||||
The authoritative final capsule is `forms/parent-final/results.json`, SHA256e1ff6f5c9928a765630db3229b1ae88312e65cea82d24efabc16ccec6a817c1e, with23/111 final forms images actually reviewed. Final triage `forms/axe-triage-parent.json` SHA25651f6adcb2b205f0a983c73646864a53ba2b724a453217c3f5390d0520e35da67 records currentforms22/154 plus currentJobs8/89 and earlierqualifiedCV12/121,Career13/377:55scans0violations/741incomplete. Twenty matchedforms scans retain7semantic removals;2newB captures and2missingstrictlocale captures explain scope changes. This is not improved contrast. All current snapshots/74export files match;6of7pre-native files match, native fixture/Home changes explicitly qualified. Exportdigest e91f356cb09a8e828ad10e6497eb2927d5e7159b48907ddcd7132458486f9a1f. FreshJobs5 at21:21:45.248272–21:23:27.806820 andordinaryP2-D01 at21:23:27.812337–21:23:39.684013 PASS; earlier CV4/Career11 remain correct as-run qualifications. SourceWorkspace7a0fb891f2632b35a8267ca0143a68522334f20bd2b2eda57b3ed2661e357934, nativeb349b5190226b0d4b5e4cfd9a56d0bd5507c7ad5da328f11d5b38829cb271914. Final static/normal push observation is separate.
|
||||
|
||||
Final hygiene at21:26:32–35UTC passes tracked/untracked secret scan, working/staged/Phase7 whitespace,14document465relative-link checks,57groups and32original routes. Local development HEAD/origin still627955a after fresh fetch; main27657f3 unchanged. Normal development commit/push receipt follows in the inbox/read successor record, avoiding a self-referential commit hash. RD11 remains ordinary failing and mandatory; independent safe development can continue.
|
||||
@@ -0,0 +1,46 @@
|
||||
# P7-06 — Remaining Application forms and global correspondence
|
||||
|
||||
**Embedded forms: CONDITIONAL GO; final static checks and normal push pending. Overall P7-06 remains ongoing.** The [bounded forms report](FORMS.md) records repairs, meaningful failures and finite evidence, including the unchanged strict language-save HTTP500 failure (RD11). Follow the exact [approved handoff](../../phase-6/p6-05/PHASE7_HANDOFF.md#migration-order-and-commit-boundaries). P7-06 has exactly three sequential implementation commits: embedded forms, inbox/read review, then compose/send. Optional P7-06F remains **DEFERRED** until its exact mode→draft/review action and fallback are decided.
|
||||
|
||||
[Entry evidence](evidence/entry.json) records the actual Reminders normal push `627955afa989d32fefa53f15da9ef3e0abf27038`, directly observed2026-10-13 11:49:32.473200UTC: localHEAD=origin=live development, clean worktree at observation, local/origin/live main unchanged `27657f31131cd95d42f0e1290853ec9c9b3959a4`. P7-05 implemented scope is CONDITIONAL GO. Its push adds no new runtime, human or production acceptance.
|
||||
|
||||
## Fresh pre-change baseline
|
||||
|
||||
The existing affected Jest baseline passes **39 cases/3 suites**: Application assets18, workspace overlay18 and workspace helper3, with zero failed, skipped/pending or todo cases. It ran2026-10-13 11:39:16.918910–11:39:27.061883UTC at HEAD `c723a4e3032185da623d81ace241eec748506fc7` with uncommitted Reminders work. All seven captured relevant sources remained unchanged through the run. This earlier source/run capsule is separate from the later clean627955a receipt.
|
||||
|
||||
Exact ignored capsule: `.artifacts/phase7/p7-06/forms/unit-baseline`. Its raw JSON report is `p706-forms-baseline-20261013-review-20261013T113916Z.json`, SHA256 `6cd3a67d35f0172d3c7de32287a72c2f1fd3aee6b6bcee15474f7ceaeff3f81e`. Portable entry retains the command, source hashes, raw report descriptors and after-run source equality. Existing mocked tests establish a baseline; they do not establish a repair or native acceptance.
|
||||
|
||||
## Sequential boundaries and required proof
|
||||
|
||||
| Order | Existing owner and bounded work | Required exit |
|
||||
|---|---|---|
|
||||
| 1 — Embedded forms | `ApplicationAssets.tsx`; retain the seven-section workspace, table, routes and renderer. Correct loaded-state/error/retry/dirty/AI review presentation and synchronous operation ownership in this owner | Meaningful RED and focused unit/native proof for read error→GET-only Retry, loaded dirty save/restore failure, long letter/answers/history, dirty Cancel/Restore, locale change without resource reads/writes and held Save/AI Apply/action context. Preserve current data/readback and frozen package bytes |
|
||||
| 2 — Inbox/read review | Existing CorrespondenceInboxPage/GmailReviewPage and review alias; retain list/detail/filter/page/back/provider ownership | Native populated/empty/loading/error/retry/foreign cases, filters/pages and detail→Back context, keyboard/focus/reflow and explicit review choices; no compose persistence restructuring |
|
||||
| 3 — Compose/send | Existing draft revision, confirmation and delivery owners; repair the [confirmed compose safety dependency](../DEBT.md#p7-06-confirmed-compose-safety-entry-dependency) coherently at this boundary | Meaningful runtime RED, captured-identity/synchronous Save–Send protection, complete dirty fields, revision/stale-conflict recovery, explicit confirmed send, uncertain-delivery protection and deliberate definitive-failure new attempt; no automatic send/resend |
|
||||
|
||||
The first slice entered with confirmed code-path findings: mutation errors hide loaded dirty controls/history; initial GET failures lack Retry; locale changes trigger reads; dirty Restore has no confirmation; AI Apply during parent Save can lose edits and a mutable action can misattribute its suggestion. [FORMS.md](FORMS.md) records repairs, exact operation/identity guards and attachment recovery. Latest54/4 units pass. Current buildxyh9FYyySEw1uIao4DveJ native8/1 retains only the strict real-account language-save204→HTTP500 EN failure; keyboard PageDown passes. Fresh current Jobs5/P2-D01ordinary1 give14pass/1fail of15; previous-build CV4/Career11 extend the relevant count to29pass/1fail of30, retaining their as-run source/build qualifiers. Final static/push proof is pending; RD11 is not waived or closed.
|
||||
|
||||
## Preserved contracts
|
||||
|
||||
- One CV variant per application; current source, association and tenant/resource boundaries.
|
||||
- Cover-letter source/action and additive owned history; dirty discard remains deliberate.
|
||||
- Bodyless restore without ExpectedVersion; [RD21](../DEBT.md) remains open rather than becoming a hidden concurrency rewrite.
|
||||
- The two existing application answers use their current Notes encoding and clearing behavior.
|
||||
- Draft/frozen packages, archived attachments and native P2-D01 byte proof remain unchanged.
|
||||
- Existing shared MUI/theme/state/confirm/error/i18n owners; no generic Documents persistence or second renderer.
|
||||
|
||||
Follow EN/Bokmål, light/dark, narrow/long forms, density, keyboard/focus/error and relevant viewport/zoom requirements from the handoff. Capture exact source/run artifacts, inspect final images and triage all-enabled axe vectors without replacing applicable human/device checks.
|
||||
|
||||
## Current disposition and retained gates
|
||||
|
||||
All57 preservation groups remain **56 PARTIAL /PRES-C11 DEFERRED** and32 routes. Entry frontend **706/94**, browser **273** and backend **1,034** are **derived only**. Latest full frontend573/89, backend1,033 and sidecar49 remain inherited; P7-12 owns fresh integrated regression. No P7-06 additions are claimed by this baseline.
|
||||
|
||||
The forms slice adds10 frontend cases/zero suites and9 ordinary browser cases, deriving **716/94 frontend** and **282 browser cases** only. Latest affected54/4 includes existing named controls5/1, which are not counted again. Existing backend30/30 no-build and qualified RichText/workspace consumer evidence do not establish a new whole-suite run or complete forms acceptance. All22 current forms PNGs from `final-verified` were actually displayed/reviewed:22/110 total, with88 other retained images; corrected attachment-failure copy is confirmed. The earlier22/110 review remains separate. Sticky composites/scaled long images retain pixel/occlusion/zoom/device limits. Prior55 scans0/749 stay qualified; no new axe total is inferred. Final portable/static/hygiene/push records remain pending, with production NO-GO.
|
||||
|
||||
The current reviewed capsule `.artifacts/phase7/p7-06/forms/final-verified/results.json` has SHA256 `28da994d574e819208d65edc756fac13eca0597a9d622bcd47a3eb488db7eea4`; captured `ApplicationAssets.tsx` has SHA256 `d3be34c85fd4ab8984356f5fdc8a5b741590120e4253f97246bf870486d027c1`. [FORMS.md](FORMS.md) retains the finite current/prior-source and visual qualifications.
|
||||
|
||||
M01–M12 remain NOT VERIFIED. Actual reader/device/software keyboard/browser zoom, deployed fonts/photo/native print/other browser, provider and release qualifications remain. P5-13 stays withheld; P7-06F stays deferred; production remains **NO-GO**, main unchanged and Phase8 has no implementation. Embedded forms continue first; inbox/read review and compose/send remain separate later commits.
|
||||
|
||||
### Final P7-06 embedded-forms observation
|
||||
|
||||
Final embedded-forms implemented scope is **CONDITIONAL GO**, normal push pending. The matching aggregate/generation repair resolves the reviewed cross-job draft leak: ordinary parent RED18/1, latest affected **55/4 PASS** and actual SPA/heldB/exact two-job readback PASS. Final parent build9sM6acEkOGxgN5fTRZXdE has **9PASS/1FAIL of10** (unchanged strict actual NB language204→500/RD11); fresh Jobs5/P2-D01ordinary1 give **15PASS/1FAIL of16**, qualified earlier CV4/Career11 give **30PASS/1FAIL relevant31**. Backend30 sameDLL/no-build; app/browser types/lint/build PASS. All23/111 current forms PNGs actually reviewed, 55 recorded axe scans0/741 (current22/154+Jobs8/89; earlierCV12/121+Career13/377), full incomplete contexts pending human qualification. See [portable forms result](evidence/forms-results.json). +11frontend/0suites derives **717/94**; +10browser derives **283**, no integrated run. All57 groups56PARTIAL/C11DEFERRED and32routes, P513withheld/06Fdeferred/main unchanged/productionNO-GO. Inbox/read and compose/send remain; Phase8 not started.
|
||||
@@ -0,0 +1,350 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"checkpoint": "P7-06",
|
||||
"slice": "Embedded Application forms entry",
|
||||
"acceptance": "ENTRY_RECORDED_EMBEDDED_FORMS_ONGOING_RUNTIME_ACCEPTANCE_PENDING",
|
||||
"previousRemindersPush": {
|
||||
"observedUtc": "2026-10-13T11:49:32.473200+00:00",
|
||||
"branch": "codex/ui-redesign-phase4",
|
||||
"head": "627955afa989d32fefa53f15da9ef3e0abf27038",
|
||||
"originDevelopment": "627955afa989d32fefa53f15da9ef3e0abf27038",
|
||||
"liveDevelopment": "627955afa989d32fefa53f15da9ef3e0abf27038",
|
||||
"main": "27657f31131cd95d42f0e1290853ec9c9b3959a4",
|
||||
"originMain": "27657f31131cd95d42f0e1290853ec9c9b3959a4",
|
||||
"liveMain": "27657f31131cd95d42f0e1290853ec9c9b3959a4",
|
||||
"workingTreeClean": true,
|
||||
"pendingPaths": [],
|
||||
"commands": [
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"branch",
|
||||
"--show-current"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "codex/ui-redesign-phase4\n",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
},
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"rev-parse",
|
||||
"HEAD"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "627955afa989d32fefa53f15da9ef3e0abf27038\n",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
},
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"rev-parse",
|
||||
"origin/codex/ui-redesign-phase4"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "627955afa989d32fefa53f15da9ef3e0abf27038\n",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
},
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"rev-parse",
|
||||
"main"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "27657f31131cd95d42f0e1290853ec9c9b3959a4\n",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
},
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"rev-parse",
|
||||
"origin/main"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "27657f31131cd95d42f0e1290853ec9c9b3959a4\n",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
},
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"ls-remote",
|
||||
"origin",
|
||||
"refs/heads/codex/ui-redesign-phase4",
|
||||
"refs/heads/main"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "627955afa989d32fefa53f15da9ef3e0abf27038\trefs/heads/codex/ui-redesign-phase4\n27657f31131cd95d42f0e1290853ec9c9b3959a4\trefs/heads/main\n",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
},
|
||||
{
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"status",
|
||||
"--porcelain=v1"
|
||||
],
|
||||
"exitCode": 0,
|
||||
"stdout": "",
|
||||
"stderr": "[rtk] /!\\ No hook installed — run `rtk init -g` for automatic token savings\n"
|
||||
}
|
||||
]
|
||||
},
|
||||
"previousRemindersPushRaw": ".artifacts/phase7/p7-05/reminders/push-receipt.json",
|
||||
"commitBoundaries": [
|
||||
{
|
||||
"order": 1,
|
||||
"scope": "Embedded Application forms",
|
||||
"status": "ONGOING",
|
||||
"productOwner": "job-tracker-ui/src/components/ApplicationAssets.tsx"
|
||||
},
|
||||
{
|
||||
"order": 2,
|
||||
"scope": "Inbox/read review",
|
||||
"status": "PENDING",
|
||||
"productOwner": "Existing CorrespondenceInboxPage/GmailReviewPage owners"
|
||||
},
|
||||
{
|
||||
"order": 3,
|
||||
"scope": "Compose/send",
|
||||
"status": "PENDING",
|
||||
"prerequisite": "Confirm meaningful runtime RED and repair captured identity/save/delivery safeguards before acceptance"
|
||||
}
|
||||
],
|
||||
"optionalFollowMode": {
|
||||
"checkpoint": "P7-06F",
|
||||
"status": "DEFERRED",
|
||||
"requiredDecision": "Exact mode-to-draft/review action and fallback; never auto-send or auto-resend"
|
||||
},
|
||||
"baseline": {
|
||||
"capturedUtc": "2026-10-13T11:39:11.302034+00:00",
|
||||
"head": "c723a4e3032185da623d81ace241eec748506fc7",
|
||||
"sourceCommitQualification": "This pre-change run occurred at c723a4e with uncommitted Reminders work. It is separate from the later clean 627955a push receipt; no clean-627955a baseline is claimed.",
|
||||
"command": {
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"npm.cmd",
|
||||
"test",
|
||||
"--",
|
||||
"--runInBand",
|
||||
"--watchAll=false",
|
||||
"--json",
|
||||
"--outputFile=E:\\Storage\\Projects\\Active\\Job tracker\\.artifacts\\phase7\\current\\unit\\p706-forms-baseline-20261013-review-20261013T113916Z.json",
|
||||
"src/application-assets.test.tsx",
|
||||
"src/application-workspace-overlay.test.tsx",
|
||||
"src/applicationWorkspace.test.ts"
|
||||
],
|
||||
"startedUtc": "2026-10-13T11:39:16.918910+00:00",
|
||||
"finishedUtc": "2026-10-13T11:39:27.061883+00:00",
|
||||
"exitCode": 0,
|
||||
"counts": {
|
||||
"numPassedTests": 39,
|
||||
"numFailedTests": 0,
|
||||
"numPendingTests": 0,
|
||||
"numTodoTests": 0,
|
||||
"numPassedTestSuites": 3,
|
||||
"numFailedTestSuites": 0
|
||||
}
|
||||
},
|
||||
"suiteCounts": [
|
||||
{
|
||||
"name": "application-workspace-overlay.test.tsx",
|
||||
"passed": 18,
|
||||
"failed": 0,
|
||||
"pending": 0
|
||||
},
|
||||
{
|
||||
"name": "application-assets.test.tsx",
|
||||
"passed": 18,
|
||||
"failed": 0,
|
||||
"pending": 0
|
||||
},
|
||||
{
|
||||
"name": "applicationWorkspace.test.ts",
|
||||
"passed": 3,
|
||||
"failed": 0,
|
||||
"pending": 0
|
||||
}
|
||||
],
|
||||
"reports": [
|
||||
{
|
||||
"source": ".artifacts/phase7/current/unit/p706-forms-baseline-20261013-review-20261013T113916Z.json",
|
||||
"copy": ".artifacts/phase7/p7-06/forms/unit-baseline/p706-forms-baseline-20261013-review-20261013T113916Z.json",
|
||||
"bytes": 15540,
|
||||
"sha256": "6cd3a67d35f0172d3c7de32287a72c2f1fd3aee6b6bcee15474f7ceaeff3f81e"
|
||||
},
|
||||
{
|
||||
"source": ".artifacts/phase7/current/unit/p706-forms-baseline-20261013-review-20261013T113916Z.log",
|
||||
"copy": ".artifacts/phase7/p7-06/forms/unit-baseline/p706-forms-baseline-20261013-review-20261013T113916Z.log",
|
||||
"bytes": 762,
|
||||
"sha256": "627ec5ddc5b43fb6f1d36a2a6e06f8e96786b8f4efe96fab775884f60eff9a1c"
|
||||
},
|
||||
{
|
||||
"source": ".artifacts/phase7/current/unit/p706-forms-baseline-20261013-review-20261013T113916Z-command.json",
|
||||
"copy": ".artifacts/phase7/p7-06/forms/unit-baseline/p706-forms-baseline-20261013-review-20261013T113916Z-command.json",
|
||||
"bytes": 753,
|
||||
"sha256": "6745179da2994411470fbd8b014f5556272049699d43ecfde02c009eab497e96"
|
||||
}
|
||||
],
|
||||
"sourceSnapshotRaw": ".artifacts/phase7/p7-06/forms/unit-baseline/source-snapshot.json",
|
||||
"reportSnapshotRaw": ".artifacts/phase7/p7-06/forms/unit-baseline/report-snapshot.json",
|
||||
"afterRunSourceCheckRaw": ".artifacts/phase7/p7-06/forms/unit-baseline/after-run-source-check.json",
|
||||
"baselineSources": [
|
||||
{
|
||||
"source": "job-tracker-ui/src/components/ApplicationAssets.tsx",
|
||||
"copy": ".artifacts/phase7/p7-06/forms/unit-baseline/ApplicationAssets.tsx",
|
||||
"bytes": 33172,
|
||||
"sha256": "69a58c2153951dfad94a42ef0dd0c662dc943f845313596dd4063e8b38f56aa6"
|
||||
},
|
||||
{
|
||||
"source": "job-tracker-ui/src/application-assets.test.tsx",
|
||||
"copy": ".artifacts/phase7/p7-06/forms/unit-baseline/application-assets.test.tsx",
|
||||
"bytes": 16119,
|
||||
"sha256": "971d9f5088379592b3a8d66909805a7541c1b5d531481ae79e85fb850e2af8c1"
|
||||
},
|
||||
{
|
||||
"source": "job-tracker-ui/src/application-workspace-overlay.test.tsx",
|
||||
"copy": ".artifacts/phase7/p7-06/forms/unit-baseline/application-workspace-overlay.test.tsx",
|
||||
"bytes": 18663,
|
||||
"sha256": "7315773906ae702f5fd93b2c941f7a46c7aeeaabdf798a963f7d38dba09b6313"
|
||||
},
|
||||
{
|
||||
"source": "job-tracker-ui/src/applicationWorkspace.test.ts",
|
||||
"copy": ".artifacts/phase7/p7-06/forms/unit-baseline/applicationWorkspace.test.ts",
|
||||
"bytes": 1894,
|
||||
"sha256": "bd068a208d40f782f66f77e6196378f4fa2a5be6f0eacd71e4f6271276e89362"
|
||||
},
|
||||
{
|
||||
"source": "job-tracker-ui/src/i18n/translations.ts",
|
||||
"copy": ".artifacts/phase7/p7-06/forms/unit-baseline/translations.ts",
|
||||
"bytes": 321263,
|
||||
"sha256": "d12724a6d4a61a15879e485316eb0227135f7218baa26ada4beaf4e12c4b9b9b"
|
||||
},
|
||||
{
|
||||
"source": "job-tracker-ui/src/applicationWorkspace.ts",
|
||||
"copy": ".artifacts/phase7/p7-06/forms/unit-baseline/applicationWorkspace.ts",
|
||||
"bytes": 14534,
|
||||
"sha256": "73b5b8c894e1ff053a41cc8c8beb6baf66ca03146abaec5866377602345f6981"
|
||||
},
|
||||
{
|
||||
"source": "job-tracker-ui/src/views/ApplicationWorkspacePage.tsx",
|
||||
"copy": ".artifacts/phase7/p7-06/forms/unit-baseline/ApplicationWorkspacePage.tsx",
|
||||
"bytes": 31096,
|
||||
"sha256": "26fc8d62b93ee3230842235d434dba97ce62b9ae1d6f38f3d735fbb4fbb749a4"
|
||||
}
|
||||
],
|
||||
"afterRunSourceCheck": {
|
||||
"checkedUtc": "2026-10-13T11:39:51.530341+00:00",
|
||||
"allUnchanged": true,
|
||||
"sources": [
|
||||
{
|
||||
"source": "job-tracker-ui/src/components/ApplicationAssets.tsx",
|
||||
"beforeSha256": "69a58c2153951dfad94a42ef0dd0c662dc943f845313596dd4063e8b38f56aa6",
|
||||
"afterSha256": "69a58c2153951dfad94a42ef0dd0c662dc943f845313596dd4063e8b38f56aa6",
|
||||
"unchanged": true
|
||||
},
|
||||
{
|
||||
"source": "job-tracker-ui/src/application-assets.test.tsx",
|
||||
"beforeSha256": "971d9f5088379592b3a8d66909805a7541c1b5d531481ae79e85fb850e2af8c1",
|
||||
"afterSha256": "971d9f5088379592b3a8d66909805a7541c1b5d531481ae79e85fb850e2af8c1",
|
||||
"unchanged": true
|
||||
},
|
||||
{
|
||||
"source": "job-tracker-ui/src/application-workspace-overlay.test.tsx",
|
||||
"beforeSha256": "7315773906ae702f5fd93b2c941f7a46c7aeeaabdf798a963f7d38dba09b6313",
|
||||
"afterSha256": "7315773906ae702f5fd93b2c941f7a46c7aeeaabdf798a963f7d38dba09b6313",
|
||||
"unchanged": true
|
||||
},
|
||||
{
|
||||
"source": "job-tracker-ui/src/applicationWorkspace.test.ts",
|
||||
"beforeSha256": "bd068a208d40f782f66f77e6196378f4fa2a5be6f0eacd71e4f6271276e89362",
|
||||
"afterSha256": "bd068a208d40f782f66f77e6196378f4fa2a5be6f0eacd71e4f6271276e89362",
|
||||
"unchanged": true
|
||||
},
|
||||
{
|
||||
"source": "job-tracker-ui/src/i18n/translations.ts",
|
||||
"beforeSha256": "d12724a6d4a61a15879e485316eb0227135f7218baa26ada4beaf4e12c4b9b9b",
|
||||
"afterSha256": "d12724a6d4a61a15879e485316eb0227135f7218baa26ada4beaf4e12c4b9b9b",
|
||||
"unchanged": true
|
||||
},
|
||||
{
|
||||
"source": "job-tracker-ui/src/applicationWorkspace.ts",
|
||||
"beforeSha256": "73b5b8c894e1ff053a41cc8c8beb6baf66ca03146abaec5866377602345f6981",
|
||||
"afterSha256": "73b5b8c894e1ff053a41cc8c8beb6baf66ca03146abaec5866377602345f6981",
|
||||
"unchanged": true
|
||||
},
|
||||
{
|
||||
"source": "job-tracker-ui/src/views/ApplicationWorkspacePage.tsx",
|
||||
"beforeSha256": "26fc8d62b93ee3230842235d434dba97ce62b9ae1d6f38f3d735fbb4fbb749a4",
|
||||
"afterSha256": "26fc8d62b93ee3230842235d434dba97ce62b9ae1d6f38f3d735fbb4fbb749a4",
|
||||
"unchanged": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"qualification": "39 passed/3 suites: assets18+overlay18+helper3, zero failed/pending/todo. All seven captured relevant sources remained unchanged through execution. Existing mocked Jest evidence is not a repair, native runtime acceptance or fresh whole-suite run."
|
||||
},
|
||||
"firstSliceAcceptanceRequirements": [
|
||||
"Keep loaded dirty controls and owned history visible after failed save/restore; deliberate retry retains drafts.",
|
||||
"Expose initial read error and explicit GET-only Retry.",
|
||||
"Retranslate current locale without issuing resource reads or writes.",
|
||||
"Confirm discarding dirty edits before Restore; cancellation performs no write.",
|
||||
"Capture AI source/action context; synchronous Save/Apply/mutation guards prevent pending-save edit loss or suggestion misattribution."
|
||||
],
|
||||
"preservedContracts": [
|
||||
"Existing seven-section Application workspace, routes, table and CV/document renderer.",
|
||||
"One CV variant per job; current CV association and ownership semantics.",
|
||||
"Cover-letter source/action and additive owned history.",
|
||||
"Bodyless restore with no ExpectedVersion: retain RD21 limitations.",
|
||||
"Existing two-answer Notes encoding and clearing behavior.",
|
||||
"Native P2-D01/frozen package and archived binary byte contracts."
|
||||
],
|
||||
"confirmedComposeDependency": "Existing updateDraft clears delivery state/rotates identity; held draft save, incomplete dirty checks and Save/Send identity races require a coherent repair at the third approved boundary. Code-path findings are not passing runtime proof; no mail/provider/backend/schema change is claimed by entry.",
|
||||
"countProvenance": {
|
||||
"wholeFrontendDerivedOnly": "706/94",
|
||||
"browserDerivedOnly": 273,
|
||||
"backendDerivedOnly": 1034,
|
||||
"latestWholeFrontend": "573/89 inherited",
|
||||
"latestWholeBackend": "1033 inherited",
|
||||
"sidecar": "49 inherited",
|
||||
"integratedAcceptance": "P7-12 pending",
|
||||
"p706Additions": "None claimed by this entry baseline"
|
||||
},
|
||||
"preservation": {
|
||||
"groups": 57,
|
||||
"statuses": {
|
||||
"PARTIAL": 56,
|
||||
"DEFERRED": 1,
|
||||
"PASS": 0,
|
||||
"FAIL": 0
|
||||
},
|
||||
"deferredGroup": "PRES-C11",
|
||||
"currentRoutes": 32
|
||||
},
|
||||
"qualifications": [
|
||||
"M01-M12 human/device acceptance remains NOT VERIFIED; M13/P5-13 is deferred and production-withheld.",
|
||||
"Actual reader/device/browser zoom, deployed fonts/photo/native-print/other-browser, provider and release gates remain.",
|
||||
"No first-slice native acceptance, full frontend/backend/browser rerun, model/provider/send activity, production deployment or Phase8 work is claimed."
|
||||
],
|
||||
"production": {
|
||||
"main": "27657f31131cd95d42f0e1290853ec9c9b3959a4",
|
||||
"originMain": "27657f31131cd95d42f0e1290853ec9c9b3959a4",
|
||||
"liveMain": "27657f31131cd95d42f0e1290853ec9c9b3959a4",
|
||||
"status": "NO-GO",
|
||||
"phase8": "No implementation"
|
||||
},
|
||||
"hashPolicy": "Baseline hashes describe exact captured raw bytes; portable entry is UTF8 LF."
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,104 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"checkpoint": "p7-06",
|
||||
"status": "PASS",
|
||||
"checkedUtc": "2026-10-13T21:26:35.976163+00:00",
|
||||
"commands": [
|
||||
{
|
||||
"name": "secret-scan",
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"C:\\Users\\Connor\\AppData\\Local\\Programs\\Python\\Python312\\python.exe",
|
||||
"-X",
|
||||
"utf8",
|
||||
"scripts/supply-chain.py",
|
||||
"scan-secrets"
|
||||
],
|
||||
"startedUtc": "2026-10-13T21:26:32.660030+00:00",
|
||||
"finishedUtc": "2026-10-13T21:26:35.270044+00:00",
|
||||
"exitCode": 0,
|
||||
"log": ".artifacts/phase7/current/static/20261013T212632Z/secret-scan.log",
|
||||
"logSha256Raw": "c5a88d5ebdc042adba125c1eaacbe44f9f4a5c19898c0f195573c00d511aa28d"
|
||||
},
|
||||
{
|
||||
"name": "working-whitespace",
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"diff",
|
||||
"--check"
|
||||
],
|
||||
"startedUtc": "2026-10-13T21:26:35.270544+00:00",
|
||||
"finishedUtc": "2026-10-13T21:26:35.365625+00:00",
|
||||
"exitCode": 0,
|
||||
"log": ".artifacts/phase7/current/static/20261013T212632Z/working-whitespace.log",
|
||||
"logSha256Raw": "d2993bc68ad9a63f711c8f5473155e2ba00fdcd461220cc3849185f2f9ad93e6"
|
||||
},
|
||||
{
|
||||
"name": "staged-whitespace",
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"diff",
|
||||
"--cached",
|
||||
"--check"
|
||||
],
|
||||
"startedUtc": "2026-10-13T21:26:35.366126+00:00",
|
||||
"finishedUtc": "2026-10-13T21:26:35.464414+00:00",
|
||||
"exitCode": 0,
|
||||
"log": ".artifacts/phase7/current/static/20261013T212632Z/staged-whitespace.log",
|
||||
"logSha256Raw": "d2993bc68ad9a63f711c8f5473155e2ba00fdcd461220cc3849185f2f9ad93e6"
|
||||
},
|
||||
{
|
||||
"name": "phase7-whitespace",
|
||||
"command": [
|
||||
"rtk",
|
||||
"proxy",
|
||||
"git",
|
||||
"diff",
|
||||
"--check",
|
||||
"b5319981ad3d1bd635daff861453d23c0de5320b"
|
||||
],
|
||||
"startedUtc": "2026-10-13T21:26:35.464414+00:00",
|
||||
"finishedUtc": "2026-10-13T21:26:35.607563+00:00",
|
||||
"exitCode": 0,
|
||||
"log": ".artifacts/phase7/current/static/20261013T212632Z/phase7-whitespace.log",
|
||||
"logSha256Raw": "d2993bc68ad9a63f711c8f5473155e2ba00fdcd461220cc3849185f2f9ad93e6"
|
||||
}
|
||||
],
|
||||
"untrackedSecretScan": {
|
||||
"files": 0,
|
||||
"findings": 0
|
||||
},
|
||||
"documentation": {
|
||||
"files": 14,
|
||||
"relativeLinks": 465,
|
||||
"errors": []
|
||||
},
|
||||
"preservation": {
|
||||
"groups": 57,
|
||||
"statuses": {
|
||||
"PARTIAL": 56,
|
||||
"PASS": 0,
|
||||
"FAIL": 0,
|
||||
"DEFERRED": 1
|
||||
},
|
||||
"originalRoutesPreserved": true,
|
||||
"currentConcreteRoutes": 32
|
||||
},
|
||||
"production": {
|
||||
"main": "27657f31131cd95d42f0e1290853ec9c9b3959a4",
|
||||
"originMain": "27657f31131cd95d42f0e1290853ec9c9b3959a4",
|
||||
"status": "NO-GO",
|
||||
"qualification": "Local fetched refs; direct push observation recorded separately."
|
||||
},
|
||||
"hashPolicy": "Portable JSON UTF8 LF; raw log hashes measure exact saved bytes.",
|
||||
"limits": [
|
||||
"Pattern scanner skips binary and files over2MiB; not historical Git/production secrets.",
|
||||
"Local links check target existence, not URL/heading anchors.",
|
||||
"Static evidence is not runtime/manual/device/provider/production acceptance."
|
||||
]
|
||||
}
|
||||
@@ -87,8 +87,8 @@ Follow the approved [Phase 7 handoff](../redesign/phase-6/p6-05/PHASE7_HANDOFF.m
|
||||
- [x] P7-02 [onboarding guidance and Career overview/evidence](../redesign/phase-7/p7-02/README.md): entryad7b419 pushed/verified; onboarding implemented-scope CONDITIONAL GO32/13/4+types/lint/build/13 actual PNG inspections/hygiene, pushedd21501aa/direct receipt23:55:12UTC. Separate actual SQLite evidence-list repair91 guards/HTTP1/Release passed and pushed01281f52/direct receipt00:06:47UTC; unfinished Career work preserved/main unchanged. Career affected46/3/native14/fresh preservation2/types/lint/build and22 actual PNG inspections pass; implemented P7-02 CONDITIONAL GO, final Career hygiene PASS (four commands0,9docs347links0errors) and normal push8b4d5c2 directly verified05:51:04UTC, localHEAD=origin=live/clean worktree/main unchanged. Career0/99 axe incompletes/manual gates retained; fullfrontend610/backend1,034 are derived only, latest fresh full573/89 unchanged.
|
||||
- [x] P7-03 Career structured editor and import/history: Implemented P7-03 scope is **CONDITIONAL GO**. The normal import/history push `5d6e32358c79cc8cfe505013fc79995940079767` was directly verified at 2026-10-12 17:28:54.912933UTC: local HEAD=origin=live development, clean worktree, local/origin/live main unchanged `27657f31131cd95d42f0e1290853ec9c9b3959a4`. Fresh affected76/6, ordinary native35, backend98/seeder24, types/lint/build and staged hygiene pass; 33/54 retained final images were inspected. Import17 scans0/302, editor13 scans0/377 and Career22 scans0/99 remain qualified. RD21 concurrency/partial-write recovery, old orphan records and human/device/provider/output requirements remain open. All57 groups remain56 PARTIAL/C11 DEFERRED,32 routes retained. 648/93 frontend and233 browser are derived only; latest whole573/89 remains inherited. Production NO-GO, P5-13 withholding and Phase8 separation remain unchanged.
|
||||
- [x] P7-04 CV library and public entry implemented scope CONDITIONAL GO: library fcacae7 pushed/verified; public38/3 affected/native8/fidelity16/36+8/24/types/lint/build PASS,18 actual public images reviewed. Public final hygiene PASS and bfa0ab6 normal push verified; sandbox frame-tested12 and human/device/production qualifications retained.
|
||||
- [x] P7-05 Discovery, Companies, Offers and Reminders: Discovery21/1,new8+existing4native/backend14/types/lint/build pass;18 actual new PNG reviews,81+52 axe incompletes retained. Discovery hygiene PASS/normal push34a4d6d verified. Companies30/4,new6+old2+named4native/backend2/types/lint/build pass;20actual PNG reviews,91+163incompletes qualified. Companies hygiene PASS/normal pusha8aba85 verified; Offers9/1,new4native/backend6/types/lint/build pass;14actual PNG reviews,15incompletes qualified. Offers hygiene PASS/normal pushc723a4e verified; Reminders17/3,new6native/backend6/types/lint/build pass;17actual PNG reviews/114incompletes qualified. P7-05 implemented CONDITIONAL GO, hygiene PASS/Reminders normal push pending; P7-06 next.
|
||||
- [ ] P7-06 remaining Application forms and global correspondence.
|
||||
- [x] P7-05 Discovery, Companies, Offers and Reminders: Discovery21/1,new8+existing4native/backend14/types/lint/build pass;18 actual new PNG reviews,81+52 axe incompletes retained. Discovery hygiene PASS/normal push34a4d6d verified. Companies30/4,new6+old2+named4native/backend2/types/lint/build pass;20actual PNG reviews,91+163incompletes qualified. Companies hygiene PASS/normal pusha8aba85 verified; Offers9/1,new4native/backend6/types/lint/build pass;14actual PNG reviews,15incompletes qualified. Offers hygiene PASS/normal pushc723a4e verified; Reminders17/3,new6native/backend6/types/lint/build pass;17actual PNG reviews/114incompletes qualified. P7-05 implemented CONDITIONAL GO, hygiene PASS/normal627955a push directly verified2026-10-13 11:49:32.473200UTC, clean localHEAD=origin=live/main unchanged.
|
||||
- [ ] P7-06 [remaining Application forms and global correspondence](../redesign/phase-7/p7-06/README.md) ongoing: [embedded forms](../redesign/phase-7/p7-06/FORMS.md) CONDITIONAL GO pending final static/push. Latest54/4 units/backend30 no-build; current native8/1 only strict language-save204→HTTP500 EN (RD11), current Jobs5/P2-D01ordinary1 give14pass/1fail of15. Previous-build CV4/Career11 give29pass/1fail relevant30 with qualifiers. PageDown passes; failure retained without rerun/waiver. Derived716/94 frontend/282browser cases only. Preserve oneCV/letter-history/Notes/frozen packages; next separate inbox/read review and compose/send commits,06F deferred.
|
||||
- [ ] P7-06F optional reviewed followMode composer: retain deferral unless its required action/fallback decision is established.
|
||||
- [ ] P7-07 owner-scoped metadata projection, then Documents interface.
|
||||
- [ ] P7-08 existing notifications and operations.
|
||||
@@ -96,3 +96,7 @@ Follow the approved [Phase 7 handoff](../redesign/phase-6/p6-05/PHASE7_HANDOFF.m
|
||||
- [ ] P7-10 Users, Audit and System administration presentation.
|
||||
- [ ] P7-11 residual Analytics/error/empty/dialog integration.
|
||||
- [ ] P7-12 integrated migration acceptance and Phase 8 handoff.
|
||||
|
||||
### Final P7-06 embedded-forms observation
|
||||
|
||||
Final embedded-forms implemented scope is **CONDITIONAL GO**, normal push pending. The matching aggregate/generation repair resolves the reviewed cross-job draft leak: ordinary parent RED18/1, latest affected **55/4 PASS** and actual SPA/heldB/exact two-job readback PASS. Final parent build9sM6acEkOGxgN5fTRZXdE has **9PASS/1FAIL of10** (unchanged strict actual NB language204→500/RD11); fresh Jobs5/P2-D01ordinary1 give **15PASS/1FAIL of16**, qualified earlier CV4/Career11 give **30PASS/1FAIL relevant31**. Backend30 sameDLL/no-build; app/browser types/lint/build PASS. All23/111 current forms PNGs actually reviewed, 55 recorded axe scans0/741 (current22/154+Jobs8/89; earlierCV12/121+Career13/377), full incomplete contexts pending human qualification. See [portable forms result](../redesign/phase-7/p7-06/evidence/forms-results.json). +11frontend/0suites derives **717/94**; +10browser derives **283**, no integrated run. All57 groups56PARTIAL/C11DEFERRED and32routes, P513withheld/06Fdeferred/main unchanged/productionNO-GO. Inbox/read and compose/send remain; Phase8 not started.
|
||||
|
||||
@@ -0,0 +1,559 @@
|
||||
import AxeBuilder from '@axe-core/playwright';
|
||||
import { createHash } from 'node:crypto';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { expect, test as base, type APIRequestContext, type APIResponse, type Locator, type Page, type Response, type TestInfo } from '@playwright/test';
|
||||
import { translations } from '../src/i18n/translations';
|
||||
import { emptyStructuredCv } from '../src/profileCv';
|
||||
import type { CvVariant, CvVariantSummary } from '../src/cvBuilder';
|
||||
import type { ApplicationCv, CoverLetter, SubmittedPackage, SubmittedPackageDetail, WorkspaceOverview } from '../src/applicationWorkspace';
|
||||
import { removeApplicationAnswerDraft } from '../src/applicationDrafts';
|
||||
|
||||
const apiUrl = 'http://localhost:5302/api';
|
||||
const password = 'E2ePassword123!';
|
||||
type Owner = { id: string; headers: Record<string, string> };
|
||||
type Sample = { language: 'en' | 'nb'; theme: 'light' | 'dark'; width: number; height: number };
|
||||
type Subsection = 'cv' | 'letter' | 'answers' | 'submission';
|
||||
type Job = { id: number; jobTitle: string; notes: string | null };
|
||||
type RequestRecord = { method: string; path: string; body: unknown };
|
||||
type Session = { owner: Owner; admin: APIRequestContext; administrator: Owner; requests: RequestRecord[] };
|
||||
const desktop: Sample = { language: 'en', theme: 'light', width: 1440, height: 900 };
|
||||
const boundary = 'Actual owner HTTP fixtures use disposable isolated SQLite and existing application/CV/attachment APIs. Free accounts disable AI; the serial runtime disables model, delivery and alert workers. No provider/model/generation/send endpoint, raw SQL, schema or production write. Controlled precommit HTTP failures and held requests qualify scoped presentation/recovery, not network-uncertain idempotency or production reliability. Request metadata includes only fixture application/CV/file paths and bodies; no auth/CSRF/session headers. Existing seven workspace sections, CV renderer, immutable packages, one-job CV association and append-only cover history are preserved. Existing P2-D01 remains a separately executed ordinary preservation case; this file supplements that corpus. Duplicate-for-job remains two writes; created-copy/failed-attach is explicitly qualified, with no automatic second duplicate. Current AttachmentsTable and its separate ID0-download debt are outside this slice.';
|
||||
function jobUrl(id: number) { return `${apiUrl}/jobapplications/${id}`; }
|
||||
function interpolate(template: string, params: Record<string, string | number>) { return template.replace(/\{(\w+)\}/g, (_, key: string) => String(params[key] ?? `{${key}}`)); }
|
||||
function hold() { let release!: () => void; const pending = new Promise<void>(resolve => { release = resolve; }); return { pending, release }; }
|
||||
async function json<T>(response: APIResponse | Response, status = 200): Promise<T> { expect(response.status(), response.url()).toBe(status); return response.json(); }
|
||||
function response(page: Page, method: string, url: string) { return page.waitForResponse(value => value.url() === url && value.request().method() === method); }
|
||||
async function keyboard(page: Page, control: Locator) { await control.focus(); await expect(control).toBeFocused(); await page.keyboard.press('Enter'); }
|
||||
function count(session: Session, method: string, path: string) { return session.requests.filter(value => value.method === method && value.path === path); }
|
||||
function mutations(session: Session) { return session.requests.filter(value => ['POST', 'PUT', 'PATCH', 'DELETE'].includes(value.method)); }
|
||||
function assetReads(session: Session, id: number) {
|
||||
const start = `/api/jobapplications/${id}/`;
|
||||
return session.requests.filter(value => value.method === 'GET' && value.path.startsWith(start) &&
|
||||
['cv', 'tailoring', 'cover-letter', 'submitted-packages'].includes(value.path.slice(start.length).split('/')[0]));
|
||||
}
|
||||
function section(page: Page, title: string) { return page.getByRole('region', { name: title, exact: true }); }
|
||||
function childFocus(page: Page, title: string) { return page.getByRole('group', { name: title, exact: true }); }
|
||||
function letter(page: Page, language: Sample['language'] = 'en') { return page.getByRole('textbox', { name: translations[language].jobDetailsCoverLetter, exact: true }); }
|
||||
function attachedCv(page: Page, language: Sample['language'] = 'en') {
|
||||
const label = translations[language].assetsAttachedCv.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
// MUI names its Select from the field label and the current selected value.
|
||||
return page.getByRole('combobox', { name: new RegExp(`^${label}(?:\\s|$)`) });
|
||||
}
|
||||
function drafts(page: Page, language: Sample['language'] = 'en') { return {
|
||||
answer: page.getByRole('textbox', { name: translations[language].assetsApplicationAnswer, exact: true }),
|
||||
message: page.getByRole('textbox', { name: translations[language].assetsRecruiterMessage, exact: true }),
|
||||
}; }
|
||||
async function login(api: APIRequestContext, email: string): Promise<Owner> {
|
||||
expect((await api.post(`${apiUrl}/auth/login`, { data: { email, password } })).status()).toBe(200);
|
||||
const me = await json<{ id: string; sessionContext: string }>(await api.get(`${apiUrl}/auth/me`));
|
||||
const csrf = (await api.storageState()).cookies.find(cookie => cookie.name === 'XSRF-TOKEN'); expect(csrf).toBeDefined();
|
||||
return { id: me.id, headers: { 'X-CSRF-TOKEN': csrf!.value, 'X-Session-Context': me.sessionContext } };
|
||||
}
|
||||
async function account(admin: APIRequestContext, owner: Owner) {
|
||||
const email = `p706-forms-${Date.now()}-${Math.random().toString(36).slice(2)}@example.test`;
|
||||
expect((await admin.post(`${apiUrl}/users`, { headers: owner.headers, data: { email, password, roles: [] } })).status()).toBe(200);
|
||||
return email;
|
||||
}
|
||||
const test = base.extend<{ session: Session }>({
|
||||
session: async ({ page, context, playwright }, provide, info) => {
|
||||
expect(process.env.PLAYWRIGHT_REUSE_SERVERS).not.toBe('true');
|
||||
expect(info.config.metadata.isolatedDataRoot).toEqual(expect.any(String));
|
||||
const admin = await playwright.request.newContext(); const requests: RequestRecord[] = []; const blocked: string[] = [];
|
||||
page.on('request', request => {
|
||||
const url = new URL(request.url());
|
||||
if (!/^\/api\/(?:jobapplications(?:\/|$)|cv\/variants(?:\/|$)|attachments(?:\/|$))/.test(url.pathname)) return;
|
||||
requests.push({ method: request.method(), path: url.pathname, body: request.postData() ? request.postDataJSON() : null });
|
||||
});
|
||||
try {
|
||||
const administrator = await login(admin, 'e2e@example.test');
|
||||
const owner = await login(page.request, await account(admin, administrator));
|
||||
expect((await json<{ entitlements: { ai: boolean } }>(await page.request.get(`${apiUrl}/auth/me`))).entitlements.ai).toBe(false);
|
||||
await context.route('**/*', route => {
|
||||
const url = new URL(route.request().url());
|
||||
if (['localhost', '127.0.0.1'].includes(url.hostname) || ['blob:', 'data:', 'about:'].includes(url.protocol)) return route.continue();
|
||||
blocked.push(url.origin + url.pathname); return route.abort();
|
||||
});
|
||||
await provide({ owner, admin, administrator, requests });
|
||||
} finally {
|
||||
await info.attach('application-forms-boundary', { body: JSON.stringify({ boundary, requests, blockedExternalRequests: blocked }), contentType: 'application/json' });
|
||||
await admin.dispose();
|
||||
}
|
||||
},
|
||||
});
|
||||
function profile(headline = 'Original reviewed career evidence') {
|
||||
const empty = emptyStructuredCv();
|
||||
return { ...empty, contact: { ...empty.contact, fullName: 'Åse Recorded Application Identity', headline },
|
||||
summary: ['Canonical owner-reviewed evidence — æøå'], skills: ['C#', 'SQL'] };
|
||||
}
|
||||
async function source(api: APIRequestContext, owner: Owner, headline?: string) {
|
||||
return json(await api.put(`${apiUrl}/career/profile`, { headers: owner.headers, data: { profile: profile(headline), cvText: 'Exact owner-reviewed source — æøå' } }));
|
||||
}
|
||||
async function createJob(api: APIRequestContext, owner: Owner, title = 'Recorded application material — æøå') {
|
||||
const company = await json<{ id: number }>(await api.post(`${apiUrl}/companies`, { headers: owner.headers, data: { name: 'Recorded application company — æøå', source: 'User' } }), 201);
|
||||
return json<Job>(await api.post(`${apiUrl}/jobapplications`, { headers: owner.headers, data: {
|
||||
companyId: company.id, jobTitle: title, status: 'Saved', notes: 'Human notes remain separate — æøå', description: 'Recorded C# and SQL role; fixture facts only.',
|
||||
} }), 201);
|
||||
}
|
||||
async function variant(api: APIRequestContext, owner: Owner, name: string) {
|
||||
return json<CvVariant>(await api.post(`${apiUrl}/cv/variants`, { headers: owner.headers, data: {
|
||||
name, settings: { themeId: 'minimal', language: 'nb-NO', showPhoto: false, showPageNumbers: false, showIcons: true, sections: [], overrides: {}, customSections: [] },
|
||||
} }));
|
||||
}
|
||||
async function saveLetter(api: APIRequestContext, owner: Owner, id: number, text: string) {
|
||||
return json<CoverLetter>(await api.put(`${jobUrl(id)}/cover-letter`, { headers: owner.headers, data: { text, source: 'manual' } }));
|
||||
}
|
||||
async function saveDrafts(api: APIRequestContext, owner: Owner, id: number, answer: string, message: string) {
|
||||
expect((await api.put(`${jobUrl(id)}/application-drafts`, { headers: owner.headers, data: { applicationAnswerDraft: answer, recruiterMessageDraft: message } })).status()).toBe(204);
|
||||
}
|
||||
async function upload(api: APIRequestContext, owner: Owner, id: number) {
|
||||
const bytes = Buffer.from('Exact archived application evidence — æøå\nOriginal bytes retained.\n', 'utf8');
|
||||
const name = 'Recorded application evidence — æøå.txt';
|
||||
expect((await api.post(`${apiUrl}/attachments`, { headers: owner.headers, multipart: { jobId: String(id), files: { name, mimeType: 'text/plain', buffer: bytes } } })).ok()).toBe(true);
|
||||
const [attachment] = await json<{ id: number; fileName: string }[]>(await api.get(`${apiUrl}/attachments/${id}`));
|
||||
expect(attachment.id).toBeGreaterThan(0); return { attachment, bytes, name };
|
||||
}
|
||||
async function fixture(page: Page, owner: Owner, long = false) {
|
||||
await source(page.request, owner);
|
||||
const job = await createJob(page.request, owner, long ? 'Langsiktig søknad om samfunnskritisk plattformutvikling med mange samarbeidspartnere og særnorske bokstaver Æ Ø Å' : undefined);
|
||||
const cv = await variant(page.request, owner, long ? 'CV med lang dokumenttittel for samfunnskritisk plattformutvikling og inkluderende arbeidsprosesser Æ Ø Å' : 'Recorded attached application CV');
|
||||
await json<ApplicationCv>(await page.request.put(`${jobUrl(job.id)}/cv`, { headers: owner.headers, data: { variantId: cv.id } }));
|
||||
const originalLetter = long ? ('Reviewed long cover letter — æøå. Existing storage remains plain markdown.\n\n').repeat(55).trim() : 'Original reviewed cover letter — æøå';
|
||||
const answer = long ? ('Recorded motivation and application answer — æøå.\n').repeat(24).trim() : 'Original application answer — æøå';
|
||||
const message = long ? ('Reviewed recruiter message draft; never sent — æøå.\n').repeat(14).trim() : 'Original recruiter message; never sent';
|
||||
await saveLetter(page.request, owner, job.id, originalLetter);
|
||||
await saveDrafts(page.request, owner, job.id, answer, message);
|
||||
return { job, cv, originalLetter, answer, message };
|
||||
}
|
||||
async function frozenFixture(page: Page, owner: Owner, long = false) {
|
||||
const seeded = await fixture(page, owner, long); const file = await upload(page.request, owner, seeded.job.id);
|
||||
const preserved = await json<SubmittedPackage>(await page.request.post(`${jobUrl(seeded.job.id)}/submitted-packages`, { headers: owner.headers }));
|
||||
const detail = await json<SubmittedPackageDetail>(await page.request.get(`${jobUrl(seeded.job.id)}/submitted-packages/${preserved.id}`));
|
||||
return { ...seeded, ...file, preserved, detail };
|
||||
}
|
||||
async function enter(page: Page, owner: Owner, job: Job, sub: Subsection, sample: Sample = desktop) {
|
||||
expect((await page.request.put(`${apiUrl}/auth/preferences/language`, { headers: owner.headers, data: { language: sample.language === 'nb' ? 'nb-NO' : 'en' } })).status()).toBe(204);
|
||||
await page.addInitScript(({ language, theme }) => {
|
||||
if (localStorage.getItem('uiLanguage') === null) localStorage.setItem('uiLanguage', language);
|
||||
if (localStorage.getItem('jobtracker.themeMode') === null) localStorage.setItem('jobtracker.themeMode', theme);
|
||||
}, sample);
|
||||
await page.setViewportSize({ width: sample.width, height: sample.height }); await page.emulateMedia({ reducedMotion: 'reduce' });
|
||||
await page.goto(`/jobs/${job.id}?section=application&sub=${sub}&source=phase7-forms&followMode=waiting-update#materials`);
|
||||
const stored = await page.evaluate(() => ({ language: localStorage.getItem('uiLanguage'), theme: localStorage.getItem('jobtracker.themeMode') }));
|
||||
if (stored.language !== sample.language || stored.theme !== sample.theme) {
|
||||
await page.evaluate(({ language, theme }) => { localStorage.setItem('uiLanguage', language); localStorage.setItem('jobtracker.themeMode', theme); }, sample); await page.reload();
|
||||
}
|
||||
const t = translations[sample.language];
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', sample.language === 'nb' ? 'nb-NO' : 'en');
|
||||
await expect(page.locator('html')).toHaveAttribute('data-color-scheme', sample.theme);
|
||||
await expect(page.getByRole('heading', { level: 1 })).toHaveCount(1);
|
||||
await expect(page.getByRole('heading', { level: 2, name: job.jobTitle, exact: true })).toBeVisible();
|
||||
await expect(page.getByRole('tablist', { name: t.workspaceSections, exact: true }).getByRole('tab')).toHaveCount(7);
|
||||
await expect(page.getByRole('tablist', { name: t.workspaceApplicationSections, exact: true }).getByRole('tab')).toHaveCount(4);
|
||||
expect(new URL(page.url()).searchParams.get('followMode')).toBe('waiting-update');
|
||||
}
|
||||
async function selectCv(page: Page, value: CvVariant | null, language: Sample['language'] = 'en') {
|
||||
await keyboard(page, attachedCv(page, language));
|
||||
const option = value ? page.getByRole('option').filter({ hasText: value.name }) : page.getByRole('option', { name: translations[language].assetsNone, exact: true });
|
||||
await keyboard(page, option);
|
||||
}
|
||||
|
||||
test('[P7-06 PRES-W01 W04 W10] same-route job navigation waits for owned answers and preserves both jobs on save', async ({ page, session }, info) => {
|
||||
const first = await fixture(page, session.owner);
|
||||
const original = await json<{ companyId: number }>(await page.request.get(jobUrl(first.job.id)));
|
||||
const second = await json<Job>(await page.request.post(`${apiUrl}/jobapplications`, { headers: session.owner.headers, data: {
|
||||
companyId: original.companyId, jobTitle: 'Second independent application draft owner', status: 'Saved', notes: 'Independent second-job notes',
|
||||
} }), 201);
|
||||
const secondAnswer = 'Owned second-job answer — æøå';
|
||||
const secondMessage = 'Owned second-job recruiter message; never sent';
|
||||
await saveDrafts(page.request, session.owner, second.id, secondAnswer, secondMessage);
|
||||
await enter(page, session.owner, first.job, 'answers');
|
||||
await expect(drafts(page).answer).toHaveValue(first.answer);
|
||||
const origin = await page.evaluate(() => performance.timeOrigin);
|
||||
const held = hold(); const reached = hold();
|
||||
const workspaceUrl = `${jobUrl(second.id)}/workspace`;
|
||||
await page.route(workspaceUrl, async route => { reached.release(); await held.pending; await route.continue(); });
|
||||
try {
|
||||
await keyboard(page, page.getByRole('button', { name: new RegExp(translations.en.quickSearch) }));
|
||||
const commands = page.getByRole('dialog', { name: translations.en.quickSearch });
|
||||
await commands.getByRole('textbox', { name: translations.en.quickSearch }).fill(second.jobTitle);
|
||||
await keyboard(page, commands.getByRole('button').filter({ hasText: second.jobTitle }));
|
||||
await reached.pending;
|
||||
await expect(page).toHaveURL(new RegExp(`/jobs/${second.id}$`));
|
||||
expect(await page.evaluate(() => performance.timeOrigin)).toBe(origin);
|
||||
await keyboard(page, page.getByRole('tab', { name: translations.en.workspaceApplication, exact: true }));
|
||||
await keyboard(page, page.getByRole('tab', { name: translations.en.workspaceAnswers, exact: true }));
|
||||
await expect(drafts(page).answer).toHaveCount(0);
|
||||
await expect(drafts(page).message).toHaveCount(0);
|
||||
expect(count(session, 'PUT', `/api/jobapplications/${second.id}/application-drafts`)).toHaveLength(0);
|
||||
await capture(page, info, desktop, 'held-second-job-aggregate-no-foreign-drafts');
|
||||
const loaded = response(page, 'GET', workspaceUrl); held.release(); await loaded;
|
||||
await expect(drafts(page).answer).toHaveValue(secondAnswer);
|
||||
await expect(drafts(page).message).toHaveValue(secondMessage);
|
||||
const reviewed = 'Edited second-job answer only — æøå';
|
||||
await drafts(page).answer.fill(reviewed);
|
||||
const saved = response(page, 'PUT', `${jobUrl(second.id)}/application-drafts`);
|
||||
await keyboard(page, page.getByRole('button', { name: translations.en.assetsSaveDrafts, exact: true }));
|
||||
expect((await saved).status()).toBe(204);
|
||||
await expect(drafts(page).message).toHaveValue(secondMessage);
|
||||
const persistedSecond = await json<WorkspaceOverview>(await page.request.get(workspaceUrl));
|
||||
expect(persistedSecond.applicationAnswerDraft).toBe(reviewed);
|
||||
expect(persistedSecond.recruiterMessageDraft).toBe(secondMessage);
|
||||
const persistedFirst = await json<WorkspaceOverview>(await page.request.get(`${jobUrl(first.job.id)}/workspace`));
|
||||
expect(persistedFirst.applicationAnswerDraft).toBe(first.answer);
|
||||
expect(persistedFirst.recruiterMessageDraft).toBe(first.message);
|
||||
expect(count(session, 'PUT', `/api/jobapplications/${second.id}/application-drafts`)).toEqual([{ method: 'PUT', path: `/api/jobapplications/${second.id}/application-drafts`, body: { applicationAnswerDraft: reviewed, recruiterMessageDraft: secondMessage } }]);
|
||||
await capture(page, info, desktop, 'second-job-answer-saved-first-job-preserved');
|
||||
} finally { held.release(); await page.unroute(workspaceUrl); }
|
||||
});
|
||||
async function capture(page: Page, info: TestInfo, sample: Sample, state: string) {
|
||||
await page.evaluate(async () => { await document.fonts.ready; await new Promise<void>(resolve => requestAnimationFrame(() => requestAnimationFrame(() => resolve()))); });
|
||||
const geometry = await page.evaluate(() => ({ width: innerWidth, height: innerHeight, rootOverflow: Math.max(0, document.documentElement.scrollWidth - document.documentElement.clientWidth),
|
||||
focused: { tag: document.activeElement?.tagName, role: document.activeElement?.getAttribute('role'), label: document.activeElement?.getAttribute('aria-label') } }));
|
||||
const axe = await new AxeBuilder({ page }).options({ rules: { 'target-size': { enabled: true } } }).analyze();
|
||||
const name = `p706-forms-${sample.language}-${sample.theme}-${sample.width}-${state}`;
|
||||
await info.attach(`${name}-audit`, { body: JSON.stringify({ sample, state, geometry, boundary, ariaSnapshot: await page.locator('body').ariaSnapshot(),
|
||||
axe: { scope: 'All default-enabled rules plus target-size, no exclusions', violations: axe.violations, incomplete: axe.incomplete, passes: axe.passes.map(rule => ({ id: rule.id, nodes: rule.nodes.length })) },
|
||||
qualifications: ['Finite Chromium states, not all combinations or physical devices.', 'All incomplete vectors retained for contextual triage; not human screen-reader, touch/software keyboard or real browser zoom acceptance.',
|
||||
'Full-page screenshots do not establish real viewport focus occlusion or every-pixel contrast.', 'Print iframe/canvas may scroll internally; outer app root reflow measured separately. Frozen HTML unchanged, not a substitute for existing full fidelity corpus.'],
|
||||
}), contentType: 'application/json' });
|
||||
await info.attach(name, { body: await page.screenshot({ fullPage: true, animations: 'disabled' }), contentType: 'image/png' });
|
||||
expect(geometry.rootOverflow).toBe(0); expect(axe.violations).toEqual([]);
|
||||
}
|
||||
|
||||
test('[P7-06 forms] held CV read Retry preserves its request and actual attach/replace/detach remain owner scoped', async ({ page, session, playwright }, info) => {
|
||||
test.setTimeout(120_000); await source(page.request, session.owner);
|
||||
const job = await createJob(page.request, session.owner); const first = await variant(page.request, session.owner, 'First reusable CV'); const second = await variant(page.request, session.owner, 'Second reusable CV');
|
||||
const gate = hold(); let reads = 0;
|
||||
await page.route(`${jobUrl(job.id)}/cv`, async route => {
|
||||
if (route.request().method() !== 'GET') return route.continue();
|
||||
reads += 1; if (reads === 1) { await gate.pending; await route.fulfill({ status: 503, json: {} }); } else return route.continue();
|
||||
});
|
||||
try {
|
||||
await enter(page, session.owner, job, 'cv'); await expect(section(page, translations.en.workspaceCv).getByRole('status')).toContainText(translations.en.loading);
|
||||
await capture(page, info, desktop, 'held-cv-read'); gate.release();
|
||||
await expect(section(page, translations.en.workspaceCv).getByRole('alert')).toContainText(translations.en.assetsLoadFailed);
|
||||
await keyboard(page, section(page, translations.en.workspaceCv).getByRole('button', { name: translations.en.retry, exact: true }));
|
||||
await expect(childFocus(page, translations.en.workspaceCv)).toBeFocused(); await expect.poll(() => reads).toBe(2);
|
||||
await expect(attachedCv(page)).toBeVisible();
|
||||
for (const current of [first, second, null]) {
|
||||
const written = response(page, 'PUT', `${jobUrl(job.id)}/cv`); await selectCv(page, current); expect((await written).status()).toBe(200);
|
||||
await expect(attachedCv(page)).toBeEnabled();
|
||||
expect((await json<ApplicationCv>(await page.request.get(`${jobUrl(job.id)}/cv`))).attachedVariantId).toBe(current?.id ?? null);
|
||||
}
|
||||
expect(count(session, 'PUT', `/api/jobapplications/${job.id}/cv`).map(value => value.body)).toEqual([{ variantId: first.id }, { variantId: second.id }, { variantId: null }]);
|
||||
const available = await json<CvVariantSummary[]>(await page.request.get(`${apiUrl}/cv/variants`));
|
||||
expect(available.map(value => value.id).sort((a, b) => a - b)).toEqual([first.id, second.id].sort((a, b) => a - b));
|
||||
expect(available.every(value => value.jobApplicationId === null)).toBe(true);
|
||||
const foreign = await playwright.request.newContext();
|
||||
try {
|
||||
const other = await login(foreign, await account(session.admin, session.administrator));
|
||||
const foreignVariant = await variant(foreign, other, 'Foreign private variant');
|
||||
expect((await page.request.put(`${jobUrl(job.id)}/cv`, { headers: session.owner.headers, data: { variantId: foreignVariant.id } })).status()).toBe(404);
|
||||
expect((await page.request.put(`${jobUrl(job.id)}/cv`, { headers: session.owner.headers, data: { variantId: 2147483647 } })).status()).toBe(404);
|
||||
for (const suffix of ['cv', 'cover-letter', 'submitted-packages']) expect((await foreign.get(`${jobUrl(job.id)}/${suffix}`)).status()).toBe(404);
|
||||
expect((await foreign.put(`${jobUrl(job.id)}/cv`, { headers: other.headers, data: { variantId: null } })).status()).toBe(404);
|
||||
expect((await json<ApplicationCv>(await page.request.get(`${jobUrl(job.id)}/cv`))).availableVariants.some(value => value.id === foreignVariant.id)).toBe(false);
|
||||
} finally { await foreign.dispose(); }
|
||||
await capture(page, info, desktop, 'cv-detached-preserved');
|
||||
} finally { gate.release(); }
|
||||
});
|
||||
|
||||
test('[P7-06 forms] long letter failed held Save retains snapshot and dirty restore Cancel writes nothing before additive explicit restore', async ({ page, session }, info) => {
|
||||
test.setTimeout(120_000); const seeded = await fixture(page, session.owner); const url = `${jobUrl(seeded.job.id)}/cover-letter`;
|
||||
await saveLetter(page.request, session.owner, seeded.job.id, 'Second reviewed letter — æøå');
|
||||
const before = await json<CoverLetter>(await page.request.get(url));
|
||||
await enter(page, session.owner, seeded.job, 'letter');
|
||||
const draft = ' ' + ('Long manually reviewed application letter — æøå. Preserve every sentence and markdown **evidence**.\n\n').repeat(60) + ' ';
|
||||
await letter(page).fill(draft); const gate = hold(); let saves = 0;
|
||||
await page.route(url, async route => {
|
||||
if (route.request().method() !== 'PUT') return route.continue();
|
||||
saves += 1; if (saves === 1) { await gate.pending; await route.fulfill({ status: 503, json: {} }); } else return route.continue();
|
||||
});
|
||||
try {
|
||||
const body = section(page, translations.en.workspaceCoverLetter);
|
||||
await keyboard(page, body.getByRole('button', { name: translations.en.save, exact: true })); await expect.poll(() => saves).toBe(1);
|
||||
await expect(letter(page)).toBeDisabled(); await expect(childFocus(page, translations.en.workspaceCoverLetter)).toBeFocused();
|
||||
await expect(body.getByRole('button', { name: translations.en.assetsDiscardChanges, exact: true })).toBeDisabled();
|
||||
expect(count(session, 'PUT', `/api/jobapplications/${seeded.job.id}/cover-letter`).map(value => value.body)).toEqual([{ text: draft, source: 'manual' }]);
|
||||
await capture(page, info, desktop, 'held-letter-save'); gate.release();
|
||||
await expect(body.getByRole('alert')).toContainText(translations.en.assetsCoverSaveFailed); await expect(letter(page)).toHaveValue(draft);
|
||||
expect(await json<CoverLetter>(await page.request.get(url))).toEqual(before); expect(saves).toBe(1);
|
||||
const saved = response(page, 'PUT', url); await keyboard(page, body.getByRole('button', { name: translations.en.save, exact: true }));
|
||||
const current = await json<CoverLetter>(await saved); expect(current.text).toBe(draft.trim()); expect(current.currentVersion).toBe(3);
|
||||
expect(current.versions.map(value => [value.version, value.source, value.aiAction])).toEqual([[3, 'manual', null], [2, 'manual', null], [1, 'manual', null]]);
|
||||
await expect(letter(page)).toHaveValue(draft.trim()); await letter(page).fill('Unsaved changes must survive Cancel — æøå');
|
||||
const restore = page.getByRole('button', { name: interpolate(translations.en.assetsRestoreVersionNumber, { version: 1 }), exact: true });
|
||||
await keyboard(page, restore);
|
||||
const dialog = page.getByRole('dialog', { name: translations.en.assetsRestoreDiscardTitle, exact: true });
|
||||
await expect(dialog).toContainText(translations.en.assetsRestoreDiscardMessage);
|
||||
await keyboard(page, dialog.getByRole('button', { name: translations.en.cancel, exact: true }));
|
||||
await expect(dialog).toHaveCount(0); await expect(restore).toBeFocused(); await expect(letter(page)).toHaveValue('Unsaved changes must survive Cancel — æøå');
|
||||
expect(count(session, 'POST', `/api/jobapplications/${seeded.job.id}/cover-letter/versions/1/restore`)).toHaveLength(0);
|
||||
expect(await json<CoverLetter>(await page.request.get(url))).toEqual(current);
|
||||
await keyboard(page, restore); const restored = response(page, 'POST', `${url}/versions/1/restore`);
|
||||
await keyboard(page, dialog.getByRole('button', { name: translations.en.assetsRestoreConfirm, exact: true }));
|
||||
const readback = await json<CoverLetter>(await restored); expect(readback.text).toBe(seeded.originalLetter); expect(readback.currentVersion).toBe(4);
|
||||
expect(readback.versions.map(value => [value.version, value.source, value.aiAction])).toEqual([[4, 'restore', null], [3, 'manual', null], [2, 'manual', null], [1, 'manual', null]]);
|
||||
await expect(letter(page)).toHaveValue(seeded.originalLetter); await capture(page, info, desktop, 'restored-additive-letter-history');
|
||||
} finally { gate.release(); }
|
||||
});
|
||||
|
||||
test('[P7-06 forms] failed held Answers save preserves both drafts and ordinary Notes through explicit recovery and reload', async ({ page, session }, info) => {
|
||||
test.setTimeout(90_000); const seeded = await fixture(page, session.owner); const url = `${jobUrl(seeded.job.id)}/application-drafts`;
|
||||
const original = await json<Job>(await page.request.get(jobUrl(seeded.job.id)));
|
||||
await enter(page, session.owner, seeded.job, 'answers'); const fields = drafts(page); const answer = 'Reviewed answer with **specific evidence** — æøå\nSecond line.'; const message = 'Reviewed recruiter note — æøå; draft only, never sent.';
|
||||
await fields.answer.fill(answer); await fields.message.fill(message);
|
||||
const gate = hold(); let writes = 0;
|
||||
await page.route(url, async route => { writes += 1; if (writes === 1) { await gate.pending; await route.fulfill({ status: 503, json: {} }); } else return route.continue(); });
|
||||
try {
|
||||
const body = section(page, translations.en.assetsApplicationDrafts);
|
||||
await keyboard(page, body.getByRole('button', { name: translations.en.assetsSaveDrafts, exact: true }));
|
||||
await expect.poll(() => writes).toBe(1); await expect(fields.answer).toBeDisabled(); await expect(fields.message).toBeDisabled(); await expect(childFocus(page, translations.en.assetsApplicationDrafts)).toBeFocused();
|
||||
expect(count(session, 'PUT', `/api/jobapplications/${seeded.job.id}/application-drafts`).map(value => value.body)).toEqual([{ applicationAnswerDraft: answer, recruiterMessageDraft: message }]);
|
||||
await capture(page, info, desktop, 'held-two-draft-save'); gate.release();
|
||||
await expect(body.getByRole('alert')).toContainText(translations.en.assetsDraftsSaveFailed); await expect(fields.answer).toHaveValue(answer); await expect(fields.message).toHaveValue(message);
|
||||
expect((await json<WorkspaceOverview>(await page.request.get(`${jobUrl(seeded.job.id)}/workspace`))).applicationAnswerDraft).toBe(seeded.answer); expect(writes).toBe(1);
|
||||
const saved = response(page, 'PUT', url); await keyboard(page, body.getByRole('button', { name: translations.en.assetsSaveDrafts, exact: true })); expect((await saved).status()).toBe(204);
|
||||
await expect(body.getByRole('button', { name: translations.en.assetsSaveDrafts, exact: true })).toBeDisabled(); await page.reload();
|
||||
await expect(drafts(page).answer).toHaveValue(answer); await expect(drafts(page).message).toHaveValue(message);
|
||||
const readback = await json<WorkspaceOverview>(await page.request.get(`${jobUrl(seeded.job.id)}/workspace`));
|
||||
expect(readback.applicationAnswerDraft).toBe(answer); expect(readback.recruiterMessageDraft).toBe(message);
|
||||
const stored = await json<Job>(await page.request.get(jobUrl(seeded.job.id))); expect(removeApplicationAnswerDraft(stored.notes)).toBe(removeApplicationAnswerDraft(original.notes));
|
||||
await keyboard(page, page.getByRole('tablist', { name: translations.en.workspaceSections, exact: true }).getByRole('tab', { name: translations.en.workspaceTasks, exact: true }));
|
||||
await expect(section(page, translations.en.workspaceNotes)).toContainText('Human notes remain separate — æøå'); await expect(section(page, translations.en.workspaceNotes)).not.toContainText(answer);
|
||||
expect(count(session, 'PUT', `/api/jobapplications/${seeded.job.id}/application-drafts`)).toHaveLength(2);
|
||||
await capture(page, info, desktop, 'drafts-saved-personal-notes-preserved');
|
||||
} finally { gate.release(); }
|
||||
});
|
||||
|
||||
test('[P7-06 forms] actual native capture freezes CV and exact archive bytes after current sources change without renderer mutation', async ({ page, session }, info) => {
|
||||
test.setTimeout(120_000); const seeded = await fixture(page, session.owner); const file = await upload(page.request, session.owner, seeded.job.id);
|
||||
await enter(page, session.owner, seeded.job, 'submission'); const captured = response(page, 'POST', `${jobUrl(seeded.job.id)}/submitted-packages`);
|
||||
await keyboard(page, section(page, translations.en.assetsSubmittedPackages).getByRole('button', { name: translations.en.assetsPackageCapture, exact: true }));
|
||||
const summary = await json<SubmittedPackage>(await captured); expect(summary.version).toBe(1); expect(summary.attachments).toHaveLength(1);
|
||||
const preservedUrl = `${jobUrl(seeded.job.id)}/submitted-packages/${summary.id}`; const before = await json<SubmittedPackageDetail>(await page.request.get(preservedUrl));
|
||||
expect(before.renderedCvHtml).toContain('Original reviewed career evidence'); expect(before.coverLetterText).toBe(seeded.originalLetter);
|
||||
expect(summary.cvVariantId).toBe(seeded.cv.id); expect(summary.cvVariantVersion).toBe(seeded.cv.version);
|
||||
expect(summary.attachments[0].sha256).toBe(createHash('sha256').update(file.bytes).digest('hex'));
|
||||
await saveLetter(page.request, session.owner, seeded.job.id, 'Later current letter — æøå');
|
||||
await saveDrafts(page.request, session.owner, seeded.job.id, 'Later answer', 'Later recruiter draft');
|
||||
const cv = await json<CvVariant>(await page.request.get(`${apiUrl}/cv/variants/${seeded.cv.id}`));
|
||||
const changedCv = await json<CvVariant>(await page.request.put(`${apiUrl}/cv/variants/${cv.id}`, { headers: session.owner.headers, data: { name: 'Later current CV', settings: { ...cv.settings, headline: 'Later CV-only headline' }, expectedVersion: cv.version, source: 'manual' } }));
|
||||
await source(page.request, session.owner, 'Later canonical headline');
|
||||
expect((await page.request.delete(`${apiUrl}/attachments/${file.attachment.id}`, { headers: session.owner.headers })).status()).toBe(204);
|
||||
expect(await json<SubmittedPackageDetail>(await page.request.get(preservedUrl))).toEqual(before);
|
||||
const archiveUrl = `${preservedUrl}/attachments/${summary.attachments[0].id}`; const archived = await page.request.get(archiveUrl); expect(archived.status()).toBe(200); expect(await archived.body()).toEqual(file.bytes);
|
||||
await page.reload(); const view = section(page, translations.en.assetsSubmittedPackages).getByRole('button', { name: translations.en.assetsPackageView, exact: true }); await keyboard(page, view);
|
||||
const dialog = page.getByRole('dialog', { name: interpolate(translations.en.assetsSubmittedPackageVersion, { version: 1 }), exact: true });
|
||||
await expect(dialog).toContainText(seeded.originalLetter); await expect(dialog).toContainText(seeded.answer); await expect(dialog).not.toContainText('Later current letter');
|
||||
const scrollRegion = dialog.getByRole('region', { name: interpolate(translations.en.assetsSubmittedPackageVersion, { version: 1 }), exact: true });
|
||||
await scrollRegion.focus(); await expect(scrollRegion).toBeFocused();
|
||||
const beforeScroll = await scrollRegion.evaluate(node => node.scrollTop); await page.keyboard.press('PageDown');
|
||||
await expect.poll(() => scrollRegion.evaluate(node => node.scrollTop)).toBeGreaterThan(beforeScroll);
|
||||
await page.keyboard.press('Home'); await expect.poll(() => scrollRegion.evaluate(node => node.scrollTop)).toBe(0);
|
||||
const iframe = dialog.getByTitle(translations.en.assetsPackageCvPreview, { exact: true });
|
||||
await expect(iframe).toHaveAttribute('sandbox', ''); await expect(iframe).toHaveAttribute('srcdoc', before.renderedCvHtml!);
|
||||
expect(await iframe.evaluate(node => getComputedStyle(node).backgroundColor)).toBe('rgb(255, 255, 255)');
|
||||
await capture(page, info, desktop, 'frozen-original-white-print-preview');
|
||||
await page.keyboard.press('Escape'); await expect(view).toBeFocused();
|
||||
const download = page.waitForEvent('download'); await keyboard(page, section(page, translations.en.assetsSubmittedPackages).getByRole('button').filter({ hasText: file.name }));
|
||||
const result = await download; expect(result.suggestedFilename()).toBe(file.name); const path = await result.path(); expect(path).not.toBeNull(); expect(await readFile(path!)).toEqual(file.bytes);
|
||||
expect(count(session, 'POST', `/api/jobapplications/${seeded.job.id}/submitted-packages`)).toHaveLength(1);
|
||||
expect(await json<SubmittedPackageDetail>(await page.request.get(preservedUrl))).toEqual(before);
|
||||
await info.attach('application-frozen-bytes', { body: JSON.stringify({ boundary, packageId: summary.id, recordedFileSha256: summary.attachments[0].sha256, downloadSha256: createHash('sha256').update(file.bytes).digest('hex'),
|
||||
preservedCvVersion: summary.cvVariantVersion, currentCvVersion: changedCv.version, qualification: 'Exact scoped real-HTTP current-source changes and archive-byte checks; existing ordinary P2-D01/full renderer fidelity runs remain required separately.' }), contentType: 'application/json' });
|
||||
});
|
||||
|
||||
test('[P7-06 forms] failed preserved detail and download retain history and Retry only the original owned read', async ({ page, session }, info) => {
|
||||
test.setTimeout(120_000); const seeded = await frozenFixture(page, session.owner); const detailUrl = `${jobUrl(seeded.job.id)}/submitted-packages/${seeded.preserved.id}`;
|
||||
const downloadUrl = `${detailUrl}/attachments/${seeded.preserved.attachments[0].id}`;
|
||||
await enter(page, session.owner, seeded.job, 'submission'); const body = section(page, translations.en.assetsSubmittedPackages); await expect(body.getByRole('button', { name: translations.en.assetsPackageView, exact: true })).toBeVisible();
|
||||
const gate = hold(); let details = 0; let downloads = 0;
|
||||
await page.route(detailUrl, async route => { details += 1; if (details === 1) await route.fulfill({ status: 503, json: {} }); else { await gate.pending; await route.continue(); } });
|
||||
await page.route(downloadUrl, async route => { downloads += 1; if (downloads === 1) await route.fulfill({ status: 503, json: {} }); else return route.continue(); });
|
||||
try {
|
||||
await keyboard(page, body.getByRole('button', { name: translations.en.assetsPackageView, exact: true }));
|
||||
await expect(body.getByRole('alert')).toContainText(translations.en.assetsPackageLoadFailed); await expect(body.getByText(interpolate(translations.en.assetsSubmittedPackageVersion, { version: 1 }), { exact: true })).toBeVisible();
|
||||
await expect(body.getByRole('button', { name: translations.en.assetsPackageView, exact: true })).toBeVisible(); expect(mutations(session)).toEqual([]);
|
||||
const baseline = assetReads(session, seeded.job.id).length;
|
||||
await keyboard(page, body.getByRole('button', { name: translations.en.retry, exact: true })); await expect.poll(() => details).toBe(2);
|
||||
await expect(childFocus(page, translations.en.assetsSubmittedPackages)).toBeFocused(); await capture(page, info, desktop, 'held-original-package-detail-retry'); gate.release();
|
||||
const dialog = page.getByRole('dialog'); await expect(dialog).toContainText(seeded.originalLetter); await page.keyboard.press('Escape');
|
||||
await expect(body.getByRole('button', { name: translations.en.assetsPackageView, exact: true })).toBeFocused();
|
||||
expect(assetReads(session, seeded.job.id)).toHaveLength(baseline + 1);
|
||||
await keyboard(page, body.getByRole('button').filter({ hasText: seeded.name }));
|
||||
await expect(body.getByRole('alert')).toContainText(translations.en.assetsPackageDownloadFailed); await expect(body.getByText(interpolate(translations.en.assetsSubmittedPackageVersion, { version: 1 }), { exact: true })).toBeVisible();
|
||||
const download = page.waitForEvent('download'); await keyboard(page, body.getByRole('button', { name: translations.en.retry, exact: true }));
|
||||
const result = await download; const path = await result.path(); expect(path).not.toBeNull(); expect(await readFile(path!)).toEqual(seeded.bytes);
|
||||
expect(details).toBe(2); expect(downloads).toBe(2); expect(mutations(session)).toEqual([]);
|
||||
expect(await json<SubmittedPackageDetail>(await page.request.get(detailUrl))).toEqual(seeded.detail);
|
||||
await capture(page, info, desktop, 'original-archive-retry-history-retained');
|
||||
} finally { gate.release(); }
|
||||
});
|
||||
|
||||
test('[P7-06 forms] live EN/Bokmal retains dirty letter and both answer drafts without asset GET or writes', async ({ page, session }, info) => {
|
||||
test.setTimeout(90_000); const seeded = await fixture(page, session.owner); await enter(page, session.owner, seeded.job, 'letter');
|
||||
await expect(letter(page)).toHaveValue(seeded.originalLetter); await letter(page).fill('Dirty owner text remains the same across UI locale — æøå');
|
||||
let reads = assetReads(session, seeded.job.id).length;
|
||||
const firstLocale = response(page, 'PUT', `${apiUrl}/auth/preferences/language`); await keyboard(page, page.locator('header').first().getByRole('button', { name: 'Norsk', exact: true }));
|
||||
const firstLocaleResponse = await firstLocale;
|
||||
await info.attach('application-locale-first-http', { body: JSON.stringify({ status: firstLocaleResponse.status(), body: await firstLocaleResponse.text() }), contentType: 'application/json' });
|
||||
expect(firstLocaleResponse.status()).toBe(204);
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO'); await expect(letter(page, 'nb')).toHaveValue('Dirty owner text remains the same across UI locale — æøå');
|
||||
expect(assetReads(session, seeded.job.id)).toHaveLength(reads); expect(mutations(session)).toEqual([]);
|
||||
await capture(page, info, { ...desktop, language: 'nb' }, 'dirty-letter-live-locale');
|
||||
await keyboard(page, section(page, translations.nb.workspaceCoverLetter).getByRole('button', { name: translations.nb.assetsDiscardChanges, exact: true }));
|
||||
await keyboard(page, page.getByRole('tablist', { name: translations.nb.workspaceApplicationSections, exact: true }).getByRole('tab', { name: translations.nb.workspaceAnswers, exact: true }));
|
||||
const fields = drafts(page, 'nb'); await expect(fields.answer).toHaveValue(seeded.answer);
|
||||
await fields.answer.fill('Ulagret søknadssvar — æøå'); await fields.message.fill('Ulagret melding; ikke sendt — æøå'); reads = assetReads(session, seeded.job.id).length;
|
||||
const secondLocale = response(page, 'PUT', `${apiUrl}/auth/preferences/language`); await keyboard(page, page.locator('header').first().getByRole('button', { name: 'English', exact: true }));
|
||||
const secondLocaleResponse = await secondLocale;
|
||||
await info.attach('application-locale-second-http', { body: JSON.stringify({ status: secondLocaleResponse.status(), body: await secondLocaleResponse.text() }), contentType: 'application/json' });
|
||||
expect(secondLocaleResponse.status()).toBe(204);
|
||||
await expect(page.locator('html')).toHaveAttribute('lang', 'en'); await expect(drafts(page).answer).toHaveValue('Ulagret søknadssvar — æøå'); await expect(drafts(page).message).toHaveValue('Ulagret melding; ikke sendt — æøå');
|
||||
expect(assetReads(session, seeded.job.id)).toHaveLength(reads); expect(mutations(session)).toEqual([]);
|
||||
await capture(page, info, desktop, 'dirty-two-drafts-live-locale');
|
||||
await info.attach('application-locale-contract', { body: JSON.stringify({ boundary, assetGetDelta: 0, writes: 0, qualification: 'Assets only: existing workspace aggregate may independently reload on locale. Persisted document/draft language is not rewritten by UI language; no model calls.' }), contentType: 'application/json' });
|
||||
});
|
||||
|
||||
test('[P7-06 forms] real duplicate then failed attach preserves created copy and original without automatic duplicate retry', async ({ page, session }, info) => {
|
||||
test.setTimeout(90_000); const seeded = await fixture(page, session.owner);
|
||||
const original = await json<CvVariant>(await page.request.get(`${apiUrl}/cv/variants/${seeded.cv.id}`));
|
||||
await enter(page, session.owner, seeded.job, 'cv'); const attachUrl = `${jobUrl(seeded.job.id)}/cv`; let attaches = 0;
|
||||
await page.route(attachUrl, async route => { if (route.request().method() !== 'PUT') return route.continue(); attaches += 1; return attaches === 1 ? route.fulfill({ status: 503, json: {} }) : route.continue(); });
|
||||
const copyResponse = response(page, 'POST', `${apiUrl}/cv/variants/${seeded.cv.id}/duplicate`);
|
||||
await keyboard(page, section(page, translations.en.workspaceCv).getByRole('button', { name: translations.en.assetsDuplicateForJob, exact: true }));
|
||||
const copy = await json<CvVariant>(await copyResponse);
|
||||
await expect(section(page, translations.en.workspaceCv).getByRole('alert').filter({ hasText: translations.en.assetsAttachCvFailed })).toBeVisible();
|
||||
await expect(section(page, translations.en.workspaceCv).getByText(translations.en.assetsCopyCreatedHelp, { exact: true })).toBeVisible();
|
||||
await expect(attachedCv(page)).toContainText(seeded.cv.name);
|
||||
// DuplicateAsync preserves JobApplicationId before the second attach write. The
|
||||
// existing read projects the newest associated variant, even while this UI
|
||||
// still holds its pre-write selection. Explicit attach normalises cardinality.
|
||||
expect((await json<ApplicationCv>(await page.request.get(attachUrl))).attachedVariantId).toBe(copy.id);
|
||||
expect(await json<CvVariant>(await page.request.get(`${apiUrl}/cv/variants/${seeded.cv.id}`))).toEqual(original);
|
||||
const partial = await json<CvVariantSummary[]>(await page.request.get(`${apiUrl}/cv/variants`));
|
||||
expect(partial.map(value => value.id).sort((a, b) => a - b)).toEqual([seeded.cv.id, copy.id].sort((a, b) => a - b));
|
||||
expect(partial.filter(value => value.jobApplicationId === seeded.job.id).map(value => value.id).sort((a, b) => a - b)).toEqual([seeded.cv.id, copy.id].sort((a, b) => a - b));
|
||||
await expect(section(page, translations.en.workspaceCv).getByRole('button', { name: translations.en.retry, exact: true })).toHaveCount(0);
|
||||
await capture(page, info, desktop, 'created-copy-failed-attach-preserved');
|
||||
expect(count(session, 'POST', `/api/cv/variants/${seeded.cv.id}/duplicate`)).toHaveLength(1); expect(attaches).toBe(1);
|
||||
const recovery = response(page, 'PUT', attachUrl);
|
||||
const builderRead = response(page, 'GET', `${apiUrl}/cv/variants/${copy.id}`);
|
||||
await keyboard(page, section(page, translations.en.workspaceCv).getByRole('button', { name: translations.en.assetsAttachCreatedCopy, exact: true }));
|
||||
expect((await recovery).status()).toBe(200);
|
||||
await expect(page).toHaveURL(new RegExp(`/career/builder/${copy.id}$`));
|
||||
expect(await json<CvVariant>(await builderRead)).toMatchObject({ id: copy.id, name: copy.name });
|
||||
expect((await json<ApplicationCv>(await page.request.get(attachUrl))).attachedVariantId).toBe(copy.id);
|
||||
expect((await json<CvVariantSummary[]>(await page.request.get(`${apiUrl}/cv/variants`))).filter(value => value.jobApplicationId === seeded.job.id).map(value => value.id)).toEqual([copy.id]);
|
||||
expect(count(session, 'POST', `/api/cv/variants/${seeded.cv.id}/duplicate`)).toHaveLength(1); expect(attaches).toBe(2);
|
||||
await info.attach('application-duplicate-partial-write', { body: JSON.stringify({ boundary, originalId: seeded.cv.id, createdCopyId: copy.id, duplicatePostCount: 1, attachAttempts: 2,
|
||||
recovery: 'Explicit Attach created copy reuses its exact ID, normalises association cardinality and opens its existing builder; no second duplicate.',
|
||||
qualification: 'Existing duplicate retains JobApplicationId on both original and copy before explicit attach; newest-copy read projection can differ from stale UI. Two nontransactional HTTP writes remain, without rollback/idempotency/version guarantee.' }), contentType: 'application/json' });
|
||||
});
|
||||
|
||||
test('[P7-06 forms] eight finite bilingual theme widths keep long CV, letter, drafts and frozen preview usable with keyboard', async ({ page, session }, info) => {
|
||||
test.setTimeout(240_000); const seeded = await frozenFixture(page, session.owner, true);
|
||||
const samples: (Sample & { sub: Subsection })[] = [
|
||||
{ language: 'en', theme: 'light', width: 320, height: 740, sub: 'answers' }, { language: 'nb', theme: 'dark', width: 360, height: 844, sub: 'letter' },
|
||||
{ language: 'en', theme: 'dark', width: 390, height: 844, sub: 'submission' }, { language: 'nb', theme: 'light', width: 768, height: 1024, sub: 'cv' },
|
||||
{ language: 'en', theme: 'dark', width: 1024, height: 768, sub: 'answers' }, { language: 'nb', theme: 'light', width: 1280, height: 320, sub: 'letter' },
|
||||
{ language: 'en', theme: 'light', width: 1440, height: 900, sub: 'submission' }, { language: 'nb', theme: 'dark', width: 1920, height: 1080, sub: 'cv' },
|
||||
];
|
||||
for (const sample of samples) {
|
||||
await enter(page, session.owner, seeded.job, sample.sub, sample); const t = translations[sample.language];
|
||||
let letterHint: { anchor: Locator; hint: Locator; id: string } | null = null;
|
||||
const selected = page.getByRole('tablist', { name: t.workspaceApplicationSections, exact: true }).locator('[aria-selected=true]'); await selected.focus(); await expect(selected).toBeFocused();
|
||||
if (sample.sub === 'letter') {
|
||||
await expect(letter(page, sample.language)).toHaveValue(seeded.originalLetter); await letter(page, sample.language).focus(); await expect(letter(page, sample.language)).toBeFocused();
|
||||
for (const title of [t.richTextBold, t.richTextItalic, t.richTextUnderline, t.richTextLink]) { const button = section(page, t.workspaceCoverLetter).getByRole('button', { name: title, exact: true }); await button.focus(); await expect(button).toBeFocused(); }
|
||||
const anchor = section(page, t.workspaceCoverLetter).getByRole('button', { name: t.richTextLink, exact: true });
|
||||
await expect(anchor).toHaveAttribute('aria-label', t.richTextLink);
|
||||
const visibleHint = page.getByRole('tooltip', { name: t.richTextLink, exact: true }); await expect(visibleHint).toBeVisible();
|
||||
// Existing MUI Tooltip names the child; describeChild is false, so there
|
||||
// is no aria-describedby contract to invent for this toolbar button.
|
||||
const id = await visibleHint.getAttribute('id'); expect(id).not.toBeNull();
|
||||
const hint = page.locator(`[id="${id}"]`); await expect(hint).toHaveAttribute('role', 'tooltip'); await expect(hint).toBeVisible();
|
||||
letterHint = { anchor, hint, id: id! };
|
||||
} else if (sample.sub === 'answers') {
|
||||
const fields = drafts(page, sample.language); await expect(fields.answer).toHaveValue(seeded.answer); await expect(fields.message).toHaveValue(seeded.message);
|
||||
await fields.answer.focus(); await expect(fields.answer).toBeFocused(); await fields.message.focus(); await expect(fields.message).toBeFocused();
|
||||
} else if (sample.sub === 'cv') {
|
||||
const control = attachedCv(page, sample.language); await expect(control).toContainText(seeded.cv.name); await control.focus(); await expect(control).toBeFocused();
|
||||
await expect(page.getByRole('link', { name: t.assetsEditPreviewExport, exact: true })).toHaveAttribute('href', `/career/builder/${seeded.cv.id}`);
|
||||
} else {
|
||||
const view = section(page, t.assetsSubmittedPackages).getByRole('button', { name: t.assetsPackageView, exact: true }); await keyboard(page, view);
|
||||
const dialog = page.getByRole('dialog', { name: interpolate(t.assetsSubmittedPackageVersion, { version: 1 }), exact: true });
|
||||
await expect(dialog).toContainText(seeded.originalLetter); const iframe = dialog.getByTitle(t.assetsPackageCvPreview, { exact: true });
|
||||
await expect(iframe).toHaveAttribute('srcdoc', seeded.detail.renderedCvHtml!); await expect(iframe).toHaveAttribute('sandbox', '');
|
||||
expect(await iframe.evaluate(node => getComputedStyle(node).backgroundColor)).toBe('rgb(255, 255, 255)');
|
||||
const close = dialog.getByRole('button', { name: t.close, exact: true }); await close.focus(); await expect(close).toBeFocused();
|
||||
}
|
||||
await page.evaluate(() => scrollTo(0, 0));
|
||||
if (letterHint) {
|
||||
await expect(letterHint.anchor).toBeFocused();
|
||||
const geometry = await letterHint.anchor.evaluate(node => {
|
||||
const rect = node.getBoundingClientRect();
|
||||
return { top: rect.top, bottom: rect.bottom, left: rect.left, right: rect.right, viewportWidth: innerWidth, viewportHeight: innerHeight,
|
||||
whollyOutsideViewport: rect.bottom <= 0 || rect.top >= innerHeight || rect.right <= 0 || rect.left >= innerWidth };
|
||||
});
|
||||
await expect(letterHint.hint).toBeAttached();
|
||||
if (geometry.whollyOutsideViewport) await expect(letterHint.hint).toBeHidden();
|
||||
else await expect(letterHint.hint).toBeVisible();
|
||||
await info.attach(`application-letter-hint-${sample.language}-${sample.width}`, { body: JSON.stringify({ matchingTooltipId: letterHint.id, anchorAccessibleName: t.richTextLink, geometry,
|
||||
expectation: geometry.whollyOutsideViewport ? 'Focused anchor outside viewport: matching hint hidden' : 'Focused anchor intersects viewport: matching hint visible' }), contentType: 'application/json' });
|
||||
}
|
||||
await capture(page, info, sample, `long-${sample.sub}`);
|
||||
if (sample.sub === 'submission') { await page.keyboard.press('Escape'); await expect(section(page, t.assetsSubmittedPackages).getByRole('button', { name: t.assetsPackageView, exact: true })).toBeFocused(); }
|
||||
}
|
||||
expect(mutations(session)).toEqual([]);
|
||||
});
|
||||
|
||||
test('[P7-06 forms] controlled language HTTP503 preserves local dirty drafts and Retry only repeats the language request', async ({ page, session }, info) => {
|
||||
test.setTimeout(90_000);
|
||||
const seeded = await fixture(page, session.owner); await enter(page, session.owner, seeded.job, 'letter');
|
||||
await expect(letter(page)).toHaveValue(seeded.originalLetter);
|
||||
const persistedBefore = await json<{ uiLanguage: string }>(await page.request.get(`${apiUrl}/auth/me`)); expect(persistedBefore.uiLanguage).toBe('en');
|
||||
const preferenceUrl = `${apiUrl}/auth/preferences/language`;
|
||||
const preferenceAttempts: { method: string; body: unknown }[] = [];
|
||||
await page.route(preferenceUrl, async route => {
|
||||
if (route.request().method() !== 'PUT') return route.continue();
|
||||
preferenceAttempts.push({ method: route.request().method(), body: route.request().postDataJSON() });
|
||||
return route.fulfill({ status: 503, json: {} });
|
||||
});
|
||||
const dirtyLetter = 'Controlled-failure draft; retain my exact unsaved letter — æøå';
|
||||
await letter(page).fill(dirtyLetter); let reads = assetReads(session, seeded.job.id).length;
|
||||
const firstResponse = response(page, 'PUT', preferenceUrl);
|
||||
await keyboard(page, page.locator('header').first().getByRole('button', { name: 'Norsk', exact: true }));
|
||||
expect((await firstResponse).status()).toBe(503); await expect(page.locator('html')).toHaveAttribute('lang', 'nb-NO');
|
||||
await expect(letter(page, 'nb')).toHaveValue(dirtyLetter);
|
||||
const nbFeedback = page.getByRole('alert').filter({ hasText: translations.nb.settingsLanguageSaveFailed }); await expect(nbFeedback).toBeVisible();
|
||||
const firstRetry = response(page, 'PUT', preferenceUrl);
|
||||
await keyboard(page, nbFeedback.getByRole('button', { name: translations.nb.retry, exact: true })); expect((await firstRetry).status()).toBe(503);
|
||||
await expect(nbFeedback).toBeVisible(); await expect(letter(page, 'nb')).toHaveValue(dirtyLetter);
|
||||
expect(preferenceAttempts).toEqual([{ method: 'PUT', body: { language: 'nb-NO' } }, { method: 'PUT', body: { language: 'nb-NO' } }]);
|
||||
expect(assetReads(session, seeded.job.id)).toHaveLength(reads); expect(mutations(session)).toEqual([]);
|
||||
await capture(page, info, { ...desktop, language: 'nb' }, 'controlled-language503-dirty-letter');
|
||||
|
||||
await keyboard(page, section(page, translations.nb.workspaceCoverLetter).getByRole('button', { name: translations.nb.assetsDiscardChanges, exact: true }));
|
||||
await keyboard(page, page.getByRole('tablist', { name: translations.nb.workspaceApplicationSections, exact: true }).getByRole('tab', { name: translations.nb.workspaceAnswers, exact: true }));
|
||||
await expect(drafts(page, 'nb').answer).toHaveValue(seeded.answer);
|
||||
const dirtyAnswer = 'Ulagret søknadssvar under kontrollert språkfeil — æøå'; const dirtyMessage = 'Ulagret melding; ikke sendt under språkfeilen — æøå';
|
||||
await drafts(page, 'nb').answer.fill(dirtyAnswer); await drafts(page, 'nb').message.fill(dirtyMessage); reads = assetReads(session, seeded.job.id).length;
|
||||
const secondResponse = response(page, 'PUT', preferenceUrl);
|
||||
await keyboard(page, page.locator('header').first().getByRole('button', { name: 'English', exact: true }));
|
||||
expect((await secondResponse).status()).toBe(503); await expect(page.locator('html')).toHaveAttribute('lang', 'en');
|
||||
await expect(drafts(page).answer).toHaveValue(dirtyAnswer); await expect(drafts(page).message).toHaveValue(dirtyMessage);
|
||||
const enFeedback = page.getByRole('alert').filter({ hasText: translations.en.settingsLanguageSaveFailed }); await expect(enFeedback).toBeVisible();
|
||||
const secondRetry = response(page, 'PUT', preferenceUrl);
|
||||
await keyboard(page, enFeedback.getByRole('button', { name: translations.en.retry, exact: true })); expect((await secondRetry).status()).toBe(503);
|
||||
await expect(enFeedback).toBeVisible(); await expect(drafts(page).answer).toHaveValue(dirtyAnswer); await expect(drafts(page).message).toHaveValue(dirtyMessage);
|
||||
expect(preferenceAttempts).toEqual([{ method: 'PUT', body: { language: 'nb-NO' } }, { method: 'PUT', body: { language: 'nb-NO' } }, { method: 'PUT', body: { language: 'en' } }, { method: 'PUT', body: { language: 'en' } }]);
|
||||
expect(assetReads(session, seeded.job.id)).toHaveLength(reads); expect(mutations(session)).toEqual([]);
|
||||
const persistedAfter = await json<{ uiLanguage: string }>(await page.request.get(`${apiUrl}/auth/me`)); expect(persistedAfter.uiLanguage).toBe(persistedBefore.uiLanguage);
|
||||
expect((await json<CoverLetter>(await page.request.get(`${jobUrl(seeded.job.id)}/cover-letter`))).text).toBe(seeded.originalLetter);
|
||||
const workspace = await json<WorkspaceOverview>(await page.request.get(`${jobUrl(seeded.job.id)}/workspace`)); expect(workspace.applicationAnswerDraft).toBe(seeded.answer); expect(workspace.recruiterMessageDraft).toBe(seeded.message);
|
||||
await capture(page, info, desktop, 'controlled-language503-dirty-answer-drafts');
|
||||
await info.attach('application-controlled-language503-boundary', { body: JSON.stringify({ boundary, controlledResponseStatus: 503, preferenceAttempts, persistedBefore: persistedBefore.uiLanguage, persistedAfter: persistedAfter.uiLanguage,
|
||||
qualification: 'Page-only language PUT is deliberately fulfilled503 before server execution. Proves local presentation, retained drafts and exact Retry request without asset GET/job writes; it does not prove account preference persistence or close RD11. The separate ordinary real-server locale case keeps its strict204 assertions and observed500 failures.' }), contentType: 'application/json' });
|
||||
});
|
||||
@@ -1,14 +1,17 @@
|
||||
import React from "react";
|
||||
import "@testing-library/jest-dom";
|
||||
import { fireEvent, render as rtlRender, screen, waitFor } from "@testing-library/react";
|
||||
import { act, fireEvent, render as rtlRender, screen, waitFor, within } from "@testing-library/react";
|
||||
|
||||
import {
|
||||
ApplicationCoverLetterSection, ApplicationCvSection, ApplicationPackageDraftsSection, SubmittedPackagesSection,
|
||||
} from "./components/ApplicationAssets";
|
||||
import { api } from "./api";
|
||||
import { I18nProvider } from "./i18n/I18nProvider";
|
||||
import { ConfirmProvider } from "./confirm";
|
||||
import { translations, type UiLanguage } from "./i18n/translations";
|
||||
|
||||
const render = (ui: React.ReactElement) => rtlRender(<I18nProvider>{ui}</I18nProvider>);
|
||||
const withProviders = (ui: React.ReactElement) => <I18nProvider><ConfirmProvider>{ui}</ConfirmProvider></I18nProvider>;
|
||||
const render = (ui: React.ReactElement) => rtlRender(withProviders(ui));
|
||||
|
||||
jest.mock("./api", () => ({
|
||||
api: {
|
||||
@@ -17,7 +20,7 @@ jest.mock("./api", () => ({
|
||||
post: jest.fn(),
|
||||
interceptors: { request: { use: jest.fn() }, response: { use: jest.fn() } },
|
||||
},
|
||||
getApiErrorMessage: (_e: any, fallback?: string) => fallback || "Request failed.",
|
||||
getApiErrorMessage: (_e: unknown, fallback = "Request failed.") => fallback,
|
||||
}));
|
||||
|
||||
const mockedApi = api as jest.Mocked<typeof api>;
|
||||
@@ -69,10 +72,37 @@ function routeGet(overrides: Record<string, any> = {}) {
|
||||
|
||||
beforeEach(() => {
|
||||
window.localStorage.removeItem("uiLanguage");
|
||||
document.documentElement.lang = "en";
|
||||
jest.clearAllMocks();
|
||||
mockedApi.get.mockReset();
|
||||
mockedApi.put.mockReset();
|
||||
mockedApi.post.mockReset();
|
||||
});
|
||||
|
||||
afterEach(() => window.localStorage.removeItem("uiLanguage"));
|
||||
afterEach(() => {
|
||||
window.localStorage.removeItem("uiLanguage");
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
function copy(key: string, params: Record<string, string | number> = {}, language: UiLanguage = document.documentElement.lang === "nb-NO" ? "nb" : "en") {
|
||||
const template = (translations[language] as Record<string, string>)[key] ?? key;
|
||||
return template.replace(/\{(\w+)\}/g, (_, name) => String(params[name] ?? `{${name}}`));
|
||||
}
|
||||
|
||||
function section(key: string) {
|
||||
return within(screen.getByRole("region", { name: copy(key) }));
|
||||
}
|
||||
|
||||
function changeLanguage(language: UiLanguage) {
|
||||
act(() => { window.dispatchEvent(new StorageEvent("storage", { key: "uiLanguage", newValue: language })); });
|
||||
}
|
||||
|
||||
function deferred<T>() {
|
||||
let resolve!: (value: T) => void;
|
||||
let reject!: (reason: unknown) => void;
|
||||
const promise = new Promise<T>((yes, no) => { resolve = yes; reject = no; });
|
||||
return { promise, resolve, reject };
|
||||
}
|
||||
|
||||
test("document package history is read-only and separates captured notes from answers", async () => {
|
||||
const summary = { id: 91, version: 1, cvVariantId: 3, cvVariantName: "Original CV", cvVariantVersion: 2, cvThemeId: "nordic", hasCv: false, hasCoverLetter: true, createdAtUtc: "2026-07-19T10:00:00Z", attachments: [] };
|
||||
@@ -302,7 +332,7 @@ test("a failed load surfaces an error", async () => {
|
||||
|
||||
render(<ApplicationCoverLetterSection jobId={7} />);
|
||||
|
||||
expect(await screen.findByText(/Could not load this section/i)).toBeInTheDocument();
|
||||
expect(await section("workspaceCoverLetter").findByText(/Could not load this section/i)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
// ---------- Application package drafts ----------
|
||||
@@ -355,3 +385,350 @@ test("application package drafts can be cleared without deleting ordinary notes"
|
||||
{ applicationAnswerDraft: "", recruiterMessageDraft: "" },
|
||||
));
|
||||
});
|
||||
|
||||
// ---------- Phase 7 retained-owner recovery ----------
|
||||
|
||||
test("failed cover-letter saving retains editable dirty text and original Save recovery across a live locale change", async () => {
|
||||
routeGet();
|
||||
const text = "Retained letter draft — æøå";
|
||||
mockedApi.put.mockRejectedValueOnce({ response: { status: 503 } })
|
||||
.mockResolvedValueOnce({ data: { ...coverLetter, text } } as any);
|
||||
const onDirtyChange = jest.fn();
|
||||
render(<ApplicationCoverLetterSection jobId={7} onDirtyChange={onDirtyChange} />);
|
||||
fireEvent.change(await screen.findByRole("textbox", { name: copy("jobDetailsCoverLetter") }), { target: { value: text } });
|
||||
fireEvent.click(section("workspaceCoverLetter").getByRole("button", { name: copy("save") }));
|
||||
expect(await section("workspaceCoverLetter").findByRole("alert")).toHaveTextContent(copy("assetsCoverSaveFailed"));
|
||||
expect(screen.getByRole("textbox", { name: copy("jobDetailsCoverLetter") })).toHaveValue(text);
|
||||
expect(screen.getByRole("textbox", { name: copy("jobDetailsCoverLetter") })).toBeEnabled();
|
||||
expect(section("workspaceCoverLetter").getByRole("button", { name: copy("save") })).toBeEnabled();
|
||||
expect(section("workspaceCoverLetter").getByRole("button", { name: copy("assetsDiscardChanges") })).toBeEnabled();
|
||||
expect(section("workspaceCoverLetter").queryByRole("button", { name: copy("retry") })).not.toBeInTheDocument();
|
||||
expect(onDirtyChange).toHaveBeenLastCalledWith(true);
|
||||
const reads = mockedApi.get.mock.calls.length;
|
||||
changeLanguage("nb");
|
||||
expect(section("workspaceCoverLetter").getByRole("alert")).toHaveTextContent(copy("assetsCoverSaveFailed"));
|
||||
expect(screen.getByRole("textbox", { name: copy("jobDetailsCoverLetter") })).toHaveValue(text);
|
||||
expect(mockedApi.get).toHaveBeenCalledTimes(reads);
|
||||
fireEvent.click(section("workspaceCoverLetter").getByRole("button", { name: copy("save") }));
|
||||
await waitFor(() => expect(mockedApi.put).toHaveBeenCalledTimes(2));
|
||||
const payload = { text, source: "manual", aiAction: undefined };
|
||||
expect(mockedApi.put).toHaveBeenNthCalledWith(1, "/jobapplications/7/cover-letter", payload);
|
||||
expect(mockedApi.put).toHaveBeenNthCalledWith(2, "/jobapplications/7/cover-letter", payload);
|
||||
await waitFor(() => expect(onDirtyChange).toHaveBeenLastCalledWith(false));
|
||||
expect(screen.getByRole("textbox", { name: copy("jobDetailsCoverLetter") })).toHaveValue(text);
|
||||
expect(mockedApi.post).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("failed application-answer saving keeps both dirty drafts editable and retries only the original save payload", async () => {
|
||||
mockedApi.put.mockRejectedValueOnce({ response: { status: 503 } }).mockResolvedValueOnce({ status: 204 } as any);
|
||||
const onDirtyChange = jest.fn();
|
||||
const onSaved = jest.fn();
|
||||
render(<ApplicationPackageDraftsSection jobId={7} initialApplicationAnswer="Saved answer" initialRecruiterMessage="Saved message" onDirtyChange={onDirtyChange} onSaved={onSaved} />);
|
||||
fireEvent.change(screen.getByLabelText(copy("assetsApplicationAnswer")), { target: { value: "Retained answer" } });
|
||||
fireEvent.change(screen.getByLabelText(copy("assetsRecruiterMessage")), { target: { value: "Retained recruiter draft" } });
|
||||
fireEvent.click(screen.getByRole("button", { name: copy("assetsSaveDrafts") }));
|
||||
expect(await section("assetsApplicationDrafts").findByRole("alert")).toHaveTextContent(copy("assetsDraftsSaveFailed"));
|
||||
expect(screen.getByLabelText(copy("assetsApplicationAnswer"))).toHaveValue("Retained answer");
|
||||
expect(screen.getByLabelText(copy("assetsRecruiterMessage"))).toHaveValue("Retained recruiter draft");
|
||||
expect(screen.getByLabelText(copy("assetsApplicationAnswer"))).toBeEnabled();
|
||||
expect(screen.getByLabelText(copy("assetsRecruiterMessage"))).toBeEnabled();
|
||||
expect(onDirtyChange).toHaveBeenLastCalledWith(true);
|
||||
expect(onSaved).not.toHaveBeenCalled();
|
||||
changeLanguage("nb");
|
||||
expect(section("assetsApplicationDrafts").getByRole("alert")).toHaveTextContent(copy("assetsDraftsSaveFailed"));
|
||||
expect(mockedApi.get).not.toHaveBeenCalled();
|
||||
fireEvent.click(screen.getByRole("button", { name: copy("assetsSaveDrafts") }));
|
||||
await waitFor(() => expect(onSaved).toHaveBeenCalledTimes(1));
|
||||
const payload = { applicationAnswerDraft: "Retained answer", recruiterMessageDraft: "Retained recruiter draft" };
|
||||
expect(mockedApi.put).toHaveBeenNthCalledWith(1, "/jobapplications/7/application-drafts", payload);
|
||||
expect(mockedApi.put).toHaveBeenNthCalledWith(2, "/jobapplications/7/application-drafts", payload);
|
||||
expect(onDirtyChange).toHaveBeenLastCalledWith(false);
|
||||
expect(mockedApi.post).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("failed CV attachment leaves the current association and selector available for the original explicit action", async () => {
|
||||
routeGet();
|
||||
mockedApi.put.mockRejectedValueOnce({ response: { status: 503 } })
|
||||
.mockResolvedValueOnce({ data: { ...cv, attachedVariantId: 5, attachedVariantName: "Generalist CV" } } as any);
|
||||
render(<ApplicationCvSection jobId={7} includePackages={false} />);
|
||||
const select = () => screen.getByRole("combobox", { name: copy("assetsAttachedCv") });
|
||||
fireEvent.mouseDown(await screen.findByRole("combobox", { name: /Attached CV variant/i }));
|
||||
fireEvent.click(await screen.findByRole("option", { name: /Generalist CV/ }));
|
||||
expect(await section("workspaceCv").findByRole("alert")).toHaveTextContent(copy("assetsAttachCvFailed"));
|
||||
expect(select()).toHaveTextContent("Backend CV");
|
||||
expect(select()).not.toHaveAttribute("aria-disabled", "true");
|
||||
expect(section("workspaceCv").getByRole("link", { name: /Edit, preview and export/i })).toHaveAttribute("href", "/career/builder/3");
|
||||
expect(section("workspaceCv").queryByRole("button", { name: copy("retry") })).not.toBeInTheDocument();
|
||||
fireEvent.mouseDown(select());
|
||||
fireEvent.click(await screen.findByRole("option", { name: /Generalist CV/ }));
|
||||
await waitFor(() => expect(mockedApi.put).toHaveBeenCalledTimes(2));
|
||||
expect(mockedApi.put).toHaveBeenNthCalledWith(1, "/jobapplications/7/cv", { variantId: 5 });
|
||||
expect(mockedApi.put).toHaveBeenNthCalledWith(2, "/jobapplications/7/cv", { variantId: 5 });
|
||||
await waitFor(() => expect(section("workspaceCv").getByRole("link", { name: /Edit, preview and export/i })).toHaveAttribute("href", "/career/builder/5"));
|
||||
expect(mockedApi.post).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("dirty version restore cancels without a write and confirmed held restore appends history exactly once", async () => {
|
||||
routeGet();
|
||||
const write = deferred<any>();
|
||||
mockedApi.post.mockImplementation(() => write.promise);
|
||||
const onDirtyChange = jest.fn();
|
||||
render(<ApplicationCoverLetterSection jobId={7} onDirtyChange={onDirtyChange} />);
|
||||
fireEvent.change(await screen.findByRole("textbox", { name: "Cover letter" }), { target: { value: "Unsaved text before restore" } });
|
||||
fireEvent.click(screen.getByRole("button", { name: /Restore version 1/i }));
|
||||
expect(mockedApi.post).not.toHaveBeenCalled();
|
||||
const dialog = await screen.findByRole("dialog", { name: copy("assetsRestoreDiscardTitle") });
|
||||
fireEvent.click(within(dialog).getByRole("button", { name: copy("cancel") }));
|
||||
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
|
||||
expect(screen.getByRole("textbox", { name: "Cover letter" })).toHaveValue("Unsaved text before restore");
|
||||
expect(onDirtyChange).toHaveBeenLastCalledWith(true);
|
||||
expect(mockedApi.post).not.toHaveBeenCalled();
|
||||
fireEvent.click(screen.getByRole("button", { name: /Restore version 1/i }));
|
||||
const confirmed = await screen.findByRole("dialog", { name: copy("assetsRestoreDiscardTitle") });
|
||||
const confirm = within(confirmed).getByRole("button", { name: copy("assetsRestoreConfirm") });
|
||||
act(() => { fireEvent.click(confirm); fireEvent.click(confirm); });
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenCalledTimes(1));
|
||||
expect(mockedApi.post).toHaveBeenCalledWith("/jobapplications/7/cover-letter/versions/1/restore");
|
||||
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
|
||||
expect(screen.getByRole("button", { name: /Restore version 1/i })).toBeDisabled();
|
||||
await act(async () => { write.resolve({ data: {
|
||||
...coverLetter, text: "Restored old text", currentVersion: 3,
|
||||
versions: [{ version: 3, source: "restore", aiAction: null, length: 17, createdAtUtc: "2026-07-20T10:00:00Z", isCurrent: true }, ...coverLetter.versions.map((version) => ({ ...version, isCurrent: false }))],
|
||||
} }); });
|
||||
expect(await screen.findByDisplayValue("Restored old text")).toBeInTheDocument();
|
||||
expect(screen.getByText("v3")).toBeInTheDocument();
|
||||
expect(screen.getByText("v2")).toBeInTheDocument();
|
||||
expect(screen.getByText("v1")).toBeInTheDocument();
|
||||
expect(onDirtyChange).toHaveBeenLastCalledWith(false);
|
||||
expect(mockedApi.post).toHaveBeenCalledTimes(1);
|
||||
expect(mockedApi.put).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("held letter Save submits one snapshot and prevents an AI Apply from replacing its pending draft", async () => {
|
||||
routeGet();
|
||||
mockedApi.post.mockResolvedValue({ data: { result: { text: "Unaccepted AI suggestion" } } } as any);
|
||||
const write = deferred<any>();
|
||||
mockedApi.put.mockImplementation(() => write.promise);
|
||||
render(<ApplicationCoverLetterSection jobId={7} />);
|
||||
fireEvent.click(await screen.findByRole("button", { name: "Generate" }));
|
||||
const apply = await screen.findByRole("button", { name: /Apply to editor/i });
|
||||
fireEvent.change(screen.getByRole("textbox", { name: "Cover letter" }), { target: { value: "Explicit manual save snapshot" } });
|
||||
const save = section("workspaceCoverLetter").getByRole("button", { name: "Save" });
|
||||
act(() => { fireEvent.click(save); fireEvent.click(save); });
|
||||
expect(mockedApi.put).toHaveBeenCalledTimes(1);
|
||||
expect(mockedApi.put).toHaveBeenCalledWith("/jobapplications/7/cover-letter", { text: "Explicit manual save snapshot", source: "manual", aiAction: undefined });
|
||||
expect(apply).toBeDisabled();
|
||||
fireEvent.click(apply);
|
||||
expect(screen.getByRole("textbox", { name: "Cover letter" })).toHaveValue("Explicit manual save snapshot");
|
||||
await act(async () => { write.resolve({ data: { ...coverLetter, text: "Explicit manual save snapshot" } }); });
|
||||
expect(screen.getByRole("textbox", { name: "Cover letter" })).toHaveValue("Explicit manual save snapshot");
|
||||
expect(mockedApi.put).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test("held AI generation locks its controls and preserves captured action attribution after a later action selection", async () => {
|
||||
routeGet();
|
||||
const generation = deferred<any>();
|
||||
mockedApi.post.mockImplementation(() => generation.promise);
|
||||
render(<ApplicationCoverLetterSection jobId={7} />);
|
||||
await screen.findByText(/application's full job advert and analysis/i);
|
||||
fireEvent.mouseDown(screen.getByRole("combobox", { name: "Document language" }));
|
||||
fireEvent.click(await screen.findByRole("option", { name: /Norsk bokmål/i }));
|
||||
fireEvent.change(screen.getByRole("textbox", { name: "Additional instructions" }), { target: { value: "Use only recorded context" } });
|
||||
const generate = screen.getByRole("button", { name: "Generate" });
|
||||
act(() => { fireEvent.click(generate); fireEvent.click(generate); });
|
||||
expect(mockedApi.post).toHaveBeenCalledTimes(1);
|
||||
expect(mockedApi.post).toHaveBeenCalledWith("/jobapplications/7/ai/generate", expect.objectContaining({ module: "cover-letter", action: "generate", mode: "professional", targetLanguage: "nb-NO", currentText: "Dear team", extraContext: "Use only recorded context" }));
|
||||
for (const name of ["Action", "Tone", "Document language"]) expect(screen.getByRole("combobox", { name })).toHaveAttribute("aria-disabled", "true");
|
||||
expect(screen.getByRole("textbox", { name: "Additional instructions" })).toBeDisabled();
|
||||
await act(async () => { generation.resolve({ data: { result: { text: "Captured generated suggestion" } } }); });
|
||||
fireEvent.mouseDown(screen.getByRole("combobox", { name: "Action" }));
|
||||
fireEvent.click(await screen.findByRole("option", { name: "Improve" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: /Apply to editor/i }));
|
||||
mockedApi.put.mockResolvedValue({ data: { ...coverLetter, text: "Captured generated suggestion" } } as any);
|
||||
fireEvent.click(section("workspaceCoverLetter").getByRole("button", { name: "Save" }));
|
||||
await waitFor(() => expect(mockedApi.put).toHaveBeenCalledWith("/jobapplications/7/cover-letter", { text: "Captured generated suggestion", source: "ai", aiAction: "generate" }));
|
||||
expect(mockedApi.post).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
test("capture, detail and download failures keep owned frozen history and recover only through their original explicit actions", async () => {
|
||||
const attachment = { id: 17, fileName: "frozen-letter.txt", fileSize: 1024, contentType: "text/plain", sha256: "fixture-hash" };
|
||||
const summary = { id: 91, version: 1, cvVariantId: 3, cvVariantName: "Original CV", cvVariantVersion: 2, cvThemeId: "nordic", hasCv: true, hasCoverLetter: true, createdAtUtc: "2026-07-19T10:00:00Z", attachments: [attachment] };
|
||||
const created = { ...summary, id: 92, version: 2, cvVariantName: "Backend CV", cvVariantVersion: 4, attachments: [] };
|
||||
const detail = { summary, renderedCvHtml: "<html><body>Frozen CV fixture</body></html>", coverLetterText: "Frozen original letter", applicationMaterialJson: "{}" };
|
||||
const blob = new Blob(["Frozen file fixture"], { type: "text/plain" });
|
||||
let detailReads = 0;
|
||||
let downloads = 0;
|
||||
mockedApi.get.mockImplementation((url: string) => {
|
||||
if (url === "/jobapplications/7/submitted-packages/91") return ++detailReads === 1 ? Promise.reject({ response: { status: 503 } }) : Promise.resolve({ data: detail } as any);
|
||||
if (url === "/jobapplications/7/submitted-packages/91/attachments/17") return ++downloads === 1 ? Promise.reject({ response: { status: 503 } }) : Promise.resolve({ data: blob } as any);
|
||||
if (url.endsWith("/submitted-packages")) return Promise.resolve({ data: [summary] } as any);
|
||||
if (url.endsWith("/tailoring")) return Promise.resolve({ data: tailoring } as any);
|
||||
return Promise.resolve({ data: cv } as any);
|
||||
});
|
||||
mockedApi.post.mockRejectedValueOnce({ response: { status: 503 } }).mockResolvedValueOnce({ data: created } as any);
|
||||
const originalCreate = Object.getOwnPropertyDescriptor(URL, "createObjectURL");
|
||||
const originalRevoke = Object.getOwnPropertyDescriptor(URL, "revokeObjectURL");
|
||||
const createUrl = jest.fn(() => "blob:owned-frozen-fixture");
|
||||
const revokeUrl = jest.fn();
|
||||
Object.defineProperty(URL, "createObjectURL", { configurable: true, value: createUrl });
|
||||
Object.defineProperty(URL, "revokeObjectURL", { configurable: true, value: revokeUrl });
|
||||
const downloadedNames: string[] = [];
|
||||
jest.spyOn(HTMLAnchorElement.prototype, "click").mockImplementation(function (this: HTMLAnchorElement) { downloadedNames.push(this.download); });
|
||||
try {
|
||||
render(<ApplicationCvSection jobId={7} />);
|
||||
fireEvent.click(await screen.findByRole("button", { name: /Freeze current package/i }));
|
||||
expect(await section("assetsSubmittedPackages").findByRole("alert")).toHaveTextContent(copy("assetsPackageCaptureFailed"));
|
||||
expect(screen.getByText("Submission package v1")).toBeInTheDocument();
|
||||
expect(section("workspaceCv").getByRole("link", { name: /Edit, preview and export/i })).toHaveAttribute("href", "/career/builder/3");
|
||||
expect(section("assetsSubmittedPackages").queryByRole("button", { name: copy("retry") })).not.toBeInTheDocument();
|
||||
expect(mockedApi.post).toHaveBeenCalledTimes(1);
|
||||
fireEvent.click(section("assetsSubmittedPackages").getByRole("button", { name: /Freeze current package/i }));
|
||||
await screen.findByText("Submission package v2");
|
||||
const packageRow = () => screen.getByText("Submission package v1").closest<HTMLElement>(".MuiPaper-root")!;
|
||||
fireEvent.click(within(packageRow()).getByRole("button", { name: "View preserved package" }));
|
||||
expect(await section("assetsSubmittedPackages").findByRole("alert")).toHaveTextContent(copy("assetsPackageLoadFailed"));
|
||||
expect(screen.getByText("Submission package v1")).toBeInTheDocument();
|
||||
expect(screen.getByText("Submission package v2")).toBeInTheDocument();
|
||||
expect(detailReads).toBe(1);
|
||||
expect(mockedApi.post).toHaveBeenCalledTimes(2);
|
||||
fireEvent.click(within(packageRow()).getByRole("button", { name: "View preserved package" }));
|
||||
const preserved = await screen.findByRole("dialog");
|
||||
expect(preserved).toHaveTextContent("Frozen original letter");
|
||||
expect(detailReads).toBe(2);
|
||||
fireEvent.click(within(preserved).getByRole("button", { name: "Close" }));
|
||||
await waitFor(() => expect(screen.queryByRole("dialog")).not.toBeInTheDocument());
|
||||
fireEvent.click(within(packageRow()).getByRole("button", { name: /frozen-letter\.txt/ }));
|
||||
expect(await section("assetsSubmittedPackages").findByRole("alert")).toHaveTextContent(copy("assetsPackageDownloadFailed"));
|
||||
expect(screen.getByText("Original CV · v2")).toBeInTheDocument();
|
||||
expect(section("workspaceCv").getByRole("link", { name: /Edit, preview and export/i })).toHaveAttribute("href", "/career/builder/3");
|
||||
expect(downloads).toBe(1);
|
||||
fireEvent.click(within(packageRow()).getByRole("button", { name: /frozen-letter\.txt/ }));
|
||||
await waitFor(() => expect(createUrl).toHaveBeenCalledWith(blob));
|
||||
expect(downloads).toBe(2);
|
||||
expect(downloadedNames).toEqual(["frozen-letter.txt"]);
|
||||
expect(revokeUrl).toHaveBeenCalledWith("blob:owned-frozen-fixture");
|
||||
expect(mockedApi.post.mock.calls).toEqual([["/jobapplications/7/submitted-packages"], ["/jobapplications/7/submitted-packages"]]);
|
||||
expect(mockedApi.put).not.toHaveBeenCalled();
|
||||
} finally {
|
||||
if (originalCreate) Object.defineProperty(URL, "createObjectURL", originalCreate); else Reflect.deleteProperty(URL, "createObjectURL");
|
||||
if (originalRevoke) Object.defineProperty(URL, "revokeObjectURL", originalRevoke); else Reflect.deleteProperty(URL, "revokeObjectURL");
|
||||
}
|
||||
});
|
||||
|
||||
test("all five asset read owners expose GET-only recovery without false empty history or locale refetch", async () => {
|
||||
mockedApi.get.mockRejectedValue({ response: { status: 503 } });
|
||||
render(<><ApplicationCvSection jobId={7} includePackages={false} /><SubmittedPackagesSection jobId={7} allowCapture={false} /><ApplicationCoverLetterSection jobId={7} /></>);
|
||||
const owners = ["workspaceCv", "assetsTailoring", "assetsSubmittedPackages", "workspaceCoverLetter", "coverAiTitle"];
|
||||
await waitFor(() => expect(mockedApi.get).toHaveBeenCalledTimes(5));
|
||||
for (const key of owners) expect(await section(key).findByRole("alert")).toHaveTextContent(copy("assetsLoadFailed"));
|
||||
expect(screen.queryByText(copy("assetsNoVersions"))).not.toBeInTheDocument();
|
||||
expect(screen.queryByText(copy("assetsNoSubmittedPackages"))).not.toBeInTheDocument();
|
||||
expect(screen.queryByText(copy("coverAiSelectCv"))).not.toBeInTheDocument();
|
||||
changeLanguage("nb");
|
||||
for (const key of owners) expect(section(key).getByRole("alert")).toHaveTextContent(copy("assetsLoadFailed"));
|
||||
expect(mockedApi.get).toHaveBeenCalledTimes(5);
|
||||
routeGet();
|
||||
const endpoints = ["cv", "tailoring", "submitted-packages", "cover-letter", "cv"];
|
||||
for (let index = 0; index < owners.length; index++) {
|
||||
fireEvent.click(section(owners[index]).getByRole("button", { name: copy("retry") }));
|
||||
await waitFor(() => expect(mockedApi.get).toHaveBeenCalledTimes(6 + index));
|
||||
expect(mockedApi.get).toHaveBeenNthCalledWith(6 + index, `/jobapplications/7/${endpoints[index]}`);
|
||||
await waitFor(() => expect(section(owners[index]).queryByRole("button", { name: copy("retry") })).not.toBeInTheDocument());
|
||||
}
|
||||
expect(screen.getByRole("textbox", { name: copy("jobDetailsCoverLetter") })).toHaveValue("Dear team");
|
||||
expect(screen.getByText("v2")).toBeInTheDocument();
|
||||
expect(mockedApi.put).not.toHaveBeenCalled();
|
||||
expect(mockedApi.post).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test("keyed job changes stop a late CV copy from attaching and never reuse another job's saved-copy recovery", async () => {
|
||||
const jobBCv = {
|
||||
...cv,
|
||||
attachedVariantId: 9,
|
||||
attachedVariantName: "Job B CV",
|
||||
attachedVersion: 6,
|
||||
availableVariants: [{ ...cv.availableVariants[0], id: 9, name: "Job B CV", version: 6, jobApplicationId: 8 }],
|
||||
};
|
||||
mockedApi.get.mockImplementation((url: string) => Promise.resolve({
|
||||
data: url.endsWith("/tailoring") ? tailoring : url === "/jobapplications/8/cv" ? jobBCv : cv,
|
||||
} as any));
|
||||
const oldCopy = deferred<any>();
|
||||
mockedApi.post.mockReturnValueOnce(oldCopy.promise);
|
||||
const mounted = render(<ApplicationCvSection key={7} jobId={7} includePackages={false} />);
|
||||
const initialLocation = window.location.href;
|
||||
fireEvent.click(await screen.findByRole("button", { name: copy("assetsDuplicateForJob") }));
|
||||
expect(mockedApi.post).toHaveBeenCalledWith("/cv/variants/3/duplicate", {
|
||||
name: copy("assetsTailoredCopyName", { name: "Backend CV" }),
|
||||
});
|
||||
|
||||
mounted.rerender(withProviders(<ApplicationCvSection key={8} jobId={8} includePackages={false} />));
|
||||
await waitFor(() => expect(screen.getByRole("combobox", { name: copy("assetsAttachedCv") })).toHaveTextContent("Job B CV"));
|
||||
await act(async () => { oldCopy.resolve({ data: { id: 83 } }); await oldCopy.promise; });
|
||||
expect(mockedApi.put).not.toHaveBeenCalled();
|
||||
expect(window.location.href).toBe(initialLocation);
|
||||
expect(section("workspaceCv").getByRole("link", { name: /Edit, preview and export/i })).toHaveAttribute("href", "/career/builder/9");
|
||||
expect(screen.getByRole("button", { name: copy("assetsDuplicateForJob") })).toBeEnabled();
|
||||
expect(screen.queryByRole("button", { name: copy("assetsAttachCreatedCopy") })).not.toBeInTheDocument();
|
||||
|
||||
mounted.rerender(withProviders(<ApplicationCvSection key={7} jobId={7} includePackages={false} />));
|
||||
mockedApi.post.mockResolvedValueOnce({ data: { id: 84 } } as any);
|
||||
mockedApi.put.mockRejectedValueOnce({ response: { status: 503 } });
|
||||
fireEvent.click(await screen.findByRole("button", { name: copy("assetsDuplicateForJob") }));
|
||||
await waitFor(() => expect(screen.getByRole("button", { name: copy("assetsAttachCreatedCopy") })).toBeEnabled());
|
||||
expect(await section("workspaceCv").findByText(copy("assetsAttachCvFailed"))).toBeInTheDocument();
|
||||
expect(mockedApi.put).toHaveBeenCalledTimes(1);
|
||||
expect(mockedApi.put).toHaveBeenCalledWith("/jobapplications/7/cv", { variantId: 84 });
|
||||
|
||||
mounted.rerender(withProviders(<ApplicationCvSection key={8} jobId={8} includePackages={false} />));
|
||||
await waitFor(() => expect(screen.getByRole("combobox", { name: copy("assetsAttachedCv") })).toHaveTextContent("Job B CV"));
|
||||
expect(screen.queryByRole("button", { name: copy("assetsAttachCreatedCopy") })).not.toBeInTheDocument();
|
||||
expect(screen.queryByText(copy("assetsCopyCreatedHelp"))).not.toBeInTheDocument();
|
||||
const jobBCopy = deferred<any>();
|
||||
mockedApi.post.mockReturnValueOnce(jobBCopy.promise);
|
||||
fireEvent.click(screen.getByRole("button", { name: copy("assetsDuplicateForJob") }));
|
||||
expect(mockedApi.post).toHaveBeenCalledTimes(3);
|
||||
expect(mockedApi.post).toHaveBeenLastCalledWith("/cv/variants/9/duplicate", {
|
||||
name: copy("assetsTailoredCopyName", { name: "Job B CV" }),
|
||||
});
|
||||
expect(mockedApi.put).toHaveBeenCalledTimes(1);
|
||||
expect(section("workspaceCv").getByRole("link", { name: /Edit, preview and export/i })).toHaveAttribute("href", "/career/builder/9");
|
||||
expect(window.location.href).toBe(initialLocation);
|
||||
mounted.unmount();
|
||||
});
|
||||
|
||||
test("keyed job changes keep job B's answer drafts and callbacks independent of job A's late save", async () => {
|
||||
const saveA = deferred<any>();
|
||||
mockedApi.put.mockReturnValueOnce(saveA.promise);
|
||||
const onSavedA = jest.fn();
|
||||
const onSavedB = jest.fn();
|
||||
const onDirtyB = jest.fn();
|
||||
const mounted = render(<ApplicationPackageDraftsSection key={7} jobId={7}
|
||||
initialApplicationAnswer="Saved A answer" initialRecruiterMessage="Saved A message" onSaved={onSavedA} />);
|
||||
fireEvent.change(screen.getByRole("textbox", { name: copy("assetsApplicationAnswer") }), { target: { value: "Pending A answer" } });
|
||||
fireEvent.change(screen.getByRole("textbox", { name: copy("assetsRecruiterMessage") }), { target: { value: "Pending A message" } });
|
||||
fireEvent.click(screen.getByRole("button", { name: copy("assetsSaveDrafts") }));
|
||||
expect(mockedApi.put).toHaveBeenCalledWith("/jobapplications/7/application-drafts", {
|
||||
applicationAnswerDraft: "Pending A answer", recruiterMessageDraft: "Pending A message",
|
||||
});
|
||||
|
||||
mounted.rerender(withProviders(<ApplicationPackageDraftsSection key={8} jobId={8}
|
||||
initialApplicationAnswer="Saved B answer" initialRecruiterMessage="Saved B message" onSaved={onSavedB} onDirtyChange={onDirtyB} />));
|
||||
fireEvent.change(screen.getByRole("textbox", { name: copy("assetsApplicationAnswer") }), { target: { value: "Unsaved B answer" } });
|
||||
fireEvent.change(screen.getByRole("textbox", { name: copy("assetsRecruiterMessage") }), { target: { value: "Unsaved B message" } });
|
||||
await act(async () => { saveA.resolve({ data: undefined }); await saveA.promise; });
|
||||
expect(screen.getByRole("textbox", { name: copy("assetsApplicationAnswer") })).toHaveValue("Unsaved B answer");
|
||||
expect(screen.getByRole("textbox", { name: copy("assetsRecruiterMessage") })).toHaveValue("Unsaved B message");
|
||||
expect(screen.getByRole("button", { name: copy("assetsSaveDrafts") })).toBeEnabled();
|
||||
expect(onDirtyB).toHaveBeenLastCalledWith(true);
|
||||
expect(onSavedA).not.toHaveBeenCalled();
|
||||
expect(onSavedB).not.toHaveBeenCalled();
|
||||
expect(mockedApi.put).toHaveBeenCalledTimes(1);
|
||||
|
||||
mockedApi.put.mockResolvedValueOnce({ data: undefined } as any);
|
||||
fireEvent.click(screen.getByRole("button", { name: copy("assetsSaveDrafts") }));
|
||||
await waitFor(() => expect(onSavedB).toHaveBeenCalledTimes(1));
|
||||
expect(mockedApi.put).toHaveBeenLastCalledWith("/jobapplications/8/application-drafts", {
|
||||
applicationAnswerDraft: "Unsaved B answer", recruiterMessageDraft: "Unsaved B message",
|
||||
});
|
||||
expect(onSavedA).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import React from "react";
|
||||
import "@testing-library/jest-dom";
|
||||
import { fireEvent, render, screen, waitFor, within } from "@testing-library/react";
|
||||
import { act, fireEvent, render, screen, waitFor, within } from "@testing-library/react";
|
||||
import { createMemoryRouter, RouterProvider, Route, Routes, useLocation } from "react-router-dom";
|
||||
|
||||
import { api } from "./api";
|
||||
@@ -27,7 +27,7 @@ jest.mock("./components/ApplicationAssets", () => ({
|
||||
</div>
|
||||
),
|
||||
ApplicationCvSection: () => <div>CV section</div>,
|
||||
ApplicationPackageDraftsSection: ({ onDirtyChange }: { onDirtyChange?: (dirty: boolean) => void }) => <div>Application drafts section<button onClick={() => onDirtyChange?.(true)}>Make answers dirty</button></div>,
|
||||
ApplicationPackageDraftsSection: ({ jobId, initialApplicationAnswer, initialRecruiterMessage, onDirtyChange }: { jobId: number; initialApplicationAnswer: string; initialRecruiterMessage: string; onDirtyChange?: (dirty: boolean) => void }) => <div>Application drafts section<output data-testid="answer-props">{jobId}|{initialApplicationAnswer}|{initialRecruiterMessage}</output><button onClick={() => onDirtyChange?.(true)}>Make answers dirty</button></div>,
|
||||
SubmittedPackagesSection: () => <div>Frozen packages section</div>,
|
||||
}));
|
||||
jest.mock("./components/InterviewPrep", () => ({ ApplicationInterviewPrep: () => <div>Interview section</div> }));
|
||||
@@ -136,7 +136,7 @@ function renderTable(path = "/jobs") {
|
||||
},
|
||||
], { initialEntries: [path] });
|
||||
|
||||
return render(
|
||||
const mounted = render(
|
||||
<ToastProvider>
|
||||
<I18nProvider>
|
||||
<ConfirmProvider>
|
||||
@@ -147,6 +147,7 @@ function renderTable(path = "/jobs") {
|
||||
</I18nProvider>
|
||||
</ToastProvider>,
|
||||
);
|
||||
return { ...mounted, router };
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
@@ -383,3 +384,30 @@ test("legacy correspondence and notes reveal distinct domain content", async ()
|
||||
expect(screen.queryByText("Application drafts section")).not.toBeInTheDocument();
|
||||
expect(screen.getByTestId("location")).toHaveTextContent("followMode=waiting-update");
|
||||
});
|
||||
|
||||
test("holds answers until their aggregate matches the route and ignores a late previous-job aggregate", async () => {
|
||||
let resolveB!: (value: any) => void;
|
||||
let resolveC!: (value: any) => void;
|
||||
const heldB = new Promise<any>((resolve) => { resolveB = resolve; });
|
||||
const heldC = new Promise<any>((resolve) => { resolveC = resolve; });
|
||||
const originalGet = mockedApi.get.getMockImplementation()!;
|
||||
mockedApi.get.mockImplementation((url: string, ...rest: any[]) => {
|
||||
if (url === "/jobapplications/43/workspace") return heldB;
|
||||
if (url === "/jobapplications/44/workspace") return heldC;
|
||||
return originalGet(url, ...rest);
|
||||
});
|
||||
const { router } = renderTable("/jobs/42?section=application&sub=answers");
|
||||
expect(await screen.findByTestId("answer-props")).toHaveTextContent("42|Saved answer|Saved recruiter message");
|
||||
await act(async () => { await router.navigate("/jobs/43?section=application&sub=answers"); });
|
||||
await waitFor(() => expect(mockedApi.get).toHaveBeenCalledWith("/jobapplications/43/workspace"));
|
||||
expect(screen.queryByTestId("answer-props")).not.toBeInTheDocument();
|
||||
await act(async () => { await router.navigate("/jobs/44?section=application&sub=answers"); });
|
||||
expect(screen.queryByTestId("answer-props")).not.toBeInTheDocument();
|
||||
await act(async () => { resolveC({ data: { ...overview, id: 44, jobTitle: "Job C", applicationAnswerDraft: "C answer", recruiterMessageDraft: "C message" } }); await heldC; });
|
||||
expect(await screen.findByTestId("answer-props")).toHaveTextContent("44|C answer|C message");
|
||||
await act(async () => { resolveB({ data: { ...overview, id: 43, jobTitle: "Late Job B", applicationAnswerDraft: "B answer", recruiterMessageDraft: "B message" } }); await heldB; });
|
||||
expect(screen.getByTestId("answer-props")).toHaveTextContent("44|C answer|C message");
|
||||
expect(screen.getByRole("heading", { name: "Job C" })).toBeInTheDocument();
|
||||
expect(mockedApi.post).not.toHaveBeenCalled();
|
||||
expect(mockedApi.put).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
@@ -19,6 +19,9 @@ import { cvBuilderApi } from "../cvBuilder";
|
||||
import { aiWorkspaceApi } from "../aiWorkspace";
|
||||
import { useAccountPlan } from "../accountPlan";
|
||||
import { useI18n } from "../i18n/I18nProvider";
|
||||
import type { TranslationKey } from "../i18n/translations";
|
||||
import type { ViewResourceError } from "../hooks/useViewResource";
|
||||
import { useConfirm } from "../confirm";
|
||||
import { PageSection } from "../layout/PageLayout";
|
||||
import ViewStateNotice from "./ViewStateNotice";
|
||||
import { extractApplicationAnswerDraft, removeApplicationAnswerDraft } from "../applicationDrafts";
|
||||
@@ -30,52 +33,75 @@ import { extractApplicationAnswerDraft, removeApplicationAnswerDraft } from "../
|
||||
// application uses and links out. The cover letter is the one thing genuinely owned here, because it
|
||||
// is application-specific by nature. docs/architecture/overview.md.
|
||||
|
||||
type AssetError = ViewResourceError & { messageKey: TranslationKey; retry?: () => Promise<void> };
|
||||
|
||||
function assetError(error: unknown, messageKey: TranslationKey, retryable = false): AssetError {
|
||||
const status = (error as { response?: { status?: number } })?.response?.status;
|
||||
const unauthorized = status === 401 || status === 403;
|
||||
return { kind: unauthorized ? "unauthorized" : "error", message: getApiErrorMessage(error, ""), messageKey, retryable: retryable && !unauthorized, status };
|
||||
}
|
||||
|
||||
function useAsset<T>(load: () => Promise<T>, deps: React.DependencyList) {
|
||||
const { t } = useI18n();
|
||||
const [data, setData] = useState<T | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [error, setError] = useState<AssetError | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const request = useRef(0);
|
||||
const pending = useRef(false);
|
||||
const active = useRef(true);
|
||||
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
const run = useCallback(load, deps);
|
||||
|
||||
const reload = useCallback(() => {
|
||||
let cancelled = false;
|
||||
const reload = useCallback(async () => {
|
||||
if (pending.current) return;
|
||||
pending.current = true;
|
||||
const current = ++request.current;
|
||||
setLoading(true);
|
||||
run()
|
||||
.then((r) => {
|
||||
if (!cancelled) {
|
||||
setData(r);
|
||||
setError(null);
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
if (!cancelled) setError(getApiErrorMessage(err, t("assetsLoadFailed")));
|
||||
})
|
||||
.finally(() => {
|
||||
if (!cancelled) setLoading(false);
|
||||
});
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [run, t]);
|
||||
try {
|
||||
const next = await run();
|
||||
if (current !== request.current) return;
|
||||
setData(next);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
if (current === request.current) setError(assetError(err, "assetsLoadFailed", true));
|
||||
} finally {
|
||||
if (current === request.current) { pending.current = false; setLoading(false); }
|
||||
}
|
||||
}, [run]);
|
||||
|
||||
useEffect(() => reload(), [reload]);
|
||||
useEffect(() => {
|
||||
active.current = true;
|
||||
setData(null);
|
||||
setError(null);
|
||||
pending.current = false;
|
||||
void reload();
|
||||
return () => { active.current = false; request.current += 1; pending.current = false; };
|
||||
}, [reload]);
|
||||
|
||||
return { data, error, loading, setData, setError, reload };
|
||||
return { data, error, loading, setData, setError, reload, isCurrent: () => active.current };
|
||||
}
|
||||
|
||||
function Shell({ title, subtitle, loading, error, children }: {
|
||||
function Shell({ title, subtitle, loading, error, available = true, onRetry, contentRef, children }: {
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
loading: boolean;
|
||||
error: string | null;
|
||||
error: AssetError | null;
|
||||
available?: boolean;
|
||||
onRetry?: () => void | Promise<void>;
|
||||
contentRef?: React.RefObject<HTMLDivElement | null>;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const { t } = useI18n();
|
||||
const localRef = useRef<HTMLDivElement>(null);
|
||||
const bodyRef = contentRef ?? localRef;
|
||||
const retry = error?.retry ?? onRetry;
|
||||
return (
|
||||
<PageSection surface title={title} description={subtitle} level="h3">
|
||||
<ViewStateNotice title={title} loading={loading} error={error ? { kind: "error", message: error, retryable: false } : null} compact />
|
||||
{!loading && !error && children}
|
||||
<Box ref={bodyRef} role="group" aria-label={title} tabIndex={-1} sx={{ minWidth: 0 }}>
|
||||
<ViewStateNotice title={title} loading={loading} error={error ? { ...error, message: error.message || t(error.messageKey) } : null}
|
||||
onRetry={retry ? () => { bodyRef.current?.focus(); return retry(); } : undefined} compact />
|
||||
{available && error?.kind !== "unauthorized" && children}
|
||||
</Box>
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
@@ -84,20 +110,29 @@ function Shell({ title, subtitle, loading, error, children }: {
|
||||
|
||||
export function ApplicationCvSection({ jobId, includePackages = true }: { jobId: number; includePackages?: boolean }) {
|
||||
const { t } = useI18n();
|
||||
const { data, error, loading, setData, setError } = useAsset<ApplicationCv>(
|
||||
const { data, error, loading, setData, setError, reload, isCurrent } = useAsset<ApplicationCv>(
|
||||
() => applicationAssetsApi.cv(jobId),
|
||||
[jobId],
|
||||
);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const busyRef = useRef(false);
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
const [createdCopy, setCreatedCopy] = useState<number | null>(null);
|
||||
|
||||
const attach = async (variantId: number | null) => {
|
||||
if (busyRef.current || loading || !data) return;
|
||||
busyRef.current = true;
|
||||
contentRef.current?.focus();
|
||||
setBusy(true);
|
||||
try {
|
||||
setData(await applicationAssetsApi.attachVariant(jobId, variantId));
|
||||
const next = await applicationAssetsApi.attachVariant(jobId, variantId);
|
||||
if (!isCurrent()) return;
|
||||
setData(next);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError(getApiErrorMessage(err, t("assetsAttachCvFailed")));
|
||||
if (isCurrent()) setError(assetError(err, "assetsAttachCvFailed"));
|
||||
} finally {
|
||||
busyRef.current = false;
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
@@ -105,15 +140,24 @@ export function ApplicationCvSection({ jobId, includePackages = true }: { jobId:
|
||||
const attached = data?.attachedVariantId ?? "";
|
||||
|
||||
const duplicateForJob = async () => {
|
||||
if (!data?.attachedVariantId) return;
|
||||
if (busyRef.current || loading || !data?.attachedVariantId) return;
|
||||
busyRef.current = true;
|
||||
contentRef.current?.focus();
|
||||
setBusy(true);
|
||||
let copyId = createdCopy;
|
||||
try {
|
||||
const copy = await cvBuilderApi.duplicate(data.attachedVariantId, t("assetsTailoredCopyName", { name: data.attachedVariantName || "CV" }));
|
||||
setData(await applicationAssetsApi.attachVariant(jobId, copy.id));
|
||||
window.location.assign(`/career/builder/${copy.id}`);
|
||||
copyId ??= (await cvBuilderApi.duplicate(data.attachedVariantId, t("assetsTailoredCopyName", { name: data.attachedVariantName || "CV" }))).id;
|
||||
if (!isCurrent()) return;
|
||||
setCreatedCopy(copyId);
|
||||
const next = await applicationAssetsApi.attachVariant(jobId, copyId);
|
||||
if (!isCurrent()) return;
|
||||
setData(next);
|
||||
setCreatedCopy(null);
|
||||
window.location.assign(`/career/builder/${copyId}`);
|
||||
} catch (err) {
|
||||
setError(getApiErrorMessage(err, t("assetsDuplicateCvFailed")));
|
||||
if (isCurrent()) setError(assetError(err, copyId ? "assetsAttachCvFailed" : "assetsDuplicateCvFailed"));
|
||||
} finally {
|
||||
busyRef.current = false;
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
@@ -123,8 +167,11 @@ export function ApplicationCvSection({ jobId, includePackages = true }: { jobId:
|
||||
<Shell
|
||||
title={t("workspaceCv")}
|
||||
subtitle={t("assetsCvSubtitle")}
|
||||
loading={loading}
|
||||
loading={loading || busy}
|
||||
error={error}
|
||||
available={data !== null}
|
||||
onRetry={reload}
|
||||
contentRef={contentRef}
|
||||
>
|
||||
<Stack spacing={2}>
|
||||
{(data?.availableVariants.length ?? 0) === 0 ? (
|
||||
@@ -138,7 +185,7 @@ export function ApplicationCvSection({ jobId, includePackages = true }: { jobId:
|
||||
fullWidth
|
||||
label={t("assetsAttachedCv")}
|
||||
value={attached}
|
||||
disabled={busy}
|
||||
disabled={busy || loading}
|
||||
onChange={(e) => attach(e.target.value === "" ? null : Number(e.target.value))}
|
||||
helperText={t("assetsAttachedCvHelp")}
|
||||
>
|
||||
@@ -172,8 +219,8 @@ export function ApplicationCvSection({ jobId, includePackages = true }: { jobId:
|
||||
>
|
||||
{t("assetsEditPreviewExport")}
|
||||
</Button>
|
||||
<Button size="small" variant="contained" disabled={busy} onClick={() => void duplicateForJob()}>
|
||||
{t("assetsDuplicateForJob")}
|
||||
<Button size="small" variant="contained" disabled={busy || loading} onClick={() => void duplicateForJob()}>
|
||||
{t(createdCopy ? "assetsAttachCreatedCopy" : "assetsDuplicateForJob")}
|
||||
</Button>
|
||||
</Stack>
|
||||
</Stack>
|
||||
@@ -189,6 +236,7 @@ export function ApplicationCvSection({ jobId, includePackages = true }: { jobId:
|
||||
{t("assetsLegacyCvText")}
|
||||
</Alert>
|
||||
)}
|
||||
{createdCopy && <Alert severity="info">{t("assetsCopyCreatedHelp")}</Alert>}
|
||||
</Stack>
|
||||
</Shell>
|
||||
|
||||
@@ -202,49 +250,73 @@ export function SubmittedPackagesSection({ jobId, allowCapture = true }: { jobId
|
||||
const titleId = useId();
|
||||
const viewTrigger = useRef<HTMLButtonElement | null>(null);
|
||||
const { language, t } = useI18n();
|
||||
const { data, error, loading, setData, setError } = useAsset<SubmittedPackage[]>(
|
||||
const { data, error, loading, setData, setError, reload, isCurrent } = useAsset<SubmittedPackage[]>(
|
||||
() => applicationAssetsApi.submittedPackages(jobId),
|
||||
[jobId],
|
||||
);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [detail, setDetail] = useState<SubmittedPackageDetail | null>(null);
|
||||
const [detailBusy, setDetailBusy] = useState(false);
|
||||
const [downloadBusy, setDownloadBusy] = useState(false);
|
||||
const operation = useRef(false);
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
const pending = busy || detailBusy || downloadBusy || loading;
|
||||
|
||||
const capture = async () => {
|
||||
if (operation.current || loading || !data) return;
|
||||
operation.current = true;
|
||||
contentRef.current?.focus();
|
||||
setBusy(true);
|
||||
try {
|
||||
const created = await applicationAssetsApi.captureSubmittedPackage(jobId);
|
||||
if (!isCurrent()) return;
|
||||
setData([created, ...(data ?? [])]);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError(getApiErrorMessage(err, t("assetsPackageCaptureFailed")));
|
||||
if (isCurrent()) setError(assetError(err, "assetsPackageCaptureFailed"));
|
||||
} finally {
|
||||
operation.current = false;
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const download = async (item: SubmittedPackage, attachment: SubmittedPackage["attachments"][number]) => {
|
||||
if (operation.current || loading || !data) return;
|
||||
operation.current = true;
|
||||
contentRef.current?.focus();
|
||||
setDownloadBusy(true);
|
||||
try {
|
||||
const blob = await applicationAssetsApi.downloadSubmittedAttachment(jobId, item.id, attachment.id);
|
||||
if (!isCurrent()) return;
|
||||
const url = URL.createObjectURL(blob);
|
||||
const anchor = document.createElement("a");
|
||||
anchor.href = url;
|
||||
anchor.download = attachment.fileName;
|
||||
anchor.click();
|
||||
URL.revokeObjectURL(url);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError(getApiErrorMessage(err, t("assetsPackageDownloadFailed")));
|
||||
if (isCurrent()) setError({ ...assetError(err, "assetsPackageDownloadFailed", true), retry: () => download(item, attachment) });
|
||||
} finally {
|
||||
operation.current = false;
|
||||
setDownloadBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const view = async (item: SubmittedPackage) => {
|
||||
if (operation.current || loading || !data) return;
|
||||
operation.current = true;
|
||||
contentRef.current?.focus();
|
||||
setDetailBusy(true);
|
||||
try {
|
||||
setDetail(await applicationAssetsApi.submittedPackage(jobId, item.id));
|
||||
const next = await applicationAssetsApi.submittedPackage(jobId, item.id);
|
||||
if (!isCurrent()) return;
|
||||
setDetail(next);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError(getApiErrorMessage(err, t("assetsPackageLoadFailed")));
|
||||
if (isCurrent()) setError({ ...assetError(err, "assetsPackageLoadFailed", true), retry: () => view(item) });
|
||||
} finally {
|
||||
operation.current = false;
|
||||
setDetailBusy(false);
|
||||
}
|
||||
};
|
||||
@@ -255,9 +327,9 @@ export function SubmittedPackagesSection({ jobId, allowCapture = true }: { jobId
|
||||
})();
|
||||
|
||||
return (
|
||||
<Shell title={t("assetsSubmittedPackages")} subtitle={t("assetsSubmittedPackagesSubtitle")} loading={loading} error={error}>
|
||||
<Shell title={t("assetsSubmittedPackages")} subtitle={t("assetsSubmittedPackagesSubtitle")} loading={pending} error={error} available={data !== null} onRetry={reload} contentRef={contentRef}>
|
||||
<Stack spacing={1.5}>
|
||||
{allowCapture && <Button variant="contained" startIcon={<ArchiveOutlinedIcon />} disabled={busy} onClick={() => void capture()} sx={{ alignSelf: "flex-start" }}>
|
||||
{allowCapture && <Button variant="contained" startIcon={<ArchiveOutlinedIcon />} disabled={pending} onClick={() => void capture()} sx={{ alignSelf: "flex-start" }}>
|
||||
{busy ? t("assetsPackageCapturing") : t("assetsPackageCapture")}
|
||||
</Button>}
|
||||
{(data?.length ?? 0) === 0 ? (
|
||||
@@ -277,11 +349,11 @@ export function SubmittedPackagesSection({ jobId, allowCapture = true }: { jobId
|
||||
<Chip size="small" variant="outlined" color={item.hasCoverLetter ? "success" : "default"} label={item.hasCoverLetter ? t("workspaceCoverLetter") : t("assetsPackageNoCoverLetter")} />
|
||||
</Stack>
|
||||
</Stack>
|
||||
<Button size="small" variant="outlined" disabled={detailBusy} onClick={(event) => { viewTrigger.current = event.currentTarget; void view(item); }} sx={{ alignSelf: "flex-start" }}>
|
||||
<Button size="small" variant="outlined" disabled={pending} onClick={(event) => { viewTrigger.current = event.currentTarget; void view(item); }} sx={{ alignSelf: "flex-start" }}>
|
||||
{t("assetsPackageView")}
|
||||
</Button>
|
||||
{item.attachments.map((attachment) => (
|
||||
<Button key={attachment.id} size="small" variant="text" startIcon={<DownloadOutlinedIcon />} onClick={() => void download(item, attachment)} sx={{ alignSelf: "flex-start", maxWidth: "100%", overflowWrap: "anywhere", textAlign: "left" }}>
|
||||
<Button key={attachment.id} size="small" variant="text" disabled={pending} startIcon={<DownloadOutlinedIcon />} onClick={() => void download(item, attachment)} sx={{ alignSelf: "flex-start", maxWidth: "100%", overflowWrap: "anywhere", textAlign: "left" }}>
|
||||
{attachment.fileName} · {(attachment.fileSize / 1024).toFixed(1)} KB
|
||||
</Button>
|
||||
))}
|
||||
@@ -293,25 +365,25 @@ export function SubmittedPackagesSection({ jobId, allowCapture = true }: { jobId
|
||||
<DialogTitle id={titleId}>
|
||||
{detail ? t("assetsSubmittedPackageVersion", { version: detail.summary.version }) : t("assetsSubmittedPackages")}
|
||||
</DialogTitle>
|
||||
<DialogContent dividers>
|
||||
<DialogContent dividers role="region" tabIndex={0} aria-labelledby={titleId}>
|
||||
<Alert severity="info" sx={{ mb: 2 }}>{t("workspaceFrozenHelp")}</Alert>
|
||||
<Stack spacing={2.5}>
|
||||
{detail?.renderedCvHtml ? (
|
||||
<Box>
|
||||
<Typography variant="subtitle2" gutterBottom>{t("workspaceCv")}</Typography>
|
||||
<Typography component="h3" variant="subtitle2" gutterBottom>{t("workspaceCv")}</Typography>
|
||||
<Typography variant="body2" color="text.secondary" sx={{ mb: 1, overflowWrap: "anywhere" }}>{detail.summary.cvVariantName} · {t("assetsThemeVersion", { theme: detail.summary.cvThemeId ?? "—", version: detail.summary.cvVariantVersion ?? "—" })}</Typography>
|
||||
<Box component="iframe" title={t("assetsPackageCvPreview")} srcDoc={detail.renderedCvHtml} sandbox="" sx={{ width: "100%", height: { xs: 520, md: 760 }, border: 1, borderColor: "divider", bgcolor: "white" }} />
|
||||
</Box>
|
||||
) : <Alert severity="info">{t("assetsPackageNoCv")}</Alert>}
|
||||
<Box>
|
||||
<Typography variant="subtitle2" gutterBottom>{t("workspaceCoverLetter")}</Typography>
|
||||
<Typography component="h3" variant="subtitle2" gutterBottom>{t("workspaceCoverLetter")}</Typography>
|
||||
<Typography variant="body2" sx={{ whiteSpace: "pre-wrap", overflowWrap: "anywhere" }}>
|
||||
{detail?.coverLetterText || t("assetsPackageNoCoverLetter")}
|
||||
</Typography>
|
||||
</Box>
|
||||
{material && ["TailoredCvText", "RecruiterMessageDraft"].map((key) => typeof material[key] === "string" && material[key] ? (
|
||||
<Box key={key}>
|
||||
<Typography variant="subtitle2">{t(`assetsPackage${key}` as "assetsPackageTailoredCvText")}</Typography>
|
||||
<Typography component="h3" variant="subtitle2">{t(`assetsPackage${key}` as "assetsPackageTailoredCvText")}</Typography>
|
||||
<Typography variant="body2" sx={{ whiteSpace: "pre-wrap", overflowWrap: "anywhere" }}>{String(material[key])}</Typography>
|
||||
</Box>
|
||||
) : null)}
|
||||
@@ -319,7 +391,7 @@ export function SubmittedPackagesSection({ jobId, allowCapture = true }: { jobId
|
||||
[t("workspaceNotes"), removeApplicationAnswerDraft(material.Notes)],
|
||||
[t("assetsApplicationAnswer"), extractApplicationAnswerDraft(material.Notes)],
|
||||
].map(([label, content]) => content ? <Box key={label}>
|
||||
<Typography variant="subtitle2">{label}</Typography>
|
||||
<Typography component="h3" variant="subtitle2">{label}</Typography>
|
||||
<Typography variant="body2" sx={{ whiteSpace: "pre-wrap", overflowWrap: "anywhere" }}>{content}</Typography>
|
||||
</Box> : null)}
|
||||
</Stack>
|
||||
@@ -334,7 +406,7 @@ export function SubmittedPackagesSection({ jobId, allowCapture = true }: { jobId
|
||||
|
||||
export function ApplicationTailoringSection({ jobId }: { jobId: number }) {
|
||||
const { t } = useI18n();
|
||||
const { data, error, loading } = useAsset<TailoringPlan>(
|
||||
const { data, error, loading, reload } = useAsset<TailoringPlan>(
|
||||
() => applicationAssetsApi.tailoring(jobId),
|
||||
[jobId],
|
||||
);
|
||||
@@ -345,6 +417,8 @@ export function ApplicationTailoringSection({ jobId }: { jobId: number }) {
|
||||
subtitle={t("assetsTailoringSubtitle")}
|
||||
loading={loading}
|
||||
error={error}
|
||||
available={data !== null}
|
||||
onRetry={reload}
|
||||
>
|
||||
<Stack spacing={2}>
|
||||
{data && !data.hasCareerProfile && (
|
||||
@@ -413,13 +487,17 @@ Med vennlig hilsen
|
||||
|
||||
export function ApplicationCoverLetterSection({ jobId, onDirtyChange }: { jobId: number; onDirtyChange?: (dirty: boolean) => void }) {
|
||||
const { language, t } = useI18n();
|
||||
const { data, error, loading, setData, setError } = useAsset<CoverLetter>(
|
||||
const { confirm } = useConfirm();
|
||||
const { data, error, loading, setData, setError, reload, isCurrent } = useAsset<CoverLetter>(
|
||||
() => applicationAssetsApi.coverLetter(jobId),
|
||||
[jobId],
|
||||
);
|
||||
const [draft, setDraft] = useState<string | null>(null);
|
||||
const [draftAiAction, setDraftAiAction] = useState<string | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [confirming, setConfirming] = useState(false);
|
||||
const busyRef = useRef(false);
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
// The textarea is only seeded from the server until the user starts typing, so a reload never
|
||||
// clobbers unsaved edits.
|
||||
@@ -432,30 +510,53 @@ export function ApplicationCoverLetterSection({ jobId, onDirtyChange }: { jobId:
|
||||
}, [dirty, onDirtyChange]);
|
||||
|
||||
const save = async (value: string, source = "manual", aiAction?: string) => {
|
||||
if (busyRef.current || loading || !data) return;
|
||||
busyRef.current = true;
|
||||
contentRef.current?.focus();
|
||||
setBusy(true);
|
||||
try {
|
||||
setData(await applicationAssetsApi.saveCoverLetter(jobId, value, source, aiAction));
|
||||
const next = await applicationAssetsApi.saveCoverLetter(jobId, value, source, aiAction);
|
||||
if (!isCurrent()) return;
|
||||
setData(next);
|
||||
setDraft(null);
|
||||
setDraftAiAction(null);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError(getApiErrorMessage(err, t("assetsCoverSaveFailed")));
|
||||
if (isCurrent()) setError(assetError(err, "assetsCoverSaveFailed"));
|
||||
} finally {
|
||||
busyRef.current = false;
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
|
||||
const restore = async (version: number) => {
|
||||
setBusy(true);
|
||||
if (busyRef.current || loading || !data) return;
|
||||
busyRef.current = true;
|
||||
try {
|
||||
setData(await applicationAssetsApi.restoreCoverLetter(jobId, version));
|
||||
if (dirty) {
|
||||
setConfirming(true);
|
||||
const accepted = await confirm({
|
||||
title: t("assetsRestoreDiscardTitle"), message: t("assetsRestoreDiscardMessage"),
|
||||
confirmLabel: t("assetsRestoreConfirm"), cancelLabel: t("cancel"), destructive: true,
|
||||
});
|
||||
setConfirming(false);
|
||||
if (!accepted) return;
|
||||
}
|
||||
if (!isCurrent()) return;
|
||||
contentRef.current?.focus();
|
||||
setBusy(true);
|
||||
const next = await applicationAssetsApi.restoreCoverLetter(jobId, version);
|
||||
if (!isCurrent()) return;
|
||||
setData(next);
|
||||
setDraft(null);
|
||||
setDraftAiAction(null);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError(getApiErrorMessage(err, t("assetsCoverRestoreFailed")));
|
||||
if (isCurrent()) setError(assetError(err, "assetsCoverRestoreFailed"));
|
||||
} finally {
|
||||
busyRef.current = false;
|
||||
setBusy(false);
|
||||
setConfirming(false);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -464,28 +565,31 @@ export function ApplicationCoverLetterSection({ jobId, onDirtyChange }: { jobId:
|
||||
<Shell
|
||||
title={t("workspaceCoverLetter")}
|
||||
subtitle={t("assetsCoverSubtitle")}
|
||||
loading={loading}
|
||||
loading={loading || busy}
|
||||
error={error}
|
||||
available={data !== null}
|
||||
onRetry={reload}
|
||||
contentRef={contentRef}
|
||||
>
|
||||
<Stack spacing={2}>
|
||||
<RichTextField
|
||||
minRows={12}
|
||||
label={t("jobDetailsCoverLetter")}
|
||||
value={text}
|
||||
disabled={busy}
|
||||
disabled={busy || confirming || loading}
|
||||
onChange={setDraft}
|
||||
placeholder={t("assetsCoverPlaceholder")}
|
||||
/>
|
||||
|
||||
<Stack direction="row" spacing={1} flexWrap="wrap" useFlexGap>
|
||||
<Button variant="contained" disabled={busy || !dirty} onClick={() => save(text, draftAiAction ? "ai" : "manual", draftAiAction ?? undefined)}>
|
||||
<Button variant="contained" disabled={busy || confirming || loading || !dirty} onClick={() => save(text, draftAiAction ? "ai" : "manual", draftAiAction ?? undefined)}>
|
||||
{t("save")}
|
||||
</Button>
|
||||
<Button disabled={busy || !dirty} onClick={() => { setDraft(null); setDraftAiAction(null); }}>
|
||||
<Button disabled={busy || confirming || loading || !dirty} onClick={() => { setDraft(null); setDraftAiAction(null); }}>
|
||||
{t("assetsDiscardChanges")}
|
||||
</Button>
|
||||
<Button
|
||||
disabled={busy || text.trim().length > 0}
|
||||
disabled={busy || confirming || loading || text.trim().length > 0}
|
||||
onClick={() => setDraft(COVER_LETTER_TEMPLATES[language])}
|
||||
>
|
||||
{t("assetsStartTemplate")}
|
||||
@@ -500,10 +604,11 @@ export function ApplicationCoverLetterSection({ jobId, onDirtyChange }: { jobId:
|
||||
<CoverLetterAiAssistant
|
||||
jobId={jobId}
|
||||
currentText={text}
|
||||
onApply={(value, aiAction) => { setDraft(value); setDraftAiAction(aiAction); }}
|
||||
disabled={busy || confirming || loading || !data}
|
||||
onApply={(value, aiAction) => { if (!busyRef.current && !loading && data) { setDraft(value); setDraftAiAction(aiAction); } }}
|
||||
/>
|
||||
|
||||
<Shell title={t("assetsVersionHistory")} loading={loading} error={null}>
|
||||
<Shell title={t("assetsVersionHistory")} loading={loading} error={null} available={data !== null}>
|
||||
{(data?.versions.length ?? 0) === 0 ? (
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("assetsNoVersions")}
|
||||
@@ -529,11 +634,11 @@ export function ApplicationCoverLetterSection({ jobId, onDirtyChange }: { jobId:
|
||||
</Typography>
|
||||
</Box>
|
||||
{!v.isCurrent && (
|
||||
<Tooltip title={t("assetsRestoreVersion")}>
|
||||
<Tooltip describeChild title={t("assetsRestoreVersion")}>
|
||||
<span>
|
||||
<IconButton
|
||||
size="small"
|
||||
disabled={busy}
|
||||
disabled={busy || loading}
|
||||
aria-label={t("assetsRestoreVersionNumber", { version: v.version })}
|
||||
onClick={() => restore(v.version)}
|
||||
>
|
||||
@@ -563,20 +668,25 @@ const COVER_LETTER_ACTIONS = [
|
||||
{ key: "tailor", labelKey: "coverActionTailor" },
|
||||
] as const;
|
||||
|
||||
function CoverLetterAiAssistant({ jobId, currentText, onApply }: { jobId: number; currentText: string; onApply: (text: string, action: string) => void }) {
|
||||
function CoverLetterAiAssistant({ jobId, currentText, disabled, onApply }: { jobId: number; currentText: string; disabled: boolean; onApply: (text: string, action: string) => void }) {
|
||||
const labelId = useId();
|
||||
const { canUseAi } = useAccountPlan();
|
||||
const { language: uiLanguage, t } = useI18n();
|
||||
const { data: cv, loading: loadingCv } = useAsset<ApplicationCv>(() => applicationAssetsApi.cv(jobId), [jobId]);
|
||||
const { data: cv, error: cvError, loading: loadingCv, reload, isCurrent } = useAsset<ApplicationCv>(() => applicationAssetsApi.cv(jobId), [jobId]);
|
||||
const [action, setAction] = useState("generate");
|
||||
const [mode, setMode] = useState("professional");
|
||||
const [language, setLanguage] = useState<"en" | "nb-NO">(() => uiLanguage === "nb" ? "nb-NO" : "en");
|
||||
const [instructions, setInstructions] = useState("");
|
||||
const [suggestion, setSuggestion] = useState("");
|
||||
const [suggestion, setSuggestion] = useState<{ text: string; action: string } | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [error, setError] = useState<AssetError | null>(null);
|
||||
const busyRef = useRef(false);
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const generate = async () => {
|
||||
if (busyRef.current || disabled || loadingCv || !canUseAi || !cv?.attachedVariantId) return;
|
||||
busyRef.current = true;
|
||||
contentRef.current?.focus();
|
||||
setBusy(true);
|
||||
setError(null);
|
||||
try {
|
||||
@@ -588,10 +698,13 @@ function CoverLetterAiAssistant({ jobId, currentText, onApply }: { jobId: number
|
||||
currentText: currentText.trim() || undefined,
|
||||
extraContext: instructions.trim() || undefined,
|
||||
});
|
||||
setSuggestion(result.result.text?.trim() ?? "");
|
||||
if (!isCurrent()) return;
|
||||
const text = result.result.text?.trim() ?? "";
|
||||
setSuggestion(text ? { text, action } : null);
|
||||
} catch (err) {
|
||||
setError(getApiErrorMessage(err, t("coverAiGenerateFailed")));
|
||||
if (isCurrent()) setError(assetError(err, "coverAiGenerateFailed"));
|
||||
} finally {
|
||||
busyRef.current = false;
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
@@ -601,8 +714,11 @@ function CoverLetterAiAssistant({ jobId, currentText, onApply }: { jobId: number
|
||||
<Shell
|
||||
title={t("coverAiTitle")}
|
||||
subtitle={t("coverAiSubtitle")}
|
||||
loading={loadingCv}
|
||||
error={null}
|
||||
loading={loadingCv || busy}
|
||||
error={cvError}
|
||||
available={cv !== null}
|
||||
onRetry={reload}
|
||||
contentRef={contentRef}
|
||||
>
|
||||
<Stack spacing={2}>
|
||||
{!hasCv ? (
|
||||
@@ -615,13 +731,13 @@ function CoverLetterAiAssistant({ jobId, currentText, onApply }: { jobId: number
|
||||
<Stack direction={{ xs: "column", sm: "row" }} spacing={1.5}>
|
||||
<FormControl size="small" sx={{ minWidth: 180 }}>
|
||||
<InputLabel id={`${labelId}-coverAiAction`}>{t("coverAiAction")}</InputLabel>
|
||||
<Select labelId={`${labelId}-coverAiAction`} label={t("coverAiAction")} value={action} onChange={(event) => setAction(event.target.value)}>
|
||||
<Select disabled={busy || disabled || loadingCv} labelId={`${labelId}-coverAiAction`} label={t("coverAiAction")} value={action} onChange={(event) => setAction(event.target.value)}>
|
||||
{COVER_LETTER_ACTIONS.map((item) => <MenuItem key={item.key} value={item.key}>{t(item.labelKey)}</MenuItem>)}
|
||||
</Select>
|
||||
</FormControl>
|
||||
<FormControl size="small" sx={{ minWidth: 160 }}>
|
||||
<InputLabel id={`${labelId}-coverAiTone`}>{t("coverAiTone")}</InputLabel>
|
||||
<Select labelId={`${labelId}-coverAiTone`} label={t("coverAiTone")} value={mode} onChange={(event) => setMode(event.target.value)}>
|
||||
<Select disabled={busy || disabled || loadingCv} labelId={`${labelId}-coverAiTone`} label={t("coverAiTone")} value={mode} onChange={(event) => setMode(event.target.value)}>
|
||||
{[
|
||||
["professional", "coverToneProfessional"], ["friendly", "coverToneFriendly"], ["short", "coverToneShort"],
|
||||
["detailed", "coverToneDetailed"], ["modern", "coverToneModern"], ["traditional", "coverToneTraditional"],
|
||||
@@ -630,7 +746,7 @@ function CoverLetterAiAssistant({ jobId, currentText, onApply }: { jobId: number
|
||||
</FormControl>
|
||||
<FormControl size="small" sx={{ minWidth: 190 }}>
|
||||
<InputLabel id={`${labelId}-coverAiDocumentLanguage`}>{t("coverAiDocumentLanguage")}</InputLabel>
|
||||
<Select labelId={`${labelId}-coverAiDocumentLanguage`} label={t("coverAiDocumentLanguage")} value={language} onChange={(event) => setLanguage(event.target.value as "en" | "nb-NO")}>
|
||||
<Select disabled={busy || disabled || loadingCv} labelId={`${labelId}-coverAiDocumentLanguage`} label={t("coverAiDocumentLanguage")} value={language} onChange={(event) => setLanguage(event.target.value as "en" | "nb-NO")}>
|
||||
<MenuItem value="en">{t("languageEnglish")}</MenuItem>
|
||||
<MenuItem value="nb-NO">{t("languageNorwegianBokmal")}</MenuItem>
|
||||
</Select>
|
||||
@@ -640,16 +756,17 @@ function CoverLetterAiAssistant({ jobId, currentText, onApply }: { jobId: number
|
||||
label={t("coverAiAdditionalInstructions")}
|
||||
placeholder={t("coverAiInstructionsPlaceholder")}
|
||||
value={instructions}
|
||||
disabled={busy || disabled || loadingCv}
|
||||
onChange={(event) => setInstructions(event.target.value)}
|
||||
multiline
|
||||
minRows={2}
|
||||
fullWidth
|
||||
/>
|
||||
{error && <Alert severity="error" action={<Button color="inherit" size="small" onClick={() => void generate()}>{t("retry")}</Button>}>{error}</Alert>}
|
||||
{error && <Alert severity="error" action={<Button color="inherit" size="small" disabled={busy || disabled || loadingCv} onClick={() => void generate()}>{t("retry")}</Button>}>{error.message || t(error.messageKey)}</Alert>}
|
||||
<Button
|
||||
variant="contained"
|
||||
startIcon={<AutoFixHighIcon />}
|
||||
disabled={!canUseAi || !hasCv || busy}
|
||||
disabled={!canUseAi || !hasCv || busy || disabled || loadingCv}
|
||||
onClick={() => void generate()}
|
||||
sx={{ alignSelf: "flex-start" }}
|
||||
>
|
||||
@@ -666,10 +783,10 @@ function CoverLetterAiAssistant({ jobId, currentText, onApply }: { jobId: number
|
||||
</Paper>
|
||||
<Paper variant="outlined" sx={{ p: 2, minWidth: 0, borderColor: "primary.main" }}>
|
||||
<Typography variant="overline" color="primary">{t("coverAiSuggestion")}</Typography>
|
||||
<Typography variant="body2" sx={{ whiteSpace: "pre-wrap", overflowWrap: "anywhere" }}>{suggestion}</Typography>
|
||||
<Typography variant="body2" sx={{ whiteSpace: "pre-wrap", overflowWrap: "anywhere" }}>{suggestion.text}</Typography>
|
||||
<Stack direction="row" spacing={1} sx={{ mt: 2 }}>
|
||||
<Button size="small" variant="contained" onClick={() => { onApply(suggestion, action); setSuggestion(""); }}>{t("coverAiApply")}</Button>
|
||||
<Button size="small" onClick={() => setSuggestion("")}>{t("coverAiReject")}</Button>
|
||||
<Button size="small" variant="contained" disabled={busy || disabled || loadingCv} onClick={() => { if (!busyRef.current && !disabled && !loadingCv) { onApply(suggestion.text, suggestion.action); setSuggestion(null); } }}>{t("coverAiApply")}</Button>
|
||||
<Button size="small" disabled={busy || disabled || loadingCv} onClick={() => setSuggestion(null)}>{t("coverAiReject")}</Button>
|
||||
</Stack>
|
||||
</Paper>
|
||||
</Box>
|
||||
@@ -701,7 +818,11 @@ export function ApplicationPackageDraftsSection({
|
||||
const [saved, setSaved] = useState<PackageDrafts>(initial);
|
||||
const [draft, setDraft] = useState<PackageDrafts | null>(null);
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [error, setError] = useState<AssetError | null>(null);
|
||||
const busyRef = useRef(false);
|
||||
const contentRef = useRef<HTMLDivElement>(null);
|
||||
const active = useRef(true);
|
||||
useEffect(() => { active.current = true; return () => { active.current = false; }; }, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (draft === null) setSaved(initial);
|
||||
@@ -722,16 +843,21 @@ export function ApplicationPackageDraftsSection({
|
||||
const update = (patch: Partial<PackageDrafts>) => setDraft({ ...value, ...patch });
|
||||
|
||||
const save = async () => {
|
||||
if (busyRef.current) return;
|
||||
busyRef.current = true;
|
||||
contentRef.current?.focus();
|
||||
setBusy(true);
|
||||
try {
|
||||
await applicationAssetsApi.saveApplicationDrafts(jobId, value.applicationAnswer, value.recruiterMessage);
|
||||
if (!active.current) return;
|
||||
setSaved(value);
|
||||
setDraft(null);
|
||||
setError(null);
|
||||
onSaved?.();
|
||||
} catch (err) {
|
||||
setError(getApiErrorMessage(err, t("assetsDraftsSaveFailed")));
|
||||
if (active.current) setError(assetError(err, "assetsDraftsSaveFailed"));
|
||||
} finally {
|
||||
busyRef.current = false;
|
||||
setBusy(false);
|
||||
}
|
||||
};
|
||||
@@ -740,8 +866,9 @@ export function ApplicationPackageDraftsSection({
|
||||
<Shell
|
||||
title={t("assetsApplicationDrafts")}
|
||||
subtitle={t("assetsApplicationDraftsSubtitle")}
|
||||
loading={false}
|
||||
loading={busy}
|
||||
error={error}
|
||||
contentRef={contentRef}
|
||||
>
|
||||
<Stack spacing={2}>
|
||||
<RichTextField
|
||||
|
||||
@@ -47,7 +47,7 @@ export default function RichTextField({
|
||||
};
|
||||
|
||||
const btn = (title: string, icon: React.ReactNode, before: string, after: string, ph: string) => (
|
||||
<Tooltip title={title}>
|
||||
<Tooltip title={title} slotProps={{ popper: { sx: { "&[data-popper-reference-hidden]": { visibility: "hidden" } } } }}>
|
||||
<IconButton size="small" disabled={disabled} aria-label={title} onMouseDown={(e) => e.preventDefault()} onClick={() => apply(before, after, ph)}>
|
||||
{icon}
|
||||
</IconButton>
|
||||
|
||||
@@ -508,6 +508,8 @@ export const translations = {
|
||||
assetsPublic: "public",
|
||||
assetsEditPreviewExport: "Edit, preview and export",
|
||||
assetsDuplicateForJob: "Duplicate for this job",
|
||||
assetsAttachCreatedCopy: "Attach created copy",
|
||||
assetsCopyCreatedHelp: "The copy is saved in your CV library. Attach it here to continue editing.",
|
||||
assetsNoCvAttached: "No CV is attached to this application yet.",
|
||||
assetsLegacyCvText: "This application also contains legacy tailored CV text. An attached CV variant takes precedence.",
|
||||
assetsTailoring: "Tailoring",
|
||||
@@ -958,6 +960,9 @@ export const translations = {
|
||||
assetsCharacterCount: "{count} characters",
|
||||
assetsRestoreVersion: "Restore this version",
|
||||
assetsRestoreVersionNumber: "Restore version {version}",
|
||||
assetsRestoreDiscardTitle: "Restore saved version?",
|
||||
assetsRestoreDiscardMessage: "Your unsaved edits will be discarded and replaced with the selected saved version.",
|
||||
assetsRestoreConfirm: "Discard and restore",
|
||||
coverAiAction: "Action",
|
||||
coverAiTone: "Tone",
|
||||
coverActionGenerate: "Generate",
|
||||
@@ -3157,6 +3162,8 @@ export const translations = {
|
||||
assetsPublic: "offentlig",
|
||||
assetsEditPreviewExport: "Rediger, forhåndsvis og eksporter",
|
||||
assetsDuplicateForJob: "Dupliser for denne jobben",
|
||||
assetsAttachCreatedCopy: "Koble til opprettet kopi",
|
||||
assetsCopyCreatedHelp: "Kopien er lagret i CV-biblioteket. Koble den til her for å fortsette redigeringen.",
|
||||
assetsNoCvAttached: "Ingen CV er tilknyttet søknaden ennå.",
|
||||
assetsLegacyCvText: "Søknaden inneholder også eldre tilpasset CV-tekst. En tilknyttet CV-variant har prioritet.",
|
||||
assetsTailoring: "Tilpasning",
|
||||
@@ -3607,6 +3614,9 @@ export const translations = {
|
||||
assetsCharacterCount: "{count} tegn",
|
||||
assetsRestoreVersion: "Gjenopprett denne versjonen",
|
||||
assetsRestoreVersionNumber: "Gjenopprett versjon {version}",
|
||||
assetsRestoreDiscardTitle: "Gjenopprette lagret versjon?",
|
||||
assetsRestoreDiscardMessage: "Endringene du ikke har lagret, blir forkastet og erstattet med den valgte versjonen.",
|
||||
assetsRestoreConfirm: "Forkast og gjenopprett",
|
||||
coverAiAction: "Handling",
|
||||
coverAiTone: "Tone",
|
||||
coverActionGenerate: "Generer",
|
||||
|
||||
@@ -82,7 +82,9 @@ export function ApplicationWorkspace({
|
||||
const secondaryId = useId();
|
||||
const panelRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const [overview, setOverview] = useState<WorkspaceOverview | null>(null);
|
||||
const [loadedOverview, setOverview] = useState<WorkspaceOverview | null>(null);
|
||||
const overview = loadedOverview?.id === jobId ? loadedOverview : null;
|
||||
const overviewRequest = useRef(0);
|
||||
const [error, setError] = useState<ViewResourceError | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [editOpen, setEditOpen] = useState(false);
|
||||
@@ -123,6 +125,7 @@ export function ApplicationWorkspace({
|
||||
}, [blocker, confirm, t]);
|
||||
|
||||
const load = useCallback(async () => {
|
||||
const request = ++overviewRequest.current;
|
||||
if (!Number.isInteger(jobId) || jobId <= 0) {
|
||||
setOverview(null);
|
||||
setError({ kind: "error", message: t("workspaceInvalidLink"), retryable: false });
|
||||
@@ -132,17 +135,20 @@ export function ApplicationWorkspace({
|
||||
try {
|
||||
setError(null);
|
||||
setLoading(true);
|
||||
setOverview(await applicationWorkspaceApi.overview(jobId));
|
||||
const next = await applicationWorkspaceApi.overview(jobId);
|
||||
if (request === overviewRequest.current) setOverview(next);
|
||||
} catch (err) {
|
||||
if (request !== overviewRequest.current) return;
|
||||
const status = (err as { response?: { status?: number } })?.response?.status;
|
||||
setError({ kind: "error", message: getApiErrorMessage(err, t("workspaceLoadFailed")), retryable: !status || status >= 500, status });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
if (request === overviewRequest.current) setLoading(false);
|
||||
}
|
||||
}, [jobId, t]);
|
||||
|
||||
useEffect(() => {
|
||||
load();
|
||||
void load();
|
||||
return () => { overviewRequest.current += 1; };
|
||||
}, [load]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -253,16 +259,17 @@ export function ApplicationWorkspace({
|
||||
{subsections.map((sub) => <Tab key={sub.key} value={sub.key} id={`${secondaryId}-${sub.key}`} aria-controls={`${secondaryId}-panel`} label={sub.label} />)}
|
||||
</Tabs>
|
||||
<Box role="tabpanel" id={`${secondaryId}-panel`} aria-labelledby={`${secondaryId}-${subsection}`} tabIndex={0} sx={{ display: "grid", gap: 2, minWidth: 0 }}>
|
||||
{section === "application" && subsection === "cv" && jobId > 0 && <ApplicationCvSection jobId={jobId} includePackages={false} />}
|
||||
{section === "application" && subsection === "letter" && jobId > 0 && <ApplicationCoverLetterSection jobId={jobId} onDirtyChange={setCoverLetterDirty} />}
|
||||
{section === "application" && subsection === "answers" && jobId > 0 && <ApplicationPackageDraftsSection
|
||||
{section === "application" && subsection === "cv" && jobId > 0 && <ApplicationCvSection key={jobId} jobId={jobId} includePackages={false} />}
|
||||
{section === "application" && subsection === "letter" && jobId > 0 && <ApplicationCoverLetterSection key={jobId} jobId={jobId} onDirtyChange={setCoverLetterDirty} />}
|
||||
{section === "application" && subsection === "answers" && overview && jobId > 0 && <ApplicationPackageDraftsSection
|
||||
key={jobId}
|
||||
jobId={jobId}
|
||||
initialApplicationAnswer={overview?.applicationAnswerDraft ?? ""}
|
||||
initialRecruiterMessage={overview?.recruiterMessageDraft ?? ""}
|
||||
onSaved={load}
|
||||
onDirtyChange={setPackageDraftsDirty}
|
||||
/>}
|
||||
{section === "application" && subsection === "submission" && jobId > 0 && <SubmittedPackagesSection jobId={jobId} />}
|
||||
{section === "application" && subsection === "submission" && jobId > 0 && <SubmittedPackagesSection key={jobId} jobId={jobId} />}
|
||||
{section === "timeline" && subsection === "activity" && jobId > 0 && <ApplicationTimeline jobId={jobId} />}
|
||||
{section === "timeline" && subsection === "correspondence" && jobId > 0 && <PageSection surface title={t("workspaceCommunication")} level="h3"><Correspondence jobId={jobId} jobContext={{ companyName: overview?.company, jobTitle: overview?.jobTitle }} /></PageSection>}
|
||||
</Box>
|
||||
@@ -272,7 +279,7 @@ export function ApplicationWorkspace({
|
||||
<Button onClick={() => go("application", "cv")}>{t("workspaceCv")}</Button>
|
||||
<Button onClick={() => go("application", "letter")}>{t("workspaceCoverLetter")}</Button>
|
||||
</>}><Attachments jobId={jobId} /></PageSection>
|
||||
<SubmittedPackagesSection jobId={jobId} allowCapture={false} />
|
||||
<SubmittedPackagesSection key={jobId} jobId={jobId} allowCapture={false} />
|
||||
</>}
|
||||
{section === "tasks" && jobId > 0 && <>
|
||||
<PageSection surface title={t("workspaceNotes")} actions={<Button startIcon={<EditOutlinedIcon />} onClick={() => setEditOpen(true)}>{t("workspaceEdit")}</Button>}>
|
||||
|
||||
Reference in New Issue
Block a user