bug(pipelines): shortcode stripping deletes text between a {{< >}} shortcode and the next {{% %}}

Aperta Adatta ai principianti
#293 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

@Ashborne-lab ci sta già lavorando.

Dal 14/11/2026.

  • #294 di @Ashborne-lab — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
70/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
data

Direzione di ricerca

Il bug è in HUGO_SHORTCODE_RE in docs-agent-mcp/pipelines/utils/canonical_rag_ingest.py, usata da _strip_hugo_artifacts(). Esegui lo snippet di riproduzione nell'issue: dovrebbe stampare 'A keep this B' invece di 'A B'. È completato quando l'alternativa di shortcode {{< smette di corrispondere al testo fino a un %}} successivo, e un test copre il testo tra uno shortcode con parentesi angolare e uno con percentuale.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Area

pipelines

What happened

HUGO_SHORTCODE_RE in docs-agent-mcp/pipelines/utils/canonical_rag_ingest.py is

re.compile(r"\{\{.*?%\}\}|\{\{.*?\}\}", re.DOTALL)

The first alternative can start at any {{, not only at {{%. When the parser reaches an angle-bracket shortcode such as {{< figure ... >}}, that alternative matches lazily forward to the next %}} anywhere later in the page, and _strip_hugo_artifacts() deletes everything in between, before the document is split into sections and chunks.

On the current kubeflow/website content (commit a7b22c9), running every page through parse_canonical_document() with the current regex and with a fixed one shows text lost on 5 pages (970 characters in total). The largest case is content/en/docs/started/installing-kubeflow/index.md, which loses the rows for five packaged distributions (prokube.ai, Microsoft Azure, Nutanix, QBO and Red Hat). Those vendors never reach the index, so the assistant cannot answer "is there a Kubeflow distribution for Azure / Red Hat / Nutanix?" from the docs. The other four pages are API reference pages that lose their spec link text.

Expected behavior

Only the shortcodes themselves are removed. Text between two shortcodes is kept.

Reproduction

From the repo root:

import sys
sys.path.insert(0, "docs-agent-mcp/pipelines/utils")
from canonical_rag_ingest import _strip_hugo_artifacts

print(repr(_strip_hugo_artifacts(
    'A {{< figure src="/a.png" >}} keep this {{% kf-latest-version %}} B'
)))

Output on main (145409a): 'A B'
Expected: 'A keep this B'

Environment: local, Python 3.12, no cluster needed.

Suspected files

docs-agent-mcp/pipelines/utils/canonical_rag_ingest.py (HUGO_SHORTCODE_RE, _strip_hugo_artifacts)

I have a fix with tests ready and will open a PR.

Lingua principale
Python
Stelle
49
Fork
122
Merge medio
10h 54m
PR unite (30g)
2

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di kubeflow/docs-agent

Tutte le issue di kubeflow/docs-agent

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.