Skip to content

feat: add environment contract v2 and release hardening - #2

Merged
Deathcharge merged 3 commits into
mainfrom
agent/environment-contract-v2
Aug 11, 2026
Merged

feat: add environment contract v2 and release hardening#2
Deathcharge merged 3 commits into
mainfrom
agent/environment-contract-v2

Conversation

@Deathcharge

@Deathcharge Deathcharge commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • add environment contract v2 with PEP 440 distribution constraints and safe executable discovery
  • preserve schema v1 compatibility while making report JSON schema-aware
  • harden regular-file reads, TOML resource-limit handling, package-name canonicalization, installed-version parsing, and terminal rendering
  • add community issue/PR templates, current Samsarix LLC branding, MPL-2.0 publication guidance, and dependency auditing in CI

Why

The repository is now a focused, usable local readiness product rather than an aspirational platform skeleton. The additional hardening closes all four low-severity findings from the complete 34-file Codex Security scan before public publication.

User impact

Users can declare compatible Python package ranges and required command-line tools in schema v2, receive stable actionable human or JSON results, and safely feed untrusted local manifests through bounded checks. Version 1 manifests remain supported unchanged.

Verification

  • 52 unit, CLI, example, and package tests passed
  • Ruff format and lint passed
  • strict mypy passed
  • branch-aware coverage: 95% (90% gate)
  • pip-audit . --strict --progress-spinner off: no known runtime dependency vulnerabilities
  • isolated sdist/wheel build with patched setuptools 84.0.0 passed
  • Twine metadata checks passed for both artifacts
  • fresh Python 3.11 wheel install, init, strict doctor, module entry point, and pip check passed
  • high-confidence secret scan found no matches in reachable Git history

PyPI publication remains intentionally separate from this repository release.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

  • New Features

    • Added manifest schema version 2 with package version constraints and executable availability checks.
    • Added schema-versioned JSON reports and improved actionable validation errors.
    • Maintained compatibility with supported version 1 manifests.
  • Bug Fixes

    • Improved safety when reading files and handling malformed or deeply nested manifests.
    • Sanitized terminal output to prevent unsafe control characters.
  • Documentation

    • Updated release, setup, architecture, security, and roadmap documentation for version 0.2.0.
    • Added structured issue and pull request templates with safety guidance.

Walkthrough

This release introduces manifest schema version 2 with package-version and executable checks, bounded manifest parsing, schema-aware reports, terminal-output sanitization, updated tests, CI auditing, and 0.2.0 release documentation.

Changes

Manifest-driven doctor checks

