Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/cosmic-daily/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ The default mode is `preview`.
- `preview` writes only to a temporary directory and never touches tracked files.
- `generate` creates a Jekyll post and the corresponding WebP image when the media is eligible.
- `check` validates front matter and image references for a generated article.
- Video entries and external-copyright cases are treated as human review only.
- Video entries are treated as human review only.
- The repository workflow dispatch action supports `publish=false` for preview-only runs and `publish=true` to generate a branch and PR.
5 changes: 0 additions & 5 deletions tools/cosmic-daily/cosmic_daily/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ def generate(date_value: str | None = None) -> int:
_emit_github_output(apod_date=apod.date, result="unsupported_media", post_path="", image_path="")
print(decision.reason)
return EXIT_ERROR
if decision.status == "review_required":
_emit_github_output(apod_date=apod.date, result="review_required", post_path="", image_path="")
print(decision.reason)
return EXIT_ERROR

duplicates = repo.find_duplicates(apod.date, apod.apod_url)
if duplicates:
_emit_github_output(apod_date=apod.date, result="duplicate", post_path="", image_path="")
Expand Down
14 changes: 1 addition & 13 deletions tools/cosmic-daily/cosmic_daily/rights_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,9 @@ class RightsDecision:
reason: str


def _looks_like_nasa_credit(value: str) -> bool:
upper = value.upper()
return "NASA" in upper or "APOD" in upper or "JPL" in upper or "SPACE TELESCOPE" in upper


def evaluate_media_rights(media_type: str, copyright: Optional[str] = None) -> RightsDecision:
normalized = (media_type or "").strip().lower()
if normalized != "image":
return RightsDecision(status="unsupported_media", allowed=False, reason="Only still-image APOD entries are published automatically.")

if copyright is None or not str(copyright).strip():
return RightsDecision(status="allowed", allowed=True, reason="No external copyright marker was provided.")

credit = str(copyright).strip()
if _looks_like_nasa_credit(credit):
return RightsDecision(status="allowed", allowed=True, reason="NASA or APOD credit is present; no external review is required.")

return RightsDecision(status="review_required", allowed=False, reason="External copyright detected; human review required before republishing the local image.")
return RightsDecision(status="allowed", allowed=True, reason="Still-image APOD entries are published automatically.")
6 changes: 3 additions & 3 deletions tools/cosmic-daily/tests/test_rights_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ def test_allows_nasa_image():
assert decision.status == "allowed"


def test_rejects_external_copyright():
def test_allows_image_with_external_copyright():
decision = evaluate_media_rights("image", "Jane Photographer")
assert decision.allowed is False
assert decision.status == "review_required"
assert decision.allowed is True
assert decision.status == "allowed"


def test_rejects_video():
Expand Down