Skip to content

Refactor scoring hygiene and profile constants#178

Merged
saagpatel merged 3 commits into
mainfrom
codex/integration-scoring-hygiene
Jul 14, 2026
Merged

Refactor scoring hygiene and profile constants#178
saagpatel merged 3 commits into
mainfrom
codex/integration-scoring-hygiene

Conversation

@saagpatel

Copy link
Copy Markdown
Owner

Stack 1/7. Isolates scoring-weight single sourcing and profile-driven thresholds. Merge with a merge commit to preserve ancestry for the dependent stack.

…ng constants

- Delete dead .weight class attributes from all analyzers; scorer.WEIGHTS
  is the single source of truth. New tests/test_scoring_weights.py asserts
  weights sum to 1.0, match the composed dimension set, and introspects
  analyzer modules so a dead weight attr cannot be silently reintroduced.
- Remove dead path_confidence parameter from build_risk_entry (accepted,
  never read) and its call sites.
- Make STALE_THRESHOLD_DAYS, GRADE_THRESHOLDS, COMPLETENESS_TIERS
  overridable via reserved scoring-profile keys; ScoringProfile carries
  overrides alongside flat weights so existing custom_weights callers and
  shipped profiles are byte-identical.
- Label the unscored description dimension via display_dimension() on
  operator-facing render surfaces; data fields keep raw dimension slugs.
@saagpatel saagpatel marked this pull request as ready for review July 14, 2026 03:57
Comment thread src/report_enrichment.py Fixed


def test_analyzer_classes_do_not_declare_dead_weight_attributes() -> None:
import src.analyzers as analyzers_package

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed31350321

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/scorer.py
Comment on lines +82 to +86
completeness_tiers = [
tuple(tier) for tier in profile.get("completeness_tiers", COMPLETENESS_TIERS)
]
grade_thresholds = [
tuple(threshold) for threshold in profile.get("grade_thresholds", GRADE_THRESHOLDS)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Propagate profile constants to reports

When a scoring profile includes completeness_tiers or grade_thresholds, the scorer now assigns tiers/grades from those overrides here, but the generated guidance still uses hard-coded defaults: src/report_enrichment.py keeps its own COMPLETENESS_THRESHOLDS, and src/excel_export.py::_build_score_explainer always feeds the default GRADE_THRESHOLDS/COMPLETENESS_TIERS into the workbook. Under a stricter profile, a repo can be graded/tiered one way while the Markdown briefing and Score Explainer describe a different threshold contract, which makes the derived reports misleading.

Useful? React with 👍 / 👎.

Comment thread src/scorer.py
if metadata.pushed_at:
days_since = (datetime.now(timezone.utc) - metadata.pushed_at).days
if days_since > STALE_THRESHOLD_DAYS:
if days_since > stale_threshold_days:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep stale flags aligned with profile threshold

When stale_threshold_days is overridden by a scoring profile, this condition no longer means “older than two years,” but the emitted flag remains stale-2yr on the next line. For example, a profile that sets the stale threshold to 30 days will label a 31-day-old repo as stale-2yr in JSON/workbook/report outputs, which misstates freshness in exactly the operator surfaces that consume these flags.

Useful? React with 👍 / 👎.

Comment thread src/scorer.py
Comment on lines +9 to +12
from src.scoring_dimensions import (
UNSCORED_DIMENSIONS as UNSCORED_DIMENSIONS,
display_dimension as display_dimension,
)
@saagpatel saagpatel merged commit 57d1692 into main Jul 14, 2026
4 checks passed
Sign up for free to 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