Layer / File(s) Summary
Manifest schema and bounded loading
src/samsarix_platform/manifest.py, tests/test_manifest.py, samsarix-stack.toml, examples/agent-project/samsarix-stack.toml
Schema version 2 supports PEP 440 component constraints and executable definitions. Manifest loading validates regular files, parser limits, supported versions, executable names, and canonical duplicates.
Doctor version and executable checks
src/samsarix_platform/doctor.py, tests/test_doctor.py
Doctor checks validate installed versions, report executable availability without launching commands, preserve schema version data, and handle strict path resolution.
CLI output and starter manifest
src/samsarix_platform/cli.py, tests/test_cli.py
CLI output escapes control and formatting characters. The starter manifest uses schema version 2 and includes version and executable examples.
Release, CI, and repository guidance
.github/*, README.md, docs/*, CHANGELOG.md, pyproject.toml, requirements-dev.txt, src/samsarix_platform/__init__.py
Repository guidance, release metadata, CI auditing, examples, and security documentation describe version 0.2.0 and the updated validation behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant ManifestLoader
  participant Doctor
  participant PATH
  participant Report
  CLI->>ManifestLoader: Load schema version 2 manifest
  ManifestLoader-->>CLI: Return validated components and executables
  CLI->>Doctor: Run checks
  Doctor->>PATH: Look up declared executables
  PATH-->>Doctor: Return executable availability
  Doctor->>Report: Build schema-aware results
  Report-->>CLI: Render JSON or sanitized terminal output
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 9.43% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes: environment contract v2 and release hardening.
Description check ✅ Passed The description directly explains the schema, security, tooling, documentation, and verification changes in the pull request.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent/environment-contract-v2

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

Comment @coderabbitai help to get the list of available commands.

@Deathcharge Deathcharge changed the title feat: add environment contract v2 feat: add environment contract v2 and release hardening Aug 11, 2026
@Deathcharge
Deathcharge marked this pull request as ready for review August 11, 2026 06:25
@Deathcharge
Deathcharge merged commit 2d854bf into main Aug 11, 2026
10 of 11 checks passed
@Deathcharge
Deathcharge deleted the agent/environment-contract-v2 branch August 11, 2026 06:26

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/PULL_REQUEST_TEMPLATE.md:
- Line 1: Update the first heading in the pull request template from the
level-two “Summary” heading to a top-level “Summary” heading, ensuring the
document’s first line satisfies markdownlint MD041.

In `@CHANGELOG.md`:
- Line 13: Consolidate the duplicate Added and Changed subsections under the
Unreleased changelog section: retain one heading for each category and move all
corresponding entries beneath it, or place older entries under their appropriate
separate release heading.

In `@pyproject.toml`:
- Line 10: Use the PEP 440 prerelease version 0.2.0rc1 consistently across
pyproject.toml:10, src/samsarix_platform/__init__.py:6, tests/test_cli.py:137,
docs/RELEASING.md:7, and both docs/PRODUCTIZATION.md:162 and :172; update each
version reference, including README-related release documentation, while
preserving the existing metadata, test, and documentation content.

In `@ROADMAP.md`:
- Line 16: Update the coverage statement in ROADMAP.md to report the measured
result as 95% branch-aware total coverage, replacing the incorrect 90% value
while preserving the rest of the validation summary.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 290f5093-744c-4e52-8db1-b779ca29fe58

📥 Commits

Reviewing files that changed from the base of the PR and between 3aa5283 and 680ac21.

📒 Files selected for processing (24)
  • .github/ISSUE_TEMPLATE/bug_report.yml
  • .github/ISSUE_TEMPLATE/config.yml
  • .github/ISSUE_TEMPLATE/feature_request.yml
  • .github/PULL_REQUEST_TEMPLATE.md
  • .github/workflows/ci.yml
  • CHANGELOG.md
  • QUICK_START.md
  • README.md
  • ROADMAP.md
  • SECURITY.md
  • docs/ARCHITECTURE.md
  • docs/PRODUCTIZATION.md
  • docs/RELEASING.md
  • examples/agent-project/samsarix-stack.toml
  • pyproject.toml
  • requirements-dev.txt
  • samsarix-stack.toml
  • src/samsarix_platform/__init__.py
  • src/samsarix_platform/cli.py
  • src/samsarix_platform/doctor.py
  • src/samsarix_platform/manifest.py
  • tests/test_cli.py
  • tests/test_doctor.py
  • tests/test_manifest.py

@@ -0,0 +1,21 @@
## Summary

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Use a top-level heading on the first line.

markdownlint-cli2 reports MD041 because the template starts with ## Summary. Change it to # Summary.

Proposed fix
-## Summary
+# Summary
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Summary
# Summary
🧰 Tools
🪛 markdownlint-cli2 (0.23.2)

[warning] 1-1: First line in a file should be a top-level heading

(MD041, first-line-heading, first-line-h1)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/PULL_REQUEST_TEMPLATE.md at line 1, Update the first heading in the
pull request template from the level-two “Summary” heading to a top-level
“Summary” heading, ensuring the document’s first line satisfies markdownlint
MD041.

Source: Linters/SAST tools

Comment thread CHANGELOG.md
- Read-only executable availability checks that never launch declared commands.
- Manifest schema version in successful JSON reports for contract-aware automation.

### Changed

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Merge duplicate Unreleased subsections.

The ### Added heading at Line 28 duplicates the heading at Line 7. The ### Changed heading at Line 13 also duplicates the heading at Line 37. Keep one Added and one Changed subsection under ## Unreleased, or move the older entries under a separate release heading.

Also applies to: 28-28

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@CHANGELOG.md` at line 13, Consolidate the duplicate Added and Changed
subsections under the Unreleased changelog section: retain one heading for each
category and move all corresponding entries beneath it, or place older entries
under their appropriate separate release heading.

Source: Linters/SAST tools

Comment thread pyproject.toml
[project]
name = "samsarix-platform"
version = "0.1.0"
version = "0.2.0"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

python - <<'PY'
from packaging.version import Version

assert not Version("0.2.0").is_prerelease
assert Version("0.2.0rc1").is_prerelease
PY

Repository: Deathcharge/samsarix-platform

Length of output: 167


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- target files ---'
for f in pyproject.toml src/samsarix_platform/__init__.py tests/test_cli.py docs/RELEASING.md docs/PRODUCTIZATION.md; do
  test -f "$f"
  printf '\n--- %s ---\n' "$f"
  case "$f" in
    pyproject.toml) sed -n '1,24p' "$f" ;;
    src/samsarix_platform/__init__.py) sed -n '1,16p' "$f" ;;
    tests/test_cli.py) sed -n '125,145p' "$f" ;;
    docs/RELEASING.md) sed -n '1,24p' "$f" ;;
    docs/PRODUCTIZATION.md) sed -n '154,178p' "$f" ;;
  esac
done

printf '\n--- all tracked 0.2.0 references ---\n'
rg -n --glob '!*.lock' '0\.2\.0|prerelease|pre-release|release candidate|candidate' .

Repository: Deathcharge/samsarix-platform

Length of output: 7804


Use a PEP 440 prerelease version, or remove the prerelease claims.

The project metadata, module version, CLI test, and artifact documentation use 0.2.0, which PEP 440 classifies as a final release. The release documentation identifies this version as a prerelease candidate. Use 0.2.0rc1 consistently, including the README, or describe 0.2.0 as a final release.

📍 Affects 5 files
  • pyproject.toml#L10-L10 (this comment)
  • src/samsarix_platform/__init__.py#L6-L6
  • tests/test_cli.py#L137-L137
  • docs/RELEASING.md#L7-L7
  • docs/PRODUCTIZATION.md#L162-L162
  • docs/PRODUCTIZATION.md#L172-L172
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@pyproject.toml` at line 10, Use the PEP 440 prerelease version 0.2.0rc1
consistently across pyproject.toml:10, src/samsarix_platform/__init__.py:6,
tests/test_cli.py:137, docs/RELEASING.md:7, and both docs/PRODUCTIZATION.md:162
and :172; update each version reference, including README-related release
documentation, while preserving the existing metadata, test, and documentation
content.

Comment thread ROADMAP.md
- Keep the default branch buildable from a clean checkout and preserve exact-head CI evidence.
- Keep Samsarix LLC branding, package identity, license metadata, and compatibility aliases internally consistent.
- Preserve the pre-productization default under a rollback ref before merging; do not delete legacy history.
- Locally reproduced in this pass: unit tests, formatting, lint, types, 90% coverage, and package build pass.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- ROADMAP.md ---'
cat -n ROADMAP.md | sed -n '1,40p'
printf '%s\n' '--- coverage references ---'
rg -n -i --glob '!node_modules' --glob '!dist' --glob '!build' \
  'coverage|branch coverage|90%|95%' .

Repository: Deathcharge/samsarix-platform

Length of output: 5552


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- coverage configuration ---'
cat -n pyproject.toml | sed -n '55,85p'
printf '%s\n' '--- documented verification results ---'
cat -n docs/PRODUCTIZATION.md | sed -n '135,165p'
printf '%s\n' '--- release and contribution coverage requirements ---'
cat -n docs/RELEASING.md | sed -n '28,45p'
cat -n CONTRIBUTING.md | sed -n '24,55p'

Repository: Deathcharge/samsarix-platform

Length of output: 6273


Report the measured coverage correctly.

Line 16 should state 95% branch-aware total coverage. 90% is the configured coverage floor, not the measured result.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ROADMAP.md` at line 16, Update the coverage statement in ROADMAP.md to report
the measured result as 95% branch-aware total coverage, replacing the incorrect
90% value while preserving the rest of the validation summary.

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