Skip to content

Need a performant solution to find content diffs between non-adjacent repo versions #7831

Description

@acheng-01

Is your feature request related to a problem? Please describe.
There is no efficient way to compute the net content difference between two non-adjacent repository versions over the REST API.

The existing repository_version_added / repository_version_removed filters only diff a version against its immediate predecessor (a single step). When two versions of interest are not adjacent — for example, two versions that were each published but have other versions created in between — there is no direct way to ask "what content is in version X but not in version Y."

The current workaround is a q= expression filter such as: q=repository_version=<X> AND NOT repository_version=<Y>

On large repositories this is expensive and puts significant load on the database, because the NOT clause is evaluated against the full content set rather than scoped to the change between the two versions.

Describe the solution you'd like
Some way to retrieve the net diff between two arbitrary repository versions where the cost scales with the size of the change rather than the size of the repository. A couple of directions that could work:

• Exposing each version's content unit IDs so clients can fetch two versions and diff the sets themselves
• A base_version parameter on the content filters — allow repository_version_added / repository_version_removed to take a base_version, so the added/removed set is computed between the two specified versions instead of only against the immediate predecessor. This would build on the existing RepositoryVersion.added() / removed() methods, which already accept a base_version argument at the model level. Omitting it would preserve today's single-step behavior.

Describe alternatives you've considered

  • Filtering content by repository_version and diffing via q=

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions