Skip to content

fix(release): extract postgresql-win before repairing its layout - #204

Closed
jasdeepkhalsa wants to merge 1 commit into
masterfrom
claude/fix-win-libpq-extract
Closed

jasdeepkhalsa wants to merge 1 commit into
masterfrom
claude/fix-win-libpq-extract

Conversation

@jasdeepkhalsa

Copy link
Copy Markdown
Member

Follow-up to #203, which fixed the right thing in the wrong place.

What happened

#203 applied the layout repair straight after spc download — but download only fetches archives. Extraction into source/ happens during build. So the repair never ran, and the guard fired on a directory that did not exist yet:

::error::libpq.lib not found under source\postgresql-win\pgsql\lib

That is the guard working correctly. It failed the build rather than letting a driverless binary through, which is what #197's smoke test would otherwise have caught one step later.

The fix

Run spc extract postgresql-win first, so there is something to repair.

The later build does not undo it. SourceManager::initSource skips extraction when the source directory exists and its .spc-hash matches — and that hash is over the downloaded archive, so adding a directory alongside does not invalidate it:

if (file_exists("{$check}/.spc-hash") && FileSystem::readFile("{$check}/.spc-hash") === $hash) {
    logger()->debug("Source [{$source}] already extracted in {$check}, skip !");
    continue;
}

Everything else is unchanged: junctions rather than copies, so the workaround costs nothing and becomes a no-op if SPC fixes the stripped path, and the build still fails loudly with a directory listing if libpq.lib is missing.

Status of the dry run

3.0.0-rc.10 currently builds 8 of 9 targets cleanly — PHAR, both macOS, all four Linux variants, and the npm dry-run publish. win32-x64 is the only one outstanding.

🤖 Generated with Claude Code

The previous attempt put the fix straight after `spc download` and it never
ran, because `download` only fetches archives — extraction into source/
happens during `build`. So the check found nothing and failed the job:

  ::error::libpq.lib not found under source\postgresql-win\pgsql\lib

which was the guard doing its job, on a directory that did not exist yet.

`spc extract postgresql-win` runs first, giving somewhere to apply the fix.
The later `build` does not undo it: SourceManager skips extraction when the
source directory exists and its .spc-hash matches the archive hash, and that
hash is over the downloaded archive, so adding a directory does not
invalidate it.

The rest is unchanged — junctions rather than copies, so the workaround costs
nothing and disappears if SPC fixes the stripped path, and the build still
fails loudly with a directory listing if libpq.lib is missing.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added bug postgres Related to Postgres labels Sep 4, 2026
@sonarqubecloud

sonarqubecloud Bot commented Sep 4, 2026

Copy link
Copy Markdown

@jasdeepkhalsa

Copy link
Copy Markdown
Member Author

Folded into #206 rather than merged separately.

Splitting these was a mistake, and the reason is concrete: #206's Windows job carries this libpq workaround inline so it can build at all, while the release workflows only got it from here. Neither pull request was complete on its own — merging them in the wrong order would have left the release workflows broken while CI looked green.

#206 now contains both, so the job that builds a Windows binary on every pull request is exercising the same fix the release uses. The branch has been merged into claude/win-binary-check with history preserved, so the commits from here are not lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug postgres Related to Postgres

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant