Repository navigation
docs(protocol): threading, lifecycle and config contracts match the host - #235
Merged
Merged
Conversation
facontidavide
force-pushed
the
docs/contract-text-matches-host
branch
from
November 13, 2026 23:19
d69195c to
e620dae
Compare
Comments and Markdown only; no code token changes.
- Normative per-slot threading tables for the DataSource and Toolbox vtables,
derived from what the host does: a stream's start runs on the GUI thread, a
file import's on a worker; set_active_topics runs concurrently with poll;
[stream-thread] host slots are callable only inside start, poll or stop.
- notify_state, pause, resume, current_state and on_data_changed are documented
as advisory. The lifecycle is described by the signals the host acts on.
- save_config/load_config state the real contract: a JSON object, the keys the
host writes into it, and load_config("") on a first run.
- The two toolbox-host tail slots a comment called unimplemented are
implemented by the host and are retagged.
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
facontidavide
force-pushed
the
docs/contract-text-matches-host
branch
from
November 13, 2026 23:22
e620dae to
8b57afe
Compare
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.
What
Comments and Markdown only. The written DataSource and Toolbox contracts are brought in line with what the reference host (PlotJuggler 4) does, before 1.0 freezes them. No code token changes: for each of the six edited headers, the comment-stripped preprocessor output is byte-identical before and after.
1. Threading
A normative per-slot table on
PJ_data_source_vtable_tandPJ_toolbox_vtable_t, with the guides,REQUIREMENTS.mdandARCHITECTURE.mdmade to agree. What was wrong before:start/stopwere tagged[main-thread]. In the host, a file import'sstartruns on a worker and a stream'sstartruns on the GUI thread;stopruns on the poll worker.set_active_topicsruns on the GUI thread concurrently withpoll.[thread-safe].register_object_topic_on_datasetandset_object_topic_retention. The host implements both.Two tags change, and tags are normative, so please check them:
show_message_box:[main-thread]→[thread-safe]. Its own text already said "may call from any thread".current_state:[thread-safe]→[main-thread]. The SDK base classes keep a plain, non-atomic state written bystart/stop.One rule is kept on purpose: a plugin must not call
[stream-thread]host slots from a thread of its own afterstartreturns. The host's poll worker callsflushPending()after every poll, which walks a map the host itself documents as unsynchronised.2. Advisory slots
notify_state,pause,resume,current_stateandon_data_changedare documented as advisory: the host has an emptynotify_state, pauses host-side through write targets, and never calls the other four. The "MUST callnotifyState" rule and the six-state machine are replaced by the signals the host acts on: thestartandpollresults,request_stop,is_stop_requestedandcomplete_ingest. The loader's required-slot rule is not changed.3. Config persistence
save_config/load_confignow state the real contract: a UTF-8 JSON object; the keys the host writes into it (filepath,_parser_config,__pj_saved_filepath) and the one the plugin writes for the host (__pj_fanout);load_config("")on a stream's first run. Passages aboutConfigEnvelopeare untouched here; #231 removes them.Open questions this could not settle from code
on_data_changed: is "the host never calls it" intended, or a host bug?toolbox_quaternionrelies on it to reinstall its node when a layout loads before its data, andtoolbox_fftto invalidate stale results. The text says "do not rely on it".load_config; a file layout storessave_configoutput.set_object_topic_retentionis documented to return false on a bad handle; the host returns true and ignores it. Not edited here._key prefix is reserved for the host in the new text. The host only uses_parser_configtoday.StreamSourceBase::startdoes not callonStop()whenonStart()fails, and the host destroys withoutstopafter a failed start, so threads spawned before the failure can leak. Documented; a base-class fix would be a code change.Verification
No build is needed (comments and Markdown).
pre-commit(clang-format 22) is clean. Rebased ontomainafter the 1.0.0-dev.1 commit.🤖 Generated with Claude Code