Skip to content

feat(self-model): model the QVTS query path and use it in the architecture document - #2048

Merged
HuiJun merged 95 commits into
developfrom
feature/self-model-qvts
Nov 21, 2026
Merged

HuiJun merged 95 commits into
developfrom
feature/self-model-qvts

Conversation

@devin-ai-integration

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

Copy link
Copy Markdown
Contributor

Chained behind #2116. This branch contains refs/pull/2116/head 60e19cf (the predecessor in the baseline lane, now in the merge queue; it carries #2280 26ba873 and #2324 92e8c43) and origin/develop 57da054 (#2002 and #2432, where this branch's expression typing landed, have merged); one merge base against each.

What and why

The architecture self-model (examples/self-model) knew the query path only as two part defs, QueryCompiler (immutablePlans) and QueryExecutor (orderedRows), in surfaces.sysml, while the implementation has grown QVTS — Query, View, Transformation for SysML v2: the DocumentQueries library, queryplan, queryexec with its outcome record, four surfaces and a recorded example suite. This PR models that path and makes the self-model's own document use it.

  • examples/self-model/queries.sysml (new, package OpenSysMLQueries): QueryLibrary with the twenty-six calc defs of DocumentQueries and the twenty-two plan operations queryplan binds them to (one LibraryQuery part each), QueryCompiler and QueryExecutor (moved here from surfaces.sysml), the outcome record field for field (Step, Frontier, Failure, Finding, PathError, ModelError, Outcome as attribute defs; StepKind ×10, OutcomeKind ×3 and ModelConstraint ×5 as enum defs), StepOutcome — a state def by which a step answers a value, a path error or a model error (model error outranks path error; a tolerated miss is a value), the four QuerySurfaces (-run-query with exit status 2 and checks[].outcome under -json, %run-query, RunDocumentQuery with the QueryOutcome detail, a document Table), QvtsOracle beside the other conformance oracles (reference Open-MBEE/qvts, baseline examples/qvts/expected, gating), the invariant outcomesAreDistinct, and satisfy requirement … by assertions of the twenty existing invariants on the parts that are their subjects, so Verdicts can table them.
  • surfaces.sysml: only the two moved part defs and the DocumentPipeline block (now typed from OpenSysMLQueries, with a QueryPlan flow from the compiler to the executor).
  • document.sysml: a new "Queries and outcomes" section whose seven tables are real queries over the model — Tree over the document pipeline's parts, Differ keyed by name between the toolchain's and the query path's code units, Verdicts over the toolchain and the query path, RelatedElements along specialization, WhereType(exact = true) over the step kinds, and two projections — plus two diagrams. views.sysml gains queryPath, stepOutcome and libraryOperations, appended at the end.
  • README (self-model): the queries.sysml row, a "Run a query over the model" section with a real -run-query recording, and the nine-files / twenty-one-invariants / forty-three-views counts. docs/internals/architecture.md gains a "Queries and documents" subsection pointing at the design note and the guide.
  • Pilot differential baselines re-recorded for the new file under examples/ (pilot-diff and pilot-apijson-diff); the quoted figures in docs/project/pilot-differential.md, docs/project/api-json-differential.md, README.md, docs/internals/architecture.md and the four .agents/skills/testing-pilot-*/SKILL.md files restated to match, with a round paragraph in each differential record. queries.sysml is read clean by the pilot; the seven new pilot-only rows are the kind-mismatch warning the pilot already gives the document's existing table bindings.

Develop and lane merges, re-recorded baselines

