canonical / canonical/cos-proxy-operator
flapping issues
- Dominant language
- Python
- Stars
- 3
- Forks
- 12
- PR merge metrics
- No merged PRs in 30d
Description
flaplint reported
```
flaplint · cos-proxy-operator main@7f9bfbc
../cos-proxy-operator/src/charm.py
✖ 344:17 unsorted iteration into a sequence · event.certificates → on-disk file · high confidence
`event.certificates` is an unordered source iterated without sorted() to build a
sequence written to an on-disk file at ../cos-proxy-operator/src/charm.py:345.
✖ 637:13 position-dependent value from unordered data · config → on-disk file · high confidence
`config` carries a value picked by position from an unordered collection upstream before
reaching an on-disk file, so a different element may be selected on different runs. Fix
at the source: the instability is created upstream in `loki_endpoints()`
(../cos-proxy-operator/src/vector.py:247).
../cos-proxy-operator/src/metrics_endpoint_aggregator.py
✖ 200:13 unsorted iteration into a sequence · jobs → databag · high confidence
`jobs` carries a value whose element order was baked in by an unsorted iteration, before
it reaches the relation databag. Fix at the source: the instability is created upstream
in `targets()` (../cos-proxy-operator/src/scrape_config.py:74).
✖ 282:9 unordered collection · targets → databag · high confidence
`targets` is an unordered collection written to the relation databag. Fix at the source:
the instability is created upstream in `_get_targets()`
(../cos-proxy-operator/src/metrics_endpoint_aggregator.py:541).
✖ 563:9 unordered collection · unit_rules → databag · high confidence
`unit_rules` is an unordered collection written to the relation databag. Fix at the
source: the instability is created upstream in `_get_alert_rules()`
(../cos-proxy-operator/src/metrics_endpoint_aggregator.py:639).
✖ 678:33 unsorted iteration into a sequence · unit_rules → databag · high confidence
a caller passes an unordered collection into `unit_rules` (a parameter), and iterating
it without sorted() bakes that disorder into a sequence written to the relation databag
at ../cos-proxy-operator/src/metrics_endpoint_aggregator.py:201. Sort at the iteration
(sorted(`unit_rules`)), or annotate `unit_rules` as dict/list so callers must pass an
ordered type.
../cos-proxy-operator/src/vector.py
✖ 247:34 position-dependent value from unordered data · loki_endpoints → rendered config · high confidence
a value taken by position from `loki_endpoints` (an unordered collection) reaches
rendered workload config at ../cos-proxy-operator/src/vector.py:275. The instability is
created at ../cos-proxy-operator/src/vector.py:242; fix it there.
../cos-proxy-operator/src/scrape_config.py
✖ 74:42 unsorted iteration into a sequence · targets → databag · medium confidence
`targets` is iterated without sorted() to build a sequence written to the relation
databag. Sort at the iteration (sorted(`targets`)), or annotate `targets` as dict/list if
callers already guarantee order.
────────────────────────────────────────────────────────
✖ 8 flap risk(s) 8 yours · 11 file(s) scanned
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reviewing the reported locations in src/charm.py, src/vector.py, src/scrape_config.py, and src/metrics_endpoint_aggregator.py, especially the named upstream functions and lines. Trace each unordered collection to its on-disk file, rendered config, or databag output, then rerun flaplint. Done means the eight reported flap risks are resolved without changing the intended values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100