GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — refactor(handler)!: rename the debug flags to doShowDebug and doShowLimits by dschach · Pull Request #382 · dschach/salesforce-trigger-framework

Conversation

@dschach

@dschach dschach commented Oct 30, 2026

Copy link
Copy Markdown
Owner

This pull request is batch 4 of the breaking release: items 62 and 75 of the 2026-10-29 quality analysis. The debug and limits lines can now be turned on for 1 handler, with new chainable methods whose names have a verb. The static flags are renamed so that they no longer share the names of their methods, and the older chainable debug() and limits() are deprecated. The only breaking change is the rename of 2 test-visible fields.

Changes

Field names

  • The private test-visible fields showDebug and showLimits are renamed to doShowDebug and doShowLimits. Their comments say what each flag holds and which methods set it.

  • The 11 unexplained NOPMD comments on the test assertions that read the fields are removed. Code Analyzer's 2 FieldNameMatchesMethodName findings are gone, and it now reports no findings.

Debug and limits lines for 1 handler

  • New chainable showHandlerDebug(), showHandlerDebug(Boolean), showHandlerLimits(), and showHandlerLimits(Boolean) turn the entry and exit lines and the limits line on or off for 1 handler. They set the new instance fields handlerShowDebug and handlerShowLimits.

  • A handler's own setting wins over the static setting of showDebug() and showLimits(). With null, the handler uses the static setting again.

  • run() reads the setting through 2 new private helpers, isDebugOn() and isLimitsOn().

  • The static showDebug() and showLimits() keep working for every handler. Their ApexDoc says that a handler with its own setting keeps it.

Deprecated methods

  • debug(), debug(Boolean), limits(), and limits(Boolean) keep working and keep acting for every handler. Their ApexDoc gets a @deprecated tag that points to the 1-handler methods and the static methods. A later major release removes them. The replacements have a verb in their names, and debug() no longer shares its name with System.debug().

Documentation

  • The README section Debug Statements names the 2 kinds of line, shows the static methods for every handler, and shows the chained 1-handler methods in a trigger. It says which setting wins and that debug() and limits() are deprecated.

  • The API table lists the 1-handler methods and marks the deprecated ones.

Tests

  • showHandlerDebugIsForOneHandlerOnly proves that only the handler with its own setting writes the entry and exit lines.

  • handlerDebugSettingWinsOverStatic proves that showHandlerDebug(false) silences 1 handler under a static showDebug(), and that null brings back the static setting.

  • showHandlerLimitsIsForOneHandlerOnly proves the same for the limits line.

Behavior notes

  • A consumer test that read TriggerHandler.showDebug or TriggerHandler.showLimits must read TriggerHandler.doShowDebug or TriggerHandler.doShowLimits. No code outside tests can see these fields.

  • Nothing else changes for callers. debug() and limits() still turn the lines on for every handler, as before.

  • A later item adds hideAllDebug(), a switch that turns off the debug lines for the rest of a transaction. It is on the 2.x roadmap.

  • The release pull request for the next major version stays open until the last batch is merged.

Test plan

  • Scratch org at API 67.0, after each code commit: all local tests pass, 59 of 59 in the 2 test classes of this project at the end, with 100 percent coverage on TriggerHandler, AccountSampleTriggerHandler, and AccountSampleTrigger.

  • npm run codeanalyzer:run reports no findings.

  • The Prettier check passes.

  • This description was parsed with release-please 17.11.2 and the changelog sections of this repository, to check the changelog entries.

BREAKING CHANGE: The test-visible fields TriggerHandler.showDebug and TriggerHandler.showLimits are renamed to TriggerHandler.doShowDebug and TriggerHandler.doShowLimits. A test that read the old names must read the new ones; no code outside tests can see these fields.

BEGIN_NESTED_COMMIT
feat(handler): turn on debug and limits lines for 1 handler

The new chainable showHandlerDebug() and showHandlerLimits(), each with a Boolean form, turn the lines on or off for 1 handler, and a handler's own setting wins over the static one.
END_NESTED_COMMIT

BEGIN_NESTED_COMMIT
docs(handler): deprecate debug() and limits() for the show methods

debug(), debug(Boolean), limits(), and limits(Boolean) keep acting for every handler, and their ApexDoc marks them as deprecated and points to the show methods.
END_NESTED_COMMIT

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Claude AI and others added 3 commits October 30, 2026 17:42
Claude AI @claude
refactor(handler)!: rename the debug flags to doShowDebug and doShowL…
bd4d9c7
…imits

The private test-visible fields showDebug and showLimits are renamed to doShowDebug and doShowLimits, so they no longer share the names of the methods showDebug() and showLimits(). Their comments say what each flag holds and which methods set it. The 11 unexplained NOPMD comments on the test assertions that read the fields are removed, and Code Analyzer reports no findings.

