Skip to content

Commit 4b7692d

Browse files
committed
fix: address gemini-code-assist 3rd review on PR #1
Type precision: - schema.Item.source_kind is now Literal["rss", "github"] instead of bare str, matching the comment and actual usage. Robustness: - report.render now escapes both `[` and `]` in titles (previously only `]`), so titles like "[CVE-2026-xxx]" cannot collide with markdown link parsing. - normalize.normalize: narrow the two bare `except Exception` blocks to `(OSError, json.JSONDecodeError)` so genuine bugs surface instead of being swallowed. - collect_github._get: narrow the fallback `except Exception` to `(URLError, TimeoutError, json.JSONDecodeError)` (HTTPError is still caught separately above). Reproducibility: - requirements.txt and requirements-dev.txt now pin exact versions with `==`. Dependabot continues to PR upgrades, but a fresh checkout + `pip install -r ...` now resolves to a known-good set. Config / docs: - tracks/iam/config/sources.yaml: drop `spiffe/spiffe` (verified via GitHub API: repo exists but has zero releases — it's the specs tree, not a release surface). - README.md: remove the duplicate 3-bullet "CI" section that the new CI table superseded. Regenerated today's seed reports under tracks/*/reports/ so they match the new formatter output (extra `\[` escape would only matter on titles containing `[`, but regen keeps the committed sample byte- identical to what CI would produce now).
1 parent a14a5b7 commit 4b7692d

8 files changed

Lines changed: 19 additions & 21 deletions

File tree

README.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ tracks/<name>/
4545
web/ # Astro 6 + Tailwind v4 + recharts (React island)
4646
```
4747

48-
## CI
49-
50-
- Daily at 06:00 UTC: `make update` for every track in parallel; raw / normalized / scored / daily.md get committed.
51-
- Monday at 08:00 UTC: `make weekly` generates the weekly digest.
52-
- Push to `main`: `web/` is rebuilt and deployed to Pages.
53-
5448
## Local
5549

5650
```bash

requirements-dev.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
pytest>=8.3.0
2-
pytest-cov>=6.0.0
3-
ruff>=0.8.0
4-
pip-audit>=2.7.0
5-
pip-licenses>=5.0.0
1+
pytest==9.0.3
2+
pytest-cov==7.1.0
3+
ruff==0.15.13
4+
pip-audit==2.10.0
5+
pip-licenses==5.5.5

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
feedparser>=6.0.11
2-
PyYAML>=6.0.2
1+
feedparser==6.0.12
2+
PyYAML==6.0.3

scripts/awsdd/collect_github.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import json
66
import os
77
from datetime import UTC, datetime
8-
from urllib.error import HTTPError
8+
from urllib.error import HTTPError, URLError
99
from urllib.request import Request, urlopen
1010

1111
from .config import load_sources, track_dir
@@ -38,7 +38,7 @@ def _get(path: str) -> list[dict]:
3838
except HTTPError as e:
3939
print(f"[collect_github] {path}: HTTP {e.code}")
4040
return []
41-
except Exception as e:
41+
except (URLError, TimeoutError, json.JSONDecodeError) as e:
4242
print(f"[collect_github] {path}: error {e}")
4343
return []
4444

scripts/awsdd/normalize.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def normalize(track: str) -> None:
1515
try:
1616
for it in json.loads(out.read_text()):
1717
by_id[it["id"]] = it
18-
except Exception as e:
18+
except (OSError, json.JSONDecodeError) as e:
1919
print(f"[normalize] existing normalized.json unreadable: {e}")
2020

2121
if raw_dir.exists():
@@ -29,7 +29,7 @@ def normalize(track: str) -> None:
2929
prev.get("fetched_at", it["fetched_at"]), it["fetched_at"]
3030
)
3131
by_id[it["id"]] = it
32-
except Exception as e:
32+
except (OSError, json.JSONDecodeError) as e:
3333
print(f"[normalize] {path.name}: {e}")
3434

3535
items = sorted(by_id.values(), key=lambda x: x.get("published_at", ""), reverse=True)

scripts/awsdd/report.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ def render(track: str, mode: str) -> None:
7272
lines.append(f"## {kind.upper()}")
7373
lines.append("")
7474
for it in g:
75-
title = (it.get("title") or "(untitled)").replace("]", r"\]")
75+
# escape both brackets so titles like "[CVE-...] thing" don't
76+
# collide with markdown link parsing
77+
title = (it.get("title") or "(untitled)").replace("[", r"\[").replace("]", r"\]")
7678
url = it.get("url", "")
7779
src = it.get("source", "")
7880
pub = (it.get("published_at") or "")[:10]

scripts/awsdd/schema.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
from __future__ import annotations
22

33
from dataclasses import asdict, dataclass, field
4-
from typing import Any
4+
from typing import Any, Literal
5+
6+
SourceKind = Literal["rss", "github"]
57

68

79
@dataclass
810
class Item:
911
id: str
1012
track: str
1113
source: str # e.g. "rss:aws-security-blog"
12-
source_kind: str # "rss" | "github"
14+
source_kind: SourceKind
1315
url: str
1416
title: str
1517
summary: str

tracks/iam/config/sources.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ github:
4747
- repo: kubernetes-sigs/aws-iam-authenticator
4848
- repo: aws/rolesanywhere-credential-helper
4949
- repo: spiffe/spire
50-
- repo: spiffe/spiffe
50+
# spiffe/spiffe is the specs repo with no GitHub releases; drop until it has any.

0 commit comments

Comments
 (0)