Skip to content

Robust rec collection - #17

Merged
NHagar merged 3 commits into
masterfrom
robust-rec-collection
Nov 3, 2025
Merged

Robust rec collection#17
NHagar merged 3 commits into
masterfrom
robust-rec-collection

Conversation

@NHagar

Copy link
Copy Markdown
Owner

Uses search endpoint to grab newsletter ID, rather than pulling most recent post (prone to 404s)

@NHagar
NHagar requested a review from CopilotNovember 3, 2025 01:01

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds code coverage tooling and refactors the get_recommendations() method to resolve publication IDs without requiring posts. The main changes include adding pytest-cov as a development dependency and implementing a new _resolve_publication_id() method that queries Substack's discovery API directly.

  • Added pytest-cov for test coverage measurement
  • Refactored get_recommendations() to use discovery API search instead of fetching posts
  • Added comprehensive test coverage for the new resolution logic and edge cases

Reviewed Changes

Copilot reviewed 3 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
pyproject.tomlAdded pytest-cov>=7.0.0 to dev dependencies
uv.lockUpdated lock file with coverage and pytest-cov packages
.gitignoreAdded coverage-related files to gitignore
substack_api/newsletter.pyImplemented publication ID resolution via discovery API with helper functions
tests/test_newsletter.pyAdded extensive test coverage for new functionality and edge cases
Comments suppressed due to low confidence (1)

substack_api/newsletter.py:273

  • The module 'substack_api.newsletter' imports itself.
 from .newsletter import Newsletter # avoid circular import

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadsubstack_api/newsletter.py
Comment threadsubstack_api/newsletter.py Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@NHagar
NHagar merged commit 35acb4d into masterNov 3, 2025
2 checks passed
@NHagar
NHagar deleted the robust-rec-collection branch November 3, 2025 01:05
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@NHagar