bmsdna-devtools 0.52.0__tar.gz → 0.53.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 (135) hide show
  1. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/PKG-INFO +11 -3
  2. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/README.md +10 -2
  3. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/ci_plan_env.py +7 -3
  4. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/pipeline.py +14 -6
  5. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/report.py +4 -1
  6. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/04_facts.sql +12 -11
  7. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/05_views.sql +5 -1
  8. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/pyproject.toml +1 -1
  9. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_ci_plan_env.py +41 -0
  10. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_usage.py +31 -1
  11. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/uv.lock +1 -1
  12. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/.github/workflows/auto-release.yml +0 -0
  13. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/.github/workflows/python-publish.yml +0 -0
  14. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/.github/workflows/python-test.yml +0 -0
  15. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/.gitignore +0 -0
  16. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/.python-version +0 -0
  17. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/__init__.py +0 -0
  18. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/_api_dump.py +0 -0
  19. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/ado_auth.py +0 -0
  20. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/ado_issue.py +0 -0
  21. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/agent_mentions.py +0 -0
  22. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/api_usage.py +0 -0
  23. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/app_service_logs.py +0 -0
  24. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/azure_arm.py +0 -0
  25. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/azure_auth.py +0 -0
  26. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/bdt_config.py +0 -0
  27. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/business_user.py +0 -0
  28. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/ci_plan.py +0 -0
  29. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/cli.py +0 -0
  30. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/cli_tools.py +0 -0
  31. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/commit.py +0 -0
  32. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/dead_code.py +0 -0
  33. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/env_config.py +0 -0
  34. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/env_files.py +0 -0
  35. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/find_injection.py +0 -0
  36. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/find_repo.py +0 -0
  37. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/gh_args.py +0 -0
  38. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/gh_issue.py +0 -0
  39. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/gh_pr.py +0 -0
  40. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/github_api.py +0 -0
  41. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/gitrepo.py +0 -0
  42. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/injection_frontend.py +0 -0
  43. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/injection_python.py +0 -0
  44. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/issue_do.py +0 -0
  45. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/issue_show.py +0 -0
  46. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/issue_watch.py +0 -0
  47. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint.py +0 -0
  48. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint_findings.py +0 -0
  49. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint_models.py +0 -0
  50. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint_sql.py +0 -0
  51. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint_sql_files.py +0 -0
  52. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint_tooling.py +0 -0
  53. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/lint_typescript.py +0 -0
  54. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/logs.py +0 -0
  55. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_build.py +0 -0
  56. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_cancel.py +0 -0
  57. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_choice.py +0 -0
  58. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_create_args.py +0 -0
  59. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_info.py +0 -0
  60. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_issue_link.py +0 -0
  61. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_labels.py +0 -0
  62. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_markdown.py +0 -0
  63. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_merge_defaults.py +0 -0
  64. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pr_ref.py +0 -0
  65. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/pull.py +0 -0
  66. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/testdb.py +0 -0
  67. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/translate.py +0 -0
  68. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/__init__.py +0 -0
  69. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/cli.py +0 -0
  70. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/pricing.py +0 -0
  71. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
  72. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
  73. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
  74. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
  75. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
  76. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/bmsdna/devtools/worktree.py +0 -0
  77. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/justfile +0 -0
  78. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/skills/bmsdna-devtools/SKILL.md +0 -0
  79. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/conftest.py +0 -0
  80. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/fake_github.py +0 -0
  81. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_ado_auth.py +0 -0
  82. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_ado_issue.py +0 -0
  83. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_ado_issue_flow.py +0 -0
  84. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_agent_mentions.py +0 -0
  85. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_api_usage.py +0 -0
  86. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_app_service_logs.py +0 -0
  87. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_azure_arm.py +0 -0
  88. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_bdt_config.py +0 -0
  89. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_business_user.py +0 -0
  90. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_ci_plan.py +0 -0
  91. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_cli_cleanup.py +0 -0
  92. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_cli_commit.py +0 -0
  93. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_cli_issue.py +0 -0
  94. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_cli_pr_create.py +0 -0
  95. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_cli_pr_id.py +0 -0
  96. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_cli_pull.py +0 -0
  97. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_cli_tools.py +0 -0
  98. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_cli_version.py +0 -0
  99. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_commit.py +0 -0
  100. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_env_config.py +0 -0
  101. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_env_files.py +0 -0
  102. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_find_injection.py +0 -0
  103. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_find_repo.py +0 -0
  104. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_gh_issue.py +0 -0
  105. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_gh_pr.py +0 -0
  106. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_github_api.py +0 -0
  107. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_gitrepo.py +0 -0
  108. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_issue_do.py +0 -0
  109. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_issue_for_me.py +0 -0
  110. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_issue_show.py +0 -0
  111. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_issue_watch.py +0 -0
  112. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_lint.py +0 -0
  113. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_lint_models.py +0 -0
  114. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_lint_sql.py +0 -0
  115. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_lint_sql_files.py +0 -0
  116. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_lint_tooling.py +0 -0
  117. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_lint_typescript.py +0 -0
  118. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_logs.py +0 -0
  119. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pr_build.py +0 -0
  120. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pr_build_create_options.py +0 -0
  121. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pr_build_flow.py +0 -0
  122. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pr_cancel_build.py +0 -0
  123. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pr_choice.py +0 -0
  124. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pr_create_args.py +0 -0
  125. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pr_description_not_truncated.py +0 -0
  126. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pr_info.py +0 -0
  127. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pr_issue_link.py +0 -0
  128. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pr_labels.py +0 -0
  129. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pr_markdown.py +0 -0
  130. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pr_merge_defaults.py +0 -0
  131. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_pull.py +0 -0
  132. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_testdb.py +0 -0
  133. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_translate.py +0 -0
  134. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_wait_timeout.py +0 -0
  135. {bmsdna_devtools-0.52.0 → bmsdna_devtools-0.53.0}/tests/test_worktree_clean.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: bmsdna-devtools
