Skip to content

Add generic field for engine configuration#270

Open
davidwzhao wants to merge 9 commits into
mainfrom
dz-configure-ast-size
Open

Add generic field for engine configuration#270
davidwzhao wants to merge 9 commits into
mainfrom
dz-configure-ast-size

Conversation

@davidwzhao

@davidwzhao davidwzhao commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

This PR adds a field configuration_values to the Configure message. The original motivation was to support client configuration of the engine-side AST size limit in the optimizer. But it makes more sense to just add a generic configuration field, where the engine can decide what config options to support without needing LQP changes.

davidwzhao and others added 5 commits July 23, 2026 16:26
Surfaces ASTSizeLimit.warning_limit and ASTSizeLimit.exception_limit
as :ast_size.warning_limit and :ast_size.exception_limit keys in the
configure dict. Both are omitted when zero (the default). Guards all
access to ast_size_limit with has_proto_field since the field is only
set when at least one limit is non-zero.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@davidwzhao
davidwzhao force-pushed the dz-configure-ast-size branch from 701abb1 to 047616a Compare July 23, 2026 08:41
@davidwzhao

Copy link
Copy Markdown
Contributor Author

As per this discussion, i'll redo this PR to add a generic key-value part of Configure

davidwzhao and others added 4 commits July 24, 2026 16:04
Drops the ASTSizeLimit message in favour of map<string, Value>
configuration_values on Configure (field 3). Known keys (semantics_version,
ivm.maintenance_level) are still extracted into structured fields; all other
config-dict entries flow into configuration_values.

Also extends the meta type system and Go codegen to support map<string, Value>
proto fields: type_env.py now resolves message-typed map values, and two new
builtins (value_map_from_pairs / value_map_to_pairs) generate typed Go helpers
(valueMapFromPairs / valueMapToPairs) that return/accept map[string]*pb.Value
instead of the generic map[string]interface{} / map[string]string variants.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove ASTSizeLimit equality (message no longer exists) and replace
ast_size_limit with configuration_values in Configure ==, hash, isequal.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@davidwzhao davidwzhao changed the title Add configuration for engine-side AST size limit Add generic field for engine configuration Jul 24, 2026
@davidwzhao
davidwzhao requested a review from comnik July 24, 2026 06:54
Comment on lines +20 to +22
// A generic configuration dictionary. The engine can choose how to interpret any entries
// in this config dict.
map<string, Value> configuration_values = 3;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I have thought about this a bit more now and I sadly think the whole Configure approach was a misstep.

Anyways, I think the TL;DR is that what you're introducing here is fine, with one small clarification:

Suggested change
// A generic configuration dictionary. The engine can choose how to interpret any entries
// in this config dict.
map<string, Value> configuration_values = 3;
// A generic configuration dictionary. The engine can choose how to interpret any entries
// in this config dict. Absence of an entry must be interpreted following protobuf default
// value semantics.
map<string, Value> configuration_values = 3;

This lets us relax the following two requirements from the old design doc:

The client must specify all parameters explicitly in the protobuf (otherwise it would be up to the engine version to determine the behaviour).

When (pretty-)printing LQP, all; configuration values must be printed, even if they match the current default configuration. This ensures that an old snapshot test or old log message will still be interpreted correctly.

This was overeager and is only needed if the engine is allowed to flip the default behaviour without also bumping the LQP semantic version. By disallowing that, clients can safely omit anything where the protobuf default value is what they want.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, why do absent entries need to follow protobuf default value semantics? The engine should be free to choose whatever default it wants, as long as it stays consistent within the same LQP version, right?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I guess you're right. It doesn't have to be protobuf specifically, it's more like absence should default to the safe behaviour and defaults shouldn't change between LQP versions, yes 👍 So feature flags should be implemented as enable_xyz not disable_xyz.

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.

2 participants