Skip to content

Dev/gitignore#9

Merged
mccaffers merged 5 commits intodev/improve_code_coveragefrom
dev/gitignore
Apr 6, 2026
Merged

Dev/gitignore#9
mccaffers merged 5 commits intodev/improve_code_coveragefrom
dev/gitignore

Conversation

@mccaffers
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 6, 2026 10:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates local scripts, Xcode project settings, and CI configuration around PostgreSQL/libpq linking and default runtime host, plus ignores the libpqxx submodule directory.

Changes:

  • Switch runtime/test host from a hard-coded IP to localhost (run script + Xcode scheme).
  • Update CI/build scripts to build libpqxx via CMake and adjust linker flags/search paths.
  • Add external/libpqxx to .gitignore.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
scripts/test.sh Simplifies the xcodebuild invocation and leaves prior flags commented out.
scripts/run.sh Defaults the executable’s QuestDB host argument to localhost.
backtesting-engine-cpp.xcodeproj/xcshareddata/xcschemes/source.xcscheme Updates launch argument host to localhost.
backtesting-engine-cpp.xcodeproj/project.pbxproj Adjusts library search paths for libpqxx/PostgreSQL.
.gitignore Ignores external/libpqxx.
.github/workflows/sonarcloud.yml Updates OTHER_LDFLAGS to use brew --prefix ... substitutions.
.github/workflows/build.sh Builds libpqxx with CMake and exports libpq-related env vars.
.github/workflows/brew.sh Tweaks dependency install comments for PostgreSQL/libpq.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread scripts/test.sh
Comment on lines +6 to +9
clean build test
# HEADER_SEARCH_PATHS="./external/libpqxx/include/pqxx/internal ./external/libpqxx/include/ ./external/libpqxx/build/include/ ./external/" \
# LIBRARY_SEARCH_PATHS="./external/libpqxx/src/ ./external/libpqxx/build/src/" \
# OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkgconf)/lib -L$(brew --prefix pkgconf)/lib/pkgconfig -L$(brew --prefix postgresql@18)/lib/postgresql -L$(brew --prefix postgresql@18)/lib/postgresql/pgxs -L$(brew --prefix postgresql@18)/lib/postgresql/pkgconfig" \
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented-out HEADER_SEARCH_PATHS / LIBRARY_SEARCH_PATHS / OTHER_LDFLAGS lines are placed after clean build test, so uncommenting them later won’t affect the xcodebuild invocation (the command already ended). If these are meant to be optional overrides, keep them within the continued xcodebuild command (before clean build test) with the appropriate line continuations.

Suggested change
clean build test
# HEADER_SEARCH_PATHS="./external/libpqxx/include/pqxx/internal ./external/libpqxx/include/ ./external/libpqxx/build/include/ ./external/" \
# LIBRARY_SEARCH_PATHS="./external/libpqxx/src/ ./external/libpqxx/build/src/" \
# OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkgconf)/lib -L$(brew --prefix pkgconf)/lib/pkgconfig -L$(brew --prefix postgresql@18)/lib/postgresql -L$(brew --prefix postgresql@18)/lib/postgresql/pgxs -L$(brew --prefix postgresql@18)/lib/postgresql/pkgconfig" \
# HEADER_SEARCH_PATHS="./external/libpqxx/include/pqxx/internal ./external/libpqxx/include/ ./external/libpqxx/build/include/ ./external/" \
# LIBRARY_SEARCH_PATHS="./external/libpqxx/src/ ./external/libpqxx/build/src/" \
# OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkgconf)/lib -L$(brew --prefix pkgconf)/lib/pkgconfig -L$(brew --prefix postgresql@18)/lib/postgresql -L$(brew --prefix postgresql@18)/lib/postgresql/pgxs -L$(brew --prefix postgresql@18)/lib/postgresql/pkgconfig" \
clean build test

Copilot uses AI. Check for mistakes.
HEADER_SEARCH_PATHS="./external/libpqxx/include/pqxx/internal ./external/libpqxx/include/ ./external/libpqxx/build/include/ ./external/"
LIBRARY_SEARCH_PATHS="./external/libpqxx/src/ ./external/libpqxx/build/src/"
OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L/opt/homebrew/Cellar/pkgconf/2.3.0_1/lib -L/opt/homebrew/Cellar/pkgconf/2.3.0_1/lib/pkgconfig -L/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14 -L/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14/pgxs -L/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14/pkgconfig"
OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkgconf)/lib -L$(brew --prefix pkgconf)/lib/pkgconfig -L$(brew --prefix postgresql@18)/lib/postgresql -L$(brew --prefix postgresql@18)/lib/postgresql/pgxs -L$(brew --prefix postgresql@18)/lib/postgresql/pkgconfig"
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTHER_LDFLAGS uses $(brew --prefix pkgconf) and $(brew --prefix postgresql@18), but this workflow installs pkg-config and postgresql in brew.sh. As-is, brew --prefix pkgconf / brew --prefix postgresql@18 will fail on runners unless those formulas are installed. Either (a) update the prefixes to match installed formulas (pkg-config, postgresql or libpq), or (b) update brew.sh to install pkgconf and postgresql@18 explicitly.

Suggested change
OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkgconf)/lib -L$(brew --prefix pkgconf)/lib/pkgconfig -L$(brew --prefix postgresql@18)/lib/postgresql -L$(brew --prefix postgresql@18)/lib/postgresql/pgxs -L$(brew --prefix postgresql@18)/lib/postgresql/pkgconfig"
OTHER_LDFLAGS="-L./external/libpqxx/build/src -lpqxx -lpq -L$(brew --prefix pkg-config)/lib -L$(brew --prefix pkg-config)/lib/pkgconfig -L$(brew --prefix postgresql)/lib/postgresql -L$(brew --prefix postgresql)/lib/postgresql/pgxs -L$(brew --prefix postgresql)/lib/postgresql/pkgconfig"

