feat(scorecards): add package covering Teams, Scorecards, Collections NGEP resources - #1433
Open
pranav-new-relic wants to merge 1 commit into
Open
feat(scorecards): add package covering Teams, Scorecards, Collections NGEP resources#1433pranav-new-relic wants to merge 1 commit into
pranav-new-relic wants to merge 1 commit into
Conversation
… NGEP resources Introduces pkg/scorecards, a single package for the four NGEP resource families that share the entityManagement GraphQL surface: Team, Scorecard, ScorecardRule, and Collection (including the auto-created membership/ownership/rules backing collections attached to Teams and Scorecards). Live-API exploration drove the design — see NGEP_ANALYSIS.md for the mind-map, per-field update semantics, cascade behaviour, and the transient-error taxonomy the integration tests retry through.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1433 +/- ##
==========================================
+ Coverage 32.39% 33.13% +0.73%
==========================================
Files 148 152 +4
Lines 6923 7174 +251
==========================================
+ Hits 2243 2377 +134
- Misses 4467 4569 +102
- Partials 213 228 +15
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
pranav-new-relic
force-pushed
the
feat/scorecards-package
branch
from
July 15, 2026 18:27
29d22fb to
94e74c2
Compare
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.
BROKEN - To be manually fixed by @pranav-new-relic
Summary
Adds
pkg/scorecards, a single package for the four NGEP (New Relic Entity Platform) resource families that share theentityManagement*GraphQL surface:TEAM)SCORECARD)SCORECARD_RULE)COLLECTION) — including the backing collections auto-created for Teams (membership, ownership) and Scorecards (rules)The package name is provisional — it groups these resources because they share the same interface, mutations, and reads, and interoperate (Teams/Scorecards own backing Collections; Collections are the join layer between Scorecards and ScorecardRules).
Mind map — how the pieces fit
What goes where
pkg/scorecards/NGEP_ANALYSIS.mdpkg/scorecards/README.mdpkg/scorecards/scorecards.goscorecards.New(cfg) Scorecards); mirrors the pipelinecontrol templatepkg/scorecards/scorecards_api.gopkg/scorecards/types.gopkg/scorecards/scorecards_collection_members.goAdd/RemoveCollectionMembershand-written because tutone can't emit valid Go for[ID]scalar-list returnpkg/scorecards/scorecards_types_extra.goEntityManagementCollectionElementsFilter/CollectionIdFilterArgumentinputs +UnmarshalJSONonEntityManagementActorStitchedFields(dispatches the polymorphicentityinterface field via__typename)pkg/scorecards/scorecards_test.gonewMockClient/newIntegrationTestClienthelpers (matchespipelinecontrol_test.goshape)pkg/scorecards/scorecards_unit_test.gopkg/scorecards/scorecards_integration_test.go.tutone.ymlscorecardspackage block withinclude_implementationsscoped to 8 relevant types andfield_type_overridepointer fixes for optional nested inputs (see below)newrelic/newrelic.goNewRelic.Scorecardspkg/testhelpers/helpers.goGetTestOrganizationID()for the ORG-scoped integration testsNon-obvious decisions baked into the code
Team.membership,Team.ownership,Scorecard.rules— their IDs are stable across parent updates and cannot be deleted directly. Consumers should treat them as read-only handles forAddCollectionMembers.managersrequires NGEP-encoded user IDs, not raw intuserIds. The user must first be added to the team'smembershipCollection.version: 0triggersConcurrent modification of entity— every generatedUpdate*andDeletemethod has theversionparameter stripped (matches the manual patch already living inpkg/pipelinecontrol). Documented in the README and in the .tutone.yml block. Regeneration recipe is captured in NGEP_ANALYSIS.md § 11.omitemptydoes not elide a zero-valued struct, soexternalIntegration,schedule, andnrqlEnginewould otherwise be transmitted as{"":""}on Team creation with just a name. Fixed viafield_type_override: "*..."in.tutone.yml(mirrors the fleetcontrol pattern forFleetControlOperatingSystemCreateInput).rulesCollection and leaves the ScorecardRule entities orphaned. Deleting a Collection detaches (does not delete) its members.Unknown type 'EntityManagementScorecardRuleEntity'during validate). Documented and worked around by treating them as create-time-only.Concurrent modification of entityon the second write, plus a soft-skip forOops! Something went wrongoncollectionElementsreads against a fresh empty collection.Test plan
go build ./...cleango vet ./...cleango test -tags unit ./pkg/scorecards/...— 12/12 passgo test -tags integration ./pkg/scorecards/...— 3/3 pass against a live org (fb33fea3-4d7e-4736-9701-acb59a634fdf); Team CRUD, Scorecard+Rule CRUD with cross-linkage, Collection CRUDversionargs → build passesnewrelic.NewRelic.ScorecardsFollow-ups (not blocking this PR)
entityManagementCreateTeamsHierarchyLevel,entityManagementCreateTeamsOrganizationSettings) are omitted because tutone's introspection dump misses their CreateInput types (they're also RBAC-gated in most orgs). Update variants are wired; re-add Creates once tutone fetch is patched.Add/RemoveCollectionMembersand the missing filter input types can move back into tutone-generated code once the upstream template supports scalar-list mutation returns and full input-type coverage.progressLevelsupdate,collectionElementson fresh Collections) are worth reporting to the NGEP team.