bmsdna-devtools 1.9.1__tar.gz → 1.10.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/PKG-INFO +9 -1
  2. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/README.md +8 -0
  3. bmsdna_devtools-1.10.0/bmsdna/devtools/build_warnings.py +142 -0
  4. bmsdna_devtools-1.10.0/bmsdna/devtools/ci_warnings.py +53 -0
  5. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/cli.py +58 -0
  6. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/gh_pr.py +80 -13
  7. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_build.py +106 -34
  8. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_logs.py +18 -14
  9. bmsdna_devtools-1.10.0/bmsdna/devtools/pr_warnings.py +146 -0
  10. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/pyproject.toml +1 -1
  11. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/skills/bmsdna-devtools/SKILL.md +2 -0
  12. bmsdna_devtools-1.10.0/tests/test_build_warnings.py +215 -0
  13. bmsdna_devtools-1.10.0/tests/test_ci_warnings.py +45 -0
  14. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_gh_pr.py +69 -3
  15. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_build_flow.py +64 -11
  16. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_cancel_build.py +14 -1
  17. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_info.py +1 -0
  18. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/uv.lock +1 -1
  19. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/.github/workflows/auto-release.yml +0 -0
  20. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/.github/workflows/python-publish.yml +0 -0
  21. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/.github/workflows/python-test.yml +0 -0
  22. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/.gitignore +0 -0
  23. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/.python-version +0 -0
  24. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/__init__.py +0 -0
  25. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/_api_dump.py +0 -0
  26. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/ado_auth.py +0 -0
  27. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/ado_issue.py +0 -0
  28. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/agent_mentions.py +0 -0
  29. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/api_usage.py +0 -0
  30. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/app_service_logs.py +0 -0
  31. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/azure_arm.py +0 -0
  32. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/azure_auth.py +0 -0
  33. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/bdt_config.py +0 -0
  34. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/business_user.py +0 -0
  35. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/ci_plan.py +0 -0
  36. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/ci_plan_env.py +0 -0
  37. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/cleanup_claude.py +0 -0
  38. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/cleanup_scan.py +0 -0
  39. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/cli_tools.py +0 -0
  40. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/commit.py +0 -0
  41. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/dead_code.py +0 -0
  42. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/deps/__init__.py +0 -0
  43. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/deps/advisories.py +0 -0
  44. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/deps/cli.py +0 -0
  45. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/deps/cooldown.py +0 -0
  46. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/deps/lockfiles.py +0 -0
  47. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/deps/osv.py +0 -0
  48. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/deps/versions.py +0 -0
  49. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/env_config.py +0 -0
  50. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/env_files.py +0 -0
  51. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/find_injection.py +0 -0
  52. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/find_repo.py +0 -0
  53. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/gh_args.py +0 -0
  54. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/gh_issue.py +0 -0
  55. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/github_api.py +0 -0
  56. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/gitrepo.py +0 -0
  57. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/injection_frontend.py +0 -0
  58. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/injection_python.py +0 -0
  59. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/issue_do.py +0 -0
  60. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/issue_show.py +0 -0
  61. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/issue_watch.py +0 -0
  62. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/lint.py +0 -0
  63. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/lint_findings.py +0 -0
  64. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/lint_models.py +0 -0
  65. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/lint_sql.py +0 -0
  66. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/lint_sql_files.py +0 -0
  67. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/lint_tooling.py +0 -0
  68. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/lint_typescript.py +0 -0
  69. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/logs.py +0 -0
  70. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_cancel.py +0 -0
  71. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_choice.py +0 -0
  72. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_create_args.py +0 -0
  73. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_drift.py +0 -0
  74. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_info.py +0 -0
  75. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_issue_link.py +0 -0
  76. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_labels.py +0 -0
  77. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_list.py +0 -0
  78. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_markdown.py +0 -0
  79. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_merge_defaults.py +0 -0
  80. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pr_ref.py +0 -0
  81. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/pull.py +0 -0
  82. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/testdb.py +0 -0
  83. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/translate.py +0 -0
  84. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/usage/__init__.py +0 -0
  85. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/usage/cli.py +0 -0
  86. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/usage/pipeline.py +0 -0
  87. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/usage/pricing.py +0 -0
  88. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/usage/report.py +0 -0
  89. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
  90. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
  91. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
  92. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
  93. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
  94. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/usage/sql/04_facts.sql +0 -0
  95. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/usage/sql/05_views.sql +0 -0
  96. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/bmsdna/devtools/worktree.py +0 -0
  97. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/justfile +0 -0
  98. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/prek.toml +0 -0
  99. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/conftest.py +0 -0
  100. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/fake_github.py +0 -0
  101. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_ado_auth.py +0 -0
  102. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_ado_issue.py +0 -0
  103. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_ado_issue_flow.py +0 -0
  104. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_agent_mentions.py +0 -0
  105. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_api_usage.py +0 -0
  106. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_app_service_logs.py +0 -0
  107. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_azure_arm.py +0 -0
  108. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_bdt_config.py +0 -0
  109. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_business_user.py +0 -0
  110. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_ci_plan.py +0 -0
  111. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_ci_plan_env.py +0 -0
  112. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_cleanup_claude.py +0 -0
  113. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_cleanup_scan.py +0 -0
  114. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_cli_cleanup.py +0 -0
  115. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_cli_commit.py +0 -0
  116. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_cli_deps.py +0 -0
  117. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_cli_issue.py +0 -0
  118. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_cli_pr_create.py +0 -0
  119. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_cli_pr_id.py +0 -0
  120. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_cli_pull.py +0 -0
  121. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_cli_tools.py +0 -0
  122. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_cli_version.py +0 -0
  123. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_commit.py +0 -0
  124. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_deps_advisories.py +0 -0
  125. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_deps_cooldown.py +0 -0
  126. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_deps_lockfiles.py +0 -0
  127. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_deps_osv.py +0 -0
  128. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_deps_versions.py +0 -0
  129. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_env_config.py +0 -0
  130. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_env_files.py +0 -0
  131. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_find_injection.py +0 -0
  132. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_find_repo.py +0 -0
  133. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_gh_issue.py +0 -0
  134. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_github_api.py +0 -0
  135. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_gitrepo.py +0 -0
  136. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_issue_do.py +0 -0
  137. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_issue_for_me.py +0 -0
  138. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_issue_show.py +0 -0
  139. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_issue_watch.py +0 -0
  140. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_lint.py +0 -0
  141. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_lint_models.py +0 -0
  142. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_lint_sql.py +0 -0
  143. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_lint_sql_files.py +0 -0
  144. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_lint_tooling.py +0 -0
  145. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_lint_typescript.py +0 -0
  146. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_logs.py +0 -0
  147. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_build.py +0 -0
  148. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_build_create_options.py +0 -0
  149. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_choice.py +0 -0
  150. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_create_args.py +0 -0
  151. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_description_not_truncated.py +0 -0
  152. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_drift.py +0 -0
  153. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_issue_link.py +0 -0
  154. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_labels.py +0 -0
  155. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_list.py +0 -0
  156. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_logs.py +0 -0
  157. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_markdown.py +0 -0
  158. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pr_merge_defaults.py +0 -0
  159. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_pull.py +0 -0
  160. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_testdb.py +0 -0
  161. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_translate.py +0 -0
  162. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_usage.py +0 -0
  163. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_wait_timeout.py +0 -0
  164. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_worktree_clean.py +0 -0
  165. {bmsdna_devtools-1.9.1 → bmsdna_devtools-1.10.0}/tests/test_worktree_create.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bmsdna-devtools
