Repository navigation
Batch 673: dryrun trace caps its writes and counts its shared patch (BACKLOG #6824, #6825) - #3253
Merged
Merged
Conversation
… huge ints
Under show_phi=True, _safe_value passed a NaN/Infinity float through, so the
CLI's json.dumps wrote the bare tokens NaN/Infinity, which RFC 8259 rejects,
and an int past the 4300-digit int-to-str limit made json.dumps raise
ValueError. A non-finite float is now repr'd ("nan", "inf", "-inf") and an int
longer than the 120-character value cap becomes "<int: too large>", found by
comparison so the conversion that raises never runs.
BACKLOG #6822 (Argon RC-S08-37). Verdict: real defect; the new test failed
before the fix.
Proposed PR title: dryrun trace: --show-phi values stay valid JSON for NaN,
Infinity and huge ints (BACKLOG #6822)
Proposed banner: CLOSED -- fixed: _safe_value renders non-finite floats and
over-cap ints as strings under --show-phi; failing test plus fix.
Check numbers by type() and call no subclass hook (no abs, repr or comparison on a user subclass), tag non-finite floats as "<float: nan>" etc., keep an over-cap int's 120-character prefix like a long string and use the placeholder only past the int-to-str digit limit, fix the positive-boundary off-by-one, and give the changelog fragment the bullet format the checker requires. Tests add the hostile-subclass case, the untraced-disposition comparison, the positive boundary and the real CLI serializer. BACKLOG #6822 Proposed PR title: dryrun trace: --show-phi values stay valid JSON for NaN, Infinity and huge ints (BACKLOG #6822) Proposed banner: CLOSED -- fixed: _safe_value renders non-finite floats and over-cap ints as strings under --show-phi; failing test plus fix.
_sends_from walked any non-Iterator iterable. An object whose __iter__ returns a stored generator is single-pass but not an Iterator, so the trace observer exhausted it before dryrun._partition ran: the traced run read FILTERED with zero deliveries where the untraced run delivered (reproduced by the new test before the fix). The Handler half now walks the same re-iterable allowlist as the Router half and declares any other iterable return with lazy_result. BACKLOG #6823 Proposed banner: FIXED - traced dry run walks only re-iterable Handler containers; a single-pass iterable of Sends is declared lazy_result and no longer drained (test + fix).
Review round 1: a list subclass with a single-pass __iter__, or one that is its own Iterator, passed isinstance(result, list) and was still drained. Walk only the exact builtin types, derive the Handler's lazy_result from the one predicate, and fix the docstrings that still described the removed Iterator guard. BACKLOG #6823
Review round 2: drop the dead Iterator check on the Handler path and correct the changelog and comment that said the Handler walks the allowlist "as the Router half already did" (the Router half still uses isinstance, so a container subclass there is reported, not fixed here). BACKLOG #6823 Proposed banner: FIXED - traced dry run walks a Handler return only when its exact type is list/tuple/set/frozenset; a single-pass iterable of Sends (or a single-pass container subclass) is declared lazy_result and no longer drained (test + fix). Open findings in the PR body.
Manager follow-up on review round 3. The exact-container test now uses identity, so no user metaclass __eq__ runs in the observer. CONNECTIONS.md and USER-GUIDE.md define the Handler's lazy_result as shipped, ADR 0072 gains a dated amendment naming gate 1b and the removed Iterator guard, and the changelog states the str/bytes exclusion. BACKLOG #6823 Proposed banner: FIXED - traced dry run walks a Handler return only when its exact type is list/tuple/set/frozenset; a single-pass iterable of Sends (or a single-pass container subclass) is declared lazy_result and no longer drained (test + fix; docs and ADR 0072 amended). Open findings in the PR body.
Text only. CONNECTIONS.md and USER-GUIDE.md now say plainly that a bare return Send(...) still gets its per-invocation sends. The ADR 0072 Status line and README index row note the 2026-11-24 amendment, which now says it supersedes section 3 and gate 1b on the Handler half. The dryrun_trace module docstring and _Recorder comment describe the wider Handler lazy_result. BACKLOG #6823
After an invocation reached _MAX_EVENTS, _finalize stopped popping _writes_by_line while record_write kept appending every Message write, so a long mutating loop grew the recorder without bound. record_write now drops a write once the event cap is reached, and past a new per-invocation _MAX_WRITES cap that also bounds a helper's writes landing on one traced line. Either marks the invocation truncated; _finalize clears writes that can no longer be emitted. BACKLOG #6824
_patched_message_writes overwrote and restored the class-global Message._write with no count or lock, so when two threads traced at once the first to finish restored the original under the other, which then recorded no writes. A lock-guarded holder count now installs the patch on the first entry and restores it on the last exit. BACKLOG #6825
- The write cap marks writes_truncated, not truncated, which the IDE reads as short line coverage. - A write is recorded only after Message._write accepts it, so refused writes spend no budget. - No write is kept without a latched frame; the dead clear() is gone. - The patch holder count is taken inside the try, released only if held. - Tests: refused write, end-to-end concurrent traces, holder count. BACKLOG #6824, #6825 Proposed vault banners: #6824: FIXED (batch 673, branch b673/trace-group-2). Adjudicated a real defect by failing test: past _MAX_EVENTS, record_write kept every write in _writes_by_line. Writes are dropped past the event cap (truncated) and a new 5,000-write cap (writes_truncated). #6825: FIXED (batch 673, branch b673/trace-group-2). Adjudicated a real defect by failing test: a second trace exiting restored Message._write under the first. A lock-guarded holder count now restores on the last exit.
- Record a write before Message._write again, so a write that raises still shows on the failing line; round 1's reorder had hidden it. - Keep no write once the traced frame has returned (no open line). - Document the event and write caps in the module docstring; fix the changelog's write-cap wording. - Thread tests re-raise worker errors and fail on a hung worker. BACKLOG #6824, #6825 Proposed vault banners: #6824: FIXED (batch 673, branch b673/trace-group-2). Adjudicated a real defect by failing test: past _MAX_EVENTS, record_write kept every write in _writes_by_line. Writes are dropped past the event cap (truncated), with no open line, and past a new 5,000-write cap (writes_truncated). #6825: FIXED (batch 673, branch b673/trace-group-2). Adjudicated a real defect by failing test: a second trace exiting restored Message._write under the first. A lock-guarded holder count now restores on the last exit.
The round-2 guard on _last_line dropped writes made after a handled in-frame exception, with no flag. It is reverted with its test. The holder-count comment now says the leak window is narrowed, not closed, and the changelog says the write cap counts kept writes. BACKLOG #6824, #6825 Proposed vault banners: #6824: FIXED (batch 673, branch b673/trace-group-2). Adjudicated a real defect by failing test: past _MAX_EVENTS, record_write kept every write in _writes_by_line. Writes are dropped past the event cap (truncated) and past a new 5,000-kept-write cap (writes_truncated). #6825: FIXED (batch 673, branch b673/trace-group-2). Adjudicated a real defect by failing test: a second trace exiting restored Message._write under the first. A lock-guarded holder count now restores on the last exit.
# Conflicts: # messagefoundry/pipeline/dryrun_trace.py
A write with no latched frame is keyed to the def line again, as on main, so a wrapper's write before a one-line target is emitted; it now counts against _MAX_WRITES. The write cap also sets truncated, the only key the IDE reads (traceView.ts, testBenchWebview.ts), so a capped trace never looks complete. Comment reason corrected; new wrapper test. BACKLOG #6824 Proposed vault banners: #6824: FIXED (batch 673, branch b673/trace-group-2). Adjudicated a real defect by failing test: past _MAX_EVENTS, record_write kept every write in _writes_by_line. Writes are dropped past the event cap and past a new 5,000-kept-write cap; either sets truncated, the second also writes_truncated. #6825: FIXED (batch 673, branch b673/trace-group-2). Adjudicated a real defect by failing test: a second trace exiting restored Message._write under the first. A lock-guarded holder count now restores on the last exit.
Text only. The write-cap comment says the test bench shows its event-cap message and the inline views read neither flag. The changelog headline is narrowed to writes past the event cap and names, at least, the kept writes that are never emitted. BACKLOG #6824
Collaborator
Author
|
QA: level xhigh. Rounds: 2 + 3 unrepaired. Tag: |
Collaborator
Author
|
Lander: enqueuing at pinned head 596566c. QA round-c26ef5f793 (exit 0) covers the branch; the head adds text only. Finding 1, the IDE inline views ignoring the truncated flag past 5000 writes, I rule ORDINARY: a disclosed display gap in a dev tool, on a path that was unbounded before this PR, which weakens no control. Findings 1-9 (ORDINARY or MAIN) are queued for filing under R2. |
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.
Batch 673 (pipeline), dryrun_trace group 2. Its base PR 3237 (#6822, #6823) has merged, and this branch merged
origin/mainnormally after it.git diff origin/main...touches onlydryrun_trace.py, its test file and two changelog fragments.BACKLOG #6824 -- traced writes are bounded
_MAX_EVENTS,_writes_by_linekept every later write.record_writedrops writes past the event cap and setstruncated._MAX_WRITESof 5000 also applies. Past it the invocation getswrites_truncated, andtruncatedtoo, which the IDE test bench reads (traceView.ts, testBenchWebview.ts).changelog.d/6824.fixed.md.truncated. The IDE's inline write views (liveDebug.ts, stepsModel.ts) read neither flag, so there a capped list can look complete. That IDE reading is open finding 1.truncated, with a failing test plus fix.BACKLOG #6825 -- concurrent traces no longer restore
Message._writeunder each otherchangelog.d/6825.fixed.md.Checks (Builder): ruff check and format, both mypy package legs, mypy on tests/test_dryrun_trace.py, the changelog fragment check. pytest on test_dryrun_trace, test_accepts_seam, test_copy_on_send, test_dryrun_snapshot_parity, test_data_never_becomes_structure and test_cli: 564 passed. Full suite not run. Read the pytest legs and the tests mypy leg.
QA: xhigh. Rounds: 2 + 3 unrepaired. Tag:
xhigh effort -> 10 inline angles -> dedup (no verify) -> sweep -> <=15 findings(round-525b615052, round-4aa8008e8c, round-11061c491c, round-df23aac5f8, round-c26ef5f793). The unrepaired rounds led to Manager-directed repairs: a write-dropping regression was reverted, and writes with no latched frame were restored. The head,596566c2, is comment and changelog text only, and no review round ran on it.Open findings, to file under R2:
writes_truncated(ortruncated), and ADR 0072 section 3 does not namewrites_truncated.__len__on a str subclass can error only the traced run. This predates the change._write, not the method installed before the first entry. A design that installs the patch once would remove both problems.b_done.waitis unasserted; there is no teardown on the module-global state; one test bounds by_MAX_EVENTS, not_MAX_WRITES._finalizeandrecord_write.