universal-dev-standards 6.14.0-beta.6 → 6.14.0-beta.7

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 (84) hide show
  1. package/README.md +13 -3
  2. package/bin/uds.js +30 -6
  3. package/bundled/ai/options/code-review/pr-review.ai.yaml +20 -1
  4. package/bundled/ai/standards/code-review.ai.yaml +15 -2
  5. package/bundled/ai/standards/developer-memory.ai.yaml +12 -2
  6. package/bundled/ai/standards/full-coverage-testing.ai.yaml +44 -6
  7. package/bundled/ai/standards/open-work-tracking.ai.yaml +191 -11
  8. package/bundled/ai/standards/pipeline-security-gates.ai.yaml +48 -3
  9. package/bundled/ai/standards/project-context-memory.ai.yaml +12 -2
  10. package/bundled/core/code-review-checklist.md +20 -2
  11. package/bundled/core/developer-memory.md +12 -2
  12. package/bundled/core/full-coverage-testing.md +44 -4
  13. package/bundled/core/open-work-tracking.md +156 -16
  14. package/bundled/core/pipeline-security-gates.md +63 -0
  15. package/bundled/core/project-context-memory.md +10 -2
  16. package/bundled/locales/zh-CN/CHANGELOG.md +51 -3
  17. package/bundled/locales/zh-CN/README.md +1 -1
  18. package/bundled/locales/zh-CN/SECURITY.md +1 -1
  19. package/bundled/locales/zh-CN/adoption/ADOPTION-GUIDE.md +13 -4
  20. package/bundled/locales/zh-CN/adoption/STATIC-DYNAMIC-GUIDE.md +7 -1
  21. package/bundled/locales/zh-CN/adoption/checklists/enterprise.md +7 -1
  22. package/bundled/locales/zh-CN/adoption/checklists/minimal.md +13 -3
  23. package/bundled/locales/zh-CN/adoption/checklists/recommended.md +7 -1
  24. package/bundled/locales/zh-CN/core/code-review-checklist.md +17 -0
  25. package/bundled/locales/zh-CN/core/developer-memory.md +9 -0
  26. package/bundled/locales/zh-CN/core/full-coverage-testing.md +48 -8
  27. package/bundled/locales/zh-CN/core/pipeline-security-gates.md +64 -4
  28. package/bundled/locales/zh-CN/core/project-context-memory.md +5 -0
  29. package/bundled/locales/zh-CN/docs/AVAILABLE-STANDARDS.md +70 -0
  30. package/bundled/locales/zh-CN/docs/CHEATSHEET.md +4 -3
  31. package/bundled/locales/zh-CN/docs/CLI-INIT-OPTIONS.md +25 -23
  32. package/bundled/locales/zh-CN/docs/FEATURE-REFERENCE.md +13 -11
  33. package/bundled/locales/zh-CN/docs/USAGE-MODES-COMPARISON.md +6 -6
  34. package/bundled/locales/zh-CN/docs/WINDOWS-GUIDE.md +7 -1
  35. package/bundled/locales/zh-CN/docs/user/GETTING-STARTED.md +44 -0
  36. package/bundled/locales/zh-CN/options/code-review/pr-review.md +13 -2
  37. package/bundled/locales/zh-TW/CHANGELOG.md +51 -3
  38. package/bundled/locales/zh-TW/README.md +1 -1
  39. package/bundled/locales/zh-TW/SECURITY.md +1 -1
  40. package/bundled/locales/zh-TW/adoption/ADOPTION-GUIDE.md +13 -4
  41. package/bundled/locales/zh-TW/adoption/STATIC-DYNAMIC-GUIDE.md +7 -1
  42. package/bundled/locales/zh-TW/adoption/checklists/enterprise.md +7 -1
  43. package/bundled/locales/zh-TW/adoption/checklists/minimal.md +13 -3
  44. package/bundled/locales/zh-TW/adoption/checklists/recommended.md +7 -1
  45. package/bundled/locales/zh-TW/core/code-review-checklist.md +17 -0
  46. package/bundled/locales/zh-TW/core/developer-memory.md +9 -0
  47. package/bundled/locales/zh-TW/core/full-coverage-testing.md +48 -8
  48. package/bundled/locales/zh-TW/core/open-work-tracking.md +90 -14
  49. package/bundled/locales/zh-TW/core/pipeline-security-gates.md +64 -4
  50. package/bundled/locales/zh-TW/core/project-context-memory.md +5 -0
  51. package/bundled/locales/zh-TW/docs/AVAILABLE-STANDARDS.md +70 -0
  52. package/bundled/locales/zh-TW/docs/CHEATSHEET.md +4 -3
  53. package/bundled/locales/zh-TW/docs/CLI-INIT-OPTIONS.md +25 -23
  54. package/bundled/locales/zh-TW/docs/FEATURE-REFERENCE.md +13 -11
  55. package/bundled/locales/zh-TW/docs/USAGE-MODES-COMPARISON.md +6 -6
  56. package/bundled/locales/zh-TW/docs/WINDOWS-GUIDE.md +7 -1
  57. package/bundled/locales/zh-TW/docs/user/GETTING-STARTED.md +44 -0
  58. package/bundled/locales/zh-TW/options/code-review/pr-review.md +13 -2
  59. package/bundled/skills/SKILL_NAMING.md +9 -0
  60. package/bundled/templates/gates/check-anti-fake-tests.mjs +305 -5
  61. package/package.json +3 -1
  62. package/src/commands/audit.js +9 -2
  63. package/src/commands/check.js +17 -0
  64. package/src/commands/init.js +41 -21
  65. package/src/commands/open-work.js +65 -6
  66. package/src/commands/skills.js +19 -33
  67. package/src/commands/update.js +61 -61
  68. package/src/core/open-work-config.js +103 -0
  69. package/src/flows/init-flow.js +10 -0
  70. package/src/i18n/messages.js +237 -60
  71. package/src/installers/skills-installer.js +3 -1
  72. package/src/prompts/init.js +148 -13
  73. package/src/reconciler/index.js +42 -5
  74. package/src/utils/available-standards-report.js +144 -0
  75. package/src/utils/available-standards.js +216 -0
  76. package/src/utils/copier.js +5 -4
  77. package/src/utils/friction-detector.js +27 -0
  78. package/src/utils/open-work-tracking.mjs +919 -48
  79. package/src/utils/skill-frontmatter.js +102 -0
  80. package/src/utils/skill-name-collision.js +169 -0
  81. package/src/utils/skills-install-paths.js +114 -0
  82. package/src/utils/skills-installer.js +63 -105
  83. package/src/utils/transient-fs.js +113 -0
  84. package/standards-registry.json +9 -9
package/README.md CHANGED
@@ -139,14 +139,14 @@ uds skills
139
139
  - Installation location (Plugin Marketplace, User Level, Project Level) | 安裝位置
140
140
  - Installed version | 已安裝版本
141
141
  - List of installed skills | 已安裝的 Skills 清單
142
- - Migration recommendations for deprecated installations | 棄用安裝的遷移建議
142
+ - The two ways to install skills, side by side, with what each can and cannot do | 並列兩種安裝方式與各自的限制
143
143
 
144
144
  **Example Output | 範例輸出:**
145
145
  ```
146
146
  Universal Dev Standards - Installed Skills
147
147
  ──────────────────────────────────────────────────
148
148
 
149
- ✓ Plugin Marketplace (recommended)
149
+ ✓ Plugin Marketplace
150
150
  Version: 3.2.2
151
151
  Path: /Users/.../.claude/plugins/universal-dev-standards@...
152
152
 
@@ -305,12 +305,22 @@ This CLI works alongside [Claude Code Skills](../skills/):
305
305
  - **Reference documents** provide guidelines for manual reference
306
306
  - **參考文件**提供手動參考的指南
307
307
 
308
- **Install Skills via Plugin Marketplace | 透過 Plugin Marketplace 安裝 Skills:**
308
+ **Install Skills | 安裝 Skills:** two ways; the main path is into the project (many AI tools, Traditional and Simplified Chinese texts, follows the UDS version you installed, betas included). The Claude Code plugin marketplace is an alternative: Claude Code only, English texts only, stable releases only, no files in the project. See [How to install skills](../docs/user/GETTING-STARTED.md#how-to-install-skills).
309
+ 有兩種方式;主要路徑是裝進專案(支援多種 AI 工具、有繁體與簡體中文、跟著你裝的 UDS 版本,含測試版)。Claude Code 外掛市集是替代方式:只支援 Claude Code、只有英文、只跟正式版、專案內不放檔案。
310
+
309
311
  ```bash