3
- Version: 0.52.0
3
+ Version: 0.53.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
@@ -934,8 +934,12 @@ Order of decision, always logged with its reason:
934
934
  4. Anything unreadable (label API, change list) runs everything: a missing decision never silently skips tests.
935
935
 
936
936
  Outputs (Azure Pipelines variables with `isOutput=true`; plain `name=value` lines elsewhere): `runTests`, and per tier
937
- (`unit`, `e2e`, ...) `<tier>Run`, `<tier>Areas` and `<tier>Paths`, a shell-quoted argument list for the runner. A
938
- tier you do not configure and split by area (e.g. flat unit tests) is simply gated on `runTests`.
937
+ (`unit`, `e2e`, ...) `<tier>Run`, `<tier>Areas` and `<tier>Paths`, a shell-quoted argument list for the runner (repo-
938
+ relative). A tier you do not configure and split by area (e.g. flat unit tests) is simply gated on `runTests`. For
939
+ custom sharding or a runner that does not take paths, use `<tier>Areas` (a space-separated list: keep area names free
940
+ of whitespace if you split it): in folder mode the `<tier>Paths` of a full run
941
+ is the bare tier folder, which may also hold things that are not tests (`.venv`, `test-results`); in glob mode it is the
942
+ list of test files either way. A moved file counts as changed under both its old and its new path.
939
943
 
