Skip to content

feat: list online account ads - #1321

Merged
1cu merged 3 commits into
Second-Hand-Friends:mainfrom
Pommel4711:feat/list-online-ads
Oct 6, 2026
Merged

1cu merged 3 commits into
Second-Hand-Friends:mainfrom
Pommel4711:feat/list-online-ads

Conversation

@Pommel4711

@Pommel4711 Pommel4711 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

ℹ️ Description

Add a list command to inspect the authenticated account's online ads, including IDs, titles, status and expiry dates. It fetches account pages without loading local ad definitions or modifying listings.

Split from #1309 as the independent online-listing feature. No separate issue.

📋 Changes Summary

  • Register and dispatch list, and document it in CLI help and README.
  • Fetch all account pages in strict mode so incomplete or malformed pagination produces an error instead of a partial listing.
  • Render translated labels/status and handle missing optional fields; close the browser session on success or failure.
  • Use English gettext source text and honor an explicitly requested help language, addressing the CodeRabbit comment in feat: add online listings and configurable publishing #1309.
  • Include the explicit-return and test-subclass fixes for the two CodeQL comments from feat: add online listings and configurable publishing #1309.

No dependencies on the other contributions and no new project dependencies.

⚙️ Type of Change

  • 🐞 Bug fix
  • ✨ New feature
  • 💥 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 the changed behavior with targeted standalone checks and the combined-series pdm run test described below.
  • I have formatted the code (pdm run format).
  • I have verified that linting passes (pdm run lint).
  • I have updated documentation where necessary.

Standalone pdm run format and pdm run lint pass. Listing, CLI and translation tests pass: 60 tests. The generated schema, default configuration and README verification passes.

Full combined-series validation on upstream main e4bca13 with Python 3.12 and Windows/Edge: pdm run format, pdm run lint, pdm run test and generated-artifact verification pass; 1,976 tests passed, 2 skipped, 93.81% coverage. This full-suite evidence belongs to the integration of all seven contributions. Standalone targeted evidence for this PR is listed above. Browser fixtures and account responses are local or mocked; tests do not contact Kleinanzeigen.

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

Summary by CodeRabbit

  • New Features
    • Added a list command to view online ads with their ID, title, status, and expiry date. The command does not download or modify listings or local ad files.
    • Added localized output in English and German, including messages for empty lists.
    • The command reports an error if it cannot retrieve the complete listing.

@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: Second-Hand-Friends/kleinanzeigen-bot/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 5cab50cc-45de-4f19-a3d6-fb31b0dd9a61
📥 Commits

Reviewing files that changed from the base of the PR and between e4bca13 and 6e2d679.

📒 Files selected for processing (7)
  • README.md
  • src/kleinanzeigen_bot/app.py
  • src/kleinanzeigen_bot/cli.py
  • src/kleinanzeigen_bot/published_ads.py
  • src/kleinanzeigen_bot/resources/translations.de.yaml
  • src/kleinanzeigen_bot/runtime_config.py
  • tests/unit/test_list_command.py

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.


📝 Walkthrough

Walkthrough

The list command fetches published ads and displays their IDs, titles, statuses, and expiry dates. The change adds localized help and output, documents the command, and tests listing, rendering, and incomplete-fetch behavior.

Changes

Online listing

Layer / File(s) Summary
Published ad rendering
src/kleinanzeigen_bot/published_ads.py, src/kleinanzeigen_bot/resources/translations.de.yaml, tests/unit/test_list_command.py
Rendering now localizes known ad states and column headings. It displays placeholders for missing fields and a message when the account has no ads. Tests cover empty results, optional fields, unknown states, and German labels.
List command flow
src/kleinanzeigen_bot/runtime_config.py, src/kleinanzeigen_bot/app.py, src/kleinanzeigen_bot/cli.py, src/kleinanzeigen_bot/resources/translations.de.yaml, README.md, tests/unit/test_list_command.py
The CLI recognizes list, fetches published ads through a logged-in browser, and prints the rendered output. Help text uses the requested language and restores the previous locale. Documentation and tests cover command parsing, successful pagination, cleanup, and incomplete-fetch errors.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: 1cu

Merge Risk: ⚪ Minimal · up to 6e2d6

