Skip to content

AI uses for records

Minimal safe software change data from 1,305 PostgreSQL back-patches

By SourceX Editorial · Updated

10 sections

Short answer

Minimal safe software change data pairs a problem with the smallest change accepted as fixing it under stated constraints, next to the fuller fix, plus evidence on whether it held. In 1,305 PostgreSQL changes back-patched in 2024 and 2025, 43.4 percent reached the oldest branch as a different patch, and those adapted fixes drew a follow-up commit within 90 days twice as often, 20.8 against 10.1 percent.

Agent run

Minimal safe software change

This page covers minimal safe software change data from 1,305 PostgreSQL back-patches.Illustrative

Key takeaways

  • The smallest diff is not the target: record the constraint, the narrow fix, the fuller fix and a later signal on whether the narrow one held.
  • Of 1,305 PostgreSQL back-patches from 2024-2025, 566 reached the oldest branch as a different patch: 224 smaller, 86 larger.
  • Adapted fixes drew a follow-up within 90 days in 20.8 percent of cases against 10.1 percent, and the gap held within every size and reach band.
  • Safer can mean bigger: preserving an interface made some back-branch fixes larger, as in an ABI-preserving wrapper that doubled a patch.
  • Tests get trimmed on old branches: 29 changes carried a test on master and none on the oldest branch, so a pass is a weak label.

What is minimal safe software change data?

It is a record that pairs a software problem with the smallest change a maintainer accepted as fixing it under stated constraints, next to the fuller fix where one exists, plus evidence on whether the smaller change held. The smallest diff is not the target. A two-line patch that silently changes behavior elsewhere is not minimal in any useful sense, and a patch that grows to protect an interface can be the safer choice.

Three things make such a record usable for AI work. The constraint has to be written down, because "keep the interface stable" and "no storage format change" are what force a fix to be small. The rejected wider option has to be visible, so a model can see what was traded away. And there has to be a later signal, such as a follow-up commit, a revert or silence over a fixed window, that says whether the narrow change was enough.

Most engineering systems keep the diff and the closed ticket and lose the other three. Public projects that maintain stable release branches are an exception, which is why this article uses one of them as its test bed.

Why stable branches keep the best record of engineering restraint

Because a stable branch is where a project promises users that an upgrade will not hurt, the same bug often gets fixed twice: fully in development, and as narrowly as possible in the released lines. PostgreSQL's versioning policy says its minor releases only contain fixes for frequently-encountered bugs, low-risk fixes, security issues and data corruption problems. The Linux kernel writes the same restraint into its stable rules, which say a patch must already exist upstream, must be obviously correct and tested, and "cannot be bigger than 100 lines, with context."

That double fixing produces matched pairs: one problem, two accepted solutions, each shaped by different constraints. PostgreSQL applies back-patches as separate commits on each release branch rather than merges, and its own changelog tool, src/tools/git_changelog, groups them by treating commits on different branches as one change when they have the same author and an identical log message and land within 24 hours of each other. This article applies that rule exactly, so the pairs it counts are the ones the project's own release-note tooling would group together.

PostgreSQL also writes reasoning into its commit messages, and sometimes says why the back branches got something different. That reasoning is the part most company repositories lose.

What 1,305 PostgreSQL back-patches show about cut-down fixes

Most back-patches travel unchanged, but more than four in ten reach the oldest branch as a different patch, and those adapted fixes are where the record says the most. We read every commit on PostgreSQL's master branch committed in 2024 and 2025, 5,539 in all, and matched each to commits on the release branches REL_12_STABLE through REL_19_STABLE. Of the 5,539, 1,305 (23.6 percent) had at least one back-branch counterpart under the project's matching rule. A looser rule, same author and subject line within 30 days, found 1,328.

For each back-patched change, the comparison is between the master commit and its counterpart on the oldest branch it reached. Of 1,305, 739 (56.6 percent) arrived there as the same patch, judged by git's patch-id, which ignores line numbers and whitespace. The other 566 (43.4 percent) were adapted: 224 smaller than on master, 86 larger and 256 of equal size but different content. Adapted changes were bigger to begin with, a median of 38 changed lines on master against 10 for the unchanged ones, and the oldest-branch versions came to a median of 30.5. They also reached more branches: 69.1 percent went to four or more release lines, against 28.7 percent of unchanged patches.

The table sets the two groups side by side. Percentages are of each group's own count, and a follow-up is a later commit within 90 days that cites the change's hash:

