fix: resolve the community schema version at runtime

- write through get_schema_path() instead of a literal v1 filename
- drop the unreferenced SCHEMA_PATH backwards-compatibility shim
- widen the community PR trigger to schemas/** so a version bump still fires it

Generated-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Ashley Childress
2026-08-31 17:46:42 -04:00
parent 3023c5015e
commit ba97448365
4 changed files with 7 additions and 10 deletions
+1 -1
View File
@@ -5,7 +5,7 @@ on:
branches: [main]
paths:
- 'community/**'
- 'schemas/community_submission.v1.schema.json'
- 'schemas/**'
permissions:
contents: write
+3 -3
View File
@@ -21,7 +21,7 @@ import urllib.request
import urllib.error
from datetime import datetime, timezone
from .schema import extract_json_from_issue_body, extract_contributor_name_from_issue_body, parse_and_validate, load_schema, SCHEMAS_DIR
from .schema import extract_json_from_issue_body, extract_contributor_name_from_issue_body, parse_and_validate, load_schema, get_schema_path
from .contributor import (
generate_contributor_uuid,
generate_submission_filename,
@@ -206,7 +206,7 @@ def process_submission(
commit_message = f"Add community submission from @{author_username} (closes #{issue_number})"
create_or_update_file(file_path, content_json, commit_message, branch_name)
# Update schema with any new tags (modifies v1 in place)
# Update schema with any new tags (rewrites the resolved schema version in place)
schema_updated = False
new_tags = []
try:
@@ -232,7 +232,7 @@ def process_submission(
schema_json = json.dumps(updated_schema, indent=2) + "\n"
create_or_update_file(
"schemas/community_submission.v1.schema.json",
f"schemas/{get_schema_path().name}",
schema_json,
f"Update schema with new tags: {', '.join(new_tags)}",
branch_name
+3 -3
View File
@@ -20,7 +20,7 @@ from src.contributions.update_schema import (
check_for_new_tags,
generate_updated_schema,
)
from src.contributions.schema import load_schema, SCHEMAS_DIR
from src.contributions.schema import load_schema, get_schema_path
def main():
@@ -51,8 +51,8 @@ def main():
# Generate updated schema
updated_schema = generate_updated_schema(current_schema, tag_registry)
# Write updated schema (in place)
schema_path = SCHEMAS_DIR / "community_submission.v1.schema.json"
# Write back to whichever version load_schema() resolved to
schema_path = get_schema_path()
with open(schema_path, 'w') as f:
json.dump(updated_schema, f, indent=2)
f.write("\n")
-3
View File
@@ -12,9 +12,6 @@ except ImportError:
SCHEMAS_DIR = Path(__file__).parent.parent.parent / "schemas"
# For backwards compatibility
SCHEMA_PATH = SCHEMAS_DIR / "community_submission.v1.schema.json"
def get_latest_schema_version() -> int:
"""