Merged origin/develop fe073d0, refs/pull/2324/head c8659fb, origin/develop 8a7f51e, refs/pull/2324/head 92e8c43, origin/develop 0e0f08a and refs/pull/2116/head ee07f91, each --no-ff with the cell-wise baseline driver and make stdlib-snapshot after it. Generated conflicts (the self-model api-json fragments and index.json, pilot-differential-baseline.json, derived_census_baseline.json, structure_differential_expected.txt) took the develop/predecessor side; the quoted pilot-differential figures in README.md, docs/internals/architecture.md, docs/project/pilot-differential.md and the four testing-pilot-* skills were resolved to the predecessor's text with the combined figures, and the two re-record paragraphs of docs/project/api-json-differential.md were both kept. Re-recorded by tool only what -check refused, each time for the same cause — examples/self-model/queries.sysml is one more file under examples/: the structure differential (the examples root alone), derived-census -update (the examples root's totals and records, no per-rule movement), pilot-diff -update (937 files, 540 fully agreeing, 126 only ours, 2458 only the pilot's: the new file reads clean and the seven new table bindings carry the kind-mismatch warning the existing ones already had) and pilot-apijson-diff -update (the nine self-model fragments and index.json, nothing else: 948 files, 110420 → 112401 elements matched, present-equal 2234290 → 2276244, present-different 162796 → 165367, ours-missing 187345 → 190133). LiteralString.result entered the launch-ready top 25 with the new literals and is adjudicated as the LiteralInteger row is. The convert goldens and the gRPC library table reproduce; training_examples_expected.txt is untouched.

How it was verified

  • examples/self_model_queries_test.go (new) reads every stated fact back from the implementation: the calc defs and NON-NORMATIVE marker from the library file, the bindings from queryplan/compiler.go and the Operation constants from plan.go, the step kinds, constraints and record fields from queryexec (by source and reflection), the outcome kinds from Outcome.Kind(), the -run-query flag, cmdRunQuery, the RunDocumentQuery RPC and QueryOutcome message from usage.go, meta.go and the protobuf descriptors, the oracle's paths and recording count from disk, the invariant through EvaluateRequirement, and the rendered section's tables for rows.
  • go build ./..., go vet ./..., gofmt -l . (empty), go test -count=1 ./examples/ ./tests/hygiene ./tests/qvts, go test -C tools ./referee/..., make self-model (renders the three new views and the document), sysml examples/self-model/*.sysml -validate clean, scripts/check-doc-links.py, scripts/check-doc-figures.py and scripts/changelog.py check.

Checklist

  • make test and make lint pass locally (the gates above; full suite in CI)
  • 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

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


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

Devin Review

Add examples/self-model/queries.sysml (OpenSysMLQueries): the DocumentQueries library and the plan operations the compiler binds its calc defs to, the executor and its outcome record (step kinds, constraints, StepOutcome), the surfaces a query is run from, the QVTS recordings as a conformance oracle, the outcomesAreDistinct invariant and the toolchain's satisfactions. Move QueryCompiler/QueryExecutor there from surfaces.sysml, append a "Queries and outcomes" section of real Tree/Differ/Verdicts/RelatedElements/WhereType queries to document.sysml with three views, and read every stated fact back from the implementation in examples/self_model_queries_test.go. Describe the path in docs/internals/architecture.md and re-record both pilot differential baselines for the new file under examples/.

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 25 commits November 10, 2026 05:42
…ueries in the query path

Frontier members and features are Member and FeatureRef records and nearest a single spelling; the service bounds a QueryOutcome detail to failureLimit failures or findings and frontierLimit entries per frontier list, each with its whole count, read from docquery.go and the protobuf descriptors. Every surface also runs a query written inline (-run-inline-query, %run-query inline, inline_query under the inline_document_query capability), and the QVTS oracle holds 27 recordings.

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

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

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…cuments from Cameo

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…d MDK surfaces

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ry and the result-view examples

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

The catalog classifies -as-view and the capability, render_model_view takes a
document form, and the figures that count the bundled libraries follow the
seventeenth: the manual pages, the self-model, the kpar install test, the two
round-trip ratchets and both differential baselines (digest only).

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

An element whose first segment is the view's name, a QVTS name the view
imports or a feature QueryResult inherits is written `expose $::…`. The
structure differential is re-recorded for the eleven new example models.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
develop's objective and body-constraint export change and this branch's
eleven example models both moved the two baselines; they are re-recorded
over the merged tree.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ted name holding :: stays one segment, and an element under an unnamed owner is counted, not exposed

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…query joins a name that is not plain

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…haring its name — the frontier keeps the element where a quoted name makes two share a qualified name

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
develop split the api-json differential baseline into per-file fragments and gave every MCP
catalog tool a scope; both met this branch's re-recorded baselines and its as-view flag on the
query tool. Generated baselines in conflict took develop's side and are re-recorded next.

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

The API-JSON fragments, the pilot differential and the derived-property
census take the eleven examples/qvts files and the QVTS library; only the
examples root and the OpenSysML Libraries provenance move.

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

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

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

The examples root gains queries.sysml (57 models); the query-library test's doc comment
is two lines.

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

Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
devin-ai-integration Bot and others added 19 commits November 20, 2026 11:43
…sult-view

The census records and the differential index merged cell by cell; no source file conflicted.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
… baselines for the self-model query path after merging develop and #2324

Co-Authored-By: jason.han <hanhuijun@gmail.com>
… on the chain head

The differential, the derived census and the structure differential move in the examples root alone, which gains the QVTS result-view models. The census was re-recorded against the live pilot because the recorded pilot column does not hold the new models. The record adjudicates the LiteralString result gap, which enters the launch-ready rows, as the LiteralInteger one.

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

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

# Conflicts:
#	.agents/skills/testing-pilot-corpora-gate/SKILL.md
#	.agents/skills/testing-pilot-differential/SKILL.md
#	.agents/skills/testing-pilot-execution-referee/SKILL.md
#	.agents/skills/testing-pilot-xpect/SKILL.md
#	README.md
#	docs/internals/architecture.md
#	docs/project/api-json-differential/examples/self-model/surfaces.sysml.json
#	docs/project/api-json-differential/index.json
#	docs/project/pilot-differential-baseline.json
#	docs/project/pilot-differential.md
#	internal/semantic/metamodel/derived_census_baseline.json
#	internal/translate/export/testdata/structure_differential_expected.txt
… baselines for the self-model query path after merging develop and #2116

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

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…rty-two QVTS recordings

The executor's Frontier carries an unexported element symbol as its own
bookkeeping; the self-model's attribute defs mirror a record's exported
fields, so the consistency test walks those only. The QVTS oracle holds
thirty-two recordings now; the model says so. Census, pilot and api-json
baselines re-recorded by their tools: the examples digest moved, no cell.

Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ry-result-view

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 found 3 new potential issues.

Devin Review

Comment thread internal/doc/docir/queryresult.go Resolved
@HuiJun
HuiJun added this pull request to the merge queue Nov 20, 2026
@HuiJun
HuiJun removed this pull request from the merge queue due to a manual request Nov 20, 2026
@HuiJun
HuiJun added this pull request to the merge queue Nov 20, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to invalid changes in the merge commit Nov 20, 2026
@HuiJun
HuiJun added this pull request to the merge queue Nov 21, 2026
devin-ai-integration Bot added a commit that referenced this pull request Nov 21, 2026
…ucture

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

# Conflicts:
#	docs/project/api-json-differential.md
#	docs/project/api-json-differential/examples/self-model/document.sysml.json
#	docs/project/api-json-differential/examples/self-model/queries.sysml.json
#	docs/project/api-json-differential/examples/self-model/surfaces.sysml.json
#	docs/project/api-json-differential/examples/self-model/views.sysml.json
#	docs/project/api-json-differential/index.json
#	docs/project/api-json-differential/pilot-examples/Cause and Effect Examples/CauseAndEffectExample.sysml.json
#	docs/project/api-json-differential/training/20. Assignment Actions/Assignment Example.sysml.json
#	docs/project/pilot-differential-baseline.json
#	internal/doc/queryexec/elementids.go
#	internal/semantic/metamodel/derived_census_baseline.json
#	internal/semantic/semantics/annotations.go
#	internal/semantic/semantics/flow_ends.go
#	internal/semantic/semantics/reflective_annotations.go
#	internal/semantic/semantics/reflective_memberships.go
#	internal/semantic/semantics/reflective_memberships_test.go
#	internal/translate/export/api_json_symbol_structure_test.go
#	internal/translate/export/testdata/structure_differential_expected.txt
#	tests/export/testdata/convert/irregular_layout.golden.ttl.sha256
Merged via the queue into develop with commit aa03065 Nov 21, 2026
32 of 59 checks passed
@HuiJun
HuiJun deleted the feature/self-model-qvts branch November 21, 2026 01:17
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