What 1,305 PostgreSQL back-patches show about cut-down fixes
MeasureSame patch on oldest branchAdapted on oldest branchAll back-patched changes
Changes7395661,305
Median changed lines, master then oldest branch10 then 1038 then 30.517 then 16
Message names ABI or API12 (1.6%)36 (6.4%)48 (3.7%)
Touches a test file, master then oldest branch26.1% then 26.1%45.9% then 40.8%34.7% then 32.5%
Any follow-up within 90 days75 (10.1%)118 (20.8%)193 (14.8%)
Follow-up needed only on release branches9 (1.2%)34 (6.0%)43 (3.3%)

Three commits that spell out the smaller change, and one where safer meant bigger

The clearest records name the constraint, the narrow fix and the wider fix left for development. In April 2025, commit 459e7bf8e2f8 removed a bitmap heap scan optimization on master that could return too many rows after a concurrent vacuum, a change of 146 lines. The REL_13_STABLE version, commit b9ec8125d167, is 15 lines: it leaves the optimization's code in place and disables it. The message gives the reason: "We can't perform API/ABI changes in the backbranches and we want to make the change as minimal as possible."

Sometimes the restraint runs the other way, with the narrow fix everywhere and the cleanup kept for development. Commit 7504d2be9eb4, from September 2025, adds one line so that GROUP BY DISTINCT is no longer ignored in PL/pgSQL assignment statements. The message says the deeper fix is to merge two copies of parsing logic, then adds: "But that seems useful only in master, so let's use this one-line fix for the back branches." The record keeps both options and the scope decision between them.

The third case shows why fewest lines is the wrong target. Commit 6ee3261e9bb6, from March 2024, fixes a crash with SQL-language procedures by adding an argument to an internal function: 40 lines on master. On REL_12_STABLE, commit dc1503d5b8b3 runs to 84 lines, because, in the message's words, the back branches "convert check_sql_fn_retval into an ABI-preserving wrapper around a new function check_sql_fn_retval_ext." External code that calls the old function keeps working. That is the safe change, and it is the bigger one: of the 36 adapted changes whose messages name ABI or API, 17 shrank on the oldest branch, 11 grew and 8 stayed the same size.

Do cut-down fixes hold? Follow-ups within 90 days

Most do, but adapted fixes draw follow-ups about twice as often as unchanged ones, and the gap holds within every size and reach band. Within 90 days, 10.1 percent of unchanged back-patches were cited by a later commit, against 20.8 percent of adapted ones. Follow-ups needed only on release branches, the cleanest sign that the back-branch version itself fell short, came to 1.2 percent against 6.0 percent.

Two records show what such a follow-up looks like. Commit 274bbced8538 disabled all TLS session tickets and was back-patched to v12 on 26 July 2024; the same day, commit e6dd0b8637b3 and its siblings on v12 to v16 said the back-patch "omitted the required changes for the MSVC build system in v16 through v12," a build system those older branches still carry, and credited a buildfarm machine with catching it. In February 2024, a change to skip .DS_Store files in server utilities was reverted the same day on v12 through v14 only, "Per failure reports from the buildfarm," while newer branches kept it.

Adapted fixes are not proof that adapting causes trouble: they are larger, touch older code and reach more branches, and each of those raises the odds of a second commit. Splitting by size and by reach does not make the gap disappear: adapted fixes draw more follow-ups in every band, though the difference is small for changes of 20 lines or fewer. The follow-ups come to 754 commits, but 421 of them are back-patched copies of master commits on release branches; counting each change once, whether it landed on master or only on a release branch, leaves 333 distinct follow-up changes. Of those, 237 changed code, 46 were reverts, 34 changed only tests and 16 changed only documentation. The rates by band, unchanged against adapted:

Do cut-down fixes hold? Follow-ups within 90 days
BandSame patch: any follow-upAdapted: any follow-up
Reached 1 release branch45 of 378 (11.9%)12 of 65 (18.5%)
Reached 2 or 3 release branches14 of 149 (9.4%)16 of 110 (14.5%)
Reached 4 or more release branches16 of 212 (7.5%)90 of 391 (23.0%)
Master change of 20 lines or fewer37 of 488 (7.6%)19 of 207 (9.2%)
Master change of 21 to 100 lines29 of 195 (14.9%)48 of 221 (21.7%)
Master change over 100 lines9 of 56 (16.1%)51 of 138 (37.0%)
Paired horizontal bars comparing PostgreSQL back-patches that reached the oldest branch unchanged with adapted ones: 739 against 566 changes, follow-ups within 90 days of 10.1 against 20.8 percent, release-branch-only follow-ups of 1.2 against 6.0 percent, and follow-up rates of 7.5 against 23.0 percent for changes reaching four or more branches.
Unchanged against adapted back-patches in PostgreSQL, changes committed to master in 2024-2025. Source: postgres/postgres git history, counted October 27, 2026.

