Skip to content

Preserve descendant subtrees when reprioritizing - #152

Draft
AryanRG wants to merge 1 commit into
python-hyper:masterfrom
AryanRG:fix/preserve-descendant-subtree
Draft

AryanRG wants to merge 1 commit into
python-hyper:masterfrom
AryanRG:fix/preserve-descendant-subtree

Conversation

@AryanRG

@AryanRG AryanRG commented Oct 16, 2026 •

Copy link
Copy Markdown

Reprioritizing a stream beneath one of its descendants currently promotes the descendant's children to its old parent while leaving them in the descendant's child list and scheduling queue. In RFC 7540 section 5.3.3, Figure 5, moving A beneath D incorrectly leaves F attached to C instead of D. Exclusive reprioritization also leaves duplicate child ownership.

Pass strip_children=False when moving the descendant to avoid the cycle. This preserves the subtree until the existing exclusive/nonexclusive insertion logic runs. The regression covers direct and indirect descendants, both exclusive modes, parent pointers, child lists, scheduling queues, and scheduling output.

Validation:

  • Unchanged base 532ace514de40ebf9a9c0a4418cbfb0e72c8f7a4: 170 tests passed with 100% coverage; all four new regression cases fail against that base.
  • Fixed: 174 tests passed on Python 3.10.22 and 3.14.4, both with 100% statement and branch coverage.
  • Flake8, mypy 0.910 with the repository's pytest <7 constraint, Sphinx HTML build, check-manifest, sdist/wheel builds, and twine check passed.
  • Black 26.10.1 still flags existing blank lines in src/priority/__init__.py and the imports in test/test_priority.py; the same formatting failures reproduce on the unchanged base. No added lines are flagged. The remaining interpreter matrix was not run locally. Hosted CI is awaiting maintainer approval; no hosted jobs have run.

AI assistance was used to prepare implementation and regression tests.

Keep the moved descendant attached to its own children during cycle avoidance, as required by RFC 7540 section 5.3.3. Cover direct and indirect descendants with exclusive and nonexclusive dependencies, including child-list and queue consistency.

Generated with OpenAI Codex and independently reviewed by a native AI agent. No human review or certification is claimed.
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