Repository navigation
Revert "Fix tap interface numbering" - #17
Merged
Merged
Conversation
anrl
added a commit
that referenced
this pull request
Sep 9, 2026
Found auditing the Traps & Interrupts Lab. TrapLab fired-and-forgot its poll and catch threads, guarding only with `if not self._closed` before the emit. That guard is check-then-act: a worker already past it can emit into a dialog being destroyed. Two ways to die — a deleteLater() path destroys the dialog under the in-flight emit, or the worker's closure over `self` is the LAST reference and the QObject is destroyed ON the worker thread when the closure dies. Both undefined in Qt, both a segfault, nondeterministic, which is why it hid. Not just a test artifact. MachineLab._retire() runs setParent(None) + deleteLater() after looking up stop_polling() — and TrapLab never had one, so the join the rest of the codebase relies on was silently skipped. Re-opening the Traps card, or closing the Machine Lab with a catch in flight, was a gBuilder segfault path. Root-caused by isolation rather than inspection: making every worker synchronous (no production change) took the crash from 1-2 per 20 two-module test runs to 0/20, and the fatal trace put the main thread in the Qt event flush with a worker mid-emit(). The pre-change test file crashes at the same rate, so it is pre-existing, not introduced by the recent journey work. Fix reuses the remedy already in the tree for the Memory and File System faces: - TrapLab adopts LivePollMixin — _closed set FIRST, worker joined in stop_polling(), which closeEvent calls and _retire() now finds. - The one-shot catch worker can block for the agent's whole wait (~10s), too long for a full join, so it holds a weakref to the dialog plus a bounded join: a straggler can neither emit into a dead dialog nor become its last owner. - _fetch/_apply become the mixin's _read/_render_live, which also gets the Traps face backoff and "a bad read never blanks a good picture" for free. Verified three ways: 0/40 crashes on the pair that failed 1-2 in 20; the production _retire-mid-catch path observed to block for the catch's duration (it joins) and survive with zero leaked threads; and a new regression test the suite-wide _no_leaked_threads fixture enforces. Full suite green: 3336 passed. Documented as known issue #17 — rewritten from a MachineLab-specific note into the CLASS of bug, since ~18 UI files carry the same shape (machine_lab, main_window, router_lab, inspector, assistant, ...). It needs three ingredients to crash and most dialogs are Qt-parented, which is why it was not an epidemic; the entry has the mechanism, the proof, a census, and the rule for new faces. live_poll.py points at it, since that is where someone adding a background read will be reading. The face-by-face sweep is deliberately NOT bundled here. Also records the audit findings elected to skip (#12-#16): the single-threaded agent stall, the catch probe being itself a device interrupt (accurate trap, inaccurate attribution), the full-ring dump per poll, three memory-ordering nits moot on QEMU, and the kernel-mode/bystander narration deferred with C-11. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NUSXZZotxcPLhjvgvQwZnY
mohd-adnaan
added a commit
that referenced
this pull request
Sep 10, 2026
…y overlap Fifty commits and seven tags had landed upstream since this branch was cut, with no local sign of it: git status said clean, and the only tell was PyPI's gini-core sitting four minor versions ahead of the newest local tag. One conflict, and it is the interesting part. 39ef5c8 shows Mahesh's session found the SAME widget bug independently, root-caused it more rigorously than I did — isolation rather than inspection, 0/20 crashes with the workers made synchronous — and wrote it up as known issue #17, as a CLASS of bug across ~18 files rather than one lab. Their remedy is LivePollMixin: `_closed` set first, and the worker JOINED in stop_polling(), with a weakref plus bounded join for the one-shot catch that can block ten seconds. Their fix is better than mine where the two meet, so trap_lab.py here is now byte-for-byte theirs. A join is a guarantee. It also closes the death mode run_off_gui does not: an emit() into a dialog that deleteLater() is destroying, where C++ teardown ignores the Python reference I pin. I had dismissed the weakref approach in an earlier message; theirs is not a bare weakref, and the join is the part I did not think of. What this branch still carries is the sweep — which #17 says is needed and which that commit deliberately did not bundle. It now covers 74 sites including three that arrived with the merge, and the threads are named after their owner so upstream's new _no_leaked_threads fixture can say which face leaked instead of "Thread-47". It is a floor under the unconverted faces, not a substitute for #17's rule, and CLAUDE.md now says so in those words. Whether it merges as-is or gets redone in the LivePollMixin idiom is a call for Mahesh, not for me. Every count in CLAUDE.md and ARCHITECTURE.md re-derived afterwards, because merging fifty commits invalidated all of them: 2,956 → 3,389 tests, 71 → 72 domain modules, 58 → 62 ui modules, 8 → 17 known issues. Both files now carry a note telling the reader to re-derive rather than cite, and the workflow comment no longer hard-codes a pass count — a number in a comment is a lie with a timestamp on it. Suite on the merged tree: 3369 passed, 20 skipped, 0 failed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
anrl
added a commit
that referenced
this pull request
Sep 10, 2026
…ones
The entry read as though the whole class threatened gBuilder. Measured, it does
not. Of the instances checked, exactly one was ever a production crash — the
Traps face, where _retire() destroyed a dialog with a catch in flight — and it
is fixed. The two found since are test-harness artifacts, established by
experiment rather than by reading the code:
* SourceBrowser crashed 5/5 for two Qt test modules in the wrong order; given
the shape production uses (parented and kept alive, as MainWindow does with
self.source_browser, built once and never destroyed) the same run is 0/5. It
needs parent=None and being dropped without closing, which only tests do.
* MachineLab, driven through the real _retire_lab() sequence against a
genuinely in-flight read, SURVIVED with no threads leaked. Reopening the
Machine Lab mid-read does not crash gBuilder.
Two things stay true and are worth fixing at leisure, neither user-facing: the
suite's green is order-dependent (those pairs fail every time in that order, and
only alphabetical collection saves the full run — which can abort a release on a
segfault unrelated to the release), and MachineLab still has no stop_polling, so
_retire_lab finds nothing to call and relies on a closeEvent disconnect winning
a race where its own docstring says a join belongs.
Recorded so the next reader does not infer a production crash from a test crash,
which is the inference I made and had to walk back.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NUSXZZotxcPLhjvgvQwZnY
anrl
added a commit
that referenced
this pull request
Sep 10, 2026
v6.11.2 was cut at bf018fe, which is BEFORE the CPU journey rebuild — so it ships the old seven-mode vocabulary (System call / Context switch / Preemption / Device / Page fault / Fatal / Kernel trap) and the bug where a captured kernel-mode timer was narrated as "a device pulled a wire". Testing the Traps face on 6.11.2 would be testing the version the fix was written against. 6.11.3 carries what 6.11.2 missed: * the CPU journey on the kernel's six trap causes, matching the Traps & Interrupts Lab's own vocabulary, with the capture choosing the path so no walkthrough can assert a cause that was not this trap's; * the known-issue #17 correction separating the one production crash from the test-harness ones. Still gBuilder-side only: no kernel, no agent, no Teaching Center change, so the container images need republishing under the new tag (gBuilder pins images to its OWN version) but NOT rebuilding — a retag of 6.11.2's manifests serves. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NUSXZZotxcPLhjvgvQwZnY
mohd-adnaan
added a commit
that referenced
this pull request
Sep 10, 2026
…ssion Known issue #17 records that the suite's green is order-dependent and that a release.sh run can therefore abort on something unrelated to the release. Measured it: run every test file in reverse collection order and origin/master reports 2 failed, 3364 passed, where alphabetical is clean. One of the two is real, and it is not a segfault. `gini.domain.fragments.FRAGMENTS` is a module-level dict built once at import, and four test files write to it without putting it back — test_compose assigns into it directly five times, and test_content_and_forks, test_authoring_build2 and test_fragment_terminals author a YAML pack into the user content layer and call F.reload(). Whatever they add is then visible to every test that runs afterwards. Alphabetically test_catalog runs before test_content_and_forks and never sees it. Reverse the order and test_archetypes_reference_real_concepts_and_elements fails asserting `a.spirit` against `t-lan-fork` — a fragment authored by a test file it has never heard of, whose spirit is empty because a test had no reason to set one. Nothing in that failure points at the cause, which is the part that would cost someone an afternoon. Fixed in conftest rather than in the four files, because the leak is the class and not the instance: an autouse fixture snapshots the registry and rebinds a clean copy afterwards, which undoes an in-place write as well as a reload(). LOAD_WARNINGS is mutated in place, so it is restored in place. About twenty entries per test; the cost is not measurable against a four-minute suite. Proven rather than assumed, both ways: with the fixture disabled the polluter-then-victim pair fails, with it enabled it passes, and the four polluting files still pass on their own. Reverse order over the whole suite: origin/master 2 failed, this branch 0 failed / 3367 passed. The OTHER reverse-order failure is NOT order-dependent and is not fixed here — I nearly reported it as such. test_tc_routes' version check fails in any checkout that has never been built, because on_disk() reads _version.py (absent) while __version__ falls back to "0.0.0+unknown"; it fails alone, in any order. It passes on a tree where dev.sh install has run. Worth its own look, as a question about what that test should assert in a source checkout. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
anrl
added a commit
that referenced
this pull request
Sep 12, 2026
…en faces run_off_gui fixed one of the two death modes — a worker closure being the last owner, so the widget was destroyed on the worker thread. It cannot fix the other: deleteLater() destroying the C++ object under an emit already in flight, because C++ teardown does not consult Python references. Only waiting does. Three faces had that wait (LivePollMixin's joined stop_polling); seventeen did not. Fixed at the source rather than face by face. A face is destroyed in exactly TWO places — MainWindow._retire_lab and MachineLab._retire. Everything else calling deleteLater() in ui/ is clearing child widgets out of a layout, not retiring something that runs workers. So worker_host gains join_owner(), and both retire paths call it. Putting the guarantee at the destroy site is the point, not an economy. "Remember to give your new face a stop_polling" is not a rule anyone keeps — it is the same trap as the gini-core floor in release.sh, which is checked rather than remembered. A face added next year inherits this without knowing it exists. The three faces on LivePollMixin keep their own joined stop_polling, which still runs first. Order is load-bearing, and matches the mixin's: stop_polling() if present, then close() — which sets _closed, so no worker may BEGIN an emit — then join_owner(), which waits out the one already in flight, and only then setParent(None) + deleteLater(). Bounded at 2s. Unbounded would hang the window on any wedged read. A straggler past the bound is not dangerous: it holds no strong reference to the owner by then, and _closed stops it emitting. Threads register BEFORE start(), because a retire landing in that gap would see nothing to wait for and destroy the owner under a worker that had already begun. MEASURED, because a race does not reproduce on demand and "it did not crash" proves nothing. Driving the real MachineLab._retire against a genuinely in-flight read: 0.00s before (it did not wait at all), 0.51s after for a 0.5s worker, zero threads leaked. Five tests pin it — retire waits; the bound is honoured AND reports its straggler rather than silently claiming success; a worker is joinable from the instant it starts. Known issue #17 marked closed with the measurement. Suite: 3395 passed. The one failure (test_catalog) is the stray July fragmen 71A4 t in ~/.gini, pre-existing and unrelated. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NUSXZZotxcPLhjvgvQwZnY
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.
Reverts #16