@boyingliu01/xp-gate 0.38.40 → 0.38.42

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.
@@ -210,6 +210,29 @@ gate10_resolve_ruleset() {
210
210
  }
211
211
  # @@RULES-RESOLVER-END@@
212
212
 
213
+
214
+ # --- Telemetry: never let an upload be the gate's runtime -------------------
215
+ #
216
+ # This file's own header already named telemetry as part of the import chain
217
+ # behind semgrep's ~9s startup -- and then never disabled it. Measured
218
+ # 2026-11-19, one trivial file, ABBA-alternated so a time trend cannot explain it:
219
+ #
220
+ # semgrep scan --config=auto ... 8095ms / 98595ms
221
+ # SEMGREP_SEND_METRICS=off (same command) 402ms / 481ms
222
+ #
223
+ # A 20x difference that moves with the network. That is exactly the bimodal shape
224
+ # the audit journal had recorded all along and nobody read: of 445 credible
225
+ # sast-security rows, 184 finished under 2s (the metrics POST failed fast) and 225
226
+ # took over 10s (it hung), with the fastest at 191ms and the slowest at 247s.
227
+ # Gate 10 was the single largest p90 share in the chain -- 35.6% -- because its
228
+ # runtime was network wait, which is the one thing a commit gate may not spend
229
+ # time on.
230
+ #
231
+ # Default OFF. The override exists because a team may legitimately want its own
232
+ # semgrep metrics for central rule tuning; what must not be true is that
233
+ # contacting semgrep.dev is the DEFAULT for every commit on every checkout.
234
+ SEMGREP_SEND_METRICS="${XP_GATE_SEMGREP_METRICS:-off}"
235
+ export SEMGREP_SEND_METRICS
213
236
  # Semgrep availability check
214
237
  SEMGREP_CMD=""
215
238
  if command -v semgrep >/dev/null 2>&1; then
@@ -44,6 +44,13 @@ GATE13_FAIL=1
44
44
  GATE13_BLOCK=2
45
45
  # shellcheck disable=SC2034 # public contract
46
46
  GATE13_WARN=3
47
+ # "Nothing to evaluate", as a verdict distinct from WARN. WARN means "looked at it
48
+ # and it is not clean"; SKIP means "there was nothing here". Conflating them is the
49
+ # defect family this codebase keeps repeating, and until now the C/C++ arm answered
50
+ # PASS -- the worst of the three -- when no C/C++ file was staged, recording
51
+ # "nothing to compile" as "compiled and clean".
52
+ # shellcheck disable=SC2034 # public contract: the entry maps this to SKIP
53
+ GATE13_SKIP=4
47
54
 
48
55
  GATE13_DEFAULT_TIMEOUT=120
49
56
 
@@ -468,10 +475,26 @@ gate13_baseline_exists() {
468
475
  # Prints the diagnostics on stderr; the COUNT goes to stdout.
469
476
  # ---------------------------------------------------------------------------
470
477
  gate13_count_warnings() {
471
- local cc="$1" flags="$2" file="$3" out
478
+ local cc="$1" flags="$2" file="$3" out warnings errors
472
479
  # shellcheck disable=SC2086 # flags is a deliberately word-split flag list
473
480
  out=$("$cc" -fsyntax-only $flags "$file" 2>&1)
474
- printf '%s\n' "$out" | grep -E 'warning:' | grep -vcE '^\s*$' || true
481
+ warnings=$(printf '%s\n' "$out" | grep -E 'warning:' | grep -vcE '^\s*$' || true)
482
+ # ERRORS COUNT TOO, AND THEY ARE THE POINT.
483
+ #
484
+ # This used to be `grep 'warning:' | grep -vc`. A file that does not COMPILE emits
485
+ # `error:` lines and no `warning:` lines, so it scored 0 -- identical to a clean
486
+ # file -- and the added-file branch below blocks only on cnt > 0. Measured on a
487
+ # new file containing `int broken( { return 0; }`:
488
+ #
489
+ # g++ says: bad.cpp:1:11: error: Unmatched '('
490
+ # gate said: (nothing) -- PASS
491
+ #
492
+ # while the banner two functions up promises "new files are still -Werror".
493
+ # Counting errors alongside warnings is the minimum honest reading: the caller's
494
+ # question is "is this file worse than clean", and a file that does not parse is
495
+ # worse than one that merely warns.
496
+ errors=$(printf '%s\n' "$out" | grep -E 'error:' | grep -vcE '^\s*$' || true)
497
+ printf '%s\n' "$(( ${warnings:-0} + ${errors:-0} ))"
475
498
  }
476
499
 
477
500
  # ============================================================================
@@ -1095,8 +1118,23 @@ gate13_run_cpp_analysis() {
1095
1118
  local classified
1096
1119
  classified=$(gate13_classify_changed)
1097
1120
  if [ -z "$classified" ]; then
1121
+ # SKIP, not PASS, and not WARN either.
1122
+ #
1123
+ # PASS said "compiled and clean" about a change set this arm never read. WARN
1124
+ # would say "looked at it and it is not clean", which is also false. The only
1125
+ # honest answer to "there is no C/C++ here" is "there is no C/C++ here", which
1126
+ # is what GATE13_SKIP is for -- the entry maps it to a SKIP verdict carrying
1127
+ # this reason, instead of the WARN that every unrecognised code used to become.
1128
+ #
1129
+ # Measured consequence of the old answer (2026-11-19): a Go file with
1130
+ # `var x int = "not an int"` staged on a Go-only project produced
1131
+ # Gate 9 : SKIP (not a TypeScript project -- correct, with a reason)
1132
+ # Gate 13 : PASS ("No staged C/C++ source files")
1133
+ # so the chain reported a passing compiler-strictness gate on a commit whose
1134
+ # compiler-level error it had not looked for.
1135
+ gate13_reason "Gate 13: no staged C/C++ source files -- nothing to compile"
1098
1136
  echo " ℹ️ No staged C/C++ source files — nothing to compile"
1099
- return "$GATE13_PASS"
1137
+ return "$GATE13_SKIP"
1100
1138
  fi
1101
1139
 
1102
1140
  budget=$(gate13_timeout_budget)
@@ -1144,7 +1182,10 @@ gate13_run_cpp_analysis() {
1144
1182
  if [ "$tier" = "warn-only" ]; then
1145
1183
  echo " ⚠️ ${f}: ${cnt} warning(s) (warn-only tier, not blocking)"
1146
1184
  else
1147
- echo " ❌ ${f}: ${cnt} warning(s) in a NEW file"
1185
+ # "diagnostic(s)" not "warning(s)": since errors are counted too, a file
1186
+ # that does not compile reports here, and calling that a warning would
1187
+ # understate what has to be fixed.
1188
+ echo " ❌ ${f}: ${cnt} diagnostic(s) in a NEW file"
1148
1189
  blocking=$((blocking + 1))
1149
1190
  fi
1150
1191
  fi
@@ -1387,6 +1428,8 @@ gate13_csharp_changed_warning_count() {
1387
1428
  # - the separators differ, so the diagnostic path is folded to "/" first.
1388
1429
  # Comparing raw strings matched nothing and reported 0 warnings on a file that
1389
1430
  # has two.
1431
+ # shellcheck disable=SC1003 # see the tr below: the backslash pairs are tr escapes,
1432
+ # and single quotes already keep the shell from touching them.
1390
1433
  printf '%s\n' "$out" \
1391
1434
  | grep -E ': (warning|error) [A-Z]+[0-9]+' \
1392
1435
  | sed -n 's/^\(.*\)(.*$/\1/p' \
@@ -542,6 +542,11 @@ if ! gate_enabled 13; then
542
542
  fi
543
543
 
544
544
  GATE_13_STATUS="SKIP"
545
+ # Cleared here, not only set on the arms that need it: the audit call below passes
546
+ # this as the detail, and an inherited value from a previous gate would attribute
547
+ # one gate's reason to another.
548
+ GATE_13_DETAIL=""
549
+
545
550
  if [ "${XP_GATE_DISABLE_13:-}" = "1" ]; then
546
551
  echo "⏭️ SKIPPED - Gate 13: Compiler Strictness (XP_GATE_DISABLE_13=1)"
547
552
  GATE_13_STATUS="SKIP"
@@ -561,10 +566,16 @@ elif [ -f "$GATE_DIR/gate-13-compiler-strictness.sh" ] || [ -f "$(git rev-parse
561
566
 
562
567
  _g13_worst=0
563
568
  _g13_rc=0
569
+ # True when at least one arm answered GATE13_SKIP (4). Kept separately from
570
+ # _g13_worst because SKIP is not a severity -- it is "this arm had nothing to
571
+ # evaluate", so it must not beat a WARN or a BLOCK, but it must survive an
572
+ # arm that answered PASS.
573
+ _g13_any_skip=0
564
574
  _g13_note() {
565
575
  case "$1" in
566
576
  1|2) _g13_worst=$1 ;;
567
577
  3) [ "$_g13_worst" -eq 0 ] && _g13_worst=3 ;;
578
+ 4) _g13_any_skip=1 ;;
568
579
  esac
569
580
  return 0
570
581
  }
@@ -577,6 +588,18 @@ elif [ -f "$GATE_DIR/gate-13-compiler-strictness.sh" ] || [ -f "$(git rev-parse
577
588
  gate13_run_csharp_analysis; _g13_rc=$?; _g13_note "$_g13_rc"
578
589
  gate13_run_analyzer; _g13_rc=$?; _g13_note "$_g13_rc"
579
590
 
591
+ # A clean worst of PASS means no arm found a problem -- but that is only a real
592
+ # PASS if every arm actually evaluated something. If any arm reported SKIP and
593
+ # none reported a finding, the honest verdict is SKIP, not PASS: nothing was
594
+ # compiled anywhere.
595
+ #
596
+ # Without this, the C/C++ arm's new GATE13_SKIP would be erased by the analyzer
597
+ # arm answering 0 on the same empty change set -- which is exactly what the
598
+ # first end-to-end run showed: the reason line printed, and the verdict was
599
+ # still PASS.
600
+ if [ "$_g13_worst" -eq 0 ] && [ "$_g13_any_skip" -eq 1 ]; then
601
+ exit 4
602
+ fi
580
603
  exit "$_g13_worst"
581
604
  )
582
605
  GATE_13_RC=$?
@@ -586,10 +609,16 @@ elif [ -f "$GATE_DIR/gate-13-compiler-strictness.sh" ] || [ -f "$(git rev-parse
586
609
  0) GATE_13_STATUS="PASS" ;;
587
610
  1) GATE_13_STATUS="FAIL" ;;
588
611
  2) GATE_13_STATUS="BLOCK" ;;
