Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved fully qualified references to code in the Schema and System namespaces #712

Merged
merged 15 commits into from
Jul 11, 2024

Conversation

jongpie
Copy link
Owner

@jongpie jongpie commented Jul 10, 2024

Since the unlocked package does not have a namespace, orgs can encounter installation errors for Nebula Logger if the target org has any custom Apex code (classes, enums, interfaces, etc.) with the same name as standard class in the Schema or System namespace (referred to as name shadowing).

This is the same concept & approach as the changes made in several previous releases (listed below) - but my hope is that this PR finally finishes this effort, and all references are now fully qualified.

This shouldn't cause any functional changes to Nebula Logger - this is to tidy up existing references to avoid name collisions so that more orgs can use the unlocked package.

Metadata Changes

  • Moved the existing name-shadowing classes in the extra-tests directory to be in separate subdirectories (one for each namespace, Schema and System)

  • Added name-shadowing classes for several standard classes in the Schema and System namespaces & switched to using fully-qualified references for these classes:

    • Schema namespace standard classes
      • ApexClassSchema.ApexClass
      • ApexEmailNotificationSchema.ApexEmailNotification
      • ApexTriggerSchema.ApexTrigger
      • AsyncApexJobSchema.AsyncApexJob
      • BatchApexErrorEventSchema.BatchApexErrorEvent
      • CustomPermissionSchema.CustomPermission
      • DisplayTypeSchema.DisplayType
      • FlowDefinitionViewSchema.FlowDefinitionView
      • FlowExecutionErrorEventSchema.FlowExecutionErrorEvent
      • FlowVersionViewSchema.FlowVersionView
      • PermissionSetSchema.PermissionSet
      • PermissionSetAssignmentSchema.PermissionSetAssignment
      • SoapTypeSchema.SoapType
      • UserRecordAccessSchema.UserRecordAccess
      • UserRoleSchema.UserRole
    • System namespace standard classes
      • BatchableContextSystem.BatchableContext
      • ComparableSystem.Comparable
      • DatabaseSystem.Database
      • EventBusSystem.EventBus
      • FinalizerContextSystem.FinalizerContext
      • InstallHandlerSystem.InstallHandler
      • JSONSystem.JSON
      • MatcherSystem.Matcher
      • PatternSystem.Pattern
      • PicklistEntrySystem.PicklistEntry
      • QueueableSystem.Queueable
      • QueueableContextSystem.QueueableContext
      • QuidditySystem.Quiddity
      • RequestSystem.Request
      • RestContextSystem.RestContext
      • RestRequestSystem.RestRequest
      • RestResponseSystem.RestResponse
      • SchedulableSystem.Schedulable
      • SchedulableContextSystem.SchedulableContext
      • SearchSystem.Search
      • TriggerOperationSystem.TriggerOperation
      • UUIDSystem.UUID
  • Scope creep: fixed some flaky tests in LogBatchPurgeController_Tests

@jongpie jongpie added Type: Bug Something isn't working Layer: Configuration Items related to the custom hierarchy setting LoggerSettings__c or any included custom metadata type Layer: Log Management Items related to the custom objects & Logger Console app Layer: Logger Engine Items related to the core logging engine Package Type: Unlocked Package Issues and enhancements that specifically apply to the unlocked package labels Jul 10, 2024
@jongpie jongpie had a problem deploying to Experience Cloud Scratch Org July 10, 2024 17:36 — with GitHub Actions Failure
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org July 10, 2024 17:51 — with GitHub Actions Inactive
@jongpie jongpie force-pushed the feature/improved-fully-qualified-references branch from f0fbf09 to 7ae0758 Compare July 10, 2024 19:17
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org July 10, 2024 19:22 — with GitHub Actions Inactive
…em.EventBus, and System.UUID

Also fixed some flaky tests in LogBatchPurgeController_Tests
…ema.ApexTrigger, and Schema.ApexEmailNotification
…View, Schema.FlowVersionView, and Schema.UserRecordAccess
…stem.InstallHandler, System.JSON, System.Queueable, System.QueueableContext, System.Quiddity, System.Request, System.Schedulable, System.SchedulableContext, System.Search, and System.TriggerOperation
…Schema.BatchApexErrorEvent, Schema.CustomPermission, Schema.FlowExecutionErrorEvent, Schema.PermissionSet, Schema.PermissionSetAssignment, Schema.UserRole, System.BatchableContext, and System.FinalizerContext
@jongpie jongpie force-pushed the feature/improved-fully-qualified-references branch from 7ae0758 to ebd342a Compare July 10, 2024 20:59
@jongpie jongpie temporarily deployed to Experience Cloud Scratch Org July 10, 2024 21:03 — with GitHub Actions Inactive
Copy link

codecov bot commented Jul 10, 2024

Codecov Report

Attention: Patch coverage is 95.14563% with 5 lines in your changes missing coverage. Please review.

Project coverage is 95.66%. Comparing base (88c630b) to head (ebd342a).
Report is 1 commits behind head on main.

Files Patch % Lines
...r/core/main/configuration/classes/LoggerPlugin.cls 0.00% 2 Missing ⚠️
...re/main/log-management/classes/LogEntryHandler.cls 94.44% 1 Missing ⚠️
...management/classes/RelatedLogEntriesController.cls 0.00% 1 Missing ⚠️
...ention-rules/plugin/classes/LogRetentionFilter.cls 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #712      +/-   ##
==========================================
- Coverage   95.67%   95.66%   -0.02%     
==========================================
  Files          50       50              
  Lines        5597     5604       +7     
==========================================
+ Hits         5355     5361       +6     
- Misses        242      243       +1     
Flag Coverage Δ
Apex 95.66% <95.14%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jongpie jongpie marked this pull request as ready for review July 10, 2024 21:48
@jongpie jongpie merged commit 48ea5fe into main Jul 11, 2024
1 check passed
@jongpie jongpie deleted the feature/improved-fully-qualified-references branch July 11, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Layer: Configuration Items related to the custom hierarchy setting LoggerSettings__c or any included custom metadata type Layer: Log Management Items related to the custom objects & Logger Console app Layer: Logger Engine Items related to the core logging engine Package Type: Unlocked Package Issues and enhancements that specifically apply to the unlocked package Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants