feat(api-check): include file path and line number in compliance failure messages#45
Merged
Merged
Conversation
…ure messages
Parsers now emit a `line` field on each `ParsedSymbol` so the CI check
can show exactly where in the codebase a new public symbol was declared.
- `ParsedSymbol` gains an optional `line?: number` field
- TypeScript parser computes 1-based line numbers from the TS AST
- Swift SymbolGraph normalizer extracts `position.line` (0→1-based)
- Griffe normalizer passes `lineno` from each Griffe node
- Dart extractor threads `LineInfo` through and captures line numbers
for every class, member, function, and variable declaration
- `CheckResult.uncoveredSymbols` is now `ParsedSymbol[]` (was `string[]`)
so callers retain the file/line context through to the formatter
- `formatErrorMessage` renders `defined at: <file>:<line>` under each
symbol when location info is available
Error output now matches the desired shape from SDK-1092:
- SupabaseClient.signInWithPasskey (supabase-flutter)
defined at: Sources/Auth/SupabaseClient.swift:142
Linear: SDK-1092
- Use firstTokenAfterCommentAndMetadata.offset in Dart extractor so annotated declarations report the line of the keyword, not the @annotation - Remove mutation in normalize-griffe emit(); use object spread instead - Rename sym_ → parsed in normalize-symbolgraph for clarity - Document that Griffe lineno is already 1-based (unlike TS/Swift) - Add test: line survives through checkNewSymbols into uncoveredSymbols - Add test: annotated Dart methods report the declaration keyword line
spydon
approved these changes
Jun 25, 2026
spydon
left a comment
Contributor
There was a problem hiding this comment.
Only one nit, except for that it looks good!
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
When the CI compliance check fails because a new public symbol is not registered in the capability matrix, the error message now includes the file and line where the symbol is declared — making it faster for contributors to find and fix the issue.
Before:
After:
Changes
ParsedSymbol: adds optionalline?: numberfield (all parsers emit it; absent means the parser couldn't determine it)ts-parser.ts): computes 1-based line numbers from the TS AST viasf.getLineAndCharacterOfPosition(node.getStart(sf)).line + 1normalize-symbolgraph.ts): extractsposition.linefromlocation.position(Swift positions are 0-based → +1)normalize-griffe.ts): passeslinenofrom each Griffe node (Python ast is already 1-based)LineInfofromCompilationUnit.lineInfoand usesfirstTokenAfterCommentAndMetadata.offsetso annotated declarations report the keyword line, not the@annotationlineCheckResult.uncoveredSymbols: changed fromstring[]toParsedSymbol[]so the formatter retains file/line contextformatErrorMessage: rendersdefined at: <file>:<line>when location is availableRoot cause
scripts/capability-matrix/src/api-check.ts:formatErrorMessageonly had symbol names (strings) — it discarded theParsedSymbolobjects fromcheckNewSymbolsbefore they reached the formatter.Test plan
formatErrorMessage: 3 new tests (file+line, file-only, empty-file)checkNewSymbols: new test verifiesfileandlinesurvive through touncoveredSymbolsLinear
Closes SDK-1092