Skip to content
Closed
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
4 changes: 4 additions & 0 deletions .jules/bolt.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@
## 2024-07-30 - Avoid chained string replace when checking character sets
**Learning:** Using chained `.replace(a, "").replace(b, "")` to check if a string consists entirely of specific characters requires intermediate string allocations for every call. In benchmarks, using `.strip("ab")` is ~30% faster and avoids multiple allocations in the hot path.
**Action:** When checking if a string is solely composed of specific characters, use `.strip(chars)` instead of chained `.replace()` calls to improve performance.

## 2026-07-29 - Avoid unnecessary string allocations with strip()
**Learning:** Checking for visible text by stripping a string and checking truthiness (e.g., `bool(text.strip())`) unnecessarily allocates a new string object when it contains whitespaces.
Comment on lines +67 to +68

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

제목 다음에 빈 줄을 추가해 주세요.

## 2026-07-29... 제목 바로 다음에 **Learning:**이 이어져 MD022 위반이 발생합니다. 제목과 본문 사이에 빈 줄을 넣어 주세요.

🧰 Tools
🪛 markdownlint-cli2 (0.23.1)

[warning] 67-67: Headings should be surrounded by blank lines
Expected: 1; Actual: 0; Below

(MD022, blanks-around-headings)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.jules/bolt.md around lines 67 - 68, Insert a blank line between the dated
Markdown heading and the following **Learning:** paragraph in .jules/bolt.md,
preserving the existing heading and content.

Source: Linters/SAST tools

**Action:** Use `.isspace()` combined with a truthiness check (e.g., `bool(text) and not text.isspace()`) to avoid intermediate allocations and speed up text processing.
4 changes: 4 additions & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@
# invoking the project build script, so forcing a non-root USER breaks fuzz CI.
# Revisit by 2026-10-31 or when ClusterFuzzLite supports non-root build output.
DS-0002

# CVE-2026-61632 applies to pymdown-extensions via mkdocs-material in uv.lock. The dependency cannot be updated because there is no patched version available yet.
# Revisit by 2026-10-31 or when pymdown-extensions releases a patch.
CVE-2026-61632
4 changes: 2 additions & 2 deletions src/newsdom_api/equivalence.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ def _article_has_headline(article: dict[str, Any]) -> bool:
return headline_present

headline = article.get("headline")
# ⚡ Bolt: Early truthiness return to avoid allocating a stripped string when it is empty
return isinstance(headline, str) and bool(headline) and bool(headline.strip())
# ⚡ Bolt: Early truthiness return and .isspace() check to avoid allocating a stripped string when checking for visible text
return isinstance(headline, str) and bool(headline) and not headline.isspace()
Comment on lines +24 to +25

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

주석의 “Early truthiness return” 표현을 수정해 주세요.

이 코드는 조기 반환이 아니라 bool(headline)을 조건식에 결합한 truthiness 검사입니다. “Early truthiness check”처럼 실제 구현을 정확히 설명하도록 바꾸는 편이 좋습니다.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/newsdom_api/equivalence.py` around lines 24 - 25, Update the comment
immediately above the return expression in the headline validation logic to
describe bool(headline) as an “Early truthiness check,” not an early return.
Keep the implementation unchanged and accurately reflect the combined truthiness
and isspace checks.



def _process_articles(metrics: dict[str, Any], articles: list[Any]) -> None:
Expand Down
Loading
Loading