[BUG] apm compile reports 'Referenced file not found' for links with a #fragment
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 76/100
Línea de trabajo
Empieza con validate_link_targets en src/apm_cli/compilation/link_resolver.py y las pruebas del resolvedor de enlaces en tests/unit/compilation/test_link_resolver*.py. Comprueba cómo se resuelven los enlaces relativos con fragmentos y cadenas de consulta; después, ejecuta las pruebas de regresión para los archivos existentes y los que faltan. Se considera terminado cuando los destinos existentes pasan y los destinos que faltan se notifican sin el sufijo.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Describe the bug
apm compile warns Referenced file not found for a relative Markdown link that carries a fragment, such as [template](references/standards.md#template), even though references/standards.md exists. validate_link_targets in src/apm_cli/compilation/link_resolver.py skips links that start with #, but passes file.md#fragment to _resolve_path unchanged, so the existence check looks for a file literally named standards.md#template. ?query suffixes behave the same.
Skills commonly link to a heading in a reference file, so a skill package with valid links produces one warning per link.
To Reproduce
from pathlib import Path
from apm_cli.compilation.link_resolver import validate_link_targets
base = Path("pkg"); (base / "references").mkdir(parents=True, exist_ok=True)
(base / "references" / "standards.md").write_text("# Template\n")
print(validate_link_targets("[t](references/standards.md#template)", base))
# ["Referenced file not found: references/standards.md#template (in link 't')"]
Or apm install a skill whose SKILL.md links to references/<file>.md#<heading>, then run apm compile --dry-run.
Expected behavior
The fragment (and query) is ignored for the existence check: an existing file passes and a missing file is still reported, without the fragment.
Environment
- OS: macOS 26 (also expected on Linux and Windows; the check is platform independent)
- Python Version: 3.12
- APM Version: 0.33.0 (code unchanged on
main)
Additional context
Proposed fix (happy to open a PR once the scope is approved), in validate_link_targets before _resolve_path:
# Strip a #fragment or ?query: it targets a heading, not a file
path = re.split(r"[#?]", path, maxsplit=1)[0]
With two regression tests (an existing file with a fragment passes; a missing file with a fragment is reported without it), tests/unit/compilation/test_link_resolver*.py passes (164 tests). resolve_markdown_links has the same startswith("#")-only skip, so a context link with a fragment is not inlined; it may want the same treatment.
- Lenguaje dominante
- Python
- Estrellas
- 4k
- Forks
- 393
- Merge medio
- 3 d 2 h
- PR fusionados (30 d)
- 102
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/apm
-
type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día
-
[BUG] apm self-update failsAbiertotype/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 61/100
microsoft/apm#3268 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[BUG] Flat hook entries without `type` reach `.codex/hooks.json` without the required `type: command`Quizá libre de nuevo @Parth-Vasave la tomó hace 8 días y no hay ningún pull request abierto. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
microsoft/apm#3249 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
-
[BUG] plugin.json `"commands": []` silently skips the `commands/` directoryQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abiertostatus/declined type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
microsoft/apm#3169 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
area/multi-target status/accepted theme/portability triage/recommended type/bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/apm#3067 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de microsoft/apm
Issues similares
-
Project submission:Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 72/100
slavakurilyak/awesome-ai-agents#845 ·
Los mantenedores suelen responder en 1 día
-
tests: pin that the atomic writers in utils/paths.py stage the temporary file in the target's directoryPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertodifficulty:2 enhancement good first issue
Dificultad 1/5 1-3 horas Aptitud para principiantes 92/100
MakazhanAlpamys/Soup#2178 ·
Los mantenedores suelen responder en 1 día
-
[BUG] dcg.waggr permutation p-values are folded twice, so near-zero scores get the smallest p-valuesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
scverse/rapids-singlecell#854 ·
Los mantenedores suelen responder en 1 día
-
Slang input: int8_t4_packed and uint8_t4_packed are copied into CrossGLPosiblemente ocupada @ninglinLiu la tomó hoy. Abiertoarea:frontend backend:slang bug direction:input
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
random_elements(unique=True) on an OrderedDict: ZeroDivisionError once only zero weights remain, AssertionError with use_weighting=FalsePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 13 días