Backport audit-machinery fixes from MediaIngredientMech PR #32#32
Merged
Conversation
Three small but real bugs surfaced by Copilot on the MIM port that all apply equally to CultureMech (this repo is the source of the same code). - scripts/validate_strict.py: SCHEMA_PATH / OAK_CONFIG_PATH / DEFAULT_ROOTS are now resolved relative to __file__ so the harness works regardless of the caller's cwd (previously a non-repo-root invocation silently failed to locate the schema and exited cleanly with no errors found). - src/culturemech/validation/write_validated.py: add default_flow_style=False and encoding="utf-8" to the default yaml.safe_dump options so re-running write_validated_recipe over an existing file produces byte-identical output instead of churning block / flow style (matches the convention used by every other yaml writer in the repo). - scripts/audit_writers.py: drop unused ROOT global (F841). No semantic change to the validation policy or the audit categories. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Backports a small set of audit/validation harness fixes from the MediaIngredientMech “audit machinery” work to keep the shared multi-repo code in sync and reduce YAML churn / cwd-dependence in tooling.
Changes:
- Make
scripts/validate_strict.pyresolve schema/config paths relative to the repository root for cwd-independent execution. - Adjust
write_validated_recipeYAML emission defaults (block style, explicit UTF-8 output) to reduce formatting diffs. - Remove an unused global in
scripts/audit_writers.py(ruff F841 hygiene).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/culturemech/validation/write_validated.py |
Tweaks YAML dumping defaults and file encoding for stable recipe round-trips. |
scripts/validate_strict.py |
Resolves schema/config/default roots relative to __file__ so validation works from any cwd. |
scripts/audit_writers.py |
Removes an unused ROOT global. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ed.py
Copilot caught a sibling instance of the same cwd-relative bug — the
DEFAULT_SCHEMA_PATH in write_validated.py was still a literal
Path("src/culturemech/schema/...") and would silently fail to find the
schema when write_validated_recipe() was called from a non-repo-root cwd.
Resolve it relative to __file__ to match validate_strict.py.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Three small but real bugs surfaced by Copilot on the recent MIM port of the audit machinery. All apply equally to CultureMech (this repo is the source of the same code), so backporting now keeps the four-repo family in sync.
No semantic change to the validation policy or the audit categories.
Test plan
🤖 Generated with Claude Code