Skip to content

ai: complete Q4-2026 hardening — schema validation, redaction policy, APG-26..30 + APG-INT-01 - #5409

Merged
makr-code merged 31 commits into
developfrom
copilot/wave-c-strategic-ml-enhancements-q3-2027
Jun 1, 2026
Merged

makr-code merged 31 commits into
developfrom
copilot/wave-c-strategic-ml-enhancements-q3-2027

Conversation

Copilot AI commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request

Description

Closes out all remaining open ROADMAP items for AIPluginGenerator (issue #5040 Wave C scope): schema bounds on previously-unchecked LLM output fields, a formal redaction policy for diagnostic logs, and a full deterministic integration fixture.

Schema-level validation (ai_plugin_generator.cpp)

Fields extracted from LLM responses were validated inconsistently — implementation_code, header_code, test_code had size caps but cmake_code, security_report, version, manifest description, and individual build_dependencies entries did not.

Field Enforcement
cmake_code ≤ 1 MiB → parse_error
security_report ≤ 64 KiB → parse_error
version ≤ 64 chars → defaults to "0.1.0"
manifest description truncated to 8 192 chars
build_dependencies entries > 256 chars silently dropped

Redaction policy (ai_plugin_generator.cpp)

Added truncateForLog() in the anonymous namespace (cap: 120 chars + […] suffix). Applied to the existing spdlog::debug call; documents the invariant that user-supplied and LLM-generated strings are never logged verbatim at any level.

// Redaction policy: user-supplied and LLM-generated content is never logged
// verbatim.  Log helpers truncate strings to kLogMaxLen characters and append
// "[…]" when truncation occurs.  Error messages must not embed raw LLM output.
static constexpr std::size_t kLogMaxLen = 120u;

std::string truncateForLog(const std::string& s) {
    if (s.size() <= kLogMaxLen) return s;
    return s.substr(0, kLogMaxLen) + "[…]";
}

Tests (test_ai_plugin_generator.cpp)

  • APG-26: rejects cmake_code > 1 MiB
  • APG-27: rejects security_report > 64 KiB
  • APG-28: oversized version defaults to "0.1.0"
  • APG-29: oversized manifest description truncated to 8 192 chars
  • APG-30: oversized build_dependencies entry silently dropped; valid entries preserved
  • APG-INT-01: full happy-path integration with a deterministic multi-field endpoint fixture; asserts all output fields, schema constraints, and stats counters in a single round-trip

ROADMAP / CHANGELOG (src/ai/)

All remaining [ ] items closed:

  • Schema validation, retry/backoff (already in code), redaction policy, dedicated benchmark (already registered), performance gate consolidation, Phase 4 integration suite
  • Stale "sandbox not enforced" Known Issues note removed

Linked Issues

Handled by system automation.

Type of Change

  • Bug fix (non-breaking)
  • New feature (non-breaking)
  • Refactoring (non-breaking)
  • Documentation
  • Breaking change (requires MAJOR version bump — see VERSIONING.md)
  • Security fix
  • Other:

Breaking Change Checklist

  • MAJOR version bump planned in VERSION and CMakeLists.txt
  • Migration guide added in docs/migration/
  • Announcement prepared for GitHub Discussions (≥ 2 weeks before release)
  • CHANGELOG ### Removed / ### Changed section updated

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • Benchmarks run (if performance-sensitive change)

📚 Research & Knowledge (wenn applicable)

  • Diese PR basiert auf wissenschaftlichen Paper(s) oder Best Practices?
    • Falls JA: Research-Dateien in /docs/research/ angelegt?
    • Falls JA: Im Modul-README unter "Wissenschaftliche Grundlagen" verlinkt?
    • Falls JA: In /docs/research/implementation_influence/ eingetragen?

Relevante Quellen:

  • Paper:
  • Best Practice:
  • Architecture Decision:

AI-Generated Code (KI-generierter Code)

  • Symbol-Referenzen mit GetSymbolReferences_CppTools geprüft (siehe .github/instructions/cpp-language-service-tools.instructions.md)
  • Keine rohen Pointer und kein new/delete ohne explizites Review eingeführt
  • RAII und Exception-Safety für neue/angepasste Pfade geprüft
  • Keine unnötig komplexen KI-Abstraktionen eingeführt
  • Performance-Metriken geprüft, falls Hotpath betroffen

Checklist

  • Code follows project style guidelines (clang-format / clang-tidy)
  • Self-review completed
  • Documentation updated (if needed)
  • CHANGELOG.md updated under [Unreleased]
  • No new warnings introduced
  • Security-sensitive paths reviewed by security maintainer (if applicable)

Scanner and IntelliSense Gates

  • IntelliSense/Compiler: no new errors in changed files
  • clang-tidy/cppcheck: no new high-risk findings in changed files
  • Gap Scanner: no new critical findings in categories security, input_validation, query_correctness, distributed_consistency, concurrency, memory
  • Gap Scanner: no new high findings in the same categories (or explicitly approved)
  • Gap Scanner delta report attached (baseline vs current), not only absolute totals
  • New unknown scanner findings triaged (fixed, re-categorized, or justified)

Copilot AI linked an issue Jun 1, 2026 that may be closed by this pull request
18 tasks
Copilot AI changed the title [WIP] Implement strategic ML enhancements for safety and privacy Document Wave C Strategic ML roadmap (CAI + Federated Learning) Jun 1, 2026
Copilot AI requested a review from makr-code June 1, 2026 04:22
Copilot AI changed the title Document Wave C Strategic ML roadmap (CAI + Federated Learning) Document Wave C strategic ML roadmap scope, references, and publication track Jun 1, 2026
Copilot AI changed the title Document Wave C strategic ML roadmap scope, references, and publication track Align Wave C docs with concrete Wave A/B issue references Jun 1, 2026
Copilot AI changed the title Align Wave C docs with concrete Wave A/B issue references Continue Wave C issue-scope docs with explicit cross-issue traceability Jun 1, 2026
Copilot AI changed the title Continue Wave C issue-scope docs with explicit cross-issue traceability Extend Wave C AI docs with end-to-end issue traceability Jun 1, 2026
Copilot AI changed the title Extend Wave C AI docs with end-to-end issue traceability Expand Wave C issue-scope traceability across AI governance docs Jun 1, 2026
Copilot AI changed the title Expand CAI default constitutional registry to 21 built-in principles Wave C: Complete C1/C2 scope — 21-principle CAI registry, federated learning, doc alignment Jun 1, 2026
Copilot AI changed the title Wave C: Complete C1/C2 scope — 21-principle CAI registry, federated learning, doc alignment feat(wave-c): complete C1/C2 documentation alignment — 21 principles, correct test ranges Jun 1, 2026
@makr-code

Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts in this pull request

The branch already contains all commits from main — git merge origin/main reports "Already up to date" (merge-base is a33263ee16, which is main's current HEAD). There are no conflicts to resolve. The mergeable_state: unknown shown in GitHub's UI was a stale/uncomputed value; pushing the branch now should trigger GitHub to recompute and show it as mergeable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated AI-assisted change; requires maintainer review before merge area:acceleration Acceleration / GPU / CUDA subsystem area:graph Graph subsystem area:storage Storage subsystem area:vector Vector search subsystem type:documentation Documentation change type:test Test-only change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wave C: Strategic ML Enhancements (Q3 2027+)

2 participants