Skip to content

OpenConceptLab/ocl_online#776 | Seeded references keep HEAD's last resolved time instead of stamping now - #1070

Merged
snyaggarwal merged 4 commits into
masterfrom
ocl_online-776-seed-last-resolved
Nov 26, 2026
Merged

snyaggarwal merged 4 commits into
masterfrom
ocl_online-776-seed-last-resolved

Conversation

@snyaggarwal

Copy link
Copy Markdown
Contributor

Fixes OpenConceptLab/ocl_online#776.

What changed
Collection.seed_references now copies each HEAD reference's last_resolved_at onto its clone in the new version. Before, it stamped timezone.now().

Why
Seeding only copies the reference and its member sets. It never resolves anything, so stamping "now" claimed a resolve that didn't happen. A reference that was dead or empty in HEAD (last_resolved_at=None) showed "last resolved just now" in the new version, which hid exactly the references that need attention. A real resolve still sets the value honestly, for example the write-back in Expansion.add_references.

Tests

  • test_seed_references_copies_head_last_resolved_at: a resolved HEAD reference keeps its timestamp, and an unresolved one stays None in the new version.

Focused pylint on the changed files passes (exit 0). The local Docker stack is down, so the tests haven't run locally. This relies on CI's Tests job.

🤖 Generated with Claude Code

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: approve with nits

No significant issues.

  • Callers: both production callers were traced: core/common/tasks.py, and seed_from_head_expansion_in_snapshot.
    • With the lock toggle on, the default expansion's write-back in add_references re-stamps resolved and unresolved references honestly afterwards.
    • With it off, the copied HEAD value is final, the same as HEAD's own value.
  • Consumers: nothing reads last_resolved_at beyond the serializer, which already allows None. Health and FHIR don't use it.
  • The new test is sound: clone(last_resolved_at=...) passes the value explicitly, so default=timezone.now doesn't apply, and save() doesn't call clean(). It fails before the change and passes after it.
  • Imports: the new timezone and timedelta imports in tests.py don't clash with anything.

Nits

  • The comment "one HEAD never resolved stays unresolved" reads oddly. Suggested: "copied, not resolved here: a reference HEAD never resolved stays unresolved".
  • FYI: on the toggle-off auto-expand path, a version's references now show HEAD's resolve date, not the version's creation date. This is intended, but it will look different in the UI.

@snyaggarwal

Copy link
Copy Markdown
Contributor Author

Fixed in 90a16b8: the comment now reads "copied, not resolved here: a reference HEAD never resolved stays unresolved".

@snyaggarwal
snyaggarwal marked this pull request as ready for review November 25, 2026 12:26
@snyaggarwal
snyaggarwal requested a review from paynejd November 25, 2026 12:26

@snyaggarwal snyaggarwal left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review round 2 (Expansion Health epic, reviewed with #1069 and #1071–#1073): approve

The round-1 nit (comment wording) is fixed in 90a16b8, and the master merges are clean.

Checked, no issue

  • No conflict with the other four API PRs. It merges cleanly onto #1069, #1071 and #1072 together.
  • last_resolved_at copied from HEAD composes with #1069: neither reads the other's field.
  • The toggle-off auto-expand path shows HEAD's resolve date, as noted in round 1. That's intended.

CI: Pylint and Tests pass. Nothing open.

@paynejd paynejd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review lead (Claude, for Jon), round 1

Verdict: APPROVE (head d94704c)

Reviewed against OpenConceptLab/ocl_online#776 and its two acceptance criteria. Both are met.

Earlier points

  • Comment wording on seed_references (round 1 nit): met. It now reads "copied, not resolved here: a reference HEAD never resolved stays unresolved" (core/collections/models.py:326).
  • Toggle-off auto-expand path shows HEAD's resolve date (FYI): accepted. It is intended, and nothing reads last_resolved_at beyond the serializer, which allows None.

This review

  • seed_references copies reference.last_resolved_at through clone(...), so an unresolved HEAD reference stays None in the new version. This is the ticket's fix, with no side effects on members or health.
  • test_seed_references_copies_head_last_resolved_at checks both cases (a dated reference keeps its date, an unresolved one stays None) and would fail on the old timezone.now() stamp.
  • A real resolve still sets the value honestly (add_references writes it back at models.py:2207-2208), so the copy is only the starting value.
  • It merges cleanly with #1069, #1071 and #1072 in any order I tried, and none of them reads or writes this field.
  • A Codex defect pass found nothing.

CI: Pylint and Tests pass.

@snyaggarwal
snyaggarwal merged commit bc3bd00 into master Nov 26, 2026
3 checks passed
@snyaggarwal
snyaggarwal deleted the ocl_online-776-seed-last-resolved branch November 26, 2026 01:56
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