FinceptTerminal is a modern finance application offering advanced market analytics, investment research, and economic data tools, designed for interactive exploration and data-driven decision-making in a user-friendly environment.
C++ ai-agentsalgorithmic-tradingbloomberg-terminalcppfinancefinancial-marketsfintechgood-first-issueinvestmentinvestment-researchmachine-learningopensourcepythonqtquantitative-financestock-markettrading
v4.0.2
tilakpatel2272806d533373
diff --git a/.github/workflows/build-cpp.yml b/.github/workflows/build-cpp.ymlindex 007193e04..c72ac99f4 100644--- a/.github/workflows/build-cpp.yml+++ b/.github/workflows/build-cpp.yml@@ -502,49 +502,117 @@ jobs:echo "=== dist/ contents ($(find dist -type f | wc -l) files) ==="find dist -type f | sort- # ---- Package: macOS (macdeployqt) ----- # Note: upload-artifact strips execute bits (zip limitation).- # We tar the dist/ contents so permissions are preserved on download.- # macdeployqt (copies ~300MB of Qt frameworks) only runs on tag builds;- # push/workflow_dispatch builds skip it to save ~3-5 minutes per job.+ # ---- Package: macOS ----+ # Order is critical (see issue #139): Python.framework + resources must+ # be placed INSIDE the .app BEFORE macdeployqt / codesign run. If we+ # copy them as siblings of the .app (old behavior) the bundle can't find+ # them at runtime; if we embed after signing, dyld on macOS 14+ kills+ # the process with SIGKILL (Code Signature Invalid).+ #+ # On tag / workflow_dispatch: full stage -> macdeployqt -> deep ad-hoc+ # codesign -> verify. On push builds: stage + skip macdeployqt/codesign+ # (saves ~3-5 min; the resulting bundle won't run on stock macOS but is+ # fine as a CI artifact for inspection).+ #+ # upload-artifact strips execute bits (zip limitation) so we tar dist/.- name: Package (macOS)if: runner.os == 'macOS'working-directory: fincept-qtrun: |+ set -euo pipefailmkdir -p distMACDEPLOYQT="${QT_ROOT_DIR}/bin/macdeployqt"- APP="build/${{ matrix.exe }}.app"IS_TAG="${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }}"- if [ -d "$APP" ]; then- # .app bundle exists — run macdeployqt only on tag builds- if [ "$IS_TAG" = "true" ]; then- "$MACDEPLOYQT" "$APP" 2>/dev/null || true- fi- cp -r "$APP" dist/++ # ── Locate or synthesize .app bundle ──────────────────────────────+ if [ -d "build/${{ matrix.exe }}.app" ]; then+ APP_BUNDLE="build/${{ matrix.exe }}.app"else- # Plain binary — create a minimal .app bundle manually- BUNDLE="dist/${{ matrix.exe }}.app"- mkdir -p "$BUNDLE/Contents/MacOS"- cp "build/${{ matrix.exe }}" "$BUNDLE/Contents/MacOS/${{ matrix.exe }}"- chmod +x "$BUNDLE/Contents/MacOS/${{ matrix.exe }}"- cat > "$BUNDLE/Contents/Info.plist" <<'PLIST'+ APP_BUNDLE="build/${{ matrix.exe }}.app"+ mkdir -p "${APP_BUNDLE}/Contents/MacOS"+ cp "build/${{ matrix.exe }}" "${APP_BUNDLE}/Contents/MacOS/${{ matrix.exe }}"+ chmod +x "${APP_BUNDLE}/Contents/MacOS/${{ matrix.exe }}"+ cat > "${APP_BUNDLE}/Contents/Info.plist" <<'PLIST'<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>CFBundleExecutable</key><string>FinceptTerminal</string>- <key>CFBundleIdentifier</key><string>in.fincept.terminal</string>+ <key>CFBundleIdentifier</key><string>com.fincept.terminal</string><key>CFBundleName</key><string>FinceptTerminal</string><key>CFBundlePackageType</key><string>APPL</string>- <key>CFBundleShortVersionString</key><string>4.0.1</string>+ <key>CFBundleShortVersionString</key><string>4.0.2</string>+ <key>CFBundleVersion</key><string>4.0.2</string>+ <key>LSMinimumSystemVersion</key><string>13.0</string><key>NSHighResolutionCapable</key><true/></dict></plist>PLIST- if [ "$IS_TAG" = "true" ]; then- "$MACDEPLOYQT" "$BUNDLE" 2>/dev/null || true+ fi++ # ── Stage resources INSIDE the bundle (not as siblings) ───────────+ mkdir -p "${APP_BUNDLE}/Contents/Resources"+ cp -r resources "${APP_BUNDLE}/Contents/Resources/" 2>/dev/null || true+ cp -r scripts "${APP_BUNDLE}/Contents/Resources/scripts" 2>/dev/null || true++ # ── Embed Python.framework (tag builds only — skip on push) ───────+ if [ "$IS_TAG" = "true" ]; then+ PY_FRAMEWORK=""+ for candidate in \+ "/Library/Frameworks/Python.framework" \+ "$(brew --prefix [email protected] 2>/dev/null)/Frameworks/Python.framework" \+ "$(brew --prefix python3 2>/dev/null)/Frameworks/Python.framework"; do+ [ -d "${candidate}/Versions" ] && { PY_FRAMEWORK="${candidate}"; break; }+ done+ BUNDLE_FRAMEWORKS="${APP_BUNDLE}/Contents/Frameworks"+ mkdir -p "${BUNDLE_FRAMEWORKS}"+ if [ -n "${PY_FRAMEWORK}" ]; then+ echo "Embedding Python.framework from: ${PY_FRAMEWORK}"+ rsync -a --copy-unsafe-links "${PY_FRAMEWORK}/" "${BUNDLE_FRAMEWORKS}/Python.framework/" 2>/dev/null || \+ cp -R "${PY_FRAMEWORK}" "${BUNDLE_FRAMEWORKS}/" 2>/dev/null || true+ find "${BUNDLE_FRAMEWORKS}/Python.framework" -name "PrivateHeaders" -type l \+ ! -exec test -e {} \; -delete 2>/dev/null || true+ PY_VER="$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')"+ ln -sf "../Frameworks/Python.framework/Versions/${PY_VER}/bin/python${PY_VER}" \+ "${APP_BUNDLE}/Contents/MacOS/python3" 2>/dev/null || true+ else+ echo "::warning::Python.framework not found — bundle will rely on system python"fifi- cp -r resources dist/resources 2>/dev/null || true- cp -r scripts dist/scripts 2>/dev/null || true++ # ── Run macdeployqt on the fully staged bundle (tag builds only) ──+ if [ "$IS_TAG" = "true" ] && [ -x "$MACDEPLOYQT" ]; then+ echo "Running macdeployqt on ${APP_BUNDLE}"+ "$MACDEPLOYQT" "${APP_BUNDLE}" -verbose=1 || \+ echo "::warning::macdeployqt exited non-zero — continuing to codesign"+ fi++ # ── Deep ad-hoc codesign (tag builds only) — fix for issue #139 ───+ # Strip every signature leaf-to-root, then re-sign whole bundle with+ # the ad-hoc identity ("-"). Do NOT pass --preserve-metadata: there+ # are no prior entitlements to preserve on a fresh bundle and the+ # flag errors out on resource-fork detritus left by macdeployqt.+ if [ "$IS_TAG" = "true" ]; then+ echo "Stripping existing signatures..."+ find "${APP_BUNDLE}" -type f \( -name "*.dylib" -o -name "*.so" -o -perm +111 \) 2>/dev/null | \+ while read -r f; do+ if file "$f" 2>/dev/null | grep -q "Mach-O"; then+ codesign --remove-signature "$f" 2>/dev/null || true+ fi+ done+ codesign --remove-signature "${APP_BUNDLE}" 2>/dev/null || true++ echo "Re-signing bundle ad-hoc (deep)..."+ codesign --force --deep --sign - --timestamp=none "${APP_BUNDLE}"++ echo "Verifying signature..."+ codesign --verify --deep --strict --verbose=2 "${APP_BUNDLE}" || {+ echo "::error::Bundle verification failed"+ codesign --display --deep --verbose=4 "${APP_BUNDLE}" || true+ exit 1+ }+ fi++ # ── Copy signed bundle to dist/ ──────────────────────────────────+ cp -R "${APP_BUNDLE}" dist/# Tar to preserve execute permissions (upload-artifact uses zip which strips them)tar -czf dist.tar.gz -C dist .diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 930388e7b..abce8e912 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -405,14 +405,16 @@ jobs:echo "Binary: $BINARY ($(du -sh "$BINARY" | cut -f1))"lipo -info "$BINARY"- # ── Package .app bundle ───────────────────────────────────────────────- - name: Package .app bundle+ # ── Stage .app bundle contents (Python + resources FIRST) ─────────────+ # Order is critical: Python.framework and resources must be in the bundle+ # BEFORE macdeployqt / codesign run. If we embed after signing, dyld on+ # macOS 14+ kills the process with SIGKILL (Code Signature Invalid)+ # because the added framework pages have no signature. See issue #139.+ - name: Stage .app bundle contentsworking-directory: fincept-qtrun: |set -euo pipefailBUILD_DIR="build"- DIST_DIR="dist"- mkdir -p "${DIST_DIR}"if [ -d "${BUILD_DIR}/${{ env.APP_NAME }}.app" ]; thenAPP_BUNDLE="${BUILD_DIR}/${{ env.APP_NAME }}.app"@@ -426,16 +428,18 @@ jobs:<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>CFBundleExecutable</key><string>FinceptTerminal</string>- <key>CFBundleIdentifier</key><string>in.fincept.terminal</string>+ <key>CFBundleIdentifier</key><string>com.fincept.terminal</string><key>CFBundleName</key><string>FinceptTerminal</string><key>CFBundlePackageType</key><string>APPL</string>- <key>CFBundleShortVersionString</key><string>4.0.1</string>+ <key>CFBundleShortVersionString</key><string>4.0.2</string>+ <key>CFBundleVersion</key><string>4.0.2</string>+ <key>LSMinimumSystemVersion</key><string>13.0</string><key>NSHighResolutionCapable</key><true/></dict></plist>PLISTfi- # Embed Python 3.12+ # Embed Python framework (before codesign so it gets signed with the bundle)PY_FRAMEWORK=""for candidate in \"/Library/Frameworks/Python.framework" \@@ -463,10 +467,89 @@ jobs:echo "WARNING: Python.framework not found"fi+ # Copy app resources + Python analytics scripts into bundle+ mkdir -p "${APP_BUNDLE}/Contents/Resources"cp -r resources "${APP_BUNDLE}/Contents/Resources/" 2>/dev/null || truecp -r scripts "${APP_BUNDLE}/Contents/Resources/scripts" 2>/dev/null || true- cp -r "${APP_BUNDLE}" "${DIST_DIR}/"- echo "Bundle size: $(du -sh "${DIST_DIR}/${{ env.APP_NAME }}.app" | cut -f1)"++ echo "Bundle staged at: ${APP_BUNDLE}"+ echo "Pre-sign size: $(du -sh "${APP_BUNDLE}" | cut -f1)"++ # ── Run macdeployqt on the fully staged bundle ────────────────────────+ # macdeployqt copies Qt frameworks, fixes rpaths, and signs everything+ # it touches. It must run AFTER Python.framework + resources are in place+ # so those get correct rpath treatment.+ - name: Run macdeployqt+ working-directory: fincept-qt+ run: |+ set -euo pipefail+ APP_BUNDLE="build/${{ env.APP_NAME }}.app"+ MACDEPLOYQT="${QT_ROOT_DIR}/bin/macdeployqt"+ if [ -x "${MACDEPLOYQT}" ]; then+ echo "Running macdeployqt on ${APP_BUNDLE}"+ "${MACDEPLOYQT}" "${APP_BUNDLE}" -verbose=1 || \+ echo "::warning::macdeployqt exited non-zero — continuing to explicit codesign"+ else+ echo "::warning::macdeployqt not found at ${MACDEPLOYQT}"+ fi++ # ── Deep ad-hoc re-sign the entire bundle ─────────────────────────────+ # This is the fix for issue #139. macdeployqt's signing of nested+ # frameworks is unreliable (known Qt bug — see GDATASoftwareAG fork).+ # We strip every existing signature and re-sign the whole bundle from+ # leaves to root with a single identity (`-` = ad-hoc). On macOS 14++ # on Apple Silicon this is what prevents dyld from killing the process+ # with SIGKILL Code Signature Invalid at launch.+ #+ # Until Apple Developer ID cert + notarization is added (Tier 2),+ # users will still see "unidentified developer" on first launch and+ # must right-click → Open (or `xattr -d com.apple.quarantine`).+ - name: Deep ad-hoc codesign bundle+ working-directory: fincept-qt+ run: |+ set -euo pipefail+ APP_BUNDLE="build/${{ env.APP_NAME }}.app"++ echo "Removing existing signatures (leaves first)..."+ # Strip signatures from every Mach-O in the bundle. Must be done+ # leaf-to-root so nested frameworks are unsigned before we re-sign+ # their parents.+ find "${APP_BUNDLE}" -type f \( -name "*.dylib" -o -name "*.so" -o -perm +111 \) 2>/dev/null | \+ while read -r f; do+ if file "$f" 2>/dev/null | grep -q "Mach-O"; then+ codesign --remove-signature "$f" 2>/dev/null || true+ fi+ done+ codesign --remove-signature "${APP_BUNDLE}" 2>/dev/null || true++ echo "Re-signing bundle ad-hoc (deep)..."+ # Ad-hoc sign ("-"): do NOT pass --preserve-metadata — the bundle has+ # no prior entitlements/requirements to preserve, and the flag will+ # fail with "resource fork, Finder information, or similar detritus+ # not allowed" on fresh macdeployqt output. Entitlements are only+ # needed with a real Developer ID cert + hardened runtime (Tier 2).+ codesign --force --deep --sign - \+ --timestamp=none \+ "${APP_BUNDLE}"++ echo "Verifying signature..."+ codesign --verify --deep --strict --verbose=2 "${APP_BUNDLE}" || {+ echo "::error::Bundle verification failed"+ codesign --display --deep --verbose=4 "${APP_BUNDLE}" || true+ exit 1+ }++ echo "Signature OK:"+ codesign --display --verbose=2 "${APP_BUNDLE}" 2>&1 | head -20++ # ── Copy signed bundle to dist/ ───────────────────────────────────────+ - name: Finalize dist+ working-directory: fincept-qt+ run: |+ set -euo pipefail+ mkdir -p dist+ cp -R "build/${{ env.APP_NAME }}.app" "dist/"+ echo "Final bundle size: $(du -sh "dist/${{ env.APP_NAME }}.app" | cut -f1)"# ── Generate Installer (IFW → DMG fallback) ───────────────────────────- name: Generate Installer@@ -483,7 +566,7 @@ jobs:echo "::warning::binarycreator not found — falling back to DMG via hdiutil"STAGING="$(mktemp -d)/dmg_staging"mkdir -p "${STAGING}"- cp -r "../dist/${{ env.APP_NAME }}.app" "${STAGING}/"+ cp -R "../dist/${{ env.APP_NAME }}.app" "${STAGING}/"hdiutil create \-volname "${{ env.APP_NAME }}" \-srcfolder "${STAGING}" \@@ -763,3 +846,146 @@ jobs:git push origin mainecho "README pushed to main"++# ═════════════════════════════════════════════════════════════════════════════+# JOB 6 — Regenerate updates.json (auto-updater manifest)+#+# Reads the published GitHub Release, computes sha256 for each installer+# asset, writes a per-platform/per-arch manifest that the in-app updater+# consumes (see fincept-qt/src/services/updater/UpdateService.cpp).+#+# Platform key scheme — must match UpdateService::current_platform_key():+# windows-x64 / windows-arm64 / linux-x64 / macos-arm64 / macos-x64+#+# Asset filename scheme — must match CPACK_PACKAGE_FILE_NAME in CMakeLists.txt:+# FinceptTerminal-<version>-<platform>-<arch>-setup.<ext>+# ═════════════════════════════════════════════════════════════════════════════+ update-manifest:+ name: Regenerate updates.json+ needs: release+ runs-on: ubuntu-latest+ if: >-+ !cancelled() &&+ needs.release.result == 'success' &&+ startsWith(github.ref, 'refs/tags/')+ permissions:+ contents: write++ steps:+ - name: Checkout repository+ uses: actions/checkout@v4+ with:+ token: ${{ secrets.GITHUB_TOKEN }}+ fetch-depth: 1+ ref: main++ - name: Regenerate updates.json from release assets+ env:+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}+ TAG: ${{ github.ref_name }}+ REPO: ${{ github.repository }}+ run: |+ set -euo pipefail++ # Strip leading 'v' from tag so "v4.0.2" → "4.0.2" for latest-version+ VERSION="${TAG#v}"+ RELEASE_URL="https://github.com/${REPO}/releases/tag/${TAG}"++ # Poll up to 60s for the release to be fully published+ for i in $(seq 1 12); do+ if gh release view "${TAG}" --json assets >/dev/null 2>&1; then+ break+ fi+ echo " attempt ${i}: release not yet visible, sleeping..."+ sleep 5+ done++ WORK="$(mktemp -d)"+ echo "Downloading release assets to ${WORK}..."+ gh release download "${TAG}" --dir "${WORK}" --pattern "FinceptTerminal-*setup*" || true++ # Export shell-side vars so the embedded python can read them via os.environ+ export WORK VERSION TAG REPO++ # Map platform key → (filename-glob, asset download url template)+ python3 <<'PYEOF' > updates.json+ import hashlib+ import json+ import os+ import pathlib+ import re++ work = pathlib.Path(os.environ["WORK"]) if os.environ.get("WORK") else pathlib.Path.cwd()+ version = os.environ["VERSION"]+ tag = os.environ["TAG"]+ repo = os.environ["REPO"]+ release_url = f"https://github.com/{repo}/releases/tag/{tag}"++ # Supported platform keys and the regex that matches their installer filename.+ # Order matters: more specific keys first.+ platforms = [+ ("windows-x64", re.compile(rf"FinceptTerminal-{re.escape(version)}-windows-x64-setup\.exe$")),+ ("windows-arm64", re.compile(rf"FinceptTerminal-{re.escape(version)}-windows-arm64-setup\.exe$")),+ ("linux-x64", re.compile(rf"FinceptTerminal-{re.escape(version)}-linux-x64-setup\.run$")),+ ("linux-arm64", re.compile(rf"FinceptTerminal-{re.escape(version)}-linux-arm64-setup\.run$")),+ ("macos-arm64", re.compile(rf"FinceptTerminal-{re.escape(version)}-macos-arm64-setup\.(dmg|exe)$")),+ ("macos-x64", re.compile(rf"FinceptTerminal-{re.escape(version)}-macos-x64-setup\.(dmg|exe)$")),+ ("macos-universal", re.compile(rf"FinceptTerminal-{re.escape(version)}-macos-universal-setup\.(dmg|exe)$")),+ ]++ # Scan downloaded files+ files = {p.name: p for p in work.iterdir() if p.is_file()}+ print(f"# Found {len(files)} asset file(s): {sorted(files)}", flush=True)++ updates = {}+ for key, pattern in platforms:+ match = next((f for f in files if pattern.match(f)), None)+ if not match:+ print(f"# No asset matches {key} — skipping", flush=True)+ continue++ path = files[match]+ sha = hashlib.sha256(path.read_bytes()).hexdigest()+ url = f"https://github.com/{repo}/releases/download/{tag}/{match}"+ updates[key] = {+ "latest-version": version,+ "download-url": url,+ "sha256": sha,+ "open-url": release_url,+ "changelog": f"Fincept Terminal v{version} — see release notes at {release_url}",+ }+ print(f"# {key}: {match} sha256={sha[:16]}...", flush=True)++ manifest = {+ "_comment": "Auto-generated by .github/workflows/release.yml on every tag push. Do not edit by hand.",+ "schema-version": 2,+ "updates": updates,+ }+ print(json.dumps(manifest, indent=2))+ PYEOF++ echo "=== updates.json diff ==="+ git diff updates.json | head -80 || true++ - name: Commit and push updates.json+ env:+ TAG: ${{ github.ref_name }}+ run: |+ set -euo pipefail+ git config user.name "github-actions[bot]"+ git config user.email "github-actions[bot]@users.noreply.github.com"++ if git diff --quiet updates.json; then+ echo "updates.json unchanged — nothing to commit"+ exit 0+ fi++ git add updates.json+ git commit -m "chore(release): regenerate updates.json for ${TAG}++ Auto-generated by release workflow. sha256 computed from release assets.++ Co-Authored-By: github-actions[bot] <github-actions[bot]@users.noreply.github.com>"++ git push origin main+ echo "updates.json pushed to main"diff --git a/README.md b/README.mdindex 1d4479904..22076ebc1 100644--- a/README.md+++ b/README.md@@ -57,13 +57,13 @@ State-of-the-art financial intelligence platform with CFA-level analytics, AI au<!-- DOWNLOAD-TABLE-START -->### Option 1 — Download Installer (Recommended)-Latest release: **v4.0.1** — [View all releases](https://github.com/Fincept-Corporation/FinceptTerminal/releases/tag/v4.0.1)+Latest release: **v4.0.2** — [View all releases](https://github.com/Fincept-Corporation/FinceptTerminal/releases/tag/v4.0.2)| Platform | Download | Run ||----------|----------|-----|-| **Windows x64** | [FinceptTerminal-Windows-x64-setup.exe](https://github.com/Fincept-Corporation/FinceptTerminal/releases/download/v4.0.1/FinceptTerminal-4.0.1-win64-setup.exe) | Run installer → launch `FinceptTerminal.exe` |-| **Linux x64** | [FinceptTerminal-Linux-x64.run](https://github.com/Fincept-Corporation/FinceptTerminal/releases/download/v4.0.1/FinceptTerminal-4.0.1-linux-x64-setup.run) | `chmod +x` → run installer |-| **macOS Apple Silicon** | [FinceptTerminal-macOS-arm64.dmg](https://github.com/Fincept-Corporation/FinceptTerminal/releases/download/v4.0.1/FinceptTerminal-4.0.1-macOS-setup.dmg) | Open DMG → drag to Applications |+| **Windows x64** | [FinceptTerminal-Windows-x64-setup.exe](https://github.com/Fincept-Corporation/FinceptTerminal/releases/download/v4.0.2/FinceptTerminal-4.0.2-win64-setup.exe) | Run installer → launch `FinceptTerminal.exe` |+| **Linux x64** | [FinceptTerminal-Linux-x64.run](https://github.com/Fincept-Corporation/FinceptTerminal/releases/download/v4.0.2/FinceptTerminal-4.0.2-linux-x64-setup.run) | `chmod +x` → run installer |+| **macOS Apple Silicon** | [FinceptTerminal-macOS-arm64.dmg](https://github.com/Fincept-Corporation/FinceptTerminal/releases/download/v4.0.2/FinceptTerminal-4.0.2-macOS-setup.dmg) | Open DMG → drag to Applications |<!-- DOWNLOAD-TABLE-END -->---diff --git a/build-windows-local.bat b/build-windows-local.batdeleted file mode 100644index dbd131442..000000000--- a/build-windows-local.bat+++ /dev/null@@ -1,26 +0,0 @@-@echo off-call "C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvarsall.bat" x64-if errorlevel 1 exit /b 1--set QT_ROOT=C:\Qt\6.8.3\msvc2022_64-set BUILD_DIR=C:\windowsdisk\finceptTerminal\fincept-qt\build-win--echo === CMake Configure ===-cmake -B "%BUILD_DIR%" ^- -DCMAKE_BUILD_TYPE=Release ^- -DCMAKE_PREFIX_PATH="%QT_ROOT%" ^- -S C:\windowsdisk\finceptTerminal\fincept-qt-if errorlevel 1 (echo CONFIGURE FAILED & exit /b 1)--echo === CMake Build ===-cmake --build "%BUILD_DIR%" --config Release --parallel-if errorlevel 1 (echo BUILD FAILED & exit /b 1)--echo === Verify ===-if exist "%BUILD_DIR%\Release\FinceptTerminal.exe" (- echo BUILD SUCCEEDED- dir "%BUILD_DIR%\Release\FinceptTerminal.exe"-) else (- echo ERROR: Binary not found- exit /b 1-)diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.mdindex d3dc231f3..2bb533fa7 100644--- a/docs/ARCHITECTURE.md+++ b/docs/ARCHITECTURE.md@@ -300,5 +300,5 @@ No external package manager required — Qt6 provides all core dependencies.----**Version**: 4.0.1+**Version**: 4.0.2**Last Updated**: March 2026diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.mdindex 61aec5f57..74767ca5f 100644--- a/docs/CONTRIBUTING.md+++ b/docs/CONTRIBUTING.md@@ -244,5 +244,5 @@ Look for labels: `good first issue`, `help wanted`, `documentation`---**Repository**: https://github.com/Fincept-Corporation/FinceptTerminal-**Version**: 4.0.1+**Version**: 4.0.2**License**: AGPL-3.0diff --git a/fincept-qt/CMakeLists.txt b/fincept-qt/CMakeLists.txtindex df2b7f732..bd8fb47c4 100644--- a/fincept-qt/CMakeLists.txt+++ b/fincept-qt/CMakeLists.txt@@ -1,5 +1,5 @@cmake_minimum_required(VERSION 3.27)-project(FinceptTerminal VERSION 4.0.1 LANGUAGES CXX)+project(FinceptTerminal VERSION 4.0.2 LANGUAGES CXX)set(CMAKE_CXX_STANDARD 20)set(CMAKE_CXX_STANDARD_REQUIRED ON)@@ -228,17 +228,10 @@ endif()# NOTE: FINCEPT_HAS_QXLSX compile definition is applied to FinceptTerminal# after add_executable() — see the target_compile_definitions block below.-# ── QSimpleUpdater (cross-platform auto-update) ──────────────────────────────-set(QSIMPLE_UPDATER_BUILD_TESTS OFF CACHE BOOL "" FORCE)-FetchContent_Declare(- QSimpleUpdater- GIT_REPOSITORY https://github.com/alex-spataru/QSimpleUpdater.git- GIT_TAG ff0cb7caae05ef381a09f212b90329ff7b7b9ab9 # master @ 2026-04-11- GIT_SHALLOW TRUE-)-FetchContent_MakeAvailable(QSimpleUpdater)-# QSimpleUpdater's CMakeLists builds a proper STATIC library target with-# AUTOMOC — we just link against it and add its include dir.+# ── Auto-update service ─────────────────────────────────────────────────────+# The updater is implemented in-tree (src/services/updater/UpdateService.cpp)+# using Qt6::Network directly — no third-party dependency. See the class+# docstring for the manifest schema.# ── md4c (fast CommonMark markdown parser → HTML) ────────────────────────────FetchContent_Declare(@@ -290,6 +283,21 @@ FetchContent_MakeAvailable(QGeoView)# QGeoView has anonymous-namespace symbol clashes under unity buildset_target_properties(qgeoview PROPERTIES UNITY_BUILD OFF)+# Qt 6.8.3's QtGui on macOS carries a transitive "-framework AGL" in its link+# interface. Apple removed AGL in macOS 14 (Sonoma), so the link fails on 14++# with: ld: framework 'AGL' not found. Scrub AGL from qgeoview's resolved link+# libraries on Apple — OpenGL framework (also in Qt's interface) is sufficient.+# See GitHub issue #140.+if(APPLE)+ foreach(_prop LINK_LIBRARIES INTERFACE_LINK_LIBRARIES)+ get_target_property(_libs qgeoview ${_prop})+ if(_libs)+ list(REMOVE_ITEM _libs "-framework AGL" "AGL")+ set_target_properties(qgeoview PROPERTIES ${_prop} "${_libs}")+ endif()+ endforeach()+endif()+# ── SingleApplication (single-process enforcement + new-window IPC) ──────────# When the user re-launches the exe, the secondary instance sends "--new-window"# to the primary, which opens a new MainWindow instead of a second process.@@ -1652,7 +1660,6 @@ target_link_libraries(FinceptTerminal PRIVATEQt6::MultimediaQXlsx::QXlsxqgeoview- QSimpleUpdatermd4cmd4c-htmlSingleApplication::SingleApplication@@ -1711,6 +1718,12 @@ if(WIN32)endif()endif()+# ── Application version (single source of truth) ─────────────────────────────+# FINCEPT_VERSION_STRING is consumed by main.cpp so QApplication::applicationVersion()+# always matches the project() VERSION declared at the top of this file.+target_compile_definitions(FinceptTerminal PRIVATE+ FINCEPT_VERSION_STRING="${CMAKE_PROJECT_VERSION}")+# ── Optional feature compile definitions (applied after add_executable) ──────if(FINCEPT_HAS_PRIVATE_HEADERS)target_compile_definitions(FinceptTerminal PRIVATE FINCEPT_HAS_QXLSX)@@ -1939,6 +1952,17 @@ if(FINCEPT_BUILD_INSTALLER)COMPONENT coreFILES_MATCHINGPATTERN "*.dll")+ # Python analytics scripts (4000+ files) — required at runtime by+ # PythonRunner / ExchangeService. Without this the Crypto tab and all+ # Python-backed screens crash on an installed build.+ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/scripts/"+ DESTINATION "scripts" COMPONENT scripts)+ # Requirements files — read by PythonSetupManager::install_packages()+ # during first-run setup. Missing files → setup fails on installed build.+ install(FILES+ "${CMAKE_CURRENT_SOURCE_DIR}/resources/requirements-numpy1.txt"+ "${CMAKE_CURRENT_SOURCE_DIR}/resources/requirements-numpy2.txt"+ DESTINATION "resources" COMPONENT core)# Qt plugin directoriesinstall(DIRECTORY "$<TARGET_FILE_DIR:FinceptTerminal>/platforms"DESTINATION "." COMPONENT core OPTIONAL)@@ -2013,17 +2037,50 @@ if(FINCEPT_BUILD_INSTALLER)set(CPACK_IFW_TARGET_DIRECTORY "@HomeDir@/FinceptTerminal")endif()- # Output file naming+ # Output file naming — arch-aware so the auto-updater manifest can point+ # at predictable, stable URLs. Scheme:+ # FinceptTerminal-<version>-<platform>-<arch>-setup+ # Platform: windows | linux | macos+ # Arch: x64 | arm64+ # The CPack IFW generator appends .exe on Windows, .app on macOS, .run on Linux.if(WIN32)+ # CMAKE_SYSTEM_PROCESSOR on Windows is "AMD64" for x64 and "ARM64" for arm64.+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "ARM64|aarch64")+ set(_FINCEPT_PKG_ARCH "arm64")+ else()+ set(_FINCEPT_PKG_ARCH "x64")+ endif()set(CPACK_PACKAGE_FILE_NAME- "FinceptTerminal-${CMAKE_PROJECT_VERSION}-win64-setup")+ "FinceptTerminal-${CMAKE_PROJECT_VERSION}-windows-${_FINCEPT_PKG_ARCH}-setup")elseif(APPLE)+ # On macOS CMAKE_OSX_ARCHITECTURES is the authoritative source+ # (it drives the actual binary slice). Fall back to host processor.+ if(CMAKE_OSX_ARCHITECTURES)+ list(LENGTH CMAKE_OSX_ARCHITECTURES _osx_arch_count)+ if(_osx_arch_count GREATER 1)+ set(_FINCEPT_PKG_ARCH "universal")+ elseif("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "arm64")+ set(_FINCEPT_PKG_ARCH "arm64")+ else()+ set(_FINCEPT_PKG_ARCH "x64")+ endif()+ elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64|aarch64")+ set(_FINCEPT_PKG_ARCH "arm64")+ else()+ set(_FINCEPT_PKG_ARCH "x64")+ endif()set(CPACK_PACKAGE_FILE_NAME- "FinceptTerminal-${CMAKE_PROJECT_VERSION}-macOS-setup")+ "FinceptTerminal-${CMAKE_PROJECT_VERSION}-macos-${_FINCEPT_PKG_ARCH}-setup")else()+ if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|arm64")+ set(_FINCEPT_PKG_ARCH "arm64")+ else()+ set(_FINCEPT_PKG_ARCH "x64")+ endif()set(CPACK_PACKAGE_FILE_NAME- "FinceptTerminal-${CMAKE_PROJECT_VERSION}-linux-x64-setup")+ "FinceptTerminal-${CMAKE_PROJECT_VERSION}-linux-${_FINCEPT_PKG_ARCH}-setup")endif()+ message(STATUS " Installer filename: ${CPACK_PACKAGE_FILE_NAME}")# ── Include CPack + IFW module ───────────────────────────────────────────include(CPack)diff --git a/fincept-qt/_build_phase4.bat b/fincept-qt/_build_phase4.batdeleted file mode 100644index f28173cad..000000000--- a/fincept-qt/_build_phase4.bat+++ /dev/null@@ -1,8 +0,0 @@-@echo off-set "PATH=C:\Program Files (x86)\Microsoft Visual Studio\Installer;%PATH%"-call "C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvars64.bat" >nul-cd /d "C:\windowsdisk\finceptTerminal\fincept-qt"-cmake -S . -B build-win -DCMAKE_PREFIX_PATH="C:/Qt/6.8.3/msvc2022_64"-if errorlevel 1 exit /b 1-cmake --build build-win --config Release --parallel-exit /b %errorlevel%diff --git a/fincept-qt/_build_phase7.bat b/fincept-qt/_build_phase7.batdeleted file mode 100644index ab6f86cae..000000000--- a/fincept-qt/_build_phase7.bat+++ /dev/null@@ -1,6 +0,0 @@-@echo off-set "PATH=C:\Program Files (x86)\Microsoft Visual Studio\Installer;%PATH%"-call "C:\Program Files\Microsoft Visual Studio\2022\Preview\VC\Auxiliary\Build\vcvars64.bat" >nul-cd /d "C:\windowsdisk\finceptTerminal\fincept-qt"-cmake --build build-win --config Release --parallel-exit /b %errorlevel%diff --git a/fincept-qt/packaging/linux/AppImageBuilder.yml b/fincept-qt/packaging/linux/AppImageBuilder.ymlindex bfb5362a1..5ce0da0f4 100644--- a/fincept-qt/packaging/linux/AppImageBuilder.yml+++ b/fincept-qt/packaging/linux/AppImageBuilder.yml@@ -16,7 +16,7 @@ AppDir:id: com.fincept.terminalname: Fincept Terminalicon: fincept-terminal- version: !ENV ${FINCEPT_VERSION:-4.0.1}+ version: !ENV ${FINCEPT_VERSION:-4.0.2}exec: usr/bin/FinceptTerminalexec_args: $@@@ -56,6 +56,6 @@ AppDir:AppImage:arch: x86_64comp: xz- file_name: FinceptTerminal-!ENV ${FINCEPT_VERSION:-4.0.1}-x86_64.AppImage+ file_name: FinceptTerminal-!ENV ${FINCEPT_VERSION:-4.0.2}-x86_64.AppImagesign-key: Noneupdate-information: gh-releases-zsync|Fincept-Corporation|FinceptTerminal|latest|FinceptTerminal-*x86_64.AppImage.zsyncdiff --git a/fincept-qt/packaging/linux/fincept-terminal.appdata.xml b/fincept-qt/packaging/linux/fincept-terminal.appdata.xmlindex a1c725b67..ad8832e0b 100644--- a/fincept-qt/packaging/linux/fincept-terminal.appdata.xml+++ b/fincept-qt/packaging/linux/fincept-terminal.appdata.xml@@ -28,9 +28,9 @@<binary>FinceptTerminal</binary></provides><releases>- <release version="4.0.1" date="2026-04-14">+ <release version="4.0.2" date="2026-04-14"><description>- <p>Version 4.0.1 — Patch release.</p>+ <p>Version 4.0.2 — Patch release.</p></description></release><release version="4.0.0" date="2025-01-01">diff --git a/fincept-qt/scripts/bcb_data.py b/fincept-qt/scripts/bcb_data.pyindex e649f1fbb..c71ef8aeb 100644--- a/fincept-qt/scripts/bcb_data.py+++ b/fincept-qt/scripts/bcb_data.py@@ -138,7 +138,7 @@ class BCBWrapper:def __init__(self):self.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1",+ "User-Agent": "Fincept-Terminal/4.0.2","Accept": "*/*",})diff --git a/fincept-qt/scripts/bnm_data.py b/fincept-qt/scripts/bnm_data.pyindex 72315636d..c1618e509 100644--- a/fincept-qt/scripts/bnm_data.py+++ b/fincept-qt/scripts/bnm_data.py@@ -99,7 +99,7 @@ class BNMWrapper:def __init__(self):self.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1",+ "User-Agent": "Fincept-Terminal/4.0.2","Accept": ACCEPT_HEADER,})diff --git a/fincept-qt/scripts/bnr_data.py b/fincept-qt/scripts/bnr_data.pyindex f82ea0601..24166f242 100644--- a/fincept-qt/scripts/bnr_data.py+++ b/fincept-qt/scripts/bnr_data.py@@ -80,7 +80,7 @@ class BNRWrapper:def __init__(self):self.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1",+ "User-Agent": "Fincept-Terminal/4.0.2","Accept": "application/xml, text/xml, */*",})diff --git a/fincept-qt/scripts/boc_data.py b/fincept-qt/scripts/boc_data.pyindex 1e2ea5544..4ed8d1b03 100644--- a/fincept-qt/scripts/boc_data.py+++ b/fincept-qt/scripts/boc_data.py@@ -121,7 +121,7 @@ class BoCWrapper:def __init__(self):self.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1",+ "User-Agent": "Fincept-Terminal/4.0.2","Accept": "application/json",})diff --git a/fincept-qt/scripts/boi_data.py b/fincept-qt/scripts/boi_data.pyindex 708fee8db..2ea265212 100644--- a/fincept-qt/scripts/boi_data.py+++ b/fincept-qt/scripts/boi_data.py@@ -108,7 +108,7 @@ class BOIWrapper:def __init__(self):self.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1",+ "User-Agent": "Fincept-Terminal/4.0.2","Accept": "text/csv, application/json, */*",})diff --git a/fincept-qt/scripts/cnb_data.py b/fincept-qt/scripts/cnb_data.pyindex bd993ea33..1b9491d72 100644--- a/fincept-qt/scripts/cnb_data.py+++ b/fincept-qt/scripts/cnb_data.py@@ -103,7 +103,7 @@ class CNBWrapper:self.lang = langself.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1",+ "User-Agent": "Fincept-Terminal/4.0.2","Accept": "application/json",})diff --git a/fincept-qt/scripts/debug_test.py b/fincept-qt/scripts/debug_test.pydeleted file mode 100644index 2103b1fe3..000000000--- a/fincept-qt/scripts/debug_test.py+++ /dev/null@@ -1,27 +0,0 @@-import urllib.request-import json--out_path = r'C:\windowsdisk\finceptTerminal\fincept-qt\scripts\debug_out.txt'--with open(out_path, 'w') as f:- f.write('starting\n')- try:- BASE = 'https://api.fincept.in'- HEADERS = {- 'X-API-Key': 'fk_user_vU20qwUxKtPmg0fWpriNBhcAnBVGgOtJxsKiiwfD9Qo',- 'Accept': 'application/json',- 'Content-Type': 'application/json',- 'User-Agent': 'FinceptTerminal/4.0.1'- }- body = {'amount': 100, 'from_currency': 'USD', 'to_currency': 'EUR', 'rate': 0.92}- data = json.dumps(body).encode()- req = urllib.request.Request(BASE + '/quantlib/core/types/money/convert', data=data, headers=HEADERS, method='POST')- with urllib.request.urlopen(req, timeout=20) as r:- resp = json.loads(r.read())- f.write(f'200 OK\n{json.dumps(resp)[:500]}\n')- except urllib.error.HTTPError as e:- resp = json.loads(e.read())- f.write(f'{e.code} FAIL\n{json.dumps(resp)[:500]}\n')- except Exception as ex:- f.write(f'EXCEPTION: {ex}\n')- f.write('done\n')diff --git a/fincept-qt/scripts/hnb_data.py b/fincept-qt/scripts/hnb_data.pyindex 08d5afcd8..ff3588258 100644--- a/fincept-qt/scripts/hnb_data.py+++ b/fincept-qt/scripts/hnb_data.py@@ -94,7 +94,7 @@ class HNBWrapper:def __init__(self):self.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1",+ "User-Agent": "Fincept-Terminal/4.0.2","Accept": "application/json",})diff --git a/fincept-qt/scripts/ilostat_data.py b/fincept-qt/scripts/ilostat_data.pyindex c784b6456..caab94f2f 100644--- a/fincept-qt/scripts/ilostat_data.py+++ b/fincept-qt/scripts/ilostat_data.py@@ -135,7 +135,7 @@ def _session() -> requests.Session:"""Return a pre-configured requests Session."""s = requests.Session()s.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1 (ILOSTAT-wrapper)",+ "User-Agent": "Fincept-Terminal/4.0.2 (ILOSTAT-wrapper)","Accept-Language": "en",})return sdiff --git a/fincept-qt/scripts/mnb_data.py b/fincept-qt/scripts/mnb_data.pyindex 8120f360b..391c686b7 100644--- a/fincept-qt/scripts/mnb_data.py+++ b/fincept-qt/scripts/mnb_data.py@@ -88,7 +88,7 @@ class MNBWrapper:def __init__(self):self.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1",+ "User-Agent": "Fincept-Terminal/4.0.2","Content-Type": "text/xml; charset=utf-8",})diff --git a/fincept-qt/scripts/nbp_data.py b/fincept-qt/scripts/nbp_data.pyindex 984da333f..4e9f38392 100644--- a/fincept-qt/scripts/nbp_data.py+++ b/fincept-qt/scripts/nbp_data.py@@ -93,7 +93,7 @@ class NBPWrapper:def __init__(self):self.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1",+ "User-Agent": "Fincept-Terminal/4.0.2","Accept": "application/json",})diff --git a/fincept-qt/scripts/norges_bank_data.py b/fincept-qt/scripts/norges_bank_data.pyindex b2f59485a..dfcbc1efc 100644--- a/fincept-qt/scripts/norges_bank_data.py+++ b/fincept-qt/scripts/norges_bank_data.py@@ -104,7 +104,7 @@ class NorgesBankWrapper:def __init__(self):self.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1",+ "User-Agent": "Fincept-Terminal/4.0.2","Accept": "text/csv,text/plain,*/*",})diff --git a/fincept-qt/scripts/polymarket.py b/fincept-qt/scripts/polymarket.pyindex d016d5d0f..97b422b44 100644--- a/fincept-qt/scripts/polymarket.py+++ b/fincept-qt/scripts/polymarket.py@@ -28,7 +28,7 @@ def get_markets(limit=10):}headers = {"Accept": "application/json",- "User-Agent": "FinceptTerminal/4.0.1",+ "User-Agent": "FinceptTerminal/4.0.2",}r = requests.get(url, params=params, headers=headers, timeout=15)r.raise_for_status()diff --git a/fincept-qt/scripts/riksbank_data.py b/fincept-qt/scripts/riksbank_data.pyindex 63b6ac0e7..934b736ee 100644--- a/fincept-qt/scripts/riksbank_data.py+++ b/fincept-qt/scripts/riksbank_data.py@@ -124,7 +124,7 @@ class RiksbankWrapper:def __init__(self):self.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1",+ "User-Agent": "Fincept-Terminal/4.0.2","Accept": "application/json",})diff --git a/fincept-qt/scripts/snb_data.py b/fincept-qt/scripts/snb_data.pyindex d6dce434b..52c60cf92 100644--- a/fincept-qt/scripts/snb_data.py+++ b/fincept-qt/scripts/snb_data.py@@ -139,7 +139,7 @@ class SNBWrapper:self.lang = langself.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1 (SNB-wrapper)",+ "User-Agent": "Fincept-Terminal/4.0.2 (SNB-wrapper)","Accept": "text/csv,text/plain,*/*",})diff --git a/fincept-qt/scripts/tcmb_data.py b/fincept-qt/scripts/tcmb_data.pyindex 86a3b65df..dc6f7646f 100644--- a/fincept-qt/scripts/tcmb_data.py+++ b/fincept-qt/scripts/tcmb_data.py@@ -82,7 +82,7 @@ class TCMBWrapper:def __init__(self):self.session = requests.Session()self.session.headers.update({- "User-Agent": "Fincept-Terminal/4.0.1",+ "User-Agent": "Fincept-Terminal/4.0.2","Accept": "application/xml, text/xml, */*",})diff --git a/fincept-qt/scripts/test_ql_all.py b/fincept-qt/scripts/test_ql_all.pydeleted file mode 100644index 8ef5fa126..000000000--- a/fincept-qt/scripts/test_ql_all.py+++ /dev/null@@ -1,128 +0,0 @@-import urllib.request-import json--BASE = 'https://api.fincept.in'-HEADERS = {- 'X-API-Key': 'fk_user_vU20qwUxKtPmg0fWpriNBhcAnBVGgOtJxsKiiwfD9Qo',- 'Accept': 'application/json',- 'Content-Type': 'application/json',- 'User-Agent': 'FinceptTerminal/4.0.1'-}--def post(path, body):- data = json.dumps(body).encode()- req = urllib.request.Request(BASE + path, data=data, headers=HEADERS, method='POST')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())- except Exception as ex:- return 0, {'detail': str(ex)}--def get(path):- h = {k: v for k, v in HEADERS.items() if k != 'Content-Type'}- req = urllib.request.Request(BASE + path, headers=h, method='GET')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())- except Exception as ex:- return 0, {'detail': str(ex)}--tests = [- (4, 'POST', '/quantlib/core/types/money/convert',- {'amount': 100, 'from_currency': 'USD', 'to_currency': 'EUR', 'rate': 0.92}),- (5, 'POST', '/quantlib/core/types/rate/convert',- {'value': 0.05, 'from_type': 'annual', 'to_type': 'continuous'}),- (6, 'GET', '/quantlib/core/types/spread/from-bps?bps=50', None),- (7, 'POST', '/quantlib/core/types/tenor/add-to-date',- {'start_date': '2024-01-01', 'tenor': '3M'}),- (8, 'POST', '/quantlib/core/types/notional-schedule',- {'notional': 1000000, 'periods': 4, 'schedule_type': 'linear'}),- (10, 'POST', '/quantlib/core/conventions/format-date',- {'date_str': '2024-01-15', 'format': '%d/%m/%Y'}),- (11, 'POST', '/quantlib/core/conventions/days-to-years',- {'value': 365, 'day_count': 'ACT/365'}),- (12, 'POST', '/quantlib/core/conventions/years-to-days',- {'value': 1.0, 'day_count': 'ACT/365'}),- (13, 'POST', '/quantlib/core/conventions/normalize-rate',- {'value': 0.05, 'compounding': 'annual'}),- (14, 'POST', '/quantlib/core/conventions/normalize-volatility',- {'value': 0.2, 'tenor': '1Y'}),- (15, 'POST', '/quantlib/core/autodiff/dual-eval',- {'func_name': 'sin', 'x': 1.0}),- (16, 'POST', '/quantlib/core/autodiff/gradient',- {'func_name': 'sin', 'x': 1.0}),- (17, 'POST', '/quantlib/core/autodiff/taylor-expand',- {'func_name': 'sin', 'x': 1.0, 'order': 3}),- (26, 'POST', '/quantlib/core/distributions/gamma/cdf',- {'x': 2.0, 'alpha': 2.0, 'beta': 1.0}),- (27, 'POST', '/quantlib/core/distributions/gamma/pdf',- {'x': 2.0, 'alpha': 2.0, 'beta': 1.0}),- (32, 'POST', '/quantlib/core/math/eval',- {'func_name': 'sqrt', 'x': 2.0}),- (33, 'POST', '/quantlib/core/math/two-arg',- {'func_name': 'pow', 'x': 2.0, 'y': 10.0}),- (34, 'POST', '/quantlib/core/ops/black-scholes',- {'spot': 100, 'strike': 105, 'rate': 0.05, 'volatility': 0.2, 'time': 1.0, 'option_type': 'call'}),- (35, 'POST', '/quantlib/core/ops/black76',- {'forward': 100, 'strike': 105, 'discount_factor': 0.95, 'volatility': 0.2, 'time': 1.0, 'option_type': 'call'}),- (36, 'POST', '/quantlib/core/ops/forward-rate',- {'df1': 0.95, 'df2': 0.90, 't1': 1.0, 't2': 2.0}),- (37, 'POST', '/quantlib/core/ops/discount-cashflows',- {'cashflows': [100, 100, 1100], 'times': [1, 2, 3], 'discount_factors': [0.95, 0.90, 0.86]}),- (38, 'POST', '/quantlib/core/ops/interpolate',- {'x_data': [1, 2, 3, 4], 'y_data': [1, 4, 9, 16], 'x': 2.5, 'method': 'linear'}),- (39, 'POST', '/quantlib/core/ops/statistics',- {'values': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}),- (40, 'POST', '/quantlib/core/ops/var',- {'returns': [-0.02, 0.01, -0.015, 0.03, -0.01, 0.02], 'confidence': 0.95, 'method': 'historical'}),- (41, 'POST', '/quantlib/core/ops/percentile',- {'values': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 'p': 0.9}),- (42, 'POST', '/quantlib/core/ops/covariance-matrix',- {'returns': [[0.01, 0.02], [0.03, -0.01], [0.02, 0.01], [-0.01, 0.03]]}),- (44, 'POST', '/quantlib/core/ops/gbm-paths',- {'spot': 100, 'drift': 0.05, 'volatility': 0.2, 'time': 1.0, 'n_steps': 10, 'n_paths': 3}),- (45, 'POST', '/quantlib/core/ops/zero-rate-convert',- {'direction': 'continuous_to_annual', 'value': 0.05, 't': 1.0}),- (46, 'POST', '/quantlib/core/legs/fixed',- {'notional': 1000000, 'rate': 0.05, 'frequency': 'semiannual',- 'start_date': '2024-01-01', 'end_date': '2026-01-01'}),- (47, 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': 'quarterly',- 'start_date': '2024-01-01', 'end_date': '2026-01-01'}),- (48, 'POST', '/quantlib/core/legs/zero-coupon',- {'notional': 1000000, 'rate': 0.05, 'start_date': '2024-01-01', 'end_date': '2029-01-01'}),- (50, 'POST', '/quantlib/core/periods/fixed-coupon',- {'notional': 1000000, 'rate': 0.05, 'start_date': '2024-01-01',- 'end_date': '2024-07-01', 'day_count_fraction': 0.5}),- (51, 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000, 'libor_rate': 0.04, 'spread': 0.01,- 'start_date': '2024-01-01', 'end_date': '2024-04-01'}),-]--OUT = r'C:\windowsdisk\finceptTerminal\fincept-qt\scripts\ql_results.txt'-with open(OUT, 'w', encoding='utf-8') as f:- for num, method, path, body in tests:- if method == 'POST':- status, resp = post(path, body)- else:- status, resp = get(path)- ok = 'OK' if status == 200 else 'FAIL'- f.write(f'--- #{num} {method} {path}\n')- f.write(f' Status: {status} {ok}\n')- if status == 200:- data = resp.get('data', resp)- if isinstance(data, dict):- f.write(f' data keys: {list(data.keys())}\n')- f.write(f' data sample: {json.dumps(data)[:600]}\n')- elif isinstance(data, list):- f.write(f' data list len={len(data)} sample: {json.dumps(data)[:600]}\n')- else:- f.write(f' data: {str(data)[:400]}\n')- else:- detail = resp.get('detail', resp)- f.write(f' detail: {json.dumps(detail)[:800]}\n')- f.write('\n')diff --git a/fincept-qt/scripts/test_ql_corrected.py b/fincept-qt/scripts/test_ql_corrected.pydeleted file mode 100644index 4b360851c..000000000--- a/fincept-qt/scripts/test_ql_corrected.py+++ /dev/null@@ -1,101 +0,0 @@-import urllib.request-import json--BASE = 'https://api.fincept.in'-HEADERS = {- 'X-API-Key': 'fk_user_vU20qwUxKtPmg0fWpriNBhcAnBVGgOtJxsKiiwfD9Qo',- 'Accept': 'application/json',- 'Content-Type': 'application/json',- 'User-Agent': 'FinceptTerminal/4.0.1'-}--def post(path, body):- data = json.dumps(body).encode()- req = urllib.request.Request(BASE + path, data=data, headers=HEADERS, method='POST')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())- except Exception as ex:- return 0, {'detail': str(ex)}--OUT = r'C:\windowsdisk\finceptTerminal\fincept-qt\scripts\ql_corrected_results.txt'-retries = []--# #8: From docs description: "constant, linear, mortgage, bullet"-retries.append(('8_linear', 'POST', '/quantlib/core/types/notional-schedule',- {'notional': 1000000, 'periods': 4, 'schedule_type': 'linear'}))-retries.append(('8_mortgage', 'POST', '/quantlib/core/types/notional-schedule',- {'notional': 1000000, 'periods': 4, 'schedule_type': 'mortgage', 'rate': 0.05}))-retries.append(('8_bullet', 'POST', '/quantlib/core/types/notional-schedule',- {'notional': 1000000, 'periods': 4, 'schedule_type': 'bullet'}))-# Maybe server uses different case-retries.append(('8_LINEAR', 'POST', '/quantlib/core/types/notional-schedule',- {'notional': 1000000, 'periods': 4, 'schedule_type': 'LINEAR'}))--# #47: FloatLegRequest has fixings as dict[date_str -> float]-# With correct date keys, the fixings dict should work.-# The error when fixings={'rate': 0.04} was "Cannot parse date from string: rate"-# meaning it IS reading the dict keys as dates. Send proper date string keys.-retries.append(('47_fixings_ok', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'fixings': {- '2024-01-01': 0.04,- '2024-04-01': 0.041,- '2024-07-01': 0.042,- '2024-10-01': 0.043,- '2025-01-01': 0.044,- '2025-04-01': 0.045,- '2025-07-01': 0.046,- '2025-10-01': 0.047- }}))--# #50: FixedPeriodRequest uses day_count string NOT day_count_fraction float-# The schema shows: notional, rate, start_date, end_date, day_count (default ACT/360)-retries.append(('50_daycount', 'POST', '/quantlib/core/periods/fixed-coupon',- {'notional': 1000000, 'rate': 0.05, 'start_date': '2024-01-01',- 'end_date': '2024-07-01', 'day_count': 'ACT/360'}))-retries.append(('50_minimal', 'POST', '/quantlib/core/periods/fixed-coupon',- {'notional': 1000000, 'rate': 0.05, 'start_date': '2024-01-01',- 'end_date': '2024-07-01'}))--# #51: FloatPeriodRequest schema: notional, spread, start_date, end_date, day_count, fixing_rate-# fixing_rate is optional (anyOf null)-retries.append(('51_fixing_rate', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000, 'spread': 0.01, 'start_date': '2024-01-01',- 'end_date': '2024-04-01', 'fixing_rate': 0.04}))-retries.append(('51_fixing_rate_dc', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000, 'spread': 0.01, 'start_date': '2024-01-01',- 'end_date': '2024-04-01', 'fixing_rate': 0.04, 'day_count': 'ACT/360'}))-retries.append(('51_no_fixing', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000, 'spread': 0.01, 'start_date': '2024-01-01',- 'end_date': '2024-04-01', 'day_count': 'ACT/360'}))--# Also re-test #45 to confirm zero-rate-convert behavior:-# The schema name ZeroRateConvertRequest; direction, value, t - it returns discount_factor-# both directions return discount_factor - this is the API behavior.-retries.append(('45_check', 'POST', '/quantlib/core/ops/zero-rate-convert',- {'direction': 'continuous_to_annual', 'value': 0.05, 't': 1.0}))--with open(OUT, 'w', encoding='utf-8') as f:- for label, method, path, body in retries:- status, resp = post(path, body)- ok = 'OK' if status == 200 else 'FAIL'- f.write(f'--- #{label} POST {path}\n')- f.write(f' Body: {json.dumps(body)}\n')- f.write(f' Status: {status} {ok}\n')- if status == 200:- data = resp.get('data', resp)- if isinstance(data, dict):- f.write(f' data keys: {list(data.keys())}\n')- f.write(f' data: {json.dumps(data)[:600]}\n')- elif isinstance(data, list):- f.write(f' data list len={len(data)}: {json.dumps(data)[:600]}\n')- else:- f.write(f' data: {str(data)[:400]}\n')- else:- detail = resp.get('detail', resp)- f.write(f' detail: {json.dumps(detail)[:700]}\n')- f.write('\n')diff --git a/fincept-qt/scripts/test_ql_final.py b/fincept-qt/scripts/test_ql_final.pydeleted file mode 100644index f415c5887..000000000--- a/fincept-qt/scripts/test_ql_final.py+++ /dev/null@@ -1,86 +0,0 @@-import urllib.request-import json--BASE = 'https://api.fincept.in'-HEADERS = {- 'X-API-Key': 'fk_user_vU20qwUxKtPmg0fWpriNBhcAnBVGgOtJxsKiiwfD9Qo',- 'Accept': 'application/json',- 'Content-Type': 'application/json',- 'User-Agent': 'FinceptTerminal/4.0.1'-}--def post(path, body):- data = json.dumps(body).encode()- req = urllib.request.Request(BASE + path, data=data, headers=HEADERS, method='POST')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())- except Exception as ex:- return 0, {'detail': str(ex)}--OUT = r'C:\windowsdisk\finceptTerminal\fincept-qt\scripts\ql_final_results.txt'-retries = []--# #8: still need valid schedule_type besides "constant". Try more options.-for stype in ['principal', 'par', 'face', 'outstanding', 'remaining',- 'proportional', 'staggered', 'even', 'regular', 'level']:- retries.append((f'8_{stype}', 'POST', '/quantlib/core/types/notional-schedule',- {'notional': 1000000, 'periods': 4, 'schedule_type': stype}))--# #47: float leg - the error message itself says "fixing rate, fixed rate, or curve"-# These are internal variable names. The issue may be a field name that does not pass-# through correctly from JSON. Try "fixings" as array, or "discount_curve"-retries.append(('47L', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'fixings': [0.04, 0.041, 0.042, 0.043, 0.044, 0.045, 0.046, 0.047]}))-retries.append(('47M', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'discount_curve': [0.04, 0.041, 0.042, 0.043]}))-retries.append(('47N', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'zero_rates': [0.04, 0.041, 0.042, 0.043]}))-retries.append(('47O', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'forward_rates': [0.04, 0.041, 0.042, 0.043]}))--# #50: fixed-coupon: 500 with correct types. This is a real server bug.-# Try omitting optional fields to isolate what crashes it.-retries.append(('50_min', 'POST', '/quantlib/core/periods/fixed-coupon',- {'notional': 1000000, 'rate': 0.05, 'start_date': '2024-01-01',- 'end_date': '2024-07-01', 'day_count_fraction': 0.5}))--# #51: float-coupon requires: notional, spread, start_date, end_date.-# libor_rate is not validated (no 422) but causes 500. Try without it.-retries.append(('51_nolib', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000, 'spread': 0.01,- 'start_date': '2024-01-01', 'end_date': '2024-04-01'}))-retries.append(('51_nolib2', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000, 'spread': 0.0,- 'start_date': '2024-01-01', 'end_date': '2024-04-01'}))--with open(OUT, 'w', encoding='utf-8') as f:- for label, method, path, body in retries:- status, resp = post(path, body)- ok = 'OK' if status == 200 else 'FAIL'- f.write(f'--- #{label} {method} {path}\n')- f.write(f' Body: {json.dumps(body)}\n')- f.write(f' Status: {status} {ok}\n')- if status == 200:- data = resp.get('data', resp)- if isinstance(data, dict):- f.write(f' data keys: {list(data.keys())}\n')- f.write(f' data: {json.dumps(data)[:600]}\n')- elif isinstance(data, list):- f.write(f' data list len={len(data)}: {json.dumps(data)[:600]}\n')- else:- f.write(f' data: {str(data)[:400]}\n')- else:- detail = resp.get('detail', resp)- f.write(f' detail: {json.dumps(detail)[:700]}\n')- f.write('\n')diff --git a/fincept-qt/scripts/test_ql_final2.py b/fincept-qt/scripts/test_ql_final2.pydeleted file mode 100644index c3d41ec8b..000000000--- a/fincept-qt/scripts/test_ql_final2.py+++ /dev/null@@ -1,86 +0,0 @@-import urllib.request-import json--BASE = 'https://api.fincept.in'-HEADERS = {- 'X-API-Key': 'fk_user_vU20qwUxKtPmg0fWpriNBhcAnBVGgOtJxsKiiwfD9Qo',- 'Accept': 'application/json',- 'Content-Type': 'application/json',- 'User-Agent': 'FinceptTerminal/4.0.1'-}--def post(path, body):- data = json.dumps(body).encode()- req = urllib.request.Request(BASE + path, data=data, headers=HEADERS, method='POST')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())- except Exception as ex:- return 0, {'detail': str(ex)}--def get(path):- h = {k: v for k, v in HEADERS.items() if k != 'Content-Type'}- req = urllib.request.Request(BASE + path, headers=h, method='GET')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())- except Exception as ex:- return 0, {'detail': str(ex)}--OUT = r'C:\windowsdisk\finceptTerminal\fincept-qt\scripts\ql_final2_results.txt'-retries = []--# Try OpenAPI schema to see notional-schedule model-retries.append(('openapi_schema', 'GET', '/openapi.json', None))-retries.append(('docs_redoc', 'GET', '/redoc', None))--# #47: fixings must be a dict - try date->rate mapping-retries.append(('47P', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'fixings': {'2024-01-01': 0.04, '2024-04-01': 0.041,- '2024-07-01': 0.042, '2024-10-01': 0.043,- '2025-01-01': 0.044, '2025-04-01': 0.045,- '2025-07-01': 0.046, '2025-10-01': 0.047}}))-retries.append(('47Q', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'fixings': {'rate': 0.04}}))--with open(OUT, 'w', encoding='utf-8') as f:- for label, method, path, body in retries:- if method == 'GET':- status, resp = get(path)- else:- status, resp = post(path, body)- ok = 'OK' if status == 200 else 'FAIL'- f.write(f'--- #{label} {method} {path}\n')- if body:- f.write(f' Body: {json.dumps(body)}\n')- f.write(f' Status: {status} {ok}\n')- if status == 200:- if label == 'openapi_schema':- # Just show the notional-schedule and float leg parts- text = json.dumps(resp)- # Find notional-schedule- idx = text.find('notional-schedule')- f.write(f' notional-schedule excerpt: {text[max(0,idx-50):idx+500]}\n')- idx2 = text.find('float-coupon')- f.write(f' float-coupon excerpt: {text[max(0,idx2-50):idx2+500]}\n')- else:- data = resp.get('data', resp)- if isinstance(data, dict):- f.write(f' data keys: {list(data.keys())}\n')- f.write(f' data: {json.dumps(data)[:600]}\n')- elif isinstance(data, list):- f.write(f' data list len={len(data)}: {json.dumps(data)[:600]}\n')- else:- f.write(f' data: {str(data)[:400]}\n')- else:- detail = resp.get('detail', resp)- f.write(f' detail: {json.dumps(detail)[:700]}\n')- f.write('\n')diff --git a/fincept-qt/scripts/test_ql_retry.py b/fincept-qt/scripts/test_ql_retry.pydeleted file mode 100644index e9f1b935f..000000000--- a/fincept-qt/scripts/test_ql_retry.py+++ /dev/null@@ -1,145 +0,0 @@-import urllib.request-import json--BASE = 'https://api.fincept.in'-HEADERS = {- 'X-API-Key': 'fk_user_vU20qwUxKtPmg0fWpriNBhcAnBVGgOtJxsKiiwfD9Qo',- 'Accept': 'application/json',- 'Content-Type': 'application/json',- 'User-Agent': 'FinceptTerminal/4.0.1'-}--def post(path, body):- data = json.dumps(body).encode()- req = urllib.request.Request(BASE + path, data=data, headers=HEADERS, method='POST')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())- except Exception as ex:- return 0, {'detail': str(ex)}--def get(path):- h = {k: v for k, v in HEADERS.items() if k != 'Content-Type'}- req = urllib.request.Request(BASE + path, headers=h, method='GET')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())- except Exception as ex:- return 0, {'detail': str(ex)}--OUT = r'C:\windowsdisk\finceptTerminal\fincept-qt\scripts\ql_retry_results.txt'--retries = []--# #6: 405 - tried GET, try POST with no body, then check if endpoint exists differently-retries.append(('6a', 'POST', '/quantlib/core/types/spread/from-bps', {'bps': 50}))-retries.append(('6b', 'GET', '/quantlib/core/types/spread/from-bps', None)) # no query param-# Try with query param as POST body style-retries.append(('6c', 'POST', '/quantlib/core/types/spread/from-bps?bps=50', {}))--# #8: "Unknown schedule type: linear" - try 'amortizing', 'bullet', 'step_up', 'step_down', 'constant'-retries.append(('8a', 'POST', '/quantlib/core/types/notional-schedule',- {'notional': 1000000, 'periods': 4, 'schedule_type': 'amortizing'}))-retries.append(('8b', 'POST', '/quantlib/core/types/notional-schedule',- {'notional': 1000000, 'periods': 4, 'schedule_type': 'bullet'}))-retries.append(('8c', 'POST', '/quantlib/core/types/notional-schedule',- {'notional': 1000000, 'periods': 4, 'schedule_type': 'step_down'}))--# #16: gradient - x must be list-retries.append(('16a', 'POST', '/quantlib/core/autodiff/gradient',- {'func_name': 'sin', 'x': [1.0]}))-retries.append(('16b', 'POST', '/quantlib/core/autodiff/gradient',- {'func_name': 'sin', 'x': [1.0, 2.0]}))--# #17: taylor-expand - needs x0 field (not x)-retries.append(('17a', 'POST', '/quantlib/core/autodiff/taylor-expand',- {'func_name': 'sin', 'x0': 1.0, 'order': 3}))-retries.append(('17b', 'POST', '/quantlib/core/autodiff/taylor-expand',- {'func_name': 'sin', 'x0': 1.0, 'x': 1.5, 'order': 3}))--# #33: math/two-arg - available: maximum, minimum, power (not pow)-retries.append(('33a', 'POST', '/quantlib/core/math/two-arg',- {'func_name': 'power', 'x': 2.0, 'y': 10.0}))-retries.append(('33b', 'POST', '/quantlib/core/math/two-arg',- {'func_name': 'maximum', 'x': 2.0, 'y': 10.0}))--# #45: zero-rate-convert returned discount_factor but we wanted rate conversion-# data was {"discount_factor": 0.951...} - note the direction field may control output-retries.append(('45b', 'POST', '/quantlib/core/ops/zero-rate-convert',- {'direction': 'annual_to_continuous', 'value': 0.05, 't': 1.0}))--# #46: legs/fixed - "Cannot parse tenor: SEMIANNUAL" - try lowercase or standard codes-retries.append(('46a', 'POST', '/quantlib/core/legs/fixed',- {'notional': 1000000, 'rate': 0.05, 'frequency': 'semi-annual',- 'start_date': '2024-01-01', 'end_date': '2026-01-01'}))-retries.append(('46b', 'POST', '/quantlib/core/legs/fixed',- {'notional': 1000000, 'rate': 0.05, 'frequency': '6M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01'}))-retries.append(('46c', 'POST', '/quantlib/core/legs/fixed',- {'notional': 1000000, 'rate': 0.05, 'frequency': 'annual',- 'start_date': '2024-01-01', 'end_date': '2026-01-01'}))-retries.append(('46d', 'POST', '/quantlib/core/legs/fixed',- {'notional': 1000000, 'rate': 0.05, 'frequency': '1Y',- 'start_date': '2024-01-01', 'end_date': '2026-01-01'}))--# #47: legs/float - same tenor parsing issue-retries.append(('47a', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01'}))-retries.append(('47b', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': 'quarterly',- 'start_date': '2024-01-01', 'end_date': '2026-01-01'}))--# #50: periods/fixed-coupon - 500 error, try different field names-retries.append(('50a', 'POST', '/quantlib/core/periods/fixed-coupon',- {'notional': 1000000, 'rate': 0.05, 'start_date': '2024-01-01',- 'end_date': '2024-07-01', 'dcf': 0.5}))-retries.append(('50b', 'POST', '/quantlib/core/periods/fixed-coupon',- {'notional': 1000000, 'coupon_rate': 0.05, 'start_date': '2024-01-01',- 'end_date': '2024-07-01', 'day_count_fraction': 0.5}))-retries.append(('50c', 'POST', '/quantlib/core/periods/fixed-coupon',- {'notional': 1000000, 'rate': 0.05, 'start_date': '2024-01-01',- 'end_date': '2024-07-01'}))-retries.append(('50d', 'POST', '/quantlib/core/periods/fixed-coupon',- {'face_value': 1000000, 'coupon_rate': 0.05, 'start_date': '2024-01-01',- 'end_date': '2024-07-01', 'day_count_fraction': 0.5}))--# #51: periods/float-coupon - 500 error-retries.append(('51a', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000, 'rate': 0.05, 'spread': 0.01,- 'start_date': '2024-01-01', 'end_date': '2024-04-01'}))-retries.append(('51b', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000, 'index_rate': 0.04, 'spread': 0.01,- 'start_date': '2024-01-01', 'end_date': '2024-04-01'}))-retries.append(('51c', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000, 'libor_rate': 0.04, 'spread': 0.01,- 'start_date': '2024-01-01', 'end_date': '2024-04-01',- 'day_count_fraction': 0.25}))--with open(OUT, 'w', encoding='utf-8') as f:- for label, method, path, body in retries:- if method == 'POST':- status, resp = post(path, body)- else:- status, resp = get(path)- ok = 'OK' if status == 200 else 'FAIL'- f.write(f'--- #{label} {method} {path}\n')- f.write(f' Body: {json.dumps(body)}\n')- f.write(f' Status: {status} {ok}\n')- if status == 200:- data = resp.get('data', resp)- if isinstance(data, dict):- f.write(f' data keys: {list(data.keys())}\n')- f.write(f' data: {json.dumps(data)[:500]}\n')- elif isinstance(data, list):- f.write(f' data list len={len(data)}: {json.dumps(data)[:500]}\n')- else:- f.write(f' data: {str(data)[:400]}\n')- else:- detail = resp.get('detail', resp)- f.write(f' detail: {json.dumps(detail)[:600]}\n')- f.write('\n')diff --git a/fincept-qt/scripts/test_ql_retry2.py b/fincept-qt/scripts/test_ql_retry2.pydeleted file mode 100644index 6e7e09163..000000000--- a/fincept-qt/scripts/test_ql_retry2.py+++ /dev/null@@ -1,115 +0,0 @@-import urllib.request-import json--BASE = 'https://api.fincept.in'-HEADERS = {- 'X-API-Key': 'fk_user_vU20qwUxKtPmg0fWpriNBhcAnBVGgOtJxsKiiwfD9Qo',- 'Accept': 'application/json',- 'Content-Type': 'application/json',- 'User-Agent': 'FinceptTerminal/4.0.1'-}--def post(path, body):- data = json.dumps(body).encode()- req = urllib.request.Request(BASE + path, data=data, headers=HEADERS, method='POST')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())- except Exception as ex:- return 0, {'detail': str(ex)}--def get(path):- h = {k: v for k, v in HEADERS.items() if k != 'Content-Type'}- req = urllib.request.Request(BASE + path, headers=h, method='GET')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())- except Exception as ex:- return 0, {'detail': str(ex)}--OUT = r'C:\windowsdisk\finceptTerminal\fincept-qt\scripts\ql_retry2_results.txt'--retries = []--# #8: Try all plausible schedule types-for stype in ['fixed', 'declining', 'reducing', 'flat', 'equal', 'uniform',- 'constant', 'accreting', 'straight-line', 'straight_line',- 'linear_amortization', 'scheduled', 'custom']:- retries.append((f'8_{stype}', 'POST', '/quantlib/core/types/notional-schedule',- {'notional': 1000000, 'periods': 4, 'schedule_type': stype}))--# #47: float leg needs fixing_rate-retries.append(('47c', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'fixing_rate': 0.04}))-retries.append(('47d', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'fixed_rate': 0.04}))-retries.append(('47e', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'rate': 0.04}))--# #50: periods/fixed-coupon - server needs rate + day_count_fraction-# but 500 happens when both provided. Try omitting day_count_fraction and using day_count string-retries.append(('50e', 'POST', '/quantlib/core/periods/fixed-coupon',- {'notional': 1000000, 'rate': 0.05, 'start_date': '2024-01-01',- 'end_date': '2024-07-01', 'day_count': 'ACT/365'}))-retries.append(('50f', 'POST', '/quantlib/core/periods/fixed-coupon',- {'notional': 1000000, 'rate': 0.05, 'start_date': '2024-01-01',- 'end_date': '2024-07-01', 'day_count': 'Actual/365'}))-retries.append(('50g', 'POST', '/quantlib/core/periods/fixed-coupon',- {'notional': 1000000, 'rate': 0.05, 'start_date': '2024-01-01',- 'end_date': '2024-07-01', 'day_count': '30/360'}))-retries.append(('50h', 'POST', '/quantlib/core/periods/fixed-coupon',- {'notional': 1000000, 'rate': 0.05, 'start_date': '2024-01-01',- 'end_date': '2024-07-01', 'day_count_fraction': 181.0/365.0}))--# #51: periods/float-coupon - all attempts return 500-# Try minimalist body first to find required fields via 422-retries.append(('51d', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000}))-retries.append(('51e', 'POST', '/quantlib/core/periods/float-coupon',- {}))-retries.append(('51f', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000, 'libor_rate': 0.04, 'spread': 0.01,- 'start_date': '2024-01-01', 'end_date': '2024-04-01',- 'day_count': 'ACT/360'}))-retries.append(('51g', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000, 'rate': 0.04, 'spread': 0.01,- 'start_date': '2024-01-01', 'end_date': '2024-04-01',- 'day_count': 'ACT/360'}))-retries.append(('51h', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 1000000, 'fixing_rate': 0.04, 'spread': 0.01,- 'start_date': '2024-01-01', 'end_date': '2024-04-01',- 'day_count_fraction': 0.25}))--with open(OUT, 'w', encoding='utf-8') as f:- for label, method, path, body in retries:- if method == 'POST':- status, resp = post(path, body)- else:- status, resp = get(path)- ok = 'OK' if status == 200 else 'FAIL'- f.write(f'--- #{label} {method} {path}\n')- f.write(f' Body: {json.dumps(body)}\n')- f.write(f' Status: {status} {ok}\n')- if status == 200:- data = resp.get('data', resp)- if isinstance(data, dict):- f.write(f' data keys: {list(data.keys())}\n')- f.write(f' data: {json.dumps(data)[:600]}\n')- elif isinstance(data, list):- f.write(f' data list len={len(data)}: {json.dumps(data)[:600]}\n')- else:- f.write(f' data: {str(data)[:400]}\n')- else:- detail = resp.get('detail', resp)- f.write(f' detail: {json.dumps(detail)[:700]}\n')- f.write('\n')diff --git a/fincept-qt/scripts/test_ql_retry3.py b/fincept-qt/scripts/test_ql_retry3.pydeleted file mode 100644index 8dc8a5117..000000000--- a/fincept-qt/scripts/test_ql_retry3.py+++ /dev/null@@ -1,88 +0,0 @@-import urllib.request-import json--BASE = 'https://api.fincept.in'-HEADERS = {- 'X-API-Key': 'fk_user_vU20qwUxKtPmg0fWpriNBhcAnBVGgOtJxsKiiwfD9Qo',- 'Accept': 'application/json',- 'Content-Type': 'application/json',- 'User-Agent': 'FinceptTerminal/4.0.1'-}--def post(path, body):- data = json.dumps(body).encode()- req = urllib.request.Request(BASE + path, data=data, headers=HEADERS, method='POST')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())- except Exception as ex:- return 0, {'detail': str(ex)}--OUT = r'C:\windowsdisk\finceptTerminal\fincept-qt\scripts\ql_retry3_results.txt'-retries = []--# #8: try remaining QuantLib-style names-for stype in ['amortization', 'amortized', 'annuity', 'schedule', 'notional',- 'linearly_declining', 'step', 'balloon', 'interest_only', 'bond']:- retries.append((f'8_{stype}', 'POST', '/quantlib/core/types/notional-schedule',- {'notional': 1000000, 'periods': 4, 'schedule_type': stype}))--# #47: float leg - the error says "no fixing rate, fixed rate, or curve provided"-# so these field names are explicitly mentioned in the error - the server reads them but-# doesn't find them. Try different nesting or plural forms.-retries.append(('47f', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'curve': [0.04, 0.042, 0.043, 0.044, 0.045, 0.046, 0.047, 0.048]}))-retries.append(('47g', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'curve': {'rates': [0.04, 0.042, 0.043, 0.044], 'tenors': ['3M','6M','9M','1Y']}}))-retries.append(('47h', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'flat_rate': 0.04}))-retries.append(('47i', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'index_rate': 0.04}))-retries.append(('47j', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'libor': 0.04}))-retries.append(('47k', 'POST', '/quantlib/core/legs/float',- {'notional': 1000000, 'spread': 0.01, 'frequency': '3M',- 'start_date': '2024-01-01', 'end_date': '2026-01-01',- 'flat_forward': 0.04}))--# #50/#51 - server-side 500s, try minimal validation to see if required fields-# are different than expected. Send invalid types to force 422 validation errors.-retries.append(('50_probe', 'POST', '/quantlib/core/periods/fixed-coupon',- {'notional': 'X', 'rate': 'X', 'start_date': 'X', 'end_date': 'X',- 'day_count_fraction': 'X'}))-retries.append(('51_probe', 'POST', '/quantlib/core/periods/float-coupon',- {'notional': 'X', 'start_date': 'X', 'end_date': 'X',- 'libor_rate': 'X', 'spread': 'X', 'day_count_fraction': 'X'}))--with open(OUT, 'w', encoding='utf-8') as f:- for label, method, path, body in retries:- status, resp = post(path, body)- ok = 'OK' if status == 200 else 'FAIL'- f.write(f'--- #{label} {method} {path}\n')- f.write(f' Body: {json.dumps(body)}\n')- f.write(f' Status: {status} {ok}\n')- if status == 200:- data = resp.get('data', resp)- if isinstance(data, dict):- f.write(f' data keys: {list(data.keys())}\n')- f.write(f' data: {json.dumps(data)[:600]}\n')- elif isinstance(data, list):- f.write(f' data list len={len(data)}: {json.dumps(data)[:600]}\n')- else:- f.write(f' data: {str(data)[:400]}\n')- else:- detail = resp.get('detail', resp)- f.write(f' detail: {json.dumps(detail)[:700]}\n')- f.write('\n')diff --git a/fincept-qt/scripts/test_ql_schema.py b/fincept-qt/scripts/test_ql_schema.pydeleted file mode 100644index 056674f00..000000000--- a/fincept-qt/scripts/test_ql_schema.py+++ /dev/null@@ -1,49 +0,0 @@-import urllib.request-import json--BASE = 'https://api.fincept.in'-HEADERS = {- 'X-API-Key': 'fk_user_vU20qwUxKtPmg0fWpriNBhcAnBVGgOtJxsKiiwfD9Qo',- 'Accept': 'application/json',- 'User-Agent': 'FinceptTerminal/4.0.1'-}--def get(path):- h = {k: v for k, v in HEADERS.items()}- req = urllib.request.Request(BASE + path, headers=h, method='GET')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except Exception as ex:- return 0, {'detail': str(ex)}--status, resp = get('/openapi.json')-OUT = r'C:\windowsdisk\finceptTerminal\fincept-qt\scripts\ql_schema_results.txt'--with open(OUT, 'w', encoding='utf-8') as f:- if status != 200:- f.write(f'Failed: {resp}\n')- else:- schemas = resp.get('components', {}).get('schemas', {})- # Print schemas relevant to our failing endpoints- targets = [- 'NotionalScheduleRequest',- 'FloatLegRequest',- 'FloatPeriodRequest',- 'FixedCouponPeriodRequest',- 'FixedPeriodRequest',- ]- for name in targets:- if name in schemas:- f.write(f'=== {name} ===\n')- f.write(json.dumps(schemas[name], indent=2) + '\n\n')- else:- f.write(f'=== {name}: NOT FOUND ===\n')- # Try to find partial matches- matches = [k for k in schemas if name.lower()[:6] in k.lower()]- f.write(f' Similar: {matches}\n\n')-- # Also dump all schema names- f.write('=== ALL SCHEMA NAMES ===\n')- for k in sorted(schemas.keys()):- f.write(f' {k}\n')diff --git a/fincept-qt/scripts/test_quantlib_batch1.py b/fincept-qt/scripts/test_quantlib_batch1.pydeleted file mode 100644index 76ea9259d..000000000--- a/fincept-qt/scripts/test_quantlib_batch1.py+++ /dev/null@@ -1,80 +0,0 @@-import urllib.request-import json-import os--BASE = 'https://api.fincept.in'-HEADERS = {- 'X-API-Key': 'fk_user_vU20qwUxKtPmg0fWpriNBhcAnBVGgOtJxsKiiwfD9Qo',- 'Accept': 'application/json',- 'Content-Type': 'application/json',- 'User-Agent': 'FinceptTerminal/4.0.1'-}--def post(path, body):- data = json.dumps(body).encode()- req = urllib.request.Request(BASE + path, data=data, headers=HEADERS, method='POST')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())--def get(path):- h = {k: v for k, v in HEADERS.items() if k != 'Content-Type'}- req = urllib.request.Request(BASE + path, headers=h, method='GET')- try:- with urllib.request.urlopen(req, timeout=20) as r:- return r.status, json.loads(r.read())- except urllib.error.HTTPError as e:- return e.code, json.loads(e.read())--tests = [- (4, 'POST', '/quantlib/core/types/money/convert',- {'amount': 100, 'from_currency': 'USD', 'to_currency': 'EUR', 'rate': 0.92}),- (5, 'POST', '/quantlib/core/types/rate/convert',- {'value': 0.05, 'from_type': 'annual', 'to_type': 'continuous'}),- (6, 'GET', '/quantlib/core/types/spread/from-bps?bps=50', None),- (7, 'POST', '/quantlib/core/types/tenor/add-to-date',- {'start_date': '2024-01-01', 'tenor': '3M'}),- (8, 'POST', '/quantlib/core/types/notional-schedule',- {'notional': 1000000, 'periods': 4, 'schedule_type': 'linear'}),- (10, 'POST', '/quantlib/core/conventions/format-date',- {'date_str': '2024-01-15', 'format': '%d/%m/%Y'}),- (11, 'POST', '/quantlib/core/conventions/days-to-years',- {'value': 365, 'day_count': 'ACT/365'}),- (12, 'POST', '/quantlib/core/conventions/years-to-days',- {'value': 1.0, 'day_count': 'ACT/365'}),- (13, 'POST', '/quantlib/core/conventions/normalize-rate',- {'value': 0.05, 'compounding': 'annual'}),- (14, 'POST', '/quantlib/core/conventions/normalize-volatility',- {'value': 0.2, 'tenor': '1Y'}),- (15, 'POST', '/quantlib/core/autodiff/dual-eval',- {'func_name': 'sin', 'x': 1.0}),- (16, 'POST', '/quantlib/core/autodiff/gradient',- {'func_name': 'sin', 'x': 1.0}),- (17, 'POST', '/quantlib/core/autodiff/taylor-expand',- {'func_name': 'sin', 'x': 1.0, 'order': 3}),-]--out_path = r'C:\windowsdisk\finceptTerminal\fincept-qt\scripts\test_results_batch1.txt'-with open(out_path, 'w', encoding='utf-8') as f:- for num, method, path, body in tests:- if method == 'POST':- status, resp = post(path, body)- else:- status, resp = get(path)- ok = 'OK' if status == 200 else 'FAIL'- f.write(f'--- #{num} {method} {path}\n')- f.write(f' Status: {status} {ok}\n')- if status == 200:- data = resp.get('data', resp)- if isinstance(data, dict):- f.write(f' data keys: {list(data.keys())}\n')- f.write(f' data: {json.dumps(data)[:400]}\n')- elif isinstance(data, list):- f.write(f' data (list len={len(data)}): {str(data)[:400]}\n')- else:- f.write(f' data: {str(data)[:400]}\n')- else:- f.write(f' full_resp: {json.dumps(resp)[:800]}\n')- f.write('\n')diff --git a/fincept-qt/src/app/MainWindow.cpp b/fincept-qt/src/app/MainWindow.cppindex 63cba57e1..b8f689841 100644--- a/fincept-qt/src/app/MainWindow.cpp+++ b/fincept-qt/src/app/MainWindow.cpp@@ -936,8 +936,13 @@ void MainWindow::on_auth_state_changed() {set_shell_visible(true);stack_->setCurrentIndex(1);WorkspaceManager::instance().load_last_workspace();- // Trigger silent update check after login (delayed so UI settles first)- QTimer::singleShot(3000, this, []() { services::UpdateService::instance().check_for_updates(true); });+ // Trigger silent update check after login (delayed so UI settles first).+ // UpdateService de-dupes silent checks across the session, so the+ // post-PIN-unlock path below won't fire a second request.+ QTimer::singleShot(3000, this, [this]() {+ services::UpdateService::instance().set_dialog_parent(this);+ services::UpdateService::instance().check_for_updates(true);+ });// Warm instrument cache in background — only loaded if not already cached.// Runs concurrently while the user reads the dashboard (3-5s head start).fincept::trading::InstrumentService::instance().load_from_db_async("zerodha");@@ -1042,7 +1047,12 @@ void MainWindow::on_terminal_unlocked() {}}WorkspaceManager::instance().load_last_workspace();- QTimer::singleShot(3000, this, []() { services::UpdateService::instance().check_for_updates(true); });+ // Silent update check — UpdateService de-dupes across call sites so+ // the login path + this post-unlock path won't fire two requests.+ QTimer::singleShot(3000, this, [this]() {+ services::UpdateService::instance().set_dialog_parent(this);+ services::UpdateService::instance().check_for_updates(true);+ });} else {// Free/no plan → pricing gateset_shell_visible(false);diff --git a/fincept-qt/src/app/main.cpp b/fincept-qt/src/app/main.cppindex 3ddb5c211..c2b403937 100644--- a/fincept-qt/src/app/main.cpp+++ b/fincept-qt/src/app/main.cpp@@ -85,7 +85,10 @@ int main(int argc, char* argv[]) {profile_key.toUtf8());app.setApplicationName("FinceptTerminal");app.setOrganizationName("Fincept");- app.setApplicationVersion("4.0.1");+#ifndef FINCEPT_VERSION_STRING+# define FINCEPT_VERSION_STRING "0.0.0-dev"+#endif+ app.setApplicationVersion(QStringLiteral(FINCEPT_VERSION_STRING));// ── Secondary instance: signal primary to open a new window, then exit ───// The primary receives receivedMessage() and calls open_new_window().@@ -223,7 +226,7 @@ int main(int argc, char* argv[]) {log.set_tag_level(tag, lvl_map.value(level));}}- LOG_INFO("App", "Fincept Terminal v4.0.1 starting...");+ LOG_INFO("App", "Fincept Terminal v4.0.2 starting...");// Theme is applied after DB is open so saved font/theme are respected from the start.diff --git a/fincept-qt/src/mcp/McpClient.cpp b/fincept-qt/src/mcp/McpClient.cppindex 719b8942a..8cbaf762c 100644--- a/fincept-qt/src/mcp/McpClient.cpp+++ b/fincept-qt/src/mcp/McpClient.cpp@@ -168,7 +168,7 @@ Result<QJsonObject> McpClient::initialize() {QJsonObject client_info;client_info["name"] = "FinceptTerminal";- client_info["version"] = "4.0.1";+ client_info["version"] = "4.0.2";params["clientInfo"] = client_info;QJsonObject capabilities;diff --git a/fincept-qt/src/screens/about/AboutScreen.cpp b/fincept-qt/src/screens/about/AboutScreen.cppindex 8a8b1f04f..938d44e32 100644--- a/fincept-qt/src/screens/about/AboutScreen.cpp+++ b/fincept-qt/src/screens/about/AboutScreen.cpp@@ -1,7 +1,9 @@#include "screens/about/AboutScreen.h"+#include "services/updater/UpdateService.h"#include "ui/theme/Theme.h"+#include <QApplication>#include <QDesktopServices>#include <QFrame>#include <QGridLayout>@@ -142,16 +144,33 @@ AboutScreen::AboutScreen(QWidget* parent) : QWidget(parent) {auto* right = new QVBoxLayout;right->setSpacing(4);right->setAlignment(Qt::AlignRight);- auto* ver = new QLabel("v4.0.0");+ auto* ver = new QLabel(QStringLiteral("v%1").arg(QApplication::applicationVersion()));ver->setStyleSheet(QString("color: %1; font-size: 18px; font-weight: bold; background: transparent; ""font-family: 'Consolas','Courier New',monospace;").arg(ui::colors::AMBER()));ver->setAlignment(Qt::AlignRight);right->addWidget(ver);- auto* bdate = new QLabel("Build: 2026-03-20");- bdate->setStyleSheet(MUTED());- bdate->setAlignment(Qt::AlignRight);- right->addWidget(bdate);++ // Check-for-updates button — user-initiated, always shows a result dialog.+ auto* check_btn = new QPushButton(QStringLiteral("Check for Updates"));+ check_btn->setStyleSheet(LINK_BTN());+ check_btn->setCursor(Qt::PointingHandCursor);+ connect(check_btn, &QPushButton::clicked, this, [this, check_btn]() {+ check_btn->setEnabled(false);+ check_btn->setText(QStringLiteral("Checking…"));+ auto& svc = services::UpdateService::instance();+ svc.set_dialog_parent(window());+ // Re-enable the button when the check completes. Using a unique+ // connection is fine since the service is a long-lived singleton.+ connect(&svc, &services::UpdateService::check_finished, check_btn,+ [check_btn](bool /*found*/) {+ check_btn->setEnabled(true);+ check_btn->setText(QStringLiteral("Check for Updates"));+ },+ Qt::SingleShotConnection);+ svc.check_for_updates(/*silent=*/false);+ });+ right->addWidget(check_btn);bhl->addLayout(right);pvl->addWidget(body);diff --git a/fincept-qt/src/services/updater/UpdateService.cpp b/fincept-qt/src/services/updater/UpdateService.cppindex 93e0a9b1b..f973deae5 100644--- a/fincept-qt/src/services/updater/UpdateService.cpp+++ b/fincept-qt/src/services/updater/UpdateService.cpp@@ -3,14 +3,23 @@#include "core/logging/Logger.h"#include <QApplication>+#include <QCryptographicHash>+#include <QDesktopServices>+#include <QDir>+#include <QFile>+#include <QFileInfo>+#include <QJsonDocument>+#include <QJsonObject>+#include <QAbstractButton>#include <QMessageBox>-#include <QSimpleUpdater.h>+#include <QNetworkReply>+#include <QPushButton>+#include <QNetworkRequest>+#include <QProcess>+#include <QRegularExpression>#include <QStandardPaths>--#ifdef Q_OS_LINUX-# include <QFileInfo>-# include <QProcess>-#endif+#include <QSysInfo>+#include <QUrl>namespace fincept::services {@@ -19,180 +28,405 @@ UpdateService& UpdateService::instance() {return inst;}-UpdateService::UpdateService(QObject* parent) : QObject(parent), url_(DEFAULT_MANIFEST_URL) {- updater_ = QSimpleUpdater::getInstance();+UpdateService::UpdateService(QObject* parent) : QObject(parent) {+ net_.setRedirectPolicy(QNetworkRequest::NoLessSafeRedirectPolicy);+ // GitHub release asset downloads redirect across origins — allow the jump.+ net_.setStrictTransportSecurityEnabled(true);+}- updater_->setModuleVersion(url_, QApplication::applicationVersion());- updater_->setModuleName(url_, "Fincept Terminal");- updater_->setNotifyOnUpdate(url_, true);- updater_->setNotifyOnFinish(url_, false);+QWidget* UpdateService::dialog_parent() {+ if (dialog_parent_)+ return dialog_parent_.data();+ return QApplication::activeWindow();+}-#ifdef Q_OS_LINUX- // On Linux (AppImage): disable the built-in downloader — we use- // AppImageUpdate for in-place delta updates instead.- updater_->setDownloaderEnabled(url_, false);- updater_->setUseCustomInstallProcedures(url_, true);+// ── Platform / arch detection ───────────────────────────────────────────────++QString UpdateService::current_platform_key() {+ const QString arch = QSysInfo::currentCpuArchitecture();+ // QSysInfo returns "x86_64", "i386", "arm64", "arm" etc.+ const bool is_arm64 = arch.contains(QLatin1String("arm64")) ||+ arch.contains(QLatin1String("aarch64"));+ const bool is_x64 = arch.contains(QLatin1String("x86_64")) ||+ arch.contains(QLatin1String("x64"));++#if defined(Q_OS_WIN)+ if (is_arm64)+ return QStringLiteral("windows-arm64");+ if (is_x64)+ return QStringLiteral("windows-x64");+ return {};+#elif defined(Q_OS_MACOS)+ if (is_arm64)+ return QStringLiteral("macos-arm64");+ if (is_x64)+ return QStringLiteral("macos-x64");+ return {};+#elif defined(Q_OS_LINUX)+ if (is_arm64)+ return QStringLiteral("linux-arm64");+ if (is_x64)+ return QStringLiteral("linux-x64");+ return {};#else- updater_->setDownloaderEnabled(url_, true);+ return {};#endif+}- connect(updater_, &QSimpleUpdater::checkingFinished, this, [this](const QString& checked_url) {- if (checked_url != url_)- return;-- // If the manifest is unreachable or returns a non-200 response,- // QSimpleUpdater sets latestVersion to empty — treat as "no update"- // rather than surfacing an error dialog to the user.- const QString latest = updater_->getLatestVersion(url_);- if (latest.isEmpty()) {- LOG_WARN("UpdateService", "Update manifest returned empty version — server may be unreachable "- "or updates.json not yet published. Skipping silently.");- emit check_finished(false);- return;- }+// ── Version parsing ─────────────────────────────────────────────────────────- bool found = updater_->getUpdateAvailable(url_);- LOG_INFO("UpdateService",- QString("Check finished — update available: %1, latest: %2").arg(found ? "yes" : "no").arg(latest));+bool UpdateService::parse_version(const QString& s, int& major, int& minor, int& patch) {+ static const QRegularExpression re(QStringLiteral("^(\\d+)\\.(\\d+)\\.(\\d+)$"));+ const auto m = re.match(s);+ if (!m.hasMatch())+ return false;+ bool ok_major = false, ok_minor = false, ok_patch = false;+ major = m.captured(1).toInt(&ok_major);+ minor = m.captured(2).toInt(&ok_minor);+ patch = m.captured(3).toInt(&ok_patch);+ return ok_major && ok_minor && ok_patch;+}-#ifdef Q_OS_LINUX- if (found) {- // Prompt the user then run AppImageUpdate in-place- auto btn = QMessageBox::question(nullptr, "Update Available",- QString("Fincept Terminal %1 is available.\n\n"- "The update will be applied in the background.\n"- "Restart when prompted to complete installation.\n\n"- "Update now?")- .arg(latest),- QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);- if (btn == QMessageBox::Yes)- run_appimage_update();- }-#endif- emit check_finished(found);- });-- connect(updater_, &QSimpleUpdater::downloadFinished, this,- [this](const QString& checked_url, const QString& filepath) {- if (checked_url != url_)- return;- LOG_INFO("UpdateService", QString("Download finished: %1").arg(filepath));- emit download_finished(filepath);- });+bool UpdateService::is_newer(const QString& local, const QString& remote) {+ int lmaj = 0, lmin = 0, lpat = 0;+ int rmaj = 0, rmin = 0, rpat = 0;+ if (!parse_version(local, lmaj, lmin, lpat))+ return false; // dev build or malformed — never treat as "update available"+ if (!parse_version(remote, rmaj, rmin, rpat))+ return false; // malformed manifest — reject+ if (rmaj != lmaj)+ return rmaj > lmaj;+ if (rmin != lmin)+ return rmin > lmin;+ return rpat > lpat;}+// ── Public entry point ──────────────────────────────────────────────────────+void UpdateService::check_for_updates(bool silent) {- updater_->setNotifyOnFinish(url_, !silent);- LOG_INFO("UpdateService", QString("Checking for updates at: %1").arg(url_));- updater_->checkForUpdates(url_);-}+ if (in_progress_) {+ LOG_INFO("UpdateService", "Check already in progress — ignoring duplicate call");+ return;+ }+ if (silent && silent_check_done_) {+ LOG_DEBUG("UpdateService", "Silent check already completed this session — skipping");+ return;+ }+ if (silent)+ silent_check_done_ = true;-bool UpdateService::update_available() const {- return updater_->getUpdateAvailable(url_);-}+ silent_ = silent;+ update_available_ = false;+ latest_version_.clear();+ changelog_.clear();+ pending_download_url_.clear();+ pending_expected_sha256_.clear();-QString UpdateService::latest_version() const {- return updater_->getLatestVersion(url_);-}+ // Skip the check for dev builds — their version string doesn't match the+ // manifest format and we'd otherwise never find a match.+ const QString local_version = QApplication::applicationVersion();+ int maj = 0, min = 0, pat = 0;+ if (!parse_version(local_version, maj, min, pat)) {+ LOG_INFO("UpdateService",+ QString("Skipping update check — running version '%1' is not a release build").arg(local_version));+ if (!silent_)+ show_error(QStringLiteral("This is a development build (%1). Auto-update is disabled.").arg(local_version));+ emit check_finished(false);+ return;+ }-QString UpdateService::changelog() const {- return updater_->getChangelog(url_);-}+ const QString platform_key = current_platform_key();+ if (platform_key.isEmpty()) {+ LOG_WARN("UpdateService", QString("Unsupported platform/arch: %1 / %2")+ .arg(QSysInfo::kernelType(), QSysInfo::currentCpuArchitecture()));+ if (!silent_)+ show_error(QStringLiteral("Auto-update is not supported on this platform."));+ emit check_finished(false);+ return;+ }-void UpdateService::set_mandatory(bool mandatory) {- mandatory_ = mandatory;- updater_->setMandatoryUpdate(url_, mandatory);-}+ in_progress_ = true;+ LOG_INFO("UpdateService",+ QString("Checking for updates — platform=%1, local=%2, manifest=%3")+ .arg(platform_key, local_version, manifest_url_));-void UpdateService::set_manifest_url(const QString& url) {- url_ = url;- updater_->setModuleVersion(url_, QApplication::applicationVersion());- updater_->setModuleName(url_, "Fincept Terminal");- updater_->setNotifyOnUpdate(url_, true);- updater_->setNotifyOnFinish(url_, false);- updater_->setMandatoryUpdate(url_, mandatory_);-#ifdef Q_OS_LINUX- updater_->setDownloaderEnabled(url_, false);- updater_->setUseCustomInstallProcedures(url_, true);-#else- updater_->setDownloaderEnabled(url_, true);-#endif+ QNetworkRequest req{QUrl(manifest_url_)};+ req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);+ req.setHeader(QNetworkRequest::UserAgentHeader,+ QString("FinceptTerminal/%1 (%2)").arg(local_version, platform_key));+ QNetworkReply* reply = net_.get(req);+ connect(reply, &QNetworkReply::finished, this, &UpdateService::on_manifest_reply_finished);}-void UpdateService::set_download_dir(const QString& dir) {- updater_->setDownloadDir(url_, dir);-}+// ── Manifest response ───────────────────────────────────────────────────────-void UpdateService::set_notify_on_finish(bool notify) {- updater_->setNotifyOnFinish(url_, notify);-}+void UpdateService::on_manifest_reply_finished() {+ auto* reply = qobject_cast<QNetworkReply*>(sender());+ if (!reply)+ return;+ reply->deleteLater();-// ── Linux: AppImage in-place update ─────────────────────────────────────────+ if (reply->error() != QNetworkReply::NoError) {+ LOG_WARN("UpdateService",+ QString("Manifest fetch failed: %1 (%2)").arg(reply->errorString()).arg(reply->error()));+ if (!silent_)+ show_error(QStringLiteral("Could not reach the update server.\n\n%1").arg(reply->errorString()));+ finish_check(false);+ return;+ }-#ifdef Q_OS_LINUX-void UpdateService::run_appimage_update() {- // APPIMAGE env var is set by the AppImage runtime — it's the path to- // the running .AppImage file. AppImageUpdate patches it in-place.- QString appimage_path = qEnvironmentVariable("APPIMAGE");- if (appimage_path.isEmpty()) {- LOG_WARN("UpdateService", "APPIMAGE env var not set — not running as AppImage, skipping in-place update");- emit appimage_update_finished(false);+ const QByteArray body = reply->readAll();+ QJsonParseError parse_err{};+ const QJsonDocument doc = QJsonDocument::fromJson(body, &parse_err);+ if (parse_err.error != QJsonParseError::NoError || !doc.isObject()) {+ LOG_WARN("UpdateService", QString("Manifest JSON parse failed: %1").arg(parse_err.errorString()));+ if (!silent_)+ show_error(QStringLiteral("The update manifest is malformed."));+ finish_check(false);return;}- // Look for AppImageUpdate tool bundled inside the AppImage or on PATH- QString tool;- QStringList candidates = {- QApplication::applicationDirPath() + "/AppImageUpdate",- "/usr/local/bin/AppImageUpdate",- "/usr/bin/AppImageUpdate",- };- for (const auto& c : candidates) {- if (QFileInfo::exists(c)) {- tool = c;- break;- }+ const QJsonObject root = doc.object();+ const QJsonObject updates = root.value(QStringLiteral("updates")).toObject();+ const QString key = current_platform_key();+ if (!updates.contains(key)) {+ LOG_INFO("UpdateService",+ QString("Manifest has no entry for '%1' — no update available").arg(key));+ finish_check(false);+ return;}- if (tool.isEmpty()) {- // Fall back: open the GitHub release page so user can download manually- LOG_WARN("UpdateService", "AppImageUpdate not found — falling back to browser download");- updater_->setDownloaderEnabled(url_, true);- updater_->setUseCustomInstallProcedures(url_, false);- emit check_finished(true); // re-trigger QSimpleUpdater UI+ const QJsonObject entry = updates.value(key).toObject();+ const QString remote_version = entry.value(QStringLiteral("latest-version")).toString();+ const QString download_url = entry.value(QStringLiteral("download-url")).toString();+ const QString sha256 = entry.value(QStringLiteral("sha256")).toString().trimmed().toLower();+ const QString open_url = entry.value(QStringLiteral("open-url")).toString();+ const QString changelog = entry.value(QStringLiteral("changelog")).toString();++ latest_version_ = remote_version;+ changelog_ = changelog;++ if (remote_version.isEmpty() || download_url.isEmpty()) {+ LOG_WARN("UpdateService",+ QString("Manifest entry for '%1' is missing latest-version or download-url").arg(key));+ finish_check(false);return;}- if (appimage_update_process_) {- appimage_update_process_->deleteLater();- appimage_update_process_ = nullptr;+ const QString local_version = QApplication::applicationVersion();+ if (!is_newer(local_version, remote_version)) {+ LOG_INFO("UpdateService",+ QString("Already up to date — local=%1, remote=%2").arg(local_version, remote_version));+ if (!silent_) {+ QMessageBox::information(+ dialog_parent(), QStringLiteral("Fincept Terminal"),+ QStringLiteral("You're running the latest version (%1).").arg(local_version));+ }+ finish_check(false);+ return;}- appimage_update_process_ = new QProcess(this);+ update_available_ = true;+ LOG_INFO("UpdateService",+ QString("Update available: %1 → %2").arg(local_version, remote_version));- connect(appimage_update_process_, &QProcess::finished, this, [this](int exit_code, QProcess::ExitStatus) {- bool ok = (exit_code == 0);- LOG_INFO("UpdateService", QString("AppImageUpdate finished — exit code: %1").arg(exit_code));- if (ok) {- QMessageBox::information(- nullptr, "Update Complete",- "Fincept Terminal has been updated.\nPlease restart the application to use the new version.");- } else {- QString err = appimage_update_process_->readAllStandardError();- LOG_ERROR("UpdateService", QString("AppImageUpdate failed: %1").arg(err));- QMessageBox::warning(nullptr, "Update Failed",- "The automatic update could not be applied.\n"- "Please download the latest version from the Fincept website.");+ // Prompt the user. Include changelog if present. Always offer a "view release+ // notes" escape hatch via open-url so users can read more before installing.+ QString prompt = QStringLiteral("A new version of Fincept Terminal is available.\n\n"+ "Current version: %1\nLatest version: %2\n\n")+ .arg(local_version, remote_version);+ if (!changelog.isEmpty()) {+ QString snippet = changelog;+ if (snippet.size() > 500)+ snippet = snippet.left(500) + QStringLiteral("\n…");+ prompt += QStringLiteral("What's new:\n%1\n\n").arg(snippet);+ }+ prompt += QStringLiteral("Download the installer now?");++ QMessageBox box(dialog_parent());+ box.setWindowTitle(QStringLiteral("Update Available"));+ box.setIcon(QMessageBox::Information);+ box.setText(prompt);+ QPushButton* install_btn = box.addButton(QStringLiteral("Download && Install"), QMessageBox::AcceptRole);+ QPushButton* release_btn = open_url.isEmpty()+ ? nullptr+ : box.addButton(QStringLiteral("View Release Notes"), QMessageBox::HelpRole);+ box.addButton(QMessageBox::Cancel);+ box.setDefaultButton(install_btn);+ box.exec();++ QAbstractButton* clicked = box.clickedButton();+ if (clicked == install_btn) {+ pending_expected_sha256_ = sha256;+ start_download(download_url, sha256);+ } else if (release_btn && clicked == release_btn) {+ QDesktopServices::openUrl(QUrl(open_url));+ finish_check(true);+ } else {+ LOG_INFO("UpdateService", "User declined the update");+ finish_check(true);+ }+}++// ── Download + verify ───────────────────────────────────────────────────────++void UpdateService::start_download(const QString& url, const QString& expected_sha256) {+ pending_download_url_ = url;++ // Build a stable local path in the system temp dir, preserving the+ // installer's basename so the user recognises it.+ const QString file_name = QFileInfo(QUrl(url).path()).fileName();+ const QString dir = QStandardPaths::writableLocation(QStandardPaths::TempLocation);+ pending_local_path_ = QDir(dir).filePath(file_name.isEmpty()+ ? QStringLiteral("FinceptTerminal-update.tmp")+ : file_name);++ // Drop any leftover from a previous run — otherwise a partial file could+ // survive and poison sha256 verification.+ QFile::remove(pending_local_path_);++ LOG_INFO("UpdateService",+ QString("Downloading installer: %1 → %2 (expected sha256=%3)")+ .arg(url, pending_local_path_, expected_sha256.isEmpty() ? QStringLiteral("<none>") : expected_sha256));++ QNetworkRequest req{QUrl(url)};+ req.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);+ req.setHeader(QNetworkRequest::UserAgentHeader,+ QString("FinceptTerminal/%1").arg(QApplication::applicationVersion()));+ QNetworkReply* reply = net_.get(req);+ connect(reply, &QNetworkReply::finished, this, &UpdateService::on_download_reply_finished);+ connect(reply, &QNetworkReply::downloadProgress, this, &UpdateService::on_download_progress);+}++void UpdateService::on_download_progress(qint64 received, qint64 total) {+ // Log every ~5 MiB to avoid spamming. No GUI progress for v1 — keep the+ // surface area small. A proper progress dialog can be layered on later.+ static qint64 last_logged = 0;+ if (received - last_logged >= 5 * 1024 * 1024 || received == total) {+ last_logged = received;+ LOG_DEBUG("UpdateService",+ QString("Download progress: %1 / %2 bytes").arg(received).arg(total));+ }+}++void UpdateService::on_download_reply_finished() {+ auto* reply = qobject_cast<QNetworkReply*>(sender());+ if (!reply)+ return;+ reply->deleteLater();++ if (reply->error() != QNetworkReply::NoError) {+ LOG_ERROR("UpdateService", QString("Installer download failed: %1").arg(reply->errorString()));+ show_error(QStringLiteral("The installer could not be downloaded.\n\n%1").arg(reply->errorString()));+ QFile::remove(pending_local_path_);+ finish_check(true);+ return;+ }++ // Write body to disk.+ QFile f(pending_local_path_);+ if (!f.open(QIODevice::WriteOnly | QIODevice::Truncate)) {+ LOG_ERROR("UpdateService", QString("Cannot open %1 for writing: %2").arg(pending_local_path_, f.errorString()));+ show_error(QStringLiteral("Cannot save the installer to disk:\n%1").arg(f.errorString()));+ finish_check(true);+ return;+ }+ const QByteArray body = reply->readAll();+ f.write(body);+ f.close();++ // Verify sha256 if the manifest provided one. Missing sha256 logs a+ // warning but does not abort — the server may be a pre-sha256 deployment.+ if (!pending_expected_sha256_.isEmpty()) {+ QFile vf(pending_local_path_);+ if (!vf.open(QIODevice::ReadOnly)) {+ LOG_ERROR("UpdateService", QString("Cannot reopen %1 for hashing").arg(pending_local_path_));+ show_error(QStringLiteral("Could not verify the downloaded installer."));+ QFile::remove(pending_local_path_);+ finish_check(true);+ return;+ }+ QCryptographicHash hasher(QCryptographicHash::Sha256);+ if (!hasher.addData(&vf)) {+ vf.close();+ LOG_ERROR("UpdateService", "Sha256 hashing failed");+ show_error(QStringLiteral("Could not verify the downloaded installer."));+ QFile::remove(pending_local_path_);+ finish_check(true);+ return;}- emit appimage_update_finished(ok);- appimage_update_process_->deleteLater();- appimage_update_process_ = nullptr;- });-- LOG_INFO("UpdateService", QString("Running AppImageUpdate: %1 %2").arg(tool, appimage_path));- // -O flag: overwrite the source AppImage in-place- appimage_update_process_->start(tool, {"-O", appimage_path});+ vf.close();+ const QString actual = QString::fromLatin1(hasher.result().toHex()).toLower();+ if (actual != pending_expected_sha256_) {+ LOG_ERROR("UpdateService",+ QString("Sha256 mismatch — expected=%1, actual=%2").arg(pending_expected_sha256_, actual));+ show_error(QStringLiteral("The downloaded installer failed integrity verification. "+ "It may be corrupt or tampered with."));+ QFile::remove(pending_local_path_);+ finish_check(true);+ return;+ }+ LOG_INFO("UpdateService", QString("Sha256 verified: %1").arg(actual));+ } else {+ LOG_WARN("UpdateService", "No sha256 in manifest — skipping integrity verification");+ }++ emit download_finished(pending_local_path_);++ // Hand off: on platforms where we can launch the installer (and the user+ // will be prompted by the OS anyway), do so. Otherwise reveal the file.+#if defined(Q_OS_WIN) || defined(Q_OS_MACOS) || defined(Q_OS_LINUX)+ launch_installer(pending_local_path_);+#else+ reveal_in_file_manager(pending_local_path_);+#endif++ finish_check(true);}++// ── Launch / reveal ─────────────────────────────────────────────────────────++void UpdateService::launch_installer(const QString& path) {+ LOG_INFO("UpdateService", QString("Launching installer: %1").arg(path));++#ifdef Q_OS_LINUX+ // Linux installers (.run) need the executable bit set before they can be+ // launched. QDesktopServices::openUrl on a non-executable .run just hands+ // it to the file manager, which is not what the user expects after+ // clicking "Install".+ QFile f(path);+ f.setPermissions(f.permissions() | QFileDevice::ExeOwner | QFileDevice::ExeUser |+ QFileDevice::ExeGroup | QFileDevice::ExeOther);#endif+ // startDetached is the right call here — we want the installer to outlive+ // this process so the user can restart and finish installation.+ const bool started = QProcess::startDetached(path, {});+ if (!started) {+ LOG_WARN("UpdateService", "startDetached failed — falling back to reveal-in-file-manager");+ reveal_in_file_manager(path);+ QMessageBox::information(+ dialog_parent(), QStringLiteral("Update Downloaded"),+ QStringLiteral("The installer has been downloaded to:\n%1\n\n"+ "Please run it manually to complete the update.")+ .arg(QDir::toNativeSeparators(path)));+ }+}++void UpdateService::reveal_in_file_manager(const QString& path) {+ const QUrl url = QUrl::fromLocalFile(QFileInfo(path).absolutePath());+ QDesktopServices::openUrl(url);+}++// ── Helpers ─────────────────────────────────────────────────────────────────++void UpdateService::finish_check(bool update_found) {+ in_progress_ = false;+ emit check_finished(update_found);+}++void UpdateService::show_error(const QString& text) {+ QMessageBox::warning(dialog_parent(), QStringLiteral("Fincept Terminal"), text);+}+} // namespace fincept::servicesdiff --git a/fincept-qt/src/services/updater/UpdateService.h b/fincept-qt/src/services/updater/UpdateService.hindex 990e6eca4..bea79acf5 100644--- a/fincept-qt/src/services/updater/UpdateService.h+++ b/fincept-qt/src/services/updater/UpdateService.h@@ -1,76 +1,113 @@#pragma once++#include <QNetworkAccessManager>#include <QObject>+#include <QPointer>#include <QString>-class QSimpleUpdater;-class QProcess;+class QNetworkReply;+class QWidget;namespace fincept::services {/// Cross-platform auto-update service.///-/// - Windows/macOS: QSimpleUpdater downloads the package and opens it-/// (zip/tar → user runs installer or drags .app).-/// - Linux (AppImage): AppImageUpdate performs an in-place delta update-/// transparently; user just sees a "restart to apply" prompt.+/// Downloads a JSON manifest, compares the running app version with the+/// manifest's per-platform/per-arch `latest-version`, and — if newer — fetches+/// the installer, verifies its sha256, and launches it.+///+/// Manifest schema (see updates.json):+/// {+/// "updates": {+/// "windows-x64": { "latest-version": "4.0.2", "download-url": "...", "sha256": "...", "open-url": "...", "changelog": "..." },+/// "windows-arm64":{ ... },+/// "linux-x64": { ... },+/// "macos-arm64": { ... },+/// "macos-x64": { ... },+/// "macos-universal": { ... }+/// }+/// }+///+/// Platforms where auto-install isn't possible (unsigned / no installer) fall+/// back to revealing the downloaded file to the user.class UpdateService : public QObject {Q_OBJECTpublic:static UpdateService& instance();- /// Trigger an update check. Safe to call from any screen.- /// silent=true → no "up to date" popup when already current.+ /// Trigger an update check.+ /// - silent=true → no dialog when already up to date or manifest unreachable.+ /// - silent=false → show result either way (used by "Check for Updates" menu).void check_for_updates(bool silent = true);/// Whether an update was found after the last check.- bool update_available() const;+ bool update_available() const { return update_available_; }- /// Latest version string from the manifest (empty if not checked yet).- QString latest_version() const;+ /// Latest version string from the manifest (empty until first successful check).+ QString latest_version() const { return latest_version_; }/// Changelog text from the manifest.- QString changelog() const;-- /// If true the user cannot dismiss the update dialog.- void set_mandatory(bool mandatory);-- // ── Configuration ────────────────────────────────────────────────────────+ QString changelog() const { return changelog_; }- /// Override the manifest URL (default: GitHub releases JSON).- void set_manifest_url(const QString& url);+ /// Override the manifest URL (default: GitHub raw updates.json).+ void set_manifest_url(const QString& url) { manifest_url_ = url; }- /// Override the download directory (default: system temp).- void set_download_dir(const QString& dir);-- /// Show "no updates available" dialog even when up to date.- void set_notify_on_finish(bool notify);+ /// Parent widget for dialogs (defaults to QApplication::activeWindow()).+ void set_dialog_parent(QWidget* parent) { dialog_parent_ = parent; }signals:/// Emitted after every check, regardless of result.void check_finished(bool update_found);- /// Emitted when a downloaded file is ready (Windows/macOS).+ /// Emitted after a successful verified download, before launch.void download_finished(const QString& filepath);- /// Emitted when AppImage in-place update completes (Linux only).- void appimage_update_finished(bool success);+ private slots:+ void on_manifest_reply_finished();+ void on_download_reply_finished();+ void on_download_progress(qint64 received, qint64 total);private:explicit UpdateService(QObject* parent = nullptr);-#ifdef Q_OS_LINUX- /// Runs AppImageUpdate CLI on the current AppImage file in-place.- void run_appimage_update();- QProcess* appimage_update_process_ = nullptr;-#endif+ /// Return the lookup key for the current runtime (e.g. "windows-x64").+ /// Returns empty string if the platform/arch combination isn't supported.+ static QString current_platform_key();++ /// Strict semver parse: "1.2.3" → {1,2,3}. Returns false for anything else+ /// (dev builds, tags, suffixes). Used to both validate the running version+ /// and the manifest version.+ static bool parse_version(const QString& s, int& major, int& minor, int& patch);++ /// Returns true iff `remote` is strictly newer than `local`.+ static bool is_newer(const QString& local, const QString& remote);++ void start_download(const QString& url, const QString& expected_sha256);+ void launch_installer(const QString& path);+ void reveal_in_file_manager(const QString& path);+ void finish_check(bool update_found);+ void show_error(const QString& text);+ QWidget* dialog_parent();static constexpr const char* DEFAULT_MANIFEST_URL ="https://raw.githubusercontent.com/Fincept-Corporation/FinceptTerminal/main/updates.json";- QSimpleUpdater* updater_ = nullptr;- QString url_;- bool mandatory_ = false;+ QNetworkAccessManager net_;+ QString manifest_url_ = DEFAULT_MANIFEST_URL;+ QString latest_version_;+ QString changelog_;+ QString pending_download_url_;+ QString pending_expected_sha256_;+ QString pending_local_path_;+ QPointer<QWidget> dialog_parent_;+ bool update_available_ = false;+ bool silent_ = true;+ bool in_progress_ = false;+ /// Silent auto-checks skip themselves after the first one per process run+ /// so multiple login/unlock code paths don't fire repeated checks. A+ /// user-initiated check (silent=false) always runs regardless.+ bool silent_check_done_ = false;};} // namespace fincept::servicesdiff --git a/fincept-qt/src/trading/brokers/motilal/MotilalBroker.cpp b/fincept-qt/src/trading/brokers/motilal/MotilalBroker.cppindex 710f07ac1..1265bc21d 100644--- a/fincept-qt/src/trading/brokers/motilal/MotilalBroker.cpp+++ b/fincept-qt/src/trading/brokers/motilal/MotilalBroker.cpp@@ -118,7 +118,7 @@ QMap<QString, QString> MotilalBroker::auth_headers(const BrokerCredentials& cred{"devicemodel", "PC"},{"manufacturer", "Generic"},{"productname", "FinceptTerminal"},- {"productversion", "4.0.1"},+ {"productversion", "4.0.2"},{"browsername", "Chrome"},{"browserversion", "120.0"},};@@ -161,7 +161,7 @@ TokenExchangeResponse MotilalBroker::exchange_token(const QString& api_key, cons{"devicemodel", "PC"},{"manufacturer", "Generic"},{"productname", "FinceptTerminal"},- {"productversion", "4.0.1"},+ {"productversion", "4.0.2"},{"browsername", "Chrome"},{"browserversion", "120.0"},};diff --git a/fincept-qt/src/ui/navigation/StatusBar.cpp b/fincept-qt/src/ui/navigation/StatusBar.cppindex 01ca121ae..9c7455cf9 100644--- a/fincept-qt/src/ui/navigation/StatusBar.cpp+++ b/fincept-qt/src/ui/navigation/StatusBar.cpp@@ -19,7 +19,7 @@ StatusBar::StatusBar(QWidget* parent) : QWidget(parent) {return l;};- hl->addWidget(mk("v4.0.1", "sbVersion"));+ hl->addWidget(mk("v4.0.2", "sbVersion"));hl->addWidget(mk(" | ", "sbSep"));const char* feeds[] = {"EQ", "FX", "CM", "FI", "CR"};for (auto& f : feeds) {diff --git a/setup.bat b/setup.batdeleted file mode 100644index 3a2bb6835..000000000--- a/setup.bat+++ /dev/null@@ -1,203 +0,0 @@-@echo off-setlocal EnableDelayedExpansion-title Fincept Terminal - Setup--:: ── Pinned versions (must match CMakeLists.txt) ─────────────-set "QT_VERSION=6.8.3"-set "QT_ARCH=win64_msvc2022_64"-set "QT_KIT_DIR=msvc2022_64"-set "MSVC_MIN=19.38"-set "PYTHON_MIN=3.11"--:: ── Parse args ──────────────────────────────────────────────-set CI_MODE=false-for %%A in (%*) do (- if /i "%%A"=="--ci" set CI_MODE=true-)--echo.-echo ================================================-echo Fincept Terminal v4.0.1 - Windows Setup-echo Pinned: Qt %QT_VERSION% ^| MSVC 2022 17.8+ ^| Python %PYTHON_MIN%+-if "!CI_MODE!"=="true" echo (CI mode -- skipping interactive steps)-echo ================================================-echo.--:: ── Step 1: Git ─────────────────────────────────────────────-echo [1/7] Checking Git...-where git >nul 2>&1-if errorlevel 1 (- echo ERROR: Git not found. Install from https://git-scm.com/downloads- if "!CI_MODE!"=="false" pause- exit /b 1-)-echo OK--:: ── Step 2: CMake ≥ 3.27 ────────────────────────────────────-echo [2/7] Checking CMake ^>= 3.27...-where cmake >nul 2>&1-if errorlevel 1 (- if "!CI_MODE!"=="true" (- echo ERROR: CMake not found in CI environment.- exit /b 1- )- echo CMake not found. Installing via winget...- winget install --id Kitware.CMake -e --silent- if errorlevel 1 (- echo ERROR: CMake install failed. Install manually from https://cmake.org/download/- pause ^& exit /b 1- )-)-for /f "tokens=3" %%V in ('cmake --version ^| findstr /R "cmake version"') do set "CMAKE_VER=%%V"-echo cmake !CMAKE_VER!-echo OK--:: ── Step 3: Ninja ───────────────────────────────────────────-echo [3/7] Checking Ninja...-where ninja >nul 2>&1-if errorlevel 1 (- if "!CI_MODE!"=="true" (- echo ERROR: Ninja not found in CI environment.- exit /b 1- )- echo Ninja not found. Installing via winget...- winget install --id Ninja-build.Ninja -e --silent- if errorlevel 1 (- echo ERROR: Ninja install failed. Install manually from https://github.com/ninja-build/ninja/releases- pause ^& exit /b 1- )-)-echo OK--:: ── Step 4: Python ≥ 3.11 ───────────────────────────────────-echo [4/7] Checking Python ^>= %PYTHON_MIN%...-where python >nul 2>&1-if errorlevel 1 (- if "!CI_MODE!"=="true" (- echo ERROR: Python not found in CI environment.- exit /b 1- )- echo Python not found. Installing via winget...- winget install --id Python.Python.3.11 -e --silent- if errorlevel 1 (- echo ERROR: Python install failed. Install from https://www.python.org/downloads/- pause ^& exit /b 1- )-)-echo OK--:: ── Step 5: MSVC 2022 17.8+ ─────────────────────────────────-echo [5/7] Checking MSVC (VS 2022 17.8+)...-where cl >nul 2>&1-if errorlevel 1 (- set "VCVARS="- if exist "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" (- set "VCVARS=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"- ) else if exist "C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars64.bat" (- set "VCVARS=C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvars64.bat"- ) else if exist "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" (- set "VCVARS=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"- ) else if exist "C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat" (- set "VCVARS=C:\Program Files\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build\vcvars64.bat"- )- if defined VCVARS (- echo Activating VS 2022 environment...- call "!VCVARS!"- ) else (- echo ERROR: MSVC not found. Install Visual Studio 2022 17.8+ with "Desktop development with C++":- echo https://visualstudio.microsoft.com/downloads/- if "!CI_MODE!"=="false" pause- exit /b 1- )-)-:: cl prints its version on stderr; capture first line-for /f "tokens=*" %%L in ('cl 2^>^&1 ^| findstr /R "Microsoft.*Compiler"') do set "CL_LINE=%%L"-echo !CL_LINE!-echo OK--:: ── Step 6: Install pinned Qt %QT_VERSION% via aqtinstall ──-set "SCRIPT_DIR=%~dp0"-set "QT_INSTALL_ROOT=%SCRIPT_DIR%.qt"-if defined FINCEPT_QT_ROOT set "QT_INSTALL_ROOT=%FINCEPT_QT_ROOT%"-set "QT_PREFIX=%QT_INSTALL_ROOT%\%QT_VERSION%\%QT_KIT_DIR%"--echo [6/7] Locating Qt %QT_VERSION%...--:: If user already has Qt6_DIR set and valid, honor it-if defined Qt6_DIR (- if exist "%Qt6_DIR%\lib\cmake\Qt6\Qt6Config.cmake" (- set "QT_PREFIX=%Qt6_DIR%"- echo Using Qt from Qt6_DIR env: !QT_PREFIX!- goto :qt_ready- )-)--:: Check default Qt Online Installer location (C:\Qt\6.8.3\msvc2022_64)-if exist "C:\Qt\%QT_VERSION%\%QT_KIT_DIR%\lib\cmake\Qt6\Qt6Config.cmake" (- set "QT_PREFIX=C:\Qt\%QT_VERSION%\%QT_KIT_DIR%"- echo Found Qt at !QT_PREFIX!- goto :qt_ready-)--:: Check aqtinstall location (%SCRIPT_DIR%.qt\6.8.3\msvc2022_64)-if exist "%QT_PREFIX%\lib\cmake\Qt6\Qt6Config.cmake" (- echo Found Qt at !QT_PREFIX!- goto :qt_ready-)--:: Install via aqtinstall-echo Installing Qt %QT_VERSION% via aqtinstall to %QT_INSTALL_ROOT% ...-python -m pip install --user --quiet --upgrade aqtinstall-if errorlevel 1 (- echo ERROR: Failed to install aqtinstall. Check internet/pip.- if "!CI_MODE!"=="false" pause- exit /b 1-)-python -m aqt install-qt windows desktop %QT_VERSION% %QT_ARCH% ^- --outputdir "%QT_INSTALL_ROOT%" ^- --modules qtcharts qtwebsockets qtmultimedia qtspeech-if errorlevel 1 (- echo ERROR: aqtinstall failed. Install Qt %QT_VERSION% manually from https://www.qt.io/download-qt-installer- if "!CI_MODE!"=="false" pause- exit /b 1-)-if not exist "%QT_PREFIX%\lib\cmake\Qt6\Qt6Config.cmake" (- echo ERROR: Qt install completed but Qt6Config.cmake not found at %QT_PREFIX%- if "!CI_MODE!"=="false" pause- exit /b 1-)--:qt_ready-echo CMAKE_PREFIX_PATH=!QT_PREFIX!-echo OK--:: ── Step 7: Configure + Build (using CMake preset) ──────────-cd /d "%SCRIPT_DIR%fincept-qt"-if errorlevel 1 (- echo ERROR: fincept-qt directory not found.- exit /b 1-)--echo [7/7] Configuring and building (preset: win-release)...-cmake --preset win-release -DCMAKE_PREFIX_PATH="!QT_PREFIX!"-if errorlevel 1 ( echo ERROR: CMake configure failed. ^& exit /b 1 )--cmake --build --preset win-release-if errorlevel 1 ( echo ERROR: Build failed. ^& exit /b 1 )--echo.-echo ================================================-echo Build complete!-echo Run: build\win-release\FinceptTerminal.exe-echo ================================================-echo.--if "!CI_MODE!"=="true" goto :done--set /p LAUNCH="Launch now? (y/n): "-if /i "!LAUNCH!"=="y" (- start "" "build\win-release\FinceptTerminal.exe"-)--:done-endlocaldiff --git a/setup.sh b/setup.shindex ad30207ee..bb951f753 100644--- a/setup.sh+++ b/setup.sh@@ -28,7 +28,7 @@ info() { echo -e " ${YELLOW}$1${NC}"; }echo ""echo "================================================"-echo " Fincept Terminal v4.0.1 — Setup"+echo " Fincept Terminal v4.0.2 — Setup"echo " Pinned: Qt ${QT_VERSION} | CMake ${CMAKE_MIN}+ | Python ${PYTHON_MIN}+"[ "$CI_MODE" = true ] && echo " (CI mode — skipping interactive steps)"echo "================================================"diff --git a/updates.json b/updates.jsonindex b4898d28b..36bd3a557 100644--- a/updates.json+++ b/updates.json@@ -1,25 +1,27 @@{+ "_comment": "Auto-generated by .github/workflows/release.yml on every tag push. Do not edit by hand — changes will be overwritten on the next release.",+ "schema-version": 2,"updates": {- "windows": {- "latest-version": "4.0.1",- "mandatory-update": false,- "download-url": "https://github.com/Fincept-Corporation/FinceptTerminal/releases/latest/download/FinceptTerminal-4.0.1-windows-x64-setup.exe",- "open-url": "https://github.com/Fincept-Corporation/FinceptTerminal/releases/latest",- "changelog": "Fincept Terminal v4.0.1 — Full rewrite in C++20 + Qt6. Native performance, embedded Python analytics, 50+ screens, MCP AI integration, and multi-broker trading.\n\nSee https://github.com/Fincept-Corporation/FinceptTerminal/releases/latest for full release notes."+ "windows-x64": {+ "latest-version": "4.0.2",+ "download-url": "https://github.com/Fincept-Corporation/FinceptTerminal/releases/download/v4.0.2/FinceptTerminal-4.0.2-windows-x64-setup.exe",+ "sha256": "",+ "open-url": "https://github.com/Fincept-Corporation/FinceptTerminal/releases/tag/v4.0.2",+ "changelog": "Fincept Terminal v4.0.2 — see release notes."},- "osx": {- "latest-version": "4.0.1",- "mandatory-update": false,- "download-url": "https://github.com/Fincept-Corporation/FinceptTerminal/releases/latest/download/FinceptTerminal-4.0.1-macOS.dmg",- "open-url": "https://github.com/Fincept-Corporation/FinceptTerminal/releases/latest",- "changelog": "Fincept Terminal v4.0.1 — Full rewrite in C++20 + Qt6. Native performance, embedded Python analytics, 50+ screens, MCP AI integration, and multi-broker trading.\n\nSee https://github.com/Fincept-Corporation/FinceptTerminal/releases/latest for full release notes."+ "linux-x64": {+ "latest-version": "4.0.2",+ "download-url": "https://github.com/Fincept-Corporation/FinceptTerminal/releases/download/v4.0.2/FinceptTerminal-4.0.2-linux-x64-setup.run",+ "sha256": "",+ "open-url": "https://github.com/Fincept-Corporation/FinceptTerminal/releases/tag/v4.0.2",+ "changelog": "Fincept Terminal v4.0.2 — see release notes."},- "linux": {- "latest-version": "4.0.1",- "mandatory-update": false,- "download-url": "https://github.com/Fincept-Corporation/FinceptTerminal/releases/latest/download/FinceptTerminal-4.0.1-x86_64.AppImage",- "open-url": "https://github.com/Fincept-Corporation/FinceptTerminal/releases/latest",- "changelog": "Fincept Terminal v4.0.1 — Full rewrite in C++20 + Qt6. Native performance, embedded Python analytics, 50+ screens, MCP AI integration, and multi-broker trading.\n\nSee https://github.com/Fincept-Corporation/FinceptTerminal/releases/latest for full release notes."+ "macos-arm64": {+ "latest-version": "4.0.2",+ "download-url": "https://github.com/Fincept-Corporation/FinceptTerminal/releases/download/v4.0.2/FinceptTerminal-4.0.2-macos-arm64-setup.dmg",+ "sha256": "",+ "open-url": "https://github.com/Fincept-Corporation/FinceptTerminal/releases/tag/v4.0.2",+ "changelog": "Fincept Terminal v4.0.2 — see release notes."}}}