Skip to content

fix: save downloaded ads with unresolved shipping options - #1346

Merged
1cu merged 2 commits into
Second-Hand-Friends:mainfrom
Tomblarom:fix/download-unmatched-shipping
Oct 15, 2026
Merged

1cu merged 2 commits into
Second-Hand-Friends:mainfrom
Tomblarom:fix/download-unmatched-shipping

Conversation

@Tomblarom

@Tomblarom Tomblarom commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

ℹ️ Description

download --ads=all currently skips direct-purchase-eligible ads when their displayed shipping price cannot be mapped to a predefined shipping option. Calculating the initial content hash raises sell_directly requires at least one predefined shipping_options entry.

Save those ads with explicit sell_directly: false and shipping_options: [], retain the extracted shipping costs, and warn the user to review shipping options before re-enabling direct purchase. Do not guess a carrier or inherit unrelated default options. Normal model validation remains unchanged.

Related context: #1256 addressed a different shipping extraction failure; this case has shipping_type: SHIPPING but no usable option. Reproduced with offline extraction tests against current main / latest release source.

📋 Changes Summary

  • Normalize the unsupported direct-purchase combination during extraction, before initial hash validation.
  • Add English/German warning and document the fallback.
  • Cover absent/empty options, valid options, disabled direct purchase, retained costs/hash, and defaults that must not leak into the fallback.
  • No dependencies, config defaults, or schema changes.

⚙️ Type of Change

  • 🐞 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (adds new functionality without breaking existing usage)
  • 💥 Breaking change (changes that might break existing user setups, scripts, or configurations)

✅ Checklist

  • I have reviewed my changes to ensure they meet the project's standards.
  • I have tested my changes and ensured that all tests pass (pdm run test: 1,947 passed, 4 skipped; Xvfb, one worker).
  • I have formatted the code (pdm run format).
  • I have verified that linting passes (pdm run lint).
  • I have updated documentation where necessary.

Tests never contact Kleinanzeigen. An earlier concurrent local run had two Node subprocess timeouts; the isolated affected suite (80 tests) and the subsequent complete run both passed.

Manual runtime validation after deployment: both previously failing ads downloaded successfully using the persisted account session (4 and 2 images). Both exported with the documented warning, sell_directly: false, and empty shipping options; no download errors were logged. Account data and ad content are intentionally omitted.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@github-actions github-actions Bot added the bug Something isn't working label Oct 15, 2026
@codecov

codecov Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.16%. Comparing base (bfc646f) to head (d08a393).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1346   +/-   ##
=======================================
  Coverage   92.15%   92.16%           
=======================================
  Files          50       50           
  Lines        7804     7808    +4     
  Branches     1360     1361    +1     
=======================================
+ Hits         7192     7196    +4     
  Misses        401      401           
  Partials      211      211           
Flag Coverage Δ
integration-tests 26.28% <0.00%> (-0.02%) ⬇️
smoke-tests 27.36% <0.00%> (-0.02%) ⬇️
unit-tests 91.07% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/kleinanzeigen_bot/extract.py 95.94% <100.00%> (+0.01%) ⬆️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bfc646f...d08a393. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@1cu
1cu marked this pull request as ready for review October 15, 2026 20:25
@1cu
1cu merged commit e0ba6a1 into Second-Hand-Friends:main Oct 15, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Development

Successfully merging this pull request may close these issues.

2 participants