3
- Version: 1.9.1
3
+ Version: 1.10.0
4
4
  Summary: Shared Azure DevOps / GitHub / git / Azure Monitor developer tooling for BMS projects
5
5
  Requires-Python: >=3.14
6
6
  Requires-Dist: azure-identity>=1.19.0
@@ -263,6 +263,14 @@ second build. `bdt pr watch-deploy` does: it finds the most recent build/
263
263
  workflow run triggered *directly* on `--target-branch` and reports its
264
264
  status the same way `pr status` does (failed steps print their logs inline).
265
265
 
266
+ It only watches the builds/runs of the commit the branch points at (the merge that
267
+ just landed). An older run of another pipeline/workflow waiting on an approval is
268
+ printed as a note, never as the reason to stop. With `--wait`, a merge whose run
269
+ isn't queued yet is waited for (up to 10 minutes, then exit 4). A run of the merge
270
+ that waits on an approval (a stage approval or, on Azure DevOps, a first-time
271
+ resource authorization such as "permit this pipeline to use a secret"; on GitHub a
272
+ deployment protection rule) stops with exit 3 and the run's link.
273
+
266
274
  ```bash
267
275
  bdt pr watch-deploy [--target-branch dev] [--wait]
268
276
  ```
@@ -244,6 +244,14 @@ second build. `bdt pr watch-deploy` does: it finds the most recent build/
244
244
  workflow run triggered *directly* on `--target-branch` and reports its
