Skip to content

feat(installer)!: find PostgreSQL by its service, not EDB keys - #26

Merged
mrcsin merged 1 commit into
masterfrom
setup-without-registry
Oct 28, 2026
Merged

mrcsin merged 1 commit into
masterfrom
setup-without-registry

Conversation

@mrcsin

@mrcsin mrcsin commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Problem

Setup found the PostgreSQL it configures through EDB's HKLM\SOFTWARE\PostgreSQL registration. A server installed without EDB was invisible to it, and the registry had dead-end states of its own: an incomplete or orphaned registration and a registered port nothing answered on.

Change

  • New read-only command semibase engine --expected-major 17 (internal/engine): reads the Windows service list with query-only rights, keeps the services whose command line runs pg_ctl.exe runservice -D <data>, and prints the state as key=value lines.
  • Facts per service: the major from PG_VERSION (the pre-10 N.M form included), the configured port from -o, postgresql.auto.conf, then postgresql.conf with its includes, the listening port from postmaster.pid.
  • States: found, fresh, ambiguous, incomplete, unreadable, port-mismatch, other-major. Installer/SemiBase.iss maps each to a page or a refusal; a configuration error never leads to "remove PostgreSQL". A service of another major beside the 17 does not stop Setup.
  • Setup reads no registry key (grep -cF 'SOFTWARE\PostgreSQL' Installer/SemiBase.iss is 0, 3 on master) and no longer passes --superuser.
  • README, AGENTS.md and docs/architecture describe the service-list detection; the plan is archived in docs/plans/completed/.

Breaking: the superuser is postgres on every machine, and a PostgreSQL that runs with no Windows service is outside what Setup configures.

Verification

  • CI installer job: every state built with fake services, each refusal and detail line asserted (run 40541188107 on the last code commit, all three jobs green).
  • On the development machine, unelevated: semibase engine --expected-major 17 prints state=found, postgresql-x64-17, port 5432, with postgresql-14 running beside it.
  • Manual GUI run of the built setup on that machine: provisioned postgresql-x64-17 with no restart; the site log ends with Done: site completed against localhost:5432/scada_archive.

The readable server error text in the site log is a separate PR from branch decode-server-errors.

Per-task commits before collapse
c0235c1 docs(plans): make the registry check non-vacuous
5a1482f docs(plans): record the exec run and its checks
631b411 fix(engine): read a pre-10 PG_VERSION major
823e5a8 refactor(installer): trim comments the code states
a396b5d refactor(installer): address code smell findings
76111e7 fix(installer): address review findings
a02f28e docs(installer): describe the service-list detection
bdf41af docs(installer): describe the service-list detection
7ba62e9 docs(plans): record the acceptance evidence
0e33fdc ci(installer): drop the reject case's hba reload
4ad79f8 ci(installer): keep the reject probe's stderr in the log
6989b37 feat(installer): read semibase engine, not the registry
99458ba feat(cli): add the engine command
b9adaf3 feat(engine): enumerate pg_ctl services read-only
bf43f8b feat(engine): add service facts and classification
74e092f docs(plans): add the setup-without-registry plan

🤖 Generated with Claude Code

Setup found the PostgreSQL it configures through EDB's
HKLM\SOFTWARE\PostgreSQL registration. A server installed without EDB
was invisible to it, and the registry had states of its own that led
nowhere: an incomplete or orphaned registration and a registered port
nothing answered on.

Setup now runs a new read-only command, semibase engine, which reads
the Windows service list with query-only rights and keeps the services
whose command line runs pg_ctl.exe runservice -D <data>. Everything else
follows from that line and the data folder: the major from PG_VERSION
(the N.M form before 10 included), the configured port from -o, then
postgresql.auto.conf, then postgresql.conf with its includes, and the
listening port from postmaster.pid. It classifies the machine as found,
fresh, ambiguous, incomplete, unreadable, port-mismatch or other-major,
and Setup maps each to a page or a refusal that never sends the reader
to uninstall a server whose only fault is its configuration. A service
of another major beside the 17 does not stop it.

Two limits come with it: the superuser is postgres on every machine,
and a server whose administrator has another name, or a PostgreSQL that
runs with no Windows service, is outside what Setup configures.

The CI installer job builds every state with fake services and asserts
each refusal and its detail line.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@mrcsin
mrcsin force-pushed the setup-without-registry branch from c12baac to e57474e Compare October 28, 2026 08:38
@mrcsin mrcsin changed the title feat(installer): find PostgreSQL through the service list feat(installer)!: find PostgreSQL by its service, not EDB keys Oct 28, 2026
@mrcsin
mrcsin marked this pull request as ready for review October 28, 2026 08:40
@mrcsin
mrcsin merged commit 01b6fde into master Oct 28, 2026
3 checks passed
@mrcsin
mrcsin deleted the setup-without-registry branch October 28, 2026 08:46
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.

1 participant