Repository navigation
Bind hook queue-full overflow hooks to Python - #15
Merged
LeStarch merged 8 commits intoOct 29, 2026
Merged
Conversation
Model each overflow hook as a HandlerView so the existing generators emit the forwarding C++ override and the Python stub; drop the unsupported-feature rejection. Co-authored-by: M Starch <LeStarch@googlemail.com>
LeStarch
approved these changes
Oct 29, 2026
F Prime drops an overflowed command unanswered, so the template's command hook sends BUSY; hook kinds read as '<member kind> overflow hook'. Co-authored-by: M Starch <LeStarch@googlemail.com>
Hooks.fpp fixture covers async input port, internal port and async command hooks, and a drop port that gets none; Config.fpp gains command port stand-ins. Co-authored-by: M Starch <LeStarch@googlemail.com>
Co-authored-by: M Starch <LeStarch@googlemail.com>
The generated init checks the Python object implements every overflow hook, so a missing one fails at startup instead of at the first overflow on the caller's thread. OverflowHookView derives its own name and generated comment. Co-authored-by: M Starch <LeStarch@googlemail.com>
Cover the GIL taken by each hook, the init check, an async command without hook, and avoid the 'msg' name that shadows a local in F Prime's internal port invoke. Co-authored-by: M Starch <LeStarch@googlemail.com>
Co-authored-by: M Starch <LeStarch@googlemail.com>
…e throwing Looking the hook up on the class keeps the base class's fall-through to the C++ object from satisfying it; releasing m_self first keeps it from outliving the interpreter when teardown is skipped. Pin the generated hook comments in the tests and rewrap long docstrings. Co-authored-by: M Starch <LeStarch@googlemail.com>
LeStarch
approved these changes
Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Binds FPP
hookqueue-full behavior to Python. When a component's queue is full, F Prime calls an overflow hook instead of queuing the message; this PR generates the C++ override that forwards each hook into Python plus a Python template stub.async input port p: P hookp_overflowHookportNum+ port argsinternal port i(...) hooki_overflowHookasync command C(...) hookC_cmdOverflowHookopCode,cmdSeqonlyChanges
view.py:OverflowHookView, a syntheticHandlerViewfor each hooked member, appended toComponentView.handlers, so the existing generators emit the forwarding override and stub unchanged. The old "hookunsupported" rejection is removed.component_generator.py: the generatedinitthrowspybind11::attribute_errorat startup if the Python class lacks any overflow hook (hooks only run on overflow, so a missing one would otherwise surface on the caller's thread at the worst moment). The lookup is on the class (so the base class's fall-through to the C++ object cannot satisfy it) andm_selfis released before throwing. The command-hook template stub answersBUSY, since F Prime drops an overflowed command unanswered.README.md: new "Queue-Full Overflow Hooks" section (naming, arguments, caller-thread/GIL cost, concurrency, buffer ownership, command response, exceptions);hookremoved from the unsupported-features table.tests/fixtures/Hooks.fpp+ command stand-ins intests/fixtures/Config.fpp; generator tests for hook signatures, GIL acquisition, Python stubs, the init check, and no hook fordrop/unhooked members.FprimePython/PythonRateGroupDriver/docs/sdd.md) covers the rate-group driver, not the autocoder; the README is the autocoder's design doc.Not in scope
Validation
mypy(strict) clean;pytest tests13/13.hookonPythonGc.referenceTrackedand a hooked internal port: builds; integration tests 4/4; flooding a 10-deep queue with 64 internal messages called the Python hook 54 times.referenceTracked_overflowHookremoved from the Python class:setupraisesPythonGc does not implement overflow hook referenceTracked_overflowHook. The referencefsw_main.pythen callsteardownon the half-built topology, which asserts inBufferManager::cleanup(m_buffers != nullptr); that happens after anysetupfailure and is outside this PR.Co-authored-by: M Starch LeStarch@googlemail.com