The online listing command appears ready to merge after normal checks; no actionable issue remains identified.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 6e2d6

The command reuses existing account permissions and browser cleanup without modifying listings. Remaining uncertainty concerns how remote text is displayed and whether exceptional pagination responses can produce an incomplete listing.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The newly exposed data path is bounded to the account represented by the existing browser/login context, its listing data, and the operator's output destination. The handler adds no account selector or alternate credential destination.

Trust Boundaries and Controls

  • observed — Production listing authenticates through the existing login flow before fetching account pages. FakeListBot's authenticated-session and GET assertions model expected behavior but are not production authorization controls.
  • observed — The new renderer writes remote account fields without terminal escaping. Existing deletion logging already emits some matched remote titles, but list expands routine display to all returned entries. Upstream acceptance of control characters and an independently attacker-controlled account-data path were not established, so this is not retained as a verified vulnerability.

Resilience and Maintainability Implications

  • observed — Run centrally owns browser cleanup through finally, covering handler success, login failure, fetch failure, and cancellation unwinding. Shared cleanup clears browser references and includes cancellation-aware process cleanup. This is existing production behavior reused by list, not merely a fake-session assertion.

Hardening Proposals

  • proposed — Consider rendering terminal-control characters in remote fields as visible escaped text. This would make the output boundary independent of upstream text filtering; it is a hardening proposal, not a demonstrated exploit.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding a command to list online account ads.
Docstring Coverage ✅ Passed Docstring coverage is 92.31% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 26 functions across 5 files. (2 skipped: 2 …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the enhancement New feature or request label Oct 5, 2026
@codecov

codecov Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.18%. Comparing base (e4bca13) to head (6e2d679).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1321      +/-   ##
==========================================
+ Coverage   92.15%   92.18%   +0.03%     
==========================================
  Files          50       50              
  Lines        7546     7579      +33     
  Branches     1304     1322      +18     
==========================================
+ Hits         6954     6987      +33     
+ Misses        392      391       -1     
- Partials      200      201       +1     
Flag Coverage Δ
integration-tests 23.81% <15.15%> (-0.04%) ⬇️
smoke-tests 27.94% <33.33%> (+0.01%) ⬆️
unit-tests 91.77% <100.00%> (+0.03%) ⬆️

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

Files with missing lines Coverage Δ
src/kleinanzeigen_bot/app.py 81.84% <100.00%> (+0.42%) ⬆️
src/kleinanzeigen_bot/cli.py 98.24% <100.00%> (-1.15%) ⬇️
src/kleinanzeigen_bot/published_ads.py 89.17% <100.00%> (+1.40%) ⬆️
src/kleinanzeigen_bot/runtime_config.py 87.59% <ø> (ø)

... and 2 files with indirect coverage changes


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 e4bca13...6e2d679. 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 merged commit ab79e10 into Second-Hand-Friends:main Oct 6, 2026
22 checks passed
1cu added a commit that referenced this pull request Oct 6, 2026
## ℹ️ Description

Follow-up to #1321. The CLI help text is the one place that keeps a
complete English and a complete German text block in the code, so `list`
belongs into both blocks instead of using a gettext lookup with a
temporary locale switch. Related issue: none.

## 📋 Changes Summary

- Write the `list` help line literally into the English and German
blocks of `help_text()` and drop the locale switch and the `help_text`
entry in `translations.de.yaml`.
- Replace the locale-preservation test with a simple check of the `list`
line per language.
- Document the exception for the CLI help text in `CONTRIBUTING.md`.

No dependencies or configuration 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)

Refactoring only, no user-visible change: the help output is identical.

## ✅ Checklist

- [x] I have reviewed my changes to ensure they meet the project's
standards.
- [x] I have tested my changes and ensured that all tests pass (`pdm run
utest` locally, the full suite runs in CI).
- [x] I have formatted the code (`pdm run format`).
- [x] I have verified that linting passes (`pdm run lint`).
- [x] I have updated documentation where necessary.

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


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* CLI help now displays the complete English or German text for the
`list` command, regardless of the currently active language setting.
* **Documentation**
* Updated translation guidance to clarify that CLI help text should
include complete English and German wording.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

2 participants