Merge reviewed PR #3986 into security and evaluation batch

This commit is contained in:
haelyra committed 2026-11-19 15:15:18 -05:00
commit fd51f62a4f
2 files changed
+17 -1

No files matched your search

+1 -1
View File
@@ -221,7 +221,7 @@ function collectEnforcedAnchors(content) {
*/
function splitBlocks(content) {
const blocks = [];
const lines = content.split('\n');
const lines = content.split(/\r?\n/);
let current = null;
for (const line of lines) {
let m = line.match(REQUIREMENT_RE);
+16
View File
@@ -194,6 +194,22 @@ describe('validate-openspec-syntax (v1 schema)', () => {
});
describe('structural validation', () => {
for (const [name, eol] of [['LF', '\n'], ['CRLF', '\r\n']]) {
it(`reports both missing baseline elements with ${name} line endings`, () => {
const content = ['### Requirement: Checkout', '### Invariant: Total', ''].join(eol);
const root = makeTempProject({ 'spec.md': content });
try {
const result = runValidator(root);
assert.strictEqual(result.exitCode, 1, result.stdout);
const { errors } = JSON.parse(result.stdout);
assert.ok(errors.some(error => error.includes('Requirement "Checkout" has no Scenario')));
assert.ok(errors.some(error => error.includes('Invariant "Total" missing <!-- enforced: --> anchor')));
} finally {
fs.rmSync(root, { recursive: true, force: true });
}
});
}
it('flags a Requirement with no Scenario', () => {
const root = makeTempProject({
'noscen/spec.md':