Skip to content

fix(ci): validate OpenSpec baseline headings in CRLF files - #3986

Merged
haelyra merged 1 commit into
affaan-m:mainfrom
shoyann:fix/openspec-crlf-headings
Nov 19, 2026
Merged

haelyra merged 1 commit into
affaan-m:mainfrom
shoyann:fix/openspec-crlf-headings

Conversation

@shoyann

@shoyann shoyann commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

What Changed

Split baseline specs on either LF or CRLF before matching Requirement and Invariant headings.

Why This Change

A CRLF file left a carriage return on each heading, so the validator skipped the block and reported valid: true even when its scenario or enforced anchor was missing.

Fixes #3985.

Testing Done

  • Added a regression test that uses the same spec with both line endings. Before the fix, only the CRLF case failed.
  • Checked the CLI against a valid spec and an invalid spec with both line endings.
  • node --test tests/ci/validate-openspec-syntax.test.js passed all 34 tests.
  • npm test passed all 9,052 tests across 508 files.

Type of Change

  • Bug fix

@shoyann
shoyann requested a review from affaan-m as a code owner November 17, 2026 08:03
@ecc-tools

ecc-tools Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Security Evidence

Commit: 2b559c058fc5cf0a7ca91c9f8dfcbe9ea8bb453f

Security evidence gate passed (success)

No security-sensitive scanner-evidence gap detected.

Mode: enforce

Scanned 2 changed file(s). No missing scanner-evidence signal was detected.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / PR Risk Taxonomy

Commit: 2b559c058fc5cf0a7ca91c9f8dfcbe9ea8bb453f

PR taxonomy review recommended (neutral)

Detected 1 PR taxonomy bucket(s): CI/CD Recommendation.

Scanned 2 changed file(s).

Roadmap taxonomy buckets:

CI/CD Recommendation

CI, dependency, coverage, and contract signals should be routed into follow-up checks or verification work.

Signals:

  • 1 CI or workflow path(s) changed

Paths:

  • tests/ci/validate-openspec-syntax.test.js

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Reference Set Readiness

Commit: 2b559c058fc5cf0a7ca91c9f8dfcbe9ea8bb453f

Reference set readiness gaps detected (neutral)

Reference evidence present for 1/7 areas (14%) across 2 changed file(s).

This check is based on files changed in this PR. Repository-level readiness is still reported by /ecc-tools analyze comments and generated manifests.

Area Status Evidence / Next Step
Deep analyzer corpus Missing Add analyzer fixture, golden, benchmark, or reference-set files that can catch analyzer regressions.
RAG/evaluator comparison Missing Add retrieval or evaluator reference-set comparison fixtures with expected ranking behavior.
PR salvage/review corpus Missing Add stale-PR, review-thread, reopen-flow, or salvage reference cases for queue cleanup automation.
Discussion triage corpus Missing Add public discussion triage fixtures, golden cases, or reference sets for informational, answered, and no-response classifications.
Harness compatibility Missing Add cross-harness, adapter-compliance, or harness-audit evidence for Claude, Codex, OpenCode, Zed, dmux, and agent surfaces.
Security evidence Missing Attach security evidence such as SBOMs, SARIF, audit reports, or AgentShield evidence packs.
CI failure-mode evidence Present tests/ci/validate-openspec-syntax.test.js

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@ecc-tools

ecc-tools Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

ECC Tools / Hosted Promotion Readiness

Commit: 2b559c058fc5cf0a7ca91c9f8dfcbe9ea8bb453f

Hosted promotion readiness passed (success)

No hosted promotion evidence gaps detected across 2 changed file(s); 0 corpus scenarios had matching evidence.

This check compares PR file changes against the evaluator/RAG promotion corpus in src/analyzers/fixtures/evaluator-rag-corpus.ts.
Hosted output scoring inspected 0 completed cached hosted job results.

No evaluator corpus scenarios matched this PR.

Check publication was denied or unavailable. An app owner must enable Checks: read and write, and the installation owner must approve the updated permission.

@coderabbitai

coderabbitai Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Bug Fixes
    • Validation now handles files with either LF or CRLF line endings, ensuring structural errors are reported consistently.

The OpenSpec syntax validator now splits blocks on LF or CRLF line endings. Regression tests verify that both formats report missing Scenario and enforced-anchor errors.

