Document versions, and the versioning mode an organization chooses

Featurekamo-shared-library
Shipped
September 11, 2026 at 3:02 AM UTC
Author
Kamo
Commit
6d0523e

Documents were two records: the upload, which nothing edited, and one modified copy derived the first time anyone opened it to edit. Members found the pair confusing, and it fitted nobody's actual rules - one organization wants every edit kept, another wants one copy and no history, a third wants to freeze a state on purpose and keep working on top of it. A document is one record now, and what happens to its previous content when it changes is a versioning mode chosen per organization (img_org_assoc.versioning_mode) and per document category **************** which wins): - DISABLED: the change overwrites. One copy, no history. - AUTO: every change is the next version and the old one is kept. One classic-editor session is one version however often it autosaves; one member's template-layer saves within ten minutes are one version too. - MANUAL: changes overwrite a working copy on top of the last snapshot; a member snapshots to keep a state permanently and carries on editing on top of it. The upload is the first snapshot. Unset everywhere, a category is AUTO - the only mode that loses nothing, as the model it replaces never lost an upload. A category whose documents are records (overwrite off and not settable, e.g. Patient Charts) is locked to AUTO. - ImgVersion / img_versions: a version is a POINTER to the content-addressed img_dats row the document held, plus the template-layer design version on a template. Keeping one costs nothing until the bytes move on without it. - DocumentVersioningService: the one write path for "this document's content changed" - applyContentChange, recordTemplateLayerChange, snapshot, restore, recordBranch - so the modes mean the same whether the change came from a classic save (DocsService), a new upload over the document (ConversionService) or a template layer save (ESigService). Versions are written lazily: a document that never changed has none, and the first kept change writes v1 from the state before it, so an organization can turn versioning on at any time with no backfill. Restoring is itself a new version under AUTO; history is never rewritten. The e-sign repositories are ObjectProviders, since not every service scans them (SharedLibBeanSafetyTest). - Img.isTemplate() over the existing has_form_layer flag, and isRetiredDerivedCopy() for the classic copies the old model left behind, which no listing shows again. - **************** for version pills on a page of templates in one query. - **************** is public, so a new version meets its first upload's rule. The schema is **************** in docsservice, applied to the cluster before this commit: img_org_assoc is read on every upload, so the column had to exist first.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing