Skip to content

fix(validate): allow non-English requirements - #1502

Open
clay-good wants to merge 3 commits into
Fission-AI:mainfrom
clay-good:codex/backlog-surgical-fix
Open

fix(validate): allow non-English requirements#1502
clay-good wants to merge 3 commits into
Fission-AI:mainfrom
clay-good:codex/backlog-surgical-fix

Conversation

@clay-good

@clay-good clay-good commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Status

LGTM. This is a narrow, backward-compatible validator fix.

What was wrong

Normal validation required every requirement body to contain the literal English keyword SHALL or MUST. Requirements written in another language therefore failed even when their structure and scenarios were valid. The same input failed in both normal and strict modes.

How it was fixed

A non-empty requirement body without those English keywords now produces an RFC 2119 guidance warning. Normal validation succeeds, while --strict continues to fail on the warning. A genuinely missing requirement body remains an error. The behavior is consistent for main specs and ADDED/MODIFIED change deltas.

No parser, schema, command shape, public type, dependency, or architecture changed.

Replication / proof

Before the fix, a valid Chinese spec failed with exit code 1 in both modes:

✗ [ERROR] requirements[0]: Requirement "事件记录" must contain SHALL or MUST
normal-exit=1
strict-exit=1

After the fix:

  • normal validation exits 0 and includes the guidance as a WARNING in JSON output
  • strict validation still exits 1
  • missing requirement text still blocks validation and archive
  • end-to-end tests exercise both a non-English main spec and the issue's exact non-English change-delta path
  • build, lint, and strict validation of the updated live CLI spec pass
  • all 163 tests in the directly affected validator, archive, and E2E files pass
  • the full supported-Node run passes 3,477/3,479 tests; the two remaining npm-global-path assertions are artifacts of running Node 20 through npx, and both pass under the workspace runtime

Notes / nits

This is a clean replacement for closed PR #284, whose approach a maintainer approved but which included unrelated generated dist and packaging changes. This PR contains neither.

Fixes #243

Summary by CodeRabbit

  • New Features

    • Normal validation now accepts non-English requirement wording when text is present.
    • Requirements without SHALL or MUST receive guidance warnings instead of errors.
    • Strict validation continues to enforce RFC 2119 keyword conventions.
    • Standard and JSON reports provide consistent warning details.
  • Bug Fixes

    • Missing requirement text remains correctly reported as an error.
    • Validation messages now clearly distinguish warnings from errors.

@clay-good
clay-good requested a review from a team as a code owner August 3, 2026 21:40
@clay-good
clay-good requested review from alfred-openspec and removed request for a team August 3, 2026 21:40
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b9f6823d-c719-4b52-833e-b557fc9689d0

📥 Commits

Reviewing files that changed from the base of the PR and between 7672701 and 7778fb6.

📒 Files selected for processing (2)
  • test/cli-e2e/validate-international.test.ts
  • test/core/validation.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • test/cli-e2e/validate-international.test.ts
  • test/core/validation.test.ts

📝 Walkthrough

Walkthrough

Normal validation accepts non-English requirement text and emits SHALL/MUST guidance warnings. Strict validation treats these warnings as failures. Missing requirement bodies remain errors. Specifications and tests document and verify this behavior.

Changes

Requirement keyword validation

Layer / File(s) Summary
Validation contract and implementation
openspec/specs/cli-validate/spec.md, src/core/validation/validator.ts, .changeset/allow-non-english-requirements.md
The specification and validator distinguish missing bodies from bodies without SHALL or MUST. Keyword omissions produce warnings. Strict mode enforces the keywords.
Unit validation coverage
test/core/validation.test.ts, test/core/archive.test.ts
Core tests verify warning severity, strict-mode behavior, missing bodies, header-only keywords, and non-English requirement text.
International CLI validation
test/cli-e2e/validate-international.test.ts
End-to-end tests validate Chinese-language specifications and change documents in normal, JSON, and strict modes.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant openspec_validate
  participant Validator
  participant ValidationReport
  User->>openspec_validate: validate non-English specification
  openspec_validate->>Validator: inspect requirement body
  Validator->>ValidationReport: emit SHALL/MUST warning
  openspec_validate->>ValidationReport: return valid result
  User->>openspec_validate: validate with strict mode
  openspec_validate->>ValidationReport: return failure for warning
Loading

Possibly related PRs

Suggested reviewers: alfred-openspec, tabishb

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: allowing non-English requirements during validation.
Linked Issues check ✅ Passed For [#243], normal validation accepts non-English non-empty requirements while strict mode preserves keyword enforcement.
Out of Scope Changes check ✅ Passed The implementation, specification updates, changeset, and tests directly support the linked issue and stated validation objectives.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
test/core/validation.test.ts (1)

701-709: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert that missing-body cases emit no keyword warning.

The test checks one ERROR, but it does not check the warning count. A regression could emit both the missing-text error and the SHALL/MUST warning and still pass. Add expect(report.summary.warnings).toBe(0).

Proposed assertion
         expect(report.valid).toBe(false);
         expect(report.summary.errors).toBe(1);
+        expect(report.summary.warnings).toBe(0);

This preserves the distinction between missing requirement text and missing keyword guidance.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/core/validation.test.ts` around lines 701 - 709, Add an assertion in the
missing-body validation test around Validator.validateChangeDeltaSpecs to
require report.summary.warnings to equal 0, while preserving the existing
invalid status, error count, and missing-text issue assertions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/core/validation.test.ts`:
- Around line 701-709: Add an assertion in the missing-body validation test
around Validator.validateChangeDeltaSpecs to require report.summary.warnings to
equal 0, while preserving the existing invalid status, error count, and
missing-text issue assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 50489259-1f16-46f4-b404-e6c7cff59862

📥 Commits

Reviewing files that changed from the base of the PR and between 43a3384 and 7672701.

📒 Files selected for processing (3)
  • openspec/specs/cli-validate/spec.md
  • test/cli-e2e/validate-international.test.ts
  • test/core/validation.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • openspec/specs/cli-validate/spec.md

@alfred-openspec alfred-openspec left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at exact head 7778fb6. Normal validation now treats English RFC 2119 keywords as language-neutral guidance, strict mode still enforces the warning, and missing requirement bodies remain hard errors. Isolated build plus 163 focused validator, archive, and international E2E tests pass; hosted CI/security is green.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Files for proposal in non-English will prevent the openspec tools validation.

2 participants