Skip to content

runner: report progress via OSC 9;4 sequences - #315

Merged
tingerrr merged 1 commit into
typst-community:mainfrom
T1mVo:osc94
Sep 10, 2026
Merged

tingerrr merged 1 commit into
typst-community:mainfrom
T1mVo:osc94

Conversation

@T1mVo

@T1mVo T1mVo commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Summary

See commit messages.

Preview in Ghostty:

Screen.Recording.2026-08-21.at.20.33.16.mov

Related Issues

Closes #314

Checklist

  • I have structured my commits according to the commit guidelines (if applicable).
  • I have added tests for new features (if applicable).
  • I have updated the documentation (if applicable).

@tingerrr tingerrr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have you tested this with a terminal that does not support OSC 9;4? What happens in this case? I imagine we might need to add a user-wide configuration in which we can configure this or query the terminal database to see which terminals support it. I'd say that this is where an extra dependency would be warranted.

Comment thread Cargo.toml Outdated
@T1mVo

T1mVo commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Have you tested this with a terminal that does not support OSC 9;4? What happens in this case?

I've tested it with Warp and the default macOS Terminal. Both show the normal output.

I imagine we might need to add a user-wide configuration in which we can configure this or query the terminal database to see which terminals support it. I'd say that this is where an extra dependency would be warranted.

I did some further research into how Cargo handles this. They use anstyle-progress, which does have a method for checking terminal support and also allows manual configuration.

I would switch the implementation to use anstyle-progress. I could also add a global config option to disable it if desired. Not sure if tytanic even has global config options yet.

@T1mVo
T1mVo force-pushed the osc94 branch 2 times, most recently from ae9acfe to e028882 Compare August 25, 2026 21:17
@tingerrr

Copy link
Copy Markdown
Member

I did some further research into how Cargo handles this. They use anstyle-progress, which does have a method for checking terminal support and also allows manual configuration.

Seems like the right choice then, we'll have to see how well this interacts with the terminal library Typst uses since we use it in a few places too through typst-kit, but perhaps it's fine.

I would switch the implementation to use anstyle-progress. I could also add a global config option to disable it if desired. Not sure if tytanic even has global config options yet.

Not yet, hence why I'm a little on the fence about this. If you want, you could add that in a PR and stack this one on top. I don't think I can enable GitHub's Stacked PRs, but I can manage reviewing either way.

@T1mVo

T1mVo commented Sep 2, 2026

Copy link
Copy Markdown
Contributor Author

I copied the system config structure from Cargo for now. I also thought about just adding a top-level key for it but I think this depends on which option get added here in the future. I am open for suggestions here.

@tingerrr tingerrr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, minor change request on the config structure.

I found out that Stderr::lock is reentrant while reviewing this and wasn't sure if it's fine to rely on this, but it turns out it is.

Comment thread crates/tytanic-core/src/config.rs
Emit an OSC 9;4 progress bar so the current test count is observable
at a glance, starting at 0% on run start, advancing after each test,
and clearing when the run finishes.

@tingerrr tingerrr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@tingerrr
tingerrr merged commit fa9b09d into typst-community:main Sep 10, 2026
15 checks passed
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.

Add progress reporting with OSC 9;4

2 participants