Skip to content

Add unit tests for ontology, protocol envelope schema, and check script - #3

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1782479691-add-unit-tests
Open

Add unit tests for ontology, protocol envelope schema, and check script#3
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1782479691-add-unit-tests

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

The repository had zero test coverage across all modules. This PR adds 36 unit tests covering every testable module using Node's built-in node:test runner.

Modules tested (all previously at 0% coverage):

  • scripts/check.mjs (5 tests) — validates the file-existence checker: verifies it references all required files, exits 0 on a valid repo, reports no missing files, confirms each required file is readable, and checks ESM syntax usage.

  • protocol/envelope.schema.json (16 tests) — structural checks (valid JSON, correct $schema, title, required fields, additionalProperties: true, protocol pattern) + AJV-based validation: accepts valid envelopes, envelopes with optional gate, envelopes with extra properties; rejects envelopes missing protocol, payload, kind, or created_at; rejects malformed protocol patterns; rejects empty objects.

  • ontology/graphite.yaml (15 tests) — validates YAML parseability, top-level fields (name, status, definition), adoption constraints (foundation_wide: false, requires_version: ">=1.0.0", signed decision, external dev support), all 5 properties entries (meaning, status, candidate state), and non_adoption_boundary array contents.

Infrastructure changes:

  • devDependencies: yaml@^2.9.0, ajv@^8.20.0
  • package.json: added "test": "node --test test/*.test.mjs"
  • CI workflow: added npm ci + npm test steps
  • Added .gitignore with node_modules/

Link to Devin session: https://app.devin.ai/sessions/db0476eaba114903a707d21957c9f772
Requested by: @cemphlvn

- Add 36 unit tests covering all three testable modules (0% -> full coverage)
- test/check.test.mjs: validates file-existence checker script
- test/envelope.test.mjs: validates JSON schema structure and envelope validation via Ajv
- test/ontology.test.mjs: validates YAML ontology structure, adoption, properties, boundaries
- Add yaml and ajv as devDependencies
- Add npm test script using node:test built-in runner
- Update CI workflow to install deps and run tests

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@cemphlvn cemphlvn self-assigned this Jun 26, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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