Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/WORKFLOW_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Diese Richtlinie gilt fuer den schlanken, release-zentrierten Workflow-Kern.
Die kanonische Liste aktiver Workflows steht in `.github/WORKFLOW_REGISTRY.md`.

## Aktive Workflows (43)
## Aktive Workflows (44)
Die aktuelle kanonische Liste steht in `.github/WORKFLOW_REGISTRY.md`; der alte 21er-Stand war veraltet und wird hier durch den aktuellen, im Repository geltenden Zustand ersetzt.

Kernliste der aktiven Workflows:
Expand All @@ -28,6 +28,7 @@ Kernliste der aktiven Workflows:
- `.github/workflows/compliance-supply-chain.yml`
- `.github/workflows/build-ollama-router.yml`
- `.github/workflows/gate-copilot-regression.yml`
- `.github/workflows/copilot-code-review.yml`
- `.github/workflows/publish-wiki.yml`
- `.github/workflows/release-docker-image.yml`
- `.github/workflows/edition-hyperscaler-ci.yml`
Expand Down Expand Up @@ -90,6 +91,9 @@ Kernliste der aktiven Workflows:
- `concurrency` mit `cancel-in-progress` auf Push/PR-Workflows setzen.
- Berechtigungen minimal halten (`permissions` least privilege).
- Schwere Benchmark-, GPU- und Sweep-Jobs standardmaessig ueber `schedule` oder `workflow_dispatch` isolieren.
- Copilot-Review-Runner-Konfigurationen muessen als selbstbegrenzte Workflows
mit dem Jobnamen `copilot-setup-steps` und einem expliziten Ubuntu
`runs-on` deklariert werden.