245
245
  status the same way `pr status` does (failed steps print their logs inline).
246
246
 
247
+ It only watches the builds/runs of the commit the branch points at (the merge that
248
+ just landed). An older run of another pipeline/workflow waiting on an approval is
249
+ printed as a note, never as the reason to stop. With `--wait`, a merge whose run
250
+ isn't queued yet is waited for (up to 10 minutes, then exit 4). A run of the merge
251
+ that waits on an approval (a stage approval or, on Azure DevOps, a first-time
252
+ resource authorization such as "permit this pipeline to use a secret"; on GitHub a
253
+ deployment protection rule) stops with exit 3 and the run's link.
254
+
247
255
  ```bash
248
256
  bdt pr watch-deploy [--target-branch dev] [--wait]
249
257
  ```
@@ -0,0 +1,142 @@
1
+ """The warnings of a build (Azure DevOps timeline issues) / workflow run (GitHub check-run annotations):
2
+ counted for `bdt pr status`, listed by `bdt pr warnings`. Tools that only print their warnings are scanned by
3
+ `tool_warnings`, which `bdt ci warnings` uses to report them to the CI system in the first place."""
4
+
5
+ from __future__ import annotations
6
+
7
+ import re
8
+ from collections.abc import Callable
9
+ from dataclasses import dataclass
10
+
11
+ import requests
12
+
13
+ from bmsdna.devtools.github_api import GitHubClient
14
+
15
+ LOG_WARNING_RE = re.compile(r"##\[warning\]\s*(.*)")
16
+ ANSI_RE = re.compile(r"\x1b\[[0-9;]*m")
17
+ # rolldown (the bundler of vite 8) prints its warnings as `<yellow>[CODE] <reset>message`
18
+ BUNDLER_WARNING_RE = re.compile(r"\x1b\[33m\[([A-Z][A-Z0-9_]+)\]\s*(?:\x1b\[0m)?(.+)")
19
+ PYTEST_WARNING_RE = re.compile(r"^\s*(\S+:\d+): (\w*Warning): (.*)$")
20
+
21
+
22
+ @dataclass(frozen=True)
23
+ class BuildWarning:
24
+ step: str
25
+ message: str
26
+
27
+
28
+ def count_text(count: int, build_id: int) -> str:
29
+ return f"{count} Warning{'s' * (count != 1)} (see with bdt pr warnings --build-id {build_id})"
30
+
31
+
32
+ def _is_task(rec: dict) -> bool:
33
+ return rec.get("type") == "Task"
34
+
35
+
36
+ def ado_warning_issues(rec: dict) -> list[dict]:
37
+ return [i for i in rec.get("issues") or [] if (i.get("type") or "").casefold() == "warning"]
38
+
39
+
40
+ def _vite_warning(lines: list[str], start: int) -> str:
41
+ """`(!) message` plus the bullet lines under it (`- hint`)."""
42
+ parts = [lines[start].removeprefix("(!) ").strip()]
43
+ for line in lines[start + 1 :]:
44
+ if not line.lstrip().startswith("- "):
45
+ break
46
+ parts.append(line.strip().removeprefix("- "))
47
+ return " ".join(parts)
48
+
49
+
50
+ def _pytest_warnings(lines: list[str], start: int) -> list[str]:
51
+ """The entries of a pytest `warnings summary` section, which ends at `-- Docs:`."""
52
+ found = []
53
+ for line in lines[start + 1 :]:
54
+ if line.startswith("-- Docs:"):
55
+ break
56
+ if m := PYTEST_WARNING_RE.match(line):
57
+ found.append(f"{m.group(1)}: {m.group(2)}: {m.group(3)}")
58
+ return found
59
+
60
+
61
+ def tool_warnings(output: str) -> list[str]:
62
+ """What tools print for warnings, without telling the CI system: rolldown/vite (`[CODE] message`, `(!) message`)
63
+ and the entries of pytest's `warnings summary`, each once, in order."""
64
+ found: list[str] = []
65
+ raw_lines = output.splitlines()
66
+ lines = [ANSI_RE.sub("", line) for line in raw_lines]
67
+ for i, line in enumerate(lines):
68
+ if m := BUNDLER_WARNING_RE.match(raw_lines[i]):
69
+ found.append(f"[{m.group(1)}] {ANSI_RE.sub('', m.group(2)).strip()}")
70
+ elif line.startswith("(!) "):
71
+ found.append(_vite_warning(lines, i))
72
+ elif line.strip("= ") == "warnings summary":
73
+ found.extend(_pytest_warnings(lines, i))
74
+ return list(dict.fromkeys(found))
75
+
76
+
77
+ def ado_warning_count(records: list[dict]) -> int:
78
+ """Warnings in a build's timeline. A task's `warningCount` is the real number; its `issues` list is capped
79
+ by Azure DevOps. Stage/job records only count their own issues, as their `warningCount` sums their tasks'."""
80
+ total = 0
81
+ for rec in records:
82
+ listed = len(ado_warning_issues(rec))
83
+ total += max(listed, rec.get("warningCount") or 0) if _is_task(rec) else listed
84
+ return total
85
+
86
+
87
+ def issue_text(issue: dict) -> str:
88
+ message = (issue.get("message") or "").strip()
89
+ data = issue.get("data") or {}
90
+ source = data.get("sourcepath")
91
+ if not source:
92
+ return message
93
+ line = data.get("linenumber")
94
+ return f"{source}:{line}: {message}" if line else f"{source}: {message}"
95
+
96
+
97
+ def log_warnings(log: str) -> list[str]:
98
+ return [m.group(1).strip() for line in log.splitlines() if (m := LOG_WARNING_RE.search(line))]
99
+
100
+
101
+ def ado_warnings(
102
+ records: list[dict], path: Callable[[dict], str], fetch_log: Callable[[str], str]
103
+ ) -> list[BuildWarning]:
104
+ """Every warning of the timeline, by step. Where a task has more warnings than its (capped) `issues`
105
+ list holds, they are read from its log instead."""
106
+ found = []
107
+ for rec in records:
108
+ messages = [issue_text(i) for i in ado_warning_issues(rec)]
109
+ url = (rec.get("log") or {}).get("url")
110
+ if _is_task(rec) and (rec.get("warningCount") or 0) > len(messages) and url:
111
+ try:
112
+ from_log = log_warnings(fetch_log(url))
113
+ except requests.RequestException:
114
+ from_log = []
115
+ if len(from_log) > len(messages):
116
+ messages = from_log
117
+ found += [BuildWarning(path(rec), m) for m in messages]
118
+ return found
119
+
120
+
121
+ def annotation_text(annotation: dict) -> str:
122
+ where = annotation.get("path") or ""
123
+ if where and annotation.get("start_line"):
124
+ where += f":{annotation['start_line']}"
125
+ parts = [where, (annotation.get("title") or "").strip(), (annotation.get("message") or "").strip()]
126
+ return ": ".join(p for p in parts if p)
127
+
128
+
129
+ def github_warnings(gh: GitHubClient, run_id: int) -> list[BuildWarning]:
130
+ """The `warning` annotations of the run's jobs (GitHub shows them on the run's summary page)."""
131
+ jobs = gh.paginate(f"{gh.repo_path}/actions/runs/{run_id}/jobs", {"filter": "latest"}, items_key="jobs")
132
+ found = []
133
+ for job in jobs:
134
+ if job.get("conclusion") == "skipped":
135
+ continue
136
+ annotations = gh.paginate(f"{gh.repo_path}/check-runs/{job['id']}/annotations")
137
+ found.extend(
138
+ BuildWarning(job.get("name", "?"), annotation_text(a))
139
+ for a in annotations
140
+ if a.get("annotation_level") == "warning"
141
+ )
142
+ return found
@@ -0,0 +1,53 @@
1
+ """`bdt ci warnings`: run a command and report the warnings it only prints (vite, pytest) to the CI system."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ import shutil
7
+ import subprocess
8
+ import sys
9
+ from collections.abc import Mapping
10
+
11
+ from bmsdna.devtools import ci_plan_env
12
+ from bmsdna.devtools.build_warnings import tool_warnings
13
+
14
+
15
+ def _github(message: str) -> str:
16
+ escaped = message.replace("%", "%25").replace("\r", "%0D").replace("\n", "%0A")
17
+ return f"::warning::{escaped}"
18
+
19
+
20
+ def announce(warnings: list[str], env: Mapping[str, str]) -> None:
21
+ """Azure Pipelines and GitHub Actions count them (`bdt pr status` shows how many); elsewhere they are plain lines."""
22
+ for message in warnings:
23
+ if env.get("TF_BUILD"):
24
+ ci_plan_env.log(True, "warning", message)
25
+ elif env.get("GITHUB_ACTIONS"):
26
+ print(_github(message))
27
+ else:
28
+ print(f"warning: {message}")
29
+
30
+
31
+ def run(command: list[str], env: Mapping[str, str] | None = None) -> int:
32
+ """Run `command` with its output passed through as it comes, then announce its warnings; its exit code is returned."""
33
+ env = os.environ if env is None else env
34
+ executable = shutil.which(command[0])
35
+ if executable is None:
36
+ print(f"error: {command[0]}: command not found", file=sys.stderr)
37
+ return 127
38
+ output: list[str] = []
39
+ with subprocess.Popen(
40
+ [executable, *command[1:]],
41
+ stdout=subprocess.PIPE,
42
+ stderr=subprocess.STDOUT,
43
+ text=True,
44
+ encoding="utf-8",
45
+ errors="replace",
46
+ ) as process:
47
+ assert process.stdout is not None
48
+ for line in process.stdout:
49
+ sys.stdout.write(line)
50
+ sys.stdout.flush()
51
+ output.append(line)
52
+ announce(tool_warnings("".join(output)), env)
53
+ return process.returncode
@@ -40,6 +40,7 @@ from bmsdna.devtools import (
40
40
  )
41
41
  from bmsdna.devtools import api_usage as api_usage_mod
42
42
  from bmsdna.devtools import business_user as business_user_mod
43
+ from bmsdna.devtools import ci_warnings as ci_warnings_mod
43
44
  from bmsdna.devtools import cleanup_claude as cleanup_claude_mod
44
45
  from bmsdna.devtools import cleanup_scan as cleanup_scan_mod
45
46
  from bmsdna.devtools import commit as commit_mod
@@ -55,6 +56,7 @@ from bmsdna.devtools import logs as logs_mod
55
56
  from bmsdna.devtools import pr_info as pr_info_mod
56
57
  from bmsdna.devtools import pr_list as pr_list_mod
57
58
  from bmsdna.devtools import pr_logs as pr_logs_mod
59
+ from bmsdna.devtools import pr_warnings as pr_warnings_mod
58
60
  from bmsdna.devtools import pull as pull_mod
59
61
  from bmsdna.devtools import translate as translate_mod
60
62
  from bmsdna.devtools import worktree as worktree_mod
@@ -812,6 +814,47 @@ def pr_logs(
812
814
  )
813
815
 
814
816
 
817
+ @pr_app.command("warnings")
818
+ def pr_warnings(
819
+ build_id_arg: int | None = typer.Argument(
820
+ None, metavar="[BUILD_ID]", help="Same as --build-id (default: the PR's latest build per pipeline)"
821
+ ),
822
+ target_branch: str | None = typer.Option(None, "--target-branch", help=_LOOKUP_TARGET_HELP),
823
+ pr_id: int | None = typer.Option(None, "--pr-id", help=_PR_ID_HELP),
824
+ build_id: int | None = typer.Option(
825
+ None,
826
+ "--build-id",
827
+ "--run-id",
828
+ help="Show this Azure DevOps build / GitHub Actions run directly instead of the PR's latest ones",
829
+ ),
830
+ as_json: bool = typer.Option(False, "--json", help="Print machine-readable JSON instead of text"),
831
+ pat: str | None = typer.Option(
832
+ None,
833
+ "--pat",
834
+ envvar=["AZURE_DEVOPS_EXT_PAT", "AZURE_DEVOPS_PAT"],
835
+ help="Azure DevOps PAT (else uses DefaultAzureCredential, e.g. your `az login`)",
836
+ ),
837
+ ) -> None:
838
+ """List the warnings of the PR's builds (Azure DevOps) / workflow runs (GitHub, auto-detected), by step:
839
+ the ones `bdt pr status` only counts. The PR is the one opened from the current branch, or --pr-id;
840
+ --build-id picks one build/run directly.
841
+ """
842
+ if build_id_arg is not None and build_id is not None and build_id_arg != build_id:
843
+ raise typer.BadParameter("BUILD_ID and --build-id differ; give only one", param_hint="--build-id")
844
+ build_id = build_id if build_id is not None else build_id_arg
845
+ remote = current_remote()
846
+ if isinstance(remote, GitHubRemote):
847
+ gh = require_gh()
848
+ pr_warnings_mod.run_github(
849
+ gh,
850
+ pr_id=None if build_id else gh_pr.resolve_pr_id(gh, pr_id, target_branch),
851
+ build_id=build_id,
852
+ as_json=as_json,
853
+ )
854
+ return
855
+ pr_warnings_mod.run_ado(remote, pat, target_branch, pr_id=pr_id, build_id=build_id, as_json=as_json)
856
+
857
+
815
858
  @pr_app.command("info")
816
859
  def pr_info(
817
860
  as_json: bool = typer.Option(
@@ -1074,6 +1117,9 @@ def pr_watch_deploy(
1074
1117
  actual deployment -- as opposed to `bdt pr status`, which watches builds/checks tied to a PR
1075
1118
  (Azure DevOps or GitHub, auto-detected).
1076
1119
 
1120
+ Only the runs of the commit the branch points at (the merge) count; with --wait one not queued
1121
+ yet is waited for, up to 10 minutes.
1122
+
1077
1123
  No --pr-id here: this watches a branch-triggered run, not any particular PR.
1078
1124
  """
1079
1125
  remote = current_remote()
@@ -2160,6 +2206,18 @@ def ci_plan_cmd(
2160
2206
  raise typer.Exit(ci_plan_env.run(pr_source, pr_target, label))
2161
2207
 
2162
2208
 
2209
+ @ci_app.command("warnings", context_settings={"allow_extra_args": True, "ignore_unknown_options": True})
2210
+ def ci_warnings_cmd(
2211
+ command: list[str] = typer.Argument(..., help="The command to run, after `--`: `bdt ci warnings -- bun run build`"),
2212
+ ) -> None:
2213
+ """Run a command and report the warnings it only prints to the CI system (a pipeline warning on Azure
2214
+ Pipelines, an annotation on GitHub Actions), so `bdt pr status` counts them and `bdt pr warnings` lists them.
2215
+ Recognises vite/rolldown (`[INEFFECTIVE_DYNAMIC_IMPORT] ...`, `(!) ...`) and the `warnings summary` of pytest.
2216
+ The output is passed through as it comes and the command's exit code is kept.
2217
+ """
2218
+ raise typer.Exit(ci_warnings_mod.run(command))
2219
+
2220
+
2163
2221
  @app.command("lint")
2164
2222
  def lint(
2165
2223
  paths: list[str] = typer.Argument(
@@ -25,10 +25,11 @@ from pathlib import Path
25
25
  from typing import Any
26
26
  from urllib.parse import quote
27
27
 
28
- from bmsdna.devtools import pr_cancel, pr_issue_link
28
+ from bmsdna.devtools import build_warnings, pr_cancel, pr_issue_link
29
29
  from bmsdna.devtools.cli_tools import (
30
30
  CLI_TIMEOUT_SECS,
31
31
  EXIT_NEEDS_APPROVAL,
32
+ EXIT_WAIT_TIMEOUT,
32
33
  PollHeartbeat,
33
34
  WaitDeadline,
34
35
  detect_agent_session,
@@ -491,15 +492,20 @@ def abandon(gh: GitHubClient, reason: str, pr_id: int | None = None, session_id:
491
492
  print(f"Added an '{pr_cancel.ABANDON_PREFIX}' comment to PR #{number}")
492
493
 
493
494
 
494
- def get_workflow_runs_for_branch(gh: GitHubClient, branch: str, limit: int = 5) -> list[dict]:
495
+ def get_workflow_runs_for_branch(
496
+ gh: GitHubClient, branch: str, limit: int = 5, head_sha: str | None = None
497
+ ) -> list[dict]:
495
498
  """Workflow runs triggered directly by a push to `branch` -- e.g. a post-merge/deployment
496
499
  workflow that only runs on the target branch once a PR merges into it -- as opposed to a
497
500
  run some open PR's `pull_request` trigger produced. `event=push` is what distinguishes the
498
501
  two on the same branch name.
499
502
 
500
- Each run is `{databaseId, name, workflowName, status, conclusion, url, headBranch}`.
503
+ Each run is `{databaseId, name, workflowName, status, conclusion, url, headBranch, headSha}`.
501
504
  """
502
- data = gh.get(f"{gh.repo_path}/actions/runs", params={"branch": branch, "event": "push", "per_page": limit})
505
+ params: dict[str, Any] = {"branch": branch, "event": "push", "per_page": limit}
506
+ if head_sha:
507
+ params["head_sha"] = head_sha
508
+ data = gh.get(f"{gh.repo_path}/actions/runs", params=params)
503
509
  return [
504
510
  {
505
511
  "databaseId": r["id"],
@@ -509,11 +515,30 @@ def get_workflow_runs_for_branch(gh: GitHubClient, branch: str, limit: int = 5)
509
515
  "conclusion": r.get("conclusion"),
510
516
  "url": r.get("html_url"),
511
517
  "headBranch": r.get("head_branch"),
518
+ "headSha": r.get("head_sha"),
512
519
  }
513
520
  for r in (data.get("workflow_runs") or [])[:limit]
514
521
  ]
515
522
 
516
523
 
524
+ def branch_tip(gh: GitHubClient, branch: str) -> str | None:
525
+ """The commit `branch` points at now; None if there is no such branch."""
526
+ r = gh.request("GET", f"{gh.repo_path}/git/ref/heads/{quote(branch, safe='/')}", ok=(404,))
527
+ return None if r.status_code == 404 else r.json()["object"]["sha"]
528
+
529
+
530
+ def note_other_waiting_runs(gh: GitHubClient, branch: str, merge_commit: str) -> None:
531
+ """Mention runs of older commits that wait for a reviewer: worth knowing, but nothing this merge waits on."""
532
+ others = [r for r in get_workflow_runs_for_branch(gh, branch, limit=20) if r.get("headSha") != merge_commit]
533
+ for r in latest_per_workflow(others):
534
+ if r.get("status") == "waiting":
535
+ print(
536
+ f"Note: {r.get('workflowName') or r.get('name') or '?'} #{r['databaseId']} (commit "
537
+ f"{(r.get('headSha') or '?')[:8]}, not this merge) waits for a reviewer to approve the deployment "
538
+ f"— {r.get('url', '?')}"
539
+ )
540
+
541
+
517
542
  def latest_per_workflow(runs: list[dict]) -> list[dict]:
518
543
  """Reduce a workflow run list to the single latest run per workflow."""
519
544
  latest: dict = {}
@@ -553,6 +578,21 @@ def print_check(check: dict) -> None:
553
578
  print(f" [{icon} {bucket.upper()}] {check_label(check)}")
554
579
 
555
580
 
581
+ def print_warning_counts(gh: GitHubClient, checks: list[dict]) -> None:
582
+ """Best-effort: the warning count of each finished run behind `checks`, if it has any."""
583
+ lines = []
584
+ for run_id, label in check_runs(checks, {"pass", "fail", "cancel"}):
585
+ try:
586
+ count = len(build_warnings.github_warnings(gh, run_id))
587
+ except SystemExit:
588
+ continue
589
+ if count:
590
+ lines.append(f" Run #{run_id} ({label}): {build_warnings.count_text(count, run_id)}")
591
+ if lines:
592
+ print("\nWarnings:")
593
+ print("\n".join(lines))
594
+
595
+
556
596
  def exit_needs_approval(msg: str, item_lines: list[str], rerun_cmd: str) -> None:
557
597
  """Print the "Waiting for approval" report for already-formatted `item_lines` and exit
558
598
  EXIT_NEEDS_APPROVAL -- shared by `run()` and `run_watch_deploy()`, which differ only in
@@ -662,6 +702,7 @@ def _status(gh: GitHubClient, wait: bool, pr_id: int | None, timeout: float, dea
662
702
  print("\nDetails:")
663
703
  for c in checks:
664
704
  print_check(c)
705
+ print_warning_counts(gh, checks)
665
706
 
666
707
  cancelled = cancellation(gh, pr["number"], checks) if "cancel" in buckets else None
667
708
  if cancelled is not None:
@@ -734,23 +775,49 @@ def print_run(gh: GitHubClient, run: dict) -> None:
734
775
  print_failed_step_logs(gh, run_id)
735
776
 
736
777
 
778
+ DEPLOY_APPEAR_TIMEOUT_SECS = 600 # how long `watch-deploy --wait` waits for the merge's first run to be queued
779
+
780
+
737
781
  def run_watch_deploy(gh: GitHubClient, target_branch: str, wait: bool) -> None:
738
- """Watch the most recent workflow run(s) triggered directly by a push to `target_branch`
739
- -- e.g. a post-merge workflow that only runs on the target branch once a PR merges into
740
- it, and usually does the actual deployment -- until they complete.
782
+ """Watch the workflow run(s) of the commit `target_branch` points at now -- normally the merge that just landed,
783
+ whose post-merge workflow usually does the actual deployment -- until they complete.
741
784
 
742
- Mirrors `run()`'s polling/reporting shape, but looks at runs tied to the branch's push
743
- event via `get_workflow_runs_for_branch` rather than a PR's `statusCheckRollup`.
785
+ Mirrors `run()`'s polling/reporting shape, but looks at runs tied to the branch's push event via
786
+ `get_workflow_runs_for_branch`, asking for those of that commit only. With --wait, a merge whose
787
+ run isn't queued yet is waited for, up to `DEPLOY_APPEAR_TIMEOUT_SECS`.
744
788
  """
789
+ merge_commit = branch_tip(gh, target_branch)
790
+ if merge_commit is None:
791
+ sys.exit(f"No branch '{target_branch}' in {gh.repo_path} (or the token cannot read the repository contents).")
792
+
745
793
  heartbeat = PollHeartbeat()
794
+ appear_by = time.monotonic() + DEPLOY_APPEAR_TIMEOUT_SECS
795
+ others_noted = False
746
796
  while True:
747
- runs = get_workflow_runs_for_branch(gh, target_branch)
797
+ runs = get_workflow_runs_for_branch(gh, target_branch, head_sha=merge_commit)
798
+ if not others_noted:
799
+ note_other_waiting_runs(gh, target_branch, merge_commit)
800
+ others_noted = True
748
801
  if not runs:
749
- print(f"No workflow runs found on '{target_branch}' triggered by a push.")
750
- return
802
+ msg = f"\rBranch '{target_branch}' at {merge_commit[:8]} | no workflow run of this commit yet"
803
+ if not wait:
804
+ print(
805
+ f"{msg}.\n\nTip: Use --wait to wait up to {DEPLOY_APPEAR_TIMEOUT_SECS // 60} min for one to start."
806
+ )
807
+ return
808
+ if time.monotonic() > appear_by:
809
+ print(msg)
810
+ print(
811
+ f"\nNo workflow run of {merge_commit[:8]} started on '{target_branch}' within "
812
+ f"{DEPLOY_APPEAR_TIMEOUT_SECS // 60} min: this branch may have no post-merge workflow."
813
+ )
814
+ sys.exit(EXIT_WAIT_TIMEOUT)
815
+ heartbeat.show(f"{msg}, waiting up to {DEPLOY_APPEAR_TIMEOUT_SECS // 60} min for one to start")
816
+ time.sleep(30)
817
+ continue
751
818
 
752
819
  latest_runs = latest_per_workflow(runs)
753
- msg = f"\rBranch '{target_branch}' | " + ", ".join(
820
+ msg = f"\rBranch '{target_branch}' at {merge_commit[:8]} | " + ", ".join(
754
821
  f"{(r.get('workflowName') or r.get('name'))} #{r['databaseId']} {r.get('status')} ({r.get('conclusion') or '—'})"
755
822
  for r in latest_runs
756
823
  )