feat: recognize // volume: mounts in PHP scripts (#11018)

* feat: recognize `// volume:` mounts in PHP scripts

Volume annotations were parsed for every language but PHP, so a PHP script
could not mount a workspace volume. Two things stood in the way: PHP had no
entry in the comment-prefix maps, and a PHP script opens with `<?php`, which
ends the leading comment block the parsers scan before any annotation is read.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T3FR7iS9nRhpFt615cnuQ7

* fix: tolerate a PHP opener that carries code, drop the inert CLI hunk

The open-tag skip matched `<?php` exactly, so `<?php declare(strict_types=1);`
still ended the leading comment block and every annotation below it was silently
ignored. Match the tag as a case-insensitive prefix and skip the whole line.

The CLI local-graph hunk could never fire: PHP has no wasm asset parser, so
`fallbackParse` handles it, and its own header scan stops at `<?php` — the script
is dropped as a non-pipeline-member before any volume asset is read. Making only
the CLI PHP-aware would also put the local graph out of parity with the deployed
one, whose `parse_pipeline_annotations` stops there too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T3FR7iS9nRhpFt615cnuQ7

* docs: correct the CLI mirror comment, state the own-line annotation rule

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01T3FR7iS9nRhpFt615cnuQ7

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-09-08 13:23:35 +02:00
committed by GitHub
co-authored by Claude Opus 5
parent 3e3a41d418
commit f081fb1070
5 changed files with 60 additions and 8 deletions
+7 -1
View File
@@ -413,7 +413,13 @@ export function parseMuteAnnotations(content: string): {
// Comment prefix for `volume:` annotations. Deliberately NOT `commentPrefix`
// above (which returns `--` for SQL): volume annotations are only recognized for
// the languages the backend/frontend recognize them for — mirrors
// `asset_inference.rs:comment_prefix` and `infer.ts:getCommentPrefix` (SQL → none).
// `asset_inference.rs:comment_prefix` and `infer.ts:getCommentPrefix` (SQL → none),
// minus `php`. Those two recognize PHP, but a PHP script cannot reach this map: it
// has no wasm asset parser, so `fallbackParse` handles it and that scan breaks on
// the mandatory `<?php` opener, leaving `in_pipeline` false and the script dropped
// as a non-member. Add `php` here together with PHP support in the pipeline
// annotation scanners (backend `parse_pipeline_annotations` + its frontend mirror
// + the header scans in this file), or the local graph desyncs from the deployed one.
function volumeCommentPrefix(language: string): string | undefined {
switch (language) {
case "python3":