bmsdna-devtools 1.6.0__tar.gz → 1.7.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.
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/PKG-INFO +1 -1
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pr_build.py +23 -1
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/pyproject.toml +1 -1
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_build.py +95 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/uv.lock +1 -1
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/.github/workflows/auto-release.yml +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/.github/workflows/python-publish.yml +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/.github/workflows/python-test.yml +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/.gitignore +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/.python-version +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/README.md +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/__init__.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/_api_dump.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/ado_auth.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/ado_issue.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/agent_mentions.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/api_usage.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/app_service_logs.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/azure_arm.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/azure_auth.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/bdt_config.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/business_user.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/ci_plan.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/ci_plan_env.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/cleanup_scan.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/cli.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/cli_tools.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/commit.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/dead_code.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/deps/__init__.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/deps/advisories.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/deps/cli.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/deps/cooldown.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/deps/lockfiles.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/deps/osv.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/deps/versions.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/env_config.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/env_files.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/find_injection.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/find_repo.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/gh_args.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/gh_issue.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/gh_pr.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/github_api.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/gitrepo.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/injection_frontend.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/injection_python.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/issue_do.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/issue_show.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/issue_watch.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/lint.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/lint_findings.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/lint_models.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/lint_sql.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/lint_sql_files.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/lint_tooling.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/lint_typescript.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/logs.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pr_cancel.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pr_choice.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pr_create_args.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pr_drift.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pr_info.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pr_issue_link.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pr_labels.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pr_list.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pr_markdown.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pr_merge_defaults.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pr_ref.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/pull.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/testdb.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/translate.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/__init__.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/cli.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/pipeline.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/pricing.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/report.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/sql/04_facts.sql +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/sql/05_views.sql +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/worktree.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/justfile +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/prek.toml +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/skills/bmsdna-devtools/SKILL.md +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/conftest.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/fake_github.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_ado_auth.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_ado_issue.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_ado_issue_flow.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_agent_mentions.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_api_usage.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_app_service_logs.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_azure_arm.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_bdt_config.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_business_user.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_ci_plan.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_ci_plan_env.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_cleanup_scan.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_cli_cleanup.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_cli_commit.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_cli_deps.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_cli_issue.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_cli_pr_create.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_cli_pr_id.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_cli_pull.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_cli_tools.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_cli_version.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_commit.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_deps_advisories.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_deps_cooldown.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_deps_lockfiles.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_deps_osv.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_deps_versions.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_env_config.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_env_files.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_find_injection.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_find_repo.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_gh_issue.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_gh_pr.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_github_api.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_gitrepo.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_issue_do.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_issue_for_me.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_issue_show.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_issue_watch.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_lint.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_lint_models.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_lint_sql.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_lint_sql_files.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_lint_tooling.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_lint_typescript.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_logs.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_build_create_options.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_build_flow.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_cancel_build.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_choice.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_create_args.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_description_not_truncated.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_drift.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_info.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_issue_link.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_labels.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_list.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_markdown.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pr_merge_defaults.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_pull.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_testdb.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_translate.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_usage.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_wait_timeout.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_worktree_clean.py +0 -0
- {bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/tests/test_worktree_create.py +0 -0
|
@@ -1277,6 +1277,22 @@ def cancelled_for_current_push(build: dict, pr: dict) -> bool:
|
|
|
1277
1277
|
return current is None or build.get("sourceVersion") == current
|
|
1278
1278
|
|
|
1279
1279
|
|
|
1280
|
+
def build_is_current(build: dict, pr: dict, source_head: str | None) -> bool:
|
|
1281
|
+
"""A build of what the PR is at right now, so the answer to `--wait` even when it finished before `--wait` started
|
|
1282
|
+
(one of an older push is a leftover to wait past). `source_head` is what the source branch points at now; None
|
|
1283
|
+
(unknown) means not current. A build of exactly that commit (a branch build) is current. A PR validation build is
|
|
1284
|
+
one of the PR's merge commit, and that only counts once Azure DevOps has seen the newest push, i.e. the PR's merge
|
|
1285
|
+
was computed from `source_head`: before that, `lastMergeCommit` still belongs to the previous push."""
|
|
1286
|
+
if not source_head:
|
|
1287
|
+
return False
|
|
1288
|
+
if build.get("sourceVersion") == source_head:
|
|
1289
|
+
return True
|
|
1290
|
+
merged_from = (pr.get("lastMergeSourceCommit") or {}).get("commitId")
|
|
1291
|
+
return merged_from == source_head and build.get("sourceVersion") == (pr.get("lastMergeCommit") or {}).get(
|
|
1292
|
+
"commitId"
|
|
1293
|
+
)
|
|
1294
|
+
|
|
1295
|
+
|
|
1280
1296
|
def print_build(session: requests.Session, remote: AdoRemote, build: dict) -> None:
|
|
1281
1297
|
build_id = build["id"]
|
|
1282
1298
|
status = build.get("status", "unknown")
|
|
@@ -1390,7 +1406,8 @@ def _status(
|
|
|
1390
1406
|
|
|
1391
1407
|
# When waiting, a pipeline's "latest" build may already be a *completed* run from before
|
|
1392
1408
|
# this invocation (CI hasn't registered a new build for the current push yet). Only accept
|
|
1393
|
-
# a fresh build in that case, so --wait doesn't immediately report that stale old result.
|
|
1409
|
+
# a fresh build in that case, so --wait doesn't immediately report that stale old result. Unless it is a build of the
|
|
1410
|
+
# PR's current head (`build_is_current`, judged on every poll): nothing newer is coming, waiting would hang forever.
|
|
1394
1411
|
# Only builds already completed at this snapshot go in here -- one that's inProgress here
|
|
1395
1412
|
# (whether just-started or long-running) is genuinely the current build for the current
|
|
1396
1413
|
# HEAD, not a stale leftover, and must be watched rather than waited past: recording it too
|
|
@@ -1451,11 +1468,16 @@ def _status(
|
|
|
1451
1468
|
if builds:
|
|
1452
1469
|
pipeline_builds = latest_per_pipeline(builds)
|
|
1453
1470
|
if wait:
|
|
1471
|
+
try:
|
|
1472
|
+
source_head = target_tip(session, remote, source_branch)
|
|
1473
|
+
except requests.RequestException:
|
|
1474
|
+
source_head = None # unknown: a build from before `--wait` stays a leftover, as before
|
|
1454
1475
|
stale = [
|
|
1455
1476
|
b
|
|
1456
1477
|
for b in pipeline_builds
|
|
1457
1478
|
if b["id"] <= baseline_completed_ids.get(b.get("definition", {}).get("id"), 0)
|
|
1458
1479
|
and not cancelled_for_current_push(b, pr)
|
|
1480
|
+
and not build_is_current(b, pr, source_head)
|
|
1459
1481
|
]
|
|
1460
1482
|
if stale:
|
|
1461
1483
|
msg += " | waiting for new build(s) to start: " + ", ".join(
|
|
@@ -10,7 +10,7 @@ packages = ["bmsdna"]
|
|
|
10
10
|
|
|
11
11
|
[project]
|
|
12
12
|
name = "bmsdna-devtools"
|
|
13
|
-
version = "1.
|
|
13
|
+
version = "1.7.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
|
|
@@ -8,6 +8,7 @@ from bmsdna.devtools.gitrepo import AdoRemote
|
|
|
8
8
|
from bmsdna.devtools.pr_build import (
|
|
9
9
|
_poll_or_exit,
|
|
10
10
|
approval_stage_name,
|
|
11
|
+
build_is_current,
|
|
11
12
|
build_web_url,
|
|
12
13
|
draft_notice,
|
|
13
14
|
find_pending_approvals,
|
|
@@ -446,3 +447,97 @@ def test_link_work_item_raises_on_http_error() -> None:
|
|
|
446
447
|
|
|
447
448
|
with pytest.raises(requests.HTTPError):
|
|
448
449
|
link_work_item(session, remote, pr_id=456, work_item_id=99)
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
HEAD = "a" * 40
|
|
453
|
+
MERGE = "b" * 40
|
|
454
|
+
OLD_HEAD = "c" * 40
|
|
455
|
+
CURRENT_PR = {
|
|
456
|
+
"pullRequestId": 42,
|
|
457
|
+
"title": "feat: widgets",
|
|
458
|
+
"status": "active",
|
|
459
|
+
"isDraft": False,
|
|
460
|
+
"lastMergeSourceCommit": {"commitId": HEAD},
|
|
461
|
+
"lastMergeCommit": {"commitId": MERGE},
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
def _done(build_id: int, source_version: str | None, definition: int = 1) -> dict:
|
|
466
|
+
return {
|
|
467
|
+
"id": build_id,
|
|
468
|
+
"status": "completed",
|
|
469
|
+
"result": "succeeded",
|
|
470
|
+
"sourceVersion": source_version,
|
|
471
|
+
"definition": {"id": definition, "name": f"pipeline-{definition}"},
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
@pytest.mark.parametrize(
|
|
476
|
+
("build", "pr", "head", "expected"),
|
|
477
|
+
[
|
|
478
|
+
(_done(1, MERGE), CURRENT_PR, HEAD, True), # PR validation build of the current merge commit
|
|
479
|
+
(_done(1, HEAD), CURRENT_PR, HEAD, True), # branch build of the current head
|
|
480
|
+
(_done(1, OLD_HEAD), CURRENT_PR, OLD_HEAD, True), # branch build of the head, merge metadata not caught up yet
|
|
481
|
+
(_done(1, "d" * 40), CURRENT_PR, HEAD, False), # build of an older merge commit
|
|
482
|
+
(_done(1, MERGE), CURRENT_PR, OLD_HEAD, False), # the branch moved on, the PR merge is not recomputed yet
|
|
483
|
+
(_done(1, HEAD), CURRENT_PR, OLD_HEAD, False), # a branch build of the previous head
|
|
484
|
+
(_done(1, MERGE), CURRENT_PR, None, False), # head unknown: keep waiting like before
|
|
485
|
+
(_done(1, MERGE), {**CURRENT_PR, "lastMergeSourceCommit": None}, HEAD, False),
|
|
486
|
+
],
|
|
487
|
+
)
|
|
488
|
+
def test_build_is_current(build, pr, head, expected) -> None:
|
|
489
|
+
assert build_is_current(build, pr, head) is expected
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
def _wait_env(monkeypatch, builds: list[dict], head: str | None) -> None:
|
|
493
|
+
monkeypatch.setattr("bmsdna.devtools.pr_build.current_branch", lambda: "feature-x")
|
|
494
|
+
monkeypatch.setattr("bmsdna.devtools.ado_auth.auth_header", lambda pat: {})
|
|
495
|
+
monkeypatch.setattr("bmsdna.devtools.pr_build.get_pr", lambda *a, **k: CURRENT_PR)
|
|
496
|
+
monkeypatch.setattr("bmsdna.devtools.pr_build.get_builds_for_pr", lambda *a, **k: builds)
|
|
497
|
+
monkeypatch.setattr("bmsdna.devtools.pr_build.target_tip", lambda *a, **k: head)
|
|
498
|
+
monkeypatch.setattr("bmsdna.devtools.pr_build.target_drift_or_none", lambda *a, **k: None)
|
|
499
|
+
monkeypatch.setattr("bmsdna.devtools.pr_build.find_pending_approvals", lambda *a, **k: [])
|
|
500
|
+
monkeypatch.setattr("bmsdna.devtools.pr_build.print_build", lambda *a, **k: None)
|
|
501
|
+
|
|
502
|
+
|
|
503
|
+
def test_run_wait_reports_builds_that_finished_before_it_started(monkeypatch, capsys) -> None:
|
|
504
|
+
"""Regression: `--wait` started after the builds of the PR's current head had completed used to treat them as
|
|
505
|
+
leftovers of an earlier push and wait for new builds that never come."""
|
|
506
|
+
_wait_env(monkeypatch, [_done(11, MERGE, 1), _done(12, MERGE, 2)], HEAD)
|
|
507
|
+
monkeypatch.setattr("bmsdna.devtools.pr_build.time.sleep", lambda s: pytest.fail("must not wait for a new build"))
|
|
508
|
+
|
|
509
|
+
run(AdoRemote("myorg", "MyProj", "myrepo"), pat=None, target_branch="main", wait=True)
|
|
510
|
+
|
|
511
|
+
assert "waiting for new build" not in capsys.readouterr().out
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
def test_run_wait_waits_when_the_branch_moved_past_the_finished_build(monkeypatch) -> None:
|
|
515
|
+
"""A push landed after the build of HEAD finished: the source tip is newer, so that build is a leftover."""
|
|
516
|
+
|
|
517
|
+
class MovedOnError(Exception):
|
|
518
|
+
pass
|
|
519
|
+
|
|
520
|
+
def sleep(_: float) -> None:
|
|
521
|
+
raise MovedOnError
|
|
522
|
+
|
|
523
|
+
_wait_env(monkeypatch, [_done(11, HEAD)], OLD_HEAD)
|
|
524
|
+
monkeypatch.setattr("bmsdna.devtools.pr_build.time.sleep", sleep)
|
|
525
|
+
monkeypatch.setattr("bmsdna.devtools.cli_tools.time.sleep", sleep)
|
|
526
|
+
|
|
527
|
+
with pytest.raises(MovedOnError):
|
|
528
|
+
run(AdoRemote("myorg", "MyProj", "myrepo"), pat=None, target_branch="main", wait=True)
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
def test_run_wait_still_waits_past_builds_of_an_older_push(monkeypatch) -> None:
|
|
532
|
+
class WaitedError(Exception):
|
|
533
|
+
pass
|
|
534
|
+
|
|
535
|
+
def sleep(_: float) -> None:
|
|
536
|
+
raise WaitedError
|
|
537
|
+
|
|
538
|
+
_wait_env(monkeypatch, [_done(11, "d" * 40)], HEAD)
|
|
539
|
+
monkeypatch.setattr("bmsdna.devtools.pr_build.time.sleep", sleep)
|
|
540
|
+
monkeypatch.setattr("bmsdna.devtools.cli_tools.time.sleep", sleep)
|
|
541
|
+
|
|
542
|
+
with pytest.raises(WaitedError):
|
|
543
|
+
run(AdoRemote("myorg", "MyProj", "myrepo"), pat=None, target_branch="main", wait=True)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/sql/01_ingest_claude.sql
RENAMED
|
File without changes
|
{bmsdna_devtools-1.6.0 → bmsdna_devtools-1.7.0}/bmsdna/devtools/usage/sql/01_ingest_codex.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|