Repository navigation
fix(spans): TS/JS/PHP functions start on their declaration line (#3543, #3555) - #3585
Merged
Merged
Conversation
…3543, #3555) Two causes put a unit's start_line before its declaration: - #3543: TS/JS func_start opens with `[ \t\n]*` and PHP's consumes one boundary character (usually the previous line's newline), so the match -- and start_idx -- began on the line before: the class `{`, the prior member's `},`, a docblock's `*/`, or several lines up when PRISM had blanked a doc comment. _slice_by_braces now anchors the unit just past the last newline of the match's leading whitespace run. - #3555: PRISM shielded a PHP heredoc/nowdoc as a bare `""`, dropping its newlines, so every line after one was numbered early. The shield now keeps the literal's newlines (and its statement `;`). span_anchor_audit (language-crucible), misanchored units: typescript 18.1% -> 0.0%, php 21.9% -> 0.0%, javascript 0.4% -> 0.0%; every other language unchanged at 0%. Baseline regenerated. Golden masters reblessed: start/end lines in ts/js/php units (end lines were early by the same amount), the doc-adjacency and archetype mix that follow them, and coordinate ripple. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q
Contributor
6 of 10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3543. Fixes #3555.
Two independent causes put a function's
start_linebefore its declaration in TypeScript, JavaScript and PHP. Downstream,start_linefeeds the DB, SARIF, doc adjacency and the wrapper channel's alignment check.#3543: the
func_startmatch opens on the previous line. TS/JSfunc_startopens with[ \t\n]*. PHP's consumes one boundary character, usually the previous line's\n._slice_by_bracestookmatch.start()as the unit start, so the span opened on:{,},,*/,_slice_by_bracesnow movesstart_idxjust past the last newline of the match's leading whitespace run. Indentation stays in the block. A match that doesn't open with a newline is untouched, which covers every language the audit showed at 0%. The idea matches the existing scheme/lisp #2933 skip.#3555: PRISM collapsed a PHP heredoc/nowdoc to
"". That dropped the literal's newlines, so every line after a heredoc was numbered early; wordpressfunctions.phplost 10. The shield now keeps""plus the literal's newlines, and its statement;.The two fixes ship together because PHP only reaches 0 with both.
Measured:
span_anchor_audit.pyon language-crucibletests/span_anchor_baseline.jsonis regenerated, so the gate now holds these at 0.Type of change
gitgalaxy/core/detector.py,language_standards.py,prism.py, or a per-language rule)CI checklist
audit_checkcomponents: ruff-audit and dead-key are clean. Localruff format --checkand mypy flags are the same on unmodified main (local tool versions).python -m pytest tests/passes: 11,107 passed.test_security_auditor.pywas skipped locally for lack of numpy.crucible_check.py --update --yes: both fixtures reblessed on top of current main. Scope is below.tree_sitter_accuracy_audit.py --ci --all: all OK, 30 languages.tri_comparison_chart.py --all --ci: javascript fails locally identically on unmodified main (ctagsisn't installed here); CI runs it.Golden-master scope
Zero-dependency fixture: 120 differences. 17 are coordinate or composition-fit ripple. The other 103 are all TS/JS/PHP units or their aggregates. That count includes the
.phpfile in the SQL corpus folder and the.tsfile in the javascript folder.Start Linemoves down onto the declaration.End Linemoves with it: it was early by the same amount. For example, reactBabelPlugin.ts:enter35–82 → 36–83 andexit83–99 → 84–100, both now matching the source.Verification
🤖 Generated with Claude Code
https://claude.ai/code/session_01YAtpBfGGyBGGovitSVaM5Q
Generated by Claude Code