[editor-core] accept the legacy source_project_display_name on project_file (#36837)

GitOrigin-RevId: bebbba328ecdd04ac4df06f66e6b0b1f8a41276f
This commit is contained in:
Anna Claire Fields
2026-09-17 12:03:05 +00:00
committed by Copybot
parent 6590b33321
commit 285bcd4315
2 changed files with 15 additions and 0 deletions
@@ -105,6 +105,10 @@ const rawLinkedFileData = z.discriminatedUnion('provider', [
source_project_id: zz.objectId().optional(),
v1_source_doc_id: z.number().optional(),
source_entity_path: z.string(),
// written by the linked-file agents until 2018 (removed in ebe828aa625)
// and never since; still present in the history of projects that linked a
// file before then, so it has to be tolerated when replaying changes.
source_project_display_name: z.string().optional(),
importedAt: z.iso.datetime().optional(),
}),
z.strictObject({
@@ -111,6 +111,17 @@ describe('schemas', function () {
expect(result.success).to.equal(true)
})
it('accepts a project_file provider with a legacy display name', function () {
const result = rawLinkedFileData.safeParse({
provider: 'project_file',
v1_source_doc_id: 1234,
source_entity_path: '/main.tex',
source_project_display_name: 'My linked project',
importedAt: '2017-05-04T00:00:00.000Z',
})
expect(result.success).to.equal(true)
})
it('rejects a project_file provider with a malformed source_project_id', function () {
const result = rawLinkedFileData.safeParse({
provider: 'project_file',