Skip to content

feat: article version history with abstract/title diff#162

Open
xenacode-art wants to merge 10 commits intom2b3:testfrom
xenacode-art:feat/article-version-diff
Open

feat: article version history with abstract/title diff#162
xenacode-art wants to merge 10 commits intom2b3:testfrom
xenacode-art:feat/article-version-diff

Conversation

@xenacode-art
Copy link
Copy Markdown

Closes #159

Adds version tracking for articles so users can see what changed between edits (title and abstract diffs).

Changes

articles/models.py

  • New ArticleVersion model — stores title, abstract, version number, and created_at for each edit

articles/api.py

  • update_article() now snapshots the current title+abstract into ArticleVersion before overwriting
  • New endpoint: GET /articles/{article_id}/versions — returns a list of versions, each with a unified diff for title and abstract
    (uses Python stdlib difflib)

articles/schemas.py

  • New ArticleVersionDiffOut schema with version, created_at, title_diff: List[str], abstract_diff: List[str]

articles/migrations/0034_articleversion.py

  • Migration to create the ArticleVersion table

Example response

[
  {
    "version": 1,
    "created_at": "2026-03-26T10:00:00Z",
    "title_diff": ["--- ", "+++ ", "@@ -1 +1 @@", "-Old Title", "+New Title"],
    "abstract_diff": ["--- ", "+++ ", "@@ -1,2 +1,2 @@", "-Old abstract text.", "+Updated abstract text."]
  }
]

Test plan

- Edit an article via PUT /articles/{id} and confirm an ArticleVersion row is created
- Call GET /articles/{id}/versions and verify the diff output is correct
- Confirm articles with no edits return []
- Confirm 404 is returned for unknown article IDs

armanalam03 and others added 10 commits December 14, 2025 20:23
Sync Alphatest with Test
Sync Main with AlphaTest
Sync test with alphatest
Sync main with Alphatest
Sync AlphaTest with Test
Sync Main with Alphatest
change MAX_COMMUNITIES_PER_USER to 40
change MAX_COMMUNITIES_PER_USER to 40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants