Skip to content

feat(forge): never reuse a migrated repository's pull request numbers - #335

Merged
tonibergholm-codento merged 2 commits into
mainfrom
feat/forge-pull-floor
Nov 9, 2026
Merged

tonibergholm-codento merged 2 commits into
mainfrom
feat/forge-pull-floor

Conversation

@tonibergholm-codento

Copy link
Copy Markdown
Collaborator

Codento Engine is moving its Project repositories from Gitea to sc-forge (Engine ADR-0080, COD2-7135). sc-forge numbers pull requests from 1 in each repository. Engine still holds .../pulls/N references to old Gitea pull requests, so after the move those numbers would point at new, unrelated pull requests.

This adds a per-repository floor on pull-request numbers:

  • sc-forge admin repo set-pull-floor --owner --name --floor --data-dir sets it, and works while the server runs. The floor only rises.
  • Both allocation paths (pulls::next_number and pulls::insert) number the next pull request one above the larger of the floor and the highest existing number.
  • Schema migration 6 adds repos.pull_floor. A binary older than this one refuses a data directory this one has opened.
  • docs/FORGE-OPERATIONS.md documents the command for migrations.
  • The pulls unit tests now each get their own temp directory. Two tests that started in the same second had shared one.

Proof:

  • A unit test sets the floor to 41 and checks the next number is 42; a later, lower floor changes nothing.
  • An end-to-end test sets the floor on a running server, lowers it, then opens a pull request: it is number 42, and /pulls/1 answers 404.
  • cargo test -p scl-forge passes all 323 tests, and fmt and clippy (-D warnings) are clean.

Not covered: a floor change between choosing a pull request's number and inserting it could leave a stray retention ref until the next sync. Engine sets floors during its write freeze, before any pull request can be created.

Reviewed with sol-loop: 3 rounds with gpt-6.1-sol on high. Sol verdict: approved

Created with Claude Opus 5.5 in T3 Code (Claude Code harness).

sc-forge admin repo set-pull-floor sets a per-repository floor (schema
migration 6); both pull-number allocation paths take the larger of the
floor and the highest existing number, plus one. A repository migrated
from Gitea then never gives out an old number again, so a stored
.../pulls/N answers 404 instead of naming an unrelated pull request
(Codento Engine ADR-0080, COD2-7135).

Also gives each pulls unit test its own temp directory (two tests in one
second shared one).
@coderabbitai

coderabbitai Bot commented Nov 9, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 71ac5989-63b9-4e11-8e61-67598597c306
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T13:48:08.114693Z 739ba62 PR opened
🔒 Security Review ✅ Completed 2026-11-09T13:53:18.521956Z 739ba62 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tonibergholm-codento
tonibergholm-codento merged commit ccb08ea into main Nov 9, 2026
11 checks passed
@tonibergholm-codento
tonibergholm-codento deleted the feat/forge-pull-floor branch November 9, 2026 13:59
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