612
+ # GATE13_SKIP: at least one arm had nothing to evaluate, and no arm found a
613
+ # problem. Before this case existed, 4 fell through to WARN -- which said "we
614
+ # looked at your C/C++ and it is not clean" about a change set containing no
615
+ # C/C++ at all.
616
+ 4) GATE_13_STATUS="SKIP"
617
+ GATE_13_DETAIL="no_sources_for_any_arm" ;;
589
618
  *) GATE_13_STATUS="WARN" ;;
590
619
  esac
591
620
  echo " Gate 13 ($GATE_13_STATUS) completed in ${GATE_13_DURATION}s"
592
- record_gate_audit "gate-13" "compiler-strictness" "$GATE_13_STATUS" "0" "$GATE13_START"
621
+ record_gate_audit "gate-13" "compiler-strictness" "$GATE_13_STATUS" "0" "$GATE13_START" "${GATE_13_DETAIL:-}"
593
622
  # Every other gate blocks by exiting immediately (e.g. Gate 1's
594
623
  # "❌ BLOCKED ... exit 1"); there is no aggregate-then-exit shared with
595
624
  # gates 0-12, so Gate 13 must do the same or its FAIL would only be cosmetic
@@ -2,6 +2,6 @@
2
2
  "verdict": "PASS",
3
3
  "license_type": "MIT",
4
4
  "sha256": "0e7ac423bf2c6e223b7c5b156f8cf72da49d748e56a1641402c31f22ad07dbb5",
5
- "checked_at": "2026-11-19T16:06:01.170Z",
5
+ "checked_at": "2026-11-19T16:37:53.689Z",
6
6
  "source": "network"
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/xp-gate",
3
- "version": "0.38.40",
3
+ "version": "0.38.42",
4
4
  "description": "AI-driven development workflow: 6 quality gates + Delphi review + Sprint Flow",
5
5
  "bin": {
6
6
  "xp-gate": "bin/xp-gate.js"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xp-gate",
3
- "version": "0.38.40",
3
+ "version": "0.38.42",
4
4
  "displayName": "XP-Gate",
5
5
  "description": "Extreme Programming quality gates + AI workflow skills for Claude Code. Includes 12 pre-commit gates (Gate 0-11), 8 pre-push gates, Sprint Flow (6 phases), and Delphi multi-expert review (>=90% consensus).",
6
6
  "author": {
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/dsh-plugin-xp-gate",
3
- "version": "0.38.40",
3
+ "version": "0.38.42",
4
4
  "description": "XP-Gate deterministic quality gates + AI workflow skills as a DeepSeek Harness (DSH) native plugin: gate-check / gate-principles / gate-arch tools + 12 SKILL.md skills",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@boyingliu01/opencode-plugin",
3
- "version": "0.38.40",
3
+ "version": "0.38.42",
4
4
  "type": "module",
5
5
  "main": "index.ts",
6
6
  "description": "XP-Gate quality gates + AI workflow skills for OpenCode",
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Delphi Consensus Review — multi-round anonymous expert review (≥90% threshold, exactly 3 experts with distinct executable model IDs). Supports design, requirements, and code-walkthrough modes.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  **6-phase** development pipeline (v2.0 compact redesign, Issue #290): PREP → DESIGN → BUILD → VERIFY → SHIP → CLOSE. Phase 3/6 BUILD default build mode is **ralph-loop** (REQ-level iteration; each REQ starts from a clean context instead of accumulating one across REQs). HARD-GATE between DESIGN (2/6) and BUILD (3/6): design must pass Delphi review (≥90% consensus) before any coding.
@@ -3,7 +3,7 @@
3
3
  **Generated:** 2026-11-04
4
4
  **Commit:** eb2097b0
5
5
  **Branch:** sprint/2026-11-03-02
6
- **Version:** 0.38.40.0
6
+ **Version:** 0.38.42.0
7
7
 
8
8
  ## OVERVIEW
9
9
  Test-Specification Alignment Engine — two-stage validation ensuring tests accurately reflect requirements and design specs.