fix(miner): scope run-state by forge host, not bare repoFullName - #5585
Merged
Conversation
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 | 742f5ed | Commit Preview URL Branch Preview URL |
Jul 13 2026, 07:27 AM |
4 tasks
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 "current discover/plan/prepare state" row. Rebuild the constraint to PRIMARY KEY (api_base_url, repo_full_name), backfilling existing rows with the pre-#4784 implicit default. The migration uses INSERT OR IGNORE so a pre-existing row with an already-invalid state (this store's read path already fails closed on those) can't abort the whole rebuild. Thread an optional apiBaseUrl through the store's API (getRunState/ setRunState) and the admin CLI (--api-base-url on state get/set). Every existing caller is unaffected: apiBaseUrl defaults to https://api.github.com when omitted. manage-status.js's collectRunPortfolio folds run state into one row per repo NAME (not per host) for its dashboard view -- documented in-code as a known, safe (no data loss, read-only) display limitation for the narrow case of the same repo name existing on two hosts, rather than silently patched over; broadening that fold to be host-aware is a separate, larger dashboard-shape change. Advances #5563 (run-state.js of 5 affected stores; claim-ledger.js landed in #5576, portfolio-queue.js in #5583).
JSONbored
force-pushed
the
forge-scope-run-state
branch
from
July 13, 2026 07:25
281da94 to
742f5ed
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5585 +/- ##
=======================================
Coverage 94.99% 94.99%
=======================================
Files 573 573
Lines 45490 45512 +22
Branches 14680 14680
=======================================
+ Hits 43212 43235 +23
+ Misses 1527 1526 -1
Partials 751 751
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
This was referenced Jul 13, 2026
JSONbored
added a commit
that referenced
this pull request
Jul 13, 2026
… repoFullName (#5591) 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).
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
run-state.js'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 "current discover/plan/prepare state" row.PRIMARY KEY (api_base_url, repo_full_name), backfilling existing rows with the pre-De-hardcode discovery from gittensory's own conventions #4784 implicit defaulthttps://api.github.com. The migration usesINSERT OR IGNOREso a pre-existing row with an already-invalidstate(this store's own read path already fails closed on those, per an existing test) can't abort the whole rebuild.apiBaseUrlthrough the store's API (getRunState/setRunState) and the admin CLI (--api-base-urlonstate get/state set).apiBaseUrldefaults tohttps://api.github.comwhen omitted.manage-status.js'scollectRunPortfoliofolds run state into one row per repo name (not per host) for its dashboard view — documented in-code as a known, safe (no data loss, read-only) display limitation for the narrow case of the same repo name existing on two hosts, rather than silently patched over.Third of 5 stores from #5563 (
claim-ledger.jslanded in #5576,portfolio-queue.jsin #5583;governor-state.js's reputation table anddeny-hook-synthesis.jsfollow).Test plan
npx vitest run test/unit/miner-run-state.test.ts test/unit/miner-cli-run-state.test.ts test/unit/miner-manage-status.test.ts test/unit/miner-migrate-cli.test.ts test/unit/miner-loop-cli.test.ts— all passing, including a migration test (pre-existing on-disk file upgrades and preserves rows) and cross-host coexistence regression testsstatevalue (rejected by the rebuilt table'sCHECKconstraint) — fixed withINSERT OR IGNORE, consistent with the store's existing fail-closed read behavior for the same corrupt-data casenpx tsc --noEmitcleannpm run build:minercleannpm run test:coverage(full, unsharded) — 15817/15829 passing (12 pre-existing skips), 100% patch coverage on touched lines/branchesnpm audit --audit-level=moderate— 0 vulnerabilities