bmsdna-devtools 1.2.0__tar.gz → 1.3.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 (154) hide show
  1. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/PKG-INFO +5 -1
  2. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/README.md +4 -0
  3. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pr_build.py +39 -2
  4. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/pyproject.toml +1 -1
  5. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_build_flow.py +76 -0
  6. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/uv.lock +1 -1
  7. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/.github/workflows/auto-release.yml +0 -0
  8. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/.github/workflows/python-publish.yml +0 -0
  9. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/.github/workflows/python-test.yml +0 -0
  10. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/.gitignore +0 -0
  11. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/.python-version +0 -0
  12. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/__init__.py +0 -0
  13. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/_api_dump.py +0 -0
  14. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/ado_auth.py +0 -0
  15. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/ado_issue.py +0 -0
  16. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/agent_mentions.py +0 -0
  17. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/api_usage.py +0 -0
  18. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/app_service_logs.py +0 -0
  19. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/azure_arm.py +0 -0
  20. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/azure_auth.py +0 -0
  21. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/bdt_config.py +0 -0
  22. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/business_user.py +0 -0
  23. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/ci_plan.py +0 -0
  24. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/ci_plan_env.py +0 -0
  25. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/cli.py +0 -0
  26. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/cli_tools.py +0 -0
  27. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/commit.py +0 -0
  28. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/dead_code.py +0 -0
  29. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/deps/__init__.py +0 -0
  30. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/deps/advisories.py +0 -0
  31. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/deps/cli.py +0 -0
  32. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/deps/cooldown.py +0 -0
  33. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/deps/lockfiles.py +0 -0
  34. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/deps/osv.py +0 -0
  35. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/deps/versions.py +0 -0
  36. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/env_config.py +0 -0
  37. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/env_files.py +0 -0
  38. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/find_injection.py +0 -0
  39. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/find_repo.py +0 -0
  40. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/gh_args.py +0 -0
  41. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/gh_issue.py +0 -0
  42. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/gh_pr.py +0 -0
  43. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/github_api.py +0 -0
  44. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/gitrepo.py +0 -0
  45. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/injection_frontend.py +0 -0
  46. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/injection_python.py +0 -0
  47. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/issue_do.py +0 -0
  48. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/issue_show.py +0 -0
  49. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/issue_watch.py +0 -0
  50. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/lint.py +0 -0
  51. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/lint_findings.py +0 -0
  52. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/lint_models.py +0 -0
  53. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/lint_sql.py +0 -0
  54. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/lint_sql_files.py +0 -0
  55. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/lint_tooling.py +0 -0
  56. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/lint_typescript.py +0 -0
  57. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/logs.py +0 -0
  58. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pr_cancel.py +0 -0
  59. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pr_choice.py +0 -0
  60. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pr_create_args.py +0 -0
  61. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pr_drift.py +0 -0
  62. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pr_info.py +0 -0
  63. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pr_issue_link.py +0 -0
  64. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pr_labels.py +0 -0
  65. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pr_list.py +0 -0
  66. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pr_markdown.py +0 -0
  67. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pr_merge_defaults.py +0 -0
  68. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pr_ref.py +0 -0
  69. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/pull.py +0 -0
  70. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/testdb.py +0 -0
  71. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/translate.py +0 -0
  72. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/usage/__init__.py +0 -0
  73. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/usage/cli.py +0 -0
  74. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/usage/pipeline.py +0 -0
  75. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/usage/pricing.py +0 -0
  76. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/usage/report.py +0 -0
  77. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
  78. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
  79. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
  80. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
  81. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
  82. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/usage/sql/04_facts.sql +0 -0
  83. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/usage/sql/05_views.sql +0 -0
  84. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/bmsdna/devtools/worktree.py +0 -0
  85. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/justfile +0 -0
  86. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/prek.toml +0 -0
  87. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/skills/bmsdna-devtools/SKILL.md +0 -0
  88. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/conftest.py +0 -0
  89. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/fake_github.py +0 -0
  90. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_ado_auth.py +0 -0
  91. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_ado_issue.py +0 -0
  92. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_ado_issue_flow.py +0 -0
  93. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_agent_mentions.py +0 -0
  94. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_api_usage.py +0 -0
  95. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_app_service_logs.py +0 -0
  96. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_azure_arm.py +0 -0
  97. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_bdt_config.py +0 -0
  98. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_business_user.py +0 -0
  99. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_ci_plan.py +0 -0
  100. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_ci_plan_env.py +0 -0
  101. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_cli_cleanup.py +0 -0
  102. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_cli_commit.py +0 -0
  103. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_cli_deps.py +0 -0
  104. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_cli_issue.py +0 -0
  105. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_cli_pr_create.py +0 -0
  106. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_cli_pr_id.py +0 -0
  107. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_cli_pull.py +0 -0
  108. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_cli_tools.py +0 -0
  109. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_cli_version.py +0 -0
  110. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_commit.py +0 -0
  111. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_deps_advisories.py +0 -0
  112. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_deps_cooldown.py +0 -0
  113. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_deps_lockfiles.py +0 -0
  114. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_deps_osv.py +0 -0
  115. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_deps_versions.py +0 -0
  116. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_env_config.py +0 -0
  117. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_env_files.py +0 -0
  118. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_find_injection.py +0 -0
  119. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_find_repo.py +0 -0
  120. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_gh_issue.py +0 -0
  121. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_gh_pr.py +0 -0
  122. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_github_api.py +0 -0
  123. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_gitrepo.py +0 -0
  124. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_issue_do.py +0 -0
  125. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_issue_for_me.py +0 -0
  126. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_issue_show.py +0 -0
  127. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_issue_watch.py +0 -0
  128. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_lint.py +0 -0
  129. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_lint_models.py +0 -0
  130. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_lint_sql.py +0 -0
  131. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_lint_sql_files.py +0 -0
  132. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_lint_tooling.py +0 -0
  133. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_lint_typescript.py +0 -0
  134. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_logs.py +0 -0
  135. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_build.py +0 -0
  136. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_build_create_options.py +0 -0
  137. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_cancel_build.py +0 -0
  138. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_choice.py +0 -0
  139. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_create_args.py +0 -0
  140. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_description_not_truncated.py +0 -0
  141. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_drift.py +0 -0
  142. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_info.py +0 -0
  143. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_issue_link.py +0 -0
  144. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_labels.py +0 -0
  145. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_list.py +0 -0
  146. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_markdown.py +0 -0
  147. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pr_merge_defaults.py +0 -0
  148. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_pull.py +0 -0
  149. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_testdb.py +0 -0
  150. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_translate.py +0 -0
  151. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_usage.py +0 -0
  152. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_wait_timeout.py +0 -0
  153. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.0}/tests/test_worktree_clean.py +0 -0
  154. {bmsdna_devtools-1.2.0 → bmsdna_devtools-1.3.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.2.0
3
+ Version: 1.3.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
@@ -76,6 +76,10 @@ interactive (an agent, CI): pass `--pr-id N` or `--target BRANCH` then. Exactly
76
76
  Only `pr create` and `pr watch-deploy`, which need a branch rather than a PR, default `--target` / `--target-branch`
77
77
  to `dev`.
78
78
 
79
+ Once the builds are done, the output says whether the PR merged (Azure DevOps): a completed PR is `PR #42 is merged into 'dev'.`;
80
+ an open one with auto-complete set gets 15 seconds to merge, then `PR #42 was merged into 'dev' by auto-complete.` or
81
+ `PR #42 is not merged yet (auto-complete is set by …); it merges once the remaining policies pass.` (or `… could not look again.` if that request fails; a conflict that appeared meanwhile is reported as an error, exit 1)
82
+
79
83
  If the PR can't be merged, that's reported immediately instead of polling
80
84
  for builds/checks that will never run — e.g. on Azure DevOps:
81
85
  `PR #42 ('feat: widgets') has merge conflicts with the target branch (mergeStatus=conflicts)`;
@@ -57,6 +57,10 @@ interactive (an agent, CI): pass `--pr-id N` or `--target BRANCH` then. Exactly
57
57
  Only `pr create` and `pr watch-deploy`, which need a branch rather than a PR, default `--target` / `--target-branch`
58
58
  to `dev`.
59
59
 
60
+ Once the builds are done, the output says whether the PR merged (Azure DevOps): a completed PR is `PR #42 is merged into 'dev'.`;
61
+ an open one with auto-complete set gets 15 seconds to merge, then `PR #42 was merged into 'dev' by auto-complete.` or
62
+ `PR #42 is not merged yet (auto-complete is set by …); it merges once the remaining policies pass.` (or `… could not look again.` if that request fails; a conflict that appeared meanwhile is reported as an error, exit 1)
63
+
60
64
  If the PR can't be merged, that's reported immediately instead of polling
61
65
  for builds/checks that will never run — e.g. on Azure DevOps:
62
66
  `PR #42 ('feat: widgets') has merge conflicts with the target branch (mergeStatus=conflicts)`;
@@ -137,7 +137,7 @@ def has_build_policy(session: requests.Session, remote: AdoRemote, branch: str)
137
137
  """
138
138
  try:
139
139
  return _build_policy_lookup(session, remote, branch)
140
- except requests.RequestException, SystemExit:
140
+ except requests.RequestException:
141
141
  return False
142
142
 
143
143
 
@@ -150,7 +150,7 @@ def lacks_build_policy(session: requests.Session, remote: AdoRemote, branch: str
150
150
  """
151
151
  try:
152
152
  return not _build_policy_lookup(session, remote, branch)
153
- except requests.RequestException, SystemExit:
153
+ except requests.RequestException:
154
154
  return False
155
155
 
156
156
 
@@ -919,6 +919,40 @@ def deploy_build_hint(session: requests.Session, remote: AdoRemote, target_branc
919
919
  )
920
920
 
921
921
 
922
+ AUTO_COMPLETE_GRACE_SECS = 15 # how long Azure DevOps gets to merge a PR whose auto-complete just became satisfiable
923
+
924
+
925
+ def merge_outcome(
926
+ session: requests.Session, remote: AdoRemote, pr: dict, deadline: WaitDeadline | None = None
927
+ ) -> str | None:
928
+ """Best-effort one-line answer to "did it merge?" once the PR's builds are done, None when there is nothing to add.
929
+
930
+ A completed PR is reported as merged. An active one with auto-complete set is merged by Azure DevOps a moment after
931
+ its last policy passes, not at the same instant: give it `AUTO_COMPLETE_GRACE_SECS`, look again, and say whether
932
+ it did. A request failure looking again fails open (the build report stands on its own), like `deploy_build_hint`; a merge
933
+ conflict that appeared meanwhile is not swallowed (`get_pr_by_id` exits with it).
934
+ """
935
+ target = (pr.get("targetRefName") or "").removeprefix("refs/heads/")
936
+ into = f" into '{target}'" if target else ""
937
+ if pr.get("status") == "completed":
938
+ return f"\nPR #{pr['pullRequestId']} is merged{into}."
939
+ if pr.get("status") != "active" or not pr.get("autoCompleteSetBy"):
940
+ return None
941
+ by = (pr["autoCompleteSetBy"].get("displayName") or "").strip()
942
+ auto = f"auto-complete is set{f' by {by}' if by else ''}"
943
+ if deadline is not None:
944
+ deadline.sleep(AUTO_COMPLETE_GRACE_SECS)
945
+ else:
946
+ time.sleep(AUTO_COMPLETE_GRACE_SECS)
947
+ try:
948
+ fresh = get_pr_by_id(session, remote, pr["pullRequestId"])
949
+ except requests.RequestException:
950
+ return f"\nPR #{pr['pullRequestId']} is not merged yet ({auto}); could not look again."
951
+ if fresh.get("status") == "completed":
952
+ return f"\nPR #{pr['pullRequestId']} was merged{into} by auto-complete."
953
+ return f"\nPR #{pr['pullRequestId']} is not merged yet ({auto}); it merges once the remaining policies pass."
954
+
955
+
922
956
  def latest_per_pipeline(builds: list) -> list:
923
957
  """Reduce a build list to the single latest build per pipeline (definition)."""
924
958
  latest: dict = {}
@@ -1465,6 +1499,9 @@ def _status(
1465
1499
  # otherwise it'd claim a merge/deploy is underway before the PR's own build
1466
1500
  # has even completed.
1467
1501
  if all_done:
1502
+ outcome = merge_outcome(session, remote, pr, deadline)
1503
+ if outcome:
1504
+ print(outcome)
1468
1505
  hint = deploy_build_hint(session, remote, target_branch)
1469
1506
  if hint:
1470
1507
  print(hint)
@@ -10,7 +10,7 @@ packages = ["bmsdna"]
10
10
 
11
11
  [project]
12
12
  name = "bmsdna-devtools"
13
- version = "1.2.0"
13
+ version = "1.3.0"
14
14
  description = "Shared Azure DevOps / GitHub / git / Azure Monitor developer tooling for BMS projects"
15
15
  readme = "README.md"
16
16
  requires-python = ">=3.14" # pgdevkit>=0.7.1 requires 3.14; was >=3.11 before adding it as a dependency
@@ -731,3 +731,79 @@ def test_link_work_item_is_idempotent() -> None:
731
731
  link_work_item(session, REMOTE, 42, 7)
732
732
 
733
733
  session.patch.assert_not_called()
734
+
735
+
736
+ def _run_status_with_pr(monkeypatch, pr: dict, fresh_pr: dict | BaseException | None = None) -> list[float]:
737
+ """`run` (no --wait) against one succeeded build; returns the sleeps asked for. `fresh_pr` is what looking the
738
+ PR up by id again finds."""
739
+ sleeps: list[float] = []
740
+ ci_build = {**DEPLOY_BUILD, "id": 5, "definition": {"id": 2, "name": "CI"}}
741
+
742
+ def fake_get_pr_by_id(session, remote, pr_id):
743
+ if fresh_pr is None:
744
+ pytest.fail("must not look the PR up again")
745
+ if isinstance(fresh_pr, BaseException):
746
+ raise fresh_pr
747
+ return fresh_pr
748
+
749
+ monkeypatch.setattr("bmsdna.devtools.pr_build.requests.Session", MagicMock)
750
+ monkeypatch.setattr("bmsdna.devtools.pr_build.get_pr", lambda session, remote, source, target: pr)
751
+ monkeypatch.setattr("bmsdna.devtools.pr_build.get_pr_by_id", fake_get_pr_by_id)
752
+ monkeypatch.setattr("bmsdna.devtools.pr_build.get_builds_for_pr", lambda session, remote, source, pr_id: [ci_build])
753
+ monkeypatch.setattr("bmsdna.devtools.pr_build.deploy_build_hint", lambda session, remote, target: None)
754
+ monkeypatch.setattr("bmsdna.devtools.cli_tools.time.sleep", sleeps.append)
755
+ run(REMOTE, "fake-pat", "main", wait=False, source_branch="feature-x")
756
+ return sleeps
757
+
758
+
759
+ AUTO_COMPLETE_PR = {
760
+ "pullRequestId": 1,
761
+ "title": "feat: x",
762
+ "status": "active",
763
+ "isDraft": False,
764
+ "targetRefName": "refs/heads/dev",
765
+ "autoCompleteSetBy": {"displayName": "Adrian"},
766
+ }
767
+
768
+
769
+ def test_run_reports_a_completed_pr_as_merged_without_waiting(monkeypatch, capsys) -> None:
770
+ pr = {**AUTO_COMPLETE_PR, "status": "completed"}
771
+
772
+ sleeps = _run_status_with_pr(monkeypatch, pr)
773
+
774
+ assert sleeps == []
775
+ assert "PR #1 is merged into 'dev'." in capsys.readouterr().out
776
+
777
+
778
+ def test_run_waits_then_reports_auto_complete_merge(monkeypatch, capsys) -> None:
779
+ sleeps = _run_status_with_pr(monkeypatch, AUTO_COMPLETE_PR, fresh_pr={**AUTO_COMPLETE_PR, "status": "completed"})
780
+
781
+ assert sleeps == [15]
782
+ assert "PR #1 was merged into 'dev' by auto-complete." in capsys.readouterr().out
783
+
784
+
785
+ def test_run_says_auto_complete_has_not_merged_yet(monkeypatch, capsys) -> None:
786
+ sleeps = _run_status_with_pr(monkeypatch, AUTO_COMPLETE_PR, fresh_pr=AUTO_COMPLETE_PR)
787
+
788
+ assert sleeps == [15]
789
+ assert "PR #1 is not merged yet (auto-complete is set by Adrian)" in capsys.readouterr().out
790
+
791
+
792
+ def test_run_fails_open_when_looking_the_pr_up_again_fails(monkeypatch, capsys) -> None:
793
+ _run_status_with_pr(monkeypatch, AUTO_COMPLETE_PR, fresh_pr=requests.ConnectionError("boom"))
794
+
795
+ assert "not merged yet" in capsys.readouterr().out
796
+
797
+
798
+ def test_run_adds_nothing_for_an_open_pr_without_auto_complete(monkeypatch, capsys) -> None:
799
+ pr = {k: v for k, v in AUTO_COMPLETE_PR.items() if k != "autoCompleteSetBy"}
800
+
801
+ sleeps = _run_status_with_pr(monkeypatch, pr)
802
+
803
+ assert sleeps == []
804
+ assert "merged" not in capsys.readouterr().out
805
+
806
+
807
+ def test_run_does_not_hide_a_conflict_that_appeared_during_the_auto_complete_wait(monkeypatch) -> None:
808
+ with pytest.raises(SystemExit, match="merge conflicts"):
809
+ _run_status_with_pr(monkeypatch, AUTO_COMPLETE_PR, fresh_pr=SystemExit("PR #1 has merge conflicts"))
@@ -58,7 +58,7 @@ wheels = [
58
58
 
59
59
  [[package]]
60
60
  name = "bmsdna-devtools"
61
- version = "1.2.0"
61
+ version = "1.3.0"
62
62
  source = { editable = "." }
63
63
  dependencies = [
64
64
  { name = "azure-identity" },