Package vs Project proposal#1260
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1260 +/- ##
=======================================
- Coverage 81.2% 81.2% -0.1%
=======================================
Files 111 111
Lines 9371 9371
=======================================
- Hits 7617 7616 -1
- Misses 1754 1755 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
||
| # Shared options (apply to all subcommands that accept them) | ||
| # [registry] | ||
| # path = "https://github.com/open-telemetry/semantic-conventions.git" |
There was a problem hiding this comment.
I think it's common to break down params into two groups: persistent ones and specific invocation.
Only persistent ones go into the config.
E.g. clippy does not seem to allow to configure which path to lint, it only takes it in CLI.
Following this logic:
- path and include_unreferenced seem to be pre-invocation.
- Follow_symlink is probably persistent
- policies could be persistent (like I want all my semconv to pass policies)
- skipping policies is per-invocation
....
There was a problem hiding this comment.
Why restrict it? if my .weaver.toml is in a project dir I don't want to keep typing weaver registry check --registry /path/to/my/model - I can just type weaver registry check and override the default registry which is the semconv github project main branch.
There was a problem hiding this comment.
back to what we chatted on the call: it's not typical and is surprising.
If weaver registry check is provided without args, I imagine it defaults -r to .; if it's also in the config, -r resolution becomes ambiguous - can you use config for a specific registry on a different registry provided in explicit option? is it valid?
I think we're discussing this: is this config for a registry or for a weaver command.
I'm going to throw a crazy idea and run away.
What if it's a part of definition manifest?
- My registry files are in this location
- I want this set of policies I want to run on it (this is almost independent of the tooling used to validate)
- I want this set of live-checks (? maybe, not 100% sure if it's part of definition)
Then weaver.toml becomes a list of setting specific to weaver, not specific to registry.
You pass -r [definition-]manifest.yaml and this is where registry config lives.
There was a problem hiding this comment.
If weaver registry check is provided without args, I imagine it defaults -r to .
It defaults to semconv github main branch today.
Like cargo, I don't want to change dir to target/debug every time I need to build, test or run my debug code.
Maybe we establish that model is the default location under the project root to have your model and then you can change that (like you can with .cargo/config.toml for targets) to some other location.
So, when you run a weaver command that uses a registry it would:
- use what you specify in
-r - look in CWD for a
manifest.yaml - look in
model-dirlocation as specified in.weaver.tomlwith./modelas the default - error
There was a problem hiding this comment.
It defaults to semconv github main branch today.
😮 another TIL
Does it make sense on all commands though? Live check makes sense, but why everyone should generate, resolve, package, check, update markdown for otel semconv main branch?!
I don't think we need to decide on this PR, but I think there will be properties that belong on the config and don't belong on it. Some properties are part of the manifest, some are in config and maybe there are some that are cli only. I don't think it changes general design here
There was a problem hiding this comment.
update: even live-check does not make sense because of main branch - only semconv internals and prototypes should care about it.
lquerel
left a comment
There was a problem hiding this comment.
I really like the direction this proposal is taking. I've added a number of suggestions that I think remain aligned with the overall idea.
| ### 2. Load template config from the package directory only | ||
|
|
||
| `template_config.yaml` is read from the given template directory and nowhere else. No directory-walking. No `$HOME/.weaver/` fallback. This is already the behavior for remote template packages and the update-markdown command — we are making local packages consistent with remote ones. | ||
|
|
||
| A template package should be self-contained and predictable. The same package produces the same output regardless of what `weaver.yaml` files happen to exist in parent directories or the user's home directory. | ||
|
|
There was a problem hiding this comment.
It's important to note that some users use the same acronyms, the same whitespace_control, and the same template_syntax across multiple template packages (e.g. one package for code gen language A and language B, or even another for doc gen using those same parameters). The current mechanism makes that easy, and it would be a shame to lose that. At the same time, I understand and agree with the rest of the argument.
I suggest that the new .weaver.toml file should allow defining (or overriding) a limited set of safe, shared knobs (e.g. acronyms, template_syntax, whitespace_control, params). If we do that, then we can make the simplification described in this proposal.
There was a problem hiding this comment.
This makes sense to me. You're actively choosing to change the behaviour of the packaged config within your project.
|
|
||
| ### 3. Introduce `.weaver.toml` as project config | ||
|
|
||
| A new `.weaver.toml` file belongs to the **project** — the codebase that uses Weaver. It configures everything that does not belong to a template package: settings that are CLI-configured today, plus new project-level settings that are cumbersome to provide on the command line. |
There was a problem hiding this comment.
A project can be a simple repo or a monorepo made up of multiple projects/services, which reinforces the need for "walking up from the current working directory" as defined later. Maybe we should clarify a bit more what we mean by "project" to better explain the value of the mechanism that's been put in place?
| # | ||
| # [emit] | ||
| # endpoint = "http://localhost:4317" | ||
| ``` |
There was a problem hiding this comment.
As a follow up to my previous comments, we could have something like:
# Shared defaults applied to all template packages
[template_defaults]
acronyms = ["API", "HTTP", "SDK", "CLI", "URL", "JSON"]
[template_defaults.template_syntax]
block_start = "{%"
block_end = "%}"
variable_start = "{{"
variable_end = "}}"
comment_start = "{#"
comment_end = "#}"
[template_defaults.whitespace_control]
trim_blocks = true
lstrip_blocks = true
keep_trailing_newline = false
[template_defaults.params]
copyright_owner = "Acme"
include_experimental = false
year = 2026and even an optional per-package overrides (if we want, could come later).
# Optional per-package overrides
[[template_overrides]]
acronyms = ["API", "HTTP", "SDK", "CLI", "OTLP"]
[template_overrides.template_syntax]
variable_start = "[["
variable_end = "]]"
[template_overrides.whitespace_control]
trim_blocks = false
[template_overrides.params]
language = "rust"
crate_name = "otel_semconv"
# TOML has no null so we could use explicit unsets
unset_params = ["include_experimental"]| # === Phase 2: CLI-equivalent settings === | ||
|
|
||
| # Shared options (apply to all subcommands that accept them) | ||
| # [registry] |
There was a problem hiding this comment.
Should we rename this section [defaults.registry] ?
| # include_unreferenced = false | ||
| # v2 = true | ||
| # | ||
| # [policy] |
There was a problem hiding this comment.
Should we rename this section [defaults.policy] ?
| # paths = ["./policies"] | ||
| # skip = false | ||
| # | ||
| # [diagnostics] |
There was a problem hiding this comment.
Should we rename this section [defaults.diagnostics] ?
| # [live_check] | ||
| # input_source = "otlp" | ||
| # input_format = "json" | ||
| # format = "ansi" | ||
| # templates = "live_check_templates" | ||
| # no_stream = false | ||
| # no_stats = false | ||
| # | ||
| # [live_check.otlp] | ||
| # grpc_address = "0.0.0.0" | ||
| # grpc_port = 4317 | ||
| # admin_port = 4320 | ||
| # inactivity_timeout = 10 | ||
| # | ||
| # [live_check.emit] | ||
| # otlp_logs = false | ||
| # otlp_logs_endpoint = "http://localhost:4317" | ||
| # otlp_logs_stdout = false | ||
| # | ||
| # [generate] | ||
| # templates = "templates" | ||
| # target = "" | ||
| # | ||
| # [emit] | ||
| # endpoint = "http://localhost:4317" |
There was a problem hiding this comment.
Should we rename those sections with the following pattern [commands.<command_in_cli>] ?
That will make things really clear in my opinion.
There was a problem hiding this comment.
Yes, that makes sense. I also really want to take the opportunity to find more defaults where the same settings are used across two or more commands. e.g. grpc* is now also used by infer
Co-authored-by: Liudmila Molkova <[email protected]>
|
|
||
| ## Proposal | ||
|
|
||
| ### 1. Rename `weaver.yaml` to `template_config.yaml` |
There was a problem hiding this comment.
Bikeshed: weaver_template.yaml ?
There was a problem hiding this comment.
Agreed, and updated the doc.
|
|
||
| ## Implementation Phases | ||
|
|
||
| **Phase 1:** Introduce `.weaver.toml` with `[live_check]` finding overrides and filters. |
There was a problem hiding this comment.
Can we add it for check and live-check? The stable-by-default / federated semconv OTEP would be WAY simpler if check also had config we could share.
There was a problem hiding this comment.
phase 1 is just these new filtering settings for live-check. phase 2 will include check. We can prioritise check
jsuereth
left a comment
There was a problem hiding this comment.
Approve of this going forward.
I think there's some bikeshedding to figure out, but approving assuming we address all open comments, as this is a proposal/directional doc.
|
|
||
| A new `.weaver.toml` file belongs to the **project** — the codebase that uses Weaver. A project may be a single repository or a monorepo containing multiple services. It configures everything that does not belong to a template package: settings that are CLI-configured today, plus new project-level settings that are cumbersome to provide on the command line. | ||
|
|
||
| **Discovery strategy — open question:** `.weaver.toml` is discovered by walking up from CWD through parent directories to root and then includes `$HOME/.weaver.toml`. Two approaches: |
There was a problem hiding this comment.
Is this needed right away or ever? I believe this was not used before and we can always build it if it becomes necessary.
There was a problem hiding this comment.
I clearly prefer the second approach for the reasons mentioned in a previous comment (monorepo or multiple templates sharing configuration elements). Example in a monorepo context:
- I define acronyms at the global level (across microservices).
- I define parameters at the service level, for example to specify their names.
There was a problem hiding this comment.
Is this a practical or a theoretical need? In my mental model one config per repo/registry is necessary and merging live check suppression rules across registries automatically does not make sense.
If we need some inheritance and walking up, i would always prefer it to be explicit and only add it when 2-3 people ask for it
|
I've updated the proposal in response to the comments. Some specifics like config naming and handling of specific options/commands are best deferred to when they're implemented. I have left an open question which is important to resolve on whether we merge config up the tree or have first-wins. Once that's clarified, I think we're good to go. |
lmolkova
left a comment
There was a problem hiding this comment.
this is great! I'd like to polish the details around properties (which config / manifest they go to), but that can be done during implementation
Proposal for clean separation of configuration that belongs with an artifact that weaver uses, templates, versus configuration for weaver itself e.g. live-check settings in a project.