Skip to content

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.

v4.0.2 bug fixes and workflow update

tilakpatel22880ab56e3821
diff --git a/.dockerignore b/.dockerignore
index 78a67c36b..89a876b12 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,7 +1,18 @@
fincept-qt/build/
+fincept-qt/build-*/
fincept-qt/uitest/
+fincept-qt/.vs/
+fincept-qt/cmake-build-*/
+build/
+build-*/
+out/
+.vs/
+.vscode/
+.idea/
+*.user
tmpqt/
.git/
+.gitignore
images/
docs/
.github/
@@ -12,3 +23,5 @@ funding.json
updates.json
fincept_icon.ico
setup.sh
+Dockerfile
+.dockerignore
diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md
index bf36791c4..3cef2a892 100644
--- a/.github/CONTRIBUTING.md
+++ b/.github/CONTRIBUTING.md
@@ -1,48 +1,95 @@
-# Contributing to Fincept Terminal
+# Contribution Policy — Fincept Terminal
-Fincept Terminal is a native C++20/Qt6 desktop financial terminal. All contributions are welcome!
+This file is the **contribution policy** — the rules every PR must follow. GitHub surfaces it automatically on issues and PRs, so we keep it short and strict.
-## Ways to Contribute
+Looking for **how to build, where code lives, code conventions?** → [`docs/CONTRIBUTING.md`](../docs/CONTRIBUTING.md).
-- **C++ / Qt6** — new screens, performance fixes, core infrastructure
-- **Python Analytics** — data scripts, AI agents, quant modules
-- **Data Sources** — connect APIs, brokers, government financial databases
-- **Bug Reports & Feature Requests** — open an issue
+Maintainers' operational runbook → [`.github/MAINTAINERS.md`](./MAINTAINERS.md).
-## Getting Started
+---
-**Pinned toolchain (enforced by CMake):** Qt 6.7.2 · CMake 3.27.7 · MSVC 19.38 / GCC 12.3 / Apple Clang 15.0 · Python 3.11.9. See [docs/CONTRIBUTING.md](../docs/CONTRIBUTING.md) for the full list.
+## TL;DR
-```bash
-# Fork & clone
-git clone https://github.com/your-username/FinceptTerminal.git
-cd FinceptTerminal
+1. **Open an issue first.** Wait for a maintainer to add `good-first-issue`, `help-wanted`, or `scope:approved`.
+2. **One logical change per PR.** Minimum diff. Link the issue with `Closes #NNN`.
+3. **No auto-formatter churn.** No `print()` / `std::cout`. No PR from your fork's `main` branch.
-# Automated setup (installs toolchain + Qt 6.7.2 via aqtinstall, then builds)
-./setup.sh # Linux / macOS
-setup.bat # Windows (run from VS 2022 Developer Cmd)
+PRs that ignore these rules are closed — not personal, it's automated.
-# ── OR manual build via CMake presets ──
-cd fincept-qt
-cmake --preset linux-release && cmake --build --preset linux-release # Linux
-cmake --preset macos-release && cmake --build --preset macos-release # macOS
-cmake --preset win-release && cmake --build --preset win-release # Windows
+---
-# Create a branch
-git checkout -b feature/your-feature
-```
+## Full policy
-## Code Guidelines
+### 1. PRs must link a labeled, scope-approved issue
-- C++20, `snake_case` for functions/variables, `PascalCase` for types
-- Screens render UI only — no business logic or direct HTTP calls
-- Never block the UI thread (`waitForFinished()` forbidden on main thread)
-- Use `Result<T>` for error handling, `LOG_INFO`/`LOG_ERROR` for logging
+Open an issue first, or claim an existing one that carries one of:
-## Submitting a PR
+- `good-first-issue` — newcomer-friendly, pre-approved.
+- `help-wanted` — open for external contribution.
+- `scope:approved` — maintainer has agreed the approach with the author.
-1. Push your branch and open a Pull Request against `main`
-2. Link any related issues
-3. Keep changes focused — one feature or fix per PR
+PRs against issues **without** one of these labels are auto-flagged by the `PR Scope Gate` workflow and closed after 7 days. A maintainer can bypass the gate on a per-PR basis by adding `scope:approved` directly to the PR.
-Questions? [[email protected]](mailto:[email protected]) · [Discord](https://discord.gg/ae87a8ygbN)
+You may not claim more than one issue at a time until your previous PR merges or closes.
+
+### 2. No unsolicited wording / formatting / comment-only PRs
+
+Rewording a single error message, renaming a local variable, rewrapping a comment, fixing a typo in a log string, or running `black` / `clang-format` / `isort` / `autopep8` / `prettier` on a file you otherwise didn't touch are **not** accepted unless a maintainer explicitly requested them on an issue.
+
+**Exception:** typos in user-facing docs (`README.md`, `docs/*.md`) may be submitted directly — batch multiple typos into one PR.
+
+### 3. No auto-formatter churn
+
+Do not run any code formatter over existing files. Match the surrounding style exactly. A diff showing hundreds of reformatted lines for ~15 lines of real change will be closed without review.
+
+### 4. PRs must build and run
+
+The change must compile on your target platform before submission. `build-cpp.yml` CI must pass. If you couldn't build locally, say so in the PR body — don't submit untested code and claim it "should work".
+
+### 5. Minimum scope, one logical change per PR
+
+One feature or one bug fix per PR. Do not bundle unrelated changes. If your fix reveals a second bug, open a separate issue and PR.
+
+### 6. Use a topic branch, never your fork's `main`
+
+Examples: `fix/execute-multi-user-config`, `feat/crypto-depth-chart`, `perf/market-data-coalesce`. PRs opened from `your-fork:main` will be asked to rebase onto a topic branch.
+
+### 7. Describe the change like you mean it
+
+The PR description must explain the user-visible effect and the reasoning. "Small improvements" / "fix bug" / "update code" / "minor refactor" are not acceptable descriptions — the PR will be closed.
+
+---
+
+## PRs closed on sight
+
+- Single-line string edits with no linked approved issue.
+- Black / autopep8 / isort / clang-format / prettier-only PRs.
+- `README.md` / `CONTRIBUTING.md` rewrites that don't fix an actual error.
+- PRs that add the author to a contributors / credits file, or add a CODEOWNERS entry for themselves.
+- PRs that delete "dead code" without an analysis proving it's unreachable.
+- PRs that touch `CLAUDE.md`, this file, `MAINTAINERS.md`, or any `docs/*` file without an explicit maintainer ask.
+- PRs whose body is only "fix bug" / "small improvements" / "update code".
+
+---
+
+## Hacktoberfest
+
+This repository carries the `hacktoberfest-excluded` topic. PRs opened during October that don't follow this policy are labeled `invalid` / `spam` and closed — they will not count toward Hacktoberfest. The `hacktoberfest-accepted` label is applied **only** to substantive, reviewed contributions.
+
+---
+
+## Contributor list / credits
+
+The contributor list is **manually curated** — we don't auto-include every merged author. Inclusion requires:
+
+- **3+ merged non-trivial PRs** (non-trivial = >50 lines of real code change, not formatting or comments), OR
+- **1 substantive feature** contribution reviewed and accepted (new screen, new broker integration, new data source, major refactor).
+
+If you're contributing for the list and not for the product, this isn't the right project for you — and that's fine.
+
+---
+
+## Questions before you code?
+
+- Ask on the issue before writing code. Maintainers are happy to scope-approve early.
+- [[email protected]](mailto:[email protected]) · [Discord](https://discord.gg/ae87a8ygbN)
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index d218d5501..e6d21bf1b 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -6,6 +6,12 @@ labels: "type:bug, status:triage"
assignees: ""
---
+<!--
+Planning to fix this yourself? Please read .github/CONTRIBUTING.md first.
+A maintainer must add `good-first-issue`, `help-wanted`, or `scope:approved`
+to this issue before PRs against it will be accepted.
+-->
+
## What happened?
<!-- Describe the bug and what you expected instead -->
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 000000000..5f69045a2
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,11 @@
+blank_issues_enabled: false
+contact_links:
+ - name: Discord
+ url: https://discord.gg/ae87a8ygbN
+ about: Ask a question, discuss a feature idea, or get help before opening an issue.
+ - name: Read CONTRIBUTING.md first
+ url: https://github.com/Fincept-Corporation/FinceptTerminal/blob/main/.github/CONTRIBUTING.md
+ about: PRs must link a labeled, scope-approved issue. Please read the contribution policy before opening an issue that you intend to fix yourself.
+ - name: Email support
+ url: mailto:[email protected]
+ about: Commercial / security / licensing questions.
diff --git a/.github/ISSUE_TEMPLATE/documentation.md b/.github/ISSUE_TEMPLATE/documentation.md
index d64704b34..d1c1caf41 100644
--- a/.github/ISSUE_TEMPLATE/documentation.md
+++ b/.github/ISSUE_TEMPLATE/documentation.md
@@ -6,6 +6,13 @@ labels: "type:documentation, status:triage"
assignees: ""
---
+<!--
+Planning to send a PR for this? Please read .github/CONTRIBUTING.md first.
+Single-line typo fixes in README / docs/*.md may be submitted directly as a PR
+(batch multiple typos into one PR). Larger doc changes require a maintainer to
+add `good-first-issue`, `help-wanted`, or `scope:approved` to this issue first.
+-->
+
## What's the issue?
<!-- Describe what's missing, unclear, or incorrect -->
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
index ff1c952a3..6a556d9e2 100644
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -6,6 +6,12 @@ labels: "type:feature, status:triage"
assignees: ""
---
+<!--
+Planning to send a PR for this? Please read .github/CONTRIBUTING.md first.
+A maintainer must add `good-first-issue`, `help-wanted`, or `scope:approved`
+to this issue before PRs against it will be accepted.
+-->
+
## What feature would you like?
<!-- Describe the feature clearly -->
diff --git a/.github/ISSUE_TEMPLATE/improvement.md b/.github/ISSUE_TEMPLATE/improvement.md
index 1497d11ef..7a7f608ff 100644
--- a/.github/ISSUE_TEMPLATE/improvement.md
+++ b/.github/ISSUE_TEMPLATE/improvement.md
@@ -6,6 +6,13 @@ labels: "type:enhancement, status:triage"
assignees: ""
---
+<!--
+Planning to send a PR for this? Please read .github/CONTRIBUTING.md first.
+A maintainer must add `good-first-issue`, `help-wanted`, or `scope:approved`
+to this issue before PRs against it will be accepted. Unsolicited PRs for
+string tweaks, wording changes, or single-line edits are closed on sight.
+-->
+
## Which feature needs improvement?
<!-- Name the screen or feature (e.g., Dashboard, Crypto Trading, News) -->
diff --git a/.github/ISSUE_TEMPLATE/performance_issues.md b/.github/ISSUE_TEMPLATE/performance_issues.md
index 71a9d3cdb..6e14107d5 100644
--- a/.github/ISSUE_TEMPLATE/performance_issues.md
+++ b/.github/ISSUE_TEMPLATE/performance_issues.md
@@ -6,6 +6,12 @@ labels: "type:performance, status:triage"
assignees: ""
---
+<!--
+Planning to fix this yourself? Please read .github/CONTRIBUTING.md first.
+A maintainer must add `good-first-issue`, `help-wanted`, or `scope:approved`
+to this issue before PRs against it will be accepted.
+-->
+
## What's slow or freezing?
<!-- Describe the issue and when it happens (e.g., on startup, when switching screens) -->
diff --git a/.github/MAINTAINERS.md b/.github/MAINTAINERS.md
new file mode 100644
index 000000000..8c5d775a0
--- /dev/null
+++ b/.github/MAINTAINERS.md
@@ -0,0 +1,72 @@
+# Maintainer Runbook
+
+Internal notes for Fincept Terminal maintainers. Contributors read [`CONTRIBUTING.md`](./CONTRIBUTING.md); this file is for people with repo write access.
+
+## What the automation handles for you
+
+You do **not** need to click around in GitHub Settings. These workflows keep the repo configured:
+
+| Workflow | What it does |
+|-------------------------------------------------|--------------------------------------------------------------------------------------------------------|
+| [`sync-labels.yml`](./workflows/sync-labels.yml) | Creates / updates every label listed in [`.github/labels.json`](./labels.json). Runs on push to `main` when that file changes, or on manual dispatch. |
+| [`sync-repo-topics.yml`](./workflows/sync-repo-topics.yml) | Ensures `hacktoberfest-excluded` is present in repo topics. Runs weekly + on manual dispatch. |
+| [`pr-gate.yml`](./workflows/pr-gate.yml) | On every PR event, flags PRs that don't close a labeled / scope-approved issue with `needs-scope-approval` and a templated comment. |
+| [`pr-stale-close.yml`](./workflows/pr-stale-close.yml) | Closes PRs that have carried `needs-scope-approval` for 7+ days with the `invalid` label. |
+
+To change labels: edit `.github/labels.json` and merge — the sync workflow applies the change. Extra labels that exist on the repo but aren't in the file are left alone (not deleted).
+
+To add a repo topic: edit the `REQUIRED` array in `sync-repo-topics.yml` and merge.
+
+## Scope-approval flow
+
+1. A contributor opens an issue using one of the templates.
+2. Triage it. If the scope is clear and you want external help, add one of:
+ - `good-first-issue` — small, self-contained, documented enough for a newcomer.
+ - `help-wanted` — you want external help but it is non-trivial.
+ - `scope:approved` — you have discussed the approach with the author and agreed on the change.
+3. Only after one of these labels is applied should anyone open a PR against the issue.
+4. A PR that does not close a labeled issue is auto-flagged by `pr-gate.yml` with `needs-scope-approval` and a templated comment. After 7 days, `pr-stale-close.yml` closes it with the `invalid` label.
+5. **Bypass:** apply `scope:approved` directly on the PR itself to bypass the gate — use this for maintainer PRs and for external PRs where the scope is obvious and the change is already reviewable.
+
+## Hacktoberfest
+
+- The repo-topics sync keeps `hacktoberfest-excluded` applied year-round, so spam PRs can't be counted.
+- Do **not** add the `hacktoberfest-accepted` label to any PR unless it is a real, substantive contribution.
+- Use the `spam` label for obvious farming attempts (single-line typo PRs, auto-formatter PRs, README-bloat PRs). Two `spam` / `invalid` labels across Hacktoberfest-participating repos disqualifies the author from the event.
+- Most of these PRs are already filtered by `pr-gate.yml` before you see them.
+
+## Contributor list curation
+
+The contributor list is **not** auto-populated from git history. Inclusion rules:
+
+- **3+ merged non-trivial PRs**, OR
+- **1 substantive feature** reviewed and accepted (new screen, new broker integration, new data source, major refactor).
+
+Non-trivial = real code change of >50 lines that is not formatting, comments, or generated output.
+
+Review the list quarterly. Remove entries that were added by mistake or that correspond to reverted work.
+
+## PR review triage order
+
+1. PRs with `scope:approved` label → review next.
+2. PRs closing a `good-first-issue` / `help-wanted` → review within a week.
+3. PRs flagged `needs-scope-approval` → ignore; automation will close them.
+4. PRs labeled `spam` → close immediately with one-line reason, do not engage.
+
+## When to engage vs when to close
+
+Engage (with review comments):
+- Contributor shows understanding of the codebase.
+- Change is in a labeled, approved area.
+- Diff is minimal and focused.
+
+Close with a templated comment:
+- Auto-formatter churn (Black, clang-format, autopep8, isort).
+- Wording-only string changes with no linked approved issue.
+- PR adds the author to any contributors / credits file.
+- PR from fork's `main` branch after they were asked once to use a topic branch.
+- PR body says only "fix bug" / "small improvements" / "update code".
+
+Templated close comment:
+
+> Thanks for the interest in Fincept Terminal. Closing per our [contribution policy](https://github.com/Fincept-Corporation/FinceptTerminal/blob/main/.github/CONTRIBUTING.md) — this PR does not meet the scope-approval / minimum-diff / topic-branch requirements. You are welcome to open a labeled issue first and then a follow-up PR once the scope is agreed.
diff --git a/.github/PULL_REQUEST_TEMPLATE/pull_request_for_terminal.md b/.github/PULL_REQUEST_TEMPLATE/pull_request_for_terminal.md
index 345d7dfa6..748522218 100644
--- a/.github/PULL_REQUEST_TEMPLATE/pull_request_for_terminal.md
+++ b/.github/PULL_REQUEST_TEMPLATE/pull_request_for_terminal.md
@@ -1,35 +1,55 @@
+<!--
+Before opening this PR, confirm you have read .github/CONTRIBUTING.md.
+PRs that do not link a scope-approved issue, or that contain auto-formatter churn,
+or that are single-line wording edits without maintainer request, WILL BE CLOSED.
+-->
+
+## Scope gate (required)
+
+- [ ] This PR closes an issue that carries the `good-first-issue`, `help-wanted`, or `scope:approved` label.
+- [ ] I confirmed the scope with a maintainer on the issue before writing code.
+- [ ] This PR is from a **topic branch** (not `main` on my fork).
+- [ ] This PR makes **one logical change**. It does not bundle unrelated fixes.
+- [ ] I did **not** run Black / autopep8 / isort / clang-format / Prettier on files I did not otherwise modify.
+- [ ] Diff is minimal — no reformatting of surrounding lines that are unrelated to the change.
+
+Linked issue (required — use `Closes #NNN` or `Fixes #NNN`):
+
+Closes #
+
## What does this PR do?
-<!-- Brief description of the change -->
+<!-- Plain-English description of the user-visible effect. "Small improvement" is not acceptable. -->
+
+## Type of change
-## Type of Change
- [ ] Bug fix
- [ ] New feature / screen
- [ ] Performance improvement
-- [ ] Refactoring
-- [ ] Documentation
+- [ ] Refactoring (with linked issue)
+- [ ] Documentation (see CONTRIBUTING — docs-only PRs allowed only for genuine errors)
- [ ] Build / config change
-## Related Issues
-<!-- Fixes #, Closes #, or Related to # -->
+## Changes made
+<!-- List key files and what was done to each. Do not paste the diff. -->
-## Changes Made
-<!-- List key files/components changed and what was done -->
+## How to test
-
-## How to Test
1.
2.
3.
-## Checklist
-- [ ] Builds without errors on target platform
-- [ ] UI thread is never blocked (no `waitForFinished()` on main thread)
-- [ ] Timers start/stop in `showEvent()`/`hideEvent()`
-- [ ] No raw `QProcess` for Python — used `PythonRunner::instance().run()`
+## Architecture / code-quality checklist
+
+- [ ] Builds without errors on my target platform (Windows / macOS / Linux) — state which below
+- [ ] UI thread is never blocked (no `waitForFinished()` on main thread) — see CLAUDE.md P1
+- [ ] Timers start/stop in `showEvent()` / `hideEvent()` — see P3
+- [ ] No raw `QProcess` for Python — used `PythonRunner::instance().run()` — see P4
+- [ ] No `print()` in Python scripts — used `logger.info` / `logger.warning` — see P14
- [ ] No sensitive data (API keys, credentials) committed
-- [ ] Tested manually on: (Windows / macOS / Linux)
+- [ ] DataHub rules (D1–D5) respected if touching data flow
+- [ ] Tested manually on: (Windows / macOS / Linux — pick one)
-## Screenshots
-<!-- For UI changes, include before/after screenshots -->
+## Screenshots / logs
+<!-- For UI changes include before/after. For bug fixes include the log line that proves the fix. -->
diff --git a/.github/labels.json b/.github/labels.json
new file mode 100644
index 000000000..484923020
--- /dev/null
+++ b/.github/labels.json
@@ -0,0 +1,16 @@
+[
+ { "name": "good-first-issue", "color": "7057ff", "description": "Newcomer-friendly, pre-approved scope. Anyone may PR against it." },
+ { "name": "help-wanted", "color": "008672", "description": "Open for external contribution, pre-approved scope." },
+ { "name": "scope:approved", "color": "0e8a16", "description": "Maintainer-approved scope. Applied to an issue or directly to a PR to bypass the scope gate." },
+ { "name": "needs-scope-approval", "color": "fbca04", "description": "Auto-applied by pr-gate.yml to PRs that fail the scope gate." },
+ { "name": "invalid", "color": "e6e6e6", "description": "Closed as not meeting contribution policy. Applied automatically by stale-close workflow." },
+ { "name": "spam", "color": "b60205", "description": "Obvious farming / LLM-slop PRs. Closed manually." },
+ { "name": "pinned", "color": "5319e7", "description": "Exempt from stale-bot closure." },
+ { "name": "do-not-close", "color": "5319e7", "description": "Explicit intent: do not auto-close." },
+ { "name": "type:bug", "color": "d73a4a", "description": "Something isn't working." },
+ { "name": "type:enhancement", "color": "a2eeef", "description": "Improvement to an existing feature." },
+ { "name": "type:feature", "color": "a2eeef", "description": "New feature or screen." },
+ { "name": "type:documentation", "color": "0075ca", "description": "Documentation-related." },
+ { "name": "type:performance", "color": "d93f0b", "description": "Performance / responsiveness issue." },
+ { "name": "status:triage", "color": "ededed", "description": "Needs triage by a maintainer." }
+]
diff --git a/.github/workflows/pr-gate.yml b/.github/workflows/pr-gate.yml
new file mode 100644
index 000000000..e3bb1e4de
--- /dev/null
+++ b/.github/workflows/pr-gate.yml
@@ -0,0 +1,113 @@
+name: PR Scope Gate
+
+on:
+ pull_request_target:
+ types: [opened, edited, reopened, synchronize, labeled, unlabeled]
+
+permissions:
+ pull-requests: write
+ issues: write
+ contents: read
+
+jobs:
+ scope-check:
+ if: github.event.pull_request.draft == false
+ runs-on: ubuntu-latest
+ steps:
+ - name: Evaluate PR scope
+ id: check
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const pr = context.payload.pull_request;
+ const { owner, repo } = context.repo;
+ const number = pr.number;
+
+ // ── Config ────────────────────────────────────────────────
+ const SMALL_PR_MAX_LINES = 10; // PRs ≤ this many changed lines are "small"
+ const APPROVED_LABELS = ['good-first-issue', 'help-wanted', 'scope:approved'];
+ const BYPASS_LABEL = 'scope:approved'; // any label on the PR itself that bypasses the gate
+ const FORK_MAIN_WARN = pr.head.ref === 'main' && pr.head.repo.full_name !== pr.base.repo.full_name;
+
+ // ── Collect signals ───────────────────────────────────────
+ const body = pr.body || '';
+ const closesRegex = /\b(?:clos(?:e|es|ed)|fix(?:es|ed)?|resolv(?:e|es|ed))\s+#(\d+)/gi;
+ const linkedIssues = [...body.matchAll(closesRegex)].map(m => parseInt(m[1], 10));
+
+ const changedLines = (pr.additions || 0) + (pr.deletions || 0);
+ const isSmall = changedLines <= SMALL_PR_MAX_LINES;
+
+ // PR-level bypass (a maintainer labeled this specific PR as scope:approved)
+ const prLabels = (pr.labels || []).map(l => l.name);
+ const prBypass = prLabels.includes(BYPASS_LABEL);
+
+ // ── Check linked issues for approval labels ───────────────
+ let approvedIssue = null;
+ for (const n of linkedIssues) {
+ try {
+ const { data: issue } = await github.rest.issues.get({ owner, repo, issue_number: n });
+ const names = (issue.labels || []).map(l => (typeof l === 'string' ? l : l.name));
+ if (names.some(x => APPROVED_LABELS.includes(x))) { approvedIssue = n; break; }
+ } catch (e) { /* issue may not exist — fall through */ }
+ }
+
+ // ── Decide ────────────────────────────────────────────────
+ const problems = [];
+ if (!prBypass && !approvedIssue) {
+ problems.push(
+ `❌ **No scope-approved linked issue.** This PR must close an issue that carries one of: ` +
+ APPROVED_LABELS.map(l => '`' + l + '`').join(', ') +
+ `. Link it in the PR body with \`Closes #NNN\`.`
+ );
+ }
+ if (!prBypass && isSmall && !approvedIssue) {
+ problems.push(
+ `❌ **Small PR (${changedLines} changed lines) without a scope-approved issue.** ` +
+ `Small PRs are a common vector for contributor-list farming; we require a maintainer-approved issue before reviewing them.`
+ );
+ }
+ if (FORK_MAIN_WARN) {
+ problems.push(
+ `⚠️ **PR opened from your fork's \`main\` branch.** Please use a topic branch (e.g. \`fix/short-slug\`) — see CONTRIBUTING.md.`
+ );
+ }
+
+ // ── Comment + label ───────────────────────────────────────
+ const marker = '<!-- pr-scope-gate -->';
+ const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: number });
+ const existing = comments.find(c => c.body && c.body.includes(marker));
+
+ if (problems.length === 0) {
+ // Clear previous block comment & invalid label if any
+ if (existing) {
+ await github.rest.issues.deleteComment({ owner, repo, comment_id: existing.id });
+ }
+ try {
+ await github.rest.issues.removeLabel({ owner, repo, issue_number: number, name: 'needs-scope-approval' });
+ } catch (e) {}
+ core.setOutput('blocked', 'false');
+ return;
+ }
+
+ const body_md = [
+ marker,
+ `Hi @${pr.user.login} — thanks for the PR! Our automated scope gate flagged the following:`,
+ '',
+ ...problems,
+ '',
+ `Please read [CONTRIBUTING.md](https://github.com/${owner}/${repo}/blob/main/.github/CONTRIBUTING.md). ` +
+ `Once an issue with the appropriate label exists and is linked here, re-run this check by pushing an empty commit or editing the PR description. ` +
+ `A maintainer can also bypass this gate by adding the \`${BYPASS_LABEL}\` label to **this PR**.`,
+ '',
+ `PRs that remain unresolved for 7 days will be closed automatically.`
+ ].join('\n');
+
+ if (existing) {
+ await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body: body_md });
+ } else {
+ await github.rest.issues.createComment({ owner, repo, issue_number: number, body: body_md });
+ }
+ try {
+ await github.rest.issues.addLabels({ owner, repo, issue_number: number, labels: ['needs-scope-approval'] });
+ } catch (e) {}
+ core.setOutput('blocked', 'true');
diff --git a/.github/workflows/pr-stale-close.yml b/.github/workflows/pr-stale-close.yml
new file mode 100644
index 000000000..72df328ee
--- /dev/null
+++ b/.github/workflows/pr-stale-close.yml
@@ -0,0 +1,28 @@
+name: Close stale gated PRs
+
+on:
+ schedule:
+ - cron: '30 4 * * *' # daily at 04:30 UTC
+ workflow_dispatch: {}
+
+permissions:
+ pull-requests: write
+ issues: write
+
+jobs:
+ close-stale:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/stale@v9
+ with:
+ days-before-pr-stale: 7
+ days-before-pr-close: 0
+ only-pr-labels: needs-scope-approval
+ stale-pr-message: ''
+ close-pr-message: |
+ Closing this PR because it has had the `needs-scope-approval` label for 7+ days without a maintainer-approved issue being linked.
+
+ This is not personal — see [CONTRIBUTING.md](https://github.com/${{ github.repository }}/blob/main/.github/CONTRIBUTING.md) for the scope-approval flow. You are welcome to open a new PR once an issue carrying `good-first-issue`, `help-wanted`, or `scope:approved` exists and the change is agreed with a maintainer.
+ close-pr-label: 'invalid'
+ operations-per-run: 100
+ exempt-pr-labels: 'scope:approved,pinned,do-not-close'
diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml
new file mode 100644
index 000000000..a2511c545
--- /dev/null
+++ b/.github/workflows/sync-labels.yml
@@ -0,0 +1,59 @@
+name: Sync repository labels
+
+on:
+ push:
+ branches: [main]
+ paths:
+ - '.github/labels.json'
+ - '.github/workflows/sync-labels.yml'
+ workflow_dispatch: {}
+
+permissions:
+ issues: write
+ contents: read
+
+jobs:
+ sync:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+
+ - name: Create or update labels from labels.json
+ uses: actions/github-script@v7
+ with:
+ script: |
+ const fs = require('fs');
+ const path = '.github/labels.json';
+ const desired = JSON.parse(fs.readFileSync(path, 'utf8'));
+ const { owner, repo } = context.repo;
+
+ // Fetch existing labels (paginate)
+ const existing = await github.paginate(github.rest.issues.listLabelsForRepo, {
+ owner, repo, per_page: 100,
+ });
+ const existingByName = new Map(existing.map(l => [l.name, l]));
+
+ for (const want of desired) {
+ const have = existingByName.get(want.name);
+ if (!have) {
+ core.info(`Creating label: ${want.name}`);
+ await github.rest.issues.createLabel({
+ owner, repo,
+ name: want.name,
+ color: want.color,
+ description: want.description || '',
+ });
+ } else if (have.color !== want.color || (have.description || '') !== (want.description || '')) {
+ core.info(`Updating label: ${want.name}`);
+ await github.rest.issues.updateLabel({
+ owner, repo,
+ name: want.name,
+ color: want.color,
+ description: want.description || '',
+ });
+ } else {
+ core.info(`Label already up to date: ${want.name}`);
+ }
+ }
+
+ core.info('Label sync complete. (Extra labels on the repo are left untouched.)');
diff --git a/.github/workflows/sync-repo-topics.yml b/.github/workflows/sync-repo-topics.yml
new file mode 100644
index 000000000..e76b1448f
--- /dev/null
+++ b/.github/workflows/sync-repo-topics.yml
@@ -0,0 +1,47 @@
+name: Sync repository topics
+
+on:
+ push:
+ branches: [main]
+ paths:
+ - '.github/workflows/sync-repo-topics.yml'
+ schedule:
+ - cron: '0 5 * * 1' # weekly — idempotent safety net
+ workflow_dispatch: {}
+
+permissions:
+ contents: write # required to call /repos/{owner}/{repo}/topics
+
+jobs:
+ ensure-topics:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Ensure required topics are set
+ uses: actions/github-script@v7
+ with:
+ script: |
+ // Topics we always want applied. Extra topics already on the repo are preserved.
+ const REQUIRED = ['hacktoberfest-excluded'];
+
+ const { owner, repo } = context.repo;
+
+ const { data: current } = await github.request('GET /repos/{owner}/{repo}/topics', {
+ owner, repo,
+ headers: { 'Accept': 'application/vnd.github.mercy-preview+json' },
+ });
+ const have = new Set(current.names || []);
+ const missing = REQUIRED.filter(t => !have.has(t));
+
+ if (missing.length === 0) {
+ core.info(`All required topics already present: ${REQUIRED.join(', ')}`);
+ return;
+ }
+
+ const merged = Array.from(new Set([...(current.names || []), ...REQUIRED]));
+ core.info(`Adding missing topics: ${missing.join(', ')}`);
+ await github.request('PUT /repos/{owner}/{repo}/topics', {
+ owner, repo,
+ names: merged,
+ headers: { 'Accept': 'application/vnd.github.mercy-preview+json' },
+ });
+ core.info(`Topics now: ${merged.join(', ')}`);
diff --git a/Dockerfile b/Dockerfile
index 2e60d9a0c..ab6ca0eca 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,87 +1,243 @@
-# ── Stage 1: Build ────────────────────────────────────────────────────────────
-# Debian 12 base: ships a recent glibc (2.36) and g++-12 meeting our GCC 12.3+ pin.
-# Qt is NOT installed from apt (Debian ships 6.4.x); we fetch Qt 6.8.3 via
-# aqtinstall to match the version pin in fincept-qt/CMakeLists.txt.
-FROM debian:12-slim AS builder
-
-ENV DEBIAN_FRONTEND=noninteractive
+# syntax=docker/dockerfile:1.6
+# ─────────────────────────────────────────────────────────────────────────────
+# Fincept Terminal — multi-stage, multi-arch Docker build
+#
+# One Dockerfile, all hosts. Works for Docker Desktop on Windows/macOS (they
+# run Linux containers) and native Linux hosts. Windows/macOS native installers
+# (.exe / .dmg) are produced by .github/workflows/release.yml on platform
+# runners — Docker cannot build those, by design.
+#
+# Architecture auto-detection
+# ───────────────────────────
+# BuildKit sets TARGETARCH automatically (`amd64` or `arm64`). The build picks
+# the right Qt kit, Kitware CMake tarball, and apt architecture for us:
+#
+# docker build -t fincept/terminal:4.0.2 .
+# → auto-detects host arch via BuildKit
+#
+# docker buildx build --platform linux/amd64,linux/arm64 \
+# -t fincept/terminal:4.0.2 --push .
+# → cross-build both archs in one go
+#
+# Pins (must match fincept-qt/CMakeLists.txt + release.yml):
+# • Qt 6.8.3 EXACT — aqtinstall (linux_gcc_64 / linux_gcc_arm64)
+# • GCC ≥ 12.3 — Debian trixie g++-13
+# • CMake 3.27.7 — Kitware prebuilt (x86_64 / aarch64)
+# • QT_MODULES = qtcharts qtwebsockets qtmultimedia
+#
+# Run (X11 on Linux host):
+# docker run --rm -it --net=host \
+# -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix \
+# fincept/terminal:4.0.2
+# ─────────────────────────────────────────────────────────────────────────────
+
+# ── Stage 1: Build ───────────────────────────────────────────────────────────
+# `--platform=$BUILDPLATFORM` pins the builder stage to the native host arch —
+# this avoids emulation overhead for toolchain work. Qt + CMake tarballs are
+# picked for $TARGETARCH so the produced binary matches the requested target.
+# When building for the native arch (no --platform override), BUILDPLATFORM
+# and TARGETPLATFORM are equal and this is a plain native build.
+FROM --platform=$BUILDPLATFORM debian:trixie-slim AS builder
+
+# BuildKit-provided args. Valid values we care about: TARGETARCH ∈ {amd64, arm64}.
+ARG TARGETARCH
+ARG TARGETPLATFORM
+ARG BUILDPLATFORM
+
+ENV DEBIAN_FRONTEND=noninteractive \
+ LANG=C.UTF-8 \
+ LC_ALL=C.UTF-8
+
+# Pins — overridable via `--build-arg` if you need to bump without editing.
ARG QT_VERSION=6.8.3
-ARG QT_ARCH=gcc_64
-
-# Build toolchain + Qt runtime system deps (for Qt to link against)
+ARG CMAKE_VERSION=3.27.7
+
+# Architecture-dependent values. Qt 6.8 introduced `linux_gcc_arm64` as the
+# aqtinstall arch for Linux on ARM; the on-disk install path is still
+# `gcc_arm64`. x86_64 maps to `linux_gcc_64` / `gcc_64` (the 6.8 rename).
+#
+# We resolve these once in a short shell block and persist them as /etc/build.env
+# so later RUN steps can re-source them. Doing the resolution in-image (rather
+# than as additional ARGs) keeps the `docker build` CLI simple.
+RUN set -eux; \
+ case "${TARGETARCH}" in \
+ amd64) \
+ QT_ARCH_AQT=linux_gcc_64; \
+ QT_ARCH_PATH=gcc_64; \
+ CMAKE_ASSET="cmake-${CMAKE_VERSION}-linux-x86_64.sh"; \
+ ;; \
+ arm64) \
+ QT_ARCH_AQT=linux_gcc_arm64; \
+ QT_ARCH_PATH=gcc_arm64; \
+ CMAKE_ASSET="cmake-${CMAKE_VERSION}-linux-aarch64.sh"; \
+ ;; \
+ *) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
+ esac; \
+ { \
+ echo "QT_ARCH_AQT=${QT_ARCH_AQT}"; \
+ echo "QT_ARCH_PATH=${QT_ARCH_PATH}"; \
+ echo "CMAKE_ASSET=${CMAKE_ASSET}"; \
+ echo "QT_VERSION=${QT_VERSION}"; \
+ echo "CMAKE_VERSION=${CMAKE_VERSION}"; \
+ } > /etc/build.env; \
+ cat /etc/build.env
+
+# Build toolchain + Qt build/link-time system deps. Mirrors the
+# "Install system dependencies" step in release.yml (build-linux job).
+# The -dev packages pull in their non-dev runtime counterparts; the extra
+# `libglib2.0-0t64` / `libicu76` / `libdouble-conversion3` / `libpcre2-16-0`
+# lines below are for Qt's own build-time tools (rcc, moc, uic) — they are
+# binaries shipped inside the aqtinstall Qt kit and must be able to dlopen
+# these at build time, not just link-time.
RUN apt-get update && apt-get install -y --no-install-recommends \
- ca-certificates curl git \
- cmake ninja-build g++-12 \
+ ca-certificates curl wget git \
+ ninja-build \
+ g++-13 gcc-13 \
python3 python3-pip python3-venv \
- pkg-config \
+ pkg-config file \
+ libssl-dev \
libgl1-mesa-dev libglu1-mesa-dev \
libxkbcommon-dev libxkbcommon-x11-dev \
libxcb1-dev libxcb-cursor-dev libxcb-icccm4-dev libxcb-image0-dev \
libxcb-keysyms1-dev libxcb-randr0-dev libxcb-render-util0-dev \
libxcb-shape0-dev libxcb-sync-dev libxcb-xfixes0-dev \
libxcb-xinerama0-dev libxcb-xkb-dev libxcb-util-dev \
- libfontconfig1-dev libdbus-1-dev libssl-dev \
- && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-12 60 \
- && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 60 \
+ libfontconfig1-dev libfreetype6-dev libdbus-1-dev \
+ libglib2.0-0t64 libicu-dev libdouble-conversion3 \
+ libpcre2-16-0 libpcre2-8-0 zlib1g \
+ # Qt Multimedia linkage — prebuilt libQt6Multimedia.so references
+ # PulseAudio + GStreamer symbols that must resolve at link time.
+ libpulse-dev \
+ libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
+ libasound2-dev \
+ && update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-13 60 \
+ && update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 60 \
&& rm -rf /var/lib/apt/lists/*
-# ── Install pinned Qt ${QT_VERSION} via aqtinstall ────────────────────────────
-# aqtinstall pulls exact Qt binaries from the official Qt mirror. Strict pin —
-# matches find_package(Qt6 6.7.2 EXACT ...) in CMakeLists.txt.
+# CMake pinned to 3.27.7 — Kitware ships prebuilt installers for both x86_64
+# and aarch64. Debian's apt cmake drifts behind the project's EXACT pin.
+RUN . /etc/build.env \
+ && wget -q "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_ASSET}" -O /tmp/cmake.sh \
+ && chmod +x /tmp/cmake.sh \
+ && /tmp/cmake.sh --skip-license --prefix=/usr/local \
+ && rm /tmp/cmake.sh \
+ && cmake --version
+
+# Qt 6.8.3 via aqtinstall. Modules match QT_MODULES in release.yml. Retry
+# loop rides through transient drops from the Qt mirror. --break-system-packages
+# is required on trixie's PEP 668 pip.
ENV QT_ROOT=/opt/Qt
-RUN pip3 install --break-system-packages --no-cache-dir aqtinstall \
- && python3 -m aqt install-qt linux desktop ${QT_VERSION} ${QT_ARCH} \
- --outputdir ${QT_ROOT} \
- --modules qtcharts qtwebsockets qtmultimedia qtmultimediawidgets qtspeech
-
-ENV CMAKE_PREFIX_PATH="${QT_ROOT}/${QT_VERSION}/${QT_ARCH}"
-ENV PATH="${CMAKE_PREFIX_PATH}/bin:${PATH}"
-
-# ── Build Fincept Terminal ────────────────────────────────────────────────────
+RUN . /etc/build.env \
+ && pip3 install --break-system-packages --no-cache-dir aqtinstall \
+ && for attempt in 1 2 3 4 5; do \
+ python3 -m aqt install-qt linux desktop "${QT_VERSION}" "${QT_ARCH_AQT}" \
+ --outputdir "${QT_ROOT}" \
+ --modules qtcharts qtwebsockets qtmultimedia \
+ && break \
+ || { echo "aqtinstall attempt ${attempt} failed, retrying in 5s..."; sleep 5; }; \
+ done
+
+# ── Build Fincept Terminal ───────────────────────────────────────────────────
WORKDIR /src
-COPY fincept-qt/ .
-
-RUN rm -rf build \
- && cmake --preset linux-release -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
- && cmake --build --preset linux-release \
- && strip build/linux-release/FinceptTerminal
-
-
-# ── Stage 2: Runtime ──────────────────────────────────────────────────────────
-# Minimal runtime: bundles Qt 6.8.3 libs copied from the builder stage so the
-# runtime image doesn't depend on Debian's (older) Qt packages.
-FROM debian:12-slim AS runtime
-
-ENV DEBIAN_FRONTEND=noninteractive
+COPY fincept-qt/ ./fincept-qt/
+
+WORKDIR /src/fincept-qt
+RUN . /etc/build.env \
+ && export CMAKE_PREFIX_PATH="${QT_ROOT}/${QT_VERSION}/${QT_ARCH_PATH}" \
+ && export PATH="${CMAKE_PREFIX_PATH}/bin:${PATH}" \
+ && rm -rf build \
+ && cmake -B build -G Ninja \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DCMAKE_PREFIX_PATH="${CMAKE_PREFIX_PATH}" \
+ -DOPENSSL_ROOT_DIR=/usr \
+ && cmake --build build --parallel 4 \
+ && strip build/FinceptTerminal
+
+# ── Stage 2: Runtime ─────────────────────────────────────────────────────────
+# Pinned to $TARGETPLATFORM so the final image actually matches the arch the
+# user requested (even when buildx cross-builds from a different BUILDPLATFORM).
+# Minimal runtime: we bundle Qt 6.8.3 from the builder stage so the image does
+# not depend on Debian's (older) Qt packages. Qt pulls in EGL, GL, XCB, audio,
+# Kerberos, and the glib-networking TLS backend — missing any of these causes
+# HTTPS to silently fail or the app to crash on launch.
+FROM --platform=$TARGETPLATFORM debian:trixie-slim AS runtime
+
+ARG TARGETARCH
ARG QT_VERSION=6.8.3
-ARG QT_ARCH=gcc_64
+
+ENV DEBIAN_FRONTEND=noninteractive \
+ LANG=C.UTF-8 \
+ LC_ALL=C.UTF-8
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
- python3 python3-pip \
- libgl1 libglu1-mesa libglib2.0-0 libdbus-1-3 libfontconfig1 \
+ python3 python3-pip python3-venv \
+ # GL / EGL — Qt platform plugins need EGL even with xcb
+ libegl1 libgl1 libglx-mesa0 libglu1-mesa \
+ # XCB platform plugin stack
libxcb1 libxcb-cursor0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 \
libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxcb-sync1 \
- libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-util1 \
+ libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-util1 libxcb-glx0 \
libxkbcommon0 libxkbcommon-x11-0 \
+ # Core Qt runtime dependencies
+ libglib2.0-0t64 libdbus-1-3 libfontconfig1 libfreetype6 \
+ libx11-6 libx11-xcb1 \
+ # TLS backend for QNetworkAccessManager (without it HTTPS silently fails)
+ glib-networking \
+ # Network auth — Kerberos
+ libgssapi-krb5-2 \
+ # Qt Multimedia audio backends (optional module, but linked when present)
+ libpulse0 libasound2t64 libpipewire-0.3-0t64 \
+ # Wayland client libs — WSLg / modern Linux desktops. Without
+ # libwayland-cursor, Qt's wayland plugin fails to dlopen.
+ libwayland-client0 libwayland-cursor0 libwayland-egl1 \
+ libdecor-0-0 libxkbcommon0 \
+ # Used by embedded Python analytics
+ libopenblas0 \
&& rm -rf /var/lib/apt/lists/*
+# Resolve the on-disk Qt arch path for this target. Same mapping as builder.
+RUN set -eux; \
+ case "${TARGETARCH}" in \
+ amd64) echo "gcc_64" > /etc/qt_arch ;; \
+ arm64) echo "gcc_arm64" > /etc/qt_arch ;; \
+ *) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
+ esac
+
ENV QT_ROOT=/opt/Qt
-ENV QT_PREFIX="${QT_ROOT}/${QT_VERSION}/${QT_ARCH}"
-# Bundle Qt 6.8.3 libs + plugins from builder stage
-COPY --from=builder ${QT_PREFIX}/lib ${QT_PREFIX}/lib
-COPY --from=builder ${QT_PREFIX}/plugins ${QT_PREFIX}/plugins
+# Bundle Qt 6.8.3 libs + plugins from builder stage. The builder writes under
+# /opt/Qt/${QT_VERSION}/${arch-dependent}/ — the whole /opt/Qt tree copies
+# cleanly for either arch, since only one kit is installed per build.
+COPY --from=builder /opt/Qt /opt/Qt
-ENV LD_LIBRARY_PATH="${QT_PREFIX}/lib:${LD_LIBRARY_PATH}"
-ENV QT_PLUGIN_PATH="${QT_PREFIX}/plugins"
-ENV QT_QPA_PLATFORM_PLUGIN_PATH="${QT_PREFIX}/plugins/platforms"
+# LD_LIBRARY_PATH / QT_PLUGIN_PATH / QT_QPA_PLATFORM_PLUGIN_PATH are resolved
+# at container start by the ENTRYPOINT wrapper so they pick up the correct
+# per-arch subdirectory (gcc_64 vs gcc_arm64) without needing a shell.
ENV QT_QPA_PLATFORM=xcb
WORKDIR /app
-COPY --from=builder /src/build/linux-release/FinceptTerminal ./FinceptTerminal
-COPY --from=builder /src/scripts ./scripts
-
-RUN chmod +x ./FinceptTerminal
-
-ENTRYPOINT ["./FinceptTerminal"]
+COPY --from=builder /src/fincept-qt/build/FinceptTerminal ./FinceptTerminal
+COPY --from=builder /src/fincept-qt/scripts ./scripts
+COPY --from=builder /src/fincept-qt/resources ./resources
+
+# QGeoView is a FetchContent dependency built as a shared library next to the
+# binary on Linux. Copy it into /usr/local/lib so the map widget can dlopen it.
+COPY --from=builder /src/fincept-qt/build/_deps/qgeoview-build/lib/ /usr/local/lib/
+RUN ldconfig \
+ && chmod +x ./FinceptTerminal
+
+# Tiny wrapper resolves QT_PREFIX at runtime (cannot expand $(cat ...) in ENV).
+RUN { \
+ echo '#!/bin/sh'; \
+ echo 'set -e'; \
+ echo 'QT_ARCH="$(cat /etc/qt_arch)"'; \
+ echo 'QT_PREFIX="${QT_ROOT}/'"${QT_VERSION}"'/${QT_ARCH}"'; \
+ echo 'export LD_LIBRARY_PATH="${QT_PREFIX}/lib:/usr/local/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"'; \
+ echo 'export QT_PLUGIN_PATH="${QT_PREFIX}/plugins"'; \
+ echo 'export QT_QPA_PLATFORM_PLUGIN_PATH="${QT_PREFIX}/plugins/platforms"'; \
+ echo 'exec /app/FinceptTerminal "$@"'; \
+ } > /usr/local/bin/fincept-entrypoint.sh \
+ && chmod +x /usr/local/bin/fincept-entrypoint.sh
+
+ENTRYPOINT ["/usr/local/bin/fincept-entrypoint.sh"]
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
index 61aec5f57..ce55ab707 100644
--- a/docs/CONTRIBUTING.md
+++ b/docs/CONTRIBUTING.md
@@ -1,17 +1,21 @@
# Contributing to Fincept Terminal
-Welcome! Fincept Terminal is an open-source native C++20 financial intelligence platform with 40+ screens, embedded Python analytics, and 100+ data connectors.
+Fincept Terminal is an open-source native C++20/Qt6 financial intelligence platform with 50+ screens, embedded Python analytics, and 100+ data connectors. This guide is the canonical **how-to** for contributors — build, architecture, conventions.
+
+> **Before you open a PR**, also read the contribution **policy**: [`.github/CONTRIBUTING.md`](../.github/CONTRIBUTING.md). Policy defines which PRs are accepted (linked approved issue, minimum scope, no auto-formatter churn, etc.); this file covers how to build and where code lives.
---
-## Table of Contents
+## Contents
- [Ways to Contribute](#ways-to-contribute)
- [Tech Stack](#tech-stack)
-- [Getting Started](#getting-started)
+- [Prerequisites](#prerequisites)
+- [Build](#build)
+- [Run](#run)
- [Project Architecture](#project-architecture)
+- [Code Conventions](#code-conventions)
- [Development Workflow](#development-workflow)
-- [Pull Request Process](#pull-request-process)
- [Language-Specific Guides](#language-specific-guides)
- [Getting Help](#getting-help)
@@ -19,230 +23,246 @@ Welcome! Fincept Terminal is an open-source native C++20 financial intelligence
## Ways to Contribute
-| Area | Examples |
-|------|----------|
-| **Code** | Bug fixes, new features, new screens, new analytics |
-| **Documentation** | Improve guides, add examples |
-| **Testing** | Report bugs, write tests, review PRs |
-| **Design** | UI/UX improvements, themes |
-| **Data** | New data sources, API integrations, Python scripts |
+| Area | Examples |
+|---------------|-------------------------------------------------------------------|
+| C++ / Qt | New screens, services, core infrastructure, performance fixes |
+| Python | Analytics scripts, AI agents, data fetchers |
+| Data sources | Broker integrations, government / market data connectors |
+| Documentation | Fix broken/outdated docs (see policy for scope) |
+| Testing | Reproduce bugs, review PRs, write tests |
---
## Tech Stack
-| Layer | Technologies |
-|-------|--------------|
-| **Language** | C++20 — MSVC 19.38 (VS 2022 17.8) / GCC 12.3 / Apple Clang 15.0 |
-| **UI** | Qt 6.7.2 Widgets (pinned EXACT) |
-| **Charts** | Qt6 Charts |
-| **Networking** | Qt6 Network + Qt6 WebSockets |
-| **Database** | Qt6 Sql (SQLite) |
-| **Serialization** | QJsonDocument |
-| **Analytics** | Embedded Python 3.11.9 (1300+ scripts) |
-| **Build** | CMake 3.27.7 + Ninja 1.11.1 (pinned) |
-
-**Language-Specific Guides:**
-- [C++ Guide](./CPP_CONTRIBUTOR_GUIDE.md) — screens, services, core infrastructure
-- [Python Guide](./PYTHON_CONTRIBUTOR_GUIDE.md) — analytics modules, data fetchers
+| Layer | Technology |
+|---------------|--------------------------------------------------------------------------------------|
+| Language | **C++20** — MSVC 19.38 (VS 2022 17.8) / GCC 12.3 / Apple Clang 15.0 |
+| UI | **Qt 6.8.3 EXACT** Widgets (pinned) |
+| Charts | Qt6 Charts |
+| Networking | Qt6 Network + Qt6 WebSockets |
+| Database | Qt6 Sql (SQLite) |
+| Analytics | Embedded **Python 3.11.9** (4000+ scripts) |
+| Excel I/O | QXlsx v1.4.9 (FetchContent, pinned commit) |
+| Mapping | QGeoView (pinned commit) |
+| Build | **CMake 3.27.7 + Ninja 1.11.1** (pinned, unity build) |
---
-## Getting Started
+## Prerequisites
+
+Pinned toolchain versions — enforced by CMake. Mismatch produces a clear fail-fast error.
-### Prerequisites (pinned versions — enforced by CMake)
+| Tool | Version |
+|---------------|-----------------------------------------------------------------------------------------|
+| C++ compiler | MSVC 19.38 (VS 2022 17.8) / GCC 12.3 / Apple Clang 15.0 (Xcode 15.2) |
+| CMake | **3.27.7** — [cmake.org](https://cmake.org/download/) |
+| Ninja | **1.11.1** — [releases](https://github.com/ninja-build/ninja/releases) |
+| Qt | **6.8.3** — [Qt Online Installer](https://www.qt.io/download-qt-installer) |
+| Python | **3.11.9** — [python.org](https://www.python.org/downloads/release/python-3119/) |
+| Git | latest — [git-scm.com](https://git-scm.com) |
-| Tool | Version |
-|------|---------|
-| **C++ compiler** | MSVC 19.38 (VS 2022 17.8) / GCC 12.3 / Apple Clang 15.0 (Xcode 15.2) |
-| **CMake** | 3.27.7 — [cmake.org](https://cmake.org/download/) |
-| **Ninja** | 1.11.1 — [releases](https://github.com/ninja-build/ninja/releases) |
-| **Qt** | 6.7.2 (LTS) — [Qt Online Installer](https://www.qt.io/download-qt-installer) |
-| **Python** | 3.11.9 — [python.org](https://www.python.org/downloads/release/python-3119/) |
-| **Git** | latest — [git-scm.com](https://git-scm.com) |
+Optional (speeds up rebuilds): **ccache 4.13.4** on Windows is auto-detected.
+
+---
-> The CMake build fails fast with a clear error message when toolchain versions don't match.
+## Build
-### Setup (fastest — automated)
+### Fastest — automated setup script
```bash
-# Clone + auto-install toolchain + Qt 6.7.2 + build
git clone https://github.com/Fincept-Corporation/FinceptTerminal.git
cd FinceptTerminal
-./setup.sh # Linux / macOS
-setup.bat # Windows (run from VS 2022 Developer Cmd)
+./setup.sh # Linux / macOS — installs toolchain + Qt via aqtinstall, then builds
+setup.bat # Windows — run from a VS 2022 Developer Command Prompt
```
-The setup script uses `aqtinstall` to fetch Qt 6.7.2 exactly.
+### Manual — CMake presets
-### Setup (manual — using CMake presets)
+All day-to-day development uses presets from `fincept-qt/CMakePresets.json`.
```bash
-git clone https://github.com/Fincept-Corporation/FinceptTerminal.git
-cd FinceptTerminal/fincept-qt
+cd fincept-qt
+
+# Configure (one-time, or after CMakeLists.txt changes)
+cmake --preset win-release # Windows
+cmake --preset linux-release # Linux
+cmake --preset macos-release # macOS
+
+# Build (run after every code change — incremental)
+cmake --build --preset win-release # Windows
+cmake --build --preset linux-release # Linux
+cmake --build --preset macos-release # macOS
+```
-# Install Qt 6.7.2 first (Qt Online Installer or: pip install aqtinstall && aqt install-qt ...)
+Debug builds: replace `release` with `debug` in both commands.
-# Configure + Build (pick your platform preset)
-cmake --preset win-release && cmake --build --preset win-release # Windows
-cmake --preset linux-release && cmake --build --preset linux-release # Linux
-cmake --preset macos-release && cmake --build --preset macos-release # macOS
+Manual configure if presets can't resolve Qt:
-# Run
-./build/linux-release/FinceptTerminal # Linux
-./build/macos-release/FinceptTerminal.app/Contents/MacOS/FinceptTerminal # macOS
-.\build\win-release\FinceptTerminal.exe # Windows
+```powershell
+cmake -B build/win-release -G Ninja -DCMAKE_BUILD_TYPE=Release `
+ -DCMAKE_PREFIX_PATH="C:/Qt/6.8.3/msvc2022_64"
+cmake --build build/win-release
```
-### Verify Installation
+---
+
+## Run
```bash
-cmake --version # 3.27.7
-python --version # 3.11.9
-# Compiler:
-cl / # MSVC 19.38+ (Windows)
-g++ --version / # 12.3+ (Linux)
-clang --version # 15.0+ (macOS, Xcode 15.2)
+.\build\win-release\FinceptTerminal.exe # Windows
+./build/linux-release/FinceptTerminal # Linux
+./build/macos-release/FinceptTerminal.app/Contents/MacOS/FinceptTerminal # macOS
```
---
## Project Architecture
-### Source Layout (`fincept-cpp/src/`)
+### Repository layout
+
+```
+finceptTerminal/
+├── fincept-qt/ # Main C++ application (all development happens here)
+│ ├── src/ # C++ source
+│ ├── scripts/ # Embedded Python analytics (4000+ files)
+│ ├── resources/ # Icons, assets, Qt resources
+│ ├── CMakeLists.txt
+│ ├── CMakePresets.json
+│ ├── CLAUDE.md # Performance/architecture rules (P1–P15, D1–D5)
+│ └── DESIGN_SYSTEM.md # Obsidian UI/UX spec
+├── docs/ # Repo-wide documentation (this file lives here)
+├── .github/ # Issue/PR templates, workflows, contribution policy
+└── README.md
+```
+
+### C++ source layout (`fincept-qt/src/`)
```
src/
-├── main.cpp # Entry point, GLFW/OpenGL setup
-├── app.cpp/h # App state machine, routing
-│
-├── core/ # Shared infrastructure
-│ ├── config.h # Constants (URLs, timeouts, versions)
-│ ├── event_bus.h # Pub/sub messaging
-│ ├── logger.h # Structured logging
-│ └── result.h # Result<T> error handling
-│
-├── ui/ # Reusable ImGui widgets
-├── http/ # HTTP client (libcurl)
-├── storage/ # SQLite database
-├── auth/ # Authentication
-├── python/ # Python runtime bridge
-├── mcp/ # MCP integration
-├── trading/ # Trading engine + brokers
-├── portfolio/ # Portfolio management
-│
-└── screens/ # 40+ terminal screens
- ├── dashboard/
- ├── markets/
- ├── crypto_trading/
- ├── research/
- ├── quantlib/
- ├── ai_chat/
- ├── economics/
- ├── geopolitics/
- └── ...
+├── app/ # Entry point, MainWindow, routing, splash
+├── core/ # Config, events, logging, Result<T>, session
+├── ui/ # Theme, reusable widgets, tables, charts, navigation
+├── network/ # http/ and websocket/ clients
+├── storage/ # SQLite, cache, secure storage, 16 repositories
+├── auth/ # Guest + registered auth, JWT
+├── python/ # Embedded Python bridge, PythonRunner
+├── datahub/ # DataHub producers/consumers (see DATAHUB_ARCHITECTURE.md)
+├── services/ # 18 service domains — market data, news, agents, workflow, etc.
+├── trading/ # Trading core + 18 broker integrations
+├── mcp/ # Model Context Protocol infrastructure (24 tool modules)
+├── ai_chat/ # AI chat UI + LlmService
+└── screens/ # 50+ terminal screens, one subdirectory each
```
-### Python Scripts (`fincept-cpp/scripts/`)
+### Python scripts (`fincept-qt/scripts/`)
```
scripts/
-├── Analytics/ # 34 analytics modules
-│ ├── equityInvestment/ # Stock valuation, DCF
-│ ├── portfolioManagement/# Portfolio optimization
-│ ├── derivatives/ # Options pricing, Greeks
-│ ├── fixedIncome/ # Bond analytics
-│ └── ...
-│
-├── agents/ # AI agents
-├── strategies/ # Trading strategies
-├── technicals/ # Technical analysis
-└── *.py # 80+ data fetchers
+├── Analytics/ # CFA-level quant modules — equity, portfolio, derivatives,
+│ # fixed income, economics, corporate finance
+├── agents/ # AI agent frameworks (finagent_core, Geopolitics, HedgeFund, …)
+├── ai_quant_lab/ # ML, factor discovery, HFT, RL trading, vision quant
+├── agno_trading/ # Agno-based trading agents
+└── *.py # 100+ top-level data fetchers (market, gov, economic, alt)
```
+See `fincept-qt/CLAUDE.md` for the detailed service catalog and architecture rules.
+
---
-## Development Workflow
+## Code Conventions
-### Branch Naming
+### C++
-```
-feature/add-options-screen
-fix/chart-rendering-crash
-docs/update-architecture
-```
+- **Standard:** C++20
+- **Naming:** `snake_case` functions/variables, `PascalCase` types/classes
+- **Namespaces:** `namespace fincept {}`, `namespace fincept::ui {}`; never `using namespace std;`
+- **Qt:** `Q_OBJECT` in all QObject subclasses; pointer-to-member signal/slot syntax only (never `SIGNAL()`/`SLOT()` string macros)
+- **Error handling:** `Result<T>` — no raw exception-based APIs across module boundaries
+- **Logging:** `LOG_INFO` / `LOG_WARN` / `LOG_ERROR` / `LOG_DEBUG` with a context tag, e.g. `LOG_INFO("MarketData", "Fetched 12 quotes")`. Never log API keys or credentials.
-### Making Changes
+### Python
-1. Create branch from `main`
-2. Follow the appropriate language guide
-3. Build and test locally
-4. Commit with clear messages
+- **Style:** match surrounding code. Do **not** run Black / autopep8 / isort on existing files.
+- **Logging:** use the `logging` module (`logger = logging.getLogger(__name__)`, `logger.info(...)`), never `print()`. Scripts run inside an embedded Qt runtime; `print()` output never reaches the user.
+- **Entry points:** C++ invokes scripts through `PythonRunner::instance().run(...)` — your script receives a JSON payload on stdin and must return JSON on stdout. See existing scripts in `scripts/` for the pattern.
-### Commit Format
+### UI / design
-```
-type: short description
+Follow `fincept-qt/DESIGN_SYSTEM.md` (Obsidian design system). Do not introduce ad-hoc color values, typography, or spacing — use the tokens.
-Types: feat, fix, docs, refactor, test, chore, perf
-```
+### Mandatory architecture rules (summary)
+
+Full detail in `fincept-qt/CLAUDE.md`. These are **non-negotiable** — PRs that violate them will be sent back:
+
+- **P1.** Never block the UI thread — no `waitForFinished()` on main thread.
+- **P2.** Lazy screen construction — use `register_factory()` for any screen that fetches data.
+- **P3.** Timers must start/stop in `showEvent()` / `hideEvent()`, never in constructors.
+- **P4.** Python subprocesses go through `PythonRunner` (max 3 concurrent).
+- **P6.** Screens render UI only; services do all fetching, caching, processing.
+- **P14.** Logs use the `LOG_*` macros (C++) or `logger` (Python). Never `printf` / `print` / `std::cout`.
+- **D1–D5.** Streaming data flows through the DataHub — never spawn Python directly from a screen. See `fincept-qt/DATAHUB_ARCHITECTURE.md`.
---
-## Pull Request Process
+## Development Workflow
-### Before Submitting
+### Branch naming
-- [ ] Code compiles without warnings (`-Wall -Wextra`)
-- [ ] No duplicated code — use `core/` and `ui/widgets/`
-- [ ] Screens don't call HTTP directly (use data services)
-- [ ] New `.cpp` files added to `CMakeLists.txt`
-- [ ] `.clang-format` applied
-- [ ] Tested in development mode
+```
+feat/add-options-screen
+fix/chart-render-crash
+docs/update-python-guide
+perf/market-data-coalesce
+refactor/broker-http
+```
-### PR Template
+Never PR from your fork's `main` — always a topic branch.
-```markdown
-## Description
-Brief description
+### Commit style
-## Type
-- [ ] Bug fix
-- [ ] New feature / screen
-- [ ] Documentation
+```
+type: short imperative subject line
-## Testing
-How was this tested?
+Optional body explaining why, not what. Wrap at ~72 cols.
-## Screenshots (if UI)
+Types: feat, fix, docs, refactor, test, chore, perf
```
+### Before you open a PR
+
+1. Confirm the issue you're fixing carries one of: `good-first-issue`, `help-wanted`, `scope:approved` (see [`.github/CONTRIBUTING.md`](../.github/CONTRIBUTING.md)).
+2. Build locally and run the app — verify the fix / feature works end-to-end.
+3. Keep the diff minimal. No auto-formatter churn.
+4. Fill out the PR template honestly; don't tick boxes you didn't verify.
+
+Review process, scope gate, and close-on-sight list are in [`.github/CONTRIBUTING.md`](../.github/CONTRIBUTING.md).
+
---
## Language-Specific Guides
-| Guide | Coverage |
-|-------|----------|
-| [C++ Guide](../fincept-cpp/CONTRIBUTING.md) | Screens, services, core infrastructure, widgets |
-| [Python Guide](./PYTHON_CONTRIBUTOR_GUIDE.md) | Analytics modules, data fetchers, AI agents |
+| Guide | Coverage |
+|---------------------------------------------------------|-----------------------------------------------------------|
+| [C++ Guide](./CPP_CONTRIBUTOR_GUIDE.md) | Screens, services, core infrastructure, widgets, Qt patterns |
+| [Python Guide](./PYTHON_CONTRIBUTOR_GUIDE.md) | Analytics modules, data fetchers, AI agents, PythonRunner contract |
+| [Architecture](./ARCHITECTURE.md) | System design, module boundaries, data flow |
---
## Getting Help
-| Channel | Link |
-|---------|------|
-| Issues | [GitHub Issues](https://github.com/Fincept-Corporation/FinceptTerminal/issues) |
-| Discussions | [GitHub Discussions](https://github.com/Fincept-Corporation/FinceptTerminal/discussions) |
-| Discord | [Join Discord](https://discord.gg/ae87a8ygbN) |
-| Email | [email protected] |
-
-### Good First Issues
+| Channel | Link |
+|--------------|-------------------------------------------------------------------------------|
+| Issues | [GitHub Issues](https://github.com/Fincept-Corporation/FinceptTerminal/issues) |
+| Discussions | [GitHub Discussions](https://github.com/Fincept-Corporation/FinceptTerminal/discussions) |
+| Discord | [discord.gg/ae87a8ygbN](https://discord.gg/ae87a8ygbN) |
+| Email | [email protected] |
-Look for labels: `good first issue`, `help wanted`, `documentation`
+Good first issues carry the `good-first-issue` label — those are the right starting point for new contributors.
---
-**Repository**: https://github.com/Fincept-Corporation/FinceptTerminal
-**Version**: 4.0.1
-**License**: AGPL-3.0
+**Repository:** https://github.com/Fincept-Corporation/FinceptTerminal
+**License:** AGPL-3.0-or-later
diff --git a/fincept-qt/.claude/scheduled_tasks.lock b/fincept-qt/.claude/scheduled_tasks.lock
new file mode 100644
index 000000000..4f37331f9
--- /dev/null
+++ b/fincept-qt/.claude/scheduled_tasks.lock
@@ -0,0 +1 @@
+{"sessionId":"70b3bc8e-3d5a-4a4c-a308-a40235226d57","pid":16144,"acquiredAt":1777033746170}
\ No newline at end of file
diff --git a/fincept-qt/CMakeLists.txt b/fincept-qt/CMakeLists.txt
index 783bc8de1..469602358 100644
--- a/fincept-qt/CMakeLists.txt
+++ b/fincept-qt/CMakeLists.txt
@@ -479,6 +479,7 @@ set(CORE_SOURCES
src/core/symbol/SymbolDragSource.cpp
src/core/components/ComponentCatalog.cpp
src/core/components/PopularityTracker.cpp
+ src/core/crash/CrashHandler.cpp
)
# Network
@@ -1552,7 +1553,23 @@ set_source_files_properties(
# MACOSX_BUNDLE — create a proper .app bundle on macOS
if(WIN32)
set(_FINCEPT_EXE_FLAGS WIN32)
- set(_FINCEPT_PLATFORM_SOURCES resources/app.rc)
+ # Generate app.rc from app.rc.in so FILEVERSION / PRODUCTVERSION / string
+ # table reflect the project() VERSION. Without this the exe's PE version
+ # resource is 0.0.0.0 and Windows Error Reporting cannot triage crashes
+ # by app version (see issue #215). The .ico reference is relative to the
+ # generated file's directory, so copy fincept.ico next to it.
+ set(FINCEPT_VER_MAJOR ${PROJECT_VERSION_MAJOR})
+ set(FINCEPT_VER_MINOR ${PROJECT_VERSION_MINOR})
+ set(FINCEPT_VER_PATCH ${PROJECT_VERSION_PATCH})
+ configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/resources/app.rc.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/app.rc"
+ @ONLY)
+ configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/resources/fincept.ico"
+ "${CMAKE_CURRENT_BINARY_DIR}/fincept.ico"
+ COPYONLY)
+ set(_FINCEPT_PLATFORM_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/app.rc")
elseif(APPLE)
set(_FINCEPT_EXE_FLAGS MACOSX_BUNDLE)
set(_FINCEPT_PLATFORM_SOURCES "")
@@ -1831,6 +1848,15 @@ if(APPLE)
target_link_libraries(FinceptTerminal PRIVATE "-framework Security")
endif()
+# Windows: link dbghelp for the crash-handler minidump writer (see
+# src/core/crash/CrashHandler.cpp). Also link Advapi32/Crypt32 explicitly for
+# SecureStorage — they're normally pulled in transitively, but when MSVC runs
+# /OPT:REF aggressively on release builds the indirect reference via wincred.h
+# can get stripped, producing late-link errors.
+if(WIN32)
+ target_link_libraries(FinceptTerminal PRIVATE dbghelp Advapi32 Crypt32)
+endif()
+
# Copy OpenSSL DLLs to build output — Windows only
if(WIN32)
get_target_property(OPENSSL_CRYPTO_DLL OpenSSL::Crypto IMPORTED_LOCATION)
diff --git a/fincept-qt/resources/app.rc b/fincept-qt/resources/app.rc
deleted file mode 100644
index ace3a2b38..000000000
--- a/fincept-qt/resources/app.rc
+++ /dev/null
@@ -1 +0,0 @@
-IDI_ICON1 ICON "fincept.ico"
diff --git a/fincept-qt/resources/app.rc.in b/fincept-qt/resources/app.rc.in
new file mode 100644
index 000000000..4e2083f6f
--- /dev/null
+++ b/fincept-qt/resources/app.rc.in
@@ -0,0 +1,39 @@
+// No #include <windows.h> — the project's CMAKE_RC_FLAGS strips default /I
+// paths so rc.exe can't resolve SDK headers. Use the numeric equivalents:
+// VS_VERSION_INFO = 1
+// VS_FFI_FILEFLAGSMASK = 0x3FL
+// VOS_NT_WINDOWS32 = 0x00040004L
+// VFT_APP = 0x00000001L
+// VFT2_UNKNOWN = 0x00000000L
+// Values lifted from verrsrc.h; they are ABI-stable since Windows 2000.
+
+IDI_ICON1 ICON "fincept.ico"
+
+1 VERSIONINFO
+FILEVERSION @FINCEPT_VER_MAJOR@,@FINCEPT_VER_MINOR@,@FINCEPT_VER_PATCH@,0
+PRODUCTVERSION @FINCEPT_VER_MAJOR@,@FINCEPT_VER_MINOR@,@FINCEPT_VER_PATCH@,0
+FILEFLAGSMASK 0x3FL
+FILEFLAGS 0x0L
+FILEOS 0x00040004L
+FILETYPE 0x00000001L
+FILESUBTYPE 0x00000000L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Fincept Corporation"
+ VALUE "FileDescription", "Fincept Terminal - Financial Intelligence Platform"
+ VALUE "FileVersion", "@CMAKE_PROJECT_VERSION@"
+ VALUE "InternalName", "FinceptTerminal"
+ VALUE "LegalCopyright", "Copyright (C) 2025 Fincept Corporation. AGPL-3.0-or-later."
+ VALUE "OriginalFilename", "FinceptTerminal.exe"
+ VALUE "ProductName", "Fincept Terminal"
+ VALUE "ProductVersion", "@CMAKE_PROJECT_VERSION@"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x0409, 0x04B0
+ END
+END
diff --git a/fincept-qt/scripts/agents/finagent_core/main.py b/fincept-qt/scripts/agents/finagent_core/main.py
index 1799e0171..84731ff05 100644
--- a/fincept-qt/scripts/agents/finagent_core/main.py
+++ b/fincept-qt/scripts/agents/finagent_core/main.py
@@ -427,8 +427,16 @@ def dispatch_action(
query = params.get("query")
if not query:
return {"success": False, "error": "Missing 'query'"}
- agent = SuperAgent(api_keys=api_keys)
- return agent.execute_multi(query, params.get("session_id"), params.get("aggregate", True))
+ # Forward user's model config so execute_multi's per-agent execute()
+ # calls don't fall through to the "No LLM model configured" path.
+ model_config = (config or {}).get("model")
+ agent = SuperAgent(api_keys=api_keys, model_config=model_config)
+ return agent.execute_multi(
+ query,
+ params.get("session_id"),
+ params.get("aggregate", True),
+ user_config=config,
+ )
# =========================================================================
# Execution Planner
diff --git a/fincept-qt/scripts/agents/finagent_core/super_agent.py b/fincept-qt/scripts/agents/finagent_core/super_agent.py
index 27e57ea3e..3481f51ae 100644
--- a/fincept-qt/scripts/agents/finagent_core/super_agent.py
+++ b/fincept-qt/scripts/agents/finagent_core/super_agent.py
@@ -538,7 +538,12 @@ class SuperAgent:
if not model_provider or not model_id:
return {
"success": False,
- "error": "No LLM model configured. Please configure a model provider and model ID in Settings > LLM Configuration.",
+ "error": (
+ "No LLM model configured. "
+ "GUI: Settings > LLM Configuration. "
+ "Programmatic: pass user_config={'model': {'provider': '...', 'model_id': '...'}} "
+ "to execute() / execute_multi()."
+ ),
"routing": {
"intent": routing.intent.value,
"agent_id": routing.agent_id,
@@ -614,7 +619,8 @@ class SuperAgent:
self,
query: str,
session_id: Optional[str] = None,
- aggregate: bool = True
+ aggregate: bool = True,
+ user_config: Optional[Dict[str, Any]] = None,
) -> Dict[str, Any]:
"""
Execute query on multiple routed agents and aggregate results.
@@ -623,21 +629,84 @@ class SuperAgent:
query: User query
session_id: Optional session ID
aggregate: Whether to aggregate responses
+ user_config: Optional user-provided model/tools/instructions overrides.
+ Must be forwarded to every per-agent execute() call — otherwise
+ multi-agent runs bypass the user's configured provider and fail
+ with "No LLM model configured" (issue #150).
Returns:
- Aggregated or individual responses
+ Aggregated or individual responses, plus a ``workflow`` dict
+ describing each step (intent, agent_id, confidence, success,
+ latency_ms, error) so the UI can render the multi-agent trace.
"""
+ import time
+
routings = self.route_multi(query)
if not routings:
- return self.execute(query, session_id)
+ return self.execute(query, session_id, user_config=user_config)
+
+ logger.info(
+ f"Multi-agent workflow start: query={query[:80]!r} agents={len(routings)}"
+ )
+
+ responses: List[Dict[str, Any]] = []
+ steps: List[Dict[str, Any]] = []
+ workflow_started_at = time.time()
+
+ for index, routing in enumerate(routings, start=1):
+ step_started_at = time.time()
+ logger.info(
+ f"Multi-agent step {index}/{len(routings)}: "
+ f"agent={routing.agent_id} intent={routing.intent.value} "
+ f"confidence={routing.confidence:.2f}"
+ )
- responses = []
- for routing in routings:
- result = self.execute(query, session_id)
- result["routing"]["priority"] = routing.confidence
+ result = self.execute(query, session_id, user_config=user_config)
+ latency_ms = int((time.time() - step_started_at) * 1000)
+
+ # Preserve original confidence as priority (route_multi's confidence
+ # may differ from the per-step LLM-routed confidence in execute()).
+ result.setdefault("routing", {})["priority"] = routing.confidence
responses.append(result)
+ step = {
+ "index": index,
+ "intent": routing.intent.value,
+ "agent_id": routing.agent_id,
+ "confidence": routing.confidence,
+ "success": bool(result.get("success")),
+ "latency_ms": latency_ms,
+ "error": result.get("error"),
+ }
+ steps.append(step)
+
+ if step["success"]:
+ logger.info(
+ f"Multi-agent step {index}/{len(routings)} ok "
+ f"agent={routing.agent_id} latency_ms={latency_ms}"
+ )
+ else:
+ logger.warning(
+ f"Multi-agent step {index}/{len(routings)} failed "
+ f"agent={routing.agent_id} latency_ms={latency_ms} "
+ f"error={step['error']!r}"
+ )
+
+ success_count = sum(1 for s in steps if s["success"])
+ total_latency_ms = int((time.time() - workflow_started_at) * 1000)
+ workflow = {
+ "total": len(steps),
+ "succeeded": success_count,
+ "failed": len(steps) - success_count,
+ "latency_ms": total_latency_ms,
+ "steps": steps,
+ }
+ logger.info(
+ f"Multi-agent workflow done: succeeded={success_count}/{len(steps)} "
+ f"latency_ms={total_latency_ms}"
+ )
+
if aggregate and len(responses) > 1:
# Simple aggregation - combine successful responses
combined = []
@@ -646,16 +715,18 @@ class SuperAgent:
combined.append(f"[{resp['routing']['intent']}]\n{resp['response']}")
return {
- "success": True,
+ "success": success_count > 0,
"response": "\n\n---\n\n".join(combined),
"responses": responses,
- "aggregated": True
+ "aggregated": True,
+ "workflow": workflow,
}
return {
- "success": True,
+ "success": success_count > 0,
"responses": responses,
- "aggregated": False
+ "aggregated": False,
+ "workflow": workflow,
}
def _get_instructions_for_intent(self, intent: QueryIntent) -> str:
diff --git a/fincept-qt/src/app/DockScreenRouter.cpp b/fincept-qt/src/app/DockScreenRouter.cpp
index 1a94c9039..50780d66e 100644
--- a/fincept-qt/src/app/DockScreenRouter.cpp
+++ b/fincept-qt/src/app/DockScreenRouter.cpp
@@ -151,7 +151,7 @@ QWidget* DockScreenRouter::wrap_with_group_badge(const QString& id, QWidget* scr
};
connect(badge, &ui::GroupBadge::group_change_requested, this,
- [this, id, linked, badge, sync_label](SymbolGroup g) {
+ [linked, badge, sync_label](SymbolGroup g) {
linked->set_group(g);
badge->set_group_silent(g);
sync_label();
diff --git a/fincept-qt/src/app/MainWindow.cpp b/fincept-qt/src/app/MainWindow.cpp
index 4ffebfa6c..435b15f66 100644
--- a/fincept-qt/src/app/MainWindow.cpp
+++ b/fincept-qt/src/app/MainWindow.cpp
@@ -436,7 +436,7 @@ MainWindow::MainWindow(int window_id, QWidget* parent) : QMainWindow(parent), wi
if (auto* act_lock = km.action(KeyAction::LockNow)) {
act_lock->setShortcutContext(Qt::ApplicationShortcut);
addAction(act_lock);
- connect(act_lock, &QAction::triggered, this, [this]() {
+ connect(act_lock, &QAction::triggered, this, []() {
auth::InactivityGuard::instance().trigger_manual_lock();
});
}
diff --git a/fincept-qt/src/app/main.cpp b/fincept-qt/src/app/main.cpp
index 4208924db..3d1002e62 100644
--- a/fincept-qt/src/app/main.cpp
+++ b/fincept-qt/src/app/main.cpp
@@ -8,6 +8,7 @@
#include "core/config/AppPaths.h"
#include "core/config/ProfileManager.h"
#include "core/components/ComponentCatalog.h"
+#include "core/crash/CrashHandler.h"
#include "core/keys/KeyConfigManager.h"
#include "core/logging/Logger.h"
#include "core/session/ScreenStateManager.h"
@@ -82,6 +83,13 @@ int main(int argc, char* argv[]) {
QDir().mkpath(fincept::AppPaths::root());
}
+ // Install the unhandled-exception filter BEFORE any Qt object is
+ // constructed. On Windows this writes a minidump to AppPaths::crashdumps()
+ // when the process dies from an access violation, stack overflow, or GS
+ // cookie check failure (STATUS_STACK_BUFFER_OVERRUN — see issue #215).
+ // Do it early so a crash in Qt's own startup still produces a dump.
+ fincept::crash::install();
+
// Required before QApplication when any dock panel contains an OpenGL widget
// (Qt Charts, QOpenGLWidget) — prevents black rendering in floating windows.
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
diff --git a/fincept-qt/src/core/config/AppPaths.cpp b/fincept-qt/src/core/config/AppPaths.cpp
index 6b9f70882..9f8073155 100644
--- a/fincept-qt/src/core/config/AppPaths.cpp
+++ b/fincept-qt/src/core/config/AppPaths.cpp
@@ -53,6 +53,10 @@ QString AppPaths::workspaces() {
return ProfileManager::instance().profile_root() + "/workspaces";
}
+QString AppPaths::crashdumps() {
+ return ProfileManager::instance().profile_root() + "/crashdumps";
+}
+
void AppPaths::ensure_all() {
// Use fprintf to stderr (not qWarning) — main.cpp installs a Qt message
// handler that routes qWarning into Logger, but Logger's file isn't open
@@ -77,6 +81,7 @@ void AppPaths::ensure_all() {
try_mkpath(models());
try_mkpath(runtime());
try_mkpath(workspaces());
+ try_mkpath(crashdumps());
}
} // namespace fincept
diff --git a/fincept-qt/src/core/config/AppPaths.h b/fincept-qt/src/core/config/AppPaths.h
index 5c1e8bfc4..48542ec2d 100644
--- a/fincept-qt/src/core/config/AppPaths.h
+++ b/fincept-qt/src/core/config/AppPaths.h
@@ -45,6 +45,9 @@ class AppPaths {
/// root/workspaces — saved workspace files (.fwsp)
static QString workspaces();
+ /// root/crashdumps — minidumps written by the unhandled-exception filter
+ static QString crashdumps();
+
/// Create all sub-directories if they don't exist.
/// Call once before any path is used.
static void ensure_all();
diff --git a/fincept-qt/src/core/crash/CrashHandler.cpp b/fincept-qt/src/core/crash/CrashHandler.cpp
new file mode 100644
index 000000000..81d13c4ff
--- /dev/null
+++ b/fincept-qt/src/core/crash/CrashHandler.cpp
@@ -0,0 +1,182 @@
+#include "core/crash/CrashHandler.h"
+
+#ifdef _WIN32
+# include "core/config/AppPaths.h"
+
+# include <QDateTime>
+# include <QDir>
+# include <QString>
+
+# include <windows.h>
+// dbghelp.h MUST come after windows.h
+# include <dbghelp.h>
+
+# pragma comment(lib, "dbghelp.lib")
+
+// These NTSTATUS values are the exception codes we care about for crash
+// capture. Windows SDK only exposes them via <ntstatus.h>, which conflicts
+// with <winnt.h> in the same TU. Define them locally.
+# ifndef STATUS_STACK_BUFFER_OVERRUN
+# define STATUS_STACK_BUFFER_OVERRUN ((DWORD)0xC0000409L)
+# endif
+# ifndef STATUS_HEAP_CORRUPTION
+# define STATUS_HEAP_CORRUPTION ((DWORD)0xC0000374L)
+# endif
+
+// ─────────────────────────────────────────────────────────────────────────────
+// Minidump writer for Windows.
+//
+// When FinceptTerminal.exe crashes (access violation, stack overflow,
+// FAST_FAIL_STACK_COOKIE_CHECK_FAILURE, etc.) the default behaviour is that
+// Windows Error Reporting writes a dump to AppData\CrashDumps — BUT only if
+// the user has WER enabled, and WER strips user data and is hard to retrieve.
+//
+// This filter writes our own minidump the moment the unhandled exception
+// fires, to a directory we control, with a deterministic filename. We can
+// then ship it from support tickets or bug reports and open it in WinDbg /
+// Visual Studio.
+//
+// Safety rules inside the filter (heap may be corrupt):
+// - All strings are resolved at install() time and stored in static wide
+// buffers, so no allocation happens during the crash.
+// - dbghelp.dll is implicitly linked via pragma, so no LoadLibrary inside
+// the filter.
+// - We fall through to EXCEPTION_CONTINUE_SEARCH so WER still gets its
+// chance (so the existing AppCrash report the user sees still fires).
+// ─────────────────────────────────────────────────────────────────────────────
+
+namespace {
+
+// Static pre-allocated buffer for the dump directory, resolved once at
+// install() time. MAX_PATH is deliberately small — anything longer than
+// MAX_PATH on Windows needs \\?\ prefixes that MiniDumpWriteDump won't
+// accept, so we keep the dump under the LOCALAPPDATA profile root where
+// paths are always well under the limit.
+constexpr size_t kDirBufferLen = MAX_PATH;
+wchar_t g_dump_dir[kDirBufferLen] = {0};
+bool g_installed = false;
+
+LONG WINAPI unhandled_exception_filter(EXCEPTION_POINTERS* ep) {
+ if (!g_installed || !ep || g_dump_dir[0] == L'\0') {
+ return EXCEPTION_CONTINUE_SEARCH;
+ }
+
+ // Build timestamped filename: crash_YYYYMMDD_HHMMSS_<pid>.dmp
+ SYSTEMTIME st;
+ GetLocalTime(&st);
+
+ wchar_t path[kDirBufferLen + 64] = {0};
+ // swprintf_s is safe inside the filter — it writes to a stack buffer and
+ // does not allocate. The %04d/%02d specifiers are size-bounded so the
+ // final path cannot overflow the buffer.
+ swprintf_s(path, L"%s\\crash_%04d%02d%02d_%02d%02d%02d_%lu.dmp",
+ g_dump_dir,
+ st.wYear, st.wMonth, st.wDay,
+ st.wHour, st.wMinute, st.wSecond,
+ GetCurrentProcessId());
+
+ HANDLE file = CreateFileW(path, GENERIC_WRITE, 0, nullptr,
+ CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
+ if (file != INVALID_HANDLE_VALUE) {
+ MINIDUMP_EXCEPTION_INFORMATION mei = {};
+ mei.ThreadId = GetCurrentThreadId();
+ mei.ExceptionPointers = ep;
+ mei.ClientPointers = FALSE;
+
+ // MiniDumpWithDataSegs + MiniDumpWithThreadInfo give us enough to
+ // reconstruct a usable stack + local variables in WinDbg without
+ // producing a multi-GB dump. MiniDumpWithIndirectlyReferencedMemory
+ // pulls in pointers-to-pointers so struct fields show up.
+ const MINIDUMP_TYPE dump_type = static_cast<MINIDUMP_TYPE>(
+ MiniDumpWithDataSegs |
+ MiniDumpWithThreadInfo |
+ MiniDumpWithIndirectlyReferencedMemory |
+ MiniDumpWithUnloadedModules);
+
+ MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(),
+ file, dump_type, &mei, nullptr, nullptr);
+ CloseHandle(file);
+ }
+
+ // Let WER + debugger attach still see the exception. Returning
+ // EXCEPTION_EXECUTE_HANDLER would swallow it and skip WER, which means
+ // the user loses the crash dialog. We want both our dump AND WER.
+ return EXCEPTION_CONTINUE_SEARCH;
+}
+
+} // namespace
+#endif // _WIN32
+
+namespace fincept::crash {
+
+void install() {
+#ifdef _WIN32
+ // Resolve and create the dump directory once. AppPaths uses QString so we
+ // snapshot it into a static wchar_t buffer for the filter to use without
+ // touching the heap during a crash.
+ const QString dir = fincept::AppPaths::crashdumps();
+ QDir().mkpath(dir);
+
+ // Normalise to native Windows separators — MiniDumpWriteDump's CreateFileW
+ // call can handle '/' but WinDbg is happier with backslashes in reports.
+ const QString native = QDir::toNativeSeparators(dir);
+ const std::wstring wide = native.toStdWString();
+
+ if (wide.size() + 1 >= kDirBufferLen) {
+ // Path too long for our static buffer — skip install rather than
+ // risk a truncated path that writes to the wrong location.
+ return;
+ }
+ wcsncpy_s(g_dump_dir, wide.c_str(), wide.size());
+
+ // Register the filter. A previously-installed filter (Qt's WER stub, say)
+ // is chained via EXCEPTION_CONTINUE_SEARCH so we don't clobber it.
+ SetUnhandledExceptionFilter(unhandled_exception_filter);
+
+ // Also install a vectored handler as a second line of defence. The MSVC
+ // runtime can silently call SetUnhandledExceptionFilter(nullptr) from
+ // inside __CxxFrameHandler when a C++ exception propagates unwind, which
+ // would disable our top-level filter. Vectored handlers run before
+ // SEH's __except blocks and cannot be overridden by the CRT. We return
+ // EXCEPTION_CONTINUE_SEARCH so normal SEH unwinding still runs — we are
+ // only here to capture the dump on the way past.
+ AddVectoredExceptionHandler(/*FirstHandler=*/0,
+ [](EXCEPTION_POINTERS* ep) -> LONG {
+ // Only capture the "this is about to kill us" codes. Filtering
+ // keeps benign SEH (e.g. C++ exceptions, which are SEH internally
+ // with code 0xE06D7363) from triggering a dump on every throw.
+ if (!ep || !ep->ExceptionRecord) return EXCEPTION_CONTINUE_SEARCH;
+ const DWORD code = ep->ExceptionRecord->ExceptionCode;
+ switch (code) {
+ case EXCEPTION_ACCESS_VIOLATION:
+ case EXCEPTION_STACK_OVERFLOW:
+ case EXCEPTION_ILLEGAL_INSTRUCTION:
+ case EXCEPTION_INT_DIVIDE_BY_ZERO:
+ case EXCEPTION_PRIV_INSTRUCTION:
+ case STATUS_STACK_BUFFER_OVERRUN: // 0xC0000409 — GS cookie, FAST_FAIL
+ case STATUS_HEAP_CORRUPTION: // 0xC0000374
+ unhandled_exception_filter(ep);
+ break;
+ default:
+ break;
+ }
+ return EXCEPTION_CONTINUE_SEARCH;
+ });
+
+ // Make sure MSVC's runtime doesn't silently replace our filter when the
+ // CRT internally catches an exception. The call below is a no-op on most
+ // modern MSVC runtimes but is harmless and documented to help.
+ // https://learn.microsoft.com/cpp/c-runtime-library/reference/set-invalid-parameter-handler
+ _set_invalid_parameter_handler([](const wchar_t*, const wchar_t*, const wchar_t*,
+ unsigned int, uintptr_t) {
+ // Trigger our filter by raising a non-continuable exception with the
+ // current context, rather than letting the CRT call abort() which
+ // exits without running our handler.
+ RaiseException(0xE0000001, EXCEPTION_NONCONTINUABLE, 0, nullptr);
+ });
+
+ g_installed = true;
+#endif
+}
+
+} // namespace fincept::crash
diff --git a/fincept-qt/src/core/crash/CrashHandler.h b/fincept-qt/src/core/crash/CrashHandler.h
new file mode 100644
index 000000000..ffab4b693
--- /dev/null
+++ b/fincept-qt/src/core/crash/CrashHandler.h
@@ -0,0 +1,16 @@
+#pragma once
+
+namespace fincept::crash {
+
+/// Install the platform crash handler. On Windows this registers an
+/// UnhandledExceptionFilter that writes a minidump to AppPaths::crashdumps()
+/// when the process is about to die (access violation, stack overflow, GS
+/// cookie check failure, etc.). No-op on other platforms.
+///
+/// Call once, as early as possible in main() — before any Qt object is
+/// constructed. The handler does not allocate heap memory during a crash
+/// (dbghelp is loaded up-front and the dump path is pre-resolved), so it
+/// remains safe even when the heap is corrupted.
+void install();
+
+} // namespace fincept::crash
diff --git a/fincept-qt/src/python/PythonSetupManager.h b/fincept-qt/src/python/PythonSetupManager.h
index 836f0f3df..3d50b7899 100644
--- a/fincept-qt/src/python/PythonSetupManager.h
+++ b/fincept-qt/src/python/PythonSetupManager.h
@@ -111,7 +111,11 @@ class PythonSetupManager : public QObject {
bool verify_packages_installed(const QString& venv_name,
const QString& requirements_file) const;
- static constexpr const char* kPythonVersion = "3.12";
+ // Pinned to an exact patch so `uv python install <ver>` resolves to the
+ // same build on every machine. Previously set to "3.12" which let uv pick
+ // the latest patch, producing non-reproducible installs and contributing
+ // to confusion during crash triage (see issue #215).
+ static constexpr const char* kPythonVersion = "3.12.7";
static constexpr const char* kUvVersion = "0.7.12";
// Session-lifetime caches — requirements files never change at runtime.
diff --git a/fincept-qt/src/services/agents/AgentService.cpp b/fincept-qt/src/services/agents/AgentService.cpp
index 7ccc97ca0..200a52d61 100644
--- a/fincept-qt/src/services/agents/AgentService.cpp
+++ b/fincept-qt/src/services/agents/AgentService.cpp
@@ -1163,14 +1163,14 @@ void AgentService::execute_routed_query(const QString& query, const QJsonObject&
// ── Multi-query ──────────────────────────────────────────────────────────────
-void AgentService::execute_multi_query(const QString& query, bool aggregate) {
+void AgentService::execute_multi_query(const QString& query, bool aggregate, const QJsonObject& config) {
LOG_INFO("AgentService", QString("Multi-query: %1").arg(query.left(60)));
QJsonObject params;
params["query"] = query;
params["aggregate"] = aggregate;
QPointer<AgentService> self = this;
- run_python_stdin("execute_multi_query", params, {}, [self](bool ok, QJsonObject result) {
+ run_python_stdin("execute_multi_query", params, config, [self](bool ok, QJsonObject result) {
if (!self)
return;
if (ok)
diff --git a/fincept-qt/src/services/agents/AgentService.h b/fincept-qt/src/services/agents/AgentService.h
index 90f3ff6c8..e7c4f3be6 100644
--- a/fincept-qt/src/services/agents/AgentService.h
+++ b/fincept-qt/src/services/agents/AgentService.h
@@ -43,7 +43,7 @@ class AgentService : public QObject
void execute_routed_query(const QString& query, const QJsonObject& config = {}, const QString& session_id = {});
// ── Multi-query & parallel ───────────────────────────────────────────────
- void execute_multi_query(const QString& query, bool aggregate = true);
+ void execute_multi_query(const QString& query, bool aggregate = true, const QJsonObject& config = {});
// ── Financial workflows ──────────────────────────────────────────────────
void run_stock_analysis(const QString& symbol, const QJsonObject& config = {});