fix(migrate): embed DocGen table images, default viewpoint-less views, place anchored paragraphs - #612
Open
devin-ai-integration[bot] wants to merge 4 commits into
Conversation
…, place anchored paragraphs An Image step drawing a Cameo table diagram now writes a Table over the table definition's own row query instead of a Diagram of the view rendered asElementTable; a definition without a query form is refused where the figure would be. A view conforming to no viewpoint follows MDK's DocumentGenerator.parseView default: its documentation, then the figure or table of each exposed diagram in order. Collaborator paragraphs following nothing open the section before the method's content, and paragraphs anchored to a DiagramMainImage follow the figure the section drew for that diagram, the report saying why when the anchor cannot be placed. 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)".
|
…nstead of defaulting Only a view with no Conform gets DocGen's default behavior, as in MDK's DocumentGenerator.parseView; a Conform whose general resolves to nothing is refused with the reason and draws none of the exposed diagrams. Co-Authored-By: jason.han <hanhuijun@gmail.com>
Co-Authored-By: jason.han <hanhuijun@gmail.com>
…gh the view usage Co-Authored-By: jason.han <hanhuijun@gmail.com>
This branch has not been deployed
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
Three DocGen fidelity defects, measured by comparing our render of a Cameo project's Detailed Design Document with the Cameo-generated PDF. All three are generic DocGen semantics; none of the fixes is project-specific.
An
Imageof a Cameo table embedded the view, not the table.chain.imageplanned aDiagramof the view for every collected diagram, so a table diagram (whose view is renderedasElementTable) came out as an Element / Kind / Type / Declared-in listing of every member of the exposed package — 206 of the 343 pages of the sample document. The table definition itself had been lowered correctly to a… Rowsquery plus a standalone… Document, but the document never referenced it. Now a section that draws a diagram with a written table definition (m.tableOf/view.tables) holds aDocumentQueries::Tableover that same query: the query is written once beside the definition's view, andtableFigureshares the body writer with the standaloneDocument(writeTable→tableDoc/tableFigure), so nothing is lowered twice. The caption is the step'stitleswhen present, else the diagram's name; tables number among the tables, figures among the figures (-doc-number-figuresalready counted them apart). A definition with no query form is refused where the figure would stand, with the reason, instead of drawn as the listing — a listing of the view's elements is not the table. The step's report row says… is written as a Table over the query '…'.A view conforming to no viewpoint printed only its documentation.
planMethodreturned when there was no method. MDK'sDocumentGenerator.parseViewapplies a default instead: a view that is itself a diagram shows its own image; any other shows its documentation, then, for each element it exposes, in order, an image of a diagram (a table for a table diagram) and nothing for anything else.defaultViewimplements exactly that, sharingfigure/tableFigurewith theImagestep andviewDocumentationfor the text; the view's report row states that the default applied and what it drew and skipped. Only the absence of a «Conform» triggers it, as inparseView(which reads that relationship alone, not the «View» stereotype'sviewpointtag): the reader now setsDocGenView.ConformMalformedfor a «Conform» whosegeneralresolves to nothing, and such a view is refused with that reason rather than given default figures. Views conforming to a viewpoint whose method is malformed keep their refusal; child views that satisfy a viewpoint and expose nothing still print as empty headings.Collaborator paragraphs were appended after the method's content whatever their anchors.
sysmlv1.DocGenParagraphnow carriesPredecessor(the rawsiblingId/parentIdtag) andAnchor(Kind,Target) parsed from theContainment_<Kind>__<id>form, andmigrateplaces them: a paragraph following nothing opens the section before the generated content, as Cameo prints it; one anchored to aDiagramMainImagefollows the figure, table or refusal the section drew for that diagram (sectionPlan.figuresmarks where each diagram's figure ends, andinsertmoves the marks along); its followers come after it. When the anchor names no diagram of the model — the ids are Collaborator publish-time ids, which match noxmi:idin the sample project — and the section draws exactly one figure, the paragraph follows that figure and its row says so; when the anchor cannot be placed (another anchor kind, a tag naming nothing, a section drawing several figures with several unresolved anchors) the paragraph follows the content and its row says why. No anchor kind is guessed: onlyDiagramMainImageis placed, the rest are refused by name.Intentional golden changes: in
documents.golden.sysmlthe refusal comment of a malformed collaborator paragraph that follows nothing moves before the section's table, since a paragraph following nothing now precedes the generated content; and theNotesview, whose «Conform» names_vp_gone, now carries a refusal comment and its own unmapped report row (the note used to sit on the document's row).The PDF-toolchain CI job now also runs
./tests/migrate, where the new fixture is rendered as PDF.Specification basis
MDK DocGen:
DocumentGenerator.parseView(Open-MBEE/mdk,src/main/java/org/openmbee/mdk/generator/DocumentGenerator.java) — the no-viewpoint default and theImagestep's handling of table diagrams; MDK Collaborator paragraphs'siblingId/parentIdanchors. The migration is not a spec-compliance surface; no row indocs/project/spec-compliance.mdmoves.How it was verified
tests/migrate/testdata/xmi/table_figures.xmi(a document whose viewImages a generic table, a refused table, a viewpoint-less view exposing a table diagram, a plain diagram and a block with documentation, and collaborator paragraphs anchored before the content, on aDiagramMainImage, and on a refused figure) withtests/migrate/table_figures_test.go: the embeddedTableshares the standaloneDocument's query, the refusal, the default view's order, the paragraph order, and HTML and PDF renders of the fixture document showing the table's columns and rows and noElement Kind Type Declared inheader.internal/translate/xmi/sysmlv1/docgen_test.gocovers the raw predecessor chain, the anchor classification and an unsupported anchor kind;internal/translate/migrate/paragraph_placement_internal_test.gocovers grouping and the insertion arithmetic of the figure marks.go build ./... && go vet ./... && gofmt -l . && go test ./...clean; corpus gates withOPENSYSML_REQUIRE_TRAINING_CORPUS=1 OPENSYSML_REQUIRE_PILOT_CORPORA=1 OPENSYSML_REQUIRE_PSSM_SUITE=1clean;OPENSYSML_REQUIRE_PDF_TOOLCHAIN=1 go test ./tests/migraterenders the fixture PDF.-validate: no errors on both.-compare-results … -seed 1: the results are identical line for line (the migration-results JSON is byte-identical; the only diagnostic lines that differ are pre-existing "Duplicate of inherited member name" warnings re-listing the sections'diagram N/table Nmembers, 2978 → 2975).-render-documents: 103 documents written on both.Element Kind Type Declared inheader 206 → 0. The 9 results/lookup sections printTable 3–Table 12with the same columns and cell values as their standalone… Documentrenders (Post-Segment Exchange: 45 rows,tFinal4962 / 5029 present, table rows byte-identical to the standalone document's). Section 3 printsTable 1. Table of L2 APS Requirements: KeyandTable 2. … Drivingbetween its paragraph and 3.1; 3.1/3.2 stay empty headings. 4.3.1.4 reads paragraph → Figure 4 → paragraph.Containment_DiagramMainImage__<id>anchor whose id names no diagram of the model. 25 (in 24 sections) are placed after their section's only figure; 50 sit in 20 sections drawing 2–5 figures and follow the content, each row naming the anchor and the figure count. Zero paragraphs are placed by an exact diagram id, since the project carries none.Imagesteps whose row now says which query the Table is over (mapped → approximated, since the table's own lowering carries column notes), plus 35 of the 216 rows of theDump Diagramviewpoint's sharedImagestep re-verdicted the same way; 2 new rows for the default-view tables of the viewpoint-less section; the collaborator paragraphs' rows now carry their placement notes; 2 tables whose definition has no query form are now refused where the figure would be (mapped → unmapped).->size(),.oclAsType(...)) and stereotype-tag columns are still omitted from the tables' columns with a note; a 19-column table overflows the landscape page in the PDF backend (the standalone document renders the same), which is a renderer layout matter separate from these fixes.Before / after (develop build vs this branch)
Section 3 — Key and Driving Requirements (before: paragraph then empty subsections; after: Table 1 / Table 2 between them):
4.3.1.4 Use Case Activity (before: figure → paragraph → paragraph; after: paragraph → figure → paragraph):
4.3.1.5 Time to Execute (before: the element listing; after: Table 3 with the timing analysis rows):
Checklist
make testandmake lintpass locallychanges/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 changelog