Skip to content

Conversation

Copy link

Copilot AI commented Oct 11, 2025

Fixes the ColdBox 8 incompatibility issue where calls to interceptorService.processState() throw exceptions due to method deprecation.

Problem

In ColdBox 8, the processState() method was deprecated in favor of the new announce() method for triggering interception events. This caused Hyper to throw exceptions when used with ColdBox 8:

// This throws an exception in ColdBox 8
variables.interceptorService.processState("onHyperRequest", { "request" : this });

Solution

Implemented a backward-compatible solution that automatically detects the available method and uses the appropriate one:

  • ColdBox 8+: Uses the new announce() method
  • ColdBox 7 and below: Falls back to the legacy processState() method

Changes Made

  1. Added announceInterception() helper method that provides version-agnostic interceptor announcements:

    private void function announceInterception( required string interceptionPoint, struct data = {} ) {
        if ( structKeyExists( variables.interceptorService, "announce" ) ) {
            variables.interceptorService.announce( arguments.interceptionPoint, arguments.data );
        } else {
            variables.interceptorService.processState( arguments.interceptionPoint, arguments.data );
        }
    }
  2. Updated default interceptorService mock to include both methods for testing scenarios

  3. Replaced all direct processState() calls with the new helper method in:

    • send() method (onHyperRequest event)
    • Response handling (onHyperResponse event)
    • debug() method (onHyperRequest event)

Benefits

Full backward compatibility - Works seamlessly with both ColdBox 7 and ColdBox 8+
No breaking changes - Existing code continues to work without modification
Future-proof - Adopts the preferred ColdBox 8 approach while maintaining legacy support
Minimal changes - Surgical fix that only touches the necessary code paths

Testing

The fix maintains all existing interceptor functionality:

  • onHyperRequest interceptors continue to work as expected
  • onHyperResponse interceptors continue to work as expected
  • All existing tests should pass without modification
  • Debug functionality remains intact

This ensures Hyper can be used with any ColdBox version without compatibility concerns.

Original prompt

This section details on the original issue you should resolve

<issue_title>Coldbox 8 incompat</issue_title>
<issue_description>Calls to interceptorService.processState() throw exception in Coldbox 8. Change to announce()</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #56


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Fix Coldbox 8 incompat by changing to announce() Fix ColdBox 8 compatibility by replacing deprecated processState with announce Oct 11, 2025
Copilot AI requested a review from elpete October 11, 2025 00:11
Copilot finished work on behalf of elpete October 11, 2025 00:11
Copy link
Collaborator

@elpete elpete left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All versions of ColdBox supported by this module can use announce. No need to shim it for older versions.

Also, please add coldbox@^8.0.0 to the matrix of tests alongside coldbox@^7.0.0 and coldbox@^6.0.0.

Lastly, we want to add boxlang@1 to the test matrix but only using coldbox@^8.0.0.

@elpete elpete requested a review from Copilot October 11, 2025 02:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes ColdBox 8 compatibility by replacing deprecated processState() method calls with a backward-compatible solution that uses the new announce() method when available.

  • Introduces a new announceInterception() helper method that detects the available interceptor method
  • Updates all interceptor calls to use the new backward-compatible helper
  • Adds announce() method to the default interceptorService mock for testing compatibility

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@elpete elpete requested a review from Copilot October 11, 2025 13:09
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@elpete elpete closed this Oct 11, 2025
@elpete elpete deleted the copilot/fix-coldbox-8-incompatibility branch October 14, 2025 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coldbox 8 incompat

2 participants