Repository navigation
Conversation
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Update handling and policy type naming packages/graphql/src/resolvers/globals/update.ts, packages/graphql/src/schema/buildPoliciesType.ts, test/graphql/hidden-fields.int.spec.ts |
The resolver passes {} when args.data is nullish. Global policy type names use entity.graphQL?.name or fall back to slug. The test checks that the HiddenGlobalAccess and HiddenGlobalDocAccess types exist and their snake-case alternatives do not. |
Priority:
Estimated code review effort: 2 (Simple) | ~8 minutes
Change: Bug fix · Severity of issue fixed: Medium
Possibly related PRs
- payloadcms/payload#19075: This PR makes the same resolver and policy type naming changes and adds regression coverage for hidden globals.
- payloadcms/payload#18862: This PR changes hidden-field input generation and covers empty global updates, within the same hidden-global GraphQL behavior.
Suggested reviewers: paulpopus
Merge Risk: 
Minimal · up to b34ee
-
No actionable merge-blocking risk remains in the verified changes.
Security architecture risk: 
Low · up to b34ee
-
The changes are narrowly scoped and retain the existing update authorization checks and server-selected global identity. No authorization bypass was established. Applications may nevertheless observe renamed policy types or newly successful empty updates, including their configured hook effects.
Retained concerns
No architecture-level concerns identified.Security review details
-
Security Blast Radius
- inferred — Each update invocation remains scoped to the server-configured global captured by its resolver, subject to that application's access policy. The changed data expression gives the caller no new ability to select another global or request an access override.
Trust Boundaries and Controls
- observed — The empty-object fallback still reaches globalConfig.access.update through executeAccess before document retrieval and persistence. A false access result throws Forbidden; when no callback is supplied, executeAccess requires an authenticated request user. Custom callbacks receive the normalized data, so their application-specific semantics remain relevant.
Resilience and Maintainability Implications
- observed — The newly successful path retains transaction initialization, existing lock checks, commit after change hooks, and transaction cleanup on thrown errors. Empty updates are not guaranteed to be side-effect-free or idempotent: configured hooks and normal update processing still execute. The normalization introduces no new concurrency or external-side-effect rollback guarantee.
-
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title names the two changes in the PR: defaulting global update data to an empty object, and using the entity name for the global policy type name. It also carries the conventional-commit prefix and the issue number. The title is specific and matches the changeset.
Full details: Description check
-
Explanation
The description states the root causes and the fixes for both files. It names the affected lines and the error that was thrown. It also describes the schema test added in hidden-fields.int.spec.ts, so it relates directly to the changeset.
Full details: Linked Issues check
-
Explanation
Directly linked issue
#19067has two coding objectives. Both are implemented at the reviewed head.-
Default missing global update data to {} [
#19067]: packages/graphql/src/resolvers/globals/update.ts line 42 now readsdata: (args.data ?? {}) as any. The base revision passeddata: args.data. This matches the pattern the issue cites in resolvers/collections/update.ts. When the mutation omits data, updateOperationGlobal now receives {} instead of undefined. -
Derive the global policy type name from the entity [
#19067]: packages/graphql/src/schema/buildPoliciesType.ts line 220 now readsformatName(${entity?.graphQL?.name || slug}${typeSuffix || ''}). The base revision readglobal?.graphQL?.name, whereglobalresolved to Node's globalThis.global. The fallback to slug is kept.
An automated schema test was added in test/graphql/hidden-fields.int.spec.ts. It asserts that HiddenGlobalAccess and HiddenGlobalDocAccess exist and that hidden_globalAccess and hidden_globalDocAccess do not. formatName does not change letter case, so the buggy slug-based name would produce the lowercase names the test rejects. The test therefore distinguishes the fixed and buggy behavior, provided the hidden global config sets graphQL.name to HiddenGlobal. I did not verify that config setting. The issue does not require a test for the resolver change. No coding requirement is unmet.
-
Full details: Out of Scope Changes check
-
Explanation
The whole-PR diff against the merge base changes three files. Each change maps to the linked issue
#19067.- packages/graphql/src/resolvers/globals/update.ts: one line, the
datadefault. This implements objective 1. - packages/graphql/src/schema/buildPoliciesType.ts: one line, the
globalTypeNamesource. This implements objective 2. - test/graphql/hidden-fields.int.spec.ts: one added test for the policy type names. It covers the buggy naming path from objective 2 and is supporting test coverage.
The PR does not modify initGlobals.ts, and no unrelated files change. The
as anycast mirrors the existing collection resolver pattern. No change lacks a connection to the linked issue. - packages/graphql/src/resolvers/globals/update.ts: one line, the
-
-
Finishing Touches
-
🧪 Generate unit tests (beta)
-
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
Description
Fixes #19067.
Root Causes & Fixes
resolvers/globals/update.ts:dataargument is supplied in the mutation),initGlobals.tsomits thedataargument fromupdate<Global>.resolvers/globals/update.tspreviously passeddata: args.data, forwardingundefinedtoupdateOperationGlobalwhich then threw aTypeError: Cannot read properties of undefined (reading '_status').data: (args.data ?? {}) as anymirroringresolvers/collections/update.ts.schema/buildPoliciesType.ts:buildPolicyTypetakes{ type, entity, scope, typeSuffix }.globalTypeNamewas formatted usingglobal?.graphQL?.name || slug. Becauseglobalwas not a parameter in scope, Node'sglobalThis.globalwas referenced (returningundefined), unexpectedly falling back tosluginstead of readingentity.graphQL?.name.entity?.graphQL?.name || slug.Verification
test/graphql/hidden-fields.int.spec.tsverifying thatHiddenGlobalAccessandHiddenGlobalDocAccessuseentity.graphQL.namerather than the slug fallback.printWidth: 100, singleQuote: true, semi: false).