Skip to content

feat: Adds support for live print context and run_pool context propagation#19

Merged
EspenAlbert merged 2 commits into
mainfrom
task/t11-27-live-print-context-run-pool
Jun 1, 2026
Merged

feat: Adds support for live print context and run_pool context propagation#19
EspenAlbert merged 2 commits into
mainfrom
task/t11-27-live-print-context-run-pool

Conversation

@EspenAlbert
Copy link
Copy Markdown
Owner

@EspenAlbert EspenAlbert commented Jun 1, 2026

Summary

Adds scoped metadata for live-console scroll lines so tfdo multi-directory orchestration can prefix or suppress print_to_live / log_to_live per run directory without touching every call site.

What changed

  • LivePrintContext + live_print_scope() on ask_shell.console: optional prefix and suppress via contextvars.
  • print_to_live / log_to_live: honor active scope (prepend prefix; skip output when suppressed).
  • run_pool.submit: captures submit-time context with copy_context() so worker threads see the same scope.

Reviewer notes

  • Not breaking for existing callers; default context is unset (same behavior as before).
  • copy_context on every submit: small per-task cost; intended for orchestration-scale parallelism, not hot loops with thousands of submits.
  • Prefix is a separate Rich print segment, not merged into caller style; markup in prefix is caller responsibility.
  • style on LivePrintContext deferred; add later if tfdo needs dim per-dir lines without per-call style=.

@EspenAlbert EspenAlbert changed the title feat: ask-shell live print context and run_pool context propagation feat: Adds support for live print context and run_pool context propagation Jun 1, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jun 1, 2026

Codecov Report

❌ Patch coverage is 95.34884% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.27%. Comparing base (e328236) to head (fc2090e).

Files with missing lines Patch % Lines
ask_shell/_internal/rich_live.py 87.50% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #19      +/-   ##
==========================================
+ Coverage   85.89%   86.27%   +0.38%     
==========================================
  Files          21       22       +1     
  Lines        2042     2084      +42     
==========================================
+ Hits         1754     1798      +44     
+ Misses        288      286       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@EspenAlbert EspenAlbert marked this pull request as ready for review June 1, 2026 12:38
@EspenAlbert EspenAlbert merged commit de0e8a4 into main Jun 1, 2026
18 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.

2 participants