940
944
  ```yaml
941
945
  - stage: Plan
@@ -1260,6 +1264,10 @@ writes `report.html` (charts plus a table view, light/dark) with CSV / Parquet e
1260
1264
  (`~/.cache/bdt/usage/`, or `--db` / `--out`). The report is self-contained and contains your session titles and agent
1261
1265
  descriptions, so look at it before sharing it.
1262
1266
 
1267
+ - **Before vs. after:** the turns of a session before it loaded `dev-workflow` (or ran its first workflow command such as
1268
+ `bdt worktree`) are their own step, "Before dev-workflow was loaded", for the main thread and for the subagents spawned
1269
+ then. Everything from that point on is split into the steps below. The summary has `cost_before_workflow` /
1270
+ `cost_after_workflow`. Sessions that never load it are not counted, unless `--scope all`.
1263
1271
  - **Steps:** setup, plan, plan review, implement, test, screenshots, design review, quick review, full review, publish / CI.
1264
1272
  Every model turn is assigned to one by markers in its tool calls: skill calls (`bms-code-review --quick|--full`,
1265
1273
  `design-review`, `bms-plan-review`; for codex, reading the skill's `SKILL.md`), `bdt` commands, edits (`apply_patch` for
@@ -916,8 +916,12 @@ Order of decision, always logged with its reason:
916
916
  4. Anything unreadable (label API, change list) runs everything: a missing decision never silently skips tests.
917
917
 
918
918
  Outputs (Azure Pipelines variables with `isOutput=true`; plain `name=value` lines elsewhere): `runTests`, and per tier
919
- (`unit`, `e2e`, ...) `<tier>Run`, `<tier>Areas` and `<tier>Paths`, a shell-quoted argument list for the runner. A
920
- tier you do not configure and split by area (e.g. flat unit tests) is simply gated on `runTests`.
919
+ (`unit`, `e2e`, ...) `<tier>Run`, `<tier>Areas` and `<tier>Paths`, a shell-quoted argument list for the runner (repo-
920
+ relative). A tier you do not configure and split by area (e.g. flat unit tests) is simply gated on `runTests`. For
921
+ custom sharding or a runner that does not take paths, use `<tier>Areas` (a space-separated list: keep area names free
922
+ of whitespace if you split it): in folder mode the `<tier>Paths` of a full run
923
+ is the bare tier folder, which may also hold things that are not tests (`.venv`, `test-results`); in glob mode it is the
924
+ list of test files either way. A moved file counts as changed under both its old and its new path.
921
925
 
922
926
  ```yaml
923
927
  - stage: Plan
@@ -1242,6 +1246,10 @@ writes `report.html` (charts plus a table view, light/dark) with CSV / Parquet e
1242
1246
  (`~/.cache/bdt/usage/`, or `--db` / `--out`). The report is self-contained and contains your session titles and agent
1243
1247
  descriptions, so look at it before sharing it.
1244
1248
 
1249
+ - **Before vs. after:** the turns of a session before it loaded `dev-workflow` (or ran its first workflow command such as
1250
+ `bdt worktree`) are their own step, "Before dev-workflow was loaded", for the main thread and for the subagents spawned
1251
+ then. Everything from that point on is split into the steps below. The summary has `cost_before_workflow` /
1252
+ `cost_after_workflow`. Sessions that never load it are not counted, unless `--scope all`.
1245
1253
  - **Steps:** setup, plan, plan review, implement, test, screenshots, design review, quick review, full review, publish / CI.
