fix(rd21): retain draft revisions and qualify conflict recovery

This commit is contained in:
cesnimda
2026-10-23 12:34:34 +02:00
parent 12f342c09c
commit 05a738693e
53 changed files with 813 additions and 192 deletions
@@ -20,7 +20,10 @@ test("bound CV proposals use real owned saves and reject fabricated or stale out
const headers = await authenticate(request, "cv-ai-readiness@example.test");
expect((await request.post(`${providerUrl}/fixture/reset`)).status()).toBe(200);
const profile = { version: "1", contact: { fullName: "Native AI Fixture", headline: source }, summary: [source] };
expect((await request.put(`${apiUrl}/career/profile`, { headers, data: { profile } })).status()).toBe(200);
const canonicalRevision = (await (await request.get(`${apiUrl}/career/profile`)).json()).revision;
const canonicalSave = await request.put(`${apiUrl}/career/profile`, { headers, data: { profile, expectedVersion: canonicalRevision } });
expect(canonicalSave.status()).toBe(200);
const savedCanonicalRevision = (await canonicalSave.json()).revision;
const create = async (name: string) => {
const response = await request.post(`${apiUrl}/cv/variants`, { headers, data: { name, settings: { themeId: "minimal", language: "en", sections: [{ key: "summary" }] } } });
@@ -114,7 +117,7 @@ test("bound CV proposals use real owned saves and reject fabricated or stale out
const profileProposalResponse = await generate(staleProfileCv, "Fixture case: stale canonical profile.");
expect(profileProposalResponse.status()).toBe(200);
const profileProposal = await profileProposalResponse.json();
expect((await request.put(`${apiUrl}/career/profile`, { headers, data: { profile: { ...profile, summary: ["Newer canonical user content."] } } })).status()).toBe(200);
expect((await request.put(`${apiUrl}/career/profile`, { headers, data: { profile: { ...profile, summary: ["Newer canonical user content."] }, expectedVersion: savedCanonicalRevision } })).status()).toBe(200);
const newerProfile = await snapshot(staleProfileCv.id);
expect(newerProfile.variant.version).toBe(1);
const profileConflict = await apply(staleProfileCv.id, profileProposal.proposalToken);
@@ -147,7 +150,8 @@ test("Production withholds CV review before provider calls or content writes whi
expect((await request.post(`${providerUrl}/fixture/reset`)).status()).toBe(200);
const profile = { version: "1", contact: { fullName: "Production Gate Fixture", headline: source }, summary: [source] };
expect((await api.put(`${productionUrl}/career/profile`, { headers, data: { profile } })).status()).toBe(200);
const canonicalRevision = (await (await api.get(`${productionUrl}/career/profile`, { headers })).json()).revision;
expect((await api.put(`${productionUrl}/career/profile`, { headers, data: { profile, expectedVersion: canonicalRevision } })).status()).toBe(200);
const created = await api.post(`${productionUrl}/cv/variants`, { headers, data: { name: "Withheld AI review", settings: { themeId: "minimal", language: "en", sections: [{ key: "summary" }] } } });
expect(created.status()).toBe(200);
const cv = await created.json();