refactor(geo_enrichment): layer trigger args, TOML and request body through load_config - #171
Merged
Merged
Conversation
…hrough load_config Replace normalize_config with a declarative VALIDATORS list plus prepare_config for the cross-setting checks and derived values. Each source is read by its own influxdata-plugin-utils parser and the layers are handed to load_config lowest precedence first: trigger arguments, then the TOML file they name, then on the HTTP trigger the request body. config_file_path is now a trigger argument on both triggers and is refused in the request body. The HTTP trigger gains an http_args_config block so a backfill trigger can hold the defaults each request overrides. Bump to 0.2.0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ields One validator list served both triggers, so a TOML shared with the HTTP endpoint that carried a half window or a bad batch_size stopped live enrichment over fields process_writes never reads. The list is now SETTING_VALIDATORS plus BACKFILL_VALIDATORS; the write trigger applies only the first and the HTTP trigger the sum of both. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The body KeySpec had a denylist and no allowlist, so unknown="reject" fired for config_file_path alone and a misspelled field such as "forse" was accepted, ignored, and left in cfg while the caller believed it took effect. The body now carries the settings and backfill fields by name and refuses anything else, config_file_path included. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…P trigger The http_args_config entries for source_measurements and output_columns were copied from the write trigger: the example named two tables and the description spoke of rows in the batch, neither of which applies to a backfill that handles one table per call. Both were also marked required, although the README's own example creates the trigger bare and lets the body or the TOML file supply them; Explorer would have inserted them as non-removable arguments. They are now optional, with the requirement described on the merged configuration. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… back Expressing them as Validator(required=True, when=...) replaced messages that named the setting making the demand, and for target_measurement said why, with the library's fixed "<name> is required". prepare_config's own docstring places refusals that name a second setting there, so the three move back with their 0.1.x wording. The start/end pairing stays declarative in BACKFILL_VALIDATORS, since only the HTTP trigger may apply it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A module-level helper named text was shadowed by locals and parameters of the same name in five functions. None of them called the helper, so nothing was broken yet, but the next edit to one of them would have met an UnboundLocalError. trimmed() says what it does and collides with nothing. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
cast=trimmed stringified whatever TOML delivered, so an unquoted start = 2026-08-01T00:00:00.123456789Z became str(datetime): space separated, +00:00, and truncated to microseconds, quietly breaking the nanosecond precision the README promises. start and end now take a timestamp_text cast that refuses anything but a string and names the fix. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…pected parse_delimited_list and parse_key_value stringify what they do not expect, so a JSON object for source_measurements, a non-string list item, or a null or nested value inside an output_columns object became garbage identifiers instead of a refusal. measurement_list and output_column_map now check the shape before handing it on. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…ile_path The README and the test explained the refusal as keeping a caller from naming any file the server can read, but reference_file is body-settable, accepts absolute paths and is opened server-side, so that reason did not hold. The path is refused because it selects a layer rather than setting a value: a body that could pick which file the trigger reads would take the trigger's configuration out of the operator's hands. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…setting Both the source parsers and the layer merge drop an empty string or null as "not provided", so a body sending target_measurement="" still writes to the table the trigger names, with a 200. A reset mechanism is a library design question; for now the README states the limitation and its workaround, and a test pins the behavior so a change to it is deliberate. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
… asserts The trigger-holds-the-setup, body-carries-the-window flow the README and the TOML example advertise had no test: every backfill() call sent the full configuration in the body. It now has one, driven through a config file on the trigger. test_unusable_request_body_is_a_bad_request got its 400 for None and "" only because no trigger was configured; those are a 200 with one, and the malformed bodies now assert their message against a configured trigger. test_the_body_overrides_the_trigger_arguments would have passed had the arguments been ignored; a second argument now proves they were read. test_a_blank_argument_leaves_the_default_in_place asserts the value it passed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
5 tasks
Aliaksei-Kharlap
approved these changes
Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Rewrites how geo_enrichment loads its configuration, using the
config,sourcesandvalidationmodules frominfluxdata-plugin-utils0.4.0. Supersedes #170.config_file_pathis a trigger argument only. Sending it in the body is a 400, as is any unknown field.max_radius_mandgrid_precisionno longer accept-1. Leave them unset for the default.🤖 Generated with Claude Code