## Security Guidelines
- Keine Secrets im YAML oder in Shell-Skripten hardcoden.
Expand Down
4 changes: 3 additions & 1 deletion .github/WORKFLOW_REGISTRY.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ Signalqualität und Release-Stabilitaet zu verbessern.
— Scoped CI fuer `tools/copilot-ollama-router/**`
- `.github/workflows/gate-copilot-regression.yml`
— Copilot/CMake-Regression Guard
- `.github/workflows/copilot-code-review.yml`
— Self-scoped Copilot review runner declaration (`copilot-setup-steps`) so agentic reviews have an assigned Ubuntu runner
- `.github/workflows/publish-wiki.yml`
— Publishes docs/architecture, docs/governance, src/*/ROADMAP.md and developer wiki to GitHub Wiki on push to develop or manual dispatch; community guardrail blocks private plugin paths

Expand Down Expand Up @@ -117,7 +119,7 @@ Geplante Dateinamen-Harmonisierung (Soll-Format aus Workflow-Design):
- `.github/docs/WORKFLOW_FILENAME_RENAME_MATRIX.md`

## Stand
- Aktive Workflows im Verzeichnis `.github/workflows/`: 43
- Aktive Workflows im Verzeichnis `.github/workflows/`: 44
- Deaktivierte Workflows in `.github/no_workflows/`: 30
- Strategie: Lean + harte Triggergrenzen + Quarantaene fuer uebertriggernde CI
- Der 21er-Zähler war im vorherigen Dokumentationsstand veraltet; der aktuelle Stand wird durch die kanonische Liste in diesem Registry-Dokument und die zugehörigen Workflow-Dateien definiert.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-clang-fast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
submodules: false
working_directory: .
setup_command: >-
set -euo pipefail; sudo apt-get update -qq; sudo apt-get install -y --no-install-recommends clang lld cmake ninja-build pkg-config librocksdb-dev libgtest-dev libssl-dev zlib1g-dev libzstd-dev libfmt-dev libspdlog-dev nlohmann-json3-dev libtbb-dev libyaml-cpp-dev libmimalloc-dev libcurl4-openssl-dev libvulkan-dev glslc libcpp-httplib-dev libboost-system-dev libboost-filesystem-dev libgrpc++-dev libprotobuf-dev protobuf-compiler-grpc libpugixml-dev
set -euo pipefail; sudo apt-get update -qq; sudo apt-get install -y --no-install-recommends clang lld cmake ninja-build pkg-config sccache librocksdb-dev libgtest-dev libssl-dev zlib1g-dev libzstd-dev libfmt-dev libspdlog-dev nlohmann-json3-dev libtbb-dev libyaml-cpp-dev libmimalloc-dev libcurl4-openssl-dev libvulkan-dev glslc libcpp-httplib-dev libboost-system-dev libboost-filesystem-dev libgrpc++-dev libprotobuf-dev protobuf-compiler-grpc libpugixml-dev
configure_command: >-
cmake -S . -B build-clang-fast -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS="-Wall -Wextra -Wpedantic" -DTHEMIS_BUILD_BENCHMARKS=OFF -DTHEMIS_BUILD_TESTS=ON
build_command: >-
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/copilot-code-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Copilot code review setup

on:
workflow_dispatch:
push:
branches: [develop, community]
paths:
- '.github/workflows/copilot-code-review.yml'
pull_request:
branches: [develop, community]
paths:
- '.github/workflows/copilot-code-review.yml'

permissions:
contents: read

concurrency:
group: copilot-code-review-${{ github.ref }}
cancel-in-progress: true

jobs:
# The job name must remain `copilot-setup-steps` so Copilot can detect it.
copilot-setup-steps:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
persist-credentials: false

- name: Confirm runner availability
run: echo "Copilot code review runner is configured."
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,9 @@
[submodule "projects/Themis.AdminTools.Shared"]
path = projects/Themis.AdminTools.Shared
url = https://github.com/makr-code/themisdb_admin_tools.git

[submodule "plugins/themisdb_ethic_ai"]
path = plugins/themisdb_ethic_ai
url = https://github.com/makr-code/themisdb_ethic_ai.git
branch = develop
commit = ce401ad9d604012a2c02655e79f5c17f57a9f82d
9 changes: 5 additions & 4 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ ThemisDB is a high-performance multi-model database with native AI/LLM integrati
|---|---|---|---|
| core | 9 listed | Mostly DOC / evidence gaps | Runtime adapter registry and plugin loading are delivered; remaining items are Wave D operability and refreshed evidence |
| base | 8 listed | Mostly historical scanner noise | `src/base/MODULE_GAPS.md` re-scan shows 0 actionable current gaps; remaining items are documented false positives or follow-up docs |
| server | 4 residual source gaps | REAL IMPL gaps | gRPC-Web proxy is still UNIMPLEMENTED-only in fallback builds; time-series aggregate/retention providers and RoPE metrics still rely on degraded fallback paths; non-Linux MCP stdio transport remains unsupported |
| server | 1 residual source gap | MOSTLY REMEDIATED | gRPC-Web fallback builds now advertise an explicit fail-closed capability contract, RoPE DELETE now disables runtime config, and unsupported MCP stdio self-disables; remaining work is first-class time-series provider DI beyond degraded metadata signaling |
| query | residual perf / validation follow-up | Mostly verification / perf gaps | Process-mining trace/pattern/ideal query paths and the three `ETHICS_*` runtime gaps were closed on 2026-08-31; remaining work is optimizer/federation hardening and benchmark evidence |
| transaction | 19 listed | Mostly verification / benchmark evidence | Wave 4C code gaps are closed; build/run, chaos, and representative-hardware evidence remain open |
| auth | 8+ listed | Mostly verification / perf follow-up | Wave 4B source gaps are closed; remaining work is Wave 8 tests, representative-hardware baselines, and protocol-matrix regressions |
| LLM | 13 listed | MIXED | Major Wave 5 closures landed; remaining real gaps center on distributed collectives, multi-tenant isolation, and final cross-module speculative/TARG wiring |
| RAG / LLM Wiki | 57 listed | Mostly perf / integration follow-up | BM25+, RRF, persistent cache, and real `LLMJudgeIntegration` path are implemented; remaining work is performance gates, Recall@k sign-off, Wikipedia ABI wiring, and entropy-bridge integration |
| GPU/CUDA | 21+53 listed | REAL IMPL gaps | CUDA/HIP kernel parity and representative-hardware validation remain open release blockers for acceleration-heavy paths |
| access_model | 21 listed | REAL IMPL gaps | Benchmarks and GATE-ACM-01..06 not yet implemented |
| GPU/CUDA | 21+53 listed | REAL IMPL gaps | Break-even routing now uses production build wiring plus explicit CPU/GPU profiling contracts, but CUDA/HIP kernel parity, unchecked-kernel-call closure, and representative-hardware validation remain open release blockers |
| storage | 11 real gaps after 2026-08-31 revalidation | MIXED | Backup restore fail-closed hardening, ggml bridge runtime wiring, `SecuritySignatureManager` null-backend fail-closed behavior, and remote S3/GCS/Azure manifest transport are in place; biggest remaining gaps are long-run validation evidence and cloud-backend hardening follow-up |
| access_model | roadmap contradiction | Mostly DOC drift | Source and module evidence show Phase 5-6 observability, e2e/concurrency tests, and GATE-ACM-01..06 are complete; stale checklist/known-issues text must stay synchronized |
Comment on lines +45 to +47

## Release Hardening Program (current canonical version: v2.4.0-alpha)

Expand Down Expand Up @@ -71,7 +72,7 @@ ThemisDB is a high-performance multi-model database with native AI/LLM integrati
- [x] Wave 8, chaos/fault-injection, sanitizer/recovery, penetration-test, and 99.99% SLA sign-off artefacts are closed: sanitizer evidence bundle at `docs/security/GA_SANITIZER_EVIDENCE_BUNDLE.md`; pentest evidence bundle at `security/pentest/GA_PENTEST_EVIDENCE_BUNDLE.md`; Wave 9 SLA/chaos gates PASS; final governance sign-off pending human approval at `docs/governance/GA_PROMOTION_SIGN_OFF.md`.
- [x] Phase 1-6 execution contract complete: all technical gates PASS; human sign-off (Section 9 of `docs/governance/GA_PROMOTION_SIGN_OFF.md`) is the only remaining GA blocker.
- [x] Tools build-option transition complete: canonical flag for desktop tools is `THEMIS_BUILD_TOOLS` (default `ON`); legacy alias removed.
- [~] Core-first residual source-gap queue revalidated: finish server runtime fallback gaps and query feature gaps first, then close LLM/RAG integration and GPU representative-hardware gates (Target: Q4 2026).
- [~] Core-first residual source-gap queue revalidated: finish the remaining server time-series provider DI gap and query feature gaps first, then close LLM/RAG integration and the remaining GPU parity / representative-hardware gates after the 2026-08-31 acceleration break-even hardening batch. (Target: Q4 2026).

## Program Execution Model (Wave A → B → C → D)

Expand Down
1 change: 1 addition & 0 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2909,6 +2909,7 @@ set(THEMIS_CORE_SOURCES
../src/acceleration/geo_acceleration_bridge.cpp
../src/acceleration/device_manager.cpp
../src/acceleration/vllm_resource_manager.cpp
../src/acceleration/break_even_validator.cc
# PERF-D3: Parallel batch insertion + SIMD distance pipeline
../src/acceleration/vec_knn.cpp
# shader_integrity.cpp uses only OpenSSL (SHA-256) — no GPU/graphics dependency.
Expand Down
1 change: 1 addition & 0 deletions cmake/ModularBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ set(THEMIS_BASE_SOURCES
../src/acceleration/plugin_security.cpp
../src/acceleration/device_manager.cpp
../src/acceleration/vllm_resource_manager.cpp
../src/acceleration/break_even_validator.cc
../src/acceleration/shader_integrity.cpp
# PERF-D3: Parallel batch insertion + SIMD distance pipeline
../src/acceleration/vec_knn.cpp
Expand Down
92 changes: 75 additions & 17 deletions include/acceleration/break_even_validator.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <string>
#include <chrono>
#include <functional>
#include <optional>
#include <unordered_map>
#include <mutex>
Expand Down Expand Up @@ -124,10 +125,10 @@ struct BreakEvenDecision {
float speedup_ratio = 0.0f;

/// CPU path execution time (milliseconds)
std::chrono::milliseconds cpu_time_ms;
std::chrono::milliseconds cpu_time_ms{0};

/// GPU path execution time including transfer (milliseconds)
std::chrono::milliseconds gpu_time_ms;
std::chrono::milliseconds gpu_time_ms{0};

/// Human-readable reason: "break_even_met", "gpu_unavailable", etc.
std::string reason;
Expand Down Expand Up @@ -170,6 +171,11 @@ struct BreakEvenDecision {
*/
class BreakEvenValidator {
public:
using ProfileFn = std::function<std::optional<std::chrono::milliseconds>(
const WorkloadProfile&)>;
using MetricsSinkFn = std::function<void(
const WorkloadProfile&, const BreakEvenDecision&)>;

/**
* @brief Construct a new BreakEvenValidator instance.
*
Expand Down Expand Up @@ -197,7 +203,7 @@ class BreakEvenValidator {
* @param profile Workload profile defining input characteristics
* @return BreakEvenDecision with recommendation and metrics
*
* @thread Fully thread-safe; protected by internal mutex
* @note Thread safety: Fully thread-safe; protected by internal mutex
*/
BreakEvenDecision ShouldUseGPU(const WorkloadProfile& profile);

Expand All @@ -213,7 +219,7 @@ class BreakEvenValidator {
* @param profile Workload profile to profile
* @return BreakEvenDecision with fresh profiling results
*
* @thread Fully thread-safe
* @note Thread safety: Fully thread-safe
*/
BreakEvenDecision Profile(const WorkloadProfile& profile);

Expand All @@ -226,7 +232,7 @@ class BreakEvenValidator {
* @param kernel Kernel type to set threshold for
* @param threshold Minimum speedup ratio (must be >= 1.0)
*
* @thread Fully thread-safe
* @note Thread safety: Fully thread-safe
*/
void SetSpeedupThreshold(KernelType kernel, float threshold);

Expand All @@ -236,7 +242,7 @@ class BreakEvenValidator {
* @param kernel Kernel type
* @return Current threshold for this kernel (or default 1.5 if not set)
*
* @thread Fully thread-safe
* @note Thread safety: Fully thread-safe
*/
float GetSpeedupThreshold(KernelType kernel) const;

Expand All @@ -245,7 +251,7 @@ class BreakEvenValidator {
*
* Next call to ShouldUseGPU() will trigger profiling (cache miss).
*
* @thread Fully thread-safe
* @note Thread safety: Fully thread-safe
*/
void ClearCache();

Expand All @@ -257,10 +263,51 @@ class BreakEvenValidator {
*
* @param duration Cache validity duration
*
* @thread Fully thread-safe
* @note Thread safety: Fully thread-safe
*/
void SetCacheValidityDuration(std::chrono::hours duration);

/**
* @brief Override CPU workload profiling with a caller-provided implementation.
*
* When set, ProfileCPU() delegates to @p fn instead of the built-in
* deterministic cost model. Passing an empty function restores the default
* CPU estimator. Any cached decisions are cleared so subsequent calls are
* re-profiled with the new behavior.
*
* @param fn CPU profiling callback, or empty to restore defaults
*
* @note Thread safety: Fully thread-safe
*/
void SetCPUProfileFn(ProfileFn fn);

/**
* @brief Override GPU workload profiling with a caller-provided implementation.
*
* When set, ProfileGPU() delegates to @p fn instead of the built-in
* deterministic GPU estimate. Passing an empty function restores the default
* GPU estimator. Any cached decisions are cleared so subsequent calls are
* re-profiled with the new behavior.
*
* @param fn GPU profiling callback, or empty to restore defaults
*
* @note Thread safety: Fully thread-safe
*/
void SetGPUProfileFn(ProfileFn fn);

/**
* @brief Register a metrics sink that receives every fresh profile decision.
*
* The sink is called after a non-cached profile completes successfully or
* degrades to CPU because GPU profiling is unavailable. Exceptions thrown by
* the sink are swallowed to preserve fail-closed decision behavior.
*
* @param fn Metrics callback, or empty to disable metrics emission
*
* @note Thread safety: Fully thread-safe
*/
void SetMetricsSink(MetricsSinkFn fn);

/**
* @brief Get the latest break-even speedup ratio for a kernel type.
*
Expand All @@ -270,7 +317,7 @@ class BreakEvenValidator {
* @param kernel Kernel type to query
* @return Latest observed speedup ratio, or 0.0 if no data
*
* @thread Fully thread-safe
* @note Thread safety: Fully thread-safe
*/
float GetLatestBreakEvenRatio(KernelType kernel) const;

Expand All @@ -279,7 +326,7 @@ class BreakEvenValidator {
*
* @return Number of ShouldUseGPU() calls that hit the cache
*
* @thread Fully thread-safe
* @note Thread safety: Fully thread-safe
*/
size_t GetCacheHitCount() const;

Expand All @@ -288,7 +335,7 @@ class BreakEvenValidator {
*
* @return Number of ShouldUseGPU() calls that missed the cache
*
* @thread Fully thread-safe
* @note Thread safety: Fully thread-safe
*/
size_t GetCacheMissCount() const;

Expand All @@ -297,7 +344,7 @@ class BreakEvenValidator {
*
* @return Number of cached decision entries
*
* @thread Fully thread-safe
* @note Thread safety: Fully thread-safe
*/
size_t GetCacheSize() const;

Expand All @@ -321,8 +368,8 @@ class BreakEvenValidator {
/**
* @brief Profile CPU execution time for the given workload.
*
* Delegates to CPU reference kernel implementations to measure
* end-to-end execution time (no GPU transfer overhead).
* Uses a caller-provided profiling hook when configured; otherwise falls
* back to the built-in deterministic CPU cost model.
*
* @param profile Workload to profile on CPU
* @return CPU execution time, or nullopt if profiling failed
Expand All @@ -333,16 +380,22 @@ class BreakEvenValidator {
/**
* @brief Profile GPU execution time for the given workload.
*
* Includes GPU allocation, data transfer, kernel execution, and sync time.
* Returns nullopt if GPU is unavailable or profiling fails.
* Uses a caller-provided profiling hook when configured; otherwise falls
* back to the built-in deterministic GPU estimate including transfer and
* launch overhead. Returns nullopt if the selected device cannot run GPU
* work or profiling fails.
*
* @param profile Workload to profile on GPU
* @return GPU execution time (transfer + compute), or nullopt if GPU unavailable
*/
std::optional<std::chrono::milliseconds> ProfileGPU(
const WorkloadProfile& profile);


static bool RequiresVectorDimension(KernelType kernel);
static bool IsGpuCapableDevice(DeviceType device);
static double EstimateWorkUnits(const WorkloadProfile& profile);
static std::optional<std::chrono::milliseconds> MillisecondsFromEstimate(
double estimated_ms);

/**
* @brief Parse KernelType from string.
Expand Down Expand Up @@ -394,6 +447,11 @@ class BreakEvenValidator {

// Cache configuration
std::chrono::hours cache_validity_duration_;

// Optional profiling/metrics hooks
ProfileFn cpu_profile_fn_;
ProfileFn gpu_profile_fn_;
MetricsSinkFn metrics_sink_;
};

} // namespace acceleration
Expand Down
Loading
Loading