Relevance score can reach 1.0, outside the documented [0, 1)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 64/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python, typescript
調査の方向性
Read src/selfgraph/_maintenance.py and typescript/src/maintenance.ts, then compare their rounding behavior with the [0, 1) contract in docs/maintenance.md. Reproduce the issue using the values in the report and check how prune(min_relevance=1) behaves. Done means the score and prune behavior match the chosen documented range in both SDKs.
索引モデルが issue の本文から書いたものです。
説明
docs/maintenance.md says "A score lies in [0, 1)", but relevance_score returns exactly 1.0 once the signal is large and the item is fresh.
Tested at 5a277c9 (current main).
Reproduce
from datetime import datetime, timezone
from selfgraph._maintenance import relevance_score
t = datetime(2020, 1, 1, tzinfo=timezone.utc)
relevance_score([t], t, 30, 999_998) # 0.999999
relevance_score([t], t, 0.25, 999_999_999) # 1.0
relevanceScore in typescript/src/maintenance.ts uses the same formula and returns the same 1.
Cause
src/selfgraph/_maintenance.py:68 computes recency * (1 + frequency) / 2 and rounds half up to six decimals. With recency at or near 1 and frequency = signal / (signal + 1) at or above 0.999999 (a signal of about one million or more), the unrounded value is at least 0.9999995, and rounding takes it to 1.0. The signal is the source count plus, for an entity, its degree, so a heavily linked hub entity scored right after a write reaches it.
Impact
prune(min_relevance=...) accepts a threshold up to 1 and removes items whose relevance is below it. With the documented range, min_relevance=1 matches every scored item; in practice an item scored 1.0 is kept. Anything else that relies on the documented upper bound is affected the same way in both SDKs.
Suggested fix
Either cap the rounded score below 1 (for example min(score, 0.999999)) in both SDKs, or change the docs to [0, 1] and the prune description to match.
- 主要言語
- TypeScript
- スター
- 173
- フォーク
- 58
- 平均マージ
- 6時間
- マージ済み PR(30日)
- 120
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hydra-db/selfgraph のほかの issue
-
approved-for-pr area: cli-mcp area: errors bug effort: S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
hydra-db/selfgraph#401 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
approved-for-pr area: errors area: store bug effort: S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
hydra-db/selfgraph#398 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
approved-for-pr area: errors area: write bug effort: S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
hydra-db/selfgraph#392 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
approved-for-pr area: parity area: write bug effort: S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
hydra-db/selfgraph#391 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
hydra-db/selfgraph の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
code-yeongyu/senpi#7139 ·
メンテナーはふだん 1 日以内に返信
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
難易度 1/5 1〜3時間 初心者へのやさしさ 72/100
lingdojo/kana-dojo#34395 · コメント 1 件 · リアクション 5 件 ·
メンテナーはふだん 1 日以内に返信
-
bug status: needs triage
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
mastra-ai/mastra#31093 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
area:web p2 product:business triage:active type:bug
難易度 1/5 1時間未満 初心者へのやさしさ 89/100
cuadrao-ai/argus#2328 ·
メンテナーはふだん 1 日以内に返信
-
bug frontend good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
nikhilb2/simple_invoicing#907 ·