feat(compliance): fire badge issuance on owner_test runs (closes #4376)#4391
Open
bokelley wants to merge 2 commits into
Open
feat(compliance): fire badge issuance on owner_test runs (closes #4376)#4391bokelley wants to merge 2 commits into
bokelley wants to merge 2 commits into
Conversation
Extract the per-version badge fan-out from compliance-heartbeat.ts into a shared runBadgeFanOut() helper and call it from both owner-driven test paths so an owner who just fixed a compliance issue sees their badge update on the next page load instead of waiting up to a heartbeat cycle. The helper loads the latest per-storyboard statuses from agent_storyboard_status (not just what this run touched), which is required for the single-storyboard run path so a partial test doesn't degrade badges for storyboards it didn't touch. Verification-change Slack notifications stay scoped to heartbeat — owner runs already deliver the result via chat or HTTP response. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
processAgentBadgesloop acrossSUPPORTED_BADGE_VERSIONS) fromcompliance-heartbeat.tsinto a sharedrunBadgeFanOut()helper inservices/badge-issuance.ts.recordComplianceRun():member-tools.tsevaluate_agent_quality(full comply) for an agent owner — fires badges off the canonical write so an owner who just fixed compliance sees the badge update on the next page load.registry-api.tsPOST /registry/agents/:encodedUrl/storyboard/:storyboardId/run(single storyboard) — same effect for in-place storyboard re-runs from the dashboard.Why the helper reads
getStoryboardStatuses()instead of trusting the run's own inputsThe single-storyboard endpoint (
storyboard/:storyboardId/run) supplies only one storyboard status indbInput. If the helper used those inputs verbatim,deriveVerificationStatus()would treat every other declared specialism as "failing" (its storyboard would be absent from the status map) and degrade unrelated badges as a side effect. Loading the merged latest state fromagent_storyboard_statusafterrecordComplianceRun()returns the correct picture for both partial owner runs and full heartbeat runs.Test plan
npx vitest run tests/unit/badge-fan-out.test.ts tests/unit/badge-issuance.test.ts— 17 tests pass.npx tsc --noEmit -p server/tsconfig.jsonclean.Closes #4376.
🤖 Generated with Claude Code