Copilot uses AI. Check for mistakes.
Comment on lines +15 to +17
export PATH="$(brew --prefix libpq)/bin:$PATH"
export PKG_CONFIG_PATH="$(brew --prefix libpq)/lib/pkgconfig:$PKG_CONFIG_PATH"
export PostgreSQL_ROOT="$(brew --prefix libpq)"
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script now relies on brew --prefix libpq, but the CI install step (brew.sh) installs postgresql (and not the libpq formula). On a clean runner, brew --prefix libpq will fail unless libpq is installed. Either install libpq in brew.sh (and use its prefix), or switch these exports to use the installed postgresql prefix instead.

Suggested change
export PATH="$(brew --prefix libpq)/bin:$PATH"
export PKG_CONFIG_PATH="$(brew --prefix libpq)/lib/pkgconfig:$PKG_CONFIG_PATH"
export PostgreSQL_ROOT="$(brew --prefix libpq)"
POSTGRESQL_PREFIX="$(brew --prefix postgresql)"
export PATH="$POSTGRESQL_PREFIX/bin:$PATH"
export PKG_CONFIG_PATH="$POSTGRESQL_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
export PostgreSQL_ROOT="$POSTGRESQL_PREFIX"

Copilot uses AI. Check for mistakes.
Comment thread .github/workflows/brew.sh

# Install packages if they don't exist
check_and_install postgresql # Check and install PostgreSQL
check_and_install postgresql # Check and install PostgreSQL (which includes libpq)
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow scripts reference the separate Homebrew libpq formula (e.g., brew --prefix libpq in build.sh). Installing postgresql doesn’t guarantee brew --prefix libpq will work, so CI can still fail unless libpq is installed explicitly (or the other scripts are updated to use postgresql’s prefix).

Suggested change
check_and_install postgresql # Check and install PostgreSQL (which includes libpq)
check_and_install postgresql # Check and install PostgreSQL
check_and_install libpq # Check and install the standalone libpq formula used by other workflow scripts

Copilot uses AI. Check for mistakes.
Comment on lines 3787 to 3790
LIBRARY_SEARCH_PATHS = (
"\"$(SRCROOT)/external/libpqxx/src\"",
"$(SRCROOT)/build/external/libpqxx/src",
"/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14",
"\"$(SRCROOT)/external/libpqxx/build/src\"",
"/opt/homebrew/Cellar/postgresql@18/18.3/lib/postgresql",
);
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hard-codes a Homebrew Cellar path to postgresql@18/18.3, which is machine- and version-specific and will break for anyone without that exact installation. Prefer using a stable path via build settings (e.g., $(shell brew --prefix ...) in a script-driven xcconfig, or linking against libpq via pkg-config) rather than committing a Cellar versioned path into the project.

Copilot uses AI. Check for mistakes.
Comment on lines 3809 to 3812
LIBRARY_SEARCH_PATHS = (
"\"$(SRCROOT)/external/libpqxx/src\"",
"$(SRCROOT)/build/external/libpqxx/src",
"/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14",
"\"$(SRCROOT)/external/libpqxx/build/src\"",
"/opt/homebrew/Cellar/postgresql@18/18.3/lib/postgresql",
);
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This build configuration hard-codes a Homebrew Cellar path for postgresql@18/18.3, which isn’t portable across machines/CI and will break on version bumps. Use a stable prefix (Homebrew opt path / brew --prefix ...) or pkg-config-driven linking instead of committing a versioned Cellar path.

Copilot uses AI. Check for mistakes.
Comment on lines 3831 to 3834
LIBRARY_SEARCH_PATHS = (
"\"$(SRCROOT)/external/libpqxx/src\"",
"$(PROJECT_DIR)/build/external/libpqxx/src",
"/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14",
"\"$(SRCROOT)/external/libpqxx/build/src\"",
"/opt/homebrew/Cellar/postgresql@18/18.3/lib/postgresql",
);
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LIBRARY_SEARCH_PATHS includes a versioned Homebrew Cellar path (/opt/homebrew/Cellar/postgresql@18/18.3/...). That path will differ across developer machines and will change on upgrades, making the project brittle. Prefer referencing a stable prefix (e.g., Homebrew opt symlink) or resolving via pkg-config/xcconfig rather than a Cellar version path.

Copilot uses AI. Check for mistakes.
"$(PROJECT_DIR)/build/external/libpqxx/src",
"/opt/homebrew/Cellar/postgresql@14/14.15/lib/postgresql@14",
"\"$(SRCROOT)/external/libpqxx/build/src\"",
"/opt/homebrew/Cellar/postgresql@18/18.3/lib/postgresql",
Copy link

Copilot AI Apr 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coding /opt/homebrew/Cellar/postgresql@18/18.3/... into LIBRARY_SEARCH_PATHS ties the project to one specific Homebrew install/version. This is likely to break in CI and for other developers. Use a stable opt path (or brew --prefix resolved via an xcconfig/script) or pkg-config to locate libpq instead.

Suggested change
"/opt/homebrew/Cellar/postgresql@18/18.3/lib/postgresql",
"/opt/homebrew/opt/postgresql@18/lib/postgresql",

Copilot uses AI. Check for mistakes.
@mccaffers mccaffers merged commit 0f69def into dev/improve_code_coverage Apr 6, 2026
6 of 8 checks passed
@mccaffers mccaffers deleted the dev/gitignore branch April 6, 2026 11:02
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