Builds of charm using reactive plugin produces different config option
Metadata
Current evaluation
Closed without resolution. Maintainers acknowledged the charmcraft 3 reactive plugin incorrectly strips deprecated config options, but no fix was implemented.
Suggested action: —
No scores available.
Issue body
### Bug Description
Take https://github.com/canonical/charm-juju-local for example, after updating the `charmcraft.yaml` to the syntax to what `charmcraft 3` supports:
```yaml
type: charm
parts:
charm:
source: .
plugin: reactive
build-snaps: [charm/2.x/stable]
platforms:
ubuntu@20.04:amd64:
ubuntu@22.04:amd64:
```
The produced charm file will have different `config.yaml` than what was build using `charmcraft 2`
```diff
diff charmcraft2/config.yaml charmcraft3/config.yaml
1,47c1,8
< # Copyright 2016 Canonical Ltd.
< #
< # This file is part of the Snap layer for Juju.
< #
< # Licensed under the Apache License, Version 2.0 (the "License");
< # you may not use this file except in compliance with the License.
< # You may obtain a copy of the License at
< #
< # http://www.apache.org/licenses/LICENSE-2.0
< #
< # Unless required by applicable law or agreed to in writing, software
< # distributed under the License is distributed on an "AS IS" BASIS,
< # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
< # See the License for the specific language governing permissions and
< # limitations under the License.
< "options":
< # snap_proxy and snap_proxy_url have been deprecated for some time.
< # If your charm still needs them, add these config items manually
< # to your charm's config.yaml.
< # snap_proxy:
< # description: >
< # DEPRECATED. Use snap-http-proxy and snap-https-proxy model configuration settings.
< # HTTP/HTTPS web proxy for Snappy to use when accessing the snap store.
< # type: string
< # default: ""
< # snap_proxy_url:
< # default: ""
< # type: string
< # description: >
< # DEPRECATED. Use snap-store-proxy model configuration setting.
< # The address of a Snap Store Proxy to use for snaps e.g. http://snap-proxy.example.com
< "snapd_refresh":
< "default": ""
< "type": "string"
< "description": >
< How often snapd handles updates for installed snaps. The default
< (an empty string) is 4x per day. Set to "max" to check once per month
< based on the charm deployment date. You may also set a custom string as
< described in the 'refresh.timer' section here:
< https://forum.snapcraft.io/t/system-options/87
< "juju-channel":
< "default": "2.9/stable"
< "type": "string"
< "description": |-
< The channel of juju snap to install. Default to 2.9/stable.
< Note: This value needs to be set at deployment time. Changes made
< post-deployment will not be taken into effect.
---
> options:
> juju-channel:
> default: "2.9/stable"
> type: string
> description: |
> The channel of juju snap to install. Default to 2.9/stable.
> Note: This value needs to be set at deployment time. Changes made
> post-deployment will not be taken into effect.
\ No newline at end of file
```
The difference in the `config.yaml` causes error during the installation of the charm
```
unit-juju-local-0: 2025-02-24 06:55:11 ERROR unit.juju-local/0.juju-log Hook error:
Traceback (most recent call last):
File "/var/lib/juju/agents/unit-juju-local-0/.venv/lib/python3.10/site-packages/charms/reactive/__init__.py", line 74, in main
bus.dispatch(restricted=restricted_mode)
File "/var/lib/juju/agents/unit-juju-local-0/.venv/lib/python3.10/site-packages/charms/reactive/bus.py", line 390, in dispatch
_invoke(other_handlers)
File "/var/lib/juju/agents/unit-juju-local-0/.venv/lib/python3.10/site-packages/charms/reactive/bus.py", line 359, in _invoke
handler.invoke()
File "/var/lib/juju/agents/unit-juju-local-0/.venv/lib/python3.10/site-packages/charms/reactive/bus.py", line 181, in invoke
self._action(*args)
File "/var/lib/juju/agents/unit-juju-local-0/charm/reactive/snap.py", line 345, in change_snapd_refresh
timer = hookenv.config()["snapd_refresh"]
KeyError: 'snapd_refresh'
```
### To Reproduce
`git clone https://github.com/canonical/charm-juju-local`
1. Use charmcraft 2 (2.x/stable) to pack the charm, and unzip the charm file.
2. Update the `charmcraft.yaml` as the following (see below) . Then ,use charmcraft 3 (3.x/stable) to pack the charm, and unzip the charm file.
3. Compare the `config.yaml` between the two builds
### Environment
```
Name Version Rev Tracking Publisher Notes
charm 3.0.7 745 3.x/stable canonical✓ classic
charmcraft 3.4.2 5977 3.x/stable canonical✓ classic
...
```
### charmcraft.yaml
```yaml
type: charm
parts:
charm:
source: .
plugin: reactive
build-snaps: [charm/2.x/stable]
platforms:
ubuntu@20.04:amd64:
ubuntu@22.04:amd64:
```
### Relevant log output
```shell
unit-juju-local-0: 2025-02-24 06:55:11 ERROR unit.juju-local/0.juju-log Hook error:
Traceback (most recent call last):
File "/var/lib/juju/agents/unit-juju-local-0/.venv/lib/python3.10/site-packages/charms/reactive/__init__.py", line 74, in main
bus.dispatch(restricted=restricted_mode)
File "/var/lib/juju/agents/unit-juju-local-0/.venv/lib/python3.10/site-packages/charms/reactive/bus.py", line 390, in dispatch
_invoke(other_handlers)
File "/var/lib/juju/agents/unit-juju-local-0/.venv/lib/python3.10/site-packages/charms/reactive/bus.py", line 359, in _invoke
handler.invoke()
File "/var/lib/juju/agents/unit-juju-local-0/.venv/lib/python3.10/site-packages/charms/reactive/bus.py", line 181, in invoke
self._action(*args)
File "/var/lib/juju/agents/unit-juju-local-0/charm/reactive/snap.py", line 345, in change_snapd_refresh
timer = hookenv.config()["snapd_refresh"]
KeyError: 'snapd_refresh'
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without resolution. Maintainers acknowledged the charmcraft 3 reactive plugin incorrectly strips deprecated config options, but no fix was implemented. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without resolution. Internal ticket CRAFT-4206 tracks investigation into why charmcraft 3's reactive plugin modifies config.yaml during the PRIME step, omitting options and breaking deployments. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed without a fix. An internal ticket was created to investigate why charmcraft 3's reactive plugin alters config.yaml, but no resolution was implemented. The report appears abandoned. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Abandoned. The charmcraft 3 reactive plugin regression altering config.yaml and causing deployment failures was acknowledged and tracked internally, but no fix was implemented. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed without a public fix. The charmcraft 3 reactive plugin config.yaml discrepancy was deferred and tracked internally as CRAFT-4206. No resolution or merge details provided. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1816 Reactive charm built with charmcraft 3.x is missing options from the included layers and is broken | charmcraft | open | Reactive charms built with charmcraft 3.x lose config.yaml options from included layers; 2.x works. Maintainer acknowledged and plans a rewrite of the reactive build logic; reporter confirmed still broken on 3.4.3 and is willing to wait. | |
| #809 Reactive plugin doesn't allow for other `charm` cli arguments. | charmcraft | closed | Closed without resolution. The reactive plugin could not pass custom charm CLI arguments like --layer-index. Despite user requests for reproducible builds and binary wheel support, the feature was abandoned due to inactivity. | |
| #872 charm artifacts from reactive plugin are missing valuable build metadata | charmcraft | open | Reactive charms built via charmcraft's reactive plugin lack the .build.manifest file that charm-tools generates, and manifest.yaml omits charm-tools version. Triaged (Status: Triaged, Type: Bug); internal ticket CHARMCRAFT-654 created 2025-09-17; no code change yet. | |
| #610 many: add reactive charm plugin | charmcraft | closed | Closed and superseded by pull request #613. The reactive charm plugin was replaced rather than merged. | |
| #924 reactive plugin: call `charm build` with `-v` | charmcraft | closed | Closed after triage and internal ticket creation. Implementation guidance was provided to pass verbose flags to charm calls when verbosity is trace or debug. No fix or pull request was merged. | |
| #804 The reactive plugin is not correctly checking if `charm` failed | charmcraft | closed | Incorrect charm return code validation in the reactive plugin was abandoned and closed without a fix. No pull requests or follow-up actions were recorded. | |
| #864 reactive plugin charm tools version validation code is britle | charmcraft | closed | Closed without resolution. The reactive plugin's brittle charm-tools version validation was flagged for potential breakage. Suggestions to use JSON format or string matching were not implemented. No comments or fixes were applied, indicating the issue was abandoned. |