Skip to content

Conversation

@hudlow
Copy link
Collaborator

@hudlow hudlow commented Dec 11, 2025

  • Random overload IDs
    After staring at the schema I'm proposing that we generate UUIDs for overload_id values at compile time.

    It basically seems like a bug to me that other implementations treat these as non-opaque values when their stated purpose is purely for cross-referencing values in a compiled expression payload. Using non-opaque IDs, let alone specific, stable non-opaque IDs does not seem to be part of the contract.

    And I believe it should be avoided because of the potential for unintentional collisions that could cause subtle-but-nasty bugs. The best way to avoid depending on the semantics or stability of values is to randomize them.

  • Cross-type numeric comparisons
    Where we need to treat specific overloads specially, I have instead proposed a mechanism for standardized flags, and added CelOverloadFlag.CROSS_TYPE_NUMERIC_COMPARISON as the inaugural flag. I've also added a synthetic isCrossTypeNumericComparison property to overloads and a test to verify that the overloads — and only those overloads — that we expect to return true for this property do so.

  • Stale generated files
    The operator_const.ts and overload_const.ts files were previously generated... but generated from some hand-maintained YAML files? The generation mechanism and source YAML files have been lost in refactors.

    I've added code that generates these from cel-go to the cel-spec build, and now import these enumerations from that package.

@hudlow hudlow requested a review from srikrsna-buf December 11, 2025 16:56
@hudlow hudlow changed the title Hudlow/overload flags Add function overload IDs and flags Dec 11, 2025
@hudlow hudlow requested a review from timostamm December 11, 2025 16:57
): CelOverload<P, R> {
return new FuncOverload(parameters, result, impl);
return new FuncOverload(
crypto.randomUUID(),
Copy link
Collaborator Author

@hudlow hudlow Dec 11, 2025

Choose a reason for hiding this comment

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

It seems like crypto is safe to use everywhere?

Copy link
Member

Choose a reason for hiding this comment

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

"Widely available" according to mdn. Safe to use. https://developer.mozilla.org/en-US/docs/Web/API/Crypto/randomUUID

/**
* Returns true if the given value is a numeric CelType.
*/
export function isCelNumericType(
Copy link
Member

Choose a reason for hiding this comment

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

I see that this is only used in tests can we move this to the test file?

@hudlow hudlow marked this pull request as draft December 24, 2025 18:29
@hudlow
Copy link
Collaborator Author

hudlow commented Dec 24, 2025

Mostly superseded by #244, but some automation is probably worth keeping.

@hudlow hudlow changed the title Add function overload IDs and flags Generate enums for operators and overloads Dec 29, 2025
@hudlow hudlow force-pushed the hudlow/overload-flags branch from 483c511 to 2026e55 Compare December 29, 2025 23:05
@hudlow hudlow marked this pull request as ready for review December 29, 2025 23:07
@hudlow hudlow requested a review from srikrsna-buf December 29, 2025 23:07
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.

4 participants