feature-flag-policy

Documents Cargo feature flags and target-conditional build configurations for the xberg crate.

9.2k|581|Updated Jan 31, 2025
One-click install
npx skills add https://github.com/kreuzberg-dev/kreuzberg --skill feature-flag-policy
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: feature-flag-policy
Source: https://github.com/kreuzberg-dev/kreuzberg/tree/main/.ai-rulez/skills/feature-flag-policy
Command: npx skills add https://github.com/kreuzberg-dev/kreuzberg --skill feature-flag-policy

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It prevents build failures and CI breakage when adding, wiring, or debugging Cargo features in crates/xberg, where ORT-dependent features are incompatible with WASM and Android x86_64 targets and aggregate feature sets must stay in parity.

Core Features & Use Cases

  • ORT Compatibility Rules: Maps which features (paddle-ocr, layout-detection, embeddings, auto-rotate, formula-recognition) fail on WASM and Android x86_64, and which pure-Rust type-only or tract-based variants replace them.
  • Aggregate Feature Sets: Documents the membership of formats, analysis, services, full, no-ort-target, wasm-target, android-target, windows-target, and other curated bundles.
  • CI Parity Guard: Explains the check-feature-parity.py script that fails CI when a feature is added to full but not to windows-target.
  • Use Case: When adding a new ML feature, consult this Skill to decide whether it needs a tract variant, which aggregate sets must include it, and whether the parity guard will reject the change.

Quick Start

Ask the AI to check whether a new Cargo feature compiles on WASM and Android targets and which aggregate feature sets need updating.

Frequently Asked Questions about feature-flag-policy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a new Cargo feature to the xberg crate?

Define the feature in crates/xberg/Cargo.toml, then add it to every applicable aggregate set such as full, formats, or no-ort-target. If it is code-bearing and added to full, you must also add it to windows-target or the feature-parity CI check fails.

Which xberg features work on WASM targets?

WASM-safe features are bundled in wasm-target: no-ort-target plus excel-wasm, ocr-wasm, layout-tract, auto-rotate-tract, and ner-candle-wasm. ORT-dependent features like paddle-ocr, embeddings, and layout-detection cannot compile for WASM.

Why does paddle-ocr fail on the Android x86_64 emulator?

paddle-ocr depends on ONNX Runtime, and pyke ships no prebuilt ORT binary for the x86_64-linux-android triple. The aarch64-linux-android target does have a prebuilt, but Android still routes inference through tract rather than ORT on every ABI.

What is the difference between ort-bundled and ort-dynamic features?

ort-bundled downloads official Microsoft ONNX Runtime binaries and is the default when OCR or ML features are active. ort-dynamic loads ORT from the system and should only be used when a system ORT installation is guaranteed present, such as on macOS Intel.

Why is tree-sitter excluded from the wasm-target feature set?

The statically-linked 371-language grammar pack pushes the browser .wasm file past jsDelivr's 50 MB per-file cap, breaking the CDN-hosted demo. WASM therefore has no code intelligence, while Android keeps the native tree-sitter feature.

What happens if I use the pdf_oxide backend value in PdfConfig?

The pre-1.1.0 spelling pdf_oxide is rejected, not aliased, so the config fails to parse. PdfConfig.backend accepts exactly native and pdfium, and omitting the field defaults to Native.