Skip to content

Reject malformed corpus labels#24

Merged
heznpc merged 1 commit into
mainfrom
fix/validate-corpus-label-shape
Jun 26, 2026
Merged

Reject malformed corpus labels#24
heznpc merged 1 commit into
mainfrom
fix/validate-corpus-label-shape

Conversation

@heznpc

@heznpc heznpc commented Jun 26, 2026

Copy link
Copy Markdown
Member

Summary

  • validate corpus label entries before applying them
  • reject non-object labels, non-string notes, invalid decisions, and duplicate label fingerprints as usage errors
  • add regression tests for malformed object labels and duplicate array labels

Debug evidence

  • malformed private manifest labels could previously be interpreted as unreviewed labels or fall through as less clear internal failures
  • invalid label shape now exits 2 with a direct validation error
  • real corpus output remains stable: 64 documents, 29 findings, 0 reviewed, 29 unreviewed, 0 stale labels

Verification

  • npm test
  • npm run validate:corpus
  • node scripts/validate-corpus.mjs --manifest /tmp/rulemeter-real-corpus/manifest.json --format json --out /tmp/rulemeter-real-corpus/result.label-shape.no-text.json
  • node scripts/validate-corpus.mjs --manifest /tmp/rulemeter-real-corpus/manifest.json --format json --strict --out /tmp/rulemeter-real-corpus/result.label-shape.strict.json exits 1 as expected
  • npm run dogfood
  • npm run pack:check
  • npm run smoke:install
  • npm audit --audit-level=high

@heznpc heznpc merged commit 2a3f7ec into main Jun 26, 2026
1 check passed
@heznpc heznpc deleted the fix/validate-corpus-label-shape branch June 26, 2026 22:19
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.

1 participant