Skip to content

feat: add plugin raw_options blob and typed generic options#81

Merged
liamcervante merged 2 commits into
mainfrom
plugin-raw-options
Jul 10, 2026
Merged

feat: add plugin raw_options blob and typed generic options#81
liamcervante merged 2 commits into
mainfrom
plugin-raw-options

Conversation

@liamcervante

Copy link
Copy Markdown
Contributor

Summary

Makes plugins the source of truth for their own parse options, and moves caller-assembled runtime data into the typed options channel. Additive and backwards-compatible.

parser.proto — plugin raw_options blob (always JSON)

  • Add bytes raw_options to IdentifyProjectsResponse, IdentifyEnvironmentsRequest, and Environment. A plugin generates it during identification; the caller persists it (as a YAML map in the config file) and forwards it verbatim into Parse — opaque to the config library / CLI / runner.
  • Drop ParseRequest.raw_options_format (field 4) and reserve the number — raw_options is always JSON.

options.proto — typed caller-sourced fields on GenericOptions

Data a plugin can't derive from the repo (flag / env var / API) is typed here rather than in the blob:

  • required_attributes (+ new AttributeRequirement message) — FinOps naming policy
  • default_tags — YOR config / YOR_SIMPLE_TAGS
  • source_map — flat INFRACOST_TERRAFORM_SOURCE_MAP (the config-file regex source map stays in the blob)
  • env — runtime/integration env vars
  • force_local_module_paths — caller flag

Each new field documents which plugins consume it; others ignore it.

Rule

Source decides the channel: caller-sourced (flag/env/API) → typed GenericOptions; plugin-derived-from-repo or user-config-in-the-config-file → raw_options blob.

IdentifyAllProjects (letting a plugin own the whole-repo walk) is intentionally not included here — it's a separate follow-up.

Testing

  • make generate passes: buf lint, buf format, buf generate, go build ./gen/go/..., and the TS tsc check. Go and TS bindings regenerated.

Introduce a plugin-owned raw_options blob (always JSON) on the identify
RPCs so plugins become the source of truth for their own parse options:
- IdentifyProjectsResponse, IdentifyEnvironmentsRequest and Environment
  each carry a bytes raw_options field.
- ParseRequest.raw_options_format is dropped (raw_options is always JSON)
  and its field number reserved.

Add typed, caller-sourced fields to GenericOptions for data a plugin
cannot derive from the repo (flag/env/API): required_attributes (plus a
new AttributeRequirement message), default_tags, source_map, env and
force_local_module_paths.

Regenerated Go and TS bindings.
@liamcervante
liamcervante marked this pull request as ready for review July 10, 2026 12:22
@liamcervante
liamcervante merged commit e18012a into main Jul 10, 2026
2 checks passed
@liamcervante
liamcervante deleted the plugin-raw-options branch July 10, 2026 13:10
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