fix(miner): scope governor_reputation_history by forge host, not bare repoFullName - #5591
Merged
Merged
Conversation
… repoFullName repo_full_name TEXT PRIMARY KEY let two forge hosts (github.com vs. a GitHub Enterprise host, #4784) serving a same-named owner/repo share one reputation-history row. Rebuild the constraint to PRIMARY KEY (api_base_url, repo_full_name), following governor-state.js's existing idempotent-ALTER convention (ensurePauseColumns) rather than introducing the applySchemaMigrations framework into this file for the first time -- a full PRIMARY KEY rebuild still needs the create-new/copy/ drop/rename dance, just gated by a column-presence check instead of a version stamp. Uses INSERT OR IGNORE for the copy step (a corrupted legacy row violating the rebuilt table's NOT NULL columns is dropped, not a migration-aborting crash), regression-tested the same way as run-state.js's #5563 fix. Threads an optional apiBaseUrl through loadReputationHistory/ saveReputationHistory. loadReputationHistory/saveReputationHistory have no real callers yet (attempt-runner.js's own comments note this governor input isn't wired into the attempt pipeline yet), so there is no CLI surface or call site to thread through -- this is purely the storage-layer fix, mirroring openClaimLedgerReadOnly's scaffold-only precedent. Advances #5563 (governor_reputation_history of 5 affected stores; claim-ledger.js landed in #5576, portfolio-queue.js in #5583, run-state.js in #5585; deny-hook-synthesis.js remains).
Contributor
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
loopover-ui | 1d869b6 | Commit Preview URL Branch Preview URL |
Jul 13 2026, 07:37 AM |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5591 +/- ##
=======================================
Coverage 95.01% 95.01%
=======================================
Files 573 573
Lines 45534 45547 +13
Branches 14680 14680
=======================================
+ Hits 43263 43278 +15
+ Misses 1520 1518 -2
Partials 751 751
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
6 tasks
5 tasks
JSONbored
added a commit
that referenced
this pull request
Jul 13, 2026
…re repoFullName (#5595) deny_rule_proposals' PRIMARY KEY (repo_full_name, id) let two forge hosts (github.com vs. a GitHub Enterprise host, #4784) serving a same-named owner/repo share one proposal row (and its maintainer approval decision). Rebuild the constraint to PRIMARY KEY (api_base_url, repo_full_name, id). This file has no schema-version framework of its own (unlike the package's other local stores) -- it uses a raw DatabaseSync connection, no applySchemaMigrations. Follows governor-state.js's idempotent column-presence-gated rebuild convention instead of introducing a new framework dependency here for the first time. Uses INSERT OR IGNORE for the copy step, matching the fix already applied to every other #5563 migration in this epic: a legacy row with an already-invalid status value (this store's own CHECK-constrained schema already rejects those) is dropped, not a migration-aborting crash. Threads an optional apiBaseUrl through refreshProposals/listProposals/ setProposalStatus/resolveEffectiveRules. initDenyHookSynthesisStore has no real callers yet (feeds the consumption surface #2343 will eventually wire into evaluateDenyHooks; this store owns derivation + audit, not live hook interception), so there is no CLI surface or call site to thread through -- purely the storage-layer fix, mirroring governor_reputation_history's scaffold-only precedent. Closes #5563 (5th and final store: claim-ledger.js in #5576, portfolio-queue.js in #5583, run-state.js in #5585, governor-state.js in #5591, plus the claimNextBatch/migration hardening follow-up in #5594).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
governor_reputation_history'srepo_full_name TEXT PRIMARY KEYlet two forge hosts (github.com vs. a GitHub Enterprise host, De-hardcode discovery from gittensory's own conventions #4784) serving a same-namedowner/reposhare one reputation-history row.PRIMARY KEY (api_base_url, repo_full_name), followinggovernor-state.js's existing idempotent-ALTER convention (ensurePauseColumns) rather than introducing theapplySchemaMigrationsframework into this file for the first time.INSERT OR IGNOREfor the copy step (a corrupted legacy row violating the rebuilt table'sNOT NULLcolumns is dropped, not a migration-aborting crash), regression-tested the same way asrun-state.js's Scope local ledger keys by forge host, not bare repoFullName #5563 fix in fix(miner): scope run-state by forge host, not bare repoFullName #5585.apiBaseUrlthroughloadReputationHistory/saveReputationHistory. These have no real callers yet (attempt-runner.js's own comments note this governor input isn't wired into the attempt pipeline yet), so there's no CLI surface or call site to thread through — this is purely the storage-layer fix, mirroringopenClaimLedgerReadOnly's scaffold-only precedent.Fourth of 5 stores from #5563 (
claim-ledger.jsin #5576,portfolio-queue.jsin #5583,run-state.jsin #5585;deny-hook-synthesis.jsremains).Test plan
npx vitest run test/unit/miner-governor-state.test.ts— 34/34 passing, including a migration test, a cross-host coexistence test, an idempotent-reopen test, and a regression test provingINSERT OR IGNOREdrops a corrupted legacy row instead of crashing the migration (mutation-tested: reverted the fix, confirmed the new test fails with the expected constraint error, restored and reconfirmed green)npx tsc --noEmitclean