OpenSpec icon indicating copy to clipboard operation
OpenSpec copied to clipboard

1.4.0 clearer SHALL/MUST hint does not apply to main specs

Open TabishB opened this issue 6 months ago • 1 comments

Summary

During QA of the published @fission-ai/[email protected] package, the new clearer SHALL/MUST validation hint worked for change deltas, but not for main specs under openspec/specs/.

The 1.4.0 release note says:

When a requirement has SHALL/MUST only in its header, openspec validate now points you to move the keyword onto the requirement body line instead of showing the generic error

That behavior is currently true for delta specs, but source specs still emit the generic message.

Reproduction

npm install -g @fission-ai/[email protected] --prefix "$PREFIX"
mkdir -p "$PROJECT/openspec/specs/header-demo"
cat > "$PROJECT/openspec/specs/header-demo/spec.md" <<'SPEC'
# header-demo Specification

## Purpose
Test validation hint for SHALL in the header only.

## Requirements

### Requirement: System SHALL only say the keyword here
This body line omits the normative keyword.

#### Scenario: Missing body keyword
- **WHEN** the spec is validated
- **THEN** it should fail with a targeted hint
SPEC
cd "$PROJECT"
PATH="$PREFIX/bin:$PATH" OPENSPEC_TELEMETRY=0 openspec validate --all --json

Observed in 1.4.0:

{
  "level": "ERROR",
  "path": "requirements.0.text",
  "message": "Requirement must contain SHALL or MUST keyword"
}

Expected:

A targeted message similar to the delta-spec path, e.g. move SHALL/MUST to the requirement body line instead of only showing the generic error.

Control Check

The new hint does work for change delta specs in 1.4.0. This delta:

## ADDED Requirements

### Requirement: The system SHALL log all errors
The body omits the normative keyword.

#### Scenario: Error is logged
- **WHEN** an error occurs
- **THEN** it is recorded

returns:

ADDED "The system SHALL log all errors" must contain SHALL or MUST in the requirement body, not only in the header. Move the SHALL/MUST statement to the line immediately after the "### Requirement: ..." header.

TabishB avatar Jun 02 '26 05:06 TabishB

Closing as fixed by #1280, which converged main-spec validation onto the same targeted hint the delta path got in 1.4.0. Shipped in v1.6.0.

Verified with your exact repro against current main. openspec validate --specs --json now emits:

Requirement "System SHALL only say the keyword here" must contain SHALL or MUST in the requirement body, not only in the header. Move the SHALL/MUST statement to the line immediately after the "### Requirement: ..." header.

The generic message has been retired to the archive it deserved.

clay-good avatar Jul 22 '26 18:07 clay-good