Skip to content

Dequeue transferred records using an explicit database handle - #421

Open
srikar-naidu wants to merge 2 commits into
learningequality:dequeue-records-366from
srikar-naidu:dequeue-records-366
Open

srikar-naidu wants to merge 2 commits into
learningequality:dequeue-records-366from
srikar-naidu:dequeue-records-366

Conversation

@srikar-naidu

@srikar-naidu srikar-naidu commented Nov 11, 2026 •

Copy link
Copy Markdown

Summary

Passes a required database handle through dequeue and legacy self-referential ordering, so SQL, transactions, and instance counter updates use the selected database.

Adds SessionContext.db, defaults it to routed access, and restores the default handle after unpickling. The receiver operation passes this handle to dequeue.

Closes #366 and #365.

TODO

  • Added tests for the new code
  • Updated code docstrings
  • No new dependencies required

Reviewer guidance

This PR targets dequeue-records-366.

Following Task 5, DatabaseMaxCounter.update_fsics() remains unchanged for #367. The pinned tests mock that helper while checking dequeue SQL, counters, ordering, and rollback under assert_no_default_db_queries() with routers disabled. Full pinned FSIC routing therefore still depends on #367. If that work should be included here, I can adjust the scope.

Verification completed locally:

  • All 99 context and operation tests passed.
  • All four unchanged async and legacy network characterization tests passed.
  • Repository hooks passed.
  • The broader run reported two timestamp failures in unchanged TransferSession tests on Windows. Both passed on rerun.
  • PostgreSQL was not run locally.

Issues addressed

Addresses #366, with FSIC helper routing deferred to #367 as specified in Task 5.

Documentation

Updated the SessionContext and dequeue docstrings. No separate documentation files were added.

AI usage

I used Codex as a coding assistant for implementation, test generation, and running checks. I provided the issue requirements and maintainer’s instructions, discussed the proposed approach, and evaluated the scope decision around FSIC routing. I chose to keep that work in #367 according to Task 5 and document the limitation for the reviewer. I also used the lessons and review feedback from my previous contribution to guide this PR.

@srikar-naidu
srikar-naidu requested review from a team and leq-bot November 11, 2026 14:51
@learning-equality-bot

Copy link
Copy Markdown
Contributor

👋 Hi @srikar-naidu, thanks for contributing!

For the review process to begin, please verify that the following is satisfied:

  • Contribution is aligned with our contributing guidelines

  • Pull request description has correctly filled AI usage section & follows our AI guidance:

    AI guidance

    State explicitly whether you didn't use or used AI & how.

    If you used it, ensure that the PR is aligned with Using AI as well as our DEEP framework. DEEP asks you:

    • Disclose — Be open about when you've used AI for support.
    • Engage critically — Question what is generated. Review code for correctness and unnecessary complexity.
    • Edit — Review and refine AI output. Remove unnecessary code and verify it still works after your edits.
    • Process sharing — Explain how you used the AI so others can learn.

    Examples of good disclosures:

    "I used Claude Code to implement the component, prompting it to follow the pattern in ComponentX. I reviewed the generated code, removed unnecessary error handling, and verified the tests pass."

    "I brainstormed the approach with Gemini, then had it write failing tests for the feature. After reviewing the tests, I used Claude Code to generate the implementation. I refactored the output to reduce verbosity and ran the full test suite."

📢✨ Before we assign a reviewer:

  • @rtibblesbot will pre-review this pull request. Its comments are generated by an LLM, and should be evaluated accordingly.
  • We'll also invite community pre-review. See the community review guidance for both authors and reviewers.

Also check that issue requirements are satisfied & you ran pre-commit locally.

Pull requests that don't follow the guidelines will be closed.

Reviewer assignment can take up to 2 weeks.

📎 We couldn't find an issue linked to this pull request. Please edit the description and link one under References, for example Fixes #123 or Closes #123. A plain #123 mention doesn't link the PR to the issue.

@bjester bjester self-assigned this Nov 11, 2026
@bjester
bjester changed the base branch from release-v0.9.x to db-handle-365 November 11, 2026 23:27
@bjester
bjester changed the base branch from db-handle-365 to dequeue-records-366 November 11, 2026 23:27
@bjester

bjester commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Just a note, postgres CI failure is unrelated. I've addressed it and we'll wrangle the rebasing this week. I'll let you know. Thank you!

@bjester
bjester force-pushed the dequeue-records-366 branch from 472eee2 to c046879 Compare November 13, 2026 19:41
@bjester

bjester commented Nov 13, 2026

Copy link
Copy Markdown
Member

HI @srikar-naidu, you can rebase on top of dequeue-records-366 now.

Pass the context database through dequeue SQL, counter updates, and legacy ordering. Restore routed default handles after context pickling. Keep FSIC helper routing for Task 6 (learningequality#367), as specified by Task 5.
@srikar-naidu

Copy link
Copy Markdown
Author

Including #365 in description because its implementation was merged in #419, but that PR didn’t contain a closing keyword, so the issue remained open.

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