feat: explain auto price reduction decisions and traces (#826)

This commit is contained in:
Jens
2026-02-16 15:52:24 +01:00
committed by GitHub
parent b6cf0eea93
commit 55777710e8
6 changed files with 396 additions and 220 deletions

View File

@@ -111,6 +111,10 @@ When `auto_price_reduction.enabled` is set to `true`, the bot lowers the configu
**Note:** `repost_count` and price reduction counters are only incremented and persisted after a successful publish. Failed publish attempts do not advance the counters.
When automatic price reduction is enabled, each `publish` run logs a concise decision line that states whether the reduction was applied or skipped and why (repost delay/day delay), including the earliest next eligible reduction condition.
If you run with `-v` / `--verbose`, the bot additionally logs the full cycle-by-cycle calculation trace (base price, reduction value, rounded step result, and floor clamp).
```yaml
auto_price_reduction:
enabled: # true or false to enable automatic price reduction on reposts (default: false)
@@ -163,6 +167,12 @@ This posts the ad at 150 € the first time, then 135 € (15 €), 120 € (
The `delay_days` parameter counts complete 24-hour periods (whole days) since the ad was published. For example, if `delay_days: 7` and the ad was published 6 days and 23 hours ago, the reduction will not yet apply. This ensures predictable behavior and avoids partial-day ambiguity.
Combined timeline example: with `republication_interval: 3`, `delay_reposts: 1`, and `delay_days: 2`, the first reduction is typically applied on the third publish cycle (around day 8 in a steady schedule, because due ads are republished after more than 3 full days):
- day 0: first publish, no reduction
- day 4: second publish, still waiting for repost delay
- day 8: third publish, first reduction can apply
Set `auto_price_reduction.enabled: false` (or omit the entire `auto_price_reduction` section) to keep the existing behavior—prices stay fixed and `repost_count` only acts as tracked metadata for future changes.
You can configure `auto_price_reduction` once under `ad_defaults` in `config.yaml`. The `min_price` can be set there or overridden per ad file as needed.

View File

@@ -104,6 +104,13 @@ ad_defaults:
republication_interval: 7 # every X days ads should be re-published
```
- `ad_defaults.republication_interval` controls when ads become due for republishing.
- Automatic price reductions (including `delay_reposts` and `delay_days`) are evaluated only during `publish` runs.
- Reductions do not run in the background between runs, and `update` does not evaluate or apply reductions.
- When auto price reduction is enabled, each `publish` run logs the reduction decision.
- `-v/--verbose` adds a detailed reduction calculation trace.
- For full behavior and examples (including timeline examples), see [AD_CONFIGURATION.md](./AD_CONFIGURATION.md).
> **Tip:** For current defaults of all timeout and diagnostic settings, run `kleinanzeigen-bot create-config` or see the [JSON schema](https://raw.githubusercontent.com/Second-Hand-Friends/kleinanzeigen-bot/main/schemas/config.schema.json).
### categories