Skip to content

feat: per-frame tracing buffer that dumps on panic#1790

Open
tonybierman wants to merge 2 commits into
linebender:mainfrom
tonybierman:feature/1556
Open

feat: per-frame tracing buffer that dumps on panic#1790
tonybierman wants to merge 2 commits into
linebender:mainfrom
tonybierman:feature/1556

Conversation

@tonybierman
Copy link
Copy Markdown

Replaces the always-on debug-mode file log with a per-frame in-memory buffer that captures tracing events emitted during run_rewrite_passes and dumps them to a $TMPDIR/masonry-*-panic.log file only when the process panics. Closes #1556.

tonybierman and others added 2 commits May 4, 2026 08:24
Replaces the always-on debug-mode file log with a per-frame in-memory
buffer that captures tracing events emitted during run_rewrite_passes
and dumps them to a $TMPDIR/masonry-*-panic.log file only when the
process panics. This eliminates per-log-line I/O on the hot path while
preserving full diagnostics for crashes.

Closes linebender#1556.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
AndroidTraceLayer's Layer impl requires Debug on the inner subscriber
types, which transitively requires BufferWriter: Debug.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@xStrom
Copy link
Copy Markdown
Member

xStrom commented May 6, 2026

Hi Tony, thanks for the PR. Would you be so kind to describe a bit of the process you went through when making these changes? I'm just wondering if this is a result of Claude's thinking or if you played any role in it too. Basically, what differentiates it from a simple Claude prompt? Just so I know how to approach reviewing it.

@tonybierman
Copy link
Copy Markdown
Author

tonybierman commented May 7, 2026

Stage 1
I point claude to the issue #, ask it define a statement of work in the form of a concept statement and check list of tasks. It analyzes the code base and comes back to me with a series of tasks to meet the work requirements. I try to tackle small issues with well-defined boundaries. Particularly if I'm not familiar with the code base yet. We go through the task list until we have a first blush. I do a walk through of the code (in vscode). After that we iterate a process that looks something like this:

Stage 2

  • Did we create any magic numbers or assumptions?
  • work order, human review
  • Did we create multiple versions of the truth or commit DRY violations?
  • work order, human review
  • Are all functions, variables and constants named idiomatically?
  • work order, human review
  • Are all functions, variables and constants scoped correctly?
  • work order, human review
  • Are there any stale, unnecessary, turgid, or inaccurate comments?
  • work order, human review
  • Is the uncommitted code well-structured?
  • work order, human review

Stage 3
I ask claude to look for code smells. we usually do that about three times. Maybe 4 or 5 if I don't like what I see. Same process as before - checklist, walk-through, repeat.

Stage 4

  • Are the uncommitted code and comments in compliance with the repo's standards and practices?
  • work order, human review
  • Does the repo have any guidance on submitting PRs?
  • work order, human review

Stage 5
Submit PR

Background
I'm a retired developer, project manager, and exec. This is roughly the same process I've used with human developers for about two decades. My background is mostly in C#. I've been working with Rust for about a year.

I'd add that I like xilem/masonry project. I've been reading the docs and playing with it. I like the philosophy behind it, and I think it has been designed very well. I wanted to contribute. I hope the PR meets your standards, which I find to be high. If you want me to fix something, tell me about. If you want me to close the PR, no problem. No hard feelings.

My opinions about agent assisted coding. You have to put bumpers on the agent. You have to iterate, refactor, walk-through. If you follow a tight regime, you can produce a pretty good product. If you feel otherwise about the result, or the process, I know you're busy, but let me know.

https://www.linkedin.com/in/tonybierman/

Comment on lines +267 to +269
let Ok(line) = std::str::from_utf8(buf) else {
return Ok(buf.len());
};
Copy link
Copy Markdown
Contributor

@PoignardAzur PoignardAzur May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, here's a fun one: explain this paragraph to me, without asking Claude first. Please include "This is my own understanding, I didn't ask Claude" in your answer (I'll take your word for it).

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

give me either the buffer content or the length

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't ask Claude

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*why to do it this way is to bail out gracefully if i don't have valid UTF-8

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

give me either the buffer content or the length

I don't think this is an accurate description of the chunk I quoted.

*why to do it this way is to bail out gracefully if i don't have valid UTF-8

I dispute the idea that it bails gracefully. At the very least, it drops data silently.

Copy link
Copy Markdown
Author

@tonybierman tonybierman May 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't say it bails out gracefully. I said "to bail out," as in the caller would use it to bail out. Your objection about silent data loss is still valid, but doesn't accurately contradict what I said. I can provide an example if it would serve to clarify my meaning.

Both parts of my answer are succinct, but accurate.

The buffer content itself — Ok(line) binds the decoded &str.
The length of the buffer — Ok(buf.len()) returns how many bytes were consumed.

Your point about data loss is probably more substantive, though.

I'll stop here and give you the last word, if that's what you want.

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.

[Feature request] Add per-frame tracing subscriber

3 participants