Skip to content

docs(self-model): bring the surfaces up to date with the implementation - #2043

Merged
HuiJun merged 20 commits into
developfrom
feature/self-model-surfaces-drift
Nov 10, 2026
Merged

HuiJun merged 20 commits into
developfrom
feature/self-model-surfaces-drift

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

What and why

The self-model's surfaces (examples/self-model/surfaces.sysml) had drifted from the implementation. This brings them back, each fact read back from the code by a test:

  • ModelService: -host with the loopback default, -token/-token-file, -allow-unauthenticated, -allow-insecure-token-transport, OPENSYSML_GRPC_TOKEN and per-call logging through cmd/sysml-grpc/access.go.
  • LanguageServer: notebook-cell synchronization (sysml, kerml cells), the sysml settings section with its keepLineBreaks and libraryRoots keys, the -keep-line-breaks and -strict flags, and opensysml/importDiagram.
  • RenderingForms (new): the eleven forms of view.Forms(), which are diagram forms, which render runs only, and draw.io as the one read back — by sysml -import-diagram, the LSP request and the MCP import_diagram tool.
  • CommandLine: its verbs (-convert … -metamodel-table, -run-query, -import-diagram).
  • ProjectDiscovery (new): .project.json, the well-known lib and .sysand/lib layouts, OPENSYSML_LIBRARY_ROOTS.
  • Clients: each client's connection code, token option and the variable it falls back to.
  • Editors: EmacsMode and TreeSitterGrammars (Helix, Neovim, Zed) join VsCodeExtension; OpenSysMLMDK/SysonIntegration become MagicMDK/SysonMDK with the plugin names, Maven coordinates and Java package their poms declare.
  • McpNpmPackage (new): @openmbee/sysml-mcp and its @openmbee/opensysml-mcp alias.
  • Oracles: DocCounts.baseline now points at docs/project/spec-compliance/ (the sources), with the combined page recorded as untracked and scripts/spec_compliance.py as its combiner; StdlibSnapshotGate records that it skips without an embedded snapshot; the API-JSON differential, Flexo interop, transformation, formal-constraint, notation and metaclass-map censuses, the specification-examples gate and the structure differential are modelled and placed in the Toolchain.

The "Surfaces over one pipeline" section of the architecture document reads the plugin names, the token variable and the form count from the model; the README's "Keeping it honest" lists the new checks.

origin/develop is merged in nine times with merge commits (1556ade; e074d3f after #2027 and #2071 landed; ddc4a54 after #2026 and #2072 landed; c010f23 after #2073 landed; ade067f after #2077 landed; bd58fde after #2074 landed; c4f55e0 after #2080, #2082 and #2085 landed; 67efcea after #1936 and #2089 landed; d213603 after #2086, #2090, #2091, #2094, #2095, #2098, #2076, #2097, #2099 and #2096 landed). The first two merges conflicted only in the API-JSON baseline and its record, the fourth in those two and the derived-property census baseline, the eighth in those three and the structure differential expectation, and the third, the fifth to seventh and the ninth merged clean; every conflict was resolved by taking develop's side and re-recording by tool.

How it was verified

  • New examples/self_model_surfaces2_test.go reads every added fact back: the gRPC flag table and tokenEnv constant, the access interceptor, the LSP initialize result and its constants, view.Forms()/DiagramForms()/ViewForms(), the MCP catalog entry, cmd/sysml's flag table and usage options, project.ProjectFile/LibraryRootsEnvVar/IsLibraryDir and the wellKnownLibraryDirs table, each client's connection source, the Emacs files/modes/Make targets, the editors guide, both pom.xmls, the npm package.json and README, and each oracle's baseline constants, gate variables and test names.
  • After the develop merge: make stdlib-snapshot, go build ./..., go vet ./..., go vet -C tools ./..., gofmt -l . (empty), make lint, make changelog-check, make docs-counts, make self-model, sysml -validate examples/self-model/*.sysml, and the full go test -count=1 ./... with the training, pilot and specification-example corpora required (six long packages re-run serially under a longer timeout after the parallel run hit the 10-minute default).
  • Baselines re-recorded by their tools over the fetched corpora and adjudicated: the pilot differential (examples digest; pilot-only line numbers in self-model/document.sysml shift by the ten lines the prose section grew), the API-JSON differential (-check reproduces it; matched elements +1007 from the new attributes, headline and gap-table rows restated in docs/project/api-json-differential.md), the derived-property census (-update; summary and silent list unchanged, every rule's counts scale with the new elements) and the structure differential (-update-structure-differential; 101 rows move, every one an existing bucket scaling, none newly non-zero).
  • After the second merge (e074d3f): make stdlib-snapshot, then the same re-recordings; only the API-JSON baseline moved (its examples root: matched elements +1007, ours-only +23, the scorecard scales accordingly; headline and 21 gap-table rows restated), the pilot differential, derived-property census and structure differential reproduce byte for byte. The full gate above was re-run on the pushed head.
  • After the third merge (ddc4a54, no conflicts): make stdlib-snapshot, then the same re-recordings reproduced every baseline byte for byte. The merged cmd/sysml registers -run-query through a flag.Value built in place and adds -run-inline-query, which TestSelfModelCommandLineVerbsMatchFlags caught: CommandLine.verbs now names -run-inline-query too, and the flag-definition pattern the tests read accepts a value built in place as well as a field or local. The three baselines were re-recorded once more for that examples/ edit (provenance digest only; no figure moved), and the full gate above was re-run on the pushed head.
  • After the fourth merge (c010f23): make stdlib-snapshot, then the same re-recordings. The API-JSON differential moved only by the new elements over develop's record (matched +1007, ours-only +23; the headline and the 21 gap-table rows restated), the derived-property census likewise (summary and silent list unchanged, every rule's counts scale), and the pilot differential and structure differential reproduce develop's byte for byte. The full gate above was re-run on the pushed head.
  • After the fifth to seventh merges (ade067f, bd58fde, c4f55e0; none touches examples/): make stdlib-snapshot, then the same re-recordings and every -check reproduce all four baselines byte for byte. The full gate above was re-run on the pushed head.
  • After the eighth merge (67efcea; conflicts in the API-JSON baseline and record, the derived-property census baseline and the structure differential expectation, develop's side taken): make stdlib-snapshot, then the same re-recordings. Over develop's records only the new elements move: the API-JSON differential (matched +1007, ours-only +23; the headline and 21 gap-table rows restated), the derived-property census (elements 31524 → 32523, implied 18354 → 18943; summary and silent list unchanged) and the structure differential (every examples row scales, the self-model's annotations add 8 to AnnotatingElement::annotation present-different, no row newly non-zero); the pilot differential reproduces. Against the previous head only fix(semantics): audit implied generalizations against KerML/SysML 1.1 §8.4 #1936's implicit-generalization rows move (Namespace::member/membership, Type::feature/featureMembership/inheritedFeature/inheritedMembership, Usage::usage, and the census and API-JSON figures develop re-recorded for them); the then_after_members convert golden digest is develop's and its test passes. The full gate above was re-run on the pushed head.
  • After the ninth merge (d213603, no conflicts; fix(symbols): an objective's verify r; is the RequirementUsage its RequirementVerificationMembership owns, not a SatisfyRequirementUsage — reflection, the query leg and the symbol structure answer it as the RDF writer and the pilot state it #2091 re-records the structure differential expectation, which merged clean): make stdlib-snapshot, then the same re-recordings and every -check reproduce all four baselines and the convert goldens byte for byte. The full gate above was re-run on the pushed head.

Checklist

  • make test and make lint pass locally
  • Tests added or updated for the change
  • Documentation extended where it already covers the surface (see CONTRIBUTING.md)
  • Changelog entry added as changes/unreleased/<slug>.<section>.md, not as an edit to CHANGELOG.md
  • baselines regenerated and make docs-counts run if a gate count moved (compliance rows need nothing: the census is counted at docs build)
  • No internal work-item labels (waves, slices, F4, K5) in the body, docs, or changelog

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

Devin Review

devin-ai-integration Bot and others added 2 commits November 7, 2026 19:15
ModelService carries its host, token and logging facts, LanguageServer its
notebook sync and settings, RenderingForms the eleven forms with draw.io read
back, CommandLine its verbs, ProjectDiscovery the library layouts, every client
its token option, EmacsMode/TreeSitterGrammars/MagicMDK/SysonMDK the editors,
McpNpmPackage the npm names, and the oracles the toolchain gained join the
model; self_model_surfaces2_test.go reads each fact back from the code.

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

The examples digest moved with the self-model; the API-JSON record restates
the headline and gap-table figures the re-recorded baseline carries.

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 9, 2026 15:28
devin-ai-integration Bot and others added 4 commits November 9, 2026 15:31
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…cture baselines after merging develop

The examples digest moved with the self-model's new surfaces; every figure
scales an existing bucket and the API-JSON record restates the headline and
gap-table rows the baseline carries.

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

devin-ai-integration Bot and others added 14 commits November 9, 2026 19:25
…lf-model comment tidy

Only the examples input digest moves in each baseline; no figure changed.

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

# Conflicts:
#	docs/project/api-json-differential-baseline.json
#	docs/project/api-json-differential.md
The figures move with the self-model elements only; the record's headline and gap-table rows are restated from the baseline.

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

The merged cmd/sysml registers -run-query through a flag.Value built in place and
adds -run-inline-query; the flag-definition pattern the self-model tests read now
accepts a value built in place, and the three baselines are re-recorded for the
examples/ edit (provenance digest only).

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

# Conflicts:
#	docs/project/api-json-differential-baseline.json
#	docs/project/api-json-differential.md
#	internal/semantic/metamodel/derived_census_baseline.json
… after merging develop

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

# Conflicts:
#	docs/project/api-json-differential-baseline.json
#	docs/project/api-json-differential.md
#	internal/semantic/metamodel/derived_census_baseline.json
#	internal/translate/export/testdata/structure_differential_expected.txt
…e baselines after merging develop

Co-Authored-By: jason.han <hanhuijun@gmail.com>
@HuiJun
HuiJun merged commit 1b94d85 into develop Nov 10, 2026
35 of 57 checks passed
@HuiJun
HuiJun deleted the feature/self-model-surfaces-drift branch November 10, 2026 17:24
devin-ai-integration Bot added a commit that referenced this pull request Nov 10, 2026
Re-recorded with pilot-apijson-diff -update on the merged tree. Only the six
examples/self-model fragments and index.json move (1,278 rows, 1,007 newly
matched elements from #2043's self-model surfaces); the folded totals equal
develop's monolith at 1b94d85 (105,427 matched, 2,045,067 present-equal,
144,702 present-different, 308,336 ours-missing, 81,780 pilot-missing,
2,244,567 absent-both, 35,440 indeterminate, 534 pilot-nondeterministic).

Co-Authored-By: jason.han <hanhuijun@gmail.com>
HuiJun added a commit that referenced this pull request Nov 11, 2026
…gments

* feat(tools): add tools/referee/baseline, a shared per-file fragment baseline store

A referee baseline kept as one generated file conflicts on every merge of two
branches that re-record it. This package lays a baseline out as a directory:
one JSON fragment per compared source file (<root>/<relative path>.json, the
file's summary and its rows in key order) beside an index.json carrying the
provenance and the aggregate figures, which must be a fold of the fragments.
Write/Rewrite record all or the named roots, Read refuses a missing or
unlisted fragment, Check/CheckRoots name every moved, added or removed row,
missing or orphaned fragment and stale index figure or provenance line, and
Verify holds a committed directory to itself without the reference toolchain.
Row, summary and aggregate types and the ratchet policy stay with each referee.

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

* refactor(apijson): split the api-json differential baseline into per-file fragments

docs/project/api-json-differential-baseline.json (1.3 MB, re-recorded whole by
every change under internal/translate/export) becomes the directory
docs/project/api-json-differential/ on tools/referee/baseline: one fragment per
compared source file holding the file's summary and its Metaclass.property rows
as seven-bucket count vectors, and an index.json with the provenance and the
aggregate figures, each a fold over the fragments. The fold reproduces the
monolith exactly: same provenance, same 935 files, same 11,771 scorecard rows
and every total and per-root figure, and the fresh report is byte-identical.

The comparison now accounts per source file: a matched pair under the file our
writer declares the element in, a pilot-only element under the pilot's file,
each side's diagnostics under its own, an ownerless tree without a document
under the file of the element that refers into it; fragmentsOf refuses an
account outside the root's files and sameFigures holds the direct totals to
the fold. pilot-apijson-diff gains -update -roots (re-record named roots and
refold the index), -reindex (rebuild index.json from the committed fragments,
no pilot) and -check -roots; the provenance guard, doc-counts, the hygiene
workflow test, ci-changed-areas and mkdocs read the directory.

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

* chore(apijson): re-record the api-json fragments on the merged tree

Carries develop's Documentation.documentedElement movement (387 properties
oursMissing -> presentEqual across 108 files) into the per-file fragments
and the index; the fold equals develop's monolithic baseline.

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

* chore(apijson): re-record the baseline fragments on the 67efcea merge

Re-recorded with pilot-apijson-diff -update on the merged tree. 66 fragments
and index.json move; the folded totals equal develop's monolith at 67efcea
(104,420 matched, 2,024,875 present-equal, 143,814 present-different,
305,457 ours-missing, 80,960 pilot-missing, 2,220,557 absent-both,
35,136 indeterminate, 534 pilot-nondeterministic). Movement comes from
#1936: TransitionUsage.output, EventOccurrenceUsage/AcceptActionUsage/
SendActionUsage/TerminateActionUsage inherited features and inputs, and
six newly matched elements.

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

* chore(apijson): re-record the baseline fragments on the 1b94d85 merge

Re-recorded with pilot-apijson-diff -update on the merged tree. Only the six
examples/self-model fragments and index.json move (1,278 rows, 1,007 newly
matched elements from #2043's self-model surfaces); the folded totals equal
develop's monolith at 1b94d85 (105,427 matched, 2,045,067 present-equal,
144,702 present-different, 308,336 ours-missing, 81,780 pilot-missing,
2,244,567 absent-both, 35,440 indeterminate, 534 pilot-nondeterministic).

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

* fix(examples): point the self-model at the api-json fragment directory

examples/self-model/surfaces.sysml still named the removed monolith docs/project/api-json-differential-baseline.json as the ApiJsonDifferential oracle's baseline, which TestSelfModelGainedOraclesMatchTools rightly rejects; it now names docs/project/api-json-differential.

The edit changes the examples corpus digest, so the three baselines that record it are re-recorded by their tools (pilot-apijson-diff -update -roots examples, pilot-diff -update, derived-census -update): provenance only, no row, verdict or figure moves.

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

* chore(apijson): re-record the baseline fragments on the 6ff0288 merge

pilot-apijson-diff -update on the merged tree: 69 fragments and index.json move with #2093's objective/body-constraint export and #2109's bare-comment fix (develop's monolith moved the same rows). Totals: 935 files, 105,427 matched; present-equal 2,045,864, present-different 143,898, ours-missing 308,343, pilot-missing 81,606, absent-both 2,244,653, indeterminate 35,440, pilot-nondeterministic 534 — equal to develop's monolith on this tree.

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

* chore(hygiene): mark the api-json baseline fragments generated

.gitattributes listed docs/project/*-baseline.json only, so the fragments under docs/project/api-json-differential/ were shown as source in a diff and counted in the language statistics; the directory's JSON is now linguist-generated, and tests/hygiene holds the attribute line.

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

* fix(tools): bound what a partial baseline re-record vouches for

tools/referee/baseline.Rewrite stamped the checkout's provenance on fragments it had not re-measured, so -reindex after a pilot pin move produced an index the provenance guard accepted; it now refuses every provenance movement outside the inputs named like the replaced roots, naming the refresh command. It also read the committed directory strictly, so two branches that each added or removed a file of one root could not re-record that root after merging; the replaced roots' index entries and files are now skipped and re-recorded whole, while the other roots stay strict. scripts/ci-changed-areas.sh claims tools/referee/baseline/ for the apijson differential job.

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

* chore(tools): keep the baseline store's comments to two lines

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

* build(go): move the toolchain to go1.27.4 (GO-2026-6859)

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

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: jason.han <hanhuijun@gmail.com>
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