fix: guard IDP full-replacement updates#609
Draft
cursor[bot] wants to merge 3 commits into
Draft
Conversation
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
|
|
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.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.
Description
Fixes a destructive IDP scorecard update path introduced with the new IDP write support. Scorecard updates are full replacements, but the update body previously accepted
{ scorecard: {...} }withoutchecks, allowing an agent editing metadata to replace a populated scorecard with one containing no checks. The fix makes scorecard updates require the completechecksarray and adds update-only target consistency guards for scorecards, scorecard checks, and IDP entity YAML updates so path/body mismatches fail before any Harness API call.Bug and impact:
harness_update(resource_type="scorecard", ...)call with a scorecard body but nocheckscould silently drop all checks from an existing scorecard because the API update is a full replacement.Root cause:
harness_get.Fix:
checks.scorecard.identifier,checkDetails.identifier, and IDP entity YAMLkind/metadata.nameversus the path target.Type of Change
Checklist
pnpm testpassespnpm typecheckpassespnpm buildpassespnpm standards:checkpasses (architecture guardrails — see docs/coding-standards.md)pnpm docs:checkpasses (if registry/tool counts changed)Coding Standards (registry-driven MCP model)
If this PR adds or changes Harness API coverage:
server.registerTool()calls — only toolset definitions insrc/registry/toolsets/ALL_TOOLSETSandToolsetNameunionoperationPolicyon every new/changed endpointsrc/registry/extractors.ts(no raw passthrough changes in this PR)identifierFieldsandscopealready declared on changed resourcesconsole.log()insrc/Validation performed:
pnpm exec vitest run tests/registry/scorecard-mutate.test.ts tests/registry/idp-entity.test.tspnpm buildpnpm typecheckpnpm docs:checkpnpm test(115 files / 2502 tests)pnpm standards:check