refactor(core): remove typed governance schema, generalize metadata merge (Phase 2 of #1172)#1179
Merged
refactor(core): remove typed governance schema, generalize metadata merge (Phase 2 of #1172)#1179
Conversation
…erge (Phase 2 of #1172) - Delete GovernanceMetadataSchema, GovernanceMetadata type, and governance field from EvalMetadata — governance data travels via case-level metadata: Record<string, unknown> - Delete KNOWN_GOVERNANCE_FIELDS, EU_AI_ACT_RISK_TIERS, validateGovernance, isWellFormedControlId, and extractGovernanceBlock from eval-validator; lint moves to agentv-compliance skill + CI Action - Generalise mergeCaseGovernance → mergeSuiteMetadataPayload: same array-concat-dedup / scalar- case-wins rules now apply to all keys under metadata, not just governance - JSONL metadata.governance output is byte-identical to main (verified with dry-run UAT) Closes #1172 (Phase 2) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <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
Phase 2 of #1172 — subtractive, no new code.
Removes the typed governance schema from
packages/core/(introduced in #1165) and generalises the suite-↔-case metadata merge. Governance data continues to travel through existing genericmetadata: Record<string, unknown>onEvalTestandEvaluationResult.Deleted from core:
GovernanceMetadataSchema,GovernanceMetadatatype, andgovernancefield fromEvalMetadatainmetadata.tsKNOWN_GOVERNANCE_FIELDS,EU_AI_ACT_RISK_TIERS,validateGovernance,isWellFormedControlId,extractGovernanceBlockfromeval-validator.tsvalidateGovernance(...)call sites (suite-level and case-level lint)-427lines net,+37lines (the generalised merge function)Generalised:
mergeCaseGovernance→mergeSuiteMetadataPayload: applies the same array-concat-dedup / scalar-case-wins rules to all keys undermetadata, not justgovernance. No governance-specific branches remain.Test updates:
metadata.test.ts: removed governance-specific tests; added regression for "returns undefined when only governance is present and name is absent"yaml-parser-metadata.test.ts: removed suite-levelsuite.metadata?.governancetest (governance no longer inEvalMetadata); case-level merge tests preserved and still passeval-validator.test.ts: removedgovernance metadata validationdescribe block (6 tests)Test plan
bun testpasses (all 1735 tests)metadata.governanceoutput byte-identical tomain— dry-run UAT:{ "governance": { "schema_version": "1.0", "owasp_llm_top_10_2025": ["LLM01"], "mitre_atlas": ["AML.T0051"], "controls": ["NIST-AI-RMF-1.0:MEASURE-2.7", "EU-AI-ACT-2024:Art.55"], "risk_tier": "high", "owner": "security-team" } }Closes #1172 (Phase 2)