BREAKING CHANGE: The test-visible fields TriggerHandler.showDebug and TriggerHandler.showLimits are renamed to TriggerHandler.doShowDebug and TriggerHandler.doShowLimits. A test that read the old names must read the new ones; no code outside tests can see these fields.

Co-Authored-By: Claude <[email protected]>
Claude AI @claude
feat(handler): turn on debug and limits lines for 1 handler
3734dba
The new chainable showHandlerDebug(), showHandlerDebug(Boolean), showHandlerLimits(), and showHandlerLimits(Boolean) turn the entry and exit lines and the limits line on or off for 1 handler, through the new instance fields handlerShowDebug and handlerShowLimits. A handler's own setting wins over the static setting of showDebug() and showLimits(), and null makes the handler use the static setting again. The README section Debug Statements shows both kinds of setting.

Co-Authored-By: Claude <[email protected]>
Claude AI @claude
docs(handler): deprecate debug() and limits() for the show methods
f837e5b
debug(), debug(Boolean), limits(), and limits(Boolean) keep working and keep acting for every handler. Their ApexDoc gets a deprecated tag that points to showHandlerDebug() and showHandlerLimits() for 1 handler, or to the static showDebug() and showLimits() for every handler, and the README marks them as deprecated. A later major release removes them.

Co-Authored-By: Claude <[email protected]>
@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (931d336) to head (f837e5b).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #382   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          285       299   +14     
=========================================
+ Hits           285       299   +14     
Flag Coverage Δ
Apex 100.00% <100.00%> (ø)

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

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@dschach
dschach merged commit 79d3964 into main Oct 30, 2026
5 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@dschach
dschach deleted the refactor/debug-limits-flags branch October 30, 2026 07:06
@dschach dschach mentioned this pull request Oct 30, 2026
chore(main): release 2.0.0 #379
Merged
dschach added a commit that referenced this pull request Oct 30, 2026
@dschach
chore(main): release 2.0.0 (#379)
9de6a2e
🤖 I have created a release *beep* *boop*
---


## [2.0.0](v1.5.1...v2.0.0) (2026-10-30)


### ⚠ BREAKING CHANGES

* **handler:** The test-visible no-arg constructor TriggerHandler.LoopCounter() is removed, and setTriggerContext() and validateRun() are no longer test-visible. A test that used them must build the counter with a maximum, or run the handler with setTestContext() and run().
* **handler:** The test-visible static fields TriggerHandler.loopCountMap, TriggerHandler.bypassedHandlers, and TriggerHandler.globalBypass are removed. A test that read them must use the public methods instead: getLoopCount(), bypassList(), and isGlobalBypassed().
* **handler:** TriggerHandler is now an abstract class, so new TriggerHandler() no longer compiles. Code that built the base class directly must build a class that extends it.
* **handler:** The test-visible method setTriggerContext(System.TriggerOperation, Boolean) is removed. A test that called it to force a trigger context must call setTestContext(operation) on the handler instead.
* **handler:** beforeInsert(), beforeUpdate(), beforeDelete(), afterInsert(), afterUpdate(), afterDelete(), afterUndelete(), and andFinally() are no longer test-visible. A test that called 1 of them through a TriggerHandler reference must run the handler with setTestContext() and run(), or call the handler's own public override.
* **handler:** The test-visible fields TriggerHandler.showDebug and TriggerHandler.showLimits are renamed to TriggerHandler.doShowDebug and TriggerHandler.doShowLimits. A test that read the old names must read the new ones; no code outside tests can see these fields.
* **handler:** A maximum loop count now applies to each trigger operation separately, so 1 operation no longer uses up the count of the others. A handler that called setMaxLoopCount(2) to allow 1 run of before update and after update together must call setMaxLoopCount(1). To read the count of 1 operation, call getLoopCount(String, System.TriggerOperation).
* **handler:** getLoopCount() returns -1, not 0, for a handler or trigger operation with no call of setMaxLoopCount(). After a call with 0 or a negative value, the framework counts the runs but sets no limit. Code that compared the count with 0 to find a handler that is not counted must compare it with -1.
* **handler:** setMaxLoopCount(0) no longer stops every run of a handler; it removes the limit. To keep a handler from running, bypass it with TriggerHandler.bypass().
* **handler:** setBypass(name, false) no longer clears the global bypass, and isBypassed() no longer returns true for a handler that only the global bypass stops. To ask whether a handler will run, call isSkipped(), and to ask about the global bypass, call isGlobalBypassed().
* **handler:** bypassAll() no longer clears the named bypasses. After bypassAll() and clearGlobalBypass(), a handler that was bypassed by name before is still bypassed. To clear every bypass, call clearAllBypasses().
* **handler:** A global bypass no longer adds the entry BypassAll to bypassList() or bypassSet(). To check whether all handlers are bypassed, call isGlobalBypassed(). A test that read TriggerHandler.BYPASS_ALL_ALIAS must stop using it.
* **handler:** The constructor TriggerHandler(String handlerName) is removed. A handler that calls super('HandlerName') must call super(HandlerName.class) instead, which sets the handler name to Type.getName(). A handler that passed a name other than its class name must also change the bypass calls and getLoopCount() calls that use that name.

### Features

* **handler:** Add isGlobalBypassed() and isSkipped() to check bypasses ([33c852d](33c852d))
* **handler:** Name a handler by its type with a Type constructor ([9b47bba](9b47bba))
* **handler:** Set a bypass by type with setBypass(Type, Boolean) ([33c852d](33c852d))
* **handler:** Set and read the loop limit of 1 trigger operation ([931d336](931d336))
* **handler:** Turn on debug and limits lines for 1 handler ([79d3964](79d3964))


### Bug Fixes

* **handler:** Count the loop of each trigger operation separately ([#381](#381)) ([931d336](931d336))
* **handler:** Keep the named and global bypasses independent ([#380](#380)) ([33c852d](33c852d))
* **handler:** Keep the named bypasses when all handlers are bypassed ([33c852d](33c852d))
* **handler:** Read a maximum loop count of 0 as no limit ([931d336](931d336))
* **handler:** Return -1 from getLoopCount for an operation not counted ([931d336](931d336))
* **handler:** Say that the loop limit stopped the run in its warning ([f844349](f844349))


### Tests

* **handler:** Suppress NcssCount on the large test class ([ef55c41](ef55c41))


### Code Refactoring

* **handler:** Drop the BypassAll alias from the bypass list ([33c852d](33c852d))
* **handler:** Hold the bypasses and loop counters in inner classes ([#384](#384)) ([ef55c41](ef55c41))
* **handler:** Make TriggerHandler an abstract class ([#383](#383)) ([8845dc6](8845dc6))
* **handler:** Name each handler by its type and remove the String constructor ([#378](#378)) ([9b47bba](9b47bba))
* **handler:** Remove TestVisible from the overridable methods ([8845dc6](8845dc6))
* **handler:** Remove the testMode parameter from setTriggerContext ([8845dc6](8845dc6))
* **handler:** Remove the unused LoopCounter default and test-visible members ([#385](#385)) ([0f02565](0f02565))
* **handler:** Rename the debug flags to doShowDebug and doShowLimits ([#382](#382)) ([79d3964](79d3964))


### Documentation

* **changelog:** Remove the duplicate lines of an older release ([f844349](f844349))
* **contributing:** Say that the site is updated before each release ([fecb28b](fecb28b))
* **handler:** Add since dates and fix the see links ([f844349](f844349))
* **handler:** Correct the loop count, loop limit, and andFinally docs ([f844349](f844349))
* **handler:** Deprecate bypassSet() in favor of bypassList() ([33c852d](33c852d))
* **handler:** Deprecate debug() and limits() for the show methods ([79d3964](79d3964))
* **handler:** Deprecate getLoopCount(String) for the per-operation form ([931d336](931d336))
* **handler:** Rewrite the ApexDoc and the markdown files in simplified technical English ([#386](#386)) ([fecb28b](fecb28b))
* **handler:** Say that TriggerHandler(Type) replaces the String one ([33c852d](33c852d))
* **handler:** Say when andFinally() runs and when it does not ([931d336](931d336))
* **handler:** Say why TriggerHandler suppresses EmptyStatementBlock ([0f02565](0f02565))
* **readme:** Add the upgrade steps for handlers, triggers, and tests ([fecb28b](fecb28b))
* **readme:** Fix the site links and add contributing and license ([f844349](f844349))
* **readme:** Show how to pass the handler class to super() ([9b47bba](9b47bba))
* **repo:** Correct the documentation and comments after a prose review ([#388](#388)) ([f844349](f844349))
* **repo:** Rewrite DEPLOY, the internal READMEs, and the PR template ([fecb28b](fecb28b))
* **sample:** Copy the sample trigger and handler into the sample README ([#387](#387)) ([1c7851f](1c7851f))
* **sample:** Remove the br tags from the sample code in the README ([#389](#389)) ([99cdcb4](99cdcb4))
* **sample:** Rewrite the sample ApexDoc and README ([fecb28b](fecb28b))
* **security:** Add a security policy and the issue form links ([f844349](f844349))
* **site:** Regenerate the documentation site ([99cdcb4](99cdcb4))
* **site:** Regenerate the documentation site ([f844349](f844349))


### Build System

* **hooks:** Copy the sample code into the sample README on commit ([1c7851f](1c7851f))
* **release:** Keep the version placeholder of the bug form current ([f844349](f844349))


### Continuous Integration

* **format:** Check that the sample README shows the current sample code ([1c7851f](1c7851f))

---
This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@dschach
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.