Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

fix(project): index the names and short names of every root declaration - #29

Merged
HuiJun merged 5 commits into
developfrom
fix/index-top-level-names
Nov 20, 2026
Merged

HuiJun merged 5 commits into
developfrom
fix/index-top-level-names

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Without -index, syspi bundle built the .meta.json index with a per-line regular expression that only saw package Name at the start of a line. KerML Table 13, Note 1 asks for "all the non-null shortNames and names of all the top-level elements of the root namespaces". The scanner (topLevelNames, new file internal/project/scan.go) now does that for .sysml and .kerml members:

package <v> Vehicle { … } part def <'w 1'> 'Spare Wheel';   →  v, Vehicle, "w 1", "Spare Wheel"
namespace N { class Inner; } class <c> C; feature f : C;    →  N, c, C, f

How it works, still lexical and standard library only (no external program, no new dependency):

  • A tokenizer drops // notes, //* … */ notes, string values and numbers, keeps /* … */ as a token (it is the body that ends a comment/doc/rep), and reads quoted names with the Table 4 escapes resolved.
  • Brace depth is counted on tokens, so a declaration ends at ; or at the } that returns to the root, wherever the line breaks are.
  • For each root declaration, leading keywords and #prefix::metadata are skipped and the ( '<' NAME '>' )? NAME? that follows is recorded. Each notation has its own reserved-word list, so part def class; is indexed in SysML and class part; in KerML.
  • A name is dropped when what follows shows it is a reference: ::, ., ,, to, then (dependency A to B, flow a.x to b.y, connector a to b), binding a = b, and dependency/featuring/metadata/@ unless from/of/: follows.
  • import, alias and filter contribute nothing.

Output stays deterministic: names are produced in source order and the existing "path that sorts first wins" rule is unchanged. docs/packages.md gains a "Model index from the textual scanner" section with the behaviour and its limits.

The first commit adds the table test against the old scanner; 21 of its cases failed there (short names, namespaces, definitions/usages/types/features at the root, two declarations on a line, a declaration after }, braces and package inside comments, strings and quoted names).

Checked against the specification

Read from the specification PDFs in the SysML v2 release repository: KerML 1.1 Beta 2 and SysML 2.1 Beta 2 (release 2026-09.1), plus the reserved-word lists of KerML 1.0 Beta 4 and SysML 2.0 Beta 4 (release 2025-04). I did not have the formal SysML 2.0 / KerML 1.1 documents.

Verified:

  • What the index holds: KerML 10.3, Table 13 and Note 1 (names and short names of top-level elements, any visibility).
  • Root content: KerML 8.2.3.4.1 RootNamespace = NamespaceBodyElement*; SysML 8.2.2.5.1 RootNamespace = PackageBodyElement* (definitions, usages, aliases, imports, filters).
  • Identification = ( '<' NAME '>' )? NAME?; NAME, UNRESTRICTED_NAME, the escape table, notes, REGULAR_COMMENT and STRING_VALUE (KerML 8.2.2.2–8.2.2.5).
  • Reserved words: KerML 8.2.2.6 (identical in 1.0 Beta 4 and 1.1 Beta 2) and SysML 8.2.2.1.2. SysML 2.1 adds new; it is left unreserved so a 2.0 element of that name is still indexed.
  • The productions behind the reference rules: Dependency, Comment, TypeDeclaration, FeatureDeclaration, the connector, binding, succession and flow declarations, TypeFeaturing, MetadataFeature, prefix metadata, and SysML PerformActionUsage, ExhibitStateUsage, AssertConstraintUsage, SatisfyRequirementUsage, EventOccurrenceUsage, ExtendedDefinition/ExtendedUsage.
  • As a cross-check (not part of the test suite), the scanner reproduces the shipped .meta.json index of all ten standard-library .kpar files of release 2026-09.1 exactly.

Not verified against the specification:

  • Which keywords may precede an Identification was assembled from the productions listed above, not from every definition and usage production one by one (for example IncludeUseCaseUsage, and the view, rendering and case families, are handled by analogy).
  • Whether a name added to the global scope by a root alias or public import belongs in the index. Table 13 says "an index of the global scope"; Note 1 says names of top-level elements. The scanner follows Note 1 and does not index them.

Still not handled

  • Alias and imported names (above).
  • Files with syntax errors: nothing is diagnosed and names may be wrong or missing.
  • A usage behind perform, exhibit, include, assert, satisfy or event is indexed only when its own keyword follows (perform action a); a declaration that starts with any other keyword that cannot open a root member is skipped.
  • Unquoted names accept any Unicode letter, as the old scanner did; the notation allows only a–z, A–Z, digits and _.
  • .json and .xmi members are not read. bundle -index index.json remains the route for an exporter-built index.

Link to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/2f4eb49bc26e4531bfc2ec5f5b59edbd
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/2f4eb49bc26e4531bfc2ec5f5b59edbd?variant=devin
Requested by: @HuiJun


🟢 Devin Review found nothing to fix · View findings · Follow Devin's work

Devin Review

devin-ai-integration Bot and others added 3 commits November 19, 2026 21:15
… misses

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review November 19, 2026 21:26
devin-ai-integration Bot and others added 2 commits November 19, 2026 21:29
…ix metadata

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@HuiJun
HuiJun merged commit d7ebf78 into develop Nov 20, 2026
8 checks passed
@devin-ai-integration
devin-ai-integration Bot deleted the fix/index-top-level-names branch November 20, 2026 02:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant