Skip to content

manage poll's ensureManagedPrRow drops apiBaseUrl, mis-scoping managed-PR queue rows across forge hosts #6764

Description

@JSONbored

Context

packages/loopover-miner/lib/manage-poll.js:108-116 (ensureManagedPrRow) enqueues { repoFullName, identifier, priority: 0 } with no apiBaseUrl, which portfolio-queue.js's normalizeApiBaseUrl silently defaults to DEFAULT_FORGE_CONFIG.apiBaseUrl (github.com). The same recordManagePollSnapshot function correctly threads apiBaseUrl into the real GitHub poll two lines away. portfolio-queue.js's own #5563 migration comment states the composite (api_base_url, repo_full_name, identifier) primary key exists specifically so two hosts serving the same owner/repo name never collide — this write path violates that invariant. listQueue(repoFullName)'s "already exists" check is also forge-blind (no api_base_url filter), so a same-named repo+PR-number tracked on two hosts can suppress row creation for the second host. test/unit/miner-manage-poll.test.ts has zero references to apiBaseUrl.

Requirements

  • Thread options.apiBaseUrl from recordManagePollSnapshot into ensureManagedPrRow, and pass it to portfolioQueue.enqueue({ ..., apiBaseUrl }).
  • Scope the "already exists" check to the same forge host, not just repoFullName.

Deliverables

  • apiBaseUrl threaded through ensureManagedPrRow
  • Forge-scoped existence check
  • Regression test polling a non-default apiBaseUrl and asserting the resulting queue row is scoped to that host

Test Coverage Requirements

99%+ Codecov patch coverage on every changed line and branch, plus a regression test that reproduces the exact failure mode described above and asserts it's fixed.

Expected Outcome

A managed PR on a non-default forge host gets a correctly-scoped portfolio-queue row, matching the CI poll's own forge scoping.

Links & Resources

packages/loopover-miner/lib/manage-poll.js:108-116,141-159, packages/loopover-miner/lib/portfolio-queue.js:51-55,108-112.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions