Skip to content

Scoped field updates and context initialization issue#346

Merged
rtibbles merged 4 commits into
learningequality:release-v0.8.xfrom
bjester:tidy-the-strawberry-fields
Jul 9, 2026
Merged

Scoped field updates and context initialization issue#346
rtibbles merged 4 commits into
learningequality:release-v0.8.xfrom
bjester:tidy-the-strawberry-fields

Conversation

@bjester

@bjester bjester commented Jul 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Scopes model saves to TransferSession and SyncSession to only the fields that should have changed
  • Adds regression test and fixes context initialization issue that could result in is_push of None when TransferSession.push is False

TODO

  • Have tests been written for the new code?

Reviewer guidance

The tests passed with the scoped changes, and the regression test covers the context bug. Is that sufficient?

The context bug is more important in the context of Kolibri's sync-extras-plugin, since it was passing in a hardcoded value to is_push

Kolibri's morango integration tests pass with these updates.

Issues addressed

Related to this investigation:

AI Usage

AI found the issue in the SessionContext.

@bjester bjester requested a review from rtibblesbot July 8, 2026 23:45
@rtibblesbot

rtibblesbot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🔵 Review posted

Last updated: 2026-07-08 23:54 UTC

@rtibblesbot rtibblesbot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

PR #346 scopes sync-stage save() calls to update_fields and fixes the SessionContext.is_push coercion bug. The context fix and its regression test are clean, but one update_fields list drops fields the same code path assigns.

  • blockingvalidate_and_create_buffer_data no longer persists bytes_sent/bytes_received locally (inline).
  • nitpick — a few update_fields lists include fields the branch doesn't always mutate (operations.py:1112 server_fsic on the client branch; operations.py:1504 records_total on push; core.py:336 both stage fields). Harmless since in-memory equals persisted, but if the goal is strict scoping they could be narrowed. Not worth changing on their own.
  • suggestion — no test pins the "only these fields are written" contract; a future edit that mutates a field but forgets to extend update_fields would silently regress with no failure. The is_push fix is well-tested; consider a targeted test that mutates a field out-of-band and asserts a scoped save leaves it intact.

CI: the plain unit-test matrix was pending and the app-token check is failing (unrelated permissions step, not this diff) — hence COMMENT-level CI, but the byte-accounting bug drives REQUEST_CHANGES.


@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly

How was this generated?

Ran a phased review pipeline over the pull request diff:

  • Classified the diff to select review passes (core, frontend, backend) and whether manual QA was required
  • Core review pass checked correctness, design, architecture, testing, completeness, and DRY/SRP/Rule-of-Three principles
  • Specialized frontend/backend review passes applied framework-specific lenses where those files changed
  • For UI changes: manual QA and an accessibility audit against a live dev server, when available
  • Checked CI status and linked issue acceptance criteria
  • Synthesized one review from those passes and chose the verdict from the findings, CI status, and QA evidence

Comment thread morango/sync/utils.py Outdated
@bjester bjester force-pushed the tidy-the-strawberry-fields branch from 589deea to f2f513c Compare July 9, 2026 00:10

@rtibbles rtibbles 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.

Changes make sense and align with the PR description.

@rtibbles rtibbles merged commit 635f8d9 into learningequality:release-v0.8.x Jul 9, 2026
24 checks passed
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.

3 participants