Passing tests is a weak label for a minimal fix

A green test run says a change did what its tests check, not that it did nothing else, and the PostgreSQL record shows tests themselves get trimmed on old branches. Of the 566 adapted changes, 260 touched a test file on master and 231 on the oldest branch; 29 changes carried a test on master and none on the oldest branch, and no change gained one. Messages sometimes say why, such as a test that relies on infrastructure only newer branches have. A record that keeps only the oldest-branch commit would show 29 fixes with no test evidence at all.

Research on coding agents points the same way. In a 2025 arXiv study of patches that passed SWE-bench Verified's checks, the authors compared each patch's behavior with the developer's fix and found that 29.6 percent of plausible patches behaved differently; among those, 27.3 percent changed more behavior than the developer's fix. A patch can pass every test and still be wider than the problem.

So the useful label for a minimal change is behavioral, not just a pass: the accepted narrow fix, what it leaves untouched, and whether a later commit had to widen, repair or withdraw it. Closing the issue settles none of those, and neither does the business question behind the bug. If customers kept hitting the problem, the evidence lives in support and incident records, not in the repository.

The minimal-change decision trace: fields a usable record needs

Nine fields turn a back-patch into a minimal-change case a model can learn from or be graded on. PostgreSQL's public record supplies most of them for free; a company's record has to be assembled from version control, review, CI, release and incident systems. The trace below lists each field, where the public record keeps it, and what a company record should add:

At a glance

The minimal-change decision trace: fields a usable record needs

The minimal-change decision trace: fields a usable record needs
FieldWhat it recordsWhere PostgreSQL keeps itWhat a company record adds
ProblemThe failure and how it was foundCommit message, linked mailing-list threadTicket, incident or customer report that started it
ConstraintsWhat may not change: interfaces, storage format, supported versionsMessage text on ABI, API or branch limitsWritten release policy and the approver who applied it
Full fixThe change made where constraints are looserMaster commitMain-branch pull request and its review
Narrow fix per branchThe change shipped to each released lineMatched commit on each release branchHotfix and maintenance branch commits
Patch identityWhether each branch got the same patchgit patch-id across branchesSame, plus cherry-pick or backport bot metadata
Test evidenceTests added or kept on each branch, and why any were droppedTest files in each commitCI runs per branch with results
Scope decisionHow far back the fix went and why not furtherBackpatch-through trailer and messageSupport-window policy and customer versions affected
Follow-upsLater commits that repair, widen or revert the fixLater commits citing its hashReopened tickets, incidents and hotfix-of-hotfix records
Release and outcomeWhen it shipped and whether the problem stoppedMinor release notesDeployment records and post-release support volume

Outcome rubric: six ways a minimal change can end

Six labels cover how a narrow fix ends, each with an evidence rule that keeps the label checkable. Fix the window before labeling, 90 days here, and label from the record rather than from memory; a case whose window has not closed stays open, not held.

The labels, in the order a reviewer should test them:

  • Reverted everywhere: a later commit reverts the fix on every branch it reached. Evidence: revert commits citing the fix.
  • Withdrawn from older branches: reverted on some release branches and kept on newer ones. Evidence: branch-only reverts, as in the .DS_Store case.
  • Repaired on release branches: a branch-only commit fixes the back-branch version. Evidence: a branch commit citing the fix with no matching master commit.
  • Widened later: a follow-up on master extends the fix and is back-patched too. Evidence: a matched follow-up on the same branches.
  • Held as cut: no commit cites the fix within the window. Evidence: the window's full commit log, searched for the hash.
  • Open: the window has not closed, or the branch went out of support first. Evidence: dates, not silence.

How a buyer would use minimal-change records, and what private histories add

Matched pairs make three kinds of AI work possible that single fixes do not. For training, a pair is a contrastive example: same problem, one fix under loose constraints and one under tight ones, with the constraint stated. For evaluation, a task can give a model the bug, the branch and the written constraint, then grade its patch against the accepted narrow fix on behavior and scope, not on test passage alone. For reward design, the follow-up label gives a delayed signal that penalizes patches a maintainer later had to repair.

Public pairs have limits a buyer should price in. They come from projects whose histories may already sit in training data, so evaluation sets need cases dated after the model's cutoff. They cover infrastructure software with strong release discipline, not the hotfix habits of a product company. And they rarely link a fix to the customer outcome behind it.

