@ccoalm/ccl-skills 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/README.md +2 -2
  2. package/dist/assets/marketplace/plugins/ccl-skills/skills/app-cross-platform-dev/SKILL.md +8 -7
  3. package/dist/assets/marketplace/plugins/ccl-skills/skills/app-cross-platform-dev/references/mobile-quality-release.md +1 -1
  4. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/SKILL.md +16 -17
  5. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/references/client-routing.md +1 -1
  6. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/references/staged-review-contract.md +195 -7
  7. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/references/timeout-auth-and-capabilities.md +3 -3
  8. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/claude_review.sh +13 -5
  9. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/codex_review.sh +9 -3
  10. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/kimi_review.sh +9 -3
  11. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/normalize_review_timeout.sh +22 -0
  12. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/opencode_review.sh +9 -3
  13. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/review_gate.py +1540 -129
  14. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/test_claude_review_probe.sh +8 -3
  15. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/test_review_client_compat.py +76 -1
  16. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/test_review_gate.sh +1858 -3
  17. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/test_update_review_plan_intent.sh +789 -0
  18. package/dist/assets/marketplace/plugins/ccl-skills/skills/code-review/scripts/update_review_plan_intent.py +513 -0
  19. package/dist/assets/marketplace/plugins/ccl-skills/skills/go-microservice-dev/SKILL.md +4 -1
  20. package/dist/assets/marketplace/plugins/ccl-skills/skills/llm-inference-integration/SKILL.md +2 -1
  21. package/dist/assets/marketplace/plugins/ccl-skills/skills/miniapp-product-dev/SKILL.md +11 -10
  22. package/dist/assets/marketplace/plugins/ccl-skills/skills/nodejs-service-dev/SKILL.md +64 -0
  23. package/dist/assets/marketplace/plugins/ccl-skills/skills/nodejs-service-dev/agents/openai.yaml +4 -0
  24. package/dist/assets/marketplace/plugins/ccl-skills/skills/nodejs-service-dev/references/async-lifecycle-and-performance.md +72 -0
  25. package/dist/assets/marketplace/plugins/ccl-skills/skills/nodejs-service-dev/references/runtime-and-project-contract.md +58 -0
  26. package/dist/assets/marketplace/plugins/ccl-skills/skills/nodejs-service-dev/references/source-map.md +41 -0
  27. package/dist/assets/marketplace/plugins/ccl-skills/skills/nodejs-service-dev/references/verification-diagnostics-and-security.md +63 -0
  28. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-rd-workflow/SKILL.md +8 -10
  29. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-rd-workflow/references/design-routing-and-readiness.md +10 -14
  30. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-rd-workflow/references/verify-developer-experience.md +1 -1
  31. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/SKILL.md +135 -86
  32. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/behavioral-aesthetic-logic.md +66 -80
  33. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/delivery-contract.md +275 -0
  34. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/design-execution-checklist.md +88 -214
  35. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/design-impl-naming-and-versioning.md +2 -2
  36. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/design-intake-and-acceptance.md +10 -8
  37. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/design-system-source-of-truth.md +4 -5
  38. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/external-ui-ux-quality-benchmarks.md +112 -95
  39. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/frontend-code-evidence-map.md +30 -21
  40. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/interaction-design-patterns.md +22 -3
  41. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/layout-recipes-and-screenshot-acceptance.md +20 -17
  42. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/multi-project-token-consistency.md +7 -9
  43. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/multi-stack-strategy.md +14 -10
  44. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/operational-processing-workflows.md +2 -0
  45. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/platform-mobile-patterns.md +1 -1
  46. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md +9 -6
  47. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/product-surface-patterns.md +3 -0
  48. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/source-map.md +37 -10
  49. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/tokens-and-components.md +7 -1
  50. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/ui-ux-audit.md +8 -5
  51. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/ui-ux-design-development.md +16 -5
  52. package/dist/assets/marketplace/plugins/ccl-skills/skills/product-ui-ux-design/references/visual-craft.md +4 -2
  53. package/dist/assets/marketplace/plugins/ccl-skills/skills/python-service-dev/SKILL.md +4 -1
  54. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/SKILL.md +4 -4
  55. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/dual-track-review-gate.md +95 -5
  56. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/extraction-quickstart.md +11 -9
  57. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/r0-leakage-audit.md +102 -0
  58. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/source-register.md +54 -0
  59. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/source-to-skill-extraction.md +8 -0
  60. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/uiux-judgment-extraction.md +6 -6
  61. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/references/validation-and-landing.md +4 -3
  62. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/check-ccl-skills.sh +69 -2
  63. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/extraction_review_gate.sh +22 -0
  64. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/impact-chain-gate.rb +49 -4
  65. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/obligation-ledger.py +2748 -0
  66. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/register-firing-path-resolution.rb +20 -5
  67. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/shared_git_surface_gate.py +1142 -0
  68. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_check_ccl_regressions.sh +17 -0
  69. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_check_ccl_skill_catalog.sh +41 -4
  70. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_ci_checkout_ref_binding.sh +120 -0
  71. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_entrypoint_domain_scan_terms.sh +82 -8
  72. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_extraction_review_gate.sh +336 -0
  73. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_impact_chain_self_adjudication.sh +82 -10
  74. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_obligation_ledger.sh +1416 -0
  75. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_obligation_ledger_repo_audit.sh +57 -0
  76. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_register_firing_path_wiring.sh +141 -4
  77. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_routing_pointer_integrity.sh +3 -1
  78. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_shared_git_surface_gate.sh +1696 -0
  79. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_uiux_delivery_contract.sh +2117 -0
  80. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_uiux_loading_budget.sh +316 -0
  81. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_validate_extraction_review_state.sh +1176 -0
  82. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/test_validate_skill_cross_refs.sh +31 -1
  83. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/validate-skill.sh +9 -4
  84. package/dist/assets/marketplace/plugins/ccl-skills/skills/skill-extraction-workflow/scripts/validate_extraction_review_state.py +980 -0
  85. package/dist/assets/marketplace/plugins/ccl-skills/skills/terminal-cli-dev/SKILL.md +8 -6
  86. package/dist/assets/marketplace/plugins/ccl-skills/skills/testing-strategy/SKILL.md +8 -7
  87. package/dist/assets/marketplace/plugins/ccl-skills/skills/testing-strategy/references/client-runtime-test-matrices.md +10 -2
  88. package/dist/assets/marketplace/plugins/ccl-skills/skills/web-react-dev/SKILL.md +6 -5
  89. package/dist/assets/marketplace/plugins/ccl-skills/skills/web-react-dev/references/complex-workspace-patterns.md +1 -1
  90. package/dist/assets/release.json +175 -70
  91. package/package.json +1 -1
@@ -0,0 +1,2117 @@
1
+ #!/usr/bin/env bash
2
+ # Contract test for the shared design -> test -> producer/client implementation loop.
3
+ # The canonical reference owns the protocol; each participating skill keeps
4
+ # only its local responsibility and a pointer to that reference.
5
+ set -euo pipefail
6
+
7
+ ROOT="${UIUX_CONTRACT_ROOT:-$(cd "$(dirname "$0")/../../.." && pwd -P)}"
8
+ CONTRACT="$ROOT/skills/product-ui-ux-design/references/delivery-contract.md"
9
+ ROUTER="$ROOT/skills/product-ui-ux-design/references/design-execution-checklist.md"
10
+ LEDGER="$ROOT/skills/product-ui-ux-design/references/external-ui-ux-quality-benchmarks.md"
11
+ SOURCE_MAP="$ROOT/skills/product-ui-ux-design/references/source-map.md"
12
+ INTERACTION="$ROOT/skills/product-ui-ux-design/references/interaction-design-patterns.md"
13
+ TEST_MATRIX="$ROOT/skills/testing-strategy/references/client-runtime-test-matrices.md"
14
+ APP_OWNER="$ROOT/skills/app-cross-platform-dev/SKILL.md"
15
+ PRODUCT_DESIGN_ROUTE="$ROOT/skills/product-rd-workflow/references/design-routing-and-readiness.md"
16
+ OPERATIONAL="$ROOT/skills/product-ui-ux-design/references/operational-processing-workflows.md"
17
+ fail=0
18
+
19
+ active_markdown() {
20
+ ruby -e '
21
+ in_comment = false
22
+ fence = nil
23
+ ARGF.each_line.with_index(1) do |raw, line_number|
24
+ line = raw.chomp
25
+ # Inside a fenced block, HTML-comment markers are literal code. Resolve
26
+ # only a valid CommonMark closing fence before any comment parsing;
27
+ # otherwise `<!--` in an example can swallow the real close and every
28
+ # operative line that follows it.
29
+ if fence
30
+ if (m = line.match(/\A {0,3}(`{3,}|~{3,})[ \t]*\z/))
31
+ run = m[1]
32
+ fence = nil if run[0] == fence[0] && run.length >= fence.length
33
+ end
34
+ next
35
+ end
36
+ loop do
37
+ if in_comment
38
+ close_at = line.index("-->")
39
+ if close_at
40
+ line = line[(close_at + 3)..] || ""
41
+ in_comment = false
42
+ else
43
+ line = ""
44
+ break
45
+ end
46
+ else
47
+ open_at = line.index("<!--")
48
+ break unless open_at
49
+ close_at = line.index("-->", open_at + 4)
50
+ if close_at
51
+ line = line[0...open_at] + (line[(close_at + 3)..] || "")
52
+ else
53
+ line = line[0...open_at]
54
+ in_comment = true
55
+ break
56
+ end
57
+ end
58
+ end
59
+ if (m = line.match(/\A {0,3}(`{3,}|~{3,})(.*)\z/))
60
+ run = m[1]
61
+ info = m[2]
62
+ unless run[0] == "`" && info.include?("`")
63
+ fence = run
64
+ next
65
+ end
66
+ end
67
+ # Top-level four-space/tab indentation is a CommonMark code block, not
68
+ # operative prose. Normative carriers in this contract must remain
69
+ # unindented or use an explicit list marker, which also keeps the oracle
70
+ # from certifying an obligation shown only as a code example.
71
+ next if line.match?(/\A(?:\t| {4})/)
72
+ puts "#{line_number}\t#{line}" unless line.empty?
73
+ end
74
+ ' "$1"
75
+ }
76
+
77
+ active_text() {
78
+ active_markdown "$1" | cut -f2-
79
+ }
80
+
81
+ outside_fence_contains() {
82
+ local file="$1" needle="$2"
83
+ [ -f "$file" ] || return 1
84
+ active_markdown "$file" | ruby -e '
85
+ needle = ARGV.shift
86
+ rows = ARGF.each_line.filter_map do |raw|
87
+ number, text = raw.chomp.split("\t", 2)
88
+ [Integer(number, 10), text || ""]
89
+ rescue ArgumentError
90
+ nil
91
+ end
92
+
93
+ segments = []
94
+ current = []
95
+ previous = nil
96
+ rows.each do |number, text|
97
+ if previous && number != previous + 1
98
+ segments << current unless current.empty?
99
+ current = []
100
+ end
101
+ current << text
102
+ previous = number
103
+ end
104
+ segments << current unless current.empty?
105
+
106
+ escaped = lambda do |chars, index|
107
+ count = 0
108
+ cursor = index - 1
109
+ while cursor >= 0 && chars[cursor] == "\\"
110
+ count += 1
111
+ cursor -= 1
112
+ end
113
+ count.odd?
114
+ end
115
+
116
+ token_only = needle.match?(/\A[[:alnum:]_][[:alnum:]_.:\/-]*\z/)
117
+ segments.each do |lines|
118
+ text = lines.join("\n")
119
+ chars = text.each_char.to_a
120
+ spans = []
121
+ cursor = 0
122
+ while cursor < chars.length
123
+ unless chars[cursor] == "`" && !escaped.call(chars, cursor)
124
+ cursor += 1
125
+ next
126
+ end
127
+ opener_start = cursor
128
+ cursor += 1 while cursor < chars.length && chars[cursor] == "`"
129
+ opener_end = cursor
130
+ run_length = opener_end - opener_start
131
+ probe = opener_end
132
+ closer_start = nil
133
+ closer_end = nil
134
+ while probe < chars.length
135
+ unless chars[probe] == "`" && !escaped.call(chars, probe)
136
+ probe += 1
137
+ next
138
+ end
139
+ run_start = probe
140
+ probe += 1 while probe < chars.length && chars[probe] == "`"
141
+ if probe - run_start == run_length
142
+ closer_start = run_start
143
+ closer_end = probe
144
+ break
145
+ end
146
+ end
147
+ if closer_start
148
+ spans << [opener_end, closer_start]
149
+ cursor = closer_end
150
+ else
151
+ cursor = opener_end
152
+ end
153
+ end
154
+
155
+ offset = 0
156
+ while (match_at = text.index(needle, offset))
157
+ match_end = match_at + needle.length
158
+ code_only = spans.any? { |start_at, end_at| match_at >= start_at && match_end <= end_at }
159
+ exit 0 unless code_only && !token_only
160
+ offset = match_at + 1
161
+ end
162
+ end
163
+ exit 1
164
+ ' "$needle"
165
+ }
166
+
167
+ check() {
168
+ local file="$1" needle="$2" label="$3"
169
+ if [ ! -f "$file" ]; then
170
+ echo "FAIL: $label target missing ($file)" >&2
171
+ fail=1
172
+ elif ! outside_fence_contains "$file" "$needle"; then
173
+ echo "FAIL: $label missing: $needle" >&2
174
+ fail=1
175
+ fi
176
+ }
177
+
178
+ check_absent() {
179
+ local pattern="$1" label="$2"; shift 2
180
+ local hits
181
+ hits=$(grep -Erin -- "$pattern" "$@" 2>/dev/null || true)
182
+ if [ -n "$hits" ]; then
183
+ echo "FAIL: $label" >&2
184
+ printf '%s\n' "$hits" >&2
185
+ fail=1
186
+ fi
187
+ }
188
+
189
+ client_entry_valid() {
190
+ local line
191
+ line=$(active_text "$1" | grep -F 'Before the first implementation edit, add the canonical `client_entry` defined there:' || true)
192
+ [ "$(printf '%s\n' "$line" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
193
+ case "$line" in
194
+ *'local rule identifier or short quote and implementation decision'*'target surface/runtime'*'planned run/capture command'*'behavior that must remain unchanged'*) return 0 ;;
195
+ *) return 1 ;;
196
+ esac
197
+ }
198
+
199
+ client_return_valid() {
200
+ local file="$1" line field
201
+ line=$(active_text "$file" | grep -F 'Return the complete canonical client-record member defined in `../product-ui-ux-design/references/delivery-contract.md` for testing Phase 1 and the design verdict.' || true)
202
+ [ "$(printf '%s\n' "$line" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
203
+ for field in "applied rule/decision" "affected files/components" "preserved behavior" "exact command" "immutable candidate binding" "producer member/version actually exercised" "artifacts" "tested" "criterion-mapped observations" "coverage boundary" "gaps"; do
204
+ case "$line" in
205
+ *"$field"*) ;;
206
+ *) return 1 ;;
207
+ esac
208
+ done
209
+ }
210
+
211
+ check_client_return() {
212
+ local file="$1" owner="$2"
213
+ if ! client_return_valid "$file"; then
214
+ echo "FAIL: $owner complete canonical client-record return is missing or incomplete" >&2
215
+ fail=1
216
+ fi
217
+ }
218
+
219
+ resolved_markdown_reference_valid() {
220
+ local file="$1" relative="$2" base="${3:-$(dirname "$1")}"
221
+ active_text "$file" | grep -F "\`$relative\`" >/dev/null &&
222
+ [ -f "$base/$relative" ]
223
+ }
224
+
225
+ stage_order_valid() {
226
+ local file="$1" last=0 line lines heading
227
+ [ -f "$file" ] || return 1
228
+ for heading in \
229
+ "## 1. Design brief" \
230
+ "## 2. Test Phase 0 — layer selection" \
231
+ "## 3. Producer/client execution" \
232
+ "## 4. Test Phase 1 — execution result and sufficiency" \
233
+ "## 5. Design verdict"; do
234
+ lines=$(active_markdown "$file" | awk -v heading="$heading" '
235
+ {
236
+ separator = index($0, "\t")
237
+ line_number = substr($0, 1, separator - 1)
238
+ content = substr($0, separator + 1)
239
+ if (content == heading) print line_number
240
+ }
241
+ ')
242
+ [ "$(printf '%s\n' "$lines" | awk 'NF { n++ } END { print n + 0 }')" -eq 1 ] || return 1
243
+ line="$lines"
244
+ [ -n "$line" ] && [ "$line" -gt "$last" ] || return 1
245
+ last="$line"
246
+ done
247
+ }
248
+
249
+ producer_route_valid() {
250
+ local route delta
251
+ if active_text "$1" | grep -E 'pre-runtime-test-ready|pending \+|unknown-consumers|classify that member|have every affected client owner|required design/test/producer/client' >/dev/null; then
252
+ return 1
253
+ fi
254
+ route=$(active_text "$1" | grep -F "When a change can alter what a client renders or which state, action, or decision path it offers" || true)
255
+ delta=$(active_text "$1" | grep -F 'returns only its `producer_record` delta:' || true)
256
+ [ "$(printf '%s\n' "$route" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
257
+ [ "$(printf '%s\n' "$delta" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
258
+ case "$route" in
259
+ *'API/event/schema fields'*'load `../product-ui-ux-design/references/delivery-contract.md`'*'create the applicable full or lightweight record in that contract'*'follow its canonical consumer-universe classification, design/test/client handoffs, and terminal-status rules'*) ;;
260
+ *) return 1 ;;
261
+ esac
262
+ case "$delta" in
263
+ *'immutable binding'*'exact command/environment'*'API/event/log/output observation'*) ;;
264
+ *) return 1 ;;
265
+ esac
266
+ ! printf '%s\n' "$route" | grep -F '`producer_record` delta' >/dev/null
267
+ }
268
+
269
+ router_composition_valid() {
270
+ local file="$1"
271
+ active_text "$file" | grep -F 'choose one delivery-depth profile, then add every work-mode and risk lens whose trigger is present' >/dev/null &&
272
+ active_text "$file" | grep -F 'Load the union of their references; one lens never cancels another' >/dev/null &&
273
+ active_text "$file" | grep -F 'a source-led systemic redesign or a shared-system redesign loads both sets' >/dev/null &&
274
+ active_text "$file" | grep -F '../../skill-extraction-workflow/references/two-source-extraction-pattern.md' >/dev/null
275
+ }
276
+
277
+ router_mode_reachability_valid() {
278
+ local file="$1" mode="$2" trigger="$3" reference="$4" line
279
+ line=$(active_text "$file" | grep -F "| $mode |" || true)
280
+ [ "$(printf '%s\n' "$line" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
281
+ case "$line" in
282
+ *"$trigger"*"$reference"*) return 0 ;;
283
+ *) return 1 ;;
284
+ esac
285
+ }
286
+
287
+ router_lens_reachability_valid() {
288
+ local file="$1" trigger="$2" reference="$3" line
289
+ line=$(active_text "$file" | grep -F "| $trigger |" || true)
290
+ [ "$(printf '%s\n' "$line" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
291
+ case "$line" in
292
+ *"$reference"*) return 0 ;;
293
+ *) return 1 ;;
294
+ esac
295
+ }
296
+
297
+ router_lens_terms_valid() {
298
+ local file="$1" reference="$2" line term
299
+ shift 2
300
+ line=$(active_text "$file" | grep -F "$reference" || true)
301
+ [ "$(printf '%s\n' "$line" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
302
+ for term in "$@"; do
303
+ case "$line" in
304
+ *"$term"*) ;;
305
+ *) return 1 ;;
306
+ esac
307
+ done
308
+ }
309
+
310
+ entrypoint_router_valid() {
311
+ local entry="$1" router="$2"
312
+ [ -f "$router" ] &&
313
+ active_text "$entry" | grep -F 'A runtime-visible task enters `references/delivery-contract.md` directly; the specialized router is not a prerequisite to that canonical path.' >/dev/null &&
314
+ active_text "$entry" | grep -F 'Load `references/design-execution-checklist.md` only when the task needs one or more specialized work-mode, platform, risk, or evidence references whose route is not already unambiguous below.' >/dev/null &&
315
+ active_text "$entry" | grep -F 'Do not load the router solely to reach `references/delivery-contract.md` or another unambiguous common route.' >/dev/null &&
316
+ active_text "$entry" | grep -F 'When the router applies, select one delivery-depth profile for runtime work, then add every triggered work-mode and risk lens and load the union of their required references.' >/dev/null &&
317
+ active_text "$router" | grep -F 'This router is conditional context, not an always-loaded prerequisite.' >/dev/null
318
+ }
319
+
320
+ app_design_closeout_valid() {
321
+ local file="$1" line
322
+ line=$(active_text "$file" | grep -F 'A missing or absent design verdict remains' || true)
323
+ [ "$(printf '%s\n' "$line" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
324
+ case "$line" in
325
+ *'remains `pending`'*'blocks the canonical contract'*'`complete`, MR-ready, merge-ready'*'screenshot proves only that the app rendered'*'never design acceptance'*'the design owner applies `delivery-contract.md`'*'rejected-candidate path'*'fresh runtime evidence for the revised candidate'*) return 0 ;;
326
+ *) return 1 ;;
327
+ esac
328
+ }
329
+
330
+ testing_phase0_inputs_valid() {
331
+ local file="$1" line
332
+ line=$(active_text "$file" | grep -F 'For a full UI/UX slice, Test selection Phase 0 derives its case set' || true)
333
+ [ "$(printf '%s\n' "$line" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
334
+ case "$line" in
335
+ *"Design brief's state/adaptation matrix"*'criterion IDs/outcomes'*'RED baseline'*'testing owns verifier type, assertion/rendered-evidence layers, commands/targets, independent oracles, and gaps'*'do not silently replace or narrow the recorded design obligations'*) return 0 ;;
336
+ *) return 1 ;;
337
+ esac
338
+ }
339
+
340
+ testing_incomplete_branches_valid() {
341
+ local file="$1" line
342
+ line=$(active_text "$file" | grep -F 'Phase 0 is incomplete when' || true)
343
+ [ "$(printf '%s\n' "$line" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
344
+ case "$line" in
345
+ *'applicable full/lightweight design inputs are missing, or when'*'DOM/component existence, a build pass, or an unreviewed screenshot is used in place of required rendered, interaction, accessibility, recovery, or design evidence'*) return 0 ;;
346
+ *) return 1 ;;
347
+ esac
348
+ }
349
+
350
+ composite_owner_valid() {
351
+ local file="$1"
352
+ active_text "$file" | grep -F 'A composite host has multiple owner-set members' >/dev/null &&
353
+ active_text "$file" | grep -F 'React inside a native WebView uses `web-react-dev` for content and `app-cross-platform-dev` for the native container/bridge' >/dev/null &&
354
+ active_text "$file" | grep -F 'A mini-program `web-view` uses the actual web-content owner plus `miniapp-product-dev`' >/dev/null &&
355
+ active_text "$file" | grep -F 'Electron uses the actual web-content owner plus the installed desktop-shell owner or project client convention' >/dev/null &&
356
+ active_text "$file" | grep -F 'Vue, Svelte, static, vendor, or another renderer routes to its installed owner or the fail-closed project-convention lookup below, never to React by container name alone' >/dev/null &&
357
+ active_text "$file" | grep -F 'An unchanged host member still records the integration contract and proof that the change cannot affect it' >/dev/null
358
+ }
359
+
360
+ multistack_owner_valid() {
361
+ local file="$1"
362
+ active_text "$file" | grep -F '| **native-mobile** | Flutter, React Native, native iOS, or native Android app | `app-cross-platform-dev` |' >/dev/null &&
363
+ active_text "$file" | grep -F 'Electron renderer → actual web-content owner; Electron shell → installed desktop-shell owner or project client convention' >/dev/null &&
364
+ active_text "$file" | grep -F 'Other desktop/TV runtimes → their installed owner or the same fail-closed project-convention lookup' >/dev/null &&
365
+ active_text "$file" | grep -F 'Actual web-content owner: enforces the web renderer' >/dev/null &&
366
+ active_text "$file" | grep -F '`terminal-cli-dev`: enforces terminal/TUI' >/dev/null &&
367
+ active_text "$file" | grep -F 'Installed desktop-shell owner or project client convention: owns Electron shell and other desktop/TV layers' >/dev/null &&
368
+ active_text "$file" | grep -F '`terminal-tui` / `desktop-tv-shell`' >/dev/null &&
369
+ active_text "$file" | grep -F '| **terminal-tui** | Command tree, help/output contract, terminal workflow, ANSI renderer, or full-screen TUI | `terminal-cli-dev`' >/dev/null &&
370
+ active_text "$file" | grep -F 'Route every affected consumer: React web → `web-react-dev`; other web → its installed owner or project convention; native mobile → `app-cross-platform-dev`; mini-app → `miniapp-product-dev`; terminal/TUI → `terminal-cli-dev`; desktop/TV shell → its installed owner or fail-closed project convention' >/dev/null &&
371
+ ! active_text "$file" | grep -F 'Mobile / desktop / TV client (Flutter, native iOS, native Android, RN, Electron) | `app-cross-platform-dev`' >/dev/null
372
+ }
373
+
374
+ design_mode_owner_valid() {
375
+ local development="$1" source_map="$2" frontend_map="$3" multistack="$4"
376
+ active_text "$development" | grep -F 'Vue/Svelte/static/vendor/other web → its installed web-content owner or fail-closed project-convention lookup' >/dev/null &&
377
+ active_text "$development" | grep -F 'Composite hosts keep separate content and shell members' >/dev/null &&
378
+ active_text "$source_map" | grep -F 'Implementation rules follow the complete affected client-owner set in `delivery-contract.md`' >/dev/null &&
379
+ active_text "$source_map" | grep -F 'a missing owner is never silently treated as Web or React' >/dev/null &&
380
+ active_text "$frontend_map" | grep -F 'React browser implementation ownership → `web-react-dev`; Vue/Svelte/static/vendor/other browser implementation → its installed web-content owner or the fail-closed project-convention lookup' >/dev/null &&
381
+ active_text "$multistack" | grep -F '| **web** | Browser-targeted application' | grep -F 'React → `web-react-dev`; Vue/Svelte/static/vendor/other web → its installed web-content owner or the fail-closed project-convention lookup' >/dev/null
382
+ }
383
+
384
+ restored_reference_owner_valid() {
385
+ local naming="$1" tokens="$2" source_truth="$3"
386
+ active_text "$naming" | grep -F 'follows every affected client owner in `delivery-contract.md`' >/dev/null &&
387
+ active_text "$naming" | grep -F 'mini-app → `miniapp-product-dev`; terminal/TUI → `terminal-cli-dev`' >/dev/null &&
388
+ active_text "$naming" | grep -F 'Electron shell, desktop, TV, or another runtime → its installed owner or the fail-closed project-convention lookup' >/dev/null &&
389
+ active_text "$naming" | grep -F 'code gating follows every affected client owner in `delivery-contract.md`: React web → `web-react-dev`; other web → its installed owner or project convention; native mobile → `app-cross-platform-dev`; mini-app → `miniapp-product-dev`; terminal/TUI → `terminal-cli-dev`; Electron/desktop/TV → its installed owner or fail-closed project convention' >/dev/null &&
390
+ active_text "$tokens" | grep -F 'React or other web, web H5, native app, mini-program, terminal/TUI, Electron/desktop, TV, or another rendered client' >/dev/null &&
391
+ active_text "$tokens" | grep -F 'The complete affected client-owner set in `delivery-contract.md` owns the concrete prop / option names for each component set' >/dev/null &&
392
+ active_text "$tokens" | grep -F 'follow the complete affected client-owner set in `delivery-contract.md`' >/dev/null &&
393
+ active_text "$tokens" | grep -F 'Vue/Svelte/other web → its installed owner or project convention' >/dev/null &&
394
+ active_text "$tokens" | grep -F 'terminal/TUI theme/color behavior → `terminal-cli-dev`' >/dev/null &&
395
+ active_text "$tokens" | grep -F 'A shared theme package never becomes React-owned merely because one consumer uses React' >/dev/null &&
396
+ active_text "$source_truth" | grep -F 'follows every affected client owner in `delivery-contract.md`' >/dev/null &&
397
+ active_text "$source_truth" | grep -F 'a Web-only tool is not evidence for a native, terminal, or desktop client' >/dev/null
398
+ }
399
+
400
+ binding_contract_valid() {
401
+ local file="$1"
402
+ active_text "$file" | grep -F 'Each binding value has a non-empty, exact payload' >/dev/null &&
403
+ active_text "$file" | grep -F '`dirty-bundle-v1:<full-base-commit-hex>:<64-hex-bundle-digest>`' >/dev/null &&
404
+ active_text "$file" | grep -F 'the byte-exact binary tracked diff' >/dev/null &&
405
+ active_text "$file" | grep -F 'every untracked member, and every result-affecting ignored member, all in sorted path order with path, file mode/type, and raw content or symlink target' >/dev/null &&
406
+ active_text "$file" | grep -F 'one keyed member per design/test/producer/client repository or artifact' >/dev/null &&
407
+ active_text "$file" | grep -F 'A `commit` or `tree` binding is valid for an executed member only when the command ran from that exact materialized commit/tree' >/dev/null &&
408
+ active_text "$file" | grep -F 'Do not relabel a dirty execution as a clean commit after the fact' >/dev/null &&
409
+ active_text "$file" | grep -F 'Branches, tags, abbreviated SHAs, empty suffixes, mutable external version labels or artifact paths, and prose such as “current working tree” are locators, not immutable bindings' >/dev/null &&
410
+ active_text "$file" | grep -F 'covered by an `artifact-sha256` member over the exact reviewed bytes plus its locator' >/dev/null &&
411
+ active_text "$file" | grep -F 'a result-affecting input outside the checkout must have its own `artifact-sha256` member over the exact bytes' >/dev/null &&
412
+ active_text "$file" | grep -F 'Result-affecting external inputs always use a separate content-addressed member and locator' >/dev/null
413
+ }
414
+
415
+ candidate_member_contract_valid() {
416
+ local file="$1"
417
+ active_text "$file" | grep -F 'every changed or claim-bearing producer first adds one member to `producer_record_set`' >/dev/null &&
418
+ active_text "$file" | grep -F 'Each client execution must name which producer member/version it actually exercised' >/dev/null &&
419
+ active_text "$file" | grep -F '`design_record_ids`' >/dev/null &&
420
+ active_text "$file" | grep -F '`test_record_ids`' >/dev/null &&
421
+ active_text "$file" | grep -F '`producer_record_ids`' >/dev/null &&
422
+ active_text "$file" | grep -F '`client_record_ids`' >/dev/null &&
423
+ active_text "$file" | grep -F 'which producer observation, client observation, or test artifact supports it' >/dev/null &&
424
+ active_text "$file" | grep -F 'Each design, test, producer, and client owner writes its own facts once' >/dev/null &&
425
+ active_text "$file" | grep -F 'Missing, mismatched, stale, changed-after-run, or unexercised required design/test/producer/client owner or binding members make sufficiency `blocked`' >/dev/null
426
+ }
427
+
428
+ lightweight_all_role_valid() {
429
+ local file="$1"
430
+ active_text "$file" | grep -F 'same component, rendering slot, or output field' >/dev/null &&
431
+ active_text "$file" | grep -F 'the design/test owners, every changed or claim-bearing producer owner, and every affected client owner' >/dev/null &&
432
+ active_text "$file" | grep -F 'The lightweight design record, test definitions/executions, and producer/client returns still form the complete immutable candidate-binding set' >/dev/null &&
433
+ active_text "$file" | grep -F 'Phase 1 binds and cites the complete design/test/producer/client record sets' >/dev/null
434
+ }
435
+
436
+ copy_only_misclassification_valid() {
437
+ local file="$1" line
438
+ line=$(active_text "$file" | grep -F 'If later evidence proves the `copy-only` classification wrong' || true)
439
+ [ "$(printf '%s\n' "$line" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
440
+ case "$line" in
441
+ *'the lightweight record is invalid from that discovery point, and you must apply **Missed pre-edit record** to the existing diff by stopping implementation edits'*'rebuilding the full Design brief, obtaining full Phase 0 and every affected producer/client owner entry'*'auditing the whole existing diff against them'*'rerunning producer/client execution, Phase 1, and the design verdict'*'the slice is `pending + blocked`'*'the old lightweight result cannot support completion'*) return 0 ;;
442
+ *) return 1 ;;
443
+ esac
444
+ }
445
+
446
+ trigger_class_set_valid() {
447
+ local file="$1" line
448
+ line=$(active_text "$file" | grep -F '| `trigger_class` |' || true)
449
+ [ "$(printf '%s\n' "$line" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
450
+ case "$line" in
451
+ *'`copy-only`, `narrow-visible`, `new-or-reshaped-screen`, or `systemic-redesign`'*'`shared-system`, `source-code-evidence`, `design-to-code`, `audit/review`, `naming-version-sync`, `same-stack-multi-project`, and `multi-stack`'*) return 0 ;;
452
+ *) return 1 ;;
453
+ esac
454
+ }
455
+
456
+ terminal_cli_contract_valid() {
457
+ local terminal="$1" go="$2" python="$3" product_route="$4"
458
+ active_text "$terminal" | grep -F 'command/subcommand/flag/default/help/output/exit/action/confirmation/progress/recovery contract' >/dev/null &&
459
+ active_text "$terminal" | grep -F 'Skip only parser/library/tooling internals' >/dev/null &&
460
+ active_text "$terminal" | grep -F 'provably preserve every user-facing command tree, default/action path, help/output/exit behavior, confirmation, progress, and recovery path' >/dev/null &&
461
+ active_text "$terminal" | grep -F 'even when it emits only plain text and never enters an alternate screen' >/dev/null &&
462
+ active_text "$terminal" | grep -F 'For every user-facing terminal/CLI contract change—including command tree, subcommand, flag/default/action path, help/output/exit behavior, confirmation, progress, or recovery' >/dev/null &&
463
+ active_text "$terminal" | grep -F 'Only parser/library internals that preserve all of those user-visible semantics may mark UI/UX `not-applicable`' >/dev/null &&
464
+ active_text "$go" | grep -F 'Any change to a user-facing command tree, subcommand, flag/default/action path, help/output/exit behavior, confirmation, progress, or recovery path also loads `terminal-cli-dev`' >/dev/null &&
465
+ active_text "$python" | grep -F 'Any change to a user-facing command tree, subcommand, flag/default/action path, help/output/exit behavior, confirmation, progress, or recovery path also loads `terminal-cli-dev`' >/dev/null &&
466
+ active_text "$product_route" | grep -F 'Any changed command tree, subcommand, flag/default/action path, help/output/exit behavior, confirmation, progress, recovery' >/dev/null
467
+ }
468
+
469
+ reachable_reference_scope_valid() {
470
+ local multistack="$1" source_truth="$2" multiproject="$3" tokens="$4" layout="$5" lifecycle="$6"
471
+ active_text "$multistack" | grep -F 'React and other web, H5, native mobile, mini-app, terminal/TUI, Electron/desktop, and TV consumers' >/dev/null &&
472
+ active_text "$multistack" | grep -F 'React or other web, H5, native mobile, mini-app, terminal/TUI, Electron/desktop, TV, or another client' >/dev/null &&
473
+ active_text "$multistack" | grep -F 'React web, other web, H5, native, mini-app, terminal/TUI, Electron/desktop/TV shell, and any additional client' >/dev/null &&
474
+ active_text "$source_truth" | grep -F 'React and other web, H5, native mobile, mini-app, terminal/TUI, Electron/desktop, TV, and any additional client' >/dev/null &&
475
+ active_text "$source_truth" | grep -F 'map every rendered stack in the authoritative consumer inventory' >/dev/null &&
476
+ active_text "$multiproject" | grep -F 'every same-stack subproject uses the same canonical UI-kit/component family for that rendered stack' >/dev/null &&
477
+ active_text "$multiproject" | grep -F 'find the actual theme injection or token-consumption point' >/dev/null &&
478
+ active_text "$multiproject" | grep -F 'terminal palette/style registry' >/dev/null &&
479
+ active_text "$tokens" | grep -F '## Complete Consumer Set' >/dev/null &&
480
+ active_text "$tokens" | grep -F 'absence from the desktop/mobile examples is never `not-applicable` proof' >/dev/null &&
481
+ active_text "$layout" | grep -F 'ordinary CLI or full-screen terminal/TUI, Electron/desktop/TV shell' >/dev/null &&
482
+ active_text "$layout" | grep -F 'TTY and non-TTY/plain modes as applicable' >/dev/null &&
483
+ active_text "$lifecycle" | grep -F 'the canonical prerequisite and acceptance path is `delivery-contract.md`: Design brief → Test Phase 0 → producer/client execution → Test Phase 1/sufficiency → design verdict' >/dev/null &&
484
+ active_text "$lifecycle" | grep -F 'Every runtime-ready or launch-ready claim cites the complete immutable design/test/producer/client binding set and an allowed verdict' >/dev/null &&
485
+ active_text "$lifecycle" | grep -F 'Start these launch gates only after the exact candidate is `accepted + complete`' >/dev/null
486
+ }
487
+
488
+ reachable_finish_paths_valid() {
489
+ local entry="$1" intake="$2" development="$3" lifecycle="$4" source_map="$5"
490
+ local interaction="$6" visual="$7" audit="$8" surface="$9" external="${10}"
491
+ active_text "$entry" | grep -F 'The complete affected client-owner set owns implementation and runtime evidence' >/dev/null &&
492
+ active_text "$entry" | grep -F 'Vue/Svelte/static/vendor/other web → its installed owner or fail-closed project-convention lookup' >/dev/null &&
493
+ active_text "$entry" | grep -F 'Electron/desktop/TV shell → its installed owner or the same lookup' >/dev/null &&
494
+ active_text "$intake" | grep -F 'It supplies design-owned intake and criteria to the five top-level stages in `delivery-contract.md`' >/dev/null &&
495
+ active_text "$intake" | grep -F 'Passing them locally is not completion' >/dev/null &&
496
+ active_text "$intake" | grep -F 'complete five-stage contract, immutable design/test/producer/client binding set' >/dev/null &&
497
+ active_text "$intake" | grep -F 'absence from the Web/mobile examples is not `not-applicable` proof' >/dev/null &&
498
+ active_text "$development" | grep -F 'Build the complete affected client-owner set from `delivery-contract.md`' >/dev/null &&
499
+ active_text "$development" | grep -F 'It cannot by itself finish the slice; completion requires bound design and test records, every changed producer and affected client return, Test Phase 1 sufficiency, and an allowed design verdict' >/dev/null &&
500
+ active_text "$lifecycle" | grep -F 'do not invent a second design-readiness status' >/dev/null &&
501
+ active_text "$lifecycle" | grep -F 'cannot override the canonical design verdict' >/dev/null &&
502
+ active_text "$source_map" | grep -F '`react-web` / `other-web`' >/dev/null &&
503
+ active_text "$source_map" | grep -F '`desktop-tv-shell` / `mixed-host` / `other-client`' >/dev/null &&
504
+ active_text "$interaction" | grep -F 'it cannot issue ready/complete' >/dev/null &&
505
+ active_text "$interaction" | grep -F 'complete design/test/producer/client binding set' >/dev/null &&
506
+ active_text "$visual" | grep -F 'they cannot mark a runtime slice ready or complete' >/dev/null &&
507
+ active_text "$visual" | grep -F 'complete design/test/producer/client set' >/dev/null &&
508
+ active_text "$audit" | grep -F 'not an independent acceptance path' >/dev/null &&
509
+ active_text "$audit" | grep -F 'React/other-Web, H5, native, mini-app, terminal/CLI/TUI, Electron/desktop/TV, other-client, and composite-host layer' >/dev/null &&
510
+ active_text "$surface" | grep -F 'Ordinary CLI or terminal/TUI' >/dev/null &&
511
+ active_text "$surface" | grep -F 'Vue/Svelte/static/vendor/other content and shell layers route to their installed owner or the fail-closed project-convention lookup' >/dev/null &&
512
+ active_text "$external" | grep -F 'Windows/Linux native desktop, Electron, TV, and any other rendered client' >/dev/null &&
513
+ active_text "$external" | grep -F 'An embedded renderer and its shell remain separate owner/evidence members' >/dev/null
514
+ }
515
+
516
+ parallel_completion_claims_absent() {
517
+ local file
518
+ for file in "$@"; do
519
+ if active_text "$file" | grep -Eiq \
520
+ 'Passing .*(marks|makes|finishes|completes).*(ready|complete)|marks? (the )?(runtime )?slice complete without|Launch readiness:[[:space:]]*(pass|conditional pass|block)|(^|[.;] )(may|can|does) issue (its own|an independent|a second) .*verdict|(may|can) override the canonical design verdict|implementation is considered ready:|this checklist (is|becomes) sufficient'; then
521
+ return 1
522
+ fi
523
+ done
524
+ }
525
+
526
+ all_design_references_no_parallel_completion() {
527
+ parallel_completion_claims_absent \
528
+ "$ROOT/skills/product-ui-ux-design/SKILL.md" \
529
+ "$ROOT"/skills/product-ui-ux-design/references/*.md \
530
+ "$ROOT/docs/uiux-design-handbook.md" \
531
+ "$ROOT/docs/client-dev-handbook.md" \
532
+ "$ROOT/docs/testing-handbook.md" \
533
+ "$ROOT/docs/feature-delivery-handbook.md" \
534
+ "$ROOT/docs/backend-dev-handbook.md" \
535
+ "$ROOT/docs/llm-algorithm-handbook.md" \
536
+ "$@"
537
+ }
538
+
539
+ unknown_handoff_valid() {
540
+ local line
541
+ line=$(active_text "$1" | grep -F "An incomplete universe or inaccessible member remains" || true)
542
+ line=${line%%$'\n'*}
543
+ case "$line" in
544
+ *'blocks a complete claim'*'terminal state remains `pending + blocked`'*'acceptance of the handoff is not design acceptance or completion'*) return 0 ;;
545
+ *) return 1 ;;
546
+ esac
547
+ }
548
+
549
+ contract_status_pairs() {
550
+ active_markdown "$1" | awk '
551
+ {
552
+ separator = index($0, "\t")
553
+ line = substr($0, separator + 1)
554
+ }
555
+ line == "| Verdict | Next state | Required condition |" { table = 1; next }
556
+ table && line ~ /^\| ---/ { next }
557
+ table && line ~ /^\|/ {
558
+ split(line, cell, "|")
559
+ verdict = cell[2]
560
+ state = cell[3]
561
+ gsub(/^[[:space:]]+|[[:space:]]+$/, "", verdict)
562
+ gsub(/^[[:space:]]+|[[:space:]]+$/, "", state)
563
+ gsub(/`/, "", verdict)
564
+ gsub(/`/, "", state)
565
+ print verdict ":" state
566
+ next
567
+ }
568
+ table { exit }
569
+ '
570
+ }
571
+
572
+ status_pair_valid() {
573
+ local file="$1" verdict="$2" state="$3"
574
+ contract_status_pairs "$file" | grep -Fx -- "$verdict:$state" >/dev/null
575
+ }
576
+
577
+ status_pair_set_valid() {
578
+ local file="$1" actual expected
579
+ actual=$(contract_status_pairs "$file" | LC_ALL=C sort)
580
+ expected=$(printf '%s\n' \
581
+ accepted:complete \
582
+ candidate:blocked \
583
+ pending:blocked \
584
+ pending:pre-runtime-test-ready \
585
+ rejected:design-rejected | LC_ALL=C sort)
586
+ [ "$actual" = "$expected" ]
587
+ }
588
+
589
+ accepted_completion_valid() {
590
+ local line
591
+ line=$(active_text "$1" | grep -F '| `accepted` | `complete` |' || true)
592
+ [ "$(printf '%s\n' "$line" | sed '/^$/d' | wc -l | tr -d ' ')" = "1" ] || return 1
593
+ case "$line" in
594
+ *'The bound Phase 1 `sufficiency` is `sufficient` and no required evidence gap remains'*'every required design/test/producer/client owner, record, exercised-version link, and binding-set member is present and verified'*) return 0 ;;
595
+ *) return 1 ;;
596
+ esac
597
+ }
598
+
599
+ contract_binding_specs() {
600
+ active_markdown "$1" | awk '
601
+ {
602
+ separator = index($0, "\t")
603
+ line = substr($0, separator + 1)
604
+ }
605
+ line == "| Binding kind | Exact payload |" { table = 1; next }
606
+ table && line ~ /^\| ---/ { next }
607
+ table && line ~ /^\|/ {
608
+ split(line, cell, "|")
609
+ kind = cell[2]
610
+ payload = cell[3]
611
+ gsub(/^[[:space:]]+|[[:space:]]+$/, "", kind)
612
+ gsub(/^[[:space:]]+|[[:space:]]+$/, "", payload)
613
+ gsub(/`/, "", kind)
614
+ gsub(/`/, "", payload)
615
+ print kind ":" payload
616
+ next
617
+ }
618
+ table { exit }
619
+ '
620
+ }
621
+
622
+ binding_spec_set_valid() {
623
+ local file="$1" actual expected
624
+ actual=$(contract_binding_specs "$file" | LC_ALL=C sort)
625
+ expected=$(printf '%s\n' \
626
+ 'artifact-sha256:artifact-sha256:<64-hex>' \
627
+ 'commit:commit:<full-40-or-64-hex>' \
628
+ 'dirty-bundle-v1:dirty-bundle-v1:<full-base-commit-hex>:<64-hex-bundle-digest>' \
629
+ 'tree:tree:<full-40-or-64-hex>' | LC_ALL=C sort)
630
+ [ "$actual" = "$expected" ]
631
+ }
632
+
633
+ immutable_binding_kind() {
634
+ local value="$1"
635
+ [[ "$value" =~ ^commit:([[:xdigit:]]{40}|[[:xdigit:]]{64})$ ]] ||
636
+ [[ "$value" =~ ^tree:([[:xdigit:]]{40}|[[:xdigit:]]{64})$ ]] ||
637
+ [[ "$value" =~ ^artifact-sha256:[[:xdigit:]]{64}$ ]] ||
638
+ [[ "$value" =~ ^dirty-bundle-v1:([[:xdigit:]]{40}|[[:xdigit:]]{64}):[[:xdigit:]]{64}$ ]]
639
+ }
640
+
641
+ check "$ROOT/skills/product-ui-ux-design/SKILL.md" \
642
+ "references/delivery-contract.md" \
643
+ "design owner canonical delivery-contract pointer"
644
+ check "$ROOT/skills/product-ui-ux-design/SKILL.md" \
645
+ "acceptance is conformance" \
646
+ "specified-state source conformance obligation"
647
+ check "$ROOT/skills/product-ui-ux-design/SKILL.md" \
648
+ "sweep detection across them" \
649
+ "repeatable defect-class sibling sweep obligation"
650
+ check "$ROOT/skills/product-ui-ux-design/SKILL.md" \
651
+ "performance, adaptation, launch acceptance, iteration signals, AI-assistant patterns" \
652
+ "full design capability scope remains explicit"
653
+ check "$ROOT/skills/product-ui-ux-design/SKILL.md" \
654
+ "obtain the source's required review before code follows" \
655
+ "specified treatment changes design source before code"
656
+ check "$ROOT/skills/product-ui-ux-design/references/design-execution-checklist.md" \
657
+ "delivery-contract.md" \
658
+ "design routing checklist delivery-contract pointer"
659
+ check "$ROOT/docs/uiux-design-handbook.md" \
660
+ "../skills/product-ui-ux-design/references/delivery-contract.md" \
661
+ "reader handbook canonical delivery-contract pointer"
662
+ check "$ROOT/docs/client-dev-handbook.md" \
663
+ "../skills/product-ui-ux-design/references/delivery-contract.md" \
664
+ "client handbook canonical delivery-contract pointer"
665
+ check "$ROOT/docs/testing-handbook.md" \
666
+ "../skills/product-ui-ux-design/references/delivery-contract.md" \
667
+ "testing handbook canonical delivery-contract pointer"
668
+ check "$ROOT/docs/feature-delivery-handbook.md" \
669
+ "../skills/product-ui-ux-design/references/delivery-contract.md" \
670
+ "feature delivery handbook canonical delivery-contract pointer"
671
+ check "$ROOT/docs/feature-delivery-handbook.md" \
672
+ '后端 `python-service-dev` 记录导出 API 的 `producer_record`、不可变 binding' \
673
+ "feature example returns the producer member"
674
+ check "$ROOT/docs/feature-delivery-handbook.md" \
675
+ '测试 Phase 1:`testing-strategy` 引用完整 design/test/producer/client record 与 binding set' \
676
+ "feature example runs testing Phase 1"
677
+ check "$ROOT/docs/feature-delivery-handbook.md" \
678
+ '只有满足 canonical contract 的 `accepted + complete` 才能写完成' \
679
+ "feature example closes through the design verdict"
680
+ check "$ROOT/docs/backend-dev-handbook.md" \
681
+ '../skills/product-ui-ux-design/references/delivery-contract.md' \
682
+ "backend handbook canonical delivery-contract pointer"
683
+ check "$ROOT/docs/backend-dev-handbook.md" \
684
+ 'Go/Python owner 回传自己的 `producer_record` 和不可变 binding' \
685
+ "backend handbook producer/client return"
686
+ check "$ROOT/docs/backend-dev-handbook.md" \
687
+ '记 `unknown-consumers`、缺口 owner/动作,只能 `pending + blocked`' \
688
+ "backend handbook unknown consumer fail-closed path"
689
+ check "$ROOT/docs/backend-dev-handbook.md" \
690
+ 'Phase 1 聚合集合判充分性,最后由设计 owner 给 verdict' \
691
+ "backend handbook Phase 1 and design verdict"
692
+ check "$ROOT/docs/llm-algorithm-handbook.md" \
693
+ '../skills/product-ui-ux-design/references/delivery-contract.md' \
694
+ "LLM handbook canonical delivery-contract pointer"
695
+ check "$ROOT/docs/llm-algorithm-handbook.md" \
696
+ '`llm-inference-integration` 回传 prompt/model/tool 等 `producer_record` 与不可变 binding' \
697
+ "LLM handbook producer/client return"
698
+ check "$ROOT/docs/llm-algorithm-handbook.md" \
699
+ '记 `unknown-consumers`、缺口 owner/动作,保持 `pending + blocked`' \
700
+ "LLM handbook unknown consumer fail-closed path"
701
+ check "$ROOT/docs/llm-algorithm-handbook.md" \
702
+ 'Phase 1 聚合 design/test/producer/client 集合判充分性,设计 owner 再给 verdict' \
703
+ "LLM handbook Phase 1 and design verdict"
704
+
705
+ for owner in testing-strategy web-react-dev app-cross-platform-dev miniapp-product-dev terminal-cli-dev; do
706
+ check "$ROOT/skills/$owner/SKILL.md" \
707
+ '`../product-ui-ux-design/references/delivery-contract.md`' \
708
+ "$owner reciprocal delivery-contract pointer"
709
+ done
710
+
711
+ for owner in web-react-dev app-cross-platform-dev miniapp-product-dev terminal-cli-dev; do
712
+ if ! client_entry_valid "$ROOT/skills/$owner/SKILL.md"; then
713
+ echo "FAIL: $owner canonical pre-edit client_entry is incomplete" >&2
714
+ fail=1
715
+ fi
716
+ check_client_return "$ROOT/skills/$owner/SKILL.md" "$owner"
717
+ check "$ROOT/skills/$owner/SKILL.md" \
718
+ "valid low-risk copy-only record + lightweight Phase 0" \
719
+ "$owner reachable copy-only path"
720
+ done
721
+
722
+ for producer in go-microservice-dev python-service-dev llm-inference-integration; do
723
+ check "$ROOT/skills/$producer/SKILL.md" \
724
+ '`../product-ui-ux-design/references/delivery-contract.md`' \
725
+ "$producer visible-consumer delivery-contract pointer"
726
+ if ! producer_route_valid "$ROOT/skills/$producer/SKILL.md"; then
727
+ echo "FAIL: $producer must delegate canonical routing/status and return only its producer delta" >&2
728
+ fail=1
729
+ fi
730
+ done
731
+
732
+ if ! resolved_markdown_reference_valid "$TEST_MATRIX" '../../product-ui-ux-design/references/delivery-contract.md'; then
733
+ echo "FAIL: testing matrix canonical delivery-contract reference does not resolve" >&2
734
+ fail=1
735
+ fi
736
+ for relative in \
737
+ '../../product-ui-ux-design/references/delivery-contract.md' \
738
+ '../../product-ui-ux-design/references/multi-project-token-consistency.md' \
739
+ '../../product-ui-ux-design/references/design-execution-checklist.md'; do
740
+ if ! resolved_markdown_reference_valid "$PRODUCT_DESIGN_ROUTE" "$relative"; then
741
+ echo "FAIL: product design-routing reference does not resolve: $relative" >&2
742
+ fail=1
743
+ fi
744
+ done
745
+
746
+ check_absent \
747
+ 'If any client renders the value, or the universe/member is incomplete, use `unknown-consumers`' \
748
+ "known visible consumer is incorrectly classified unknown" \
749
+ "$ROOT/skills/go-microservice-dev/SKILL.md" \
750
+ "$ROOT/skills/python-service-dev/SKILL.md" \
751
+ "$ROOT/skills/llm-inference-integration/SKILL.md"
752
+
753
+ check "$ROOT/skills/product-rd-workflow/SKILL.md" \
754
+ '`../product-ui-ux-design/references/delivery-contract.md`' \
755
+ "product lifecycle delivery-contract pointer"
756
+ check "$ROOT/skills/product-rd-workflow/references/design-routing-and-readiness.md" \
757
+ "design brief → test Phase 0 → producer/client execution → test Phase 1/sufficiency → design verdict" \
758
+ "product lifecycle names the full producer/client stage"
759
+ check "$ROOT/docs/uiux-design-handbook.md" \
760
+ '`design/test/producer/client-record set`' \
761
+ "reader handbook names all execution record sets"
762
+ check "$ROOT/docs/uiux-design-handbook.md" \
763
+ 'reference 相对路径能实际解析、客户端首笔实现前的 `client_entry` 与完整回传,以及 producer 是否只指向 canonical universe/status' \
764
+ "reader handbook explains the cross-owner static gate"
765
+ check "$ROOT/docs/client-dev-handbook.md" \
766
+ '先按 [`delivery-contract.md`](../skills/product-ui-ux-design/references/delivery-contract.md) 写 `client_entry`' \
767
+ "client handbook requires the pre-edit client entry"
768
+ check "$ROOT/docs/client-dev-handbook.md" \
769
+ '实跑后回传完整 canonical client member' \
770
+ "client handbook requires the complete client return"
771
+ check "$ROOT/docs/uiux-design-handbook.md" \
772
+ "所有影响结果的 ignored path/mode/type/content" \
773
+ "reader handbook binds ignored result-affecting inputs"
774
+ check "$ROOT/docs/uiux-design-handbook.md" \
775
+ 'Phase 1 明确为 `sufficient`、没有 required evidence gap' \
776
+ "reader handbook prevents insufficient accepted+complete"
777
+ check "$ROOT/docs/testing-handbook.md" \
778
+ 'Phase 1 为 `sufficient` 且没有 required evidence gap' \
779
+ "testing handbook prevents insufficient accepted+complete"
780
+ check "$ROOT/docs/testing-handbook.md" \
781
+ '缺 `client_entry`、client member 不完整' \
782
+ "testing handbook blocks an incomplete client handoff"
783
+
784
+ if ! stage_order_valid "$CONTRACT"; then
785
+ echo "FAIL: delivery stages are missing, duplicated, or out of order" >&2
786
+ fail=1
787
+ fi
788
+
789
+ check "$CONTRACT" "Phase 0 — layer selection" "non-circular pre-implementation test selection"
790
+ check "$CONTRACT" "Phase 1 — execution result and sufficiency" "post-client test result and sufficiency"
791
+ check "$CONTRACT" '`Design brief → Test Phase 0 → Producer/client execution → Test Phase 1/sufficiency → Design verdict`' "canonical owner/pass sequence"
792
+ check "$CONTRACT" '`client_record_ids`' "Phase 1 references every client execution member"
793
+ check "$CONTRACT" '`producer_record_ids`' "Phase 1 references every producer execution member"
794
+ check "$CONTRACT" "instead of copying them" "single-write runtime evidence ownership"
795
+ check "$CONTRACT" "visible-UI, page-slice, design-checkpoint, or rendered-evidence rule plus the decision it produced" "client-entry rule evidence closed set"
796
+ check "$CONTRACT" "Arbitrary skill text, a file path, runtime name, or vague anchor alone is not evidence" "client-entry vague-anchor rejection"
797
+ check "$CONTRACT" "A project-convention owner must quote the specific surface/interaction/evidence convention applied" "project convention entry evidence"
798
+ check "$CONTRACT" "The design brief does not select verifier type" "test-layer ownership stays out of design criteria"
799
+ check "$CONTRACT" "missing test-owned fields cannot make the brief incomplete" "non-circular brief completeness"
800
+ check "$CONTRACT" "criterion_results" "criterion-level design verdict"
801
+ check "$CONTRACT" "candidate_binding" "verdict candidate binding"
802
+ check "$CONTRACT" "Branches, tags, abbreviated SHAs, empty suffixes" "immutable evidence binding"
803
+ check "$CONTRACT" "candidate_binding_set" "multi-owner immutable evidence binding"
804
+ check "$CONTRACT" 'Missing, mismatched, stale, changed-after-run, or unexercised required design/test/producer/client owner or binding members make sufficiency `blocked`' "all-role member aggregation fails closed"
805
+ if ! composite_owner_valid "$CONTRACT"; then
806
+ echo "FAIL: composite-host client owner set is incomplete" >&2
807
+ fail=1
808
+ fi
809
+ if ! binding_contract_valid "$CONTRACT"; then
810
+ echo "FAIL: candidate binding-set contract is incomplete" >&2
811
+ fail=1
812
+ fi
813
+ if ! binding_spec_set_valid "$CONTRACT"; then
814
+ echo "FAIL: candidate binding-kind table is not the exact closed allowed set" >&2
815
+ fail=1
816
+ fi
817
+ if ! candidate_member_contract_valid "$CONTRACT"; then
818
+ echo "FAIL: design/test/producer/client record, binding, or exercised-version linkage is incomplete" >&2
819
+ fail=1
820
+ fi
821
+ if ! trigger_class_set_valid "$CONTRACT"; then
822
+ echo "FAIL: delivery-depth and composable work-mode trigger classes are not synchronized" >&2
823
+ fail=1
824
+ fi
825
+ check "$CONTRACT" "coverage boundary" "deterministic gate coverage boundary"
826
+ check "$CONTRACT" "authoritative consumer universe" "complete consumer-universe requirement"
827
+ check "$CONTRACT" "Only a value or contract change proven not to render on or alter any client may leave this contract" "proven backend-only routing boundary"
828
+ check "$CONTRACT" "using API/log/output evidence plus the recorded consumer-universe proof" "backend-only evidence handoff"
829
+ check "$CONTRACT" 'Classify a consumer as `out-of-scope` only when evidence shows that stack cannot ship the value' "out-of-scope closed proof boundary"
830
+ check "$CONTRACT" "owner-lookup-unavailable" "no-installed-owner fail-closed lookup"
831
+ check "$CONTRACT" "every screen remains its own full design slice" "systemic redesign per-screen slice"
832
+ check "$CONTRACT" "grouping content and actions by user intent and consequence" "systemic redesign IA re-derivation"
833
+ check "$CONTRACT" "A bare ownership declaration does not authorize a behavior change" "silent IA behavior change is a defect"
834
+ check "$CONTRACT" '`reference_surface`' "reference surface or explicit fallback"
835
+ check "$CONTRACT" "Before editing a design artifact, UI copy, visual rule, design-system guidance, or code-facing acceptance criterion" "design planning precedes edits and approval"
836
+ check "$CONTRACT" "named producer/test/client handoff before edit or approval" "design brief names all execution owners"
837
+ check "$ROOT/skills/product-ui-ux-design/SKILL.md" \
838
+ "Each changed or claim-bearing backend/config/content/inference owner owns its producer artifact or version identity" \
839
+ "design entrypoint exposes producer ownership"
840
+ check "$CONTRACT" "surface type, and density mode" "design brief density mode"
841
+ check "$CONTRACT" "return context, and component semantics" "design brief component semantics"
842
+ check "$CONTRACT" "behavioral logic, aesthetic/visual hierarchy and craft, interaction, and component-semantics criteria" "design brief quality criteria"
843
+ check "$CONTRACT" "A retroactive brief without the diff audit cannot bless" "missed-record remediation"
844
+ check "$CONTRACT" "remove it before commit and before completion" "temporary helper cleanup boundary"
845
+ check "$CONTRACT" "does not repeatedly interrupt the operator" "batched evidence collection avoids prompt churn"
846
+ check "$CONTRACT" "lightweight record is complete with" "copy-only minimal record"
847
+ if ! lightweight_all_role_valid "$CONTRACT"; then
848
+ echo "FAIL: copy-only path omits a design/test/producer/client owner, record, or binding obligation" >&2
849
+ fail=1
850
+ fi
851
+ if ! copy_only_misclassification_valid "$CONTRACT"; then
852
+ echo "FAIL: copy-only misclassification lost full remediation or blocking semantics" >&2
853
+ fail=1
854
+ fi
855
+ check "$CONTRACT" "All other terminal combinations are invalid" "closed verdict-state algebra"
856
+ check "$CONTRACT" 'terminal state remains `pending + blocked`' "unknown-consumers handoff remains blocked"
857
+ if ! unknown_handoff_valid "$CONTRACT"; then
858
+ echo "FAIL: user-accepted unknown-consumers handoff can escape blocked state" >&2
859
+ fail=1
860
+ fi
861
+ check "$CONTRACT" '`rejection_basis`' "rejection basis classification"
862
+ check "$CONTRACT" 'A `deterministic-conformance` rejection may be repaired by a targeted change' "deterministic rejection repair path"
863
+ check "$CONTRACT" 'A `design-judgment` or `mixed` rejection requires a revised design target' "judgment rejection independent-review path"
864
+ check "$CONTRACT" "the rejected render or screenshot is negative evidence and cannot be reused as acceptance evidence" "rejected evidence cannot launder acceptance"
865
+ check "$CONTRACT" "every normal or ordinary draft MR" "rejected design blocks normal draft handoff"
866
+ check "$CONTRACT" "every attempted capture command, its observed failure, the residual risk, and the next unblock action" "unavailable rendered evidence requires attempted capture"
867
+ check "$CONTRACT" "A hand-authored or echoed transcript is fabricated evidence" "fabricated rendered evidence severity"
868
+ check "$CONTRACT" '`planned` includes the exact capture command/step and must resolve before a final design verdict' "planned evidence final boundary"
869
+ check "$CONTRACT" "residual risk and explicitly accepts proceeding without that evidence for this specific change in the current thread" "specific current-thread evidence-gap acceptance"
870
+ check "$CONTRACT" "re-renders the actual artifact set at review time" "aggregate final review fresh render"
871
+ check "$CONTRACT" "intentionally replaces the blanket rule that an author can never accept any slice" "bounded deterministic author-acceptance decision is explicit"
872
+ check "$CONTRACT" 'A missing or absent design verdict is `pending` and blocks `complete`, MR-ready' "missing verdict blocks completion and MR readiness"
873
+ check "$CONTRACT" "Before landing executable design guidance that affects multiple client stacks" "cross-stack owner naming before landing"
874
+ check "$CONTRACT" "mirror its executable form into every affected owner" "cross-stack design rule propagation"
875
+ check "$CONTRACT" "streaming/background progress, focus/modal state, and jump/new-output affordance evidence" "terminal design evidence completeness"
876
+ check "$CONTRACT" "any rendered layer without an installed client owner" "project convention fallback covers every runtime"
877
+ check "$TEST_MATRIX" \
878
+ "Do not copy role-owned raw fields into a second record" \
879
+ "testing Phase 1 single-write rule"
880
+ check "$TEST_MATRIX" \
881
+ 'A missing canonical `client_entry`, incomplete client-record member' \
882
+ "testing Phase 1 blocks an incomplete client handoff"
883
+ check "$ROOT/skills/testing-strategy/SKILL.md" \
884
+ "a UI/UX Design brief with a stable slice/surface" \
885
+ "current design brief confirms bounded test scope"
886
+ check "$ROOT/skills/testing-strategy/SKILL.md" \
887
+ 'confirms every affected client wrote its canonical pre-edit `client_entry` and complete client-record member' \
888
+ "testing owner checks the complete client handoff"
889
+ check "$ROOT/skills/testing-strategy/SKILL.md" \
890
+ "two or more plausible scopes remain and choosing among them would materially change the test plan" \
891
+ "ambiguous test scope still asks"
892
+ check "$ROOT/skills/testing-strategy/SKILL.md" \
893
+ "A current, resolvable Design brief or accepted scope artifact is evidence, not inference" \
894
+ "scope artifact is not mistaken for unsupported inference"
895
+ check "$ROUTER" \
896
+ "This router is conditional context, not an always-loaded prerequisite." \
897
+ "router conditional-loading contract"
898
+ if ! entrypoint_router_valid "$ROOT/skills/product-ui-ux-design/SKILL.md" "$ROUTER"; then
899
+ echo "FAIL: product-ui-ux-design entrypoint lost its direct runtime route or conditional one-hop router route" >&2
900
+ fail=1
901
+ fi
902
+ if ! router_composition_valid "$ROUTER"; then
903
+ echo "FAIL: delivery-depth/work-mode reference union is incomplete" >&2
904
+ fail=1
905
+ fi
906
+ if ! router_mode_reachability_valid "$ROUTER" "Audit/review" "at any delivery depth" "ui-ux-audit.md"; then
907
+ echo "FAIL: narrow audit/review tasks cannot reliably reach the audit procedure" >&2
908
+ fail=1
909
+ fi
910
+ if ! router_mode_reachability_valid "$ROUTER" "Naming/version synchronization" "Figma↔code naming drift" "design-impl-naming-and-versioning.md"; then
911
+ echo "FAIL: naming/version drift tasks cannot reach their focused reference" >&2
912
+ fail=1
913
+ fi
914
+ if ! router_mode_reachability_valid "$ROUTER" "Source/code evidence" "local frontend implementation evidence" "frontend-code-evidence-map.md"; then
915
+ echo "FAIL: code-evidence audits cannot reach the frontend evidence map" >&2
916
+ fail=1
917
+ fi
918
+ if ! router_mode_reachability_valid "$ROUTER" "Design-to-code" "Applying design decisions to client code" "ui-ux-design-development.md"; then
919
+ echo "FAIL: design-to-client implementation cannot reach the primitive catalog" >&2
920
+ fail=1
921
+ fi
922
+ if ! router_mode_reachability_valid "$ROUTER" "Same-stack multi-project" "same end/stack" "multi-project-token-consistency.md"; then
923
+ echo "FAIL: same-stack multi-subproject theme work cannot reach its consistency procedure" >&2
924
+ fail=1
925
+ fi
926
+ if ! router_mode_reachability_valid "$ROUTER" "Multi-stack" "spans multiple client stacks" "multi-stack-strategy.md"; then
927
+ echo "FAIL: multi-stack/composite-host tasks cannot reach their focused reference" >&2
928
+ fail=1
929
+ fi
930
+ check "$ROUTER" \
931
+ 'also load `multi-project-token-consistency.md` when the same framework spans different ends and shares brand/theme infrastructure' \
932
+ "same-framework cross-end tasks compose multi-stack and shared-theme references"
933
+ if ! router_lens_reachability_valid "$ROUTER" \
934
+ "Layout recipe, component density, workbench structure, empty/loading/error geometry, or screenshot/render acceptance" \
935
+ "layout-recipes-and-screenshot-acceptance.md"; then
936
+ echo "FAIL: narrow state/layout/screenshot work cannot reach its recipe and acceptance reference" >&2
937
+ fail=1
938
+ fi
939
+ if ! router_lens_terms_valid "$ROUTER" "platform-web-desktop-patterns.md" "admin"; then
940
+ echo "FAIL: Web platform lens lost its admin trigger" >&2
941
+ fail=1
942
+ fi
943
+ if ! router_lens_terms_valid "$ROUTER" "platform-mobile-patterns.md" "App/app-hosted"; then
944
+ echo "FAIL: mobile platform lens lost its App/app-hosted trigger" >&2
945
+ fail=1
946
+ fi
947
+ if ! router_lens_terms_valid "$ROUTER" "operational-processing-workflows.md" \
948
+ "capture" "upload/import" "queue" "progress monitoring" "assignment/ownership" "exception handling" "quality-control" "moderation"; then
949
+ echo "FAIL: operational lens lost one or more established triggers" >&2
950
+ fail=1
951
+ fi
952
+ if ! router_lens_terms_valid "$ROUTER" "trust-sensitive-ai-and-data-patterns.md" \
953
+ "upload" "citation" "analytics" "moderation decision" "long-running workflow" "instrumentation"; then
954
+ echo "FAIL: trust lens lost one or more established triggers" >&2
955
+ fail=1
956
+ fi
957
+ if ! router_lens_terms_valid "$ROUTER" "resource-management-interactions.md" "content-pack"; then
958
+ echo "FAIL: resource lens lost its content-pack trigger" >&2
959
+ fail=1
960
+ fi
961
+ if ! router_lens_terms_valid "$ROUTER" "scenario-community-patterns.md" \
962
+ "Community/social/feed/creator/topic/profile/notification/moderation/AI-social"; then
963
+ echo "FAIL: community lens lost one or more established triggers" >&2
964
+ fail=1
965
+ fi
966
+ if ! router_lens_reachability_valid "$ROUTER" \
967
+ "Generic surface/loop taxonomy, account/settings, decision/review, AI-assisted or workflow-extension pattern, or no focused scenario lens fits" \
968
+ "product-surface-patterns.md"; then
969
+ echo "FAIL: generic non-scenario surface work cannot reach the surface/loop taxonomy" >&2
970
+ fail=1
971
+ fi
972
+ if ! router_lens_reachability_valid "$ROUTER" \
973
+ "Visual polish, brand feel, anti-slop, typography/hierarchy, iconography, or material treatment" \
974
+ "visual-craft.md"; then
975
+ echo "FAIL: narrow visual-polish work cannot reach visual craft guidance" >&2
976
+ fail=1
977
+ fi
978
+ if ! router_lens_reachability_valid "$ROUTER" \
979
+ "Attention, motivation, perceived effort, trust psychology, habit loop, or behavioral/aesthetic judgment" \
980
+ "behavioral-aesthetic-logic.md"; then
981
+ echo "FAIL: narrow behavioral/aesthetic work cannot reach its judgment reference" >&2
982
+ fail=1
983
+ fi
984
+ if ! router_lens_reachability_valid "$ROUTER" \
985
+ "Design-system source authority, third-party mirror detection, brand-token ownership, or wrong design-source comments in code/theme files" \
986
+ "design-system-source-of-truth.md"; then
987
+ echo "FAIL: design-system authority audits cannot reach the source-of-truth procedure" >&2
988
+ fail=1
989
+ fi
990
+ check "$ROUTER" \
991
+ "Which producer, test, and client owners must return which evidence before a verdict?" \
992
+ "router closeout includes producer/test/client owners"
993
+ if [ ! -f "$ROOT/skills/skill-extraction-workflow/references/two-source-extraction-pattern.md" ]; then
994
+ echo "FAIL: source-pair extraction reference target is missing" >&2
995
+ fail=1
996
+ fi
997
+ for routed_reference in \
998
+ ui-ux-audit.md \
999
+ ui-ux-design-development.md \
1000
+ frontend-code-evidence-map.md \
1001
+ layout-recipes-and-screenshot-acceptance.md \
1002
+ product-surface-patterns.md \
1003
+ design-impl-naming-and-versioning.md \
1004
+ multi-stack-strategy.md \
1005
+ multi-project-token-consistency.md; do
1006
+ if [ ! -f "$ROOT/skills/product-ui-ux-design/references/$routed_reference" ]; then
1007
+ echo "FAIL: routed design reference is missing: $routed_reference" >&2
1008
+ fail=1
1009
+ fi
1010
+ done
1011
+ if ! multistack_owner_valid "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md"; then
1012
+ echo "FAIL: reachable multi-stack guidance contradicts canonical client ownership" >&2
1013
+ fail=1
1014
+ fi
1015
+ if ! design_mode_owner_valid \
1016
+ "$ROOT/skills/product-ui-ux-design/references/ui-ux-design-development.md" \
1017
+ "$ROOT/skills/product-ui-ux-design/references/source-map.md" \
1018
+ "$ROOT/skills/product-ui-ux-design/references/frontend-code-evidence-map.md" \
1019
+ "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md"; then
1020
+ echo "FAIL: design-to-code/source-code-evidence guidance narrows the actual Web or composite-host owner set" >&2
1021
+ fail=1
1022
+ fi
1023
+ if ! restored_reference_owner_valid \
1024
+ "$ROOT/skills/product-ui-ux-design/references/design-impl-naming-and-versioning.md" \
1025
+ "$ROOT/skills/product-ui-ux-design/references/multi-project-token-consistency.md" \
1026
+ "$ROOT/skills/product-ui-ux-design/references/design-system-source-of-truth.md"; then
1027
+ echo "FAIL: restored naming/theme references narrow the canonical client-owner set" >&2
1028
+ fail=1
1029
+ fi
1030
+ if ! terminal_cli_contract_valid \
1031
+ "$ROOT/skills/terminal-cli-dev/SKILL.md" \
1032
+ "$ROOT/skills/go-microservice-dev/SKILL.md" \
1033
+ "$ROOT/skills/python-service-dev/SKILL.md" \
1034
+ "$ROOT/skills/product-rd-workflow/references/design-routing-and-readiness.md"; then
1035
+ echo "FAIL: ordinary user-facing CLI changes can escape terminal UI/UX/testing ownership" >&2
1036
+ fail=1
1037
+ fi
1038
+ if ! reachable_reference_scope_valid \
1039
+ "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md" \
1040
+ "$ROOT/skills/product-ui-ux-design/references/design-system-source-of-truth.md" \
1041
+ "$ROOT/skills/product-ui-ux-design/references/multi-project-token-consistency.md" \
1042
+ "$ROOT/skills/product-ui-ux-design/references/tokens-and-components.md" \
1043
+ "$ROOT/skills/product-ui-ux-design/references/layout-recipes-and-screenshot-acceptance.md" \
1044
+ "$ROOT/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md"; then
1045
+ echo "FAIL: a reachable design reference narrows the canonical consumer set or opens a parallel completion path" >&2
1046
+ fail=1
1047
+ fi
1048
+ if ! reachable_finish_paths_valid \
1049
+ "$ROOT/skills/product-ui-ux-design/SKILL.md" \
1050
+ "$ROOT/skills/product-ui-ux-design/references/design-intake-and-acceptance.md" \
1051
+ "$ROOT/skills/product-ui-ux-design/references/ui-ux-design-development.md" \
1052
+ "$ROOT/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md" \
1053
+ "$ROOT/skills/product-ui-ux-design/references/source-map.md" \
1054
+ "$ROOT/skills/product-ui-ux-design/references/interaction-design-patterns.md" \
1055
+ "$ROOT/skills/product-ui-ux-design/references/visual-craft.md" \
1056
+ "$ROOT/skills/product-ui-ux-design/references/ui-ux-audit.md" \
1057
+ "$ROOT/skills/product-ui-ux-design/references/product-surface-patterns.md" \
1058
+ "$ROOT/skills/product-ui-ux-design/references/external-ui-ux-quality-benchmarks.md"; then
1059
+ echo "FAIL: a reachable design lens narrows the owner set or opens an independent ready/complete path" >&2
1060
+ fail=1
1061
+ fi
1062
+ if ! all_design_references_no_parallel_completion; then
1063
+ echo "FAIL: a reachable design reference contains a parallel ready/complete/verdict path" >&2
1064
+ fail=1
1065
+ fi
1066
+ check "$ROOT/docs/client-dev-handbook.md" \
1067
+ "组件语义、无障碍/焦点/键盘" \
1068
+ "non-rendered classification includes interaction semantics"
1069
+ check "$PRODUCT_DESIGN_ROUTE" \
1070
+ "A clearly labeled review-only draft MR may carry the revised bound candidate" \
1071
+ "rejected design review-only handoff"
1072
+ for pair in \
1073
+ '| `accepted` | `complete` |' \
1074
+ '| `rejected` | `design-rejected` |' \
1075
+ '| `pending` | `pre-runtime-test-ready` |' \
1076
+ '| `pending` | `blocked` |' \
1077
+ '| `candidate` | `blocked` |'; do
1078
+ check "$CONTRACT" "$pair" "allowed verdict/next-state pair"
1079
+ done
1080
+
1081
+ for valid in "accepted complete" "rejected design-rejected" "pending pre-runtime-test-ready" "pending blocked" "candidate blocked"; do
1082
+ set -- $valid
1083
+ status_pair_valid "$CONTRACT" "$1" "$2" || { echo "FAIL: valid contract status rejected: $valid" >&2; fail=1; }
1084
+ done
1085
+ for invalid in "accepted pre-runtime-test-ready" "accepted blocked" "pending complete" "candidate complete" "rejected complete"; do
1086
+ set -- $invalid
1087
+ if status_pair_valid "$CONTRACT" "$1" "$2"; then
1088
+ echo "FAIL: contradictory contract status accepted: $invalid" >&2
1089
+ fail=1
1090
+ fi
1091
+ done
1092
+ if ! status_pair_set_valid "$CONTRACT"; then
1093
+ echo "FAIL: contract status table is not the exact closed allowed set" >&2
1094
+ fail=1
1095
+ fi
1096
+ if ! accepted_completion_valid "$CONTRACT"; then
1097
+ echo "FAIL: accepted+complete does not require sufficient bound Phase 1 evidence" >&2
1098
+ fail=1
1099
+ fi
1100
+ for binding in \
1101
+ "commit:0123456789abcdef0123456789abcdef01234567" \
1102
+ "tree:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" \
1103
+ "artifact-sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" \
1104
+ "dirty-bundle-v1:0123456789abcdef0123456789abcdef01234567:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"; do
1105
+ immutable_binding_kind "$binding" || { echo "FAIL: immutable binding fixture rejected: $binding" >&2; fail=1; }
1106
+ done
1107
+ for invalid_binding in \
1108
+ "branch:feature/ui" \
1109
+ "commit:" \
1110
+ "commit:abc" \
1111
+ "tree:" \
1112
+ "artifact-sha256:" \
1113
+ "base+dirty-sha256:" \
1114
+ "dirty-bundle-v1::" \
1115
+ "dirty-bundle-v1:0123456789abcdef0123456789abcdef01234567:"; do
1116
+ if immutable_binding_kind "$invalid_binding"; then
1117
+ echo "FAIL: incomplete or mutable binding fixture accepted: $invalid_binding" >&2
1118
+ fail=1
1119
+ fi
1120
+ done
1121
+
1122
+ for owner in testing-strategy web-react-dev app-cross-platform-dev miniapp-product-dev terminal-cli-dev; do
1123
+ check "$CONTRACT" "\`$owner\`" "delivery-contract owner coverage"
1124
+ done
1125
+
1126
+ for state in candidate accepted rejected pending complete pre-runtime-test-ready design-rejected blocked; do
1127
+ check "$CONTRACT" "\`$state\`" "delivery-contract status vocabulary"
1128
+ done
1129
+
1130
+ check "$CONTRACT" "Heuristic review is risk discovery, not acceptance proof" \
1131
+ "heuristic evidence boundary"
1132
+ check "$CONTRACT" "rendered evidence" "runtime evidence requirement"
1133
+ check "$CONTRACT" "unknown-consumers" "multi-consumer honesty state"
1134
+ check "$CONTRACT" "Copy acceptance is semantic" "copy-only semantic acceptance guardrails"
1135
+ check "$INTERACTION" "hidden when disclosure would be unsafe" \
1136
+ "disabled-state disclosure boundary"
1137
+ check "$INTERACTION" "placeholder text cannot be the only label" \
1138
+ "form-label accessibility boundary"
1139
+ check "$INTERACTION" "Backend logs alone do not satisfy this user-facing contract" \
1140
+ "dangerous-operation accountability is visible"
1141
+ check "$INTERACTION" "reserved or non-rebindable key combinations and actions" \
1142
+ "shortcut reserved-key contract"
1143
+ check "$INTERACTION" "text-input, IME/composition, and editable-content safety" \
1144
+ "shortcut composition safety"
1145
+ check "$INTERACTION" "a visible reset-to-defaults recovery path" \
1146
+ "shortcut recovery contract"
1147
+ check "$OPERATIONAL" "do not use a marketing-style hero banner, decorative gradient as the design, oversized empty illustration, heavy visual drama" \
1148
+ "operational workspace anti-marketing prohibition"
1149
+ check "$SOURCE_MAP" "terminal-tui" "terminal source classification"
1150
+ check "$SOURCE_MAP" "other-web" "other-Web source classification"
1151
+ check "$SOURCE_MAP" "desktop-tv-shell" "desktop/TV shell source classification"
1152
+ check "$SOURCE_MAP" "fully extract every non-excluded file" "formal source re-extraction completeness"
1153
+ check "$ROOT/skills/product-ui-ux-design/SKILL.md" \
1154
+ "render classes such as overflow" \
1155
+ "render-class sibling sweep requires re-render"
1156
+ check "$ROOT/skills/product-ui-ux-design/SKILL.md" \
1157
+ "retroactive brief cannot bless" \
1158
+ "design entry missed-record remediation"
1159
+ check "$TEST_MATRIX" \
1160
+ "valid low-risk copy-only record" \
1161
+ "testing lightweight copy path"
1162
+ check "$TEST_MATRIX" \
1163
+ "candidate_binding_set" \
1164
+ "testing immutable Phase 1 binding"
1165
+ if ! app_design_closeout_valid "$APP_OWNER"; then
1166
+ echo "FAIL: app design closeout lost verdict blocking, screenshot boundary, or rejected-candidate recapture" >&2
1167
+ fail=1
1168
+ fi
1169
+ if ! testing_phase0_inputs_valid "$TEST_MATRIX"; then
1170
+ echo "FAIL: testing Phase 0 lost a design input, no-narrowing rule, or test-owned layer" >&2
1171
+ fail=1
1172
+ fi
1173
+ if ! testing_incomplete_branches_valid "$TEST_MATRIX"; then
1174
+ echo "FAIL: testing Phase 0 incomplete rule lost a top-level branch or named evidence substitution" >&2
1175
+ fail=1
1176
+ fi
1177
+
1178
+ for profile in \
1179
+ "Copy-only" \
1180
+ "Narrow visible change" \
1181
+ "New or reshaped screen" \
1182
+ "Systemic redesign" \
1183
+ "Shared system" \
1184
+ "Source/code evidence" \
1185
+ "Design-to-code" \
1186
+ "Audit/review" \
1187
+ "Naming/version synchronization" \
1188
+ "Same-stack multi-project" \
1189
+ "Multi-stack"; do
1190
+ check "$ROUTER" "| $profile |" "design execution profile"
1191
+ done
1192
+
1193
+ for source in \
1194
+ "https://www.iso.org/standard/77520.html" \
1195
+ "https://www.iso.org/standard/63500.html" \
1196
+ "https://www.w3.org/TR/WCAG22/" \
1197
+ "https://www.w3.org/TR/WCAG22/#target-size-minimum" \
1198
+ "https://www.w3.org/TR/WCAG22/#animation-from-interactions" \
1199
+ "https://www.w3.org/TR/WCAG22/#error-prevention-legal-financial-data" \
1200
+ "https://www.w3.org/WAI/ARIA/apg/about/introduction/" \
1201
+ "https://developer.apple.com/design/human-interface-guidelines/buttons" \
1202
+ "https://developer.android.com/guide/topics/ui/accessibility/apps" \
1203
+ "https://doi.org/10.3758/BF03195514" \
1204
+ "https://doi.org/10.1006/ijhc.2002.1017" \
1205
+ "https://www.w3.org/community/reports/design-tokens/CG-FINAL-format-20251028/"; do
1206
+ check "$LEDGER" "$source" "primary theory/source ledger entry"
1207
+ done
1208
+
1209
+ check "$LEDGER" "not a W3C Standard" "design-token authority boundary"
1210
+ check "$LEDGER" "not a complete design system or production-ready code" \
1211
+ "ARIA pattern authority boundary"
1212
+ check "$LEDGER" "55%–99%" "five-user empirical range boundary"
1213
+ check "$LEDGER" "The Understanding document is informative" \
1214
+ "normative criterion versus informative explanation boundary"
1215
+ check "$LEDGER" "Retain the source's publication status" \
1216
+ "web specification maturity boundary"
1217
+ check "$LEDGER" "Apple-platform guidance for button hit regions, not a universal touch-target constant" \
1218
+ "Apple button hit-region authority boundary"
1219
+ check "$ROOT/skills/skill-extraction-workflow/references/uiux-judgment-extraction.md" \
1220
+ "Apple HIG's general-rule hit region of at least 44×44pt" \
1221
+ "extraction guidance keeps Apple hit-region strength and scope"
1222
+ check "$ROOT/skills/product-ui-ux-design/references/platform-mobile-patterns.md" \
1223
+ "Keep both platform-scoped; do not average them into a universal number" \
1224
+ "mobile reference keeps Apple and Android target guidance scoped"
1225
+ check "$ROOT/skills/product-ui-ux-design/references/ui-ux-audit.md" \
1226
+ "map applicable criteria into \`delivery-contract.md\`" \
1227
+ "platform audit uses the authority-classed contract path"
1228
+
1229
+ check_absent \
1230
+ 'canonical four-phase|Its four phases|phase order|before Phase [234]|Phase 2 and Phase 3' \
1231
+ "stage/pass terminology drift remains" \
1232
+ "$ROOT/skills/product-ui-ux-design/SKILL.md" \
1233
+ "$ROOT/skills/product-ui-ux-design/references/delivery-contract.md" \
1234
+ "$ROOT/skills/testing-strategy/SKILL.md"
1235
+
1236
+ check_absent \
1237
+ 'within (five|5) seconds|five[- ]second|5[- ]second' \
1238
+ "arbitrary five-second acceptance threshold remains" \
1239
+ "$ROOT/skills/product-ui-ux-design/SKILL.md" \
1240
+ "$ROOT/skills/product-ui-ux-design/references"
1241
+
1242
+ check_absent \
1243
+ '^- (Hick|Fitts|Miller|Doherty)[/:]' \
1244
+ "unbounded eponym shorthand remains in UI/UX extraction guidance" \
1245
+ "$ROOT/skills/skill-extraction-workflow/references/uiux-judgment-extraction.md"
1246
+
1247
+ check_absent \
1248
+ '\[\[[^]]+\.md\]\]' \
1249
+ "non-resolvable double-bracket Markdown reference remains" \
1250
+ "$ROOT/skills/product-ui-ux-design/references"
1251
+
1252
+ check_absent \
1253
+ 'Platform Convention Walkthrough' \
1254
+ "retired combined vendor walkthrough reference remains" \
1255
+ "$ROOT/skills/product-ui-ux-design"
1256
+
1257
+ check_absent \
1258
+ '^## Universal Layout Recipe' \
1259
+ "unbounded universal layout recipe remains" \
1260
+ "$ROOT/skills/product-ui-ux-design/references/layout-recipes-and-screenshot-acceptance.md"
1261
+
1262
+ check_absent \
1263
+ 'pre-runtime-test ready' \
1264
+ "legacy split spelling of the canonical handoff state remains" \
1265
+ "$ROOT/skills/product-ui-ux-design" \
1266
+ "$ROOT/skills/testing-strategy/SKILL.md" \
1267
+ "$ROOT/skills/web-react-dev/SKILL.md" \
1268
+ "$ROOT/skills/app-cross-platform-dev/SKILL.md" \
1269
+ "$ROOT/skills/miniapp-product-dev/SKILL.md" \
1270
+ "$ROOT/skills/terminal-cli-dev/SKILL.md" \
1271
+ "$ROOT/skills/product-rd-workflow/SKILL.md" \
1272
+ "$ROOT/skills/product-rd-workflow/references/verify-developer-experience.md" \
1273
+ "$ROOT/skills/testing-strategy/references/client-runtime-test-matrices.md" \
1274
+ "$ROOT/skills/web-react-dev/references/complex-workspace-patterns.md" \
1275
+ "$ROOT/skills/app-cross-platform-dev/references/mobile-quality-release.md" \
1276
+ "$ROOT/docs/testing-handbook.md"
1277
+
1278
+ MUTATION_TMP=$(mktemp -d "${TMPDIR:-/tmp}/uiux-contract-mutations.XXXXXX")
1279
+ trap 'rm -rf "$MUTATION_TMP"' EXIT
1280
+
1281
+ mutate_exact_once() {
1282
+ local source="$1" output="$2" needle="$3" replacement="$4"
1283
+ ruby -e '
1284
+ needle, replacement, source = ARGV
1285
+ text = File.binread(source)
1286
+ count = text.scan(needle).length
1287
+ abort "mutation source count=#{count}, expected=1: #{needle}" unless count == 1
1288
+ STDOUT.write(text.sub(needle, replacement))
1289
+ ' "$needle" "$replacement" "$source" > "$output"
1290
+ }
1291
+
1292
+ run_rule_mutation() {
1293
+ local name="$1" source="$2" validator="$3" needle="$4" replacement="$5"
1294
+ local output="$MUTATION_TMP/$name.md"
1295
+ mutate_exact_once "$source" "$output" "$needle" "$replacement"
1296
+ if "$validator" "$output"; then
1297
+ echo "FAIL: $name mutation survived the live-rule validator" >&2
1298
+ fail=1
1299
+ fi
1300
+ }
1301
+
1302
+ run_rule_mutation app-verdict-nonblocking "$APP_OWNER" app_design_closeout_valid \
1303
+ 'remains `pending` and blocks the canonical contract' \
1304
+ 'may remain unspecified and does not block the canonical contract'
1305
+ run_rule_mutation app-screenshot-acceptance "$APP_OWNER" app_design_closeout_valid \
1306
+ 'a mobile screenshot proves only that the app rendered and is never design acceptance' \
1307
+ 'a mobile screenshot is sufficient design acceptance'
1308
+ run_rule_mutation app-rejected-no-recapture "$APP_OWNER" app_design_closeout_valid \
1309
+ "the design owner applies \`delivery-contract.md\`'s rejected-candidate path and requires fresh runtime evidence for the revised candidate" \
1310
+ 'the client owner may patch the rejected candidate without fresh runtime evidence'
1311
+
1312
+ run_rule_mutation phase0-state-adaptation-dropped "$TEST_MATRIX" testing_phase0_inputs_valid \
1313
+ 'state/adaptation matrix' 'state notes'
1314
+ run_rule_mutation phase0-criteria-dropped "$TEST_MATRIX" testing_phase0_inputs_valid \
1315
+ 'criterion IDs/outcomes' 'visual notes'
1316
+ run_rule_mutation phase0-red-dropped "$TEST_MATRIX" testing_phase0_inputs_valid \
1317
+ 'RED baseline' 'current green result'
1318
+ run_rule_mutation phase0-narrowing-allowed "$TEST_MATRIX" testing_phase0_inputs_valid \
1319
+ 'do not silently replace or narrow the recorded design obligations' \
1320
+ 'may replace or narrow the recorded design obligations'
1321
+ run_rule_mutation phase0-layer-owner-moved "$TEST_MATRIX" testing_phase0_inputs_valid \
1322
+ 'testing owns verifier type, assertion/rendered-evidence layers, commands/targets, independent oracles, and gaps' \
1323
+ 'design owns verifier type and test layers'
1324
+
1325
+ run_rule_mutation phase0-missing-input-branch-dropped "$TEST_MATRIX" testing_incomplete_branches_valid \
1326
+ 'the applicable full/lightweight design inputs are missing, or when ' ''
1327
+ run_rule_mutation phase0-evidence-substitution-branch-dropped "$TEST_MATRIX" testing_incomplete_branches_valid \
1328
+ 'DOM/component existence, a build pass, or an unreviewed screenshot is used in place of required rendered, interaction, accessibility, recovery, or design evidence' \
1329
+ 'a build pass is accepted as sufficient evidence'
1330
+
1331
+ run_rule_mutation copy-only-misclassification-branch-dropped "$CONTRACT" copy_only_misclassification_valid \
1332
+ 'If later evidence proves the `copy-only` classification wrong, the lightweight record is invalid from that discovery point, and you must apply **Missed pre-edit record** to the existing diff by stopping implementation edits, rebuilding the full Design brief, obtaining full Phase 0 and every affected producer/client owner entry, auditing the whole existing diff against them, then rerunning producer/client execution, Phase 1, and the design verdict. Until that remediation closes, the slice is `pending + blocked`; the old lightweight result cannot support completion.' \
1333
+ ''
1334
+ run_rule_mutation copy-only-misclassification-false-complete "$CONTRACT" copy_only_misclassification_valid \
1335
+ 'If later evidence proves the `copy-only` classification wrong, the lightweight record is invalid from that discovery point, and you must apply **Missed pre-edit record** to the existing diff by stopping implementation edits, rebuilding the full Design brief, obtaining full Phase 0 and every affected producer/client owner entry, auditing the whole existing diff against them, then rerunning producer/client execution, Phase 1, and the design verdict. Until that remediation closes, the slice is `pending + blocked`; the old lightweight result cannot support completion.' \
1336
+ 'If later evidence proves the `copy-only` classification wrong, the lightweight record is invalid from that discovery point, and you must apply **Missed pre-edit record** to the existing diff by stopping implementation edits, rebuilding the full Design brief, obtaining full Phase 0 and every affected producer/client owner entry, auditing the whole existing diff against them, then rerunning producer/client execution, Phase 1, and the design verdict. The prior lightweight result is `accepted + complete` and needs no remediation.'
1337
+
1338
+ if [ -f "$CONTRACT" ]; then
1339
+ awk '
1340
+ $0 == "## 2. Test Phase 0 — layer selection" { print "## 3. Producer/client execution"; next }
1341
+ $0 == "## 3. Producer/client execution" { print "## 2. Test Phase 0 — layer selection"; next }
1342
+ { print }
1343
+ ' "$CONTRACT" > "$MUTATION_TMP/stage-order.md"
1344
+ if stage_order_valid "$MUTATION_TMP/stage-order.md"; then
1345
+ echo "FAIL: stage-order mutation survived the contract oracle" >&2
1346
+ fail=1
1347
+ fi
1348
+
1349
+ awk '
1350
+ { print }
1351
+ $0 == "## 2. Test Phase 0 — layer selection" { print "## 2. Test Phase 0 — layer selection" }
1352
+ ' "$CONTRACT" > "$MUTATION_TMP/duplicate-stage.md"
1353
+ if stage_order_valid "$MUTATION_TMP/duplicate-stage.md"; then
1354
+ echo "FAIL: duplicate-stage mutation survived the contract oracle" >&2
1355
+ fail=1
1356
+ fi
1357
+ fi
1358
+
1359
+ sed 's/Return the complete canonical client-record member/Return a partial client-record member/' \
1360
+ "$ROOT/skills/web-react-dev/SKILL.md" > "$MUTATION_TMP/partial-client-return.md"
1361
+ if client_return_valid "$MUTATION_TMP/partial-client-return.md"; then
1362
+ echo "FAIL: partial client-return mutation survived the contract oracle" >&2
1363
+ fail=1
1364
+ fi
1365
+
1366
+ sed 's/, affected files\/components//' \
1367
+ "$ROOT/skills/web-react-dev/SKILL.md" > "$MUTATION_TMP/client-return-member-dropped.md"
1368
+ if client_return_valid "$MUTATION_TMP/client-return-member-dropped.md"; then
1369
+ echo "FAIL: incomplete client-return member mutation survived the contract oracle" >&2
1370
+ fail=1
1371
+ fi
1372
+
1373
+ sed 's/, planned run\/capture command//' \
1374
+ "$ROOT/skills/web-react-dev/SKILL.md" > "$MUTATION_TMP/client-entry-command-dropped.md"
1375
+ if client_entry_valid "$MUTATION_TMP/client-entry-command-dropped.md"; then
1376
+ echo "FAIL: incomplete client_entry mutation survived the contract oracle" >&2
1377
+ fail=1
1378
+ fi
1379
+
1380
+ sed 's/API\/event\/schema fields/API fields omitted/' \
1381
+ "$ROOT/skills/go-microservice-dev/SKILL.md" > "$MUTATION_TMP/producer-trigger.md"
1382
+ if producer_route_valid "$MUTATION_TMP/producer-trigger.md"; then
1383
+ echo "FAIL: narrowed producer-trigger mutation survived the producer-routing oracle" >&2
1384
+ fail=1
1385
+ fi
1386
+
1387
+ sed 's/returns only its `producer_record` delta: immutable binding/returns no producer delta/' \
1388
+ "$ROOT/skills/go-microservice-dev/SKILL.md" > "$MUTATION_TMP/producer-record-dropped.md"
1389
+ if producer_route_valid "$MUTATION_TMP/producer-record-dropped.md"; then
1390
+ echo "FAIL: dropped producer-record delta survived the producer-routing oracle" >&2
1391
+ fail=1
1392
+ fi
1393
+
1394
+ awk '{ print } END { print "- A missing record may use `pending + pre-runtime-test-ready`." }' \
1395
+ "$ROOT/skills/go-microservice-dev/SKILL.md" > "$MUTATION_TMP/producer-wrong-preruntime.md"
1396
+ if producer_route_valid "$MUTATION_TMP/producer-wrong-preruntime.md"; then
1397
+ echo "FAIL: producer-local pre-runtime status mutation survived the canonical-pointer oracle" >&2
1398
+ fail=1
1399
+ fi
1400
+
1401
+ sed 's#../../product-ui-ux-design/references/delivery-contract.md#../product-ui-ux-design/references/delivery-contract.md#' \
1402
+ "$TEST_MATRIX" > "$MUTATION_TMP/testing-wrong-relative-path.md"
1403
+ if resolved_markdown_reference_valid "$MUTATION_TMP/testing-wrong-relative-path.md" '../../product-ui-ux-design/references/delivery-contract.md' "$(dirname "$TEST_MATRIX")"; then
1404
+ echo "FAIL: wrong testing relative path survived the reference-resolution oracle" >&2
1405
+ fail=1
1406
+ fi
1407
+
1408
+ sed 's#../../product-ui-ux-design/references/#product-ui-ux-design/references/#g' \
1409
+ "$PRODUCT_DESIGN_ROUTE" > "$MUTATION_TMP/product-wrong-relative-path.md"
1410
+ if resolved_markdown_reference_valid "$MUTATION_TMP/product-wrong-relative-path.md" '../../product-ui-ux-design/references/delivery-contract.md' "$(dirname "$PRODUCT_DESIGN_ROUTE")"; then
1411
+ echo "FAIL: wrong product-routing relative path survived the reference-resolution oracle" >&2
1412
+ fail=1
1413
+ fi
1414
+
1415
+ sed 's/terminal state remains `pending + blocked`/terminal state becomes `accepted + complete`/' \
1416
+ "$CONTRACT" > "$MUTATION_TMP/unknown-handoff.md"
1417
+ if unknown_handoff_valid "$MUTATION_TMP/unknown-handoff.md"; then
1418
+ echo "FAIL: unknown-consumers complete mutation survived the terminal-state oracle" >&2
1419
+ fail=1
1420
+ fi
1421
+
1422
+ awk '
1423
+ { print }
1424
+ $0 ~ /^\| `candidate` \| `blocked` \|/ {
1425
+ print "| `accepted` | `blocked` | injected contradictory row |"
1426
+ }
1427
+ ' "$CONTRACT" > "$MUTATION_TMP/extra-status-pair.md"
1428
+ if status_pair_set_valid "$MUTATION_TMP/extra-status-pair.md"; then
1429
+ echo "FAIL: extra contradictory status pair survived the table-derived oracle" >&2
1430
+ fail=1
1431
+ fi
1432
+
1433
+ sed 's/Load the union of their references; one lens never cancels another/Load only the deepest profile/' \
1434
+ "$ROUTER" > "$MUTATION_TMP/router-single-choice.md"
1435
+ if router_composition_valid "$MUTATION_TMP/router-single-choice.md"; then
1436
+ echo "FAIL: single-choice profile mutation survived the router oracle" >&2
1437
+ fail=1
1438
+ fi
1439
+
1440
+ sed 's#../../skill-extraction-workflow/references/two-source-extraction-pattern.md#../skill-extraction-workflow/references/two-source-extraction-pattern.md#' \
1441
+ "$ROUTER" > "$MUTATION_TMP/router-dangling-pointer.md"
1442
+ if router_composition_valid "$MUTATION_TMP/router-dangling-pointer.md"; then
1443
+ echo "FAIL: dangling cross-skill pointer mutation survived the router oracle" >&2
1444
+ fail=1
1445
+ fi
1446
+
1447
+ sed 's#references/design-execution-checklist\.md#references/missing-design-router.md#' \
1448
+ "$ROOT/skills/product-ui-ux-design/SKILL.md" > "$MUTATION_TMP/entrypoint-router-orphan.md"
1449
+ if entrypoint_router_valid "$MUTATION_TMP/entrypoint-router-orphan.md" "$ROUTER"; then
1450
+ echo "FAIL: orphaned entrypoint-to-router mutation survived the reachability oracle" >&2
1451
+ fail=1
1452
+ fi
1453
+
1454
+ sed 's/A runtime-visible task enters `references\/delivery-contract.md` directly; the specialized router is not a prerequisite to that canonical path./A runtime-visible task enters `references\/delivery-contract.md` only after the specialized router./' \
1455
+ "$ROOT/skills/product-ui-ux-design/SKILL.md" > "$MUTATION_TMP/entrypoint-runtime-through-router.md"
1456
+ if entrypoint_router_valid "$MUTATION_TMP/entrypoint-runtime-through-router.md" "$ROUTER"; then
1457
+ echo "FAIL: forced-router runtime mutation survived the direct-route oracle" >&2
1458
+ fail=1
1459
+ fi
1460
+
1461
+ sed 's/This router is conditional context, not an always-loaded prerequisite./This router is the always-loaded prerequisite./' \
1462
+ "$ROUTER" > "$MUTATION_TMP/router-always-loaded.md"
1463
+ if entrypoint_router_valid "$ROOT/skills/product-ui-ux-design/SKILL.md" "$MUTATION_TMP/router-always-loaded.md"; then
1464
+ echo "FAIL: always-loaded router mutation survived the conditional-loading oracle" >&2
1465
+ fail=1
1466
+ fi
1467
+
1468
+ sed 's/auth\/admin surface/auth surface/' "$ROUTER" > "$MUTATION_TMP/router-web-admin-dropped.md"
1469
+ if router_lens_terms_valid "$MUTATION_TMP/router-web-admin-dropped.md" "platform-web-desktop-patterns.md" "admin"; then
1470
+ echo "FAIL: dropped Web admin trigger survived the router oracle" >&2
1471
+ fail=1
1472
+ fi
1473
+
1474
+ sed 's/App\/app-hosted\///' "$ROUTER" > "$MUTATION_TMP/router-app-hosted-dropped.md"
1475
+ if router_lens_terms_valid "$MUTATION_TMP/router-app-hosted-dropped.md" "platform-mobile-patterns.md" "App/app-hosted"; then
1476
+ echo "FAIL: dropped App/app-hosted trigger survived the router oracle" >&2
1477
+ fail=1
1478
+ fi
1479
+
1480
+ sed 's/capture, upload\/import, queue/capture omitted/' "$ROUTER" > "$MUTATION_TMP/router-operational-triggers-dropped.md"
1481
+ if router_lens_terms_valid "$MUTATION_TMP/router-operational-triggers-dropped.md" "operational-processing-workflows.md" \
1482
+ "capture" "upload/import" "queue" "progress monitoring" "assignment/ownership" "exception handling" "quality-control" "moderation"; then
1483
+ echo "FAIL: narrowed operational triggers survived the router oracle" >&2
1484
+ fail=1
1485
+ fi
1486
+
1487
+ sed 's/, or instrumentation//' "$ROUTER" > "$MUTATION_TMP/router-trust-instrumentation-dropped.md"
1488
+ if router_lens_terms_valid "$MUTATION_TMP/router-trust-instrumentation-dropped.md" "trust-sensitive-ai-and-data-patterns.md" \
1489
+ "upload" "citation" "analytics" "moderation decision" "long-running workflow" "instrumentation"; then
1490
+ echo "FAIL: dropped trust instrumentation trigger survived the router oracle" >&2
1491
+ fail=1
1492
+ fi
1493
+
1494
+ sed 's/content-pack/content collection/' "$ROUTER" > "$MUTATION_TMP/router-content-pack-dropped.md"
1495
+ if router_lens_terms_valid "$MUTATION_TMP/router-content-pack-dropped.md" "resource-management-interactions.md" "content-pack"; then
1496
+ echo "FAIL: dropped content-pack trigger survived the router oracle" >&2
1497
+ fail=1
1498
+ fi
1499
+
1500
+ sed 's/Community\/social\/feed\/creator\/topic\/profile\/notification\/moderation\/AI-social/Community\/feed\/creator\/profile\/notification/' \
1501
+ "$ROUTER" > "$MUTATION_TMP/router-community-triggers-dropped.md"
1502
+ if router_lens_terms_valid "$MUTATION_TMP/router-community-triggers-dropped.md" "scenario-community-patterns.md" \
1503
+ "Community/social/feed/creator/topic/profile/notification/moderation/AI-social"; then
1504
+ echo "FAIL: narrowed community triggers survived the router oracle" >&2
1505
+ fail=1
1506
+ fi
1507
+
1508
+ sed 's/at any delivery depth/only for systemic redesign/' \
1509
+ "$ROUTER" > "$MUTATION_TMP/router-narrow-audit-orphan.md"
1510
+ if router_mode_reachability_valid "$MUTATION_TMP/router-narrow-audit-orphan.md" "Audit/review" "at any delivery depth" "ui-ux-audit.md"; then
1511
+ echo "FAIL: systemic-only audit mutation survived the task-reachability oracle" >&2
1512
+ fail=1
1513
+ fi
1514
+
1515
+ sed 's/design-impl-naming-and-versioning\.md/design-impl-naming-orphaned.md/' \
1516
+ "$ROUTER" > "$MUTATION_TMP/router-naming-orphan.md"
1517
+ if router_mode_reachability_valid "$MUTATION_TMP/router-naming-orphan.md" "Naming/version synchronization" "Figma↔code naming drift" "design-impl-naming-and-versioning.md"; then
1518
+ echo "FAIL: naming/version orphan mutation survived the task-reachability oracle" >&2
1519
+ fail=1
1520
+ fi
1521
+
1522
+ sed 's/multi-stack-strategy\.md/multi-stack-orphaned.md/' \
1523
+ "$ROUTER" > "$MUTATION_TMP/router-multistack-orphan.md"
1524
+ if router_mode_reachability_valid "$MUTATION_TMP/router-multistack-orphan.md" "Multi-stack" "spans multiple client stacks" "multi-stack-strategy.md"; then
1525
+ echo "FAIL: multi-stack orphan mutation survived the task-reachability oracle" >&2
1526
+ fail=1
1527
+ fi
1528
+
1529
+ sed 's/frontend-code-evidence-map\.md/frontend-code-evidence-orphaned.md/' \
1530
+ "$ROUTER" > "$MUTATION_TMP/router-code-evidence-orphan.md"
1531
+ if router_mode_reachability_valid "$MUTATION_TMP/router-code-evidence-orphan.md" "Source/code evidence" "local frontend implementation evidence" "frontend-code-evidence-map.md"; then
1532
+ echo "FAIL: code-evidence orphan mutation survived the task-reachability oracle" >&2
1533
+ fail=1
1534
+ fi
1535
+
1536
+ sed 's/ui-ux-design-development\.md/ui-ux-design-development-orphaned.md/' \
1537
+ "$ROUTER" > "$MUTATION_TMP/router-design-to-code-orphan.md"
1538
+ if router_mode_reachability_valid "$MUTATION_TMP/router-design-to-code-orphan.md" "Design-to-code" "Applying design decisions to client code" "ui-ux-design-development.md"; then
1539
+ echo "FAIL: design-to-code orphan mutation survived the task-reachability oracle" >&2
1540
+ fail=1
1541
+ fi
1542
+
1543
+ sed 's/multi-project-token-consistency\.md/multi-project-token-orphaned.md/' \
1544
+ "$ROUTER" > "$MUTATION_TMP/router-same-stack-orphan.md"
1545
+ if router_mode_reachability_valid "$MUTATION_TMP/router-same-stack-orphan.md" "Same-stack multi-project" "same end/stack" "multi-project-token-consistency.md"; then
1546
+ echo "FAIL: same-stack theme orphan mutation survived the task-reachability oracle" >&2
1547
+ fail=1
1548
+ fi
1549
+
1550
+ sed 's/layout-recipes-and-screenshot-acceptance\.md/layout-recipes-orphaned.md/' \
1551
+ "$ROUTER" > "$MUTATION_TMP/router-layout-orphan.md"
1552
+ if router_lens_reachability_valid "$MUTATION_TMP/router-layout-orphan.md" \
1553
+ "Layout recipe, component density, workbench structure, empty/loading/error geometry, or screenshot/render acceptance" \
1554
+ "layout-recipes-and-screenshot-acceptance.md"; then
1555
+ echo "FAIL: narrow layout/state recipe orphan mutation survived the task-reachability oracle" >&2
1556
+ fail=1
1557
+ fi
1558
+
1559
+ sed 's/product-surface-patterns\.md/product-surface-orphaned.md/' \
1560
+ "$ROUTER" > "$MUTATION_TMP/router-generic-surface-orphan.md"
1561
+ if router_lens_reachability_valid "$MUTATION_TMP/router-generic-surface-orphan.md" \
1562
+ "Generic surface/loop taxonomy, account/settings, decision/review, AI-assisted or workflow-extension pattern, or no focused scenario lens fits" \
1563
+ "product-surface-patterns.md"; then
1564
+ echo "FAIL: generic surface/loop orphan mutation survived the task-reachability oracle" >&2
1565
+ fail=1
1566
+ fi
1567
+
1568
+ sed 's/visual-craft\.md/visual-craft-orphaned.md/' \
1569
+ "$ROUTER" > "$MUTATION_TMP/router-visual-craft-orphan.md"
1570
+ if router_lens_reachability_valid "$MUTATION_TMP/router-visual-craft-orphan.md" \
1571
+ "Visual polish, brand feel, anti-slop, typography/hierarchy, iconography, or material treatment" \
1572
+ "visual-craft.md"; then
1573
+ echo "FAIL: narrow visual-craft orphan mutation survived the task-reachability oracle" >&2
1574
+ fail=1
1575
+ fi
1576
+
1577
+ sed 's/behavioral-aesthetic-logic\.md/behavioral-aesthetic-orphaned.md/' \
1578
+ "$ROUTER" > "$MUTATION_TMP/router-behavioral-orphan.md"
1579
+ if router_lens_reachability_valid "$MUTATION_TMP/router-behavioral-orphan.md" \
1580
+ "Attention, motivation, perceived effort, trust psychology, habit loop, or behavioral/aesthetic judgment" \
1581
+ "behavioral-aesthetic-logic.md"; then
1582
+ echo "FAIL: behavioral/aesthetic orphan mutation survived the task-reachability oracle" >&2
1583
+ fail=1
1584
+ fi
1585
+
1586
+ sed 's/design-system-source-of-truth\.md/design-system-source-orphaned.md/' \
1587
+ "$ROUTER" > "$MUTATION_TMP/router-source-authority-orphan.md"
1588
+ if router_lens_reachability_valid "$MUTATION_TMP/router-source-authority-orphan.md" \
1589
+ "Design-system source authority, third-party mirror detection, brand-token ownership, or wrong design-source comments in code/theme files" \
1590
+ "design-system-source-of-truth.md"; then
1591
+ echo "FAIL: design-source authority orphan mutation survived the task-reachability oracle" >&2
1592
+ fail=1
1593
+ fi
1594
+
1595
+ sed 's/analytics-visualization-interactions\.md/analytics-visualization-orphaned.md/' \
1596
+ "$ROUTER" > "$MUTATION_TMP/router-analytics-orphan.md"
1597
+ if router_lens_reachability_valid "$MUTATION_TMP/router-analytics-orphan.md" \
1598
+ "Analytics, charts, comparison, drill-down, metric explanation, creator/topic health, retention, or AI-quality metric" \
1599
+ "analytics-visualization-interactions.md"; then
1600
+ echo "FAIL: analytics lens orphan mutation survived the task-reachability oracle" >&2
1601
+ fail=1
1602
+ fi
1603
+
1604
+ sed 's/complex-creation-interactions\.md/complex-creation-orphaned.md/' \
1605
+ "$ROUTER" > "$MUTATION_TMP/router-complex-creation-orphan.md"
1606
+ if router_lens_reachability_valid "$MUTATION_TMP/router-complex-creation-orphan.md" \
1607
+ "Complex creation, upload/import, AI draft extraction, structured editing, matching/manual correction, preview/publish/export flow" \
1608
+ "complex-creation-interactions.md"; then
1609
+ echo "FAIL: complex-creation lens orphan mutation survived the task-reachability oracle" >&2
1610
+ fail=1
1611
+ fi
1612
+
1613
+ sed 's/interaction-design-patterns\.md/interaction-design-orphaned.md/' \
1614
+ "$ROUTER" > "$MUTATION_TMP/router-detailed-interaction-orphan.md"
1615
+ if router_lens_reachability_valid "$MUTATION_TMP/router-detailed-interaction-orphan.md" \
1616
+ "Detailed interaction, feedback strength, error/recovery, gesture, generated state, motion, or shortcut behavior" \
1617
+ "interaction-design-patterns.md"; then
1618
+ echo "FAIL: detailed-interaction lens orphan mutation survived the task-reachability oracle" >&2
1619
+ fail=1
1620
+ fi
1621
+
1622
+ sed 's/external-ui-ux-quality-benchmarks\.md/external-quality-orphaned.md/' \
1623
+ "$ROUTER" > "$MUTATION_TMP/router-external-theory-orphan.md"
1624
+ if router_lens_reachability_valid "$MUTATION_TMP/router-external-theory-orphan.md" \
1625
+ "External theory, WCAG, platform recommendation, benchmark claim" \
1626
+ "external-ui-ux-quality-benchmarks.md"; then
1627
+ echo "FAIL: external-theory lens orphan mutation survived the task-reachability oracle" >&2
1628
+ fail=1
1629
+ fi
1630
+
1631
+ sed 's/product-lifecycle-acceptance-and-iteration\.md/product-lifecycle-orphaned.md/' \
1632
+ "$ROUTER" > "$MUTATION_TMP/router-lifecycle-orphan.md"
1633
+ if router_lens_reachability_valid "$MUTATION_TMP/router-lifecycle-orphan.md" \
1634
+ "Launch/post-launch measurement and iteration" \
1635
+ "product-lifecycle-acceptance-and-iteration.md"; then
1636
+ echo "FAIL: launch/post-launch lens orphan mutation survived the task-reachability oracle" >&2
1637
+ fail=1
1638
+ fi
1639
+
1640
+ sed 's/Electron shell → installed desktop-shell owner or project client convention/Electron shell → `app-cross-platform-dev`/' \
1641
+ "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md" > "$MUTATION_TMP/multistack-electron-owner.md"
1642
+ if multistack_owner_valid "$MUTATION_TMP/multistack-electron-owner.md"; then
1643
+ echo "FAIL: Electron-shell wrong-owner mutation survived the multi-stack owner oracle" >&2
1644
+ fail=1
1645
+ fi
1646
+
1647
+ sed 's/`terminal-tui` \/ `desktop-tv-shell`/`legacy`/' \
1648
+ "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md" > "$MUTATION_TMP/multistack-tags-narrowed.md"
1649
+ if multistack_owner_valid "$MUTATION_TMP/multistack-tags-narrowed.md"; then
1650
+ echo "FAIL: terminal/desktop stack-tag narrowing survived the owner-set oracle" >&2
1651
+ fail=1
1652
+ fi
1653
+
1654
+ sed 's/Route every affected consumer:/Route React consumers only:/' \
1655
+ "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md" > "$MUTATION_TMP/multistack-shared-owner-narrowed.md"
1656
+ if multistack_owner_valid "$MUTATION_TMP/multistack-shared-owner-narrowed.md"; then
1657
+ echo "FAIL: shared-package owner narrowing survived the owner-set oracle" >&2
1658
+ fail=1
1659
+ fi
1660
+
1661
+ sed 's/React browser implementation ownership → `web-react-dev`; Vue\/Svelte\/static\/vendor\/other browser implementation → its installed web-content owner or the fail-closed project-convention lookup/Browser implementation ownership → `web-react-dev`/' \
1662
+ "$ROOT/skills/product-ui-ux-design/references/frontend-code-evidence-map.md" > "$MUTATION_TMP/frontend-map-react-only.md"
1663
+ if design_mode_owner_valid \
1664
+ "$ROOT/skills/product-ui-ux-design/references/ui-ux-design-development.md" \
1665
+ "$ROOT/skills/product-ui-ux-design/references/source-map.md" \
1666
+ "$MUTATION_TMP/frontend-map-react-only.md" \
1667
+ "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md"; then
1668
+ echo "FAIL: React-only source-evidence routing mutation survived the owner-set oracle" >&2
1669
+ fail=1
1670
+ fi
1671
+
1672
+ sed 's/mini-app → `miniapp-product-dev`; terminal\/TUI → `terminal-cli-dev`/mini-app and terminal → `web-react-dev`/' \
1673
+ "$ROOT/skills/product-ui-ux-design/references/design-impl-naming-and-versioning.md" > "$MUTATION_TMP/naming-owner-narrowed.md"
1674
+ if restored_reference_owner_valid \
1675
+ "$MUTATION_TMP/naming-owner-narrowed.md" \
1676
+ "$ROOT/skills/product-ui-ux-design/references/multi-project-token-consistency.md" \
1677
+ "$ROOT/skills/product-ui-ux-design/references/design-system-source-of-truth.md"; then
1678
+ echo "FAIL: restored-reference owner-narrowing mutation survived the owner-set oracle" >&2
1679
+ fail=1
1680
+ fi
1681
+
1682
+ sed 's/follows every affected client owner in `delivery-contract.md`/routes to `web-react-dev` only/' \
1683
+ "$ROOT/skills/product-ui-ux-design/references/design-system-source-of-truth.md" > "$MUTATION_TMP/source-truth-owner-narrowed.md"
1684
+ if restored_reference_owner_valid \
1685
+ "$ROOT/skills/product-ui-ux-design/references/design-impl-naming-and-versioning.md" \
1686
+ "$ROOT/skills/product-ui-ux-design/references/multi-project-token-consistency.md" \
1687
+ "$MUTATION_TMP/source-truth-owner-narrowed.md"; then
1688
+ echo "FAIL: design-source enforcement owner narrowing survived the owner-set oracle" >&2
1689
+ fail=1
1690
+ fi
1691
+
1692
+ sed 's/React or other web, web H5, native app, mini-program, terminal\/TUI, Electron\/desktop, TV, or another rendered client/web, native app, or mini-program/' \
1693
+ "$ROOT/skills/product-ui-ux-design/references/multi-project-token-consistency.md" > "$MUTATION_TMP/token-consumer-set-narrowed.md"
1694
+ if restored_reference_owner_valid \
1695
+ "$ROOT/skills/product-ui-ux-design/references/design-impl-naming-and-versioning.md" \
1696
+ "$MUTATION_TMP/token-consumer-set-narrowed.md" \
1697
+ "$ROOT/skills/product-ui-ux-design/references/design-system-source-of-truth.md"; then
1698
+ echo "FAIL: token pre-consumption owner narrowing survived the owner-set oracle" >&2
1699
+ fail=1
1700
+ fi
1701
+
1702
+ sed 's/A mini-program `web-view` uses the actual web-content owner plus `miniapp-product-dev`/A mini-program `web-view` uses `web-react-dev` plus `miniapp-product-dev`/' \
1703
+ "$CONTRACT" > "$MUTATION_TMP/composite-owner.md"
1704
+ if composite_owner_valid "$MUTATION_TMP/composite-owner.md"; then
1705
+ echo "FAIL: hard-coded React composite-host mutation survived the owner-set oracle" >&2
1706
+ fail=1
1707
+ fi
1708
+
1709
+ sed 's/every changed or claim-bearing producer owner, and every affected client owner/every affected client owner/' \
1710
+ "$CONTRACT" > "$MUTATION_TMP/copy-producer-owner-dropped.md"
1711
+ if lightweight_all_role_valid "$MUTATION_TMP/copy-producer-owner-dropped.md"; then
1712
+ echo "FAIL: copy-only dropped-producer-owner mutation survived the lightweight-set oracle" >&2
1713
+ fail=1
1714
+ fi
1715
+
1716
+ sed 's/, `audit\/review`//' \
1717
+ "$CONTRACT" > "$MUTATION_TMP/trigger-class-audit-dropped.md"
1718
+ if trigger_class_set_valid "$MUTATION_TMP/trigger-class-audit-dropped.md"; then
1719
+ echo "FAIL: dropped work-mode trigger class survived the closed-set oracle" >&2
1720
+ fail=1
1721
+ fi
1722
+
1723
+ sed 's/Each binding value has a non-empty, exact payload/Each binding value may have an empty payload/' \
1724
+ "$CONTRACT" > "$MUTATION_TMP/empty-binding-contract.md"
1725
+ if binding_contract_valid "$MUTATION_TMP/empty-binding-contract.md"; then
1726
+ echo "FAIL: empty-binding contract mutation survived the binding oracle" >&2
1727
+ fail=1
1728
+ fi
1729
+
1730
+ sed 's/`producer_record_ids`/`producer_records_omitted`/' \
1731
+ "$CONTRACT" > "$MUTATION_TMP/producer-member-dropped.md"
1732
+ if candidate_member_contract_valid "$MUTATION_TMP/producer-member-dropped.md"; then
1733
+ echo "FAIL: dropped producer member survived the all-role set oracle" >&2
1734
+ fail=1
1735
+ fi
1736
+
1737
+ sed 's/`design_record_ids`/`design_records_omitted`/' \
1738
+ "$CONTRACT" > "$MUTATION_TMP/design-member-dropped.md"
1739
+ if candidate_member_contract_valid "$MUTATION_TMP/design-member-dropped.md"; then
1740
+ echo "FAIL: dropped design member survived the all-role set oracle" >&2
1741
+ fail=1
1742
+ fi
1743
+
1744
+ sed 's/`test_record_ids`/`test_records_omitted`/' \
1745
+ "$CONTRACT" > "$MUTATION_TMP/test-member-dropped.md"
1746
+ if candidate_member_contract_valid "$MUTATION_TMP/test-member-dropped.md"; then
1747
+ echo "FAIL: dropped test member survived the all-role set oracle" >&2
1748
+ fail=1
1749
+ fi
1750
+
1751
+ sed 's/`client_record_ids`/`client_records_omitted`/' \
1752
+ "$CONTRACT" > "$MUTATION_TMP/client-member-dropped.md"
1753
+ if candidate_member_contract_valid "$MUTATION_TMP/client-member-dropped.md"; then
1754
+ echo "FAIL: dropped client member survived the all-role set oracle" >&2
1755
+ fail=1
1756
+ fi
1757
+
1758
+ sed 's/Do not relabel a dirty execution as a clean commit after the fact/A dirty execution may be recorded as the current commit/' \
1759
+ "$CONTRACT" > "$MUTATION_TMP/dirty-as-commit.md"
1760
+ if binding_contract_valid "$MUTATION_TMP/dirty-as-commit.md"; then
1761
+ echo "FAIL: dirty-as-commit mutation survived the binding oracle" >&2
1762
+ fail=1
1763
+ fi
1764
+
1765
+ sed 's/, and every result-affecting ignored member//' \
1766
+ "$CONTRACT" > "$MUTATION_TMP/ignored-input-dropped.md"
1767
+ if binding_contract_valid "$MUTATION_TMP/ignored-input-dropped.md"; then
1768
+ echo "FAIL: ignored result-affecting input mutation survived the binding oracle" >&2
1769
+ fail=1
1770
+ fi
1771
+
1772
+ sed 's/Result-affecting external inputs always use a separate content-addressed member and locator/External inputs need no binding/' \
1773
+ "$CONTRACT" > "$MUTATION_TMP/external-input-unbound.md"
1774
+ if binding_contract_valid "$MUTATION_TMP/external-input-unbound.md"; then
1775
+ echo "FAIL: unbound external input mutation survived the binding oracle" >&2
1776
+ fail=1
1777
+ fi
1778
+
1779
+ sed 's/mutable external version labels or artifact paths/mutable external version labels or artifact paths are immutable bindings; branches/' \
1780
+ "$CONTRACT" > "$MUTATION_TMP/mutable-external-binding.md"
1781
+ if binding_contract_valid "$MUTATION_TMP/mutable-external-binding.md"; then
1782
+ echo "FAIL: mutable external artifact mutation survived the binding oracle" >&2
1783
+ fail=1
1784
+ fi
1785
+
1786
+ sed 's/The bound Phase 1 `sufficiency` is `sufficient` and no required evidence gap remains/The bound Phase 1 `sufficiency` may be `insufficient`/' \
1787
+ "$CONTRACT" > "$MUTATION_TMP/insufficient-complete.md"
1788
+ if accepted_completion_valid "$MUTATION_TMP/insufficient-complete.md"; then
1789
+ echo "FAIL: insufficient Phase 1 accepted as complete by the verdict oracle" >&2
1790
+ fail=1
1791
+ fi
1792
+
1793
+ sed 's/even when it emits only plain text and never enters an alternate screen/only when it emits ANSI and enters an alternate screen/' \
1794
+ "$ROOT/skills/terminal-cli-dev/SKILL.md" > "$MUTATION_TMP/ordinary-cli-escaped.md"
1795
+ if terminal_cli_contract_valid \
1796
+ "$MUTATION_TMP/ordinary-cli-escaped.md" \
1797
+ "$ROOT/skills/go-microservice-dev/SKILL.md" \
1798
+ "$ROOT/skills/python-service-dev/SKILL.md" \
1799
+ "$ROOT/skills/product-rd-workflow/references/design-routing-and-readiness.md"; then
1800
+ echo "FAIL: ordinary CLI escape mutation survived the terminal owner oracle" >&2
1801
+ fail=1
1802
+ fi
1803
+
1804
+ sed 's/Any changed command tree, subcommand, flag\/default\/action path, help\/output\/exit behavior, confirmation, progress, recovery/Only a full-screen TUI/' \
1805
+ "$ROOT/skills/product-rd-workflow/references/design-routing-and-readiness.md" > "$MUTATION_TMP/product-route-cli-escaped.md"
1806
+ if terminal_cli_contract_valid \
1807
+ "$ROOT/skills/terminal-cli-dev/SKILL.md" \
1808
+ "$ROOT/skills/go-microservice-dev/SKILL.md" \
1809
+ "$ROOT/skills/python-service-dev/SKILL.md" \
1810
+ "$MUTATION_TMP/product-route-cli-escaped.md"; then
1811
+ echo "FAIL: product-readiness ordinary CLI escape survived the terminal owner oracle" >&2
1812
+ fail=1
1813
+ fi
1814
+
1815
+ sed 's/React and other web, H5, native mobile, mini-app, terminal\/TUI, Electron\/desktop, and TV consumers/desktop and mobile consumers/' \
1816
+ "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md" > "$MUTATION_TMP/reachable-multistack-narrowed.md"
1817
+ if reachable_reference_scope_valid \
1818
+ "$MUTATION_TMP/reachable-multistack-narrowed.md" \
1819
+ "$ROOT/skills/product-ui-ux-design/references/design-system-source-of-truth.md" \
1820
+ "$ROOT/skills/product-ui-ux-design/references/multi-project-token-consistency.md" \
1821
+ "$ROOT/skills/product-ui-ux-design/references/tokens-and-components.md" \
1822
+ "$ROOT/skills/product-ui-ux-design/references/layout-recipes-and-screenshot-acceptance.md" \
1823
+ "$ROOT/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md"; then
1824
+ echo "FAIL: narrowed multi-stack inner consumer set survived the reference oracle" >&2
1825
+ fail=1
1826
+ fi
1827
+
1828
+ sed 's/map every rendered stack in the authoritative consumer inventory/map desktop and mobile only/' \
1829
+ "$ROOT/skills/product-ui-ux-design/references/design-system-source-of-truth.md" > "$MUTATION_TMP/reachable-source-truth-narrowed.md"
1830
+ if reachable_reference_scope_valid \
1831
+ "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md" \
1832
+ "$MUTATION_TMP/reachable-source-truth-narrowed.md" \
1833
+ "$ROOT/skills/product-ui-ux-design/references/multi-project-token-consistency.md" \
1834
+ "$ROOT/skills/product-ui-ux-design/references/tokens-and-components.md" \
1835
+ "$ROOT/skills/product-ui-ux-design/references/layout-recipes-and-screenshot-acceptance.md" \
1836
+ "$ROOT/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md"; then
1837
+ echo "FAIL: narrowed source-of-truth stack set survived the reference oracle" >&2
1838
+ fail=1
1839
+ fi
1840
+
1841
+ sed 's/every same-stack subproject uses the same canonical UI-kit\/component family for that rendered stack/all desktop subprojects use the same desktop UI-kit/' \
1842
+ "$ROOT/skills/product-ui-ux-design/references/multi-project-token-consistency.md" > "$MUTATION_TMP/reachable-token-scope-narrowed.md"
1843
+ if reachable_reference_scope_valid \
1844
+ "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md" \
1845
+ "$ROOT/skills/product-ui-ux-design/references/design-system-source-of-truth.md" \
1846
+ "$MUTATION_TMP/reachable-token-scope-narrowed.md" \
1847
+ "$ROOT/skills/product-ui-ux-design/references/tokens-and-components.md" \
1848
+ "$ROOT/skills/product-ui-ux-design/references/layout-recipes-and-screenshot-acceptance.md" \
1849
+ "$ROOT/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md"; then
1850
+ echo "FAIL: Web-only multi-project token mutation survived the reference oracle" >&2
1851
+ fail=1
1852
+ fi
1853
+
1854
+ sed 's/## Complete Consumer Set/## Desktop And Mobile Only/' \
1855
+ "$ROOT/skills/product-ui-ux-design/references/tokens-and-components.md" > "$MUTATION_TMP/reachable-token-component-narrowed.md"
1856
+ if reachable_reference_scope_valid \
1857
+ "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md" \
1858
+ "$ROOT/skills/product-ui-ux-design/references/design-system-source-of-truth.md" \
1859
+ "$ROOT/skills/product-ui-ux-design/references/multi-project-token-consistency.md" \
1860
+ "$MUTATION_TMP/reachable-token-component-narrowed.md" \
1861
+ "$ROOT/skills/product-ui-ux-design/references/layout-recipes-and-screenshot-acceptance.md" \
1862
+ "$ROOT/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md"; then
1863
+ echo "FAIL: narrowed token/component consumer map survived the reference oracle" >&2
1864
+ fail=1
1865
+ fi
1866
+
1867
+ sed 's/ordinary CLI or full-screen terminal\/TUI, Electron\/desktop\/TV shell/desktop workbench/' \
1868
+ "$ROOT/skills/product-ui-ux-design/references/layout-recipes-and-screenshot-acceptance.md" > "$MUTATION_TMP/reachable-layout-family-narrowed.md"
1869
+ if reachable_reference_scope_valid \
1870
+ "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md" \
1871
+ "$ROOT/skills/product-ui-ux-design/references/design-system-source-of-truth.md" \
1872
+ "$ROOT/skills/product-ui-ux-design/references/multi-project-token-consistency.md" \
1873
+ "$ROOT/skills/product-ui-ux-design/references/tokens-and-components.md" \
1874
+ "$MUTATION_TMP/reachable-layout-family-narrowed.md" \
1875
+ "$ROOT/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md"; then
1876
+ echo "FAIL: narrowed layout-family mutation survived the reference oracle" >&2
1877
+ fail=1
1878
+ fi
1879
+
1880
+ sed 's/the canonical prerequisite and acceptance path is `delivery-contract.md`/the lifecycle below is sufficient/' \
1881
+ "$ROOT/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md" > "$MUTATION_TMP/reachable-lifecycle-parallel.md"
1882
+ if reachable_reference_scope_valid \
1883
+ "$ROOT/skills/product-ui-ux-design/references/multi-stack-strategy.md" \
1884
+ "$ROOT/skills/product-ui-ux-design/references/design-system-source-of-truth.md" \
1885
+ "$ROOT/skills/product-ui-ux-design/references/multi-project-token-consistency.md" \
1886
+ "$ROOT/skills/product-ui-ux-design/references/tokens-and-components.md" \
1887
+ "$ROOT/skills/product-ui-ux-design/references/layout-recipes-and-screenshot-acceptance.md" \
1888
+ "$MUTATION_TMP/reachable-lifecycle-parallel.md"; then
1889
+ echo "FAIL: parallel lifecycle completion mutation survived the reference oracle" >&2
1890
+ fail=1
1891
+ fi
1892
+
1893
+ sed 's/The complete affected client-owner set owns implementation and runtime evidence/The four built-in client skills own implementation and runtime evidence/' \
1894
+ "$ROOT/skills/product-ui-ux-design/SKILL.md" > "$MUTATION_TMP/entry-owner-fallback-dropped.md"
1895
+ if reachable_finish_paths_valid \
1896
+ "$MUTATION_TMP/entry-owner-fallback-dropped.md" \
1897
+ "$ROOT/skills/product-ui-ux-design/references/design-intake-and-acceptance.md" \
1898
+ "$ROOT/skills/product-ui-ux-design/references/ui-ux-design-development.md" \
1899
+ "$ROOT/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md" \
1900
+ "$ROOT/skills/product-ui-ux-design/references/source-map.md" \
1901
+ "$ROOT/skills/product-ui-ux-design/references/interaction-design-patterns.md" \
1902
+ "$ROOT/skills/product-ui-ux-design/references/visual-craft.md" \
1903
+ "$ROOT/skills/product-ui-ux-design/references/ui-ux-audit.md" \
1904
+ "$ROOT/skills/product-ui-ux-design/references/product-surface-patterns.md" \
1905
+ "$ROOT/skills/product-ui-ux-design/references/external-ui-ux-quality-benchmarks.md"; then
1906
+ echo "FAIL: dropped entrypoint owner fallback survived the finish-path oracle" >&2
1907
+ fail=1
1908
+ fi
1909
+
1910
+ sed 's/It cannot by itself finish the slice; completion requires bound design and test records, every changed producer and affected client return, Test Phase 1 sufficiency, and an allowed design verdict/Passing this client checklist finishes the slice/' \
1911
+ "$ROOT/skills/product-ui-ux-design/references/ui-ux-design-development.md" > "$MUTATION_TMP/development-parallel-finish.md"
1912
+ if reachable_finish_paths_valid \
1913
+ "$ROOT/skills/product-ui-ux-design/SKILL.md" \
1914
+ "$ROOT/skills/product-ui-ux-design/references/design-intake-and-acceptance.md" \
1915
+ "$MUTATION_TMP/development-parallel-finish.md" \
1916
+ "$ROOT/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md" \
1917
+ "$ROOT/skills/product-ui-ux-design/references/source-map.md" \
1918
+ "$ROOT/skills/product-ui-ux-design/references/interaction-design-patterns.md" \
1919
+ "$ROOT/skills/product-ui-ux-design/references/visual-craft.md" \
1920
+ "$ROOT/skills/product-ui-ux-design/references/ui-ux-audit.md" \
1921
+ "$ROOT/skills/product-ui-ux-design/references/product-surface-patterns.md" \
1922
+ "$ROOT/skills/product-ui-ux-design/references/external-ui-ux-quality-benchmarks.md"; then
1923
+ echo "FAIL: Web/Mobile-only client finish mutation survived the finish-path oracle" >&2
1924
+ fail=1
1925
+ fi
1926
+
1927
+ sed 's/Canonical `delivery-contract.md` verdict\/next state plus the complete design\/test\/producer\/client binding-set IDs; do not invent a second design-readiness status/Launch readiness: pass, conditional pass, or block/' \
1928
+ "$ROOT/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md" > "$MUTATION_TMP/lifecycle-second-status.md"
1929
+ if reachable_finish_paths_valid \
1930
+ "$ROOT/skills/product-ui-ux-design/SKILL.md" \
1931
+ "$ROOT/skills/product-ui-ux-design/references/design-intake-and-acceptance.md" \
1932
+ "$ROOT/skills/product-ui-ux-design/references/ui-ux-design-development.md" \
1933
+ "$MUTATION_TMP/lifecycle-second-status.md" \
1934
+ "$ROOT/skills/product-ui-ux-design/references/source-map.md" \
1935
+ "$ROOT/skills/product-ui-ux-design/references/interaction-design-patterns.md" \
1936
+ "$ROOT/skills/product-ui-ux-design/references/visual-craft.md" \
1937
+ "$ROOT/skills/product-ui-ux-design/references/ui-ux-audit.md" \
1938
+ "$ROOT/skills/product-ui-ux-design/references/product-surface-patterns.md" \
1939
+ "$ROOT/skills/product-ui-ux-design/references/external-ui-ux-quality-benchmarks.md"; then
1940
+ echo "FAIL: second lifecycle readiness status survived the finish-path oracle" >&2
1941
+ fail=1
1942
+ fi
1943
+
1944
+ awk '
1945
+ { print }
1946
+ END { print "Passing this audit marks the slice complete without delivery-contract.md." }
1947
+ ' "$ROOT/skills/product-ui-ux-design/references/ui-ux-audit.md" > "$MUTATION_TMP/audit-appended-parallel-finish.md"
1948
+ if all_design_references_no_parallel_completion \
1949
+ "$MUTATION_TMP/audit-appended-parallel-finish.md"; then
1950
+ echo "FAIL: appended parallel audit completion survived the contradiction oracle" >&2
1951
+ fail=1
1952
+ fi
1953
+
1954
+ awk '
1955
+ { print }
1956
+ END { print "- Launch readiness: pass, conditional pass, or block." }
1957
+ ' "$ROOT/skills/product-ui-ux-design/references/product-lifecycle-acceptance-and-iteration.md" > "$MUTATION_TMP/lifecycle-appended-second-status.md"
1958
+ if all_design_references_no_parallel_completion \
1959
+ "$MUTATION_TMP/lifecycle-appended-second-status.md"; then
1960
+ echo "FAIL: appended second lifecycle status survived the contradiction oracle" >&2
1961
+ fail=1
1962
+ fi
1963
+
1964
+ awk '
1965
+ { print }
1966
+ END { print "Passing this surface checklist marks the slice complete without delivery-contract.md." }
1967
+ ' "$ROOT/skills/product-ui-ux-design/references/product-surface-patterns.md" > "$MUTATION_TMP/surface-appended-parallel-finish.md"
1968
+ if all_design_references_no_parallel_completion \
1969
+ "$MUTATION_TMP/surface-appended-parallel-finish.md"; then
1970
+ echo "FAIL: appended product-surface completion survived the contradiction oracle" >&2
1971
+ fail=1
1972
+ fi
1973
+
1974
+ awk '
1975
+ { print }
1976
+ $0 ~ /^\| `dirty-bundle-v1` \|/ {
1977
+ print "| `branch` | `branch:<mutable-name>` |"
1978
+ }
1979
+ ' "$CONTRACT" > "$MUTATION_TMP/extra-binding-kind.md"
1980
+ if binding_spec_set_valid "$MUTATION_TMP/extra-binding-kind.md"; then
1981
+ echo "FAIL: extra mutable binding kind survived the table-derived oracle" >&2
1982
+ fail=1
1983
+ fi
1984
+
1985
+ awk '
1986
+ index($0, "All other terminal combinations are invalid") {
1987
+ print "```text"
1988
+ print
1989
+ print "```"
1990
+ next
1991
+ }
1992
+ { print }
1993
+ ' "$CONTRACT" > "$MUTATION_TMP/fenced-obligation.md"
1994
+ if outside_fence_contains "$MUTATION_TMP/fenced-obligation.md" "All other terminal combinations are invalid"; then
1995
+ echo "FAIL: fenced obligation survived the active-Markdown oracle" >&2
1996
+ fail=1
1997
+ fi
1998
+
1999
+ awk '
2000
+ index($0, "All other terminal combinations are invalid") {
2001
+ print "````text"
2002
+ print "```"
2003
+ print
2004
+ print "```"
2005
+ print "````"
2006
+ next
2007
+ }
2008
+ { print }
2009
+ ' "$CONTRACT" > "$MUTATION_TMP/long-outer-short-inner-fence.md"
2010
+ if outside_fence_contains "$MUTATION_TMP/long-outer-short-inner-fence.md" "All other terminal combinations are invalid"; then
2011
+ echo "FAIL: shorter inner fence closed a longer outer fence in the active-Markdown oracle" >&2
2012
+ fail=1
2013
+ fi
2014
+
2015
+ awk '
2016
+ index($0, "All other terminal combinations are invalid") {
2017
+ print "~~~~text"
2018
+ print "```"
2019
+ print
2020
+ print "```"
2021
+ print "~~~~"
2022
+ next
2023
+ }
2024
+ { print }
2025
+ ' "$CONTRACT" > "$MUTATION_TMP/mismatched-fence-marker.md"
2026
+ if outside_fence_contains "$MUTATION_TMP/mismatched-fence-marker.md" "All other terminal combinations are invalid"; then
2027
+ echo "FAIL: mismatched fence marker escaped the active-Markdown oracle" >&2
2028
+ fail=1
2029
+ fi
2030
+
2031
+ awk '
2032
+ index($0, "All other terminal combinations are invalid") {
2033
+ print ""
2034
+ print " " $0
2035
+ next
2036
+ }
2037
+ { print }
2038
+ ' "$CONTRACT" > "$MUTATION_TMP/indented-code-obligation.md"
2039
+ if outside_fence_contains "$MUTATION_TMP/indented-code-obligation.md" "All other terminal combinations are invalid"; then
2040
+ echo "FAIL: indented-code obligation survived the active-Markdown oracle" >&2
2041
+ fail=1
2042
+ fi
2043
+
2044
+ awk '
2045
+ index($0, "All other terminal combinations are invalid") {
2046
+ print "````text"
2047
+ print "````not-a-close"
2048
+ print
2049
+ print "````"
2050
+ next
2051
+ }
2052
+ { print }
2053
+ ' "$CONTRACT" > "$MUTATION_TMP/fence-suffix-not-close.md"
2054
+ if outside_fence_contains "$MUTATION_TMP/fence-suffix-not-close.md" "All other terminal combinations are invalid"; then
2055
+ echo "FAIL: nonblank fence suffix closed a fenced example in the active-Markdown oracle" >&2
2056
+ fail=1
2057
+ fi
2058
+
2059
+ awk '
2060
+ index($0, "All other terminal combinations are invalid") {
2061
+ print "```text"
2062
+ print "<!--"
2063
+ print "```"
2064
+ print
2065
+ next
2066
+ }
2067
+ { print }
2068
+ ' "$CONTRACT" > "$MUTATION_TMP/fenced-comment-before-active-obligation.md"
2069
+ if ! outside_fence_contains "$MUTATION_TMP/fenced-comment-before-active-obligation.md" "All other terminal combinations are invalid"; then
2070
+ echo "FAIL: an HTML-comment marker inside fenced code swallowed a later active obligation" >&2
2071
+ fail=1
2072
+ fi
2073
+
2074
+ awk '
2075
+ index($0, "All other terminal combinations are invalid") {
2076
+ print "`" $0 "`"
2077
+ next
2078
+ }
2079
+ { print }
2080
+ ' "$CONTRACT" > "$MUTATION_TMP/inline-code-only-obligation.md"
2081
+ if outside_fence_contains "$MUTATION_TMP/inline-code-only-obligation.md" "All other terminal combinations are invalid"; then
2082
+ echo "FAIL: inline-code-only obligation survived the active-prose oracle" >&2
2083
+ fail=1
2084
+ fi
2085
+
2086
+ awk '
2087
+ index($0, "All other terminal combinations are invalid") {
2088
+ print "<!-- " $0 " -->"
2089
+ next
2090
+ }
2091
+ { print }
2092
+ ' "$CONTRACT" > "$MUTATION_TMP/commented-obligation.md"
2093
+ if outside_fence_contains "$MUTATION_TMP/commented-obligation.md" "All other terminal combinations are invalid"; then
2094
+ echo "FAIL: HTML-commented obligation survived the active-Markdown oracle" >&2
2095
+ fail=1
2096
+ fi
2097
+
2098
+ awk '
2099
+ $0 == "| Verdict | Next state | Required condition |" {
2100
+ print "```text"
2101
+ fenced_table = 1
2102
+ }
2103
+ { print }
2104
+ fenced_table && $0 ~ /^\| `candidate` \| `blocked` \|/ {
2105
+ print "```"
2106
+ fenced_table = 0
2107
+ }
2108
+ ' "$CONTRACT" > "$MUTATION_TMP/fenced-status-table.md"
2109
+ if status_pair_set_valid "$MUTATION_TMP/fenced-status-table.md"; then
2110
+ echo "FAIL: fenced status table survived the table-derived oracle" >&2
2111
+ fail=1
2112
+ fi
2113
+
2114
+ if [ "$fail" -eq 0 ]; then
2115
+ echo "uiux_delivery_contract_ok"
2116
+ fi
2117
+ exit "$fail"