Repository navigation
feat(doc): read model values into Markdown and AsciiDoc prose (sysml:value) - #1476
Merged
Merged
Conversation
Markdown `[label](sysml:value:<target>)` and AsciiDoc `sysml:value[<target>, <label>]` plan one value run whose target resolves as a reference target does and whose feature is read as a span column cell reads it, the session's object when it holds the chain's root. Element-valued targets are an invalid-value-target planning error; a feature without a value an empty-value evaluation error. Co-Authored-By: jason.han <hanhuijun@gmail.com>
…rose Co-Authored-By: jason.han <hanhuijun@gmail.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
6 tasks done
…nto feat/document-inline-values Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # internal/ir/docplan/plan.go
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…nto feat/document-inline-values
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…-values manual example Co-Authored-By: jason.han <hanhuijun@gmail.com>
…ne-values Co-Authored-By: jason.han <hanhuijun@gmail.com> # Conflicts: # docs/project/api-json-differential-baseline.json # docs/project/api-json-differential.md
…th the inline-values manual example Co-Authored-By: jason.han <hanhuijun@gmail.com>
…nt-valued refs, keep sibling values A chain member written a::b or a 'quoted name' now becomes one member-path segment each, so the value evaluates instead of failing as empty-value. A reference usage is a value target only when typed by data types, itself or through the features it redefines; a ref to a part is refused with invalid-value-target. Walking a member path through held objects keeps the values of the objects that reach the member when another lacks it. Co-Authored-By: jason.han <hanhuijun@gmail.com>
A reference usage is a value target when the types KerML derives for it (declared, or those of the features it subsets, redefines or references) are data types only, so a ref subsetting an attribute reads as that attribute does. Co-Authored-By: jason.han <hanhuijun@gmail.com>
5 of 6 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.
What and why
Markdown and AsciiDoc document bodies can now read model values into the prose, completing the macro set issue #1309 asked for (references landed with #1453; AsciiDoc bodies landed with #1454):
[label](sysml:value:<target>)—[](sysml:value:telescope.mass)renders2290000 [kg],[Mass:](sysml:value:telescope.mass)rendersMass: 2290000 [kg].sysml:value[<target>]andsysml:value[<target>, label](the macro's second positional attribute is the label, assysml:ref[…]already does); the converter previously recognised and refused the macro.Both markups yield one
markup.RunValue, planned bydocplanas aRunValuerun and evaluated bydocirinto an ordinary plain run, so no backend changes were needed.Design decisions:
resolveTargetValueasRef::target/[label](sysml:<target>): a qualified name or feature chain in the body's scope. A feature chain reads from its root (telescope.mount.massreadsmount.massbelowtelescope; a member writtenmount::massor a'quoted name'is one path segment each), a bare or qualified name from the feature's owner (Telescope::aperturereads the nominal value).refto one of those, or anything else that is not a data-valued feature (an attribute, calculation or enumeration usage, or arefwhose types, derived as KerML derivesFeature::typefrom the features it subsets, redefines or references, are data types only) is refused when planning withinvalid-value-targetnaming the element and its kind (Observatory::Telescope::mount, a part usage);sysml:withoutvalue:is the way to name an element. Unresolvable targets areunknown-value-target.queryexec.ReadFeaturebuilds the same executor a query uses and reads the property throughpropertyValues, so a value renders exactly as the same feature does in aSpanColumncell (valuesText, shared withcellText): quantities with their unit, strings, booleans, enumeration literals, multi-valued features joined with,. Over a session whose roots include the chain's root (-run, a document rendered while the REPL holds objects), the object's current value is read asObjectsrows read it;ReadFeaturewalks a member path through nested objects, which the column path does not do today for object rows.empty-valuenaming the content block and the feature. No default syntax was added: cells have none either.Origininside the body.Known limit, stated in the manual's terms: a feature whose name coincides with a queryable property (
name,qualifiedName, …) reads as the column of that name does.Merge order: #1454 (merged) → this PR, now against
developwith currentorigin/developmerged in.Overlap with #1477 (headings open sections, also against
develop): both touchinternal/ir/docplan/markup/{markup,markdown,asciidoc}.go,markup_bodies.go,plan.go,errors.go,scripts/asciidoc/asciidoctor-json.js,docs/manual/authoring.mdand the generateddocs/reference/diagnostics.md. This change is additive (newRunValue, one case each inmarkdown.go,asciidoc.goandmarkup_bodies.go; the new logic lives indocplan/value_runs.goandqueryexec/feature.go). A dry merge of the two heads conflicts inasciidoc.go,asciidoctor-json.js,authoring.mdanddiagnostics.md, each an adjacent addition; whichever lands second re-merges and regenerates the catalogue withmake diagnostics-catalogue. Both add a manual example, anddocs/manual/examplesis an input of the API JSON differential: the baseline here is re-recorded overdevelopplusvalues.sysml(one more file; +96 matched and +12 pilot-only elements, no movement in ours-only or type mismatches), so the second to land re-records it again withgo run -C tools ./cmd/pilot-apijson-diff -updateandmake docs-counts.Proposed wording for the vendored
DocumentQueries.sysml(not edited here), inParagraph's doc comment: "A Markdown or AsciiDoc body may read a feature's value into the prose (sysml:value:,sysml:value[…]); the value renders as aSpanColumncell of that feature would."How it was verified
internal/ir/docplan/markup: Markdown labelled and baresysml:value:destinations; AsciiDocsysml:value[a.mass]/sysml:value[a.b, Mass:]against the converter's JSON, refusals for a value in a table cell and a macro without target.internal/ir/docplan:value_runs_test.go— chain, nested chain and qualified-name targets with root, member path, label and origin; errors for unknown, unparseable, part-usage, definition and content-block targets; AsciiDoc through the recorded converter fixturetestdata/asciidoc_values.{adoc,json}.internal/doc/docir:values_test.go— real, string, boolean, enumeration, quantity with unit and multi-valued attributes in a paragraph and a list item;empty-value; session-bound read of a written object value.internal/doc/docrender:values_report.sysmlwith Markdown and HTML goldens.docs/manual/authoring.md(both prose sections), worked exampledocs/manual/examples/values.{sysml,md}rendered end to end byTestManualValuesExampleMatchesCommittedOutput.go build ./...,go vet ./...,gofmt -l .empty,make lint,go test -raceoverinternal/ir/docplan/... internal/doc/... internal/check/... internal/frontend/grpc/... cmd/sysml/...,make wasm-check(sysml-core 6,613,880 gz under the 6,800,000 budget),make docs-check,make diagnostics-check(catalogue regenerated),python3 scripts/changelog.py check,make docs(strict site build),go run -C tools ./cmd/pilot-apijson-diff -updatewith the pinned exporter (TestCommittedBaselineStatesThisRepositorysProvenance,TestRecordStatesTheBaselinesFiguresandmake docs-countsgreen),go test ./tests/...and the training, pilot and spec-example corpus gates with their require variables set.Checklist
make testandmake lintpass locally (race suite run over the touched trees and./tests/...)changes/unreleased/<slug>.<section>.md, not as an edit toCHANGELOG.mdmake docs-countsrun if a gate count moved (compliance rows need nothing: the census is counted at docs build)F4,K5) in the body, docs, or changelogLink to Devin session: https://nasa-jpl-demo.devinenterprise.com/sessions/13dea4832ad84ed59b3a7ccea88fdfa3
Open in Devin Desktop: https://nasa-jpl-demo.devinenterprise.com/desktop/session/13dea4832ad84ed59b3a7ccea88fdfa3?variant=devin
Requested by: @HuiJun