Skip to content

fix(content): CONTENT module quality remediation — RAII fixes, noexcept dtor, regression tests, uninitialized struct defaults, [[nodiscard]] annotations (Phases 3–7)#5255

Open
Copilot wants to merge 25 commits into
developfrom
copilot/p0-critical-content-module-gaps
Open

fix(content): CONTENT module quality remediation — RAII fixes, noexcept dtor, regression tests, uninitialized struct defaults, [[nodiscard]] annotations (Phases 3–7)#5255
Copilot wants to merge 25 commits into
developfrom
copilot/p0-critical-content-module-gaps

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 19, 2026

  • Implement PM_LOAD_ADMIN_MODEL and PM_LIST_ADMIN_MODELS with real built-in administrative model payloads
  • Replace PM_PREDICT_END null placeholder with a deterministic ETA fallback payload
  • Enable fulltext AQL function registration in the builtin function registry
  • Update src/STUB_INVENTORY.md to mark resolved stubs and refresh active counts/IDs
  • Run relevant validation commands/tests and summarize results

…populate MODULE_GAPS.md

Agent-Logs-Url: https://github.com/makr-code/ThemisDB/sessions/648670d9-71f9-4403-8bad-96b96e62dea4

Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix security and code quality gaps in CONTENT module fix(content): VideoProcessor healthCheck correctness, extractMetadata stub documentation, MODULE_GAPS.md audit population May 19, 2026
Copilot AI requested a review from makr-code May 19, 2026 06:15
@makr-code
Copy link
Copy Markdown
Owner

@copilot weiter

@makr-code makr-code marked this pull request as ready for review May 19, 2026 06:21
@github-actions github-actions Bot added type:documentation Documentation improvements or additions type:test Test additions, improvements, or fixes area:storage Storage layer (RocksDB, persistence) area:vector Area: vector area:graph Area: graph area:acceleration Governance area label for acceleration ai-generated labels May 19, 2026
…r encryption; CHANGELOG.md updated

Agent-Logs-Url: https://github.com/makr-code/ThemisDB/sessions/f643ad86-ed7a-4613-aa88-4e240a829ce4

Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 19, 2026

@copilot weiter

Continuing with Phase 3.2. Added in commit 6546c3c:

CON-009 — RAII fix: raw new/delete for tags JSON in metadata encryption (content_manager.cpp)

The metadata-encryption loop (ingestRawBlob) allocated a temporary nlohmann::json for the "tags" field via new nlohmann::json(arr) and then manually deleted it in three separate exit paths — including the exception handler — making it exception-unsafe. Replaced with a local stack variable (tags_tmp) that is destroyed automatically at end of scope. Three raw delete call sites eliminated.

// Before (exception-unsafe — delete in early-continue, success path, and catch):
nlohmann::json arr = meta.tags;
target = new nlohmann::json(arr);
// ... manual delete target in 3 places

// After (RAII):
nlohmann::json tags_tmp;
if (f == "tags") { tags_tmp = meta.tags; target = &tags_tmp; }
// tags_tmp destroyed automatically — no manual delete needed

CHANGELOG.md updated under [Unreleased] with CON-007/CON-008/CON-009.

Copilot AI changed the title fix(content): VideoProcessor healthCheck correctness, extractMetadata stub documentation, MODULE_GAPS.md audit population fix(content): VideoProcessor healthCheck correctness, extractMetadata stub docs, RAII fix for tags JSON encryption, MODULE_GAPS.md audit population May 19, 2026
@makr-code
Copy link
Copy Markdown
Owner

@copilot weiter

…010, CON-011

Agent-Logs-Url: https://github.com/makr-code/ThemisDB/sessions/63d8af87-4e06-4687-bb00-2f3e46aafa89

Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 19, 2026

@copilot weiter

Phase 3.3 complete in commit f9984db.

CON-010 — RAII for EVP_MD_CTX in content_fs.cpp::sha256Hex()
4 raw EVP_MD_CTX_free() early-return call sites removed:

// Before: manual free on every early return
EVP_MD_CTX* mdctx = EVP_MD_CTX_new();
if (...) { EVP_MD_CTX_free(mdctx); return ""; }  // ×3
EVP_MD_CTX_free(mdctx);  // normal exit

// After: unique_ptr frees automatically on all paths
using EvpCtxPtr = std::unique_ptr<EVP_MD_CTX, decltype(&EVP_MD_CTX_free)>;
EvpCtxPtr mdctx(EVP_MD_CTX_new(), EVP_MD_CTX_free);

CON-011 — RAII for EVP_MD_CTX in content_manager.cpp::ingestStream()
3 EVP_MD_CTX_free(sha256_ctx); sha256_ctx = nullptr; call sites (init-fail, update-fail in read loop, finalize) replaced by sha256_ctx.reset(). Closes the exception-unsafe leak in the streaming ingest path.

Additional cleanup: redundant explicit file.close() removed from the archive ingestion loop — std::ifstream already guarantees RAII closure at end of each loop iteration.

Copilot AI changed the title fix(content): VideoProcessor healthCheck correctness, extractMetadata stub docs, RAII fix for tags JSON encryption, MODULE_GAPS.md audit population fix(content): VideoProcessor healthCheck correctness, extractMetadata stub docs, EVP_MD_CTX RAII fixes, MODULE_GAPS.md audit population May 19, 2026
@makr-code
Copy link
Copy Markdown
Owner

@copilot weiter

…handlers in archive/video/geo/html processors

Agent-Logs-Url: https://github.com/makr-code/ThemisDB/sessions/fee2b9e9-a58f-46c5-8f6d-dfdb8f2a0e1d

Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
…RY-REL-001)

Agent-Logs-Url: https://github.com/makr-code/ThemisDB/sessions/e2fb7573-d841-4017-a53f-92e5b2697560

Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
…xt registration

Agent-Logs-Url: https://github.com/makr-code/ThemisDB/sessions/9234f359-84ea-47d4-91ed-b7f13614669d

Co-authored-by: makr-code <150588092+makr-code@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated area:acceleration Governance area label for acceleration area:graph Area: graph area:storage Storage layer (RocksDB, persistence) area:vector Area: vector type:documentation Documentation improvements or additions type:test Test additions, improvements, or fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P0-CRITICAL] CONTENT Module — 4,647 Security & Code Quality Gaps

2 participants