Skip to content

Migrate 3 more REES analyzers onto boundedFetchText #4824

Description

@JSONbored

Context

Discovered while implementing #4759 (PR #4821) — deliberately not bundled into that PR to keep it
scoped to exactly the 3 files #4759 named. Non-urgent, mechanical follow-up.

The problem

review-enrichment/src/analyzers/undocumented-export.ts, unused-export.ts, and caller-impact.ts
each still hand-roll their own private "fetch a repo file's content at a ref, bounded/streamed read
capped at 1MB" helper (readBoundedText + a fetchFileAtHead-style wrapper) — the same pattern
doc-comment-drift.ts, exhaustiveness-drift.ts, and complexity-delta.ts had before #4759/PR #4821
migrated them onto the shared boundedFetchText utility (review-enrichment/src/external-fetch.ts).

undocumented-export.ts additionally hand-builds its own GitHub auth headers inline
(Authorization: Bearer ${githubToken} etc.) instead of using the shared githubHeaders() helper
(review-enrichment/src/github-headers.ts) — the same inconsistency doc-comment-drift.ts had before
#4759. unused-export.ts and caller-impact.ts already use githubHeaders(), just not
boundedFetchText yet.

Fix

Follow the exact same playbook #4759/PR #4821 used:

  1. Read review-enrichment/src/analyzers/duplication-delta.ts first — its fetchFileAtHead is the
    reference implementation for calling boundedFetchText (including the options.analysis?.fetchText
    vs. direct boundedFetchText fallback and the endpointCategory/phase/subcall conventions).
  2. Delete each of the 3 files' own private readBoundedText entirely (not relocate it) and replace their
    fetch-helper with a fetchFileAtHead-style wrapper that calls boundedFetchText /
    options.analysis.fetchText.
  3. Switch undocumented-export.ts to the shared githubHeaders() helper.
  4. Verify byte-identical behavior for all three via their existing test suites in review-enrichment/test/
    — continuing to pass unchanged (mechanical mocking updates allowed if needed to match
    boundedFetchText's calling convention, mirroring duplication-delta.test.ts's own mocking style).

No new shared module — this is a pure migration onto infrastructure that already exists.

Acceptance criteria

  • undocumented-export.ts, unused-export.ts, and caller-impact.ts all call boundedFetchText
    (or options.analysis.fetchText) instead of their own private bounded-read logic.
  • undocumented-export.ts uses the shared githubHeaders() helper instead of hand-built auth headers.
  • No new shared module created.
  • All three files' existing test suites pass unchanged (or with only mechanical mocking updates).
  • Small, focused PR — these 3 files + their tests only.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

maintainer-onlyOwner-only work — yields no Gittensor points.

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions