diff --git a/.cursor/install.sh b/.cursor/install.sh index 9fdceb6e..f65e04a3 100755 --- a/.cursor/install.sh +++ b/.cursor/install.sh @@ -83,7 +83,6 @@ cd -- "$repo_root" log() { printf 'cursor-install: %s\n' "$*"; } -# --- Node from .node-version (via nvm) -------------------------------------- node_pin="$(tr -d '[:space:]' <.node-version)" export NVM_DIR="${NVM_DIR:-$HOME/.nvm}" if [[ ! -s "$NVM_DIR/nvm.sh" ]]; then @@ -105,7 +104,6 @@ if [[ ! -x "$node_bin_dir/node" ]]; then exit 1 fi -# --- Make the pinned node win on PATH --------------------------------------- # Link node/npm/npx into the first writable PATH directory that comes before # /exec-daemon, whose bundled node would otherwise shadow the pinned one. link_dir="$(cursor_install::choose_link_dir "$node_bin_dir")" @@ -119,7 +117,6 @@ fi log "node $(node --version) / npm $(npm --version)" -# --- npm dependency roots --------------------------------------------------- for lock in package-lock.json components/*/package-lock.json distribution/package-lock.json; do [[ -f "$lock" ]] || continue dir="$(dirname -- "$lock")" @@ -139,12 +136,9 @@ if [[ "$hooks_skipped" == false ]]; then npm run prepare || log 'npm run prepare failed; git hooks are not installed' fi -# --- Always-on hygiene engines (Lefthook pre-commit) ------------------------ bin_dir=/usr/local/bin stamp_dir=/usr/local/share/melodic-cursor -# put_bin : install an executable into bin_dir, using -# sudo only when the directory is not directly writable. put_bin() { if [[ -w "$bin_dir" ]]; then install -m 0755 "$1" "$bin_dir/$2" @@ -153,7 +147,6 @@ put_bin() { fi } -# write_stamp : record the installed version for idempotence. write_stamp() { if [[ -w "$stamp_dir" ]] || { [[ ! -e "$stamp_dir" ]] && [[ -w "$(dirname -- "$stamp_dir")" ]]; }; then mkdir -p "$stamp_dir" @@ -164,7 +157,6 @@ write_stamp() { fi } -# install_engine install_engine() { dest="$1" version="$2" diff --git a/.cursor/install.test.sh b/.cursor/install.test.sh index e88525af..8db8b6e2 100755 --- a/.cursor/install.test.sh +++ b/.cursor/install.test.sh @@ -13,8 +13,6 @@ cd "$root" || exit 1 # shellcheck source=.cursor/install.sh CURSOR_INSTALL_LIBONLY=1 source "$root/.cursor/install.sh" -# --- PATH-link helpers ------------------------------------------------------ - scratch="$(mktemp -d)" trap 'rm -rf "$scratch"' EXIT @@ -50,8 +48,6 @@ PATH="$nvm_bin:/exec-daemon:$other_bin:/usr/bin" found="$(cursor_install::choose_link_dir "$nvm_bin")" assert_eq 'a writable dir after exec-daemon is not selected' '' "$found" -# --- Engine pin lockstep with ci-workflows ---------------------------------- - parse_install_pin() { local name="$1" awk -v name="$name" ' diff --git a/PSScriptAnalyzerSettings.psd1 b/PSScriptAnalyzerSettings.psd1 index 71237705..4a0a7cee 100644 --- a/PSScriptAnalyzerSettings.psd1 +++ b/PSScriptAnalyzerSettings.psd1 @@ -36,8 +36,6 @@ ) Rules = @{ - # --- Formatting: OTBS (One True Brace Style) --- - PSPlaceOpenBrace = @{ Enable = $true OnSameLine = $true @@ -99,8 +97,6 @@ # a consumer ever needs a floor below the newest syntax-bearing # PowerShell release. - # --- Best practices --- - PSAvoidUsingCmdletAliases = @{ Enable = $true AllowList = @() diff --git a/components/claude-lanes/repin-callers.test.sh b/components/claude-lanes/repin-callers.test.sh index ba283d3e..df775f55 100755 --- a/components/claude-lanes/repin-callers.test.sh +++ b/components/claude-lanes/repin-callers.test.sh @@ -37,8 +37,6 @@ for tool in git sed grep sort paste cmp jq; do fail 'required tool present' "$tool is missing; this environment cannot run the subject" done -# ---------------------------------------------------------------- gh stubbing - # stub_gh — a `gh` that answers the four endpoints repin::resolve calls, # driven entirely by STUB_* variables the caller exports. It reproduces gh's # real 404 shape (`gh: Not Found (HTTP 404)` on stderr, non-zero exit) because @@ -167,8 +165,6 @@ run_resolve() { PATH="$stub_bin:$PATH" GITHUB_OUTPUT="$outfile" bash "$script" resolve "$upstream" 2>&1 } -# ------------------------------------------------------------ resolve: shapes - # Lightweight tag — the shape ci-workflows cuts today. The ref points straight # at the commit, so no second dereference happens. out_file="$scratch/out-lightweight" @@ -216,8 +212,6 @@ assert_contains 'resolve: annotated tag dereferences to the commit' "$(cat "$out assert_not_contains 'resolve: annotated tag never emits the tag object SHA' "$(cat "$out_file")" "$tag_object" unset STUB_TAG_OBJECT_SHA -# ------------------------------------------- resolve: highest SemVer wins - # THE SOURCE-OF-TRUTH RULE. The subject picks the highest-SemVer published # release, not the first entry and not the one the `releases/latest` endpoint # would name. `releases/latest` orders by `created_at`, which GitHub sets from @@ -267,8 +261,6 @@ assert_contains 'resolve: an empty release set is a notice' "$out" '::notice::' assert_not_contains 'resolve: an empty release set raises no error' "$out" '::error::' unset STUB_RELEASE_TAGS -# ------------------------------------------------- resolve: 404 vs 404 - # Benign: the repository reads, it simply has no published release. A clean # no-op, because there is nothing to re-pin against yet. Under the LIST # endpoint that case is 200 with an empty body — not the 404 the old @@ -334,8 +326,6 @@ rc=0 out="$(PATH="$stub_bin:$PATH" GITHUB_OUTPUT='' bash "$script" resolve "$upstream" 2>&1)" || rc=$? assert_nonzero 'resolve: missing GITHUB_OUTPUT fails' "$rc" -# ------------------------------------------------------------- apply: fixtures - # commit_all — stage everything and commit, ignoring ambient # signing and hooks the way make_repo does. commit_all() { @@ -399,8 +389,6 @@ run_apply() { bash "$script" apply "$tag" "$sha" "$release_date" 2>&1) } -# ------------------------------------------- apply: rewrite scope + major jump - repo="$scratch/repo-major" lane_repo "$repo" "$old_sha" 'v0.9.1' out_file="$scratch/out-apply-major" @@ -515,8 +503,6 @@ assert_contains 'apply: mixed-SHA extras include the fleet guard caller componen "$guard_fleet_caller" unset STUB_COMPARE_STATUS -# ------------------------------------------ apply: a pin ahead of the release - # guard_repo — a lane_repo plus the three # .github/workflows extras at the old tag-form pin and both guard callers at a # fallback-form pin dated , with the hosted lanes, committed. @@ -685,8 +671,6 @@ assert_contains 'narrowing: an @main reusable is untouched' "$(cat "$repo/.githu assert_eq 'narrowing: a caller with only a SHA-pinned reusable stays byte-identical' \ "$(git -C "$repo" diff --name-only -- components/claude-lanes-hosted/reusable-only.yml)" '' -# ------------------------------------------------- apply: same major, no diff - repo="$scratch/repo-minor" lane_repo "$repo" "$old_sha" 'v0.9.1' out_file="$scratch/out-apply-minor" @@ -710,8 +694,6 @@ assert_not_contains 'apply: no-diff run never reports a change' "$(cat "$out_fil assert_contains 'apply: no-diff run is a notice' "$out" '::notice::' assert_silent 'apply: no-diff run leaves the tree clean' "$(git -C "$repo" status --porcelain)" -# ------------------------------------------------------------ apply: controls - # A repository with no lane callers must fail rather than report a clean no-op # — silently re-pinning nothing is how this job would rot after a rename. repo="$scratch/repo-empty" @@ -773,8 +755,6 @@ out="$(GITHUB_OUTPUT="$scratch/out-usage" bash "$script" apply v1.0.0 "$new_sha" assert_nonzero 'apply without the release date is a usage error' "$rc" assert_contains 'apply usage names the date argument' "$out" '' -# ------------------------------------------- apply: only the paths a release changed - # consumer_repo : a consumer-shaped checkout whose callers live under # .github/ alone: two reusable workflows still SHA-pinned (never moved; they # float on @main), one composite carrying two action pins, plus a pin-shaped diff --git a/components/cloud-environment/pages-publish b/components/cloud-environment/pages-publish index 12601389..3a583bc9 100755 --- a/components/cloud-environment/pages-publish +++ b/components/cloud-environment/pages-publish @@ -83,8 +83,6 @@ else [[ -z "$page_id" || "$page_id" =~ $id_re ]] || usage "invalid id '$page_id'" fi -# ---------------------------------------------------------------- config - declare -A cfg=() keys=(PUBLIC_ENDPOINT PRIVATE_ENDPOINT PUBLIC_TOKEN_SECRET PRIVATE_TOKEN_SECRET PRIVATE_ACCESS_ID_SECRET PRIVATE_ACCESS_KEY_SECRET) @@ -133,8 +131,6 @@ load_config() { load_config -# ---------------------------------------------------------------- upload - # send []: one request to that visibility's # upload origin. Sets status and body. The bearer token, and for the private # origin the Access service-token pair, are resolved by vault-exec into the @@ -187,16 +183,12 @@ if [[ -n "$delete_id" ]]; then exit 0 fi -# ---------------------------------------------------------------- input - tmp_root="$(realpath -e -- "${TMPDIR:-/tmp}" 2>/dev/null)" || die 3 "temp dir ${TMPDIR:-/tmp} does not exist" real="$(realpath -e -- "$file" 2>/dev/null)" || die 3 "$file does not exist" [[ -f "$real" && "$real" == "$tmp_root"/* ]] || die 3 "$file is not a regular file under $tmp_root" stamp_re='' grep -aqE -- "$stamp_re" "$real" || die 3 "$file carries no builder stamp " -# ---------------------------------------------------------------- scan - # A copy of the shapes in claude-code-plugins lib/publish-gate.mjs and the # upload Worker's scan.js; change all three together. Only these shapes are # caught, and the Worker's scan is the binding one. The builder stamp is @@ -397,8 +389,6 @@ if [[ -n "$reason" ]]; then fi [[ "$sent" == "$visibility" ]] || page_id='' -# ---------------------------------------------------------------- publish - send "$sent" PUT "/_upload${page_id:+/$page_id}" "$real" if [[ "$status" == 409 && "$sent" == public && "$body" == private-required ]]; then printf 'pages-publish: the public host requires private; creating a private page\n' >&2 diff --git a/components/code-review-rules/code-review-rules.sh b/components/code-review-rules/code-review-rules.sh index 25b77234..2395b097 100755 --- a/components/code-review-rules/code-review-rules.sh +++ b/components/code-review-rules/code-review-rules.sh @@ -168,7 +168,6 @@ if [[ "$command" == file ]]; then exit 0 fi -# ---- fleet --------------------------------------------------------------- scratch="$(mktemp -d)" trap 'rm -rf "$scratch"' EXIT diff --git a/components/code-review-rules/code-review-rules.test.sh b/components/code-review-rules/code-review-rules.test.sh index 131256c2..ccfad6e6 100755 --- a/components/code-review-rules/code-review-rules.test.sh +++ b/components/code-review-rules/code-review-rules.test.sh @@ -67,7 +67,6 @@ repo nested-fence "$( printf '%s`\n' "$fence" )" review -# --- file ------------------------------------------------------------------ # check_file — `file` mode over one fixture, stderr merged. check_file() { bash "$script" file --root "$work/fleet/$1" 2>&1; } @@ -141,7 +140,6 @@ out="$(check_file nested-fence)" assert_exit 'a shorter fence inside a four-backtick fence does not close it' 1 $? assert_contains 'a section inside the longer fence does not count' "$out" "no '## Code Review Rules' heading" -# --- fleet ----------------------------------------------------------------- printf '%s\n' synced remote >"$work/ok.txt" out="$(bash "$script" fleet --repos "$work/ok.txt" --fixtures "$work/fleet" 2>&1)" assert_exit 'fleet passes when every repo conforms' 0 $? @@ -155,7 +153,6 @@ assert_contains 'fleet names a repo with the wrong pointer' "$out" 'MISSING: wro assert_contains 'fleet names a repo with a duplicate pointer' "$out" 'MISSING: duplicate-stale: 2 org-wide criteria pointer lines' assert_contains 'fleet still lists the conforming repo' "$out" 'OK: synced' -# --- names ----------------------------------------------------------------- # The listing filter both fleet listings apply, over repository objects shaped # like the GitHub API's: sandbox anywhere in the topics, archived, and absent # or null topics. @@ -174,7 +171,6 @@ assert_eq 'names keeps only audited repositories' "$(printf '%s\n' kept no-topic out="$(printf '%s\n' "$listing" | jq -c '.[]' | bash "$script" names 2>&1)" assert_eq 'names reads a stream of objects, as gh --jq emits' "$(printf '%s\n' kept no-topics null-topics sandboxed-word)" "$out" -# --- usage ----------------------------------------------------------------- bash "$script" bogus >/dev/null 2>&1 assert_exit 'an unknown command is a usage error' 2 $? bash "$script" fleet --repos "$work/absent.txt" --fixtures "$work/fleet" >/dev/null 2>&1 diff --git a/components/commit-convention/commit-convention.test.sh b/components/commit-convention/commit-convention.test.sh index e44d4892..5029d91b 100755 --- a/components/commit-convention/commit-convention.test.sh +++ b/components/commit-convention/commit-convention.test.sh @@ -49,7 +49,6 @@ $1" "$yaml_package" "${@:2}" # Comma-joined, sorted types. sorted_csv() { tr ',' '\n' | sed '/^$/d' | LC_ALL=C sort | paste -sd, -; } -# --- The file itself --- parsed="$(node_eval 'const d = yaml.parse(fs.readFileSync(process.argv[2], "utf8")); process.stdout.write(JSON.stringify([d.dialect, d.subject_pattern, d.pr_title_pattern]));' "$source_file")" rc=$? @@ -73,7 +72,6 @@ git -C "$root" ls-files --error-unmatch -- "$well_known" >/dev/null 2>&1 rc=$? assert_exit "this repository tracks $well_known" 0 "$rc" -# --- Types lockstep --- file_types="$(sed -E -n 's/^\^\(\(([a-z|]+)\).*/\1/p' <<<"$pattern" | tr '|' ',' | sorted_csv)" if [[ -n "$file_types" ]]; then pass 'the type alternation is extractable from subject_pattern' @@ -110,7 +108,6 @@ else fail "fetched check-contract action.yml at ${contract_pin:0:7}" 'fetch-error: the contents API read failed' fi -# --- The resolver reads the tracked file at the well-known path --- repo="$TEST_TMPDIR/consumer" make_repo "$repo" mkdir -p "$repo/${well_known%/*}" @@ -136,7 +133,6 @@ rc=$? assert_exit 'resolver resolves subject_pattern in this repository' 0 "$rc" assert_eq "this repository's resolved pattern is the component's" "$pattern" "$out" -# --- The commit-msg hook accepts and rejects --- check_subject() { local subject="$1" msg="$TEST_TMPDIR/msg" printf '%s\n' "$subject" >"$msg" diff --git a/components/local-lane-guards/local-lane-guards.test.sh b/components/local-lane-guards/local-lane-guards.test.sh index 189f3e82..569245e4 100755 --- a/components/local-lane-guards/local-lane-guards.test.sh +++ b/components/local-lane-guards/local-lane-guards.test.sh @@ -34,7 +34,6 @@ guard_in() { ) } -# --- exec-bit --- make_repo "$tmpdir/exec-clean" printf '#!/usr/bin/env bash\necho ok\n' >"$tmpdir/exec-clean/ok.sh" git -C "$tmpdir/exec-clean" add ok.sh @@ -126,7 +125,6 @@ else pass 'exec-bit stays bash-3.2-safe (no declare -A)' fi -# --- machine-specific-paths --- make_repo "$tmpdir/path-clean" printf 'root = /src\n' >"$tmpdir/path-clean/config.ini" git -C "$tmpdir/path-clean" add config.ini @@ -201,7 +199,6 @@ chmod +x "$path_spawn/bin/git" "$path_spawn/bin/head" assert_eq 'machine-specific-paths greps the index once' '1' "$(cat "$path_spawn/grep")" assert_eq 'machine-specific-paths does not spawn head to cap output' '0' "$(cat "$path_spawn/head")" -# --- comment-hygiene --- make_repo "$tmpdir/ch-clean" printf '# A plain explanatory comment.\necho ok\n' >"$tmpdir/ch-clean/clean.sh" git -C "$tmpdir/ch-clean" add clean.sh @@ -243,7 +240,6 @@ chmod +x "$ch_spawn/bin/awk" ) assert_eq 'comment-hygiene does not spawn awk per git-grep hit' '0' "$(cat "$ch_spawn/awk")" -# --- reference-integrity --- make_repo "$tmpdir/ref-clean" printf '# Target\n\nBody.\n' >"$tmpdir/ref-clean/target.md" # shellcheck disable=SC2016 # backticks are markdown cite syntax, not shell expansion diff --git a/components/lychee/private-repo-inventory.sh b/components/lychee/private-repo-inventory.sh index 7717f46a..26615fab 100755 --- a/components/lychee/private-repo-inventory.sh +++ b/components/lychee/private-repo-inventory.sh @@ -188,7 +188,6 @@ if [[ "$command" == generate ]]; then exit 0 fi -# ---- check --------------------------------------------------------------- status=0 problem() { printf 'DRIFT: %s\n' "$*" >&2 diff --git a/components/lychee/private-repo-inventory.test.sh b/components/lychee/private-repo-inventory.test.sh index 4e6cf069..847de26b 100755 --- a/components/lychee/private-repo-inventory.test.sh +++ b/components/lychee/private-repo-inventory.test.sh @@ -34,11 +34,9 @@ write_config "$config" 'alpha|beta|gamma' 'alpha|beta|gamma' printf '%s\n' public-one public-two >"$work/public.txt" printf '%s\n' alpha beta gamma >"$work/private.txt" -# --- list ------------------------------------------------------------------ out="$(bash "$script" list --config "$config")" assert_eq 'list prints one inventory entry per line' $'alpha\nbeta\ngamma' "$out" -# --- check: agreement ------------------------------------------------------ out="$(bash "$script" check --config "$config" --public-list "$work/public.txt" --private-list "$work/private.txt" 2>&1)" assert_exit 'check passes when the inventory equals the private set' 0 $? assert_contains 'check reports agreement' "$out" 'OK:' @@ -57,14 +55,12 @@ assert_contains 'the regenerated github entry includes it, sorted' "$out" \ assert_contains 'the regenerated raw entry includes it, sorted' "$out" \ "'^https?://raw\\.githubusercontent\\.com/melodic-software/(alpha|beta|delta|gamma)/'," -# --- check: an excluded repo that went public ------------------------------ printf '%s\n' public-one beta >"$work/public-beta.txt" out="$(bash "$script" check --config "$config" --public-list "$work/public-beta.txt" 2>&1)" assert_exit 'check fails when an excluded repo is public' 1 $? assert_contains 'the wrongly excluded repo is named' "$out" 'beta is public but excluded as private' assert_contains 'the regenerated entry drops it' "$out" '/(alpha|gamma)(\.git)?' -# --- check: structural invariants ------------------------------------------ write_config "$work/unsorted.toml" 'gamma|alpha|beta' 'gamma|alpha|beta' out="$(bash "$script" check --config "$work/unsorted.toml" --public-list "$work/public.txt" 2>&1)" assert_exit 'check fails on an unsorted alternation' 1 $? @@ -80,7 +76,6 @@ printf '%s\n' alpha my.repo >"$work/private-dotted.txt" out="$(bash "$script" check --config "$work/dotted.toml" --public-list "$work/public.txt" --private-list "$work/private-dotted.txt" 2>&1)" assert_exit 'a dotted repo name round-trips through regex escaping' 0 $? -# --- generate ---------------------------------------------------------------- out="$(bash "$script" generate --config "$config" --private-list "$work/private-plus.txt")" assert_contains 'generate prints the github entry' "$out" \ "'^https?://github\\.com/melodic-software/(alpha|beta|delta|gamma)(\\.git)?([/#?]|\$)'," @@ -103,7 +98,6 @@ out="$(bash "$script" generate --config "$config" --private-list "$work/empty.tx assert_exit 'generate refuses an empty private set' 2 $? assert_contains 'the refusal is explicit' "$out" 'refusing to generate an empty inventory' -# --- usage errors ------------------------------------------------------------ out="$(bash "$script" check --config "$work/missing.toml" 2>&1)" assert_exit 'a missing config is a usage error' 2 $? out="$(bash "$script" frobnicate 2>&1)" diff --git a/components/managed-files-guard/managed-files-guard.test.sh b/components/managed-files-guard/managed-files-guard.test.sh index 3746d385..a2d38fcf 100755 --- a/components/managed-files-guard/managed-files-guard.test.sh +++ b/components/managed-files-guard/managed-files-guard.test.sh @@ -71,9 +71,6 @@ managed_union() { done | LC_ALL=C sort -u } -# ------------------------------------------------------------------ 1. shape - -# check_shape : the locked design, per file. title_case() { local words word title='' IFS=- read -r -a words <<<"$1" @@ -172,8 +169,6 @@ else "$(diff <(strip "$hosted_source") <(strip "$fleet_source"))" fi -# ------------------------------------------------------- 2. manifest wiring - for pair in "$hosted_component:$hosted_source:$hosted_destination" \ "$fleet_component:$fleet_source:$fleet_destination"; do IFS=: read -r c s d <<<"$pair" @@ -235,8 +230,6 @@ assert_eq 'ci-workflows owns the guard locally (it runs the action from its own assert_eq 'every sync target is covered: hosted, fleet-routed, or locally-owned' \ '' "$(printf '%s\n' "${unaccounted[@]-}" | paste -sd, -)" -# ------------------------------------------------------ 3. materialization - have_actionlint=0 if command -v actionlint >/dev/null 2>&1; then have_actionlint=1 @@ -244,7 +237,6 @@ else skip_case 'actionlint not installed; the materialized callers are not linted' fi -# materialize materialize() { local target="$1" source="$2" destination="$3" absent="$4" consumer out rc consumer="$scratch/${target##*/}" diff --git a/components/markdownlint/home/.markdownlint-cli2.jsonc b/components/markdownlint/home/.markdownlint-cli2.jsonc index e93e4532..0dacb944 100644 --- a/components/markdownlint/home/.markdownlint-cli2.jsonc +++ b/components/markdownlint/home/.markdownlint-cli2.jsonc @@ -27,7 +27,6 @@ "**/.venv/**" ], "config": { - // --- GFM-aligned style --- "MD003": { "style": "atx" }, // ATX headings (# Heading) "MD004": { "style": "dash" }, // Dash unordered-list bullets "MD049": { "style": "asterisk" }, // *emphasis* @@ -37,7 +36,6 @@ "MD024": { "siblings_only": true }, // Allow duplicate headings under different parents "MD060": false, // Table column style — disabled; allows any pipe spacing (its default flags tables matching no supported style) - // --- Relaxed for GFM / prose --- "MD013": false, // No hard line-length limit (tables and code exceed 80) "MD025": false, // Allow multiple top-level (H1) sections "MD028": false, // Allow blank lines between adjacent blockquotes diff --git a/components/markdownlint/markdownlint-home.test.sh b/components/markdownlint/markdownlint-home.test.sh index 1835a18d..dbb18a82 100755 --- a/components/markdownlint/markdownlint-home.test.sh +++ b/components/markdownlint/markdownlint-home.test.sh @@ -30,8 +30,6 @@ fi manifest='distribution/sync-manifest.yml' component='markdownlint-home' -# --- The manifest mapping is what the rest of this test depends on ------------ - # Read the manifest with the `yaml` package `npm ci` already installs, NOT `yq`: # this job installs only Node dependencies, and the pinned `yq` lives in other, # isolated jobs — a `yq` call here would exit 127 on a clean runner and fail the @@ -103,8 +101,6 @@ esac deployed_name=".${dest_path#dot_}" assert_eq 'dot_ rename yields the discoverable filename' '.markdownlint-cli2.jsonc' "$deployed_name" -# --- Discovery: no --config, config found by name in the working directory ---- - home="$(mktemp -d)" trap 'rm -rf "$home"' EXIT diff --git a/components/org-architecture-pointer/org-architecture-pointer.sh b/components/org-architecture-pointer/org-architecture-pointer.sh index 84aa85fa..56c6be76 100755 --- a/components/org-architecture-pointer/org-architecture-pointer.sh +++ b/components/org-architecture-pointer/org-architecture-pointer.sh @@ -100,7 +100,6 @@ if [[ "$command" == file ]]; then exit 1 fi -# ---- fleet --------------------------------------------------------------- scratch="$(mktemp -d)" trap 'rm -rf "$scratch"' EXIT diff --git a/components/org-architecture-pointer/org-architecture-pointer.test.sh b/components/org-architecture-pointer/org-architecture-pointer.test.sh index 2865e4ba..c33a4eaa 100755 --- a/components/org-architecture-pointer/org-architecture-pointer.test.sh +++ b/components/org-architecture-pointer/org-architecture-pointer.test.sh @@ -35,7 +35,6 @@ mkdir -p "$work/fleet/empty" repo near-miss AGENTS.md 'melodic-software/architectures-of-others and melodic-software/architecture-x' repo bare-line AGENTS.md 'See melodic-software/architecture' -# --- file ------------------------------------------------------------------ # check_file — `file` mode over one fixture, stderr merged. check_file() { bash "$script" file --root "$work/fleet/$1" 2>&1; } @@ -65,7 +64,6 @@ assert_exit 'file fails on a longer repository name sharing the prefix' 1 $? out="$(check_file bare-line)" assert_exit 'file passes when the name ends the line' 0 $? -# --- fleet ----------------------------------------------------------------- printf '%s\n' in-agents in-claude in-both bare-line >"$work/ok.txt" out="$(bash "$script" fleet --repos "$work/ok.txt" --fixtures "$work/fleet" 2>&1)" assert_exit 'fleet passes when every repo conforms' 0 $? @@ -80,7 +78,6 @@ assert_contains 'fleet names a longer-name near miss' "$out" 'MISSING: near-miss assert_contains 'fleet names a repo with neither file' "$out" 'MISSING: empty:' assert_contains 'fleet still lists the conforming repo' "$out" 'OK: in-agents' -# --- names ----------------------------------------------------------------- # The listing filter both fleet listings apply: sandbox anywhere in the # topics, archived, the architecture repo itself, and absent or null topics. listing='[ @@ -98,7 +95,6 @@ assert_eq 'names keeps only audited repositories' "$expected" "$out" out="$(printf '%s\n' "$listing" | jq -c '.[]' | bash "$script" names 2>&1)" assert_eq 'names reads a stream of objects, as gh --jq emits' "$expected" "$out" -# --- usage ----------------------------------------------------------------- bash "$script" bogus >/dev/null 2>&1 assert_exit 'an unknown command is a usage error' 2 $? bash "$script" fleet --repos "$work/absent.txt" --fixtures "$work/fleet" >/dev/null 2>&1 diff --git a/components/pr-convention-policy/lockstep-behavior.mjs b/components/pr-convention-policy/lockstep-behavior.mjs index 39f4b06d..1b3dc49b 100644 --- a/components/pr-convention-policy/lockstep-behavior.mjs +++ b/components/pr-convention-policy/lockstep-behavior.mjs @@ -375,9 +375,7 @@ function run(command, args, options, location, what) { return result; } -// --------------------------------------------------------------------------- // The composite: its analyzer is the awk program inside `analyze_body`. -// --------------------------------------------------------------------------- // The awk program is single-quoted bash, so an apostrophe inside it is spelled // `'"'"'`; read it back as the apostrophe awk sees. @@ -466,11 +464,9 @@ export function checkCompositeBehavior(runShText, policy, location, wiringLocati reportMismatches(compositeMismatchCache.get(key), location); } -// --------------------------------------------------------------------------- // The hook: a sourced bash library whose aggregate verdict is // `linkage::problems`, which fills LINKAGE_PROBLEMS. The harness feeds it the // matrix NUL-separated and prints each body's problems, NUL-terminated. -// --------------------------------------------------------------------------- const HOOK_HARNESS = [ "export LC_ALL=C", diff --git a/components/pr-convention-policy/lockstep-behavior.test.mjs b/components/pr-convention-policy/lockstep-behavior.test.mjs index a04c388a..4a74d4c6 100644 --- a/components/pr-convention-policy/lockstep-behavior.test.mjs +++ b/components/pr-convention-policy/lockstep-behavior.test.mjs @@ -21,12 +21,10 @@ import { POLICY, } from "./lockstep-fixtures.mjs"; -// --------------------------------------------------------------------------- // Non-closing references and negated closers (#647). Static extractors diff // the declared data; the behavioral layer runs the vendored copies on a // policy-generated matrix, so every mutation below that breaks behavior must // surface as a `(behavior)` finding whatever source shape it takes. -// --------------------------------------------------------------------------- test("non-closing and negation parsers read the policy's values from both copies", () => { const expectedMarkers = POLICY.body.nonClosingMarkers.map((marker) => marker.toLowerCase()); diff --git a/components/pr-convention-policy/lockstep-drift.mjs b/components/pr-convention-policy/lockstep-drift.mjs index a0bbcb23..a2d1e221 100755 --- a/components/pr-convention-policy/lockstep-drift.mjs +++ b/components/pr-convention-policy/lockstep-drift.mjs @@ -138,12 +138,10 @@ function collect(errors, fn) { } } -// --------------------------------------------------------------------------- // The `check-contract` composite (the live gate, and every migrated consumer). // // `run.sh` states the section list as data: the analyzer's END block calls // `section_report("")` once per required section, in contract order. -// --------------------------------------------------------------------------- export function parseCompositeSections(runShText, location) { const names = [...runShText.matchAll(/section_report\("([^"]+)"\)/g)].map((m) => m[1]); if (names.length === 0) { @@ -283,14 +281,12 @@ export function assertCompositeIssueRefDefault(runShText, actionYmlText, locatio } } -// --------------------------------------------------------------------------- // The `pr-issue-linkage.yml` reusable (the predecessor, still pinned by every // consumer that has not taken its Phase 3 pull request yet). // // The reusable declares its contract as a `requiredSections` array of // `{ name: "...", guidance: "..." }` literals inside an actions/github-script // step. The array literal is the narrowest stable surface to parse. -// --------------------------------------------------------------------------- export function parseGateSections(workflowText, location) { const arrayMatch = workflowText.match(/const requiredSections = \[([\s\S]*?)\n\s*\];/); if (!arrayMatch) { @@ -332,10 +328,6 @@ export function parseGatePatterns(workflowText, location) { }; } -// --------------------------------------------------------------------------- -// The other two remote copies. -// --------------------------------------------------------------------------- - // The hook validator declares `REQUIRED_SECTIONS=(Summary Fix ...)`. export function parseValidatorSections(shellText, location) { const match = shellText.match(/REQUIRED_SECTIONS=\(([^)]*)\)/); @@ -396,7 +388,6 @@ export function parseValidatorPatterns(shellText, location) { return { keyword: ereToJs(keyword[1]), marker: ereToJs(marker[1]) }; } -// --------------------------------------------------------------------------- // Non-closing references and negated closers (`body.nonClosingMarkers` and // `body.negatedClosers`). Two layers: the static extractors below diff the // DATA each copy declares (marker alternation, trigger words, suffix, @@ -405,7 +396,6 @@ export function parseValidatorPatterns(shellText, location) { // generated from policy, which proves the rule is wired from declaration to // verdict whatever shape the code takes. The behavioral layer replaced a chain // of source-shape regexes that every review round found one more gap in. -// --------------------------------------------------------------------------- // The marker alternation is the first group of the pattern, after the `^` // anchor and the hook's `{0,3}` indent allowance (the composite strips that @@ -587,10 +577,6 @@ export function parseCompositeNegation(runShText, location) { }; } -// --------------------------------------------------------------------------- -// Which artifact a consumer runs. -// --------------------------------------------------------------------------- - // Every pattern below anchors on a `uses:` entry with no `#` earlier on the // line, so only a live call site counts. The same paths appear elsewhere in // ci-workflows' own `ci.yml` as a lint `paths:` list and as a @@ -649,10 +635,6 @@ export function parseCallerPin(workflowText, location) { return match[1]; } -// --------------------------------------------------------------------------- -// Comparisons. -// --------------------------------------------------------------------------- - function assertPatternsEnforce(patterns, policy, location, { lowercaseProbe = false } = {}) { const probe = (text) => (lowercaseProbe ? text.toLowerCase() : text); const missing = []; @@ -1121,10 +1103,6 @@ export function checkFleet(policy, resolutions) { return errors; } -// --------------------------------------------------------------------------- -// Live mode. -// --------------------------------------------------------------------------- - function apiHeaders(accept) { const token = process.env.LOCKSTEP_GITHUB_TOKEN || process.env.GITHUB_TOKEN; const headers = { Accept: accept }; diff --git a/components/pr-convention-policy/lockstep-drift.test.mjs b/components/pr-convention-policy/lockstep-drift.test.mjs index 576f0e9c..1216a7e8 100644 --- a/components/pr-convention-policy/lockstep-drift.test.mjs +++ b/components/pr-convention-policy/lockstep-drift.test.mjs @@ -295,10 +295,6 @@ test("a composite that stops lowercasing the line is drift, not a pass", () => { // The composite's findings at one codex-plugins pin, with the good action.yml. -// --------------------------------------------------------------------------- -// Which artifact a consumer runs. -// --------------------------------------------------------------------------- - const COMPOSITE_DIRECTORY = ".github/actions/pr-require-checks/check-contract"; const COMPOSITE_STEP = ` - uses: melodic-software/ci-workflows/${COMPOSITE_DIRECTORY}@1234567890abcdef1234567890abcdef12345678 # v0.34.0`; const REUSABLE_CALL = @@ -457,10 +453,6 @@ test("a gate composite missing from ci-workflows main is a fetch error", async ( ); }); -// --------------------------------------------------------------------------- -// The fleet, mid-transition. -// --------------------------------------------------------------------------- - function fleetResolutions(overrides = {}) { const resolutions = new Map(); for (const repo of CONSUMER_REPOSITORIES) { @@ -613,9 +605,7 @@ test("a global probe does not go stateful across repeated keyword probes", () => } }); -// --------------------------------------------------------------------------- // Mode selection: the copy check and the pin scan run separately. -// --------------------------------------------------------------------------- test("the CLI takes exactly one known mode", () => { assert.deepEqual(MODES, ["copies", "pins"]); diff --git a/components/runner-policy/runner-policy.test.mjs b/components/runner-policy/runner-policy.test.mjs index bfc39e46..fea5c8ed 100644 --- a/components/runner-policy/runner-policy.test.mjs +++ b/components/runner-policy/runner-policy.test.mjs @@ -5603,12 +5603,10 @@ test("anchored uses scalars retain provenance enforcement", async () => { ); }); -// --------------------------------------------------------------------------- // The `managed-literal` routing target: the governed fleet label written // directly, which is the only way a job reaches the managed fleet. Admitted // only on a private repository enrolled for local routing; everywhere else the // existing routing gate refuses it under its existing rule id. -// --------------------------------------------------------------------------- const FLEET_LANE_CONTRACT = { routing: "runner-input", @@ -6020,13 +6018,11 @@ test("a runner-input contract's fixedRunsOn must name known GitHub-hosted labels ); }); -// --------------------------------------------------------------------------- // The ci-workflows `checks` consolidation reusable. One job, one runner, every // content-agnostic hygiene composite as a step: the lane the CI performance // program moves five repositories onto. Its contract is drawn at the // reusable's whole declared input surface rather than at any one caller's // subset, so a later caller needs no second standards round trip. -// --------------------------------------------------------------------------- const CHECKS_REFERENCE = "melodic-software/ci-workflows/.github/workflows/checks.yml@b260ba091ca89bb3292eb53abea07ca8f0a51bf1"; diff --git a/distribution/sync-manifest.mjs b/distribution/sync-manifest.mjs index 265a0367..506b664d 100755 --- a/distribution/sync-manifest.mjs +++ b/distribution/sync-manifest.mjs @@ -139,7 +139,6 @@ function canonicalGitRoot(requested) { return physical; } -// --- Git index plumbing ------------------------------------------------------- // One batched ls-files call and one batched hash-object call per root: the // spawn-count contract in the suite asserts exactly one of each during a // production validate. @@ -254,8 +253,6 @@ function trackedRegularMode(root, p, purpose) { return mode; } -// --- YAML node helpers ---------------------------------------------------------- - let manifestSource = ""; let manifestDoc = null; @@ -393,8 +390,6 @@ function validateRecordKeys(label, required, optional, keys) { if (!found) die(`${label} is missing required key '${required}'`); } -// --- Manifest validation -------------------------------------------------------- - const componentNames = []; const targetNames = []; const componentExists = new Set(); @@ -770,8 +765,6 @@ function validateManifest(sourceRoot, manifest, manifestAbs) { } } -// --- Selection and emitters ------------------------------------------------------- - function selectTargets(filter) { if (!filter) return [...targetNames]; const requested = new Set(); @@ -846,8 +839,6 @@ function emitPlan(selected) { } } -// --- Apply -------------------------------------------------------------------------- - function verifyTargetIdentity(targetRoot, expected) { const result = runGit(["-C", targetRoot, "remote", "get-url", "--all", "origin"]); if (result.error || result.status !== 0) { @@ -967,8 +958,6 @@ function applyTarget(sourceRoot, target, targetRootRequested) { } } -// --- CLI ---------------------------------------------------------------------------- - function main() { const argv = process.argv.slice(2); if (argv.length === 0) { diff --git a/harness/shell/lib.test.sh b/harness/shell/lib.test.sh index e365852f..e414fc5e 100755 --- a/harness/shell/lib.test.sh +++ b/harness/shell/lib.test.sh @@ -12,7 +12,6 @@ trap 'exit 129' HUP trap 'exit 130' INT trap 'exit 143' TERM -# --- assert_eq --- out="$(assert_eq "eq" foo foo)" assert_contains "assert_eq emits PASS on match" "$out" "PASS:" out="$(assert_eq "eq" foo bar 2>&1)" @@ -22,7 +21,6 @@ assert_contains "assert_eq handles empty strings" "$out" "PASS:" out="$(assert_eq "eq" $'a\nb' $'a\nb')" assert_contains "assert_eq handles multi-line values" "$out" "PASS:" -# --- assert_contains / assert_not_contains --- out="$(assert_contains "c" "hello world" "world")" assert_contains "assert_contains matches substring" "$out" "PASS:" out="$(assert_contains "c" "hello" "world" 2>&1)" @@ -34,25 +32,21 @@ assert_contains "assert_not_contains passes on absence" "$out" "PASS:" out="$(assert_not_contains "nc" "hello" "ell" 2>&1)" assert_contains "assert_not_contains fails on presence" "$out" "FAIL:" -# --- assert_exit --- out="$(assert_exit "ex" 0 0)" assert_contains "assert_exit passes on equal codes" "$out" "PASS:" out="$(assert_exit "ex" 0 1 2>&1)" assert_contains "assert_exit fails on differing codes" "$out" "FAIL:" -# --- assert_nonzero --- out="$(assert_nonzero "nz" 2)" assert_contains "assert_nonzero passes on non-zero rc" "$out" "PASS:" out="$(assert_nonzero "nz" 0 2>&1)" assert_contains "assert_nonzero fails on zero rc" "$out" "FAIL:" -# --- assert_silent --- out="$(assert_silent "s" " ")" assert_contains "assert_silent passes on whitespace-only" "$out" "PASS:" out="$(assert_silent "s" "noise" 2>&1)" assert_contains "assert_silent fails on output" "$out" "FAIL:" -# --- assert_command_fails --- assert_command_fails "false exits non-zero" false out="$(assert_command_fails "cf" true 2>&1)" assert_contains "assert_command_fails fails when the command succeeds" "$out" "FAIL:" @@ -92,7 +86,6 @@ rc=$? assert_contains "require_min_version errors on a non-numeric version token" "$out" "ERROR:" assert_nonzero "require_min_version exits non-zero on a non-numeric version" "$rc" -# --- assert_file_exists / assert_file_absent --- tmp="$(mktemp "$TEST_TMPDIR/tmp.XXXXXX")" assert_file_exists "temp file exists" "$tmp" out="$(assert_file_absent "fa" "$tmp" 2>&1)" @@ -102,7 +95,6 @@ assert_file_absent "removed file is absent" "$tmp" out="$(assert_file_exists "fe" "$tmp" 2>&1)" assert_contains "assert_file_exists fails on a missing file" "$out" "FAIL:" -# --- assert_line_count --- tmp="$(mktemp "$TEST_TMPDIR/tmp.XXXXXX")" printf 'a\nb\nc\n' >"$tmp" out="$(assert_line_count "lc" "$tmp" 3)" @@ -113,7 +105,6 @@ out="$(assert_line_count "lc" "$tmp.missing" 0 2>&1)" assert_contains "assert_line_count fails on a missing file" "$out" "FAIL:" rm -f "$tmp" -# --- assert_row_count (including the zero-match path) --- out="$(assert_row_count "rc" $'x1\nx2\ny3' 2 '^x')" assert_contains "assert_row_count counts matches" "$out" "PASS:" out="$(assert_row_count "rc-zero" "no matches here" 0 '^x')" @@ -121,7 +112,6 @@ assert_contains "assert_row_count handles zero matches" "$out" "PASS:" out="$(assert_row_count "rc" $'x1\ny2' 2 '^x' 2>&1)" assert_contains "assert_row_count fails on a wrong count" "$out" "FAIL:" -# --- make_repo --- tmpd="$(mktemp -d "$TEST_TMPDIR/tmpd.XXXXXX")" make_repo "$tmpd/r" assert_file_exists "make_repo initializes a git repo" "$tmpd/r/.git/HEAD"