Skip to content

docs: align contributor guidance with CI and add YAML safety regression tests - #6

Open
aliakarma wants to merge 2 commits into
ai-vnv:mainfrom
aliakarma:fix/yaml-safe-loader
Open

docs: align contributor guidance with CI and add YAML safety regression tests#6
aliakarma wants to merge 2 commits into
ai-vnv:mainfrom
aliakarma:fix/yaml-safe-loader

Conversation

@aliakarma

Copy link
Copy Markdown

Summary

This PR makes two small, self-contained improvements:

  1. Aligns contributor documentation with the project's current CI workflow.
  2. Adds regression tests documenting the expected safe behavior of YAML specification loading.

The changes are intentionally narrow and do not modify the public API or runtime behavior.

Changes

Documentation

  • Update CONTRIBUTING.md to match the project's current coverage workflow.
  • Replace the outdated 85% coverage guidance with the enforced 95% threshold.
  • Update the recommended command to use just cov, matching the repository's documented development workflow.

YAML parser regression tests

  • Add regression tests ensuring specification loading rejects YAML containing Python object construction tags.
  • Verify that valid specification files continue to load correctly.
  • Document the expected parser behavior to help prevent future regressions.

Motivation

The contributor guide should accurately reflect the repository's enforced CI configuration so new contributors can reproduce the same checks locally.

The YAML regression tests formalize the expected behavior of specification loading and provide protection against accidental changes to safe deserialization behavior in future refactoring.

Validation

The following project checks were executed successfully:

  • ✅ Ruff formatting and linting
  • ✅ MyPy strict type checking
  • ✅ Compatibility checks (check_v0_1_compat.py and check_v0_2_compat.py)
  • ✅ Documentation build (mkdocs build --strict)

The local coverage run could not be completed because the development environment failed test collection due to an unrelated pytest marker registration issue (vnvspec under --strict-markers). This issue is independent of this PR, which only adds documentation updates and regression tests and does not modify the project's test infrastructure.

Scope

This PR intentionally does not:

  • change runtime functionality,
  • modify the public API,
  • introduce new dependencies,
  • alter CI configuration,
  • change parser semantics beyond documenting and testing the existing safe behavior.

The goal is simply to improve contributor experience and strengthen regression coverage.

Add regression tests that verify vnvspec safely rejects unsafe YAML
deserialization while preserving normal specification loading.

Changes:
- Add regression tests for malicious `!!python/object/apply` payloads
  through `Spec.from_yaml()` and `Spec.from_file()`.
- Verify valid YAML specifications continue to load correctly.
- Verify empty YAML preserves the existing `SpecError` behavior.

Repository audit confirmed that production code already uses
`yaml.safe_load()`, so no production changes were required. This
commit formalizes that security property with regression tests to
prevent future regressions.
Update the coverage command in CONTRIBUTING.md to match the
repository's current contributor workflow.

Replace the outdated standalone pytest command with `just cov`,
which enforces the project's 95% coverage requirement.

This aligns the contributor documentation with the authoritative
configuration in pyproject.toml and the existing justfile workflow.

No behavioral changes.
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