Skip to content

Add XSD visual viewer and drop dagre dependency to fix build#84

Merged
rg4444 merged 2 commits into
mainfrom
codex/add-xsd-visual-editor-for-processgit-tun2lg
Feb 5, 2026
Merged

Add XSD visual viewer and drop dagre dependency to fix build#84
rg4444 merged 2 commits into
mainfrom
codex/add-xsd-visual-editor-for-processgit-tun2lg

Conversation

@rg4444
Copy link
Copy Markdown
Contributor

@rg4444 rg4444 commented Feb 5, 2026

Motivation

  • Provide an interactive XSD viewer that renders .xsd files as a diagram and supports light-weight edits/exports and raw toggle via the ProcessGit viewer frame.
  • Resolve the Docker/CI build failure caused by adding the dagre dependency which made pnpm-lock.yaml differ from package.json under a frozen-lockfile policy.
  • Allow in-iframe viewers to stage content before committing by enabling the PGV_SET_CONTENT/PGV_REQUEST_SAVE flow.

Description

  • Add a new XSD visual feature under web_src/js/features/xsdvisual/ including index.ts, parse.ts, graph.ts, render.ts, ui.ts, editor.ts, serialize.ts, and types.ts to implement parsing, graph model, rendering, UI, editor operations and serialization.
  • Register the viewer with web_src/js/index-domready.ts, add a template templates/repo/view_file_xsd_visual.tmpl, and wire routing/payload generation in routers/web/repo/view_file.go by introducing xsdVisualPayload and setting IsXSDVisual/XSDVisualPayload for .xsd files.
  • Replace the previous dagre-based layout with a deterministic column/row layout implemented in web_src/js/features/xsdvisual/graph.ts, and remove dagre from package.json as well as its module shim in types.d.ts to avoid lockfile mismatch.
  • Improve web_src/js/features/processgitviewer/index.ts to buffer pending content with a pendingContent map, handle PGV_SET_CONTENT messages, and use buffered content when processing PGV_REQUEST_SAVE.

Testing

  • Attempted an automated Playwright script to load http://127.0.0.1:3000 and capture a screenshot, but it failed with net::ERR_EMPTY_RESPONSE because the local server was not running (failed).
  • No CI build was executed locally; the dagre removal was chosen to avoid the pnpm frozen-lockfile error rather than bumping pnpm-lock.yaml (no build attempted after the change).
  • No unit tests or bundler runs were performed in this rollout.

Codex Task

@rg4444 rg4444 merged commit ab2c553 into main Feb 5, 2026
4 checks passed
@chatgpt-codex-connector
Copy link
Copy Markdown

💡 Codex Review

doc.simpleTypes.forEach((simpleType) => appendSimpleType(xmlDoc, schema, simpleType.name, simpleType.annotation));
doc.types.forEach((type) => appendComplexType(xmlDoc, schema, type));
doc.elements.forEach((element) => appendElement(xmlDoc, schema, element));

P2 Badge Preserve schema includes/imports when serializing

The serializer only writes simpleTypes, types, and elements into the new xs:schema, so any <xs:include>, <xs:import>, or schema-level <xs:annotation> parsed into doc are silently dropped. If a user opens an XSD that relies on imports/includes and then saves from the visual editor, the file will be rewritten without those declarations, breaking namespace references or type resolution. Consider emitting doc.includes, doc.imports, and doc.annotations before the type/element lists so round-tripping doesn't lose schema-level metadata.


if (elementDecl.children && elementDecl.children.length > 0) {
const inlineType = doc.createElementNS(SCHEMA_NS, 'xs:complexType');
appendSequence(doc, inlineType, elementDecl.children);
element.append(inlineType);

P2 Badge Do not force inline complex types into sequences

appendElement always serializes inline complex types with appendSequence, but parseXsd stores inline xs:choice children in the same elementDecl.children array. This means any element that originally used <xs:choice> will be rewritten as <xs:sequence> on save, changing schema semantics (e.g., mutually exclusive children become ordered). Track whether inline children came from a sequence or choice and serialize accordingly.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant