From 0c726a18acbd48e6bfaf3f3a4c5b294a349d38ad Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Sat, 21 Nov 2026 15:22:27 -0500 Subject: [PATCH 1/2] chore: remove non-necessary comment banners and narration Remove decorative section banners, box-rule dividers, and obvious code-restatement comments across 16 non-managed scripts and test files under ADR 0110 necessary posture (pure deletions; preserves all directives, SHA pins, security models, invariants, and decision rationale). Refs: melodic-software/control-hub#12 --- .cursor/install.sh | 3 -- .github/actions/_shared/install-release.sh | 1 - .github/actions/bump-versions/bump.py | 24 ---------- .../check-exec-bit/check-exec-bit.test.sh | 6 --- .../aggregate-results/run.sh | 9 ---- .../aggregate-results/run.test.sh | 45 ------------------- .../pr-require-checks/check-contract/run.sh | 23 ---------- .../check-contract/run.test.sh | 42 ----------------- .github/actions/shellcheck/run.test.sh | 4 -- .../scripts/check-managed-files-sync.test.cjs | 10 ----- .github/scripts/check-review-reads.test.cjs | 4 -- .github/scripts/pr-review-cli-chunks.test.cjs | 8 ---- .github/scripts/pr-review-cli-slices.test.cjs | 8 ---- .github/scripts/pr-review-cli.test.cjs | 8 ---- .../scripts/select-model-credential.test.cjs | 9 ---- .github/scripts/workflow-yaml.test.cjs | 4 -- 16 files changed, 208 deletions(-) diff --git a/.cursor/install.sh b/.cursor/install.sh index aa1c849d..6b3a45df 100755 --- a/.cursor/install.sh +++ b/.cursor/install.sh @@ -31,7 +31,6 @@ env_line() { grep -qxF "$1" "$profile" 2>/dev/null || printf '%s\n' "$1" >>"$profile" } -# --- Node, from .node-version via nvm -------------------------------------- if [[ -f .node-version ]]; then node_pin="$(tr -d '[:space:]' <.node-version)" export NVM_DIR="${NVM_DIR:-$HOME/.nvm}" @@ -73,7 +72,6 @@ if [[ -f .node-version ]]; then fi fi -# --- .NET SDK, from global.json -------------------------------------------- if [[ -f global.json ]]; then sdk="" if command -v node >/dev/null 2>&1; then @@ -114,7 +112,6 @@ if [[ -f global.json ]]; then fi fi -# --- Git history ------------------------------------------------------------ # Several checks diff against origin/main; deepen a shallow clone and make the # ref resolvable. Best effort — a fetch failure must not fail environment setup. git_dir="$(git rev-parse --git-dir 2>/dev/null || true)" diff --git a/.github/actions/_shared/install-release.sh b/.github/actions/_shared/install-release.sh index 231a6c4d..94384401 100755 --- a/.github/actions/_shared/install-release.sh +++ b/.github/actions/_shared/install-release.sh @@ -78,7 +78,6 @@ fi if [[ -n "$cached_asset" && -f "$cached_asset" ]] && printf '%s %s\n' "$SHA256" "$cached_asset" | sha256sum -c - >/dev/null 2>&1; then - # Cache hit: reuse the already-verified release asset (skip the network). cp -- "$cached_asset" "$asset" else # Nine backed-off attempts span ~4-5 minutes to outlast an upstream outage; a diff --git a/.github/actions/bump-versions/bump.py b/.github/actions/bump-versions/bump.py index b99cf4dd..f28f017d 100755 --- a/.github/actions/bump-versions/bump.py +++ b/.github/actions/bump-versions/bump.py @@ -89,9 +89,6 @@ def failure_text(exc: Exception) -> str: return str(exc) if isinstance(exc, BumpError) else f"{type(exc).__name__}: {exc}" -# ---------------------------------------------------------------- pure logic - - def parse_version(text: str) -> tuple[int, ...] | None: """Numeric dotted version, or None for anything else (prereleases included).""" return tuple(int(p) for p in text.split(".")) if VERSION_RE.match(text) else None @@ -305,9 +302,6 @@ def targets_marker(rows: list[dict[str, Any]]) -> str: return ",".join(f"{r['tool']}={r['target']}" for r in rows) -# ---------------------------------------------------------------- registry integrity - - def npm_signed_message(name: str, version: str, integrity: str) -> bytes: """What the npm registry signs for a version: `@:`.""" return f"{name}@{version}:{integrity}".encode() @@ -415,9 +409,6 @@ def uv_cpython_builds(metadata: dict[str, Any]) -> dict[str, int]: return builds -# ---------------------------------------------------------------- process helpers - - def run_raw( args: list[str], *, env: dict[str, str] | None = None, input_text: str | None = None ) -> subprocess.CompletedProcess[str]: @@ -533,9 +524,6 @@ def parse_date(text: str) -> dt.datetime: return dt.datetime.fromisoformat(text.replace("Z", "+00:00")) -# ---------------------------------------------------------------- resolve - - def list_releases( source: dict[str, Any], policy: dict[str, Any], now: dt.datetime ) -> list[Release]: @@ -696,9 +684,6 @@ def release_url(source: dict[str, Any], release: Release) -> str: return f"https://www.python.org/downloads/release/{release.meta['slug']}/" -# ---------------------------------------------------------------- verify and compute new values - - class Verifier: def __init__( self, tool: dict[str, Any], release: Release, work: Path, policy: dict[str, Any] @@ -1175,9 +1160,6 @@ def file_list_edits( return edits -# ---------------------------------------------------------------- rewrite - - def rewrite(edits: list[dict[str, Any]]) -> None: for name in dict.fromkeys(e["file"] for e in edits): file = Path(name) @@ -1206,9 +1188,6 @@ def changed_paths() -> list[str]: return run(["git", "diff", "--name-only"]).split() -# ---------------------------------------------------------------- commands - - def synced_cooldown_days(path: Path, policy_path: Path) -> dict[str, int]: """cooldownDays from the standards dependabot-policy copy the standards sync places here.""" try: @@ -1439,9 +1418,6 @@ def write_results(out: Path, results: dict[str, Any]) -> None: ) -# ---------------------------------------------------------------- publish - - def pr_title(bump: dict[str, Any], rows: list[dict[str, Any]]) -> str: if len(rows) == 1: return f"chore(deps): bump {rows[0]['tool']} to {rows[0]['target']}" diff --git a/.github/actions/check-exec-bit/check-exec-bit.test.sh b/.github/actions/check-exec-bit/check-exec-bit.test.sh index 4186f65c..ad7647bc 100755 --- a/.github/actions/check-exec-bit/check-exec-bit.test.sh +++ b/.github/actions/check-exec-bit/check-exec-bit.test.sh @@ -60,7 +60,6 @@ commit_all() { git -C "$repo" -c user.name='CI Test' -c user.email='ci-test@example.invalid' commit -qm 'test' } -# 100755 shebang script is clean. good="$temporary_directory/good" init_repo "$good" printf '#!/usr/bin/env bash\necho ok\n' >"$good/tool.sh" @@ -69,7 +68,6 @@ commit_all "$good" run_case '100755 shebang is clean' 0 "$good" expect_contains 'success message on a clean tree' 'All shebang files are mode 100755 in the index.' -# 100644 shebang script fails with the exact annotation. bad="$temporary_directory/bad" init_repo "$bad" printf '#!/usr/bin/env bash\necho bad\n' >"$bad/tool.sh" @@ -92,7 +90,6 @@ commit_all "$docs" run_case 'later-line #! in 100644 markdown is clean' 0 "$docs" expect_contains 'docs with a fenced shebang pass' 'All shebang files are mode 100755 in the index.' -# Path containing a space. space="$temporary_directory/space" init_repo "$space" mkdir -p -- "$space/bin dir" @@ -101,7 +98,6 @@ commit_all "$space" run_case '100644 shebang whose path contains a space fails' 1 "$space" expect_contains 'space path in the annotation' '::error file=bin dir/run me.sh::bin dir/run me.sh has a shebang but git index mode is 100644' -# PATHS pathspec that excludes the bad file. scoped="$temporary_directory/scoped" init_repo "$scoped" mkdir -p -- "$scoped/keep" "$scoped/skip" @@ -116,7 +112,6 @@ PATHS='skip' run_case 'PATHS still fails an in-scope 100644 shebang' 1 "$scoped" expect_contains 'scoped scan reports skip/bad.sh' '::error file=skip/bad.sh::' unset PATHS -# Empty repo / no shebang files. empty="$temporary_directory/empty" init_repo "$empty" printf 'plain text\n' >"$empty/notes.txt" @@ -124,7 +119,6 @@ commit_all "$empty" run_case 'no shebang files is clean' 0 "$empty" expect_contains 'empty shebang set prints success' 'All shebang files are mode 100755 in the index.' -# Mixed: one good 100755 and one bad 100644. mixed="$temporary_directory/mixed" init_repo "$mixed" printf '#!/usr/bin/env bash\necho good\n' >"$mixed/good.sh" diff --git a/.github/actions/pr-require-checks/aggregate-results/run.sh b/.github/actions/pr-require-checks/aggregate-results/run.sh index 515fc883..9e5ccda0 100755 --- a/.github/actions/pr-require-checks/aggregate-results/run.sh +++ b/.github/actions/pr-require-checks/aggregate-results/run.sh @@ -256,13 +256,11 @@ write_status() { return 1 } -# --------------------------------------------------------------------------- # Pending mode. Only the full run a contract-only run would wait for marks its # verdict pending: a contract-only run marking it would fail itself and every # sibling with nothing coming to replace the marker, a fork's token cannot # write, and a push has no contract-only sibling to protect. Each of those # passes with a notice, so the step is safe in a job that runs on every event. -# --------------------------------------------------------------------------- if [[ "$record_pending" == true ]]; then if [[ "$contract_only" == true ]]; then echo "::notice::contract-only event: ${STATUS_CONTEXT} is not marked pending; only a full run marks its own verdict pending." @@ -287,14 +285,12 @@ if [[ "$record_pending" == true ]]; then exit 0 fi -# --------------------------------------------------------------------------- # Carry-forward mode. Branched on first, before `same-repo`: the caller's # predicate makes `contract-only` false for every fork event, so the # true/false combination is unreachable from the defaults — but a caller that # overrides `contract-only` owns the claim that the lanes did not run, and the # runner honors it rather than second-guessing it into an aggregation over # results that are all `skipped`. -# --------------------------------------------------------------------------- # Newest `status-context` state written by the Actions bot on this SHA, or the # empty string when the context is absent. Sets `carried_state` rather than @@ -1488,9 +1484,6 @@ if [[ "$contract_only" == true ]]; then finish_carry_forward fi -# --------------------------------------------------------------------------- -# Full mode — aggregate the lane results. -# --------------------------------------------------------------------------- # Unquoted expansion word-splits on all of IFS (space, tab, newline), so a YAML # block scalar spanning lines is parsed in full. `read` would stop at the first # newline and silently skip every later lane. @@ -1536,13 +1529,11 @@ if [[ "$lanes_state" == success ]]; then echo "$lanes_description" fi -# --------------------------------------------------------------------------- # Record the verdict as a commit status (see `write_status`). # # A fork pull request is the one exception: its token cannot write a status at # all, and nothing will ever read one for it, so the run reports the lanes # verdict and stops. -# --------------------------------------------------------------------------- if [[ "$same_repo" != true ]]; then echo "::notice::fork pull request: lane state is not recorded; every event runs the full workflow" if [[ "$lanes_state" == failure ]]; then diff --git a/.github/actions/pr-require-checks/aggregate-results/run.test.sh b/.github/actions/pr-require-checks/aggregate-results/run.test.sh index 5423c2cd..a326351e 100755 --- a/.github/actions/pr-require-checks/aggregate-results/run.test.sh +++ b/.github/actions/pr-require-checks/aggregate-results/run.test.sh @@ -451,8 +451,6 @@ install_step_fixtures() { } install_step_fixtures -# --- carry-forward wait fixtures ------------------------------------------- - statuses_key="GET_repos_melodic-software_ci-workflows_commits_${sha}_statuses" current_run_key='GET_repos_melodic-software_ci-workflows_actions_runs_4242' # The run's workflow is read over GraphQL, the only GraphQL call this step makes. @@ -518,8 +516,6 @@ attempt_entry() { earlier_full_run="$(run_entry 4000 in_progress 2026-09-05T12:00:00Z)" -# --- full mode ------------------------------------------------------------- - # Without the lane-aggregation loop this passes anyway; without the status # write it fails on the missing payload assertion. echo 'case: full mode aggregates green lanes and records ci-lanes success' @@ -553,8 +549,6 @@ expect_log "POST repos/${repository}/statuses/${sha} failed (HTTP 500); sending expect_log "Recorded ci-lanes=success on ${sha}." rm -f -- "$fixtures/POST_repos_melodic-software_ci-workflows_statuses_${sha}.fail-times" -# --- rate limits ----------------------------------------------------------- -# # A 403 or 429 is classified from its message and headers, not its status, and # a rate limit waits once inside rate-limit-wait-seconds, then fails closed. status_post_key="POST_repos_melodic-software_ci-workflows_statuses_${sha}" @@ -712,8 +706,6 @@ run_case 1 'success' pass false yes expect_log "::error::same-repo must be 'true' or 'false', got: yes" expect_no_gh_call 'statuses/' -# --- fork pull requests ---------------------------------------------------- - # Without the same-repo branch the write is attempted, the fork's read-only # token refuses it, and the load-bearing failure turns every fork PR red. echo 'case: same-repo false skips the status write and passes on the lanes verdict' @@ -739,8 +731,6 @@ run_case 0 'skipped skipped' fail true false expect_log "Carried forward: ci-lanes is success on ${sha}" expect_no_gh_call 'statuses/' -# --- carry-forward mode ---------------------------------------------------- - # Without the carry-forward branch, `skipped skipped` under treat-skipped-as # fail would go red. echo 'case: carry-forward passes on a recorded ci-lanes success without aggregating' @@ -789,8 +779,6 @@ run_case 1 'skipped skipped' pass true expect_log "${fail_prefix}${absent_remedy}" rm -f -- "$fixtures/GET_repos_melodic-software_ci-workflows_commits_${sha}_statuses.err" -# --- carry-forward: forged statuses ---------------------------------------- -# # Any collaborator with write can POST a commit status. Without the creator # filter, one forged `ci-lanes=success` plus a label flip turns the sole # required check green over failing lanes. @@ -856,8 +844,6 @@ status_list "[$(bot_status 10 failure),$(full_run_success 20)]" run_case 0 'skipped skipped' pass true expect_log "Carried forward: ci-lanes is success on ${sha}" -# --- carry-forward: the writer must be this workflow ------------------------- - # Without the writer check this passes before any Actions call: the creator # check alone accepts the success. echo 'case: a success written by this workflow is carried after verifying its writer run' @@ -984,8 +970,6 @@ expect_no_log 'Carried forward' expect_no_gh_call 'actions/runs/4100' rm -f -- "$fixtures/${graphql_key}.err" -# --- GraphQL reads ------------------------------------------------------------- - # Without the GraphQL read this run's workflow costs a REST call. The same # case made 6 REST calls and no GraphQL call at 8b41a59 # (origin/main before this read moved to GraphQL); the status re-read after @@ -1051,8 +1035,6 @@ expect_log '::warning::run 4242 reported no workflow_id.' expect_no_log 'Carried forward' current_run -# --- carry-forward: pagination ----------------------------------------------- - # Without `--slurp` jq runs once per page, so the filter never sees both pages # together and the newest entry on a later page is not selected. echo 'case: the newest bot entry is selected across pages (failure on a later page)' @@ -1067,8 +1049,6 @@ run_case 0 'skipped skipped' pass true expect_log "Carried forward: ci-lanes is success on ${sha}" rm -f -- "$fixtures/${statuses_key}.pages.json" -# --- carry-forward: the bounded wait --------------------------------------- -# # Every case here sets the ceiling explicitly; the harness default is 0, which # keeps every case above on the fail-immediately path. @@ -1307,8 +1287,6 @@ run_case 1 'skipped skipped' pass true true CARRY_FORWARD_WAIT_SECONDS=soon expect_log '::error::carry-forward-wait-seconds must be a non-negative integer number of seconds, got: soon' expect_no_gh_calls_at_all -# --- carry-forward: waiting on ANY in-flight sibling ------------------------ - # Without waiting on a HIGHER-id sibling this reads the absent status on the # first poll and exits 1. The sibling is same-second AND higher-id, so # neither a `created_at` term nor a run-id term puts it in the wait set. @@ -1374,8 +1352,6 @@ run_case 1 'skipped skipped' pass true true CARRY_FORWARD_WAIT_SECONDS=60 expect_no_log 'Waiting ' expect_log "${fail_prefix}the lanes verdict is error; fix the failing lane" -# --- carry-forward: a stale failure while its writer re-runs ---------------- -# # Full run 4000 fails and records ci-lanes=failure at 12:00:10Z. Someone re-runs # it: attempt 2 starts at 12:00:20Z. A contract-only run arrives meanwhile. @@ -1583,8 +1559,6 @@ expect_no_log 'Waiting ' clear_status_fixtures -# --- pending mode ---------------------------------------------------------- - status_write_key="POST_repos_melodic-software_ci-workflows_statuses_${sha}" # Without pending mode, a contract-only run that reads the status while a full @@ -1639,8 +1613,6 @@ run_case 1 '' pass false true RECORD_PENDING=yes expect_log "::error::record-pending must be 'true' or 'false', got: yes" expect_no_gh_calls_at_all -# --- full mode: re-running failed contract-only siblings ------------------- - # completed_run completed_run() { printf '{"id":%s,"status":"completed","conclusion":"%s"}' "$1" "$2" @@ -1840,8 +1812,6 @@ expect_no_gh_calls_at_all clear_run_fixtures clear_rerun_fixtures -# --- input validation ------------------------------------------------------ -# # Every one of these values is interpolated into a `gh api` path. echo 'case: a malformed repository is rejected before any API call' @@ -1861,10 +1831,6 @@ run_case 0 'success success' pass false true STATUS_CONTEXT='CI Lanes' expect_log 'Recorded CI Lanes=success' expect_status_payload '"context": "CI Lanes"' -# --- metadata contract ----------------------------------------------------- - -# --- carry-forward: yield to a full run in flight ---------------------------- - # jobs_raw # The latest attempt's jobs of an in-flight run, where a running job's # conclusion is null. @@ -2560,8 +2526,6 @@ expect_log "Failed run(s) of this workflow on ${sha} to consider for a re-run: 5 expect_log "Re-running failed contract-only run 5000 on ${sha}." expect_log "Not re-running failed run 5100 on ${sha}: its latest attempt is not contract-only" -# --- full mode: waiting for in-flight contract-only siblings ----------------- - rerun_runs_count="$calls/${workflow_runs_key}.count" inflight_contract_only_jobs='[{"name":"lint","status":"completed","conclusion":"skipped"},{"name":"ci-status","status":"in_progress","conclusion":null}]' inflight_full_jobs='[{"name":"changes","status":"completed","conclusion":"success"},{"name":"lint","status":"in_progress","conclusion":null},{"name":"ci-status","status":"queued","conclusion":null}]' @@ -2737,9 +2701,6 @@ done reset_yield_fixtures -# --- carry-forward: the writer must be a full run, and no newer full run on -# the SHA may disagree --------------------------------------------------------- - runs_key_prefix='GET_repos_melodic-software_ci-workflows_actions_runs' # writer_run [run_attempt] # The writer run object with the start of its latest attempt. @@ -2965,8 +2926,6 @@ clear_writer_fixtures run_of_workflow 4100 777 reset_yield_fixtures -# --- carry-forward: reads reused across the writer check and the polls -------- - # row_of_run [status] # A run as the run listing shows it, with the fields the writer check reads. row_of_run() { @@ -3043,8 +3002,6 @@ run_of_workflow 4100 777 run_of_workflow 4000 777 reset_yield_fixtures -# --- this run's own gate job and step ------------------------------------------ - own_jobs_key='GET_repos_melodic-software_ci-workflows_actions_runs_4242_jobs' # own_jobs [call-number] # This run's latest-attempt jobs, on every read or only on the Nth. @@ -3555,8 +3512,6 @@ if [[ "$step_name_default" != " default: ''" ]]; then fail_case "action.yml does not default step-name to '' (got: ${step_name_default})" fi -# --- api-calls count ------------------------------------------------------- - summary_file="$temporary_directory/step-summary" calls_post_key="POST_repos_melodic-software_ci-workflows_statuses_${sha}" diff --git a/.github/actions/pr-require-checks/check-contract/run.sh b/.github/actions/pr-require-checks/check-contract/run.sh index bc456e62..db5433d7 100755 --- a/.github/actions/pr-require-checks/check-contract/run.sh +++ b/.github/actions/pr-require-checks/check-contract/run.sh @@ -167,11 +167,9 @@ best_effort() { fi } -# --------------------------------------------------------------------------- # Step 1 — fetch the pull request, and its comments for the marker upsert, # in one GraphQL query. GraphQL, not `pulls/N`: the REST bucket is the one # that runs out during a burst of pull request CI. -# --------------------------------------------------------------------------- # shellcheck disable=SC2016 # `$owner`, `$name` and `$number` are GraphQL variables. pr_query='query($owner: String!, $name: String!, $number: Int!) { repository(owner: $owner, name: $name) { pullRequest(number: $number) { title body author { __typename login } labels(first: 100) { totalCount nodes { name } } comments(last: 100) { totalCount nodes { databaseId body author { __typename } } } } } }' pr_read="pull request ${REPOSITORY}#${PR_NUMBER}" @@ -242,9 +240,6 @@ pr_author="$(jq -r .user.login <"$pr_json")" jq -r .body <"$pr_json" >"$scratch/body.txt" jq -r '.labels[].name' <"$pr_json" >"$scratch/labels.txt" -# --------------------------------------------------------------------------- -# Step 2 — title against Conventional Commits with the caller's type list. -# --------------------------------------------------------------------------- types_list="$(printf '%s' "$TYPES" | tr ',' '\n' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//' | grep -v '^$' || true)" if [[ -z "$types_list" ]]; then echo "::error::check-contract: types is empty; list at least one allowed Conventional Commits type" @@ -270,22 +265,17 @@ if [[ ! "$pr_title" =~ $title_regex ]]; then echo "::error::check-contract: the PR title does not follow Conventional Commits: \"$(escape_annotation "$pr_title")\". Expected \": \" with a non-empty subject; allowed types: ${types_human}. ${scope_hint} A breaking change marks the type with \"!\"." fi -# --------------------------------------------------------------------------- -# Step 3 — do-not-merge label. -# --------------------------------------------------------------------------- do_not_merge_result=pass if grep -qxF -- "$DO_NOT_MERGE_LABEL" "$scratch/labels.txt"; then do_not_merge_result=fail echo "::error::check-contract: this PR carries the '${DO_NOT_MERGE_LABEL}' label; remove it to merge." fi -# --------------------------------------------------------------------------- # Step 3b — the hold label, when `enforce-hold-label` is on. Only a person # removing the label releases the hold. On a merge group it is read for every # queue entry at or ahead of the queued pull request: the group holds their # changes, and a passing group merges them all, whatever their own groups # read earlier. Lower `position` is nearer the front. -# --------------------------------------------------------------------------- if [[ "$ENFORCE_HOLD_LABEL" == true ]]; then if [[ "${EVENT_NAME:-}" != merge_group ]]; then hold_result=pass @@ -327,11 +317,9 @@ if [[ "$ENFORCE_HOLD_LABEL" == true ]]; then fi fi -# --------------------------------------------------------------------------- # Merge group — the title and the live do-not-merge label, both re-read because # either can change after enqueue; a failure makes the queue drop the pull # request. Linkage is advisory and a group run writes no comment or label. -# --------------------------------------------------------------------------- if [[ "${EVENT_NAME:-}" == merge_group ]]; then emit_results "$title_result" "$do_not_merge_result" skipped "$hold_result" if [[ "$title_result" == fail || "$do_not_merge_result" == fail || "$hold_result" == fail ]]; then @@ -345,9 +333,6 @@ if [[ "${EVENT_NAME:-}" == merge_group ]]; then exit 0 fi -# --------------------------------------------------------------------------- -# Step 4 — issue linkage. -# # The body must # carry a native closing keyword, an explicit non-closing `Refs:`/`Relates to:` # marker, or a no-issue opt-out, AND four non-empty contract sections. A negated @@ -358,7 +343,6 @@ fi # The analyzer masks rendered HTML comments, fenced and indented code blocks, # and inline code spans before matching, so a PR template's commented-out # example cannot satisfy the gate. -# --------------------------------------------------------------------------- analyze_body() { awk ' # Whitespace includes newlines: section content is joined before trimming, so a @@ -716,9 +700,6 @@ else fi fi -# --------------------------------------------------------------------------- -# Step 5 — advisory outcome: one marker comment, upserted, plus the label. -# --------------------------------------------------------------------------- # Each call below is sent once: the outcome is advisory, and resending its # calls could push the step past a short ci-status job's timeout. GH_API_RETRY_ERRORS=false @@ -807,12 +788,8 @@ else fi fi -# --------------------------------------------------------------------------- -# Step 6 — outputs and the single exit decision. -# # Every check runs before any exit so all four outputs are always emitted; an # early exit on the title would leave `linkage` unset for the caller. -# --------------------------------------------------------------------------- emit_results "$title_result" "$do_not_merge_result" "$linkage_result" "$hold_result" if [[ "$linkage_result" == fail && "$LINKAGE_MODE" == advisory ]]; then diff --git a/.github/actions/pr-require-checks/check-contract/run.test.sh b/.github/actions/pr-require-checks/check-contract/run.test.sh index b71e2150..7c241378 100755 --- a/.github/actions/pr-require-checks/check-contract/run.test.sh +++ b/.github/actions/pr-require-checks/check-contract/run.test.sh @@ -376,8 +376,6 @@ conforming_body=$'No related issue: melodic-software/github-iac#396 tracks the p set_comments '[]' -# --- step 0: no pull request in this event --------------------------------- - # Without the empty-pr-number short circuit this fails on the missing PR fetch. echo 'case: an event with no pull request skips every check' set_pull 'feat: something' "$conforming_body" someone '' @@ -388,8 +386,6 @@ expect_output 'do-not-merge=skipped' expect_output 'linkage=skipped' expect_no_gh_calls_at_all -# --- merge group ------------------------------------------------------------- - queue_ref="refs/heads/gh-readonly-queue/main/pr-${pr_number}-0123456789abcdef0123456789abcdef01234567" # Without the merge-group branch an empty pr-number skips, so the label passes. @@ -440,8 +436,6 @@ run_case 1 PR_NUMBER='' EVENT_NAME=merge_group MERGE_GROUP_HEAD_REF="$queue_ref" expect_log "could not read pull request ${repository}#${pr_number} (HTTP 404)" rm -f -- "$fixtures/${pull_key}.err" -# --- title check ----------------------------------------------------------- - # Without the title regex an unknown type would pass, so each accepted type has # to be shown accepted individually. echo 'case: every configured type is accepted, including security' @@ -506,8 +500,6 @@ run_case 1 REQUIRE_SCOPE=true expect_output 'title=fail' expect_log 'a scope is REQUIRED' -# --- do-not-merge label ---------------------------------------------------- - # Without the label check this exits 0. echo 'case: the do-not-merge label fails the step' set_pull 'feat: add check-contract' "$conforming_body" someone 'do-not-merge' @@ -527,8 +519,6 @@ set_pull 'feat: add check-contract' "$conforming_body" someone 'hold' run_case 1 DO_NOT_MERGE_LABEL=hold expect_output 'do-not-merge=fail' -# --- linkage: closing keywords -------------------------------------------- - # Without the nine-form closing-keyword regex the past-tense and singular forms # fail linkage. echo 'case: every closing-keyword form satisfies linkage' @@ -552,8 +542,6 @@ run_case 0 expect_output 'linkage=fail' expect_log 'Missing a native closing keyword' -# --- linkage: no-issue markers and Refs ------------------------------------ - # Without the no-issue marker both phrasings fail linkage. echo 'case: both no-issue markers satisfy linkage' for marker in 'No linked issue' 'No related issue: nothing to close'; do @@ -584,8 +572,6 @@ set_pull 'feat: add check-contract' "Refs: #12 and some prose"$'\n\n## Summary\n run_case 0 expect_output 'linkage=fail' -# --- linkage: negated closers ---------------------------------------------- - # Without the negation window a disclaimer would pass while GitHub still closes # the issue on merge. echo 'case: a negated closing reference fails linkage outright' @@ -675,8 +661,6 @@ if ! awk -v a="$time_4000" -v b="$time_8000" 'BEGIN { exit !(b < 3 * a) }'; then fail_case "8000 repeats took ${time_8000} s, at least 3x the ${time_4000} s for 4000" fi -# --- linkage: issue-ref-pattern -------------------------------------------- - sections=$'\n\n## Summary\n\ns\n\n## Fix\n\nf\n\n## Verification\n\nv\n\n## Related\n\nr\n' tracker_pattern='[a-z][a-z0-9]*-[0-9]+' @@ -800,8 +784,6 @@ if [[ -e "$injected" ]]; then fail_case 'the issue-ref-pattern input executed as awk code' fi -# --- linkage: masking ------------------------------------------------------ - # Without HTML-comment masking a PR template's commented-out example satisfies # the gate vacuously. echo 'case: a closing keyword only inside an HTML comment does not satisfy linkage' @@ -824,8 +806,6 @@ set_pull 'feat: add check-contract' 'Write `Closes #12` in the body.'$'\n\n## Su run_case 0 expect_output 'linkage=fail' -# --- linkage: contract sections -------------------------------------------- - # Without the four-section check a body with only linkage passes. echo 'case: each missing contract section is reported by name' for section in Summary Fix Verification Related; do @@ -856,8 +836,6 @@ set_pull 'feat: add check-contract' 'Closes #12'$'\n\n## Summary\n\n### Detail\n run_case 0 expect_output 'linkage=pass' -# --- linkage: exempt authors ---------------------------------------------- - # Without the exempt-author short circuit a bot body fails linkage. echo 'case: an exempt author skips the linkage check entirely' set_pull 'build: bump a dependency' 'Bumps a thing.' 'dependabot[bot]' '' @@ -877,8 +855,6 @@ set_pull 'build: bump a dependency' 'Bumps a thing.' 'renovate[bot]' '' run_case 0 'EXEMPT_AUTHORS=dependabot[bot],renovate[bot]' expect_output 'linkage=exempt' -# --- advisory outcome ------------------------------------------------------ - # Without the create branch no comment is posted on the first failing run. echo 'case: an advisory failure creates the marker comment and adds the label' set_comments '[]' @@ -1039,8 +1015,6 @@ expect_log "::error::check-contract: could not read pull request ${repository}#$ rm -f -- "$fixtures/${pull_key}.err" mv -- "$fixtures/${pull_key}.json.bak" "$fixtures/${pull_key}.json" -# --- rate limits ----------------------------------------------------------- - primary_limit_message='gh: API rate limit exceeded for installation ID 1 (HTTP 403)' # Without the wait the first limited read fails a good pull request red. @@ -1112,8 +1086,6 @@ fi rm -f -- "$fixtures/GET_${comments_key}.1.err" "$fixtures/POST_${comments_key}.1.err" set_comments '[]' -# --- the GraphQL read ------------------------------------------------------ - # Without reading the GraphQL `errors` array a primary rate limit, which # GraphQL answers with HTTP 200, is neither reported nor waited out, and a good # pull request fails red on its first throttled read. @@ -1221,8 +1193,6 @@ expect_gh_call "PATCH repos/${repository}/issues/comments/1001" expect_no_gh_call '-X GET ' set_comments '[]' -# --- comment-upsert capture ------------------------------------------------ - # Without the `.user.type == "Bot"` filter the gate edits a stranger's planted # comment instead of posting its own, and its guidance is never shown. echo 'case: a planted marker comment from a user account does not capture the upsert' @@ -1252,8 +1222,6 @@ expect_gh_call "PATCH repos/${repository}/issues/comments/1200 " expect_no_gh_call 'comments/900' rm -f -- "$fixtures/GET_${comments_key}.pages.json" -# --- annotation escaping --------------------------------------------------- - # Without escaping, a title carrying a newline closes the annotation and the # rest of the title is interpreted as a second workflow command. echo 'case: an attacker-controlled title is escaped inside the annotation' @@ -1266,8 +1234,6 @@ expect_output 'title=fail' expect_log '100%25 broken' expect_log '%0A::set-output' -# --- input validation ------------------------------------------------------ -# # Every one of these values is interpolated into a `gh api` path. echo 'case: a malformed repository is rejected before any API call' @@ -1280,8 +1246,6 @@ run_case 1 PR_NUMBER='7/../8' expect_log '::error::check-contract: pr-number must be a positive integer' expect_no_gh_calls_at_all -# --- labels are not validated ---------------------------------------------- -# # GitHub labels may legally contain spaces and colons. Neither label reaches an # API path unencoded, so rejecting those characters would break real consumers # for no gain. @@ -1308,8 +1272,6 @@ run_case 0 'LINKAGE_LABEL=needs-issue-linkage-é' expect_output 'linkage=pass' expect_gh_call "DELETE repos/${repository}/issues/${pr_number}/labels/needs-issue-linkage-%C3%A9" -# --- hold label ------------------------------------------------------------ - # Without the opt-in default every caller on main would start failing held pull # requests at merge. echo 'case: the hold label is not checked unless enforce-hold-label is on' @@ -1445,8 +1407,6 @@ expect_output 'hold=pass' expect_gh_call '-f branch=release/v1' clear_queue -# --- metadata contract ----------------------------------------------------- - echo 'case: action.yml still wires every input this harness exercises' action_metadata="$script_directory/action.yml" for input_name in token repository pr-number types require-scope do-not-merge-label enforce-hold-label hold-label exempt-authors linkage-label linkage-mode issue-ref-pattern rate-limit-wait-seconds; do @@ -1474,8 +1434,6 @@ if [[ -z "$metadata_default" || "$metadata_default" != "$runner_default" ]]; the fail_case "action.yml default '${metadata_default}' differs from run.sh default '${runner_default}'" fi -# --- api-calls count ------------------------------------------------------- - summary_file="$temporary_directory/step-summary" # Without the count in gh_api this reports zero requests. diff --git a/.github/actions/shellcheck/run.test.sh b/.github/actions/shellcheck/run.test.sh index 55bd6c15..cd5cd814 100755 --- a/.github/actions/shellcheck/run.test.sh +++ b/.github/actions/shellcheck/run.test.sh @@ -211,8 +211,6 @@ run_action 1 EXTRA_GLOBS=dot_bashrc FAKE_STATUS=1 [[ -e "$captures/1.args" && -e "$captures/2.args" ]] printf 'PASS: ShellCheck findings propagate after both lanes run\n' -# --- explicit file list ------------------------------------------------------- - for spelling in $'script.sh\nnested/tool.bash' 'script.sh nested/tool.bash'; do run_action 0 FILES="$spelling" load_args 1 @@ -288,8 +286,6 @@ load_args 1 [[ ! -e "$captures/2.args" ]] assert_contains 'the standard lane still runs when the extra lane is empty' script.sh "${captured_args[@]}" -# --- fan-out ------------------------------------------------------------------ - run_action 2 SHELLCHECK_JOBS=0 [[ ! -e "$captures/1.args" ]] grep -F 'must be positive integers' <<<"$ACTION_OUTPUT" >/dev/null diff --git a/.github/scripts/check-managed-files-sync.test.cjs b/.github/scripts/check-managed-files-sync.test.cjs index 9a8cddfc..8e7ccb10 100644 --- a/.github/scripts/check-managed-files-sync.test.cjs +++ b/.github/scripts/check-managed-files-sync.test.cjs @@ -16,8 +16,6 @@ const BOT_EMAIL = "300666570+melodic-standards-sync[bot]@users.noreply.github.com"; const HEAD_SHA = "fedcba9876543210fedcba9876543210fedcba98"; -// --- commit checks --------------------------------------------------------- - function commit( sha, { @@ -185,8 +183,6 @@ test("an unreadable commit list fails", async () => { ); }); -// --- content checks -------------------------------------------------------- - const TARGET = "melodic-software/target"; // Stands in for standards' sync-manifest.sh: dest-paths lists the target's @@ -537,8 +533,6 @@ test("a target the manifest does not manage fails", () => { ); }); -// --- hand-edit check ------------------------------------------------------- - test("a hand-edit points at the sync workflow, not a label", () => { const fx = fixture(); const result = runScript("run.sh", fx); @@ -580,8 +574,6 @@ test("renaming a managed file reports its old path", () => { assert.match(result.stderr, /- managed\/config\.txt/u); }); -// --- Dependabot mode ------------------------------------------------------- - const { dependabotMode } = verifySyncCommits; const DEPENDABOT_ID = 49699333; const WEB_FLOW_ID = 19864447; @@ -675,8 +667,6 @@ test("an empty or unreadable Dependabot commit list is not skipped", async () => ); }); -// --- merge-group mode ------------------------------------------------------ - const { resolveMergeGroup } = require(path.join(actionDir, "merge-group.cjs")); const QUEUE_SHA = "0123456789abcdef0123456789abcdef01234567"; const queueRef = (number) => diff --git a/.github/scripts/check-review-reads.test.cjs b/.github/scripts/check-review-reads.test.cjs index 476d17ee..75e1f1d0 100644 --- a/.github/scripts/check-review-reads.test.cjs +++ b/.github/scripts/check-review-reads.test.cjs @@ -1137,8 +1137,6 @@ test("names that would take the review past 100000 bytes are dropped, and the co assert.deepEqual(review.coverage, { read: 4, changed: 5 }); }); -// --- report mode: logs the check, passes the extract step's review on --- - const SHORT = { workspace: JOB_FILES, transcripts: { first: read(".claude-lane/pr.diff", DIFF, 8, 37) }, @@ -1260,8 +1258,6 @@ test("the format fallback is the same in both modes", () => { } }); -// --- the fallback is reachable only by a real format change --- - // fixtures/check-review-reads/notices.json: a local CLI 2.1.322 run's Reads // of a diff with offset 100 past its end, of an empty file, and of a file the // token cap cut (its numbered lines removed), kept to their tool messages, diff --git a/.github/scripts/pr-review-cli-chunks.test.cjs b/.github/scripts/pr-review-cli-chunks.test.cjs index 73b03348..56a6b657 100644 --- a/.github/scripts/pr-review-cli-chunks.test.cjs +++ b/.github/scripts/pr-review-cli-chunks.test.cjs @@ -333,8 +333,6 @@ test("no leg assumes a fixed chunk count", () => { assert.equal(workflow.env.MAX_CHUNKS, "20"); }); -// --- the chunk loop --- - const ACTION_DIR = path.join(__dirname, "..", "actions", "run-review-chunks"); const { runChunks } = require(path.join(ACTION_DIR, "chunks.cjs")); @@ -536,8 +534,6 @@ test("the loop gives every leg run-claude-cli's launcher environment and preambl assert.ok(name in chunks.inputs, name); }); -// --- chunk counts end to end: split, then extract over the loop's results --- - test("a 178-file diff left after verified renames are discounted is reviewed in 5 chunks", () => { for (const job of LEGS) { const cut = split(job, 178, {}, { renames: 42 }); @@ -635,8 +631,6 @@ test("a 6-chunk review with one failed chunk is partial: no verdict, no review", } }); -// --- timeouts --- - const minutes = (value, context) => Number(evaluate(String(value), context)); test("a 1-chunk review keeps today's step limits, and the loop's limit grows with the chunk count", async () => { @@ -711,8 +705,6 @@ test("each leg's job limit holds every step's limit at the chunk ceiling, inside } }); -// --- merging the chunks' comments --- - const finding = (path, line, level, text, pad = 0) => ({ path, line, diff --git a/.github/scripts/pr-review-cli-slices.test.cjs b/.github/scripts/pr-review-cli-slices.test.cjs index e0be0cb0..9091af2c 100644 --- a/.github/scripts/pr-review-cli-slices.test.cjs +++ b/.github/scripts/pr-review-cli-slices.test.cjs @@ -325,8 +325,6 @@ test("a diff with no final newline rejoins byte for byte, cut in the middle or a } }); -// --- no change for a diff that fits today --- - test("with no file over the budget the splitter gets the step's input byte for byte, and the outputs are as before", () => { const many = smallFiles(81); // Five files of about 400 bytes: over a 1000-byte budget together, each under it. @@ -395,8 +393,6 @@ test("with verified renames left out, the splitter gets the distinct diff byte f } }); -// --- the extract step's read count over the split step's chunks --- - const { isPartial } = require("../actions/publish-review/publish.cjs"); const AsyncFunction = Object.getPrototypeOf(async () => {}).constructor; @@ -620,8 +616,6 @@ test("with no cut file the extract step's result is as before, whatever the piec } }); -// --- the per-file read check over a sliced file --- - // A Read result of every line of `file` but the 1-based line `skip`, // numbered as the CLI prints them. function readAll(id, file, skip = 0) { @@ -749,8 +743,6 @@ test("a piece no chunk holds lists the cut file unread, saying its pieces do not } }); -// --- the chunk notes the compose step writes --- - // The compose step of `job` over the split `cut` (its chunk directory // `chunkDir`); returns each chunk's prompt. async function compose(job, cut, chunkDir) { diff --git a/.github/scripts/pr-review-cli.test.cjs b/.github/scripts/pr-review-cli.test.cjs index dd5a565f..ba4f70fb 100644 --- a/.github/scripts/pr-review-cli.test.cjs +++ b/.github/scripts/pr-review-cli.test.cjs @@ -5306,8 +5306,6 @@ test("a chunk that failed, did not run or returned no verdict keeps the review i assert.equal(JSON.parse(one.review).coverage.over_budget, 700000); }); -// --- every model leg keeps a sealed transcript --- - test("every model leg uploads its sealed transcript under a job id unique in the run", () => { const artifact = /^lane-transcript-(.+)-([1-9][0-9]{0,4})$/u; const jobId = /^[A-Za-z_][A-Za-z0-9_-]{0,99}$/u; @@ -5373,8 +5371,6 @@ test("every model leg uploads its sealed transcript under a job id unique in the ); }); -// --- every artifact the lane uploads is scanned for credentials first --- - const SCAN_ACTION = "$/.github/actions/scan-upload"; const isUpload = (s) => String(s.uses ?? "").startsWith("actions/upload-artifact@"); @@ -7674,8 +7670,6 @@ test("the compose step reads the full-diff step's to-read count, in every leg", ); }); -// --- the kill switch (kill-switch input) --- - const KILL_GATE = "&& (!inputs.kill-switch || needs.check-kill-switch.outputs.proceed == 'true')"; const KILLED_JOBS = () => [ @@ -7945,8 +7939,6 @@ test("with kill-switch set, each switch stops check-key-credit and every model j } }); -// --- review levels (review-level input, CLAUDE_REVIEW_LEVEL(S) variables) --- - const NO_EXPLICIT = { MODEL: "", EFFORT: "", MAX_TURNS: "" }; const ran = (outputs) => [outputs.model, outputs.effort, outputs["max-turns"]]; const composeFails = async (env, pattern) => { diff --git a/.github/scripts/select-model-credential.test.cjs b/.github/scripts/select-model-credential.test.cjs index 7c6e25f7..17a2c197 100644 --- a/.github/scripts/select-model-credential.test.cjs +++ b/.github/scripts/select-model-credential.test.cjs @@ -31,8 +31,6 @@ const load = (name) => fs.readFileSync(path.join(__dirname, "..", "workflows", name), "utf8"), ); -// --- the rules --------------------------------------------------------------- - // run-claude-cli lane.cjs readConfig names them `_`, the role // upper-snake, and the fallback leg FALLBACK_CLAUDE_CODE_OAUTH_TOKEN. test("the secret names are the ones run-claude-cli derives from the role", () => { @@ -127,7 +125,6 @@ test("the next leg follows the chain and each leg's handoff reasons", () => { handoffReason: why, }); const none = { "next-leg": "", "next-reason": "" }; - // Key leg. assert.deepEqual(next("key", {}, "true", "credit-stop"), { "next-leg": "subscription", "next-reason": "credit-stop", @@ -154,7 +151,6 @@ test("the next leg follows the chain and each leg's handoff reasons", () => { "next-leg": "subscription", "next-reason": "credit-stop", }); - // Subscription leg. for (const why of ["limit-stop", "credit-stop", "auth"]) { assert.deepEqual( next("subscription", { fallbackSet: "true" }, "true", why), @@ -191,8 +187,6 @@ test("the next leg follows the chain and each leg's handoff reasons", () => { } }); -// --- the action's calls -------------------------------------------------------- - const KEY_JOB = "claude-review-key"; const NOW = Date.parse("2026-11-06T12:00:00Z"); const NAME = markerName("REVIEWS_CLAUDE_API_KEY"); @@ -494,8 +488,6 @@ test("the action passes every input to the script and holds the job token back u } }); -// --- both reusables pick what their old copies picked -------------------------- - // Every launcher outcome a leg can produce: run-claude-cli's own handoff rule // over its classes, API statuses and stop flags, so the table never tests a // state the launcher cannot reach. @@ -595,7 +587,6 @@ test("pr-review-cli picks the same legs, credentials and reasons as its old copi gate === "skip" ? "true" : gate === "ok" ? "false" : ""; const start = gate === "failed" ? {} : select.start({ skipKey: gate === "skip" }); - // The key job. const oldKeyRuns = Boolean( evaluate(REVIEW_OLD.keyRuns, { needs: { diff --git a/.github/scripts/workflow-yaml.test.cjs b/.github/scripts/workflow-yaml.test.cjs index 955299e4..9342af25 100644 --- a/.github/scripts/workflow-yaml.test.cjs +++ b/.github/scripts/workflow-yaml.test.cjs @@ -23,8 +23,6 @@ function rejects(source, expected) { ); } -// --- The subset ------------------------------------------------------------ - test("a step sequence is enumerated positionally, not by name", () => { const document = parseWorkflow(`jobs: build: @@ -170,8 +168,6 @@ test("every workflow in this repository parses to the same shape it is read as", } }); -// --- Failing closed -------------------------------------------------------- - test("constructs outside the subset are rejected rather than approximated", () => { rejects("a: &anchor\n b: 1\n", /unsupported node indicator/u); rejects("a: *alias\n", /unsupported node indicator/u); From acaee303805e290ad18ec0d39f248b3d3f822a33 Mon Sep 17 00:00:00 2001 From: Kyle Sexton <153232337+kyle-sexton@users.noreply.github.com> Date: Sat, 21 Nov 2026 15:30:33 -0500 Subject: [PATCH 2/2] chore: restore step labels referenced across check-contract/run.sh Keep the one-line Step 2 through Step 6 headers in check-contract/run.sh so Step 0, Step 1, Step 3b, and cross-references stay coherent while still deleting all decorative box-rule divider lines. Refs: melodic-software/control-hub#12 --- .github/actions/pr-require-checks/check-contract/run.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/actions/pr-require-checks/check-contract/run.sh b/.github/actions/pr-require-checks/check-contract/run.sh index db5433d7..b25feb4d 100755 --- a/.github/actions/pr-require-checks/check-contract/run.sh +++ b/.github/actions/pr-require-checks/check-contract/run.sh @@ -240,6 +240,7 @@ pr_author="$(jq -r .user.login <"$pr_json")" jq -r .body <"$pr_json" >"$scratch/body.txt" jq -r '.labels[].name' <"$pr_json" >"$scratch/labels.txt" +# Step 2 — title against Conventional Commits with the caller's type list. types_list="$(printf '%s' "$TYPES" | tr ',' '\n' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//' | grep -v '^$' || true)" if [[ -z "$types_list" ]]; then echo "::error::check-contract: types is empty; list at least one allowed Conventional Commits type" @@ -265,6 +266,7 @@ if [[ ! "$pr_title" =~ $title_regex ]]; then echo "::error::check-contract: the PR title does not follow Conventional Commits: \"$(escape_annotation "$pr_title")\". Expected \": \" with a non-empty subject; allowed types: ${types_human}. ${scope_hint} A breaking change marks the type with \"!\"." fi +# Step 3 — do-not-merge label. do_not_merge_result=pass if grep -qxF -- "$DO_NOT_MERGE_LABEL" "$scratch/labels.txt"; then do_not_merge_result=fail @@ -333,6 +335,8 @@ if [[ "${EVENT_NAME:-}" == merge_group ]]; then exit 0 fi +# Step 4 — issue linkage. +# # The body must # carry a native closing keyword, an explicit non-closing `Refs:`/`Relates to:` # marker, or a no-issue opt-out, AND four non-empty contract sections. A negated @@ -700,6 +704,7 @@ else fi fi +# Step 5 — advisory outcome: one marker comment, upserted, plus the label. # Each call below is sent once: the outcome is advisory, and resending its # calls could push the step past a short ci-status job's timeout. GH_API_RETRY_ERRORS=false @@ -788,6 +793,8 @@ else fi fi +# Step 6 — outputs and the single exit decision. +# # Every check runs before any exit so all four outputs are always emitted; an # early exit on the title would leave `linkage` unset for the caller. emit_results "$title_result" "$do_not_merge_result" "$linkage_result" "$hold_result"