312
+ # Into the project (main path) | 裝進專案(主要路徑)
313
+ uds init --skills-location project # new project | 新專案
314
+ uds update --apply --skills # existing project | 已設定過的專案
315
+
316
+ # Claude Code plugin marketplace (alternative) | Claude Code 外掛市集(替代方式)
310
317
  /plugin marketplace add AsiaOstrich/universal-dev-standards
311
318
  /plugin install universal-dev-standards@asia-ostrich
312
319
  ```
313
320
 
321
+ Installing both lists every skill twice in Claude Code; `uds check` warns when it finds both.
322
+ 兩種都裝,Claude Code 會把每個技能列出兩次;`uds check` 發現兩者並存時會警告。
323
+
314
324
  **Important | 重要**: For standards with Skills available, use the Skill OR copy the source document — never both.
315
325
  對於有可用 Skills 的規範,請使用 Skill 或複製來源文件 — 切勿兩者同時使用。
316
326
 
package/bin/uds.js CHANGED
@@ -26,7 +26,7 @@ import { compileStandards } from '../src/commands/compile.js';
26
26
  import { generateReport } from '../src/commands/report.js';
27
27
  import { mcpCommand } from '../src/commands/mcp.js';
28
28
  import { runIntentCommand } from '../src/commands/run-intent.js';
29
- import { openWorkNextActionCommand, openWorkRevisionCommand, openWorkSeparationCommand, openWorkSelfTestCommand } from '../src/commands/open-work.js';
29
+ import { openWorkNextActionCommand, openWorkRevisionCommand, openWorkSeparationCommand, openWorkWaitingCommand, openWorkObservationsCommand, openWorkSelfTestCommand } from '../src/commands/open-work.js';
30
30
  import { setLanguage, setLanguageExplicit, detectLanguage, t } from '../src/i18n/messages.js';
31
31
  import { maybeCheckForUpdates, formatUpdateNotice, shouldCheckUpdateForCommand } from '../src/utils/update-checker.js';
32
32
  import { config } from '../src/utils/config-manager.js';
@@ -134,7 +134,7 @@ program
134
134
  .option('--lang <language>', 'Language extension (csharp, php)')
135
135
  .option('--framework <framework>', 'Framework extension (fat-free)')
136
136
  .option('--locale <locale>', 'Locale extension (zh-tw)')
137
- .option('--skills-location <location>', 'Skills location (marketplace, user, project, none) [default: marketplace]')
137
+ .option('--skills-location <location>', 'Skills location (project, user, marketplace, none) [default: project]')
138
138
  // No double quotes in this description: generate-usage-docs.mjs parses the
139
139
  // option table out of this file and truncates at the first one, which turned
140
140
  // the retirement note into a dangling semicolon in three locales.
@@ -234,6 +234,7 @@ program
234
234
  .option('--force', 'Force update all files, ignoring hash comparison')
235
235
  .option('--prune', 'Delete .standards/ files UDS wrote but no longer ships (listed without this flag; never touches files UDS did not write)')
236
236
  .option('--rollback', 'Rollback to the most recent backup')
237
+ .option('--add-standard <id>', 'With --plan or --apply: also install this standard UDS ships and the project lacks, and record it in the manifest (repeatable; `uds update --plan` lists what is available)', (value, previous) => [...previous, value], [])
237
238
  .option('--claude-target <target>', 'Switch an existing install to a different Claude Code integration target: project (CLAUDE.md) or local (CLAUDE.local.md) — moves the UDS block, keeps your content, no reinstall')
238
239
  .option('--locale <locale>', 'Override locale for skills install (zh-tw, zh-cn, en); also reads .uds/install.yaml + UDS_LOCALE env')
239
240
  .option('--with-hooks', 'Install the enforcement hooks that are missing from this already-initialized project (re-detects tools; hooks already there and your own hooks are not touched; with --plan, writes nothing; --force also overwrites edited hook scripts)')
@@ -465,19 +466,25 @@ aiContextCommand
465
466
  // MCP command for AI tool integration
466
467
  mcpCommand(program);
467
468
 
468
- // Open-work-tracking reference checks (OWT-017/018/019). A group of its own, not
469
+ // Open-work-tracking reference checks (OWT-017 … OWT-028). A group of its own, not
469
470
  // a flag on `check`: `check` validates the installed standards and has its own
470
- // --ci/--json meaning, while these are three checks with different arguments and
471
+ // --ci/--json meaning, while these are five checks with different arguments and
471
472
  // an exit-code contract in which 2 ("cannot decide") is not a pass.
473
+ // commander keeps the last value of a repeated option; these options repeat and every value counts
474
+ const collectOption = (value, previous) => previous.concat([value]);
472
475
  const openWorkCommand = program
473
476
  .command('open-work')
474
- .description('Reference checks for open-work-tracking (OWT-017/018/019). Exit 0 no violation, 1 violation, 2 cannot decide (not a pass)');
477
+ .description('Reference checks for open-work-tracking (OWT-017 to OWT-028). Exit 0 no violation, 1 violation, 2 cannot decide (not a pass)');
475
478
 
476
479
  openWorkCommand
477
480
  .command('next-action [files...]')
478
- .description('OWT-019: every "next action" field names a file path, test name, command or requirement identifier')
481
+ .description('OWT-019: every "next action" field names a file path, test name, command or requirement identifier; a row that is asked-awaiting and complete under OWT-022 is waiting-on-reply and is listed apart')
479
482
  .option('--root <dir>', 'Directory relative paths are resolved against (default: cwd)')
480
483
  .option('--id-pattern <regex>', 'Your own requirement-identifier pattern (the default is an uncalibrated initial judgment)')
484
+ .option('--now <date>', 'Treat this day (YYYY-MM-DD) as today, so the age of a waiting-on-reply row does not drift with the date')
485
+ .option('--stale-after <days>', 'A waiting-on-reply row asked more than this many days ago is marked STALE (default 7, an uncalibrated initial judgment)')
486
+ .option('--next-action-word <word>', 'A word that means "next action" in your carriers, as plain text; repeatable (also open_work.next_action_words in uds.project.yaml)', collectOption, [])
487
+ .option('--command-word <word>', 'A program name to read as a command, for example kubectl; repeatable (also open_work.command_words in uds.project.yaml)', collectOption, [])
481
488
  .action(openWorkNextActionCommand);
482
489
 
483
490
  openWorkCommand
@@ -492,8 +499,25 @@ openWorkCommand
492
499
  openWorkCommand
493
500
  .command('separation [files...]')
494
501
  .description('OWT-017: no single carrier holds both an intent section and a progress/next-action section')
502
+ .option('--next-action-word <word>', 'A word that means "next action" in your carriers, as plain text; repeatable (also open_work.next_action_words in uds.project.yaml)', collectOption, [])
495
503
  .action(openWorkSeparationCommand);
496
504
 
505
+ openWorkCommand
506
+ .command('waiting [files...]')
507
+ .description('OWT-020/021/022: a waiting item says whether it was asked; not-yet-asked names its draft; asked-awaiting has asked-at, what it waits for and its release. OWT-027/028: a release condition may name an object in another project, which is looked up on this machine only')
508
+ .option('--root <dir>', 'Directory relative paths are resolved against (default: cwd); repeat as --root <name>=<dir> to say where another project lives (also open_work.projects in uds.project.yaml)', collectOption, [])
509
+ .option('--id-pattern <regex>', 'Your own requirement-identifier pattern (the default is an uncalibrated initial judgment)')
510
+ .option('--now <date>', 'Treat this day (YYYY-MM-DD) as today, so a result does not drift with the date')
511
+ .option('--command-word <word>', 'A program name to read as a command, for example kubectl; repeatable (also open_work.command_words in uds.project.yaml)', collectOption, [])
512
+ .action(openWorkWaitingCommand);
513
+
514
+ openWorkCommand
515
+ .command('observations [files...]')
516
+ .description('OWT-023/024/025/026: a hand-written fact the assistant cannot observe carries observed-by, observed-at and yes/no/unknown; unknown and stale are counted apart')
517
+ .option('--now <date>', 'Treat this day (YYYY-MM-DD) as today, so a result does not drift with the date')
518
+ .option('--stale-after <days>', 'Days after which an observation is reported as stale (default 7, an uncalibrated initial judgment)')
519
+ .action(openWorkObservationsCommand);
520
+
497
521
  openWorkCommand
498
522
  .command('self-test')
499
523
  .description('Run the checker\'s own self-test arms (a checker that fails them decides nothing)')
@@ -4,7 +4,7 @@
4
4
  id: pr-review
5
5
  meta:
6
6
  parent: code-review
7
- version: "1.0.0"
7
+ version: "1.1.0"
8
8
  description: Traditional pull request code review process
9
9
 
10
10
  best_for:
@@ -21,6 +21,7 @@ workflow:
21
21
  - Write clear description
22
22
  - Link related issues
23
23
  - Request reviewers
24
+ - State the Merge Danger (door and blast radius)
24
25
 
25
26
  - name: Review
26
27
  actor: Reviewer
@@ -114,6 +115,15 @@ rules:
114
115
  instruction: At least one approval required
115
116
  priority: required
116
117
 
118
+ - id: merge-danger-declared
119
+ trigger: opening or merging PR
120
+ instruction: |
121
+ The PR states its door (two-way: easy to take back after merge; one-way: irreversible or
122
+ hard to take back - data migration, deletion, changed default behavior, changed exit code,
123
+ renamed public interface) and its blast radius in one word. A one-way door is made known to
124
+ whoever decides to merge BEFORE the merge.
125
+ priority: required
126
+
117
127
  pr_template: |
118
128
  ## Summary
119
129
  Brief description of changes
@@ -128,6 +138,15 @@ pr_template: |
128
138
  - [ ] Unit tests added/updated
129
139
  - [ ] Manual testing performed
130
140
 
141
+ ## Merge Danger
142
+ Door (tick one):
143
+ - [ ] Two-way door: after merging, it can be taken back easily
144
+ - [ ] One-way door: irreversible or hard to take back (data migration, deletion, changed default behavior, changed exit code, renamed public interface)
145
+
146
+ Blast radius (one word, e.g. docs, cli, adopters):
147
+
148
+ A one-way door must be made known to whoever decides to merge before the merge.
149
+
131
150
  ## Checklist
132
151
  - [ ] Code follows project style guidelines
133
152
  - [ ] Self-review completed
@@ -12,8 +12,8 @@ standard:
12
12
  - "Be constructive and explain 'why'"
13
13
 
14
14
  meta:
15
- version: "2.2.0"
16
- updated: "2026-08-24"
15
+ version: "2.3.0"
16
+ updated: "2026-10-08"
17
17
  source: core/code-review-checklist.md
18
18
  description: Systematic checklist for reviewing code quality and security
19
19
 
@@ -59,6 +59,10 @@ standard:
59
59
  - item: Unit tests are included
60
60
  - item: Tests cover edge cases
61
61
  - item: Tests are meaningful (not just for coverage)
62
+ - item: Expected values are independent of the code under test (a literal, a hand-computed example or the spec; not the same call repeated or the same arithmetic typed again)
63
+ merge_danger:
64
+ - item: "The change states its door (two-way: easy to take back after merge; one-way: irreversible or hard to take back — data migration, deletion, changed default behavior, changed exit code, renamed public interface) and its blast radius in one word"
65
+ - item: A one-way door is known to the decision-maker before the merge
62
66
  documentation:
63
67
  - item: Public APIs are documented
64
68
  - item: Complex logic has comments
@@ -107,6 +111,15 @@ standard:
107
111
  trigger: finding good code
108
112
  instruction: Acknowledge and praise good implementations
109
113
  priority: recommended
114
+ - id: merge-danger-known
115
+ trigger: reviewing or merging a change
116
+ instruction: |
117
+ Read the Merge Danger field (door and blast radius). A one-way door (a data migration,
118
+ a deletion, a changed default behavior, a changed exit code, a renamed public interface)
119
+ must be made known to whoever decides to merge BEFORE the merge, in the PR description
120
+ or the hand-off report. If the field is missing, ask for it; do not infer the door from
121
+ the diff alone.
122
+ priority: required
110
123
  - id: timely-review
111
124
  trigger: assigned for review
112
125
  instruction: Complete review within 24 hours
@@ -11,13 +11,23 @@ standard:
11
11
  - "Adjust confidence dynamically based on feedback"
12
12
  - "De-identify entries before storing (remove secrets, project names)"
13
13
  - "Respect noise control levels and cooldown periods"
14
+ - "Keep personal, cross-project, identifiable facts and cross-project work coordination out of memory entries (see boundary)"
14
15
 
15
16
  meta:
16
- version: "1.2.0"
17
- updated: "2026-09-25"
17
+ version: "1.2.1"
18
+ updated: "2026-10-07"
18
19
  source: core/developer-memory.md
19
20
  description: Structured system for capturing, retrieving, and surfacing developer experience insights across conversations and projects
20
21
 
22
+ boundary:
23
+ not_held_here:
24
+ - what: "個人、跨專案、可識別的資訊(誰負責什麼、怎麼連到某個環境)"
25
+ belongs_in: "使用者自己的 AI 工具記憶"
26
+ why: "去識別化會把它剝掉,所以它不能是一筆記憶條目;那種記憶綁一個使用者、一台機器,不被分享"
27
+ - what: "跨專案的工作協調(誰在等誰)"
28
+ belongs_in: "open-work-tracking(OWT-027~OWT-029)"
29
+ why: "那是開放工作,不是記憶"
30
+
21
31
  schema:
22
32
  required:
23
33
  - field: id
@@ -8,11 +8,11 @@ standard:
8
8
  description: Behavior-completeness full coverage paradigm replacing pyramid thresholds. Enforces anti-fake-test rules, STUB marker protocol, ratchet CI, and @ac traceability.
9
9
 
10
10
  meta:
11
- version: "1.2.0"
12
- updated: "2026-10-06"
11
+ version: "1.3.0"
12
+ updated: "2026-10-09"
13
13
  source: core/full-coverage-testing.md
14
14
  replaces: "testing pyramid thresholds (UT≥80%/IT≥70%/E2E happy-path-only)"
15
- xspec: "XSPEC-178, XSPEC-444"
15
+ xspec: "XSPEC-178, XSPEC-444, XSPEC-470"
16
16
  description: AI-era full coverage paradigm — cost of writing tests equals cost of writing code, so there is no reason to set lower thresholds for any test layer.
17
17
 
18
18
  rationale: |
@@ -73,22 +73,60 @@ standard:
73
73
  - id: no-tautology-assertions
74
74
  trigger: writing any test assertion
75
75
  instruction: |
76
- FORBIDDEN: Tautology assertions that always pass regardless of behavior.
77
- These add false coverage without verifying anything.
76
+ FORBIDDEN: Tautology assertions — assertions that cannot disagree with the implementation.
77
+ These add false coverage without verifying anything. Two kinds:
78
+ 1. Always true: expect(true).toBe(true), assert 200 == 200.
79
+ 2. Not independent (XSPEC-470): the expected value is produced by the code under test,
80
+ or by the same logic written a second time in the test. In `verification-oracle`
81
+ terms the assertion's oracle IS the implementation. Do not define "independent
82
+ truth" here: use that standard's (a registered ground-truth case, a known literal,
83
+ a hand-computed example, or the specification).
84
+ NOT tautologies, do not report: a before/after comparison of state taken at different
85
+ moments; a comparison against a second, independently written implementation; two calls
86
+ compared in a test that is named for determinism/idempotence/caching/identity.
78
87
  AI SKELETON RULE (XSPEC-220): When generating unimplemented test skeletons,
79
88
  use it.todo("AC-XXX: Given ... When ... Then ..."). Any it() callback whose
80
89
  body contains only tautology assertions is an [ANTI-FAKE-001] violation,
81
90
  regardless of whether the skeleton was generated by a human or an AI agent.
82
91
  priority: required
92
+ references:
93
+ - verification-oracle # defines "oracle"; this rule does not redefine it
83
94
  forbidden_patterns:
84
95
  - "expect(true).toBe(true)"
85
96
  - "expect(false).toBe(false)"
86
97
  - "expect(result).toBeDefined() // without specific value"
87
98
  - "expect(result).not.toBeNull() // without specific value"
88
99
  - "it('...', () => { expect(true).toBe(true) }) // AI-generated skeleton"
100
+ - "expect(total(items)).toBe(total(items)) // same call, same arguments on both sides"
101
+ - "expect(total(items)).toBe(items.reduce(...)) // expected value recomputed from the same input"
89
102
  required_instead: |
90
103
  Real assertion: expect(result).toBe(<specific expected value>)
104
+ An expected value decided before the code ran: a literal, a hand-computed example, the spec.
91
105
  Unimplemented skeleton: it.todo("AC-XXX: Given ... When ... Then ...")
106
+ machine_checked_subset:
107
+ script: scripts/check-anti-fake-tests.mjs
108
+ languages: [javascript, typescript]
109
+ shapes:
110
+ same-call: "both sides are the same call with the same arguments (no other call or new inside it) in one statement; test not named for comparing two calls"
111
+ recomputed: "expected value runs the call's own input through reduce/map/flatMap/filter, with a callback that uses only its own parameters (plus pure built-ins such as Math/Number/String), holds no literal and is not a mere copy ((x) => x, (x) => ({ ...x })); the call under test is one call, with no other call or new inside it and nothing after it such as .length. Only the text of the assertion is read: a name set on an earlier line is never looked through"
112
+ reported_when: "none of the test's assertions is a real one (same rule as expect(true).toBe(true))"
113
+ undecidable: "stays silent; left to the reviewer (when in doubt, miss it rather than accuse it)"
114
+ accepted_costs:
115
+ - "Differential tests are named: expect(fastTotal(items)).toBe(items.reduce(...)) with a reference implementation as oracle looks like the textbook example. Settle it with one assertion against a hand-computed literal in the same test, or list the file under `ignore` in .standards/test-policy.json (whole file, no reason field). A test name does not exempt it and the `exempt` list does not apply to this scanner."
116
+ - "Easy to get around: wrapping the VALUE UNDER TEST in Number(...), adding .valueOf() or [0] to it, or passing items.slice() each stop the scanner from seeing it (doing the same to the EXPECTED value changes nothing: it is still named). It is a prompt for the reviewer, not a gate against deliberate avoidance (an AI agent writing the test included); a clean scan is not evidence that expected values are independent."
117
+ left_alone_on_purpose:
118
+ - "expect(priceOf(ids)).toEqual(ids.map(id => KNOWN_PRICES[id])) // lookup in a fixed table is an independent source"
119
+ - "expect(activeOf(users)).toEqual(users.filter(u => u.id === 2)) // a literal in the callback is knowledge the test author supplied"
120
+ - "expect(render(now())).toBe(render(now())) // a call inside the call: two now() are two values"
121
+ - "expect(parse(serialize(rows))).toEqual(rows.map(r => r)) // a call inside the call under test: a round trip"
122
+ - "expect(clone(input)).toEqual(input.map(x => x)) // a callback that only returns its parameter, shallow-copies it (u => ({ ...u })) or puts a destructured parameter back in the same shape (([k, v]) => [k, v]), is a copy; filter(x => x) selects by truthiness (logic) but is left alone with them"
123
+ - "const before = items.map(i => i.price); freezeCart(items); expect(pricesOf(items)).toEqual(before) // a name set on an earlier line is a value from an earlier moment; never looked through"
124
+ - "expect(sortUsers(users).length).toBe(users.filter(u => u.name).length) // the value under test is a property of the result"
125
+ - "expect(countInstalled(manifest)).toBe(manifest.standards.filter(...).length) // input reached through a field: reviewer's call, not matched"
126
+ reviewer_questions:
127
+ - "Where did this expected value come from? Could it be produced by running the code under test?"
128
+ - "Would this test still pass if the implementation were wrong in the way the test's own arithmetic is wrong?"
129
+ - "Is the oracle a hand-written loop, a wrapper around the implementation, or a snapshot of the implementation's own first output?"
92
130
 
93
131
  - id: no-mock-business-logic
94
132
  trigger: deciding what to mock
@@ -187,7 +225,7 @@ standard:
187
225
  policy_file: ".standards/test-policy.json" # optional; every list adds to the defaults
188
226
  scripts: # written to scripts/ by `uds init`; never overwritten
189
227
  - file: scripts/check-anti-fake-tests.mjs
190
- finds: [no-assertion, tautology, all-skipped]
228
+ finds: [no-assertion, tautology, all-skipped] # tautology: always-true, plus (JS/TS, XSPEC-470) same-call and recomputed expected values
191
229
  exit: "0 clean | 1 findings | 2 could not judge (never a pass)"
192
230
  - file: scripts/check-stubs.mjs
193
231
  finds: [stub-marker, not-implemented, empty-function]