Company histories fill those gaps when they keep the fields above: maintenance branches with their own commits, approvals for exceptions to a release policy, CI results per branch, and the incident or support records that show whether the problem stopped. Rights and security review come first, because commit messages and tickets can carry customer names and exploitable detail. Datasets sourced through SourceX are found on request rather than held in stock; a request that names the constraint types, the follow-up window and the acceptance test gives a supplier enough to judge whether its history holds the pairs.

Methods note: repository, matching rules and limits

Data: the GitHub copy of PostgreSQL's repository, postgres/postgres, cloned bare on 27 October 2026 with history from 1 September 2023, master at commit 227de22 and release branches REL_12_STABLE through REL_19_STABLE. The script reads git metadata and diffs only. Window: master commits whose committer date falls from 1 January 2024 up to, not including, 1 January 2026 (UTC). Branch commits count only if not reachable from master. Strict match, the git_changelog rule: same author email, identical full message after trailing whitespace is stripped, committer dates less than 24 hours apart compared in exact seconds, at most one commit per branch, closest in time wins.

Size is lines added plus deleted from git numstat (no binary files occurred). Same patch means identical git patch-id --stable output. A test file is a path starting src/test/ or containing a t, sql, expected or specs directory. A follow-up is a later commit, more than 0 and at most 90 days after the fix in exact seconds, whose message holds a whole-word lowercase hex token of 7 to 40 characters that prefixes the fix's master hash or a counterpart hash. A release-branch-only follow-up is a branch commit with no strict master counterpart; 8 of the 51 changes with one had only follow-ups whose subject matched a master follow-up, and they are excluded from the 43. ABI or API means either word, case-sensitive and whole. Medians ending in .5 are reported as computed. Shares are computed from integer counts and rounded once.

Not measured: whether any fix was correct, customer impact, release timing, mailing-list discussion, and commits that cite a fix without its hash. The matching rule misses back-patches with edited messages or committed more than a day apart. Scripts and outputs (no author names or emails) are kept in the writer's scratch folder for recount: bin/pg_backpatch.py, pg_backpatch_v2.py (which also counts back-patched copies of follow-ups), pg_groups.py, pg_followup_check.py and pg_followup_kinds.py.

Frequently asked questions

What is a minimal safe change in software?

The smallest change a maintainer accepts as fixing a problem without breaking what must stay stable, such as an interface or a storage format. It is not always the fewest lines: preserving compatibility can make the safe version larger than the full fix.

Why use back-patches to study minimal changes?

A back-patch fixes the same bug again under tighter rules, so the development fix and the stable-branch fix form a matched pair. Projects like PostgreSQL also write in the commit message why the older branches got something different.

How often are PostgreSQL back-patches changed for older branches?

Of 1,305 changes back-patched from master in 2024 and 2025, 566 (43.4 percent) reached the oldest branch as a different patch by git patch-id. Of those, 224 were smaller, 86 larger and 256 the same size with different content.

Do smaller back-branch fixes need more follow-up work?

In PostgreSQL's 2024-2025 history, adapted back-patches were cited by a later commit within 90 days about twice as often as unchanged ones. They were also larger and reached more branches, so the pattern is an association, not proof that adapting causes problems.

What should a company record to build minimal-change data?

The problem and its trigger, the constraint that limited the fix, the full and narrow fixes per branch, test evidence on each branch, how far back the fix went and why, and any later commit that repaired, widened or reverted it, plus whether the customer problem stopped.

Sources

  • PostgreSQL's git history at master commit 227de22 (October 27, 2026) supplies every back-patch, size, test and follow-up count in this article. Source
  • PostgreSQL's git_changelog tool merges commits on different branches that share an author and an identical log message within 24 hours. Source
  • A PostgreSQL commit of April 2, 2025 removes the skip_fetch optimization on master and disables it in back branches to avoid API or ABI changes. Source
  • A PostgreSQL commit of September 27, 2025 uses a one-line fix for the back branches and keeps a refactor for master. Source
  • A PostgreSQL commit of March 12, 2024 converts a function into an ABI-preserving wrapper in the back branches. Source
  • A PostgreSQL commit of July 26, 2024 adds MSVC build changes that a back-patched TLS fix omitted in v16 through v12. Source
  • PostgreSQL's versioning policy says minor releases only contain fixes for frequently-encountered bugs, low-risk fixes, security issues and data corruption problems. Source
  • The Linux kernel's stable rules require a patch to exist upstream, be obviously correct and tested, and be no bigger than 100 lines with context. Source
  • A 2025 study found 29.6 percent of plausible SWE-bench Verified patches behave differently from the developer's fix, 27.3 percent of those by changing more behavior. Source

Tell us what data you need

Share scope, volume, format, timing and licensing needs. Datasets are sourced on request.

See if your company qualifies