[ranges-tracker] add legacy orderedRejections field in tracked-changes (#36565)

* [docstore] use more realistic test stubs for ranges

* [monorepo] define ranges schemas in @overleaf/ranges-tracker

* [ranges-tracker] add legacy orderedRejections field in tracked-changes

* [monorepo] resolve @overleaf/ranges-tracker subpath imports in typescript

* [real-time] validate comment thread ids and tracked change id seeds

* [ranges-tracker] require ObjectId ids and tracked change metadata in ranges

* [monorepo] require ObjectId tracked change ids on the accept routes

* [web] use ObjectId comment thread ids in the DocumentController tests

GitOrigin-RevId: 58b20dec311d85b917ef63f9efbe745a265a2de6
This commit is contained in:
Jakob Ackermann
2026-09-17 12:01:19 +00:00
committed by Copybot
parent 833e44d142
commit 4e80d65efc
23 changed files with 501 additions and 383 deletions
@@ -1,7 +1,7 @@
const { expressify } = require('@overleaf/promise-utils')
const { parseReq, z, zz } = require('@overleaf/validation-tools')
const editorCoreSchemas = require('overleaf-editor-core/lib/schemas')
const schemas = require('./schemas')
const rangesSchemas = require('@overleaf/ranges-tracker/schemas')
const DocumentManager = require('./DocumentManager')
const HistoryManager = require('./HistoryManager')
const ProjectManager = require('./ProjectManager')
@@ -487,15 +487,14 @@ async function deleteMultipleProjects(req, res) {
res.sendStatus(204) // No Content
}
// tracked-change ids are RangesTracker ids (seed + increment), not ObjectIds
const acceptChangesSchema = z.object({
params: z.strictObject({
project_id: zz.objectId(),
doc_id: zz.objectId(),
change_id: z.string().min(1).optional(),
change_id: zz.objectId().optional(),
}),
body: z.strictObject({
change_ids: z.array(z.string().min(1)).optional(),
change_ids: z.array(zz.objectId()).optional(),
}),
})
@@ -610,7 +609,7 @@ const addUpdateSchema = z.strictObject({
id: zz.objectId(),
pathname: zz.safePath(),
docLines: z.string().optional(),
ranges: schemas.ranges.optional(),
ranges: rangesSchemas.ranges.optional(),
historyRangesSupport: z.boolean().optional(),
// legacy filestore url for files without a created blob
url: z.string().nullish(),