1246
1254
  Every model turn is assigned to one by markers in its tool calls: skill calls (`bms-code-review --quick|--full`,
1247
1255
  `design-review`, `bms-plan-review`; for codex, reading the skill's `SKILL.md`), `bdt` commands, edits (`apply_patch` for
@@ -116,11 +116,15 @@ def _git(
116
116
 
117
117
  def changed_files(target: str, *, merge_checkout: bool) -> list[str]:
118
118
  """Files the PR changes: in CI HEAD is the synthetic PR merge commit, compared with its first parent (the target);
119
- for a local dry run the branch is compared with `origin/<target>` (it may contain ordinary merges)."""
119
+ for a local dry run the branch is compared with `origin/<target>` (it may contain ordinary merges).
120
+ `--no-renames` lists a moved file under its old path too: rename detection would hide the old path, so code moved
121
+ into a `non_code` folder (or a test moved between areas) would look like nothing happened to the old place.
122
+ `-z` keeps non-ASCII and other unusual names unquoted (git's default quoting would defeat every glob)."""
120
123
  diff = ("HEAD^1", "HEAD") if merge_checkout else (f"origin/{target}...HEAD",)
124
+ out = _git("diff", "--name-only", "--no-renames", "-z", *diff).stdout
121
125
  return [
122
- line for line in _git("diff", "--name-only", *diff).stdout.splitlines() if line
123
- ]
126
+ path for path in out.split("\0") if path
127
+ ] # -z: git would quote names like test_\303\274ber.py
124
128
 
125
129
 
126
130
  def verify_fix_base(env: Mapping[str, str]) -> None:
@@ -16,6 +16,10 @@ if TYPE_CHECKING:
16
16
  import duckdb
17
17
 
18
18
  REVIEW_PHASES = {"review_quick", "review_full"}
19
+ # Turns of a workflow-following thread before it loaded dev-workflow are counted (as `pre_workflow`), turns of threads
20
+ # that never follow it are not (`outside`). Neither reacts to markers.
21
+ PRE_WORKFLOW = "pre_workflow"
22
+ INACTIVE_PHASES = {"outside", PRE_WORKFLOW}
19
23
  KIND_RANK = {"start": 0, "skill": 1, "review_agent": 2, "cmd": 3, "edit": 4, "soft": 5, "once": 6}
20
24
 
21
25
  # Bump when the rec_* tables or their parsing change: caches with another version are rebuilt.
@@ -56,7 +60,8 @@ def assign_phases(con: duckdb.DuckDBPyConnection, scope: str) -> None:
56
60
 
57
61
  A thread that follows the workflow (invoked dev-workflow, or scope='all') starts in 'setup' and
58
62
  switches phase on the next marker; the phase stays "sticky" until the next one (test runs are the
59
- exception: they only count for the turn that runs them). Other spawned threads inherit the phase of
63
+ exception: they only count for the turn that runs them). What such a thread did before it loaded
64
+ dev-workflow is 'pre_workflow' (also for the subagents spawned then). Other spawned threads inherit the phase of
60
65
  the message that spawned them and only react to strong markers (review/design/plan skills).
61
66
  """
62
67
  msgs_by_thread: dict[str, list[tuple[str, datetime]]] = defaultdict(list)
@@ -101,7 +106,7 @@ def assign_phases(con: duckdb.DuckDBPyConnection, scope: str) -> None:
101
106
  if scope == "all":
102
107
  for tid, items in msgs_by_thread.items():
103
108
  if tid not in meta:
104
- start_ts[tid] = items[0][1]
109
+ start_ts.setdefault(tid, items[0][1])
105
110
 
106
111
  phase_of: dict[str, str] = {}
107
112
  sticky_of: dict[str, str] = {} # the phase a spawned thread inherits
@@ -109,17 +114,20 @@ def assign_phases(con: duckdb.DuckDBPyConnection, scope: str) -> None:
109
114
 
110
115
  def run_thread(tid: str, inherited: str) -> None:
111
116
  agent_type = meta.get(tid, (None, ""))[1]
112
- if "bms-review-" in agent_type and inherited not in REVIEW_PHASES and inherited != "outside":
117
+ if "bms-review-" in agent_type and inherited not in REVIEW_PHASES and inherited not in INACTIVE_PHASES:
113
118
  inherited = "review_full"
114
- phase, started, begin = inherited, False, start_ts.get(tid)
119
+ begin = start_ts.get(tid)
120
+ if begin is not None and inherited == "outside":
121
+ inherited = PRE_WORKFLOW
122
+ phase, started = inherited, False
115
123
  for mid, ts in msgs_by_thread[tid]:
116
124
  if begin is not None and not started and ts >= begin:
117
125
  phase, started = "setup", True
118
126
  once = None
119
127
  for ph, kind in sorted(markers.get(mid, []), key=lambda m: KIND_RANK[m[1]]):
120
- if kind == "skill" and phase != "outside":
128
+ if kind == "skill" and phase not in INACTIVE_PHASES:
121
129
  phase = ph
122
- elif kind == "review_agent" and phase != "outside" and phase not in REVIEW_PHASES:
130
+ elif kind == "review_agent" and phase not in INACTIVE_PHASES and phase not in REVIEW_PHASES:
123
131
  phase = ph
124
132
  elif kind in ("cmd", "edit") and started:
125
133
  phase = ph
@@ -183,6 +183,8 @@ def findings(con) -> list[str]:
183
183
  f"Screenshots as a step take <b>{pct('screenshots'):.0f}%</b>, but the {img_stats['n']} images themselves (≈{img_stats['tok']:,} tokens in total) "
184
184
  f"only cause an estimated <b>{100 * (img['c'] or 0) / (img['t'] or 1):.1f}%</b> of cost by being re-read from context; the step is expensive because of the browser loop around them, not the pixels.",
185
185
  f"Subagents account for <b>{s['pct_cost_subagents']:.0f}%</b> of the workflow cost.",
186
+ f"<b>{s['pct_cost_before_workflow']:.0f}%</b> (${s['cost_before_workflow']:,.0f}) was spent before dev-workflow was loaded, "
187
+ f"<b>${s['cost_after_workflow']:,.0f}</b> after.",
186
188
  ]
187
189
  ctx = max(steps, key=lambda r: r["avg_context_tok"])
188
190
  out.append(f"Every turn re-reads the whole context (average {ctx['avg_context_tok'] / 1000:.0f}K tokens in the heaviest step), so a step's cost is mostly its <i>number of turns</i> times that context.")
@@ -271,7 +273,7 @@ __UNPRICED__
271
273
  <div class="scroll">__TABLE__</div>
272
274
 
273
275
  <h2>How to read this</h2>
274
- <p class="note">Each assistant message is assigned to a workflow step by markers in the tool calls (Skill calls such as bms-code-review or design-review, <code>bdt</code> commands, edits, pytest, screenshot tooling, image reads). A step is sticky until the next marker, except test runs, which only count for the turn that runs them. Subagents inherit the step of the message that spawned them, unless they run the whole workflow themselves. Rules live in <code>sql/03_markers.sql</code> and <code>pipeline.py</code>. Attribution of turns that sit between two markers is a judgement call, treat differences of a few percent as noise. "Publish, CI &amp; follow-ups" includes everything after the PR goes up (git, <code>az repos</code>, merges, fixes that are not edits).</p>
276
+ <p class="note">Each assistant message is assigned to a workflow step by markers in the tool calls (Skill calls such as bms-code-review or design-review, <code>bdt</code> commands, edits, pytest, screenshot tooling, image reads). A step is sticky until the next marker, except test runs, which only count for the turn that runs them. Turns of a session before it loaded dev-workflow (or ran its first workflow command) are their own step, "Before dev-workflow was loaded", so the part of a session that never went through the workflow is not mixed into its steps. Subagents inherit the step of the message that spawned them, unless they run the whole workflow themselves. Rules live in <code>sql/03_markers.sql</code> and <code>pipeline.py</code>. Attribution of turns that sit between two markers is a judgement call, treat differences of a few percent as noise. "Publish, CI &amp; follow-ups" includes everything after the PR goes up (git, <code>az repos</code>, merges, fixes that are not edits).</p>
275
277
  </main>
276
278
  <script>
277
279
  const SERIES = __SERIES__, INK = __INK__;
@@ -311,6 +313,7 @@ def write_report(con: duckdb.DuckDBPyConnection, out_dir: Path) -> Path:
311
313
  (f"{s['tokens'] / 1e9:.2f} B", "tokens processed"),
312
314
  (f"{s['fresh_tokens'] / 1e6:.0f} M", "fresh tokens (no cache reads)"),
313
315
  (f"{s['pct_cost_subagents']:.0f}%", "of cost in subagents"),
316
+ (f"{s['pct_cost_before_workflow']:.0f}%", "of cost before dev-workflow was loaded"),
314
317
  *((f"{r['pct_tokens']:.1f}%", f"of tokens in {r['provider']}") for r in providers if r["provider"] != "claude"),
315
318
  ]
316
319
  figs = {
@@ -5,17 +5,18 @@ INSERT INTO pricing VALUES __PRICE_ROWS__;
5
5
  CREATE OR REPLACE TABLE phases (phase VARCHAR, ord INTEGER, label VARCHAR);
6
6
  INSERT INTO phases VALUES
7
7
  ('outside', 0, 'Outside workflow'),
8
- ('setup', 1, 'Setup & investigation (until draft PR)'),
9
- ('plan', 2, 'Plan'),
10
- ('plan_review', 3, 'Plan review'),
11
- ('implement', 4, 'Implement'),
12
- ('test', 5, 'Test / lint'),
13
- ('screenshots', 6, 'Screenshots'),
14
- ('design_review', 7, 'Design review'),
15
- ('review_quick', 8, 'Review (quick, mid-work)'),
16
- ('review_full', 9, 'Review (full, pre-publish)'),
17
- ('publish_ci', 10, 'Publish, CI & follow-ups'),
18
- ('cleanup', 11, 'Cleanup');
8
+ ('pre_workflow', 1, 'Before dev-workflow was loaded'),
9
+ ('setup', 2, 'Setup & investigation (until draft PR)'),
10
+ ('plan', 3, 'Plan'),
11
+ ('plan_review', 4, 'Plan review'),
12
+ ('implement', 5, 'Implement'),
13
+ ('test', 6, 'Test / lint'),
14
+ ('screenshots', 7, 'Screenshots'),
15
+ ('design_review', 8, 'Design review'),
16
+ ('review_quick', 9, 'Review (quick, mid-work)'),
17
+ ('review_full', 10, 'Review (full, pre-publish)'),
18
+ ('publish_ci', 11, 'Publish, CI & follow-ups'),
19
+ ('cleanup', 12, 'Cleanup');
19
20
 
20
21
  -- Estimated image tokens sitting in each thread's context when a message is sent.
21
22
  CREATE OR REPLACE TABLE ctx_img AS
@@ -1,4 +1,5 @@
1
- -- All "v_" views only look at in-scope rows (phase <> 'outside') and report shares of that total.
1
+ -- All "v_" views only look at in-scope rows (phase <> 'outside') and report shares of that total. That includes
2
+ -- 'pre_workflow': what a workflow-following thread did before it loaded dev-workflow, kept apart from the steps after it.
2
3
  -- `facts` keeps cost NULL for turns of a model without a price; the views count those as 0 (they say how many there
3
4
  -- are: v_summary.unpriced_msgs) so every number below is a plain number.
4
5
  CREATE OR REPLACE VIEW f AS
@@ -95,6 +96,9 @@ CREATE OR REPLACE VIEW v_summary AS
95
96
  SELECT count(DISTINCT session_id) AS sessions, count(DISTINCT thread_id) AS threads, count(*) AS msgs,
96
97
  sum(total_tok) AS tokens, sum(fresh_tok) AS fresh_tokens, sum(cost) AS cost,
97
98
  100 * sum(cost) FILTER (WHERE actor_kind = 'subagent') / sum(cost) AS pct_cost_subagents,
99
+ coalesce(sum(cost) FILTER (WHERE phase = 'pre_workflow'), 0) AS cost_before_workflow,
100
+ coalesce(sum(cost) FILTER (WHERE phase <> 'pre_workflow'), 0) AS cost_after_workflow,
101
+ 100 * coalesce(sum(cost) FILTER (WHERE phase = 'pre_workflow'), 0) / sum(cost) AS pct_cost_before_workflow,
98
102
  (SELECT count(*) FROM images i WHERE i.thread_id IN (SELECT thread_id FROM f)) AS images,
99
103
  count(*) FILTER (WHERE NOT priced) AS unpriced_msgs,
100
104
  string_agg(DISTINCT model, ', ') FILTER (WHERE NOT priced) AS unpriced_models,
@@ -10,7 +10,7 @@ packages = ["bmsdna"]
10
10
 
11
11
  [project]
12
12
  name = "bmsdna-devtools"
13
- version = "0.52.0"
13
+ version = "0.53.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
@@ -369,3 +369,44 @@ def test_vso_commands_cannot_be_split_by_untrusted_text(capsys) -> None:
369
369
  lines = capsys.readouterr().out.splitlines()
370
370
  assert len(lines) == 2
371
371
  assert "%0A" in lines[0] and "%0A" in lines[1] and "100%AZP25" in lines[1]
372
+
373
+
374
+ def test_changed_files_lists_a_moved_file_under_its_old_path_too(
375
+ clone, monkeypatch
376
+ ) -> None:
377
+ """Rename detection would show only docs/app.py: code moved into a non_code folder must not look like a docs change."""
378
+ monkeypatch.chdir(clone)
379
+ git(
380
+ clone, "config", "diff.renames", "true"
381
+ ) # the detection --no-renames must override, whatever the user has set
382
+ (clone / "src").mkdir()
383
+ (clone / "docs").mkdir()
384
+ (clone / "src/app.py").write_text("def f():\n return 1\n")
385
+ git(clone, "add", "-A")
386
+ git(clone, "commit", "-q", "-m", "app")
387
+ git(clone, "push", "-q", "origin", "main")
388
+ git(clone, "checkout", "-q", "-b", "move")
389
+ git(clone, "mv", "src/app.py", "docs/app.py")
390
+ git(clone, "commit", "-q", "-m", "move")
391
+ assert sorted(ci_plan_env.changed_files("main", merge_checkout=False)) == [
392
+ "docs/app.py",
393
+ "src/app.py",
394
+ ]
395
+ git(clone, "checkout", "-q", "main")
396
+ git(clone, "merge", "-q", "--no-ff", "-m", "merge", "move")
397
+ assert sorted(ci_plan_env.changed_files("main", merge_checkout=True)) == [
398
+ "docs/app.py",
399
+ "src/app.py",
400
+ ]
401
+
402
+
403
+ def test_changed_files_keeps_non_ascii_names_unquoted(clone, monkeypatch) -> None:
404
+ monkeypatch.chdir(clone)
405
+ git(clone, "checkout", "-q", "-b", "umlaut")
406
+ (clone / "tests").mkdir()
407
+ (clone / "tests/test_über.py").write_text("")
408
+ git(clone, "add", "-A")
409
+ git(clone, "commit", "-q", "-m", "umlaut")
410
+ assert ci_plan_env.changed_files("main", merge_checkout=False) == [
411
+ "tests/test_über.py"
412
+ ]
@@ -159,7 +159,7 @@ def phases(con) -> dict[str, str]:
159
159
 
160
160
  def test_phase_assignment(con) -> None:
161
161
  p = phases(con)
162
- assert p["m0"] == "outside"
162
+ assert p["m0"] == "pre_workflow"
163
163
  assert p["m1"] == "setup"
164
164
  assert p["m2"] == "plan"
165
165
  assert p["m3"] == "implement"
@@ -168,6 +168,36 @@ def test_phase_assignment(con) -> None:
168
168
  assert p["m6"] == "review_full"
169
169
 
170
170
 
171
+ def test_before_and_after_loading_dev_workflow_are_kept_apart(con, tmp_path) -> None:
172
+ before, after = con.execute("SELECT cost_before_workflow, cost_after_workflow FROM v_summary").fetchone()
173
+ (m0,) = con.execute("SELECT cost FROM facts WHERE mid = 'm0'").fetchone()
174
+ assert before == pytest.approx(m0)
175
+ (total,) = con.execute("SELECT sum(cost) FROM v_steps WHERE phase <> 'pre_workflow'").fetchone()
176
+ assert after == pytest.approx(total)
177
+ assert con.execute("SELECT label FROM v_steps ORDER BY ord LIMIT 1").fetchone() == ("Before dev-workflow was loaded",)
178
+
179
+ c = duckdb.connect()
180
+ pipeline.build(c, tmp_path / "claude", tmp_path / "codex", scope="all")
181
+ assert phases(c)["m0"] == "pre_workflow" # scope=all does not fold the turns before the workflow into the steps
182
+ assert phases(c)["o1"] == "setup"
183
+
184
+
185
+ def test_subagents_spawned_before_the_workflow_was_loaded_are_pre_workflow(tmp_path) -> None:
186
+ proj = tmp_path / "proj"
187
+ sid = "55555555-5555-5555-5555-555555555555"
188
+ _write(proj / f"{sid}.jsonl", [
189
+ _assistant("a0", sid, 0, ("Agent", "toolu_B", {"subagent_type": "Explore", "description": "x", "prompt": "look around"})),
190
+ _assistant("a1", sid, 5, ("Skill", "t1", {"skill": "dev-workflow:dev-workflow"})),
191
+ _assistant("a2", sid, 6, ("Bash", "t2", {"command": "bdt pr create --draft"})),
192
+ ])
193
+ sub = proj / sid / "subagents"
194
+ _write(sub / "agent-BBB.jsonl", [{**_assistant("b1", sid, 1, ("Edit", "t9", {"file_path": "/repo/a.py"}), sidechain=True), "agentId": "BBB"}])
195
+ (sub / "agent-BBB.meta.json").write_text(json.dumps({"agentType": "Explore", "description": "x", "toolUseId": "toolu_B", "spawnDepth": 1}))
196
+ c = duckdb.connect()
197
+ pipeline.build(c, proj)
198
+ assert phases(c) == {"a0": "pre_workflow", "b1": "pre_workflow", "a1": "setup", "a2": "plan"} # an edit pre-workflow stays pre-workflow
199
+
200
+
171
201
  def test_other_sessions_stay_out_of_scope(con) -> None:
172
202
  assert phases(con)["o1"] == phases(con)["o2"] == "outside"
173
203
 
@@ -51,7 +51,7 @@ wheels = [
51
51
 
52
52
  [[package]]
53
53
  name = "bmsdna-devtools"
54
- version = "0.52.0"
54
+ version = "0.53.0"
55
55
  source = { editable = "." }
56
56
  dependencies = [
57
57
  { name = "azure-identity" },