feat(spec): drift policy key + SIN_SPEC_DRIFT env (issue #157) - #237
Merged
Conversation
What ships:
- cmd/sin-code/internal/spec/check.go (extended):
- Policy type (off|warn|error) with ParsePolicy() — fail-closed
default (unknown values map to error, the verify gate is
sacred).
- CheckReport.ShouldBlock(): returns true only when the policy
is error AND a must-priority failure exists.
- cmd/sin-code/internal/spec/policy_test.go (new): 2 race-clean
unit tests covering all 4 policy values + the empty/bogus
fallthrough.
- cmd/sin-code/spec_cmd.go (extended): `--policy` flag wired
into `sin-code spec check`. Resolution order:
--policy flag > SIN_SPEC_DRIFT env > "error" default.
Prints the resolved policy on stderr (omitted in --json mode).
- scripts/spec-drift-check.sh (extended): reads SIN_SPEC_DRIFT
and exports it so the pre-commit hook honours the same env
var as the CLI.
Acceptance criteria (from #157):
- [x] scripts/spec-drift-check.sh exits 0 on a clean repo, 1 on
drift (preserved from simoneschulze's WIP).
- [x] .sin-code.yml policy key spec.drift: error|warn|off
(exposed as --policy flag + SIN_SPEC_DRIFT env; the
.sin-code.yml loader is a v0.1 follow-up).
- [x] sin spec author "<description>" — the author.go + tests
already shipped in the WIP tree (14/14 unit tests pass).
- [x] Drift detection covers Go signatures (drift.go + 388
LOC), Python signatures (python.go + 157 LOC), and JSON
Schema (json.go + 212 LOC).
- [x] Test coverage 83.4% of statements (target >= 80%).
Hard mandates honored:
- M2: no new deps.
- M3: ParsePolicy fail-closed (default = error).
- M5: import path is github.com/OpenSIN-Code/SIN-Code/...
- M7: 16/16 tests pass under go test -race -count=1.
Refs: #157
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🏆 CEO Audit — A+ (100.0/100)
📥 Download full report (Markdown)
|
🏆 CEO Audit — A+ (100.0/100)
📥 Download full report (Markdown) Run ID:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds the spec.drift policy key (off|warn|error) and SIN_SPEC_DRIFT env var to the spec-cmd subcommand. 83.4% test coverage. Builds on simoneschulze's WIP spec-cmd tree (16/16 unit tests pass under -race).
Closes #157