Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f2e6a517eb | |||
| 336bc09987 |
@@ -1,521 +0,0 @@
|
||||
{
|
||||
"schema": 1,
|
||||
"purpose": "offline-specification-only",
|
||||
"sourceCommit": "39fb9df06904e44916e258da0ed975dd46b9691c",
|
||||
"baseline": "eb2538772e1bfabbeb291e4a5efa177c79074de1",
|
||||
"nodes": [
|
||||
{
|
||||
"id": "s:GB:county:warwickshire",
|
||||
"country": "GB",
|
||||
"type": "county",
|
||||
"label": "Warwickshire",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
},
|
||||
{
|
||||
"id": "s:GB:town:warwick",
|
||||
"country": "GB",
|
||||
"type": "town",
|
||||
"label": "Warwick",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
},
|
||||
{
|
||||
"id": "s:GB:town:leamington",
|
||||
"country": "GB",
|
||||
"type": "town",
|
||||
"label": "Royal Leamington Spa",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
},
|
||||
{
|
||||
"id": "s:NO:county:vestfold",
|
||||
"country": "NO",
|
||||
"type": "county",
|
||||
"label": "Vestfold",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
},
|
||||
{
|
||||
"id": "s:NO:municipality:tonsberg",
|
||||
"country": "NO",
|
||||
"type": "municipality",
|
||||
"label": "Tønsberg",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
},
|
||||
{
|
||||
"id": "s:NO:municipality:bergen",
|
||||
"country": "NO",
|
||||
"type": "municipality",
|
||||
"label": "Bergen",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
},
|
||||
{
|
||||
"id": "s:NO:county:oslo",
|
||||
"country": "NO",
|
||||
"type": "county",
|
||||
"label": "Oslo",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
},
|
||||
{
|
||||
"id": "s:NO:municipality:oslo",
|
||||
"country": "NO",
|
||||
"type": "municipality",
|
||||
"label": "Oslo",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
},
|
||||
{
|
||||
"id": "s:SE:county:stockholm",
|
||||
"country": "SE",
|
||||
"type": "county",
|
||||
"label": "Stockholm län",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
},
|
||||
{
|
||||
"id": "s:SE:municipality:stockholm",
|
||||
"country": "SE",
|
||||
"type": "municipality",
|
||||
"label": "Stockholm",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
},
|
||||
{
|
||||
"id": "s:SE:settlement:stockholm",
|
||||
"country": "SE",
|
||||
"type": "settlement",
|
||||
"label": "Stockholm",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
},
|
||||
{
|
||||
"id": "s:DE:state:bavaria",
|
||||
"country": "DE",
|
||||
"type": "state",
|
||||
"label": "Bavaria",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
},
|
||||
{
|
||||
"id": "s:FR:region:idf",
|
||||
"country": "FR",
|
||||
"type": "region",
|
||||
"label": "Île-de-France",
|
||||
"edition": "synthetic-1",
|
||||
"provenance": "synthetic-no-boundary-claim"
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"child": "s:GB:town:warwick",
|
||||
"parent": "s:GB:county:warwickshire",
|
||||
"type": "administrative-parent"
|
||||
},
|
||||
{
|
||||
"child": "s:GB:town:leamington",
|
||||
"parent": "s:GB:county:warwickshire",
|
||||
"type": "administrative-parent"
|
||||
},
|
||||
{
|
||||
"child": "s:NO:municipality:tonsberg",
|
||||
"parent": "s:NO:county:vestfold",
|
||||
"type": "administrative-parent"
|
||||
},
|
||||
{
|
||||
"child": "s:NO:municipality:oslo",
|
||||
"parent": "s:NO:county:oslo",
|
||||
"type": "administrative-parent"
|
||||
},
|
||||
{
|
||||
"child": "s:SE:municipality:stockholm",
|
||||
"parent": "s:SE:county:stockholm",
|
||||
"type": "administrative-parent"
|
||||
},
|
||||
{
|
||||
"child": "s:SE:settlement:stockholm",
|
||||
"parent": "s:SE:municipality:stockholm",
|
||||
"type": "settlement-intersects"
|
||||
},
|
||||
{
|
||||
"child": "s:NO:municipality:oslo",
|
||||
"parent": "s:NO:county:oslo",
|
||||
"type": "same-footprint"
|
||||
}
|
||||
],
|
||||
"scenarios": [
|
||||
{
|
||||
"name": "whole county children unchecked",
|
||||
"countries": [
|
||||
"GB"
|
||||
],
|
||||
"branches": [
|
||||
{
|
||||
"root": "s:GB:county:warwickshire",
|
||||
"refinements": []
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"query": [
|
||||
"s:GB:county:warwickshire"
|
||||
],
|
||||
"tree": [
|
||||
"s:GB:county:warwickshire"
|
||||
],
|
||||
"map": [
|
||||
"s:GB:county:warwickshire"
|
||||
]
|
||||
},
|
||||
"expanded": []
|
||||
},
|
||||
{
|
||||
"name": "explicit town refines county",
|
||||
"countries": [
|
||||
"GB"
|
||||
],
|
||||
"branches": [
|
||||
{
|
||||
"root": "s:GB:county:warwickshire",
|
||||
"refinements": [
|
||||
"s:GB:town:warwick"
|
||||
]
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"query": [
|
||||
"s:GB:town:warwick"
|
||||
],
|
||||
"tree": [
|
||||
"s:GB:town:warwick"
|
||||
],
|
||||
"map": [
|
||||
"s:GB:town:warwick"
|
||||
]
|
||||
},
|
||||
"expanded": []
|
||||
},
|
||||
{
|
||||
"name": "two towns",
|
||||
"countries": [
|
||||
"GB"
|
||||
],
|
||||
"branches": [
|
||||
{
|
||||
"root": "s:GB:county:warwickshire",
|
||||
"refinements": [
|
||||
"s:GB:town:warwick",
|
||||
"s:GB:town:leamington"
|
||||
]
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"query": [
|
||||
"s:GB:town:warwick",
|
||||
"s:GB:town:leamington"
|
||||
],
|
||||
"tree": [
|
||||
"s:GB:town:warwick",
|
||||
"s:GB:town:leamington"
|
||||
],
|
||||
"map": [
|
||||
"s:GB:town:warwick",
|
||||
"s:GB:town:leamington"
|
||||
]
|
||||
},
|
||||
"expanded": []
|
||||
},
|
||||
{
|
||||
"name": "remove one town",
|
||||
"countries": [
|
||||
"GB"
|
||||
],
|
||||
"branches": [
|
||||
{
|
||||
"root": "s:GB:county:warwickshire",
|
||||
"refinements": [
|
||||
"s:GB:town:leamington"
|
||||
]
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"query": [
|
||||
"s:GB:town:leamington"
|
||||
],
|
||||
"tree": [
|
||||
"s:GB:town:leamington"
|
||||
],
|
||||
"map": [
|
||||
"s:GB:town:leamington"
|
||||
]
|
||||
},
|
||||
"expanded": []
|
||||
},
|
||||
{
|
||||
"name": "remove last town",
|
||||
"countries": [
|
||||
"GB"
|
||||
],
|
||||
"branches": [
|
||||
{
|
||||
"root": "s:GB:county:warwickshire",
|
||||
"refinements": []
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"query": [
|
||||
"s:GB:county:warwickshire"
|
||||
],
|
||||
"tree": [
|
||||
"s:GB:county:warwickshire"
|
||||
],
|
||||
"map": [
|
||||
"s:GB:county:warwickshire"
|
||||
]
|
||||
},
|
||||
"expanded": []
|
||||
},
|
||||
{
|
||||
"name": "independent Bergen branch",
|
||||
"countries": [
|
||||
"GB",
|
||||
"NO"
|
||||
],
|
||||
"branches": [
|
||||
{
|
||||
"root": "s:GB:county:warwickshire",
|
||||
"refinements": [
|
||||
"s:GB:town:warwick"
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "s:NO:municipality:bergen",
|
||||
"refinements": []
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"query": [
|
||||
"s:GB:town:warwick",
|
||||
"s:NO:municipality:bergen"
|
||||
],
|
||||
"tree": [
|
||||
"s:GB:town:warwick",
|
||||
"s:NO:municipality:bergen"
|
||||
],
|
||||
"map": [
|
||||
"s:GB:town:warwick",
|
||||
"s:NO:municipality:bergen"
|
||||
]
|
||||
},
|
||||
"expanded": []
|
||||
},
|
||||
{
|
||||
"name": "Vestfold whole",
|
||||
"countries": [
|
||||
"NO"
|
||||
],
|
||||
"branches": [
|
||||
{
|
||||
"root": "s:NO:county:vestfold",
|
||||
"refinements": []
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"query": [
|
||||
"s:NO:county:vestfold"
|
||||
],
|
||||
"tree": [
|
||||
"s:NO:county:vestfold"
|
||||
],
|
||||
"map": [
|
||||
"s:NO:county:vestfold"
|
||||
]
|
||||
},
|
||||
"expanded": []
|
||||
},
|
||||
{
|
||||
"name": "Tonsberg refinement",
|
||||
"countries": [
|
||||
"NO"
|
||||
],
|
||||
"branches": [
|
||||
{
|
||||
"root": "s:NO:county:vestfold",
|
||||
"refinements": [
|
||||
"s:NO:municipality:tonsberg"
|
||||
]
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"query": [
|
||||
"s:NO:municipality:tonsberg"
|
||||
],
|
||||
"tree": [
|
||||
"s:NO:municipality:tonsberg"
|
||||
],
|
||||
"map": [
|
||||
"s:NO:municipality:tonsberg"
|
||||
]
|
||||
},
|
||||
"expanded": []
|
||||
},
|
||||
{
|
||||
"name": "Oslo dual typed identity",
|
||||
"countries": [
|
||||
"NO"
|
||||
],
|
||||
"branches": [
|
||||
{
|
||||
"root": "s:NO:county:oslo",
|
||||
"refinements": [
|
||||
"s:NO:municipality:oslo"
|
||||
]
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"query": [
|
||||
"s:NO:municipality:oslo"
|
||||
],
|
||||
"tree": [
|
||||
"s:NO:municipality:oslo"
|
||||
],
|
||||
"map": [
|
||||
"s:NO:municipality:oslo"
|
||||
]
|
||||
},
|
||||
"expanded": []
|
||||
},
|
||||
{
|
||||
"name": "Stockholm municipality is not settlement",
|
||||
"countries": [
|
||||
"SE"
|
||||
],
|
||||
"branches": [
|
||||
{
|
||||
"root": "s:SE:county:stockholm",
|
||||
"refinements": [
|
||||
"s:SE:municipality:stockholm"
|
||||
]
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"query": [
|
||||
"s:SE:municipality:stockholm"
|
||||
],
|
||||
"tree": [
|
||||
"s:SE:municipality:stockholm"
|
||||
],
|
||||
"map": [
|
||||
"s:SE:municipality:stockholm"
|
||||
]
|
||||
},
|
||||
"expanded": []
|
||||
},
|
||||
{
|
||||
"name": "parent deselected removes children",
|
||||
"countries": [
|
||||
"GB"
|
||||
],
|
||||
"branches": [],
|
||||
"expected": {
|
||||
"query": [],
|
||||
"tree": [],
|
||||
"map": []
|
||||
},
|
||||
"expanded": []
|
||||
},
|
||||
{
|
||||
"name": "country change retains compatible branch",
|
||||
"countries": [
|
||||
"NO"
|
||||
],
|
||||
"branches": [
|
||||
{
|
||||
"root": "s:NO:municipality:bergen",
|
||||
"refinements": []
|
||||
}
|
||||
],
|
||||
"expected": {
|
||||
"query": [
|
||||
"s:NO:municipality:bergen"
|
||||
],
|
||||
"tree": [
|
||||
"s:NO:municipality:bergen"
|
||||
],
|
||||
"map": [
|
||||
"s:NO:municipality:bergen"
|
||||
]
|
||||
},
|
||||
"expanded": []
|
||||
}
|
||||
],
|
||||
"journeys": [
|
||||
{ "residence": "NO", "uiLocale": "en-GB", "countries": ["GB"], "adLanguages": ["en"], "documentLanguages": ["nb"] },
|
||||
{ "residence": "NO", "uiLocale": "nb-NO", "countries": ["SE"], "adLanguages": ["sv", "en"], "documentLanguages": ["nb"] },
|
||||
{ "residence": "DE", "uiLocale": "pl-PL", "countries": ["DE"], "adLanguages": ["de", "pl"], "documentLanguages": ["pl"] },
|
||||
{ "residence": "BE", "uiLocale": "fr-FR", "countries": ["BE", "FR"], "adLanguages": ["fr"], "documentLanguages": ["en"] }
|
||||
],
|
||||
"countryChange": {
|
||||
"beforeCountries": [
|
||||
"NO",
|
||||
"GB"
|
||||
],
|
||||
"afterCountries": [
|
||||
"GB"
|
||||
],
|
||||
"beforeBranches": [
|
||||
{
|
||||
"root": "s:NO:county:vestfold",
|
||||
"refinements": [
|
||||
"s:NO:municipality:tonsberg"
|
||||
]
|
||||
},
|
||||
{
|
||||
"root": "s:GB:county:warwickshire",
|
||||
"refinements": [
|
||||
"s:GB:town:warwick"
|
||||
]
|
||||
}
|
||||
],
|
||||
"afterBranches": [
|
||||
{
|
||||
"root": "s:GB:county:warwickshire",
|
||||
"refinements": [
|
||||
"s:GB:town:warwick"
|
||||
]
|
||||
}
|
||||
],
|
||||
"cleared": [
|
||||
"s:NO:county:vestfold"
|
||||
],
|
||||
"explanation": "Norway location removed from this temporary search.",
|
||||
"before": {
|
||||
"residence": "NO",
|
||||
"uiLocale": "en-GB",
|
||||
"adLanguages": [
|
||||
"nb",
|
||||
"en"
|
||||
],
|
||||
"documentLanguages": [
|
||||
"fr",
|
||||
"nb"
|
||||
],
|
||||
"savedSearch": "unchanged-synthetic-definition"
|
||||
},
|
||||
"after": {
|
||||
"residence": "NO",
|
||||
"uiLocale": "en-GB",
|
||||
"adLanguages": [
|
||||
"nb",
|
||||
"en"
|
||||
],
|
||||
"documentLanguages": [
|
||||
"fr",
|
||||
"nb"
|
||||
],
|
||||
"savedSearch": "unchanged-synthetic-definition"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
# Offline European geography contract QA
|
||||
|
||||
17 November 2026. Bounded documentation/tooling increment authorised by the current direct roadmap continuation. This is executable specification QA, not GJ-01/GJ-02 implementation or acceptance. No application imports, dependencies, settings, migrations, HTTP requests, provider/model calls or qualification statuses change.
|
||||
|
||||
## Inputs and identity
|
||||
|
||||
Application baseline: `eb2538772e1bfabbeb291e4a5efa177c79074de1` (A3). Isolated branch `codex/global-geo-contracts`; worktree `E:/Storage/Projects/Active/temp docs/jobjakt-local-build/global-geo-contracts`.
|
||||
|
||||
The validator reads committed Git blobs directly. It does not copy a country registry, inspect another checkout's uncommitted data or require the I18N worktree to remain present. Required commits must exist locally; missing objects fail execution rather than falling back to stale checkout files. It performs no fetch.
|
||||
|
||||
| Source commit | Repository path | Exact Git blob |
|
||||
| --- | --- | --- |
|
||||
| `39fb9df06904e44916e258da0ed975dd46b9691c` | `docs/i18n/00/EUROPE_COUNTRY_LANGUAGE_MATRIX.md` | `4b88eb52e91d1c1ad0bb9082ed3ce075e0602dbd` |
|
||||
| `39fb9df06904e44916e258da0ed975dd46b9691c` | `docs/i18n/00/EUROPE_RELEASE_COVERAGE.csv` | `395fc09934a516a2445fddb092b5de18c9469080` |
|
||||
| `0ec9f98e6ed4a646fc5e017d8eb6fade07653f37` | `docs/global-jobs/00/GEOGRAPHY_DECISIONS.md` | `48f108ef02648f53490ae505b223ebff321264bb` |
|
||||
|
||||
The I18N source commit was inspected in the existing `i18n-message-census` worktree. Both matrix/CSV blob identities also match A3 exactly. All inputs are available in this local repository object store. The GJ planning documents remain on their separate planning history; they are not merged or replaced here. The geography decision blob is bound for traceability; its prose semantics were reviewed by a human-readable source inspection, not automatically interpreted by the script.
|
||||
|
||||
Authority: Prompt 7 and the GJ pack retain predecessor/initiative gates; GJ-00 geography decisions define branch refinement and typed relationships. The later EUROPE-READY owner addendum §§4/14 requires country/refinement contract tests and §15 preserves shared owners and gates. Existing `docs/i18n/00/IMPLEMENTATION_PLAN.md` permits future fixture design without inventing dependent runtime. Current direct instruction narrows this increment to offline documentation contracts. It does not authorise a runtime scope compiler.
|
||||
|
||||
## What runs
|
||||
|
||||
From the repository root, using installed Node and Git only:
|
||||
|
||||
```text
|
||||
rtk proxy node docs/global-jobs/00/validate-contracts.cjs --self-test
|
||||
rtk proxy node --check docs/global-jobs/00/validate-contracts.cjs
|
||||
rtk git diff --check
|
||||
```
|
||||
|
||||
The first command checks the matrix's exact 59-code roster and 1,062 coverage cells (18 columns per country); validates status vocabulary and the frozen qualification snapshot, including the sole existing Norway NAV fixture result; and checks XK's explicit non-ISO caveat. Updating any status requires a separately reviewed source/evidence change and validator update. This snapshot guard is not a general release approval engine.
|
||||
|
||||
`GEOGRAPHY_CONTRACT_FIXTURES.json` contains 13 deliberately synthetic typed identities, seven typed edges and 12 selection expectation cases. Every ID uses the `s:` namespace, edition `synthetic-1`, and explicit synthetic provenance. Display labels resemble representative locations, but neither the IDs nor edges are authoritative geographic data or a licensed boundary dataset. Administrative reachability is used only to check fixture expectations; settlement intersection and shared footprint cannot substitute for administrative containment. No query plan is emitted and no function is exported for application use.
|
||||
|
||||
Cases cover whole Warwickshire, one/two towns, removing refinements, independent Bergen OR, Vestfold/Tønsberg, distinct Oslo identities, Stockholm municipality versus settlement and parent/country removal. Query/tree/map are declared expected scope lists whose consistency is checked; no UI, query service or map is exercised. Four preference examples cover EN/NO→GB, NB→SE, PL→DE and FR→BE+FR as separate residence/UI/ad/document-language fields. One explicit country-change fixture preserves unrelated preferences and a saved-search sentinel, removes only incompatible branches and requires an explanation. JSON roundtrip checks apply to these fixtures only, not server persistence.
|
||||
|
||||
## Validation outcome
|
||||
|
||||
Executed with Node `v24.19.0`:
|
||||
|
||||
- PASS: 59 country rows / 1,062 coverage cells; 13 nodes, 12 selection cases, four preference examples and one country-change expectation.
|
||||
- PASS: 22 negative mutations rejected. They cover false release claims, missing/duplicate/invented countries, invalid status, crediting the NAV fixture to GB, typed identity/edition/provenance errors, invented geometry, cross-country edges, unresolved scopes, invalid refinements, broad-parent leakage, map divergence, language/saved-search resets, invisible filters, missing explanations, settlement overlap treated as containment, administrative cycles and invalid journey country.
|
||||
- PASS: Node syntax check and staged Git diff whitespace check (exit 0 each).
|
||||
- RED evidence: before implementation, the permissive validator failed the negative suite with `Missing expected exception: must reject false release coverage` (exit 1). First implemented run then caught the real CSV's NO/SE/GB administrative hierarchy `AWAITING REVIEW` nuance; the corrected frozen-snapshot guard preserves that existing status.
|
||||
|
||||
The 22 mutations are checks of the validator, not 22 additional product tests. The counts above describe one successful final contract run; intermediate reruns are not added. Syntax/diff verification is recorded separately from product tests.
|
||||
|
||||
Required `rtk proxy graphify update .` completed exit 0 with 19,842 nodes / 48,008 edges, explicitly AST-only/no LLM. It retained warnings for unavailable PDF/SQL extractors and 146 code files yielding no symbols. Generated `graphify-out/` is local/untracked and excluded from this documentation commit; graph counts are structural orientation, not acceptance tests.
|
||||
|
||||
## Gates and limits
|
||||
|
||||
All 59 entries remain candidate scope with their existing statuses. Real geography licences, exact dataset epochs/IDs/geometry, provider rights, live operation, map attribution/privacy, native-language/device/AT evidence and release approval remain open. Phase 10 D02/frozen-candidate acceptance, Product Review, GJ implementation authority and sequential accepted stages are unchanged. No precise town/radius, accessible tree, map switching, server preference persistence or country-specific provider behavior is qualified by these checks.
|
||||
|
||||
The existing NAV municipality substring limitation remains assigned to GJ geography work; this increment does not establish or repair a separate Norway regression. No main merge, orchestrator action, push or deployment occurs. Application builds/browser/backend/hosted/provider/model suites were intentionally not run for documentation-only tooling.
|
||||
@@ -1,163 +0,0 @@
|
||||
// Offline specification QA only; never imported by the application.
|
||||
const assert = require('node:assert/strict');
|
||||
const { execFileSync } = require('node:child_process');
|
||||
const { readFileSync } = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const root = path.resolve(__dirname, '../../..');
|
||||
const git = (...args) => execFileSync('git', args, { cwd: root, encoding: 'utf8', maxBuffer: 4 * 1024 * 1024 });
|
||||
const load = () => JSON.parse(readFileSync(path.join(__dirname, 'GEOGRAPHY_CONTRACT_FIXTURES.json'), 'utf8'));
|
||||
function validate(fixture, matrix, coverage) {
|
||||
assert.equal(fixture.schema, 1);
|
||||
assert.equal(fixture.purpose, 'offline-specification-only');
|
||||
assert.equal(fixture.sourceCommit, '39fb9df06904e44916e258da0ed975dd46b9691c');
|
||||
assert.equal(fixture.baseline, 'eb2538772e1bfabbeb291e4a5efa177c79074de1');
|
||||
const unique = (values, label) => assert.equal(new Set(values).size, values.length, `duplicate ${label}`);
|
||||
const sorted = values => [...values].sort();
|
||||
const codes = [...matrix.matchAll(/^\| [^|]+ \| ([A-Z]{2}) \|/gm)].map(match => match[1]);
|
||||
assert.equal(codes.length, 59);
|
||||
unique(codes, 'matrix code');
|
||||
assert(matrix.includes('XK is a CLDR user-assigned territory code, not ISO 3166-1'));
|
||||
// This pinned CSV has no quoted fields; fail rather than silently parse a new format.
|
||||
assert(!coverage.includes('"'), 'CSV format changed; review parser');
|
||||
const [header, ...lines] = coverage.trim().split(/\r?\n/).map(line => line.split(','));
|
||||
const columns = 'territoryCode,scopeReview,countrySelectable,administrativeHierarchy,canonicalResolution,mapCountrySwitching,canonicalLocationFilters,providerCoverage,countryAwareResults,multiCountrySavedSearches,marketLanguageOptions,marketCatalogue,currencyAndTimezone,mobile,accessibility,countryTestEvidence,humanApproval,productionAvailability,existingNavFixture'.split(',');
|
||||
assert.deepEqual(header, columns);
|
||||
unique(lines.map(row => row[0]), 'coverage code');
|
||||
assert.deepEqual(sorted(lines.map(row => row[0])), sorted(codes));
|
||||
const statuses = ['NOT IMPLEMENTED', 'IMPLEMENTED', 'TESTED', 'BLOCKED', 'AWAITING REVIEW', 'ACCEPTED', 'RELEASED'];
|
||||
for (const row of lines) {
|
||||
assert.equal(row.length, columns.length);
|
||||
for (let i = 1; i < row.length; i++) {
|
||||
assert(statuses.includes(row[i]), `invalid status ${row[0]} ${columns[i]}`);
|
||||
let expected = 'NOT IMPLEMENTED';
|
||||
if (['scopeReview', 'humanApproval'].includes(columns[i])) expected = 'AWAITING REVIEW';
|
||||
if (columns[i] === 'administrativeHierarchy' && ['NO', 'SE', 'GB'].includes(row[0])) expected = 'AWAITING REVIEW';
|
||||
if (columns[i] === 'productionAvailability' || (columns[i] === 'providerCoverage' && ['NO', 'SE', 'GB'].includes(row[0]))) expected = 'BLOCKED';
|
||||
if (columns[i] === 'existingNavFixture' && row[0] === 'NO') expected = 'TESTED';
|
||||
assert.equal(row[i], expected, `unqualified coverage change ${row[0]} ${columns[i]}`);
|
||||
}
|
||||
}
|
||||
const nodes = new Map(fixture.nodes.map(node => [node.id, node]));
|
||||
unique(fixture.nodes.map(node => node.id), 'node ID');
|
||||
for (const node of fixture.nodes) {
|
||||
assert(codes.includes(node.country));
|
||||
assert(['county', 'municipality', 'town', 'settlement', 'state', 'region'].includes(node.type));
|
||||
assert(node.id.startsWith(`s:${node.country}:${node.type}:`), 'typed country identity mismatch');
|
||||
assert.equal(node.edition, 'synthetic-1');
|
||||
assert.equal(node.provenance, 'synthetic-no-boundary-claim');
|
||||
assert.equal(typeof node.label, 'string');
|
||||
assert(node.label.trim());
|
||||
assert(!('coordinates' in node || 'geometry' in node || 'providerCode' in node), 'unqualified spatial/provider data');
|
||||
}
|
||||
unique(fixture.edges.map(edge => JSON.stringify(edge)), 'edge');
|
||||
for (const edge of fixture.edges) {
|
||||
assert(nodes.has(edge.child) && nodes.has(edge.parent), 'unresolved edge');
|
||||
assert.notEqual(edge.child, edge.parent);
|
||||
assert.equal(nodes.get(edge.child).country, nodes.get(edge.parent).country, 'cross-country edge');
|
||||
assert(['administrative-parent', 'settlement-intersects', 'same-footprint'].includes(edge.type));
|
||||
if (edge.type === 'settlement-intersects') assert.equal(nodes.get(edge.child).type, 'settlement');
|
||||
}
|
||||
// Reachability checks fixture declarations only; this is not a runtime scope compiler.
|
||||
function ancestor(child, parent, trail = []) {
|
||||
assert(!trail.includes(child), 'administrative cycle');
|
||||
return fixture.edges.filter(edge => edge.type === 'administrative-parent' && edge.child === child)
|
||||
.some(edge => edge.parent === parent || ancestor(edge.parent, parent, [...trail, child]));
|
||||
}
|
||||
for (const node of nodes.keys()) assert(!ancestor(node, node), 'administrative cycle');
|
||||
function checkBranches(branches, countries) {
|
||||
unique(countries, 'search country');
|
||||
assert(countries.every(country => codes.includes(country)));
|
||||
unique(branches.map(branch => branch.root), 'branch');
|
||||
for (const branch of branches) {
|
||||
assert(nodes.has(branch.root), 'unresolved scope');
|
||||
assert(countries.includes(nodes.get(branch.root).country), 'incompatible country scope');
|
||||
unique(branch.refinements, 'refinement');
|
||||
for (const refinement of branch.refinements) {
|
||||
assert(nodes.has(refinement) && ancestor(refinement, branch.root), 'invalid refinement');
|
||||
assert.equal(nodes.get(refinement).country, nodes.get(branch.root).country);
|
||||
}
|
||||
}
|
||||
}
|
||||
unique(fixture.scenarios.map(scenario => scenario.name), 'scenario name');
|
||||
assert(fixture.scenarios.length >= 12);
|
||||
for (const scenario of fixture.scenarios) {
|
||||
checkBranches(scenario.branches, scenario.countries);
|
||||
assert(scenario.expanded.every(id => nodes.has(id)));
|
||||
const leaves = scenario.branches.flatMap(branch => branch.refinements.length
|
||||
? branch.refinements.filter(id => !branch.refinements.some(other => id !== other && ancestor(other, id))) : [branch.root]);
|
||||
unique(leaves, 'effective scope');
|
||||
for (const surface of ['query', 'tree', 'map']) {
|
||||
assert.deepEqual(sorted(scenario.expected[surface]), sorted(leaves), `incorrect ${surface} scope: ${scenario.name}`);
|
||||
}
|
||||
assert.deepEqual(JSON.parse(JSON.stringify(scenario)), scenario, 'fixture roundtrip');
|
||||
}
|
||||
const change = fixture.countryChange;
|
||||
checkBranches(change.beforeBranches, change.beforeCountries);
|
||||
checkBranches(change.afterBranches, change.afterCountries);
|
||||
const retained = change.beforeBranches.filter(branch => change.afterCountries.includes(nodes.get(branch.root).country));
|
||||
assert.deepEqual(change.afterBranches, retained, 'only incompatible filters may clear');
|
||||
assert.deepEqual(change.cleared, change.beforeBranches.filter(branch => !retained.includes(branch)).map(branch => branch.root));
|
||||
assert(change.explanation.trim(), 'country change explanation required');
|
||||
assert.deepEqual(change.after, change.before, 'unrelated preferences/saved search changed');
|
||||
assert.deepEqual(Object.keys(change.before).sort(), ['adLanguages', 'documentLanguages', 'residence', 'savedSearch', 'uiLocale']);
|
||||
assert.equal(fixture.journeys.length, 4);
|
||||
for (const journey of fixture.journeys) {
|
||||
assert(codes.includes(journey.residence));
|
||||
assert(journey.countries.length && journey.countries.every(country => codes.includes(country)));
|
||||
unique(journey.countries, 'journey country');
|
||||
assert.equal(typeof journey.uiLocale, 'string');
|
||||
assert(journey.adLanguages.length && journey.documentLanguages.length);
|
||||
assert(journey.adLanguages.every(language => typeof language === 'string'));
|
||||
assert(journey.documentLanguages.every(language => typeof language === 'string'));
|
||||
}
|
||||
return { countries: codes.length, coverageCells: lines.length * (columns.length - 1), syntheticNodes: nodes.size,
|
||||
syntheticScenarios: fixture.scenarios.length, preferenceJourneys: fixture.journeys.length, countryChangeInvariants: 1,
|
||||
qualification: 'offline specification consistency only' };
|
||||
}
|
||||
function selfTest(fixture, matrix, coverage) {
|
||||
const cases = [
|
||||
['false release coverage', (f, m, c) => [f, m, c.replace('BLOCKED', 'RELEASED')]],
|
||||
['cross-country edge', f => { f.edges[0].parent = 's:NO:county:vestfold'; }],
|
||||
['invalid refinement', f => { f.scenarios[1].branches[0].refinements = ['s:NO:municipality:tonsberg']; }],
|
||||
['unqualified provenance', f => { f.nodes[0].provenance = 'licensed-real-data'; }],
|
||||
['duplicate country', (f, m, c) => [f, m, c + c.trim().split('\n')[1] + '\n']],
|
||||
['missing country', (f, m, c) => [f, m, c.trim().split('\n').slice(0, -1).join('\n')]],
|
||||
['invented country', (f, m, c) => [f, m, c.replace('AD,', 'ZZ,')]],
|
||||
['invalid status', (f, m, c) => [f, m, c.replace('BLOCKED', 'HEALTHY')]],
|
||||
['NO fixture credited to GB', (f, m, c) => [f, m, c.replace(/^GB,(.*),NOT IMPLEMENTED$/m, 'GB,$1,TESTED')]],
|
||||
['wrong type identity', f => { f.nodes[0].type = 'town'; }],
|
||||
['missing edition', f => { delete f.nodes[0].edition; }],
|
||||
['invented geometry', f => { f.nodes[0].geometry = {}; }],
|
||||
['unresolved scope', f => { f.scenarios[0].branches[0].root = 'missing'; }],
|
||||
['parent incorrectly ORed with town', f => { f.scenarios[1].expected.query.push(f.scenarios[1].branches[0].root); }],
|
||||
['map divergent from query', f => { f.scenarios[1].expected.map = []; }],
|
||||
['unrelated language reset', f => { f.countryChange.after.uiLocale = 'nb-NO'; }],
|
||||
['saved search overwritten', f => { f.countryChange.after.savedSearch = 'rewritten'; }],
|
||||
['invisible country filter', f => { f.countryChange.afterBranches = f.countryChange.beforeBranches; }],
|
||||
['silent country clearing', f => { f.countryChange.explanation = ''; }],
|
||||
['settlement overlap used as containment', f => {
|
||||
f.scenarios[9].branches[0].refinements = ['s:SE:settlement:stockholm'];
|
||||
}],
|
||||
['administrative cycle', f => { f.edges.push({child: f.edges[0].parent, parent: f.edges[0].child, type: 'administrative-parent'}); }],
|
||||
['invalid journey country', f => { f.journeys[0].countries = ['ZZ']; }],
|
||||
];
|
||||
for (const [name, mutate] of cases) {
|
||||
const candidate = structuredClone(fixture);
|
||||
const inputs = mutate(candidate, matrix, coverage) || [candidate, matrix, coverage];
|
||||
assert.throws(() => validate(...inputs), undefined, `must reject ${name}`);
|
||||
}
|
||||
return cases.length;
|
||||
}
|
||||
const fixture = load();
|
||||
// Read committed inputs directly; never copy a second register or use another worktree's dirty files.
|
||||
const bindings = [
|
||||
[fixture.sourceCommit, 'docs/i18n/00/EUROPE_COUNTRY_LANGUAGE_MATRIX.md', '4b88eb52e91d1c1ad0bb9082ed3ce075e0602dbd'],
|
||||
[fixture.sourceCommit, 'docs/i18n/00/EUROPE_RELEASE_COVERAGE.csv', '395fc09934a516a2445fddb092b5de18c9469080'],
|
||||
['0ec9f98e6ed4a646fc5e017d8eb6fade07653f37', 'docs/global-jobs/00/GEOGRAPHY_DECISIONS.md', '48f108ef02648f53490ae505b223ebff321264bb'],
|
||||
];
|
||||
for (const [commit, file, blob] of bindings) assert.equal(git('rev-parse', `${commit}:${file}`).trim(), blob, `source binding: ${file}`);
|
||||
const matrix = git('show', `${fixture.sourceCommit}:docs/i18n/00/EUROPE_COUNTRY_LANGUAGE_MATRIX.md`);
|
||||
const coverage = git('show', `${fixture.sourceCommit}:docs/i18n/00/EUROPE_RELEASE_COVERAGE.csv`);
|
||||
const result = validate(fixture, matrix, coverage);
|
||||
if (process.argv.includes('--self-test')) result.rejectedMutations = selfTest(fixture, matrix, coverage);
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
@@ -0,0 +1,44 @@
|
||||
# Preserve interview answer drafts through same-job refresh
|
||||
|
||||
18 November 2026. Branch `codex/interview-answer-refresh`, based on validated parent-lifetime checkpoint `336bc09987e5f3eb7b21c3a312284d9e45b3b9fc`. This resolves the ordinary-refresh draft-loss limitation recorded in that checkpoint, without changing job ownership, latest-read sequencing, APIs, locale catalogue or persistence contracts.
|
||||
|
||||
## Root cause and bounded change
|
||||
|
||||
`PrepRow` explicitly treats the answer as a local draft until saved, but `Shell` unmounted all children whenever its parent started a board GET. A sibling mark-ready, add, delete or explicit answer save therefore removed unrelated answer drafts. Failed refreshes also hid the loaded board with no GET retry. Separately, the row's shared write helper cleared its own draft after a readiness-only PATCH even though no answer was saved.
|
||||
|
||||
The shared local Shell now accepts an opt-in `keepContentOnLoading` flag. Only interview prep enables it, and only when its current job-keyed workspace has a successfully loaded board. That same condition retains content on a refresh error; read errors expose the existing GET-only retry. Initial loading/failed initial reads still have no editable board/default rows. Follow-up and AI Shell callers retain their existing defaults. Explicit answer saves clear that row's draft after successful persistence; readiness-only writes retain it.
|
||||
|
||||
Fresh successful GETs remain authoritative for row presence and server content. Surviving stable row IDs retain local drafts; rows absent from the refreshed board unmount normally. Explicit discard reveals the newest server answer. Changing job still unmounts all old private content/drafts via the existing keyed workspace. No global store, stale-content cache, string addition, implicit save or write retry was added.
|
||||
|
||||
## Test-first evidence
|
||||
|
||||
New deferred-promise tests initially failed on unchanged parent source: EN/NB sibling ready/add/delete/save refreshes, EN/NB refresh-error/retry preservation, and same-row readiness-only draft preservation. Delete fixtures were corrected to await modal exit; both corrected delete cases were then rerun against original `336bc099` production bytes and failed specifically because the editor disappeared during the board GET. Fixed production bytes were restored before final verification. Overlapping reruns are not added to test totals.
|
||||
|
||||
The final suite adds **13 cases**: eight sibling-action cases across EN/NB; two refresh-error/GET-retry cases; one readiness-only case; two job-change/failed-initial-read privacy controls. The inherited latest-read test now expects a previously loaded same-job board to remain mounted during refresh, while retaining its progress indicator. Initial/cross-job loading assertions remain unchanged. Native receipt: [jest-results.json](jest-results.json).
|
||||
|
||||
## Verification
|
||||
|
||||
From `job-tracker-ui`:
|
||||
|
||||
```powershell
|
||||
rtk proxy node node_modules/jest/bin/jest.js --runInBand --runTestsByPath src/interview-prep.test.tsx --cacheDirectory='../.test-cache' --json --outputFile='../docs/validation/interview-answer-refresh/jest-results.json'
|
||||
rtk proxy node node_modules/typescript/bin/tsc --noEmit --incremental false
|
||||
rtk proxy node node_modules/eslint/bin/eslint.js src/components/InterviewPrep.tsx src/interview-prep.test.tsx --max-warnings=0
|
||||
```
|
||||
|
||||
- Focused jsdom: **76/76 passed**, zero failed/skipped, no snapshots or React warnings; runner duration 28.558 seconds. This is 63 inherited plus 13 new cases, not a cumulative total of repeated runs.
|
||||
- Full UI TypeScript: passed, exit 0.
|
||||
- Scoped ESLint: passed, exit 0, zero warnings.
|
||||
- `rtk git diff --check`: passed.
|
||||
- Graph-first query used the existing parent worktree graph before source inspection. Its local graph artifacts were copied into this new worktree solely as an update seed. `rtk proxy graphify update .` ran AST-only here after source edits, with no API/model calls or shared graph mutation. Optional PDF/SQL extraction dependencies were absent; graph results provide structural orientation only. Generated graph and Jest cache remain local untracked artifacts.
|
||||
|
||||
Existing dependencies were accessed through the approved read-only junction to `next-security-patch/job-tracker-ui/node_modules`; no install, application build, browser or server ran.
|
||||
|
||||
Validated working-file SHA-256:
|
||||
|
||||
| File | SHA-256 |
|
||||
| --- | --- |
|
||||
| `job-tracker-ui/src/components/InterviewPrep.tsx` | `088cd555085bdecede0d61aa5b822505126ce5c66272f57030a532df50ff11cb` |
|
||||
| `job-tracker-ui/src/interview-prep.test.tsx` | `f02cfda979b20a76972765d96e47538b3574507a5b442c209086e663ce2e22bd` |
|
||||
|
||||
Browser/native/device, broader repository suites, hosted CI, backend/database, live AI/provider and production checks were not run. Root owns source-bound browser qualification, publication/integration and central tracking. Pending explicit writes still complete against their original job; this patch neither cancels nor redirects them. A deleted or recategorised row can legitimately unmount on authoritative refresh; preserving arbitrary removed content is outside this change.
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,45 @@
|
||||
# Interview parent state lifetime
|
||||
|
||||
17 November 2026; final revalidation 18 November 2026. Development checkpoint based on A3 `eb253877`, branch `codex/interview-parent-lifetime`. Scope is the interview-preparation and follow-up parent components and their unit tests. No runtime locale expansion, model/service calls, schema changes, production work or approval changes.
|
||||
|
||||
## Reproduced defects and fix
|
||||
|
||||
On unchanged baseline, deferred reads for application 7 were completed after rendering application 8. Seven regression cases failed: previous prep content replaced the current board; previous follow-up data overwrote a current draft; stale errors appeared in either current surface; stale finalisers dismissed either current loading state; and parent drafts/data survived the application boundary, causing a failed new follow-up read to expose old editable data instead of a GET-only retry.
|
||||
|
||||
A second pre-fix run added three cases: an older same-application refresh replaced a newer board, and a late prep addition cleared the new application's title draft and initiated a previous-application reload (both failed); a late follow-up write already retained its original API target (positive control passed). Thus nine expected failing regressions and one passing control were observed before editing production code; overlapping reruns are not additional unique tests.
|
||||
|
||||
The exported prep/follow-up components now render a job-keyed private workspace, following the existing keyed interview-assistant ownership pattern. Changing job unmounts its board, drafts, error and busy state together. A per-workspace active flag and read sequence guard read success/error/finally, and prevent an unmounted workspace from starting a refresh after an existing write completes. Only the newest read can update a mounted owner. Explicit writes retain their original closure/API target; no write is cancelled, migrated to another application or retried automatically. Same-application language changes keep the same workspace and its drafts.
|
||||
|
||||
Two additional same-application controls exercise stale errors and stale finalisers while a newer refresh remains pending. Existing rerender tests now await remount reads inside `act`, avoiding React test warnings caused by unawaited new parent workspaces. No test suppresses console output.
|
||||
|
||||
## Verification
|
||||
|
||||
Commands from `job-tracker-ui`:
|
||||
|
||||
```powershell
|
||||
rtk proxy node node_modules/jest/bin/jest.js --runInBand --runTestsByPath src/interview-prep.test.tsx --cacheDirectory='../.test-cache'
|
||||
rtk proxy node node_modules/typescript/bin/tsc --noEmit --incremental false
|
||||
rtk proxy node node_modules/eslint/bin/eslint.js src/components/InterviewPrep.tsx src/interview-prep.test.tsx --max-warnings=0
|
||||
```
|
||||
|
||||
- Final focused jsdom suite: **63/63 passed**, no snapshots, no React warnings. This includes 12 added cases and the existing 51; prior focused runs are not added to that total.
|
||||
- Native runner receipt: [jest-results.json](jest-results.json), produced with `--json --outputFile='../docs/validation/interview-parent-lifetime/jest-results.json'` added to the command above. Final revalidation passed 63/63 with zero failed/pending tests and 23.206 seconds reported by the runner. This is a repeat of the same source-bound cases, not an additional 63 distinct tests.
|
||||
- Full UI TypeScript check: passed, exit 0.
|
||||
- Scoped lint: passed, exit 0, zero warnings. An earlier cleanup-ref lint warning was fixed by checking the active flag on completion instead of mutating the read ref during cleanup.
|
||||
- `rtk git diff --check`: passed.
|
||||
- Graph-first query used the existing isolated A3 research graph before source inspection. `rtk proxy graphify update .` performed AST-only extraction in this new worktree, without API/model calls or shared graph mutation. The initial refresh created 19,835 nodes and 48,044 edges; an incremental refresh followed the final source/test edits. Generated graph output is local untracked research material, not a new runtime dependency. Graph reported missing optional PDF/SQL extraction dependencies and unsupported/no-symbol files; this is structural orientation, not full runtime or document analysis.
|
||||
|
||||
Existing dependencies were accessed read-only through a directory junction to `E:/Storage/Projects/Active/temp docs/jobjakt-local-build/next-security-patch/job-tracker-ui/node_modules`. No install/build/browser lane ran.
|
||||
|
||||
Validated working-file SHA-256:
|
||||
|
||||
| File | SHA-256 |
|
||||
| --- | --- |
|
||||
| `job-tracker-ui/src/components/InterviewPrep.tsx` | `57d208df5880d8b93c9a3acf13e7b11d2791f4a9d3fdf55da56debe68c3145ee` |
|
||||
| `job-tracker-ui/src/interview-prep.test.tsx` | `82c36af6225d4fb00fb689bf7243ef2163b6abc237c91a7058f283c173d34471` |
|
||||
|
||||
## Limits and integration
|
||||
|
||||
Browser/native/device, broader repository suites, hosted CI, backend/database, live AI, provider and production checks were not run. Root owns source-bound browser qualification, integration/publication and central tracking. This checkpoint does not grant release or roadmap-stage approval.
|
||||
|
||||
Adjacent existing behaviour remains: ordinary same-application board refresh hides/remounts row editors through `Shell`'s loading condition; preserving row-local unsaved answers during every ordinary refresh needs a separate behavioural decision and test package. This fix prevents superseded reads from replacing the newest board/draft state; it does not redesign refresh presentation or persistence. Pending writes may still finish on the original application after navigation, as explicitly initiated by the user.
|
||||
File diff suppressed because one or more lines are too long
@@ -25,7 +25,7 @@ import ViewStateNotice from "./ViewStateNotice";
|
||||
// become prep items after an explicit accept action.
|
||||
// docs/architecture/overview.md.
|
||||
|
||||
function Shell({ title, subtitle, loading, error, children, onRetry, keepContentOnError = false }: {
|
||||
function Shell({ title, subtitle, loading, error, children, onRetry, keepContentOnError = false, keepContentOnLoading = false }: {
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
loading: boolean;
|
||||
@@ -33,16 +33,21 @@ function Shell({ title, subtitle, loading, error, children, onRetry, keepContent
|
||||
children: React.ReactNode;
|
||||
onRetry?: () => void | Promise<void>;
|
||||
keepContentOnError?: boolean;
|
||||
keepContentOnLoading?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<PageSection surface title={title} description={subtitle} level="h3">
|
||||
<ViewStateNotice title={title} loading={loading} error={error ? { kind: "error", message: error, retryable: Boolean(onRetry) } : null} onRetry={onRetry} compact />
|
||||
{!loading && (!error || keepContentOnError) && children}
|
||||
{(!loading || keepContentOnLoading) && (!error || keepContentOnError) && children}
|
||||
</PageSection>
|
||||
);
|
||||
}
|
||||
|
||||
export function ApplicationInterviewPrep({ jobId }: { jobId: number }) {
|
||||
return <InterviewPrepWorkspace key={jobId} jobId={jobId} />;
|
||||
}
|
||||
|
||||
function InterviewPrepWorkspace({ jobId }: { jobId: number }) {
|
||||
const { t } = useI18n();
|
||||
const [board, setBoard] = useState<InterviewPrepBoard | null>(null);
|
||||
const [error, setError] = useState<{ cause: unknown; fallback: "interviewPrepLoadFailed" | "interviewPrepUpdateFailed" | "interviewPrepAnswerSaveFailed" } | null>(null);
|
||||
@@ -50,16 +55,26 @@ export function ApplicationInterviewPrep({ jobId }: { jobId: number }) {
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [title, setTitle] = useState("");
|
||||
const [category, setCategory] = useState(INTERVIEW_PREP_CATEGORIES[0].key);
|
||||
const active = useRef(true);
|
||||
const readSequence = useRef(0);
|
||||
useLayoutEffect(() => {
|
||||
active.current = true;
|
||||
return () => { active.current = false; };
|
||||
}, []);
|
||||
|
||||
const load = useCallback(async () => {
|
||||
if (!active.current) return;
|
||||
const request = ++readSequence.current;
|
||||
setLoading(true);
|
||||
try {
|
||||
setBoard(await interviewPrepApi.get(jobId));
|
||||
const result = await interviewPrepApi.get(jobId);
|
||||
if (!active.current || request !== readSequence.current) return;
|
||||
setBoard(result);
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError({ cause: err, fallback: "interviewPrepLoadFailed" });
|
||||
if (active.current && request === readSequence.current) setError({ cause: err, fallback: "interviewPrepLoadFailed" });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
if (active.current && request === readSequence.current) setLoading(false);
|
||||
}
|
||||
}, [jobId]);
|
||||
|
||||
@@ -104,7 +119,9 @@ export function ApplicationInterviewPrep({ jobId }: { jobId: number }) {
|
||||
subtitle={t("interviewPrepSubtitle")}
|
||||
loading={loading}
|
||||
error={error ? getApiErrorMessage(error.cause, t(error.fallback)) : null}
|
||||
keepContentOnError={error?.fallback === "interviewPrepAnswerSaveFailed" || error?.fallback === "interviewPrepUpdateFailed"}
|
||||
onRetry={error?.fallback === "interviewPrepLoadFailed" ? load : undefined}
|
||||
keepContentOnLoading={board !== null}
|
||||
keepContentOnError={board !== null}
|
||||
>
|
||||
<Stack spacing={2}>
|
||||
{board && !board.isInterviewStage && (
|
||||
@@ -341,11 +358,11 @@ function PrepRow({ jobId, item, busy, onChanged, onError }: {
|
||||
const content = draft ?? item.content ?? "";
|
||||
const dirty = draft !== null && draft !== (item.content ?? "");
|
||||
|
||||
const run = async (fn: () => Promise<unknown>) => {
|
||||
const run = async (fn: () => Promise<unknown>, savesAnswer = false) => {
|
||||
setSaving(true);
|
||||
try {
|
||||
await fn();
|
||||
setDraft(null);
|
||||
if (savesAnswer) setDraft(null);
|
||||
onChanged();
|
||||
} catch (err) {
|
||||
onError({ cause: err, fallback: "interviewPrepAnswerSaveFailed" });
|
||||
@@ -390,7 +407,7 @@ function PrepRow({ jobId, item, busy, onChanged, onError }: {
|
||||
size="small"
|
||||
variant="contained"
|
||||
disabled={saving}
|
||||
onClick={() => run(() => interviewPrepApi.update(jobId, item.id, { content }))}
|
||||
onClick={() => run(() => interviewPrepApi.update(jobId, item.id, { content }), true)}
|
||||
>
|
||||
{t("interviewPrepSaveAnswer")}
|
||||
</Button>
|
||||
@@ -424,6 +441,10 @@ function PrepRow({ jobId, item, busy, onChanged, onError }: {
|
||||
}
|
||||
|
||||
export function ApplicationFollowUp({ jobId }: { jobId: number }) {
|
||||
return <FollowUpWorkspace key={jobId} jobId={jobId} />;
|
||||
}
|
||||
|
||||
function FollowUpWorkspace({ jobId }: { jobId: number }) {
|
||||
const { t } = useI18n();
|
||||
const [data, setData] = useState<FollowUp | null>(null);
|
||||
const [error, setError] = useState<{ cause: unknown; fallback: "interviewFollowUpLoadFailed" | "interviewFollowUpSaveFailed" } | null>(null);
|
||||
@@ -431,19 +452,28 @@ export function ApplicationFollowUp({ jobId }: { jobId: number }) {
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [date, setDate] = useState<string>("");
|
||||
const [action, setAction] = useState<string>("");
|
||||
const active = useRef(true);
|
||||
const readSequence = useRef(0);
|
||||
useLayoutEffect(() => {
|
||||
active.current = true;
|
||||
return () => { active.current = false; };
|
||||
}, []);
|
||||
|
||||
const load = useCallback(async () => {
|
||||
if (!active.current) return;
|
||||
const request = ++readSequence.current;
|
||||
setLoading(true);
|
||||
try {
|
||||
const result = await interviewPrepApi.followUp(jobId);
|
||||
if (!active.current || request !== readSequence.current) return;
|
||||
setData(result);
|
||||
setDate(result.followUpAt ? result.followUpAt.slice(0, 10) : "");
|
||||
setAction(result.nextAction ?? "");
|
||||
setError(null);
|
||||
} catch (err) {
|
||||
setError({ cause: err, fallback: "interviewFollowUpLoadFailed" });
|
||||
if (active.current && request === readSequence.current) setError({ cause: err, fallback: "interviewFollowUpLoadFailed" });
|
||||
} finally {
|
||||
setLoading(false);
|
||||
if (active.current && request === readSequence.current) setLoading(false);
|
||||
}
|
||||
}, [jobId]);
|
||||
|
||||
|
||||
@@ -63,6 +63,232 @@ beforeEach(() => {
|
||||
window.localStorage.setItem("uiLanguage", "en");
|
||||
});
|
||||
|
||||
function deferredRead() {
|
||||
let resolve!: (value: any) => void;
|
||||
let reject!: (reason: unknown) => void;
|
||||
const promise = new Promise<any>((yes, no) => { resolve = yes; reject = no; });
|
||||
return { promise, resolve, reject };
|
||||
}
|
||||
|
||||
test.each((['en', 'nb'] as const).flatMap(language => (['ready', 'add', 'delete', 'save'] as const).map(operation => [language, operation] as const)))('same-application %s %s refresh keeps a sibling answer mounted until explicit discard', async (language, operation) => {
|
||||
localStorage.setItem('uiLanguage', language);
|
||||
const copy = translations[language];
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
const read = mockedApi.get.getMockImplementation()!;
|
||||
const refresh = deferredRead(); let reads = 0;
|
||||
mockedApi.get.mockImplementation((url: string) => url.endsWith('/interview-prep') && ++reads > 1 ? refresh.promise : read(url));
|
||||
mockedApi.patch.mockReset().mockResolvedValue({ data: board.groups[0].items[0] } as any);
|
||||
mockedApi.post.mockReset().mockResolvedValue({ data: board.groups[0].items[0] } as any);
|
||||
mockedApi.delete.mockReset().mockResolvedValue({ data: null } as any);
|
||||
render(<ApplicationInterviewPrep jobId={7} />);
|
||||
const name = copy.interviewPrepAnswerFor.replace('{title}', 'Tell me about a conflict');
|
||||
const answer = await screen.findByRole('textbox', { name });
|
||||
fireEvent.change(answer, { target: { value: 'My unsaved sibling answer Øresund' } });
|
||||
if (operation === 'ready') fireEvent.click(screen.getByRole('checkbox', { name: copy.interviewPrepReadyLabel.replace('{title}', 'Funding history') }));
|
||||
if (operation === 'add') {
|
||||
fireEvent.change(screen.getByLabelText(copy.interviewPrepAddLabel), { target: { value: 'New prep item' } });
|
||||
fireEvent.click(screen.getByRole('button', { name: copy.interviewPrepAdd }));
|
||||
}
|
||||
if (operation === 'delete') {
|
||||
fireEvent.click(screen.getByRole('button', { name: copy.interviewPrepDeleteLabel.replace('{title}', 'Funding history') }));
|
||||
fireEvent.click(within(await screen.findByRole('dialog')).getByRole('button', { name: copy.interviewPrepDelete }));
|
||||
await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());
|
||||
}
|
||||
if (operation === 'save') {
|
||||
fireEvent.change(screen.getByRole('textbox', { name: copy.interviewPrepAnswerFor.replace('{title}', 'Funding history') }), { target: { value: 'Saved first answer' } });
|
||||
fireEvent.click(screen.getAllByRole('button', { name: copy.interviewPrepSaveAnswer })[0]);
|
||||
}
|
||||
await waitFor(() => expect(reads).toBe(2));
|
||||
expect(screen.getByRole('textbox', { name })).toBe(answer);
|
||||
expect(answer).toHaveValue('My unsaved sibling answer Øresund');
|
||||
const updatedGroup = { ...board.groups[1], items: [{ ...board.groups[1].items[0], content: 'Current server answer' }] };
|
||||
const updated = { ...board, groups: operation === 'delete' ? [updatedGroup] : [board.groups[0], updatedGroup] };
|
||||
await act(async () => refresh.resolve({ data: updated }));
|
||||
expect(screen.getByRole('textbox', { name })).toBe(answer);
|
||||
expect(answer).toHaveValue('My unsaved sibling answer Øresund');
|
||||
expect(mockedApi.patch).not.toHaveBeenCalledWith('/jobapplications/7/interview-prep/2', expect.anything());
|
||||
fireEvent.click(screen.getByRole('button', { name: copy.interviewPrepDiscard }));
|
||||
expect(answer).toHaveValue('Current server answer');
|
||||
});
|
||||
|
||||
test.each(['en', 'nb'] as const)('same-application %s refresh failure and GET-only retry preserve an unsaved answer', async language => {
|
||||
localStorage.setItem('uiLanguage', language);
|
||||
const copy = translations[language];
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
const read = mockedApi.get.getMockImplementation()!;
|
||||
let reads = 0;
|
||||
mockedApi.get.mockImplementation((url: string) => url.endsWith('/interview-prep') && ++reads === 2 ? Promise.reject(new Error('Refresh failed')) : read(url));
|
||||
mockedApi.patch.mockReset().mockResolvedValue({ data: board.groups[0].items[0] } as any);
|
||||
render(<ApplicationInterviewPrep jobId={7} />);
|
||||
const name = copy.interviewPrepAnswerFor.replace('{title}', 'Tell me about a conflict');
|
||||
const answer = await screen.findByRole('textbox', { name });
|
||||
fireEvent.change(answer, { target: { value: 'Keep across failed refresh' } });
|
||||
fireEvent.click(screen.getByRole('checkbox', { name: copy.interviewPrepReadyLabel.replace('{title}', 'Funding history') }));
|
||||
expect(await screen.findByText(copy.interviewPrepLoadFailed)).toBeVisible();
|
||||
expect(screen.getByRole('textbox', { name })).toBe(answer);
|
||||
expect(answer).toHaveValue('Keep across failed refresh');
|
||||
fireEvent.click(screen.getByRole('button', { name: copy.retry }));
|
||||
await waitFor(() => expect(screen.queryByText(copy.interviewPrepLoadFailed)).not.toBeInTheDocument());
|
||||
expect(reads).toBe(3); expect(mockedApi.patch).toHaveBeenCalledTimes(1);
|
||||
expect(screen.getByRole('textbox', { name })).toBe(answer);
|
||||
expect(answer).toHaveValue('Keep across failed refresh');
|
||||
});
|
||||
|
||||
test('marking readiness preserves that row answer draft because the write contains no answer', async () => {
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
mockedApi.patch.mockReset().mockResolvedValue({ data: board.groups[1].items[0] } as any);
|
||||
render(<ApplicationInterviewPrep jobId={7} />);
|
||||
const name = translations.en.interviewPrepAnswerFor.replace('{title}', 'Tell me about a conflict');
|
||||
fireEvent.change(await screen.findByRole('textbox', { name }), { target: { value: 'Not saved by readiness' } });
|
||||
fireEvent.click(screen.getByRole('checkbox', { name: 'Ready: Tell me about a conflict' }));
|
||||
await waitFor(() => expect(mockedApi.get.mock.calls.filter(([url]) => String(url).endsWith('/interview-prep'))).toHaveLength(2));
|
||||
expect(screen.getByRole('textbox', { name })).toHaveValue('Not saved by readiness');
|
||||
expect(mockedApi.patch.mock.calls).toEqual([['/jobapplications/7/interview-prep/2', { isPrepared: true }]]);
|
||||
});
|
||||
|
||||
test.each(['en', 'nb'] as const)('changing job clears %s answer drafts and a failed initial read offers only a GET retry', async language => {
|
||||
localStorage.setItem('uiLanguage', language);
|
||||
const copy = translations[language];
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
const read = mockedApi.get.getMockImplementation()!;
|
||||
const current = deferredRead(); let currentReads = 0;
|
||||
mockedApi.get.mockImplementation((url: string) => url === '/jobapplications/8/interview-prep' && ++currentReads === 1 ? current.promise : read(url));
|
||||
const name = copy.interviewPrepAnswerFor.replace('{title}', 'Tell me about a conflict');
|
||||
const view = render(<ApplicationInterviewPrep jobId={7} />);
|
||||
fireEvent.change(await screen.findByRole('textbox', { name }), { target: { value: 'Private application seven answer' } });
|
||||
await act(async () => view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>));
|
||||
expect(screen.queryByRole('textbox', { name })).not.toBeInTheDocument();
|
||||
await act(async () => current.reject(new Error('New application initial read failed')));
|
||||
expect(screen.getByText(copy.interviewPrepLoadFailed)).toBeVisible();
|
||||
expect(screen.queryByLabelText(copy.interviewPrepAddLabel)).not.toBeInTheDocument();
|
||||
fireEvent.click(screen.getByRole('button', { name: copy.retry }));
|
||||
expect(await screen.findByRole('textbox', { name })).toHaveValue('');
|
||||
expect(currentReads).toBe(2);
|
||||
expect(mockedApi.patch).not.toHaveBeenCalled(); expect(mockedApi.post).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test.each(['success', 'failure', 'pending-newer'] as const)('a newer preparation refresh wins against an older %s completion', async completion => {
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
const read = mockedApi.get.getMockImplementation()!;
|
||||
const older = deferredRead(); const newer = deferredRead();
|
||||
let reads = 0;
|
||||
mockedApi.get.mockImplementation((url: string) => url.endsWith('/interview-prep') && ++reads > 1 ? (reads === 2 ? older.promise : newer.promise) : read(url));
|
||||
const firstWrite = deferredRead(); const secondWrite = deferredRead();
|
||||
mockedApi.patch.mockReset().mockReturnValueOnce(firstWrite.promise).mockReturnValueOnce(secondWrite.promise);
|
||||
render(<ApplicationInterviewPrep jobId={7} />);
|
||||
fireEvent.click(await screen.findByRole('checkbox', { name: 'Ready: Funding history' }));
|
||||
fireEvent.click(screen.getByRole('checkbox', { name: 'Ready: Tell me about a conflict' }));
|
||||
await act(async () => firstWrite.resolve({ data: {} }));
|
||||
await act(async () => secondWrite.resolve({ data: {} }));
|
||||
expect(reads).toBe(3);
|
||||
if (completion === 'pending-newer') {
|
||||
await act(async () => older.resolve({ data: board }));
|
||||
const region = within(screen.getByRole('region', { name: translations.en.interviewPrepTitle }));
|
||||
expect(region.getByRole('progressbar', { name: translations.en.loading })).toBeVisible();
|
||||
expect(region.getByLabelText(translations.en.interviewPrepAddLabel)).toBeVisible();
|
||||
}
|
||||
const currentBoard = { ...board, groups: [{ ...board.groups[0], items: [{ ...board.groups[0].items[0], title: 'Newest board' }] }] };
|
||||
await act(async () => newer.resolve({ data: currentBoard }));
|
||||
expect(await screen.findByText('Newest board')).toBeVisible();
|
||||
fireEvent.change(screen.getByLabelText(translations.en.interviewPrepAddLabel), { target: { value: 'Current draft' } });
|
||||
if (completion === 'success') await act(async () => older.resolve({ data: board }));
|
||||
if (completion === 'failure') await act(async () => older.reject(new Error('Older refresh failure')));
|
||||
expect(screen.getByText('Newest board')).toBeVisible();
|
||||
expect(screen.queryByText(translations.en.interviewPrepLoadFailed)).not.toBeInTheDocument();
|
||||
expect(screen.getByLabelText(translations.en.interviewPrepAddLabel)).toHaveValue('Current draft');
|
||||
});
|
||||
|
||||
test.each(['prep', 'follow-up'] as const)('late %s write keeps its original target and cannot clear a new application draft', async surface => {
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
const write = deferredRead();
|
||||
mockedApi.post.mockReset().mockReturnValueOnce(write.promise);
|
||||
mockedApi.put.mockReset().mockReturnValueOnce(write.promise);
|
||||
const component = (id: number) => surface === 'prep' ? <ApplicationInterviewPrep jobId={id} /> : <ApplicationFollowUp jobId={id} />;
|
||||
const label = surface === 'prep' ? translations.en.interviewPrepAddLabel : translations.en.workspaceNextAction;
|
||||
const view = render(component(7));
|
||||
fireEvent.change(await screen.findByLabelText(label), { target: { value: 'Original application write' } });
|
||||
fireEvent.click(screen.getByRole('button', { name: translations.en[surface === 'prep' ? 'interviewPrepAdd' : 'save'] }));
|
||||
await act(async () => view.rerender(<I18nProvider><ConfirmProvider>{component(8)}</ConfirmProvider></I18nProvider>));
|
||||
fireEvent.change(await screen.findByLabelText(label), { target: { value: 'New application draft' } });
|
||||
await act(async () => write.resolve({ data: surface === 'prep' ? board.groups[0].items[0] : followUp }));
|
||||
expect(screen.getByLabelText(label)).toHaveValue('New application draft');
|
||||
expect(surface === 'prep' ? mockedApi.post : mockedApi.put).toHaveBeenCalledTimes(1);
|
||||
expect((surface === 'prep' ? mockedApi.post : mockedApi.put).mock.calls[0][0]).toBe(`/jobapplications/7/${surface === 'prep' ? 'interview-prep' : 'follow-up'}`);
|
||||
expect(mockedApi.get.mock.calls.filter(([url]) => url === '/jobapplications/7/interview-prep')).toHaveLength(surface === 'prep' ? 1 : 0);
|
||||
});
|
||||
|
||||
test.each(['prep', 'follow-up'] as const)('late %s read cannot replace the current application or its draft', async surface => {
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
const read = mockedApi.get.getMockImplementation()!;
|
||||
const old = deferredRead();
|
||||
const suffix = surface === 'prep' ? 'interview-prep' : 'follow-up';
|
||||
mockedApi.get.mockImplementation((url: string) => url === `/jobapplications/7/${suffix}` ? old.promise : read(url));
|
||||
const component = (id: number) => surface === 'prep' ? <ApplicationInterviewPrep jobId={id} /> : <ApplicationFollowUp jobId={id} />;
|
||||
const view = render(component(7));
|
||||
await act(async () => view.rerender(<I18nProvider><ConfirmProvider>{component(8)}</ConfirmProvider></I18nProvider>));
|
||||
const label = surface === 'prep' ? translations.en.interviewPrepAddLabel : translations.en.workspaceNextAction;
|
||||
fireEvent.change(await screen.findByLabelText(label), { target: { value: 'Current application draft' } });
|
||||
const oldData = surface === 'prep'
|
||||
? { ...board, groups: [{ ...board.groups[0], items: [{ ...board.groups[0].items[0], title: 'Previous application only' }] }] }
|
||||
: { ...followUp, nextAction: 'Previous application only' };
|
||||
await act(async () => old.resolve({ data: oldData }));
|
||||
expect(screen.getByLabelText(label)).toHaveValue('Current application draft');
|
||||
expect(screen.queryByText('Previous application only')).not.toBeInTheDocument();
|
||||
expect(screen.queryByDisplayValue('Previous application only')).not.toBeInTheDocument();
|
||||
expect(mockedApi.post).not.toHaveBeenCalled(); expect(mockedApi.put).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test.each(['prep', 'follow-up'] as const)('late %s read failure cannot hide the current draft', async surface => {
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
const read = mockedApi.get.getMockImplementation()!;
|
||||
const old = deferredRead();
|
||||
const suffix = surface === 'prep' ? 'interview-prep' : 'follow-up';
|
||||
mockedApi.get.mockImplementation((url: string) => url === `/jobapplications/7/${suffix}` ? old.promise : read(url));
|
||||
const component = (id: number) => surface === 'prep' ? <ApplicationInterviewPrep jobId={id} /> : <ApplicationFollowUp jobId={id} />;
|
||||
const view = render(component(7));
|
||||
await act(async () => view.rerender(<I18nProvider><ConfirmProvider>{component(8)}</ConfirmProvider></I18nProvider>));
|
||||
const label = surface === 'prep' ? translations.en.interviewPrepAddLabel : translations.en.workspaceNextAction;
|
||||
fireEvent.change(await screen.findByLabelText(label), { target: { value: 'Current application draft' } });
|
||||
await act(async () => old.reject(new Error('Previous application failure')));
|
||||
expect(screen.queryByText(translations.en[surface === 'prep' ? 'interviewPrepLoadFailed' : 'interviewFollowUpLoadFailed'])).not.toBeInTheDocument();
|
||||
expect(screen.getByLabelText(label)).toHaveValue('Current application draft');
|
||||
});
|
||||
|
||||
test.each(['prep', 'follow-up'] as const)('late %s finally cannot dismiss the current application loading state', async surface => {
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
const read = mockedApi.get.getMockImplementation()!;
|
||||
const old = deferredRead(); const current = deferredRead();
|
||||
const suffix = surface === 'prep' ? 'interview-prep' : 'follow-up';
|
||||
mockedApi.get.mockImplementation((url: string) => url.endsWith(`/${suffix}`) ? (url.includes('/7/') ? old.promise : current.promise) : read(url));
|
||||
const component = (id: number) => surface === 'prep' ? <ApplicationInterviewPrep jobId={id} /> : <ApplicationFollowUp jobId={id} />;
|
||||
const view = render(component(7));
|
||||
await act(async () => view.rerender(<I18nProvider><ConfirmProvider>{component(8)}</ConfirmProvider></I18nProvider>));
|
||||
await act(async () => old.resolve({ data: surface === 'prep' ? board : followUp }));
|
||||
const region = within(screen.getByRole('region', { name: translations.en[surface === 'prep' ? 'interviewPrepTitle' : 'interviewFollowUpTitle'] }));
|
||||
expect(region.getByRole('progressbar', { name: translations.en.loading })).toBeVisible();
|
||||
expect(region.queryByLabelText(translations.en[surface === 'prep' ? 'interviewPrepAddLabel' : 'workspaceNextAction'])).not.toBeInTheDocument();
|
||||
await act(async () => current.resolve({ data: surface === 'prep' ? board : followUp }));
|
||||
expect(await region.findByLabelText(translations.en[surface === 'prep' ? 'interviewPrepAddLabel' : 'workspaceNextAction'])).toBeVisible();
|
||||
});
|
||||
|
||||
test('changing application resets parent drafts and a failed follow-up read retains a GET-only retry', async () => {
|
||||
mockedApi.get.mockReset(); routeGet();
|
||||
const read = mockedApi.get.getMockImplementation()!;
|
||||
mockedApi.get.mockImplementation((url: string) => url === '/jobapplications/8/follow-up' ? Promise.reject(new Error('Current read failure')) : read(url));
|
||||
const view = render(<ApplicationInterviewPrep jobId={7} />);
|
||||
fireEvent.change(await screen.findByLabelText(translations.en.interviewPrepAddLabel), { target: { value: 'Application seven draft' } });
|
||||
await screen.findByDisplayValue(followUp.nextAction);
|
||||
await act(async () => view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>));
|
||||
expect(await screen.findByLabelText(translations.en.interviewPrepAddLabel)).toHaveValue('');
|
||||
expect(await screen.findByText(translations.en.interviewFollowUpLoadFailed)).toBeVisible();
|
||||
const region = within(screen.getByRole('region', { name: translations.en.interviewFollowUpTitle }));
|
||||
expect(region.queryByLabelText(translations.en.workspaceNextAction)).not.toBeInTheDocument();
|
||||
mockedApi.get.mockImplementation(read);
|
||||
fireEvent.click(region.getByRole('button', { name: translations.en.retry }));
|
||||
expect(await region.findByLabelText(translations.en.workspaceNextAction)).toHaveValue(followUp.nextAction);
|
||||
expect(mockedApi.put).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test.each(['en', 'nb'] as const)('pending preparation deletion follows %s without a preparation reload or answer loss', async from => {
|
||||
localStorage.setItem('uiLanguage', from);
|
||||
const to = from === 'en' ? 'nb' : 'en';
|
||||
@@ -352,7 +578,7 @@ test('late generation cannot offer another application the previous application
|
||||
fireEvent.change(screen.getByLabelText(translations.en.coverAiAdditionalInstructions), { target: { value: 'Private instructions for application seven' } });
|
||||
fireEvent.click(screen.getByRole('button', { name: translations.en.interviewAiGenerate }));
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenCalledTimes(1));
|
||||
view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>);
|
||||
await act(async () => view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>));
|
||||
await act(async () => finish({ data: { result: { text: 'Only for application seven' } } }));
|
||||
const assistant = within(screen.getByRole('region', { name: translations.en.interviewAiTitle }));
|
||||
expect(assistant.queryByText('Only for application seven')).not.toBeInTheDocument();
|
||||
@@ -368,7 +594,7 @@ test('completed AI suggestion is scoped to its application instead of becoming a
|
||||
await screen.findByText('Backend CV');
|
||||
fireEvent.click(screen.getByRole('button', { name: translations.en.interviewAiGenerate }));
|
||||
expect(await screen.findByText('Prepared for application seven only')).toBeVisible();
|
||||
view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>);
|
||||
await act(async () => view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>));
|
||||
const assistant = within(screen.getByRole('region', { name: translations.en.interviewAiTitle }));
|
||||
expect(assistant.queryByText('Prepared for application seven only')).not.toBeInTheDocument();
|
||||
expect(assistant.queryByRole('button', { name: translations.en.interviewAiAddToPrep })).not.toBeInTheDocument();
|
||||
@@ -385,7 +611,7 @@ test('late accepted suggestion does not reload the previous application board in
|
||||
await screen.findByText('Application seven suggestion');
|
||||
fireEvent.click(screen.getByRole('button', { name: translations.en.interviewAiAddToPrep }));
|
||||
await waitFor(() => expect(mockedApi.post).toHaveBeenCalledTimes(2));
|
||||
view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>);
|
||||
await act(async () => view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>));
|
||||
await waitFor(() => expect(mockedApi.get).toHaveBeenCalledWith('/jobapplications/8/interview-prep'));
|
||||
await act(async () => finish({ data: board.groups[0].items[0] }));
|
||||
expect(mockedApi.get.mock.calls.filter(([url]) => url === '/jobapplications/7/interview-prep')).toHaveLength(1);
|
||||
@@ -444,7 +670,7 @@ test.each(['en', 'nb'] as const)('changing application hides the previous linked
|
||||
mockedApi.get.mockImplementation((url: string) => url === '/jobapplications/8/cv' ? pending as any : read(url));
|
||||
const view = render(<ApplicationInterviewPrep jobId={7} />);
|
||||
await screen.findByText('Backend CV');
|
||||
view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>);
|
||||
await act(async () => view.rerender(<I18nProvider><ConfirmProvider><ApplicationInterviewPrep jobId={8} /></ConfirmProvider></I18nProvider>));
|
||||
const assistant = within(screen.getByRole('region', { name: translations[language].interviewAiTitle }));
|
||||
expect(assistant.queryByText('Backend CV')).not.toBeInTheDocument();
|
||||
expect(assistant.getByRole('progressbar', { name: translations[language].loading })).toBeVisible();
|
||||
|
||||
Reference in New Issue
Block a user