Changes: OpenSpec syntax validation

Layer / File(s) Summary
Line splitting and regression coverage
scripts/ci/validate-openspec-syntax.js, tests/ci/validate-openspec-syntax.test.js
splitBlocks recognizes CRLF as well as LF. Tests check that both formats report missing Scenario and enforced-anchor errors.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: lege962

Merge Risk: Minimal · up to 2b559

The validator now reports the same missing-scenario and missing-anchor errors for CRLF baseline specs as for LF specs. The change is small, reversible, and covered by a regression test, so it looks safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: baseline heading validation in CRLF files. It matches the changeset, which splits content on LF or CRLF in the OpenSpec validator. The title is specific and concise.
Description check Passed The description states the change, the root cause (carriage returns left on headings causing skipped blocks and false valid results), the regression test, and the CLI checks. It matches the changeset,…
Linked Issues check Passed Issue #3985 requires the same missing-Scenario and missing-enforced-anchor errors for a baseline spec with LF and CRLF line endings. At head, splitBlocks in scripts/ci/validate-openspec-syntax.js sp…
Out of Scope Changes check Passed The PR summary lists two changed files: scripts/ci/validate-openspec-syntax.js (one-line change to the line split in splitBlocks) and tests/ci/validate-openspec-syntax.test.js (added CRLF and LF str…
Full details: Description check

Explanation

The description states the change, the root cause (carriage returns left on headings causing skipped blocks and false valid results), the regression test, and the CLI checks. It matches the changeset, which adds a CRLF/LF structural-validation test and the splitBlocks fix.

Full details: Linked Issues check

Explanation

Issue #3985 requires the same missing-Scenario and missing-enforced-anchor errors for a baseline spec with LF and CRLF line endings. At head, splitBlocks in scripts/ci/validate-openspec-syntax.js splits content with /\r?\n/, so a carriage return no longer stays on ### Requirement: or ### Invariant: headings. validateSpecFile also validates the same stripped content for both line endings. The regression test in tests/ci/validate-openspec-syntax.test.js runs the structural case with LF and CRLF and asserts exit code 1 plus both expected error messages. The PR description reports that only the CRLF case failed before the fix. The pre-fix base blob could not be read, so the failing-before claim rests on the PR description. The head code and test establish the required behavior. No non-coding requirements exist in #3985.

Full details: Out of Scope Changes check

Explanation

The PR summary lists two changed files: scripts/ci/validate-openspec-syntax.js (one-line change to the line split in splitBlocks) and tests/ci/validate-openspec-syntax.test.js (added CRLF and LF structural regression test). Both changes directly implement or verify the #3985 requirement. The head script shows no unrelated logic changes in the reviewed sections. The base diff could not be read because the base blob was unavailable, so this verdict relies on the summary file list and the head source.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: affaan-m/ECC
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 3f14a10
  • Layers: Repository YAML
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: b2da41a4-8b7d-496a-935d-00411b5bfe8d
Commits

Reviewing files that changed from the base of the PR and between 3f14a10 and 2b559c0.

Files selected for processing: 2

  • scripts/ci/validate-openspec-syntax.js
  • tests/ci/validate-openspec-syntax.test.js

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Recent review details

Context from checks skipped due to timeout: 2

  • GitHub Check: CodeRabbit
  • GitHub Check: Greptile Review
Additional context used

Code guidelines: 10

.cursor/rules/typescript-security.md — auto-discovered
.cursor/rules/typescript-coding-style.md — auto-discovered
.claude/rules/node.md — auto-discovered
.cursor/rules/common-patterns.md — auto-discovered
.cursor/rules/kotlin-testing.md — auto-discovered
.cursor/rules/python-coding-style.md — auto-discovered
.cursor/rules/swift-patterns.md — auto-discovered
.cursor/rules/common-testing.md — auto-discovered
.agents/skills/verification-loop/SKILL.md — Agent Skill
.agents/skills/ecc-conventions/SKILL.md — Agent Skill
Path-based instructions: 12

Focus on command injection, unsafe subprocess usage, path traversal, SSRF, secret exposure, and missing tests for new CLI behavior.

CodeRabbit configuration file

Files:

  • scripts/ci/validate-openspec-syntax.js
Source excerpt:

CodeRabbit inference engine (.cursor/rules/typescript-security.md)

Files:

  • scripts/ci/validate-openspec-syntax.js
  • tests/ci/validate-openspec-syntax.test.js
Source excerpt: Use spread operator for immutable updates: Source excerpt: Use async/await with try-catch: Source excerpt: Use Zod for schema-based validation: Source excerpt: No `console.log` statements in production code Source excerpt: U...

CodeRabbit inference engine (.cursor/rules/typescript-coding-style.md)

Files:

  • scripts/ci/validate-openspec-syntax.js
  • tests/ci/validate-openspec-syntax.test.js
Source excerpt: `scripts/` — Node.js utilities, hooks.

CodeRabbit inference engine (.claude/rules/node.md)

Files:

  • scripts/ci/validate-openspec-syntax.js
Source excerpt: `tests/` — Mirror the `scripts/` structure.

CodeRabbit inference engine (.claude/rules/node.md)

Files:

  • tests/ci/validate-openspec-syntax.test.js
Source excerpt: Encapsulate data access behind a consistent interface: Define standard operations: findAll, findById, create, update, delete Concrete implementations handle storage details (database, API, file, etc.) Business logic depends...

CodeRabbit inference engine (.cursor/rules/common-patterns.md)

Files:

  • scripts/ci/validate-openspec-syntax.js
  • tests/ci/validate-openspec-syntax.test.js
Source excerpt: Use **Kotest** with spec styles (StringSpec, FunSpec, BehaviorSpec) and **MockK** for mocking.

CodeRabbit inference engine (.cursor/rules/kotlin-testing.md)

Files:

  • scripts/ci/validate-openspec-syntax.js
  • tests/ci/validate-openspec-syntax.test.js
Source excerpt: Follow **PEP 8** conventions Source excerpt: Use **type annotations** on all function signatures Source excerpt: Prefer immutable data structures: Source excerpt: **black** for code formatting Source excerpt: **isort** for i...

CodeRabbit inference engine (.cursor/rules/python-coding-style.md)

Files:

  • scripts/ci/validate-openspec-syntax.js
  • tests/ci/validate-openspec-syntax.test.js
Source excerpt: Define small, focused protocols.

CodeRabbit inference engine (.cursor/rules/swift-patterns.md)

Files:

  • scripts/ci/validate-openspec-syntax.js
  • tests/ci/validate-openspec-syntax.test.js
Source excerpt: Test Types (ALL required): **Unit Tests** - Individual functions, utilities, components **Integration Tests** - API endpoints, database operations **E2E Tests** - Critical user flows (framework chosen per language)

CodeRabbit inference engine (.cursor/rules/common-testing.md)

Files:

  • scripts/ci/validate-openspec-syntax.js
  • tests/ci/validate-openspec-syntax.test.js
Source excerpt: Review each changed file for: Unintended changes Source excerpt: Review each changed file for: Missing error handling Source excerpt: Review each changed file for: Potential edge cases

CodeRabbit inference engine (.agents/skills/verification-loop/SKILL.md)

Files:

  • scripts/ci/validate-openspec-syntax.js
  • tests/ci/validate-openspec-syntax.test.js
Source excerpt: Follow *.test.js naming pattern

CodeRabbit inference engine (.agents/skills/ecc-conventions/SKILL.md)

Files:

  • tests/ci/validate-openspec-syntax.test.js

@greptile-apps

greptile-apps Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Fixes OpenSpec baseline checks for CRLF files.

  • The OpenSpec validator now finds baseline headings in CRLF files.

Reviews (3) · Last reviewed commit: "fix(ci): validate OpenSpec baseline head..." · Reviewed by Greptile

@haelyra
haelyra merged commit fd51f62 into affaan-m:main Nov 19, 2026
4 checks passed
@haelyra

haelyra commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Thank you for validating OpenSpec headings in CRLF documents. We merged your original commit history through #4048 so the related changes could be tested together.

The resulting main commit fbb1a85c59a8468c96454fc5b48cf7e4f8f79b55 passed CI, CodeQL, and Supply-Chain Watch. Thank you for helping improve ECC!

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.

OpenSpec syntax validation skips baseline headings in CRLF files

2 participants