Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
90f8402
chore(diagram): open Python API browser stage [skip-slow]
HansBug Jul 20, 2026
57acff0
feat(diagram): add Python API and standalone browser viewer
HansBug Jul 20, 2026
59d83bb
fix(diagram): close browser viewer review gaps
HansBug Jul 20, 2026
4a0448d
fix(jsfcstm): use npm cmd on Windows
HansBug Jul 20, 2026
c98a381
fix(jsfcstm): invoke npm shim through Windows shell
HansBug Jul 20, 2026
22fbcf9
fix(diagram): resolve Windows Node executable correctly
HansBug Jul 20, 2026
8c23499
fix(cli): use UTF-8 for localized help
HansBug Jul 20, 2026
abf08ae
fix(cli): decode Windows smoke output as UTF-8
HansBug Jul 20, 2026
ec3fd13
fix(diagram): avoid dirtying requirements during asset build
HansBug Jul 20, 2026
5b72268
fix(cli): preserve piped Windows help output
HansBug Jul 20, 2026
dbefe82
fix(diagram): keep browser comparison panes usable on short screens
HansBug Jul 20, 2026
8b0b395
test(diagram): fail browser gate on CSP violations
HansBug Jul 20, 2026
5480031
fix(diagram): harden compact viewer gate
HansBug Jul 20, 2026
bc5a189
fix(diagram): honor initial palette and color mode
HansBug Jul 20, 2026
eb78814
fix(diagram): sanitize standalone data and preserve preferences
HansBug Jul 20, 2026
245e769
fix(diagram): escape script line separators
HansBug Jul 20, 2026
4dad5af
fix(diagram): close browser API contract gaps
HansBug Jul 20, 2026
8dca0b8
fix(diagram): 完善导出接口错误处理
HansBug Jul 20, 2026
401dd9d
fix(diagram): close public contract review gaps
HansBug Jul 20, 2026
11edfcf
fix(diagram): polish standalone viewer window and source panel
HansBug Jul 21, 2026
a81078c
fix(diagram): keep transition hover on edge geometry
HansBug Jul 21, 2026
6f00b51
fix(diagram): preserve transition label colors in PDF
HansBug Jul 21, 2026
49c7ea8
chore(deps-dev): bump linkify-it from 5.0.1 to 5.0.2 in /editors/vscode
dependabot[bot] Jul 24, 2026
4fb03b0
chore(deps-dev): bump fast-uri from 3.1.2 to 3.1.4 in /editors/vscode
dependabot[bot] Jul 25, 2026
75d67c6
feat(diagram): close PR-C export ownership and contract gates
HansBug Jul 26, 2026
b880d32
fix(diagram): close review findings on the export and contract gates
HansBug Jul 26, 2026
c58d298
fix(diagram): select the official Chrome build for the browser gate
HansBug Jul 26, 2026
2322913
fix(diagram): wait long enough for DevTools and tighten the new gates
HansBug Jul 26, 2026
1f759d1
Merge pull request #394 from HansBug/dependabot/npm_and_yarn/editors/…
HansBug Jul 26, 2026
66854d5
Merge pull request #396 from HansBug/dependabot/npm_and_yarn/editors/…
HansBug Jul 26, 2026
09c8d43
chore(deps): bump postcss from 8.5.15 to 8.5.23 in /editors/vscode
dependabot[bot] Jul 26, 2026
2b49856
chore(deps): bump dompurify from 3.4.11 to 3.4.12 in /editors/vscode
dependabot[bot] Jul 26, 2026
93d139f
fix(diagram): apply the DevTools startup budget at the call site
HansBug Jul 26, 2026
f292463
Merge pull request #395 from HansBug/dependabot/npm_and_yarn/editors/…
HansBug Jul 26, 2026
7c55327
fix(diagram): let the browser exit before removing its profile
HansBug Jul 26, 2026
0b49aa5
Merge pull request #402 from HansBug/dependabot/npm_and_yarn/editors/…
HansBug Jul 27, 2026
7c3bc9e
fix(diagram): size the standalone viewer layout to its content
HansBug Jul 27, 2026
070b0c0
fix(diagram): style viewer controls under CSP and keep the UI in English
HansBug Jul 27, 2026
be58b09
chore(deps): pin ruff below 0.16 for the lint contract
HansBug Jul 27, 2026
d8c2dcc
fix(diagram): let a document say it has no initial framing preference
HansBug Jul 27, 2026
4ece36c
fix(diagram): keep the viewer chrome accurate at narrow widths
HansBug Jul 27, 2026
fa8d27f
fix(diagram): make the viewer gates able to fail
HansBug Jul 27, 2026
827d128
Merge pull request #404 from HansBug/dev/pin-ruff-below-0-16
HansBug Jul 27, 2026
83d3b07
fix(diagram): close public API footguns found in review
HansBug Jul 27, 2026
a628752
fix(diagram): report failures instead of blaming the user's model
HansBug Jul 27, 2026
a8f356e
fix(diagram): close the remaining gates that could not fail
HansBug Jul 27, 2026
c8f68bc
fix(diagram): keep a viewer alive for the window that opened it
HansBug Jul 27, 2026
faa317e
fix(diagram): reuse one temporary viewer per diagram
HansBug Jul 27, 2026
4defa43
fix(diagram): report a bad input file instead of a traceback
HansBug Jul 27, 2026
e1211f0
fix(diagram): make the docstring examples run
HansBug Jul 27, 2026
159c717
fix(diagram): keep the temporary viewer private, and stop three false…
HansBug Jul 27, 2026
dd21dd9
fix(diagram): give a window's viewer a different name than a reapable…
HansBug Jul 27, 2026
2652dff
fix(diagram): let a large diagram export, and make detail_level mean …
HansBug Jul 27, 2026
03693f1
fix(diagram): reveal the element the user clicked, not one on the sam…
HansBug Jul 27, 2026
bb3b64e
fix(diagram): name the extra that installs the headless runtime
HansBug Jul 27, 2026
ef65976
Merge branch 'main' into dev/python-diagram-api-browser
HansBug Jul 27, 2026
6beae01
docs(diagram): make the package roadmap cover what the package exports
HansBug Jul 27, 2026
776d9ce
fix(diagram): close a umask race and five defects three reviewers found
HansBug Jul 27, 2026
c48cd12
fix(diagram): stop reaping live viewers and close a CSP gate false-green
HansBug Jul 27, 2026
12ccb99
fix(diagram): compare the relay flag, cache the whole document, recor…
HansBug Jul 27, 2026
f4641a5
fix(diagram): keep the SVG when font expansion is what failed
HansBug Jul 27, 2026
5be222f
docs(diagram): document the central class and drop roadmap language
HansBug Jul 27, 2026
0e5a544
fix(diagram): clean up the temporary sibling when a write is interrupted
HansBug Jul 27, 2026
3a85e47
fix(diagram): make the cleanup failure this code swallows actually vi…
HansBug Jul 27, 2026
5ff564e
fix(diagram): stop the umask probe from breaking the write it serves
HansBug Jul 28, 2026
a171ee1
fix(diagram): run the tests that guarded this work, and stop warning …
HansBug Jul 28, 2026
8631422
fix(diagram): close the cross-process reap and make model equality us…
HansBug Jul 28, 2026
47b3441
fix(diagram): keep the shared viewer, and widen the guards that only …
HansBug Jul 28, 2026
75948e4
fix(diagram): pin script-src and style-src by directive, not by subst…
HansBug Jul 28, 2026
7712e4b
fix(diagram): Windows does have a umask, so stop returning a constant…
HansBug Jul 28, 2026
37d9e04
fix(diagram): stop the umask probe cleanup from following a hijacked …
HansBug Jul 28, 2026
a63da62
fix(diagram): remove the last name-based chmod, and stop a flag from …
HansBug Jul 28, 2026
3a4bb0b
fix(diagram): probe the umask with one file that is doomed when it is…
HansBug Jul 28, 2026
26170d7
fix(diagram): align the probe's two failure sides and make its gates …
HansBug Jul 28, 2026
f845b96
fix(diagram): stop the report of a degradation from becoming one
HansBug Jul 28, 2026
1756a05
fix(diagram): order the write before the report instead of swallowing…
HansBug Jul 28, 2026
da90a20
fix(diagram): make the safe reporter observable and cover all four of…
HansBug Jul 28, 2026
6450764
fix(diagram): hold the reporter to its own rules, on both writers
HansBug Jul 28, 2026
72396bc
fix(diagram): report the degradation and the traceback in two writes
HansBug Jul 28, 2026
7c429aa
refactor(diagram): let the temporary file answer what mode the target…
Jul 29, 2026
01dfa55
test(diagram): pin the two mode guarantees a content check cannot see
Jul 29, 2026
27fc0e2
fix(diagram): refuse a read-only target, and close two gaps in the wr…
Jul 29, 2026
bfb12cb
fix(diagram): own the staging file across the call boundary, and stop…
Jul 29, 2026
2fd56e9
fix(diagram): enter the staging file's try before it exists, and let …
HansBug Jul 29, 2026
ced3567
fix(diagram): hold no resource across a nested try, and give each use…
HansBug Jul 29, 2026
17a42d7
fix(diagram): key a window document on the identity the ownership che…
HansBug Jul 29, 2026
ef9f290
fix(diagram): give the viewer-name rule one owner, and gate what the …
HansBug Jul 29, 2026
ef2d4bc
refactor(diagram): wait for the window, then delete the document, and…
HansBug Jul 29, 2026
f97c0b3
fix(diagram): give every shown document a path of its own, and hold n…
HansBug Jul 29, 2026
72d1b7c
fix(diagram): share a viewer name only where nothing removes it, and …
HansBug Jul 29, 2026
c42434b
fix(diagram): keep reuse in the process, not in the file name
HansBug Jul 29, 2026
16ce266
fix(diagram): make the directory the privacy boundary, not the file name
HansBug Jul 29, 2026
b6a0497
fix(diagram): check the private directory on every use, and claim onl…
HansBug Jul 30, 2026
1e20b7d
fix(diagram): reclaim an emptied fallback at exit, and put the platfo…
HansBug Jul 30, 2026
563b4a8
fix(diagram): pin each directory rule on its own, and say when a fall…
HansBug Jul 30, 2026
086765a
fix(diagram): pin the symlink rule and the forgetting, and grade the …
HansBug Jul 30, 2026
28db6e4
test(diagram): set the setgid bit rather than inherit it, which macOS…
HansBug Jul 30, 2026
9b39947
fix(diagram): give each fallback directory an owner, so a fork keeps …
HansBug Jul 30, 2026
12525ba
test(diagram): reproduce the fork precondition instead of assuming it
HansBug Jul 30, 2026
5e67784
fix(diagram): grade both cleanups alike, and put the platform boundar…
HansBug Jul 30, 2026
fdb2c1c
fix(diagram): reclaim in a multiprocessing worker too, and share the …
HansBug Jul 30, 2026
09ff5ba
test(diagram): cover all three multiprocessing start methods, not onl…
HansBug Jul 30, 2026
85a44e7
fix(diagram): reclaim after the workers, and say what a kept viewer r…
HansBug Jul 30, 2026
27aba7d
test(diagram): leave the two new gates no room to pass without testin…
HansBug Jul 30, 2026
d484381
test(diagram): hand the worker its path without a queue, and cover ev…
HansBug Jul 30, 2026
ae248d2
test(diagram): tell a dead worker apart from the defect it looks like
HansBug Jul 30, 2026
2343001
docs(diagram): point the exception references at the module that defi…
HansBug Jul 30, 2026
37ee08f
docs(diagram): make the package's own two tables clickable
HansBug Jul 30, 2026
66721e6
build(diagram): gate the cross-reference class that had no gate
HansBug Jul 30, 2026
18ff065
test(diagram): release the worker from the parent's exit instead of t…
HansBug Jul 30, 2026
eed8e52
fix(diagram): give the worker gate a short root, because macOS caps a…
HansBug Jul 30, 2026
56a60a1
fix(diagram): the gate missed the field kind it arrived to protect
HansBug Jul 30, 2026
186845c
docs(explanations): give the diagram viewer the role it was missing
HansBug Jul 30, 2026
b07121d
fix(diagram): two claims on the new page were wrong, and one rule it …
HansBug Jul 30, 2026
cb92878
fix(diagram): three of last round's corrections were themselves wrong
HansBug Jul 30, 2026
57e4b3e
build(diagram): the intersphinx guard missed the forms that actually …
HansBug Jul 30, 2026
b028c88
fix(diagram): stop defending a rule I could not guard, and fix a clai…
HansBug Jul 30, 2026
6c7b32c
fix(diagram): make the message actionable, and make the backstop real
HansBug Jul 30, 2026
ebee960
revert(diagram): drop the two reference checkers, which were not this…
HansBug Jul 30, 2026
8a4f465
ci(lint): enforce ruff and generated API RST on every push
HansBug Jul 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,32 @@ jobs:
shell: bash
run: |
make DIAGRAM_REFERENCE="$DIAGRAM_REFERENCE" diagram_assets_verify
- name: Provision Chromium for the browser export gate
if: ${{ matrix.python-version == '3.11' }}
shell: bash
run: |
set -euo pipefail
# Only the official Chrome package is accepted here. The runner's
# /usr/bin/chromium is the snap wrapper, which cannot open a
# DevTools endpoint under Actions confinement.
for candidate in google-chrome google-chrome-stable; do
if command -v "$candidate" >/dev/null 2>&1; then
echo "CHROME_BIN=$(command -v "$candidate")" >> "$GITHUB_ENV"
exit 0
fi
done
curl -fsSL -o "$RUNNER_TEMP/google-chrome.deb" \
https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt-get install -y "$RUNNER_TEMP/google-chrome.deb"
command -v google-chrome >/dev/null
echo "CHROME_BIN=$(command -v google-chrome)" >> "$GITHUB_ENV"
- name: Run standalone browser export gate
if: ${{ matrix.python-version == '3.11' }}
env:
CI: 'true'
shell: bash
run: |
make diagram_browser_check

template_suite_gate:
name: template-suite-gate
Expand Down Expand Up @@ -1412,3 +1438,51 @@ jobs:
flags: jsfcstm
name: codecov-jsfcstm
fail_ci_if_error: false

lint:
# ``ruff`` and the generated API RST were gates that existed only as lines
# in a plan for a human to run, which is how a gate stops being one: the
# generated RST turned out to be current only because someone regenerated
# it by hand to find out. Both are seconds of work, so they run on every
# push and name the commit that introduced the drift.
#
# The paths are narrow on purpose. ``ruff check`` over the whole package
# reports 941 pre-existing findings and ``ruff format`` would rewrite 66
# files, so a repository-wide gate could only be added by first paying off
# that debt. Widen these lists when a tree is cleaned up, rather than
# relaxing the rules to fit one.
name: Lint and generated RST
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3.3.0
with:
fetch-depth: 20
submodules: 'recursive'
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install lint and runtime dependencies
shell: bash
run: |
python -m pip install --upgrade pip
# Read the pin out of requirements-dev.txt so the ruff version
# contract keeps living in exactly one place. The rest of that file
# is LLM/image tooling this job has no use for.
python -m pip install "$(grep -E '^ruff' requirements-dev.txt)"
python -m pip install -r requirements.txt
- name: Lint the diagram surface
shell: bash
run: |
ruff check pyfcstm/diagram pyfcstm/model/model.py \
pyfcstm/model/imports.py pyfcstm/bmc/domain.py test/diagram
ruff format --check pyfcstm/diagram test/diagram
- name: Check the generated API RST is current
shell: bash
run: |
make rst_auto
# ``rst_auto`` is generation, so a clean tree afterwards is the whole
# assertion: a public signature that moved without its RST being
# regenerated shows up here as a diff.
git diff --exit-code
75 changes: 75 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,59 @@ Applies to all code in [pyfcstm/](pyfcstm/), [editors/jsfcstm/src/](editors/jsfc
[editors/jsfcstm/src/dsl/grammar/](editors/jsfcstm/src/dsl/grammar/))
are exempt — they are produced by ANTLR.

## Code Review Scope (findings must be reachable through the public surface)

A code-review finding about this repository's behaviour must describe a failure a
real user can reach through a documented entry point, used the way the
documentation says to use it. Anything else is not a finding, however true it is
about the internals.

**In scope.** The public Python API and the CLI, called normally:

- `StateMachine.diagram()`, `Diagram.to_dict` / `to_json` / `to_html` / `save` /
`show` / `with_options` / `with_view_state`, and the equivalents on other
modules' public surfaces.
- `pyfcstm generate` / `simulate` / `bmc` / `plantuml` / `inspect` / `diagram`
with the argument combinations their `--help` documents.
- Ordinary environmental failures a user actually meets on those paths: Ctrl-C
part-way through, a destination directory that does not exist or is not
writable, a full disk, a missing optional dependency, a common umask, a shared
temporary directory, a second user on the same machine, a supported Python
version, a supported platform.

**Out of scope.** A defect that exists only in a path constructed for the purpose
is not reported:

- Calling a private helper directly to reach a state the public API cannot
produce.
- Patching production internals to create a state the public API cannot produce.
- Injecting a failure into an internal call site — a `logging.Handler` that
raises, a broken `sys.stderr`, an argument whose `__str__` raises, a forced
`os.fstat` / `os.fchmod` / `unlink` error, a synthesised `EDQUOT`.
- Faking a platform constant, or forcing a branch that does not exist on the
platform under test.
- Races that need preemption between adjacent bytecodes, or a hard link or
symlink swapped in at a freshly generated random name.
- Branches that need two or more independent failures at once.

**Instruments are not findings.** The exclusions above are about what may be
*reported*, not about how a property may be *tested*. A test may drive a private
helper, inject an interrupt at every line, or fake an identity, provided the
property it pins is one the public surface exposes: `save()` being interrupted is
an ordinary user event, so a line-granularity probe over the private writer is a
legitimate way to gate it.

**The question to answer before reporting.** "A user who only reads the public
documentation and runs the documented commands — how do they arrive here?" If that
has no answer, the finding is not one. Reporting "nothing found on normal paths,
and here is what I checked" is the correct outcome in that case, and is more useful
than a list of unreachable branches.

This section governs correctness reviews of this repository's own code. It does
not narrow security review of untrusted *input* — a malicious `.fcstm` source, a
hostile template, or a crafted `.fbmcq` query arrives through a public entry point
and is therefore in scope by the rule above, not excluded by it.

## Conversation Language

Reply in whatever language the user wrote their most recent message in. Do not default to English on your own. If the user writes in Chinese, reply in Chinese; if the user writes in English, reply in English; if the user mixes languages, mirror their dominant language and keep technical terms in their original form. When the user switches languages mid-conversation, switch with them on the very next turn — do not keep using the previous language.
Expand Down Expand Up @@ -303,6 +356,9 @@ pyfcstm simulate -i input.fcstm -e "cycle; cycle Start; current" # Batch mod
pyfcstm simulate -i input.fcstm -e "init System.Active counter=10; cycle 5" # Hot start batch
pyfcstm bmc -i input.fcstm -q property.fbmcq # Human BMC report
pyfcstm bmc -i input.fcstm -q property.fbmcq --json -o result.json # Stable JSON result
pyfcstm diagram -i input.fcstm # Portable JSON on stdout
pyfcstm diagram -i input.fcstm -o viewer.html # Self-contained HTML viewer
pyfcstm diagram -i input.fcstm --open # Viewer in an app window

# Interactive hot start:
# > init System.Active counter=10 flag=1
Expand Down Expand Up @@ -493,10 +549,29 @@ Mandatory completion rule for built-in template work:
- Requires every SAT model to decode into a public macro-step trace and pass `SimulationRuntime` replay before the CLI reports a trusted verdict
- Keeps bounded conclusions explicit: SAT/UNSAT describe the solver objective, while `property_satisfied` / `outcome` describe whether the user property holds within the requested bound

**Diagram Views** ([pyfcstm/diagram/](pyfcstm/diagram/))

- `StateMachine.diagram()` returns a `Diagram`: an immutable snapshot detached from the model, so later edits to the
model cannot change what a saved view shows
- `to_dict()` / `to_json()` give portable data; `to_html()` gives a self-contained ~29 MB viewer with the jsfcstm
renderer, ELK layout, resvg WASM rasteriser and CJK fonts embedded, under a strict inline CSP and no network access
- `with_options()` / `with_view_state()` return new snapshots rather than mutating; `show()` opens the viewer in a
Chromium-family app window
- Runtime assets under [pyfcstm/diagram/assets/](pyfcstm/diagram/assets/) are build products, not tracked sources.
`make build_assets` produces them and `make unittest` depends on it, in the same way `make tpl` produces the packaged
template assets
- The gates are `make diagram_assets_check`, `diagram_csp_check`, `diagram_contract_check`, `diagram_browser_check`
and `diagram_docstring_check`; each one must be able to fail, so mutation-test a gate before trusting it
- A reST cross-reference must name the module that `docs/source/api_doc` documents the object under, which is the
implementation module: `pyfcstm.diagram.api.Diagram`, not `pyfcstm.diagram.Diagram`. A wrong one renders as plain
text without any complaint from an ordinary Sphinx build. There is no automated gate for this; a build with `-n`
reports it, along with some 1700 pre-existing warnings elsewhere in the tree

**Entry Points** ([pyfcstm/entry/](pyfcstm/entry/))

- [cli.py](pyfcstm/entry/cli.py): Click-based CLI; `pyfcstmcli()` registered as console script
- [plantuml.py](pyfcstm/entry/plantuml.py): PlantUML diagram generation from state machine models
- [diagram.py](pyfcstm/entry/diagram.py): `pyfcstm diagram` — portable JSON or a self-contained HTML viewer
- [generate.py](pyfcstm/entry/generate.py): Orchestrates parsing DSL, building model, and rendering with either `--template-dir` or built-in `--template`
- [dispatch.py](pyfcstm/entry/dispatch.py): Command dispatching logic for CLI subcommands
- [simulate/](pyfcstm/entry/simulate/): Interactive simulation REPL (sub-package) with
Expand Down
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ recursive-include pyfcstm/template *.zip *.json
recursive-include pyfcstm/dsl *.g4 *.interp *.tokens
recursive-include pyfcstm/bmc/grammar *.g4 *.interp *.tokens
recursive-include pyfcstm/llm *.md *.sha256
recursive-include pyfcstm/diagram/assets *.md *.js *.wasm *.json *.txt *.ttf *.otf
recursive-include pyfcstm/diagram/assets *.md *.js *.css *.wasm *.json *.txt *.ttf *.otf
prune pyfcstm/assets
prune pyfcstm/diagram_runtime
include pyfcstm/diagram/assets/NOTICE.txt
include pyfcstm/diagram/assets/LICENSE-MPL-2.0.txt
include pyfcstm/diagram/assets/LICENSE-EPL-2.0.txt
include pyfcstm/diagram/assets/LICENSE-OFL-1.1.txt
include pyfcstm/diagram/assets/LICENSE-MIT.txt
42 changes: 39 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: docs docs_en docs_zh docs_pdf docs_pdf_en docs_pdf_zh test unittest template_unittest resource antlr antlr_build fcstm_antlr_build fbmcq_antlr_build build build_info build_info_cli package clean build_assets build_assets_clean diagram_assets_check diagram_rendering_check diagram_parity_check diagram_reference_check diagram_engine_floor diagram_provenance_check diagram_assets_verify diagram_package_check diagram_corpus docs_auto todos_auto tests_auto rst_auto sha256 jsfcstm jsfcstm_clean vscode vscode_clean vscode_install vscode_uninstall logos logos_clean app_icons app_icons_clean help tpl tpl_clean templates_package template_packaging_check template_source_install_check docs_terminology_check test_boundary_check
.PHONY: docs docs_en docs_zh docs_pdf docs_pdf_en docs_pdf_zh test unittest template_unittest resource antlr antlr_build fcstm_antlr_build fbmcq_antlr_build build build_info build_info_cli package clean build_assets build_assets_clean diagram_assets_check diagram_rendering_check diagram_browser_check diagram_contract_check diagram_data_check diagram_options_check diagram_csp_check diagram_parity_check diagram_reference_check diagram_engine_floor diagram_provenance_check diagram_assets_verify diagram_package_check diagram_corpus docs_auto todos_auto tests_auto rst_auto sha256 jsfcstm jsfcstm_clean vscode vscode_clean vscode_install vscode_uninstall logos logos_clean app_icons app_icons_clean help tpl tpl_clean templates_package template_packaging_check template_source_install_check docs_terminology_check test_boundary_check

PYTHON := $(shell which python)

Expand Down Expand Up @@ -93,7 +93,12 @@ help:
@echo " make build_info - Generate build identity for a package or CLI build"
@echo " make build_assets - Build ignored Python diagram JS/WASM/font assets"
@echo " make diagram_assets_check - Build and validate diagram assets and ignore rules"
@echo " make diagram_assets_verify - Run provenance, runtime, and visual asset gates"
@echo " make diagram_browser_check - Run representative offline Chrome export gate"
@echo " make diagram_contract_check - Verify the public snapshot and portable data contract"
@echo " make diagram_data_check - Verify parsed, imported and programmatic data parity"
@echo " make diagram_options_check - Verify option and view-state mapping parity"
@echo " make diagram_csp_check - Verify the standalone HTML policy and embedded resources"
@echo " make diagram_assets_verify - Run provenance, runtime, contract, and visual asset gates"
@echo " make diagram_parity_check DIAGRAM_REFERENCE=/abs/path/reference.json"
@echo " make diagram_reference_check - Verify reference archive retry behavior"
@echo " make diagram_corpus - Rebuild checked-in DiagramData rendering oracles"
Expand Down Expand Up @@ -244,6 +249,37 @@ diagram_assets_check: build_assets
$(PYTHON) tools/build_diagram_assets.py --check
$(PYTHON) tools/check_diagram_assets.py

diagram_browser_check: build_assets
@if test -n "$(DIAGRAM_HTML)"; then \
node tools/diagram_assets/check_viewer_browser.js "$(DIAGRAM_HTML)" "$(DIAGRAM_SCREENSHOT)"; \
else \
$(PYTHON) tools/check_diagram_browser_exports.py --all-cases --formats svg,png,pdf --pdf-require-zero-images --pdf-page-size-match --pdf-rerender; \
fi

diagram_contract_check: build_assets
$(PYTHON) tools/check_diagram_contract.py

diagram_data_check: build_assets
$(PYTHON) tools/check_diagram_data_parity.py

diagram_options_check: build_assets
$(PYTHON) tools/check_diagram_options_parity.py

diagram_csp_check: build_assets
$(PYTHON) tools/check_diagram_csp.py --check
$(PYTHON) tools/check_diagram_csp.py \
--require-default-none --require-connect-none --require-worker-none \
--require-script-hashes --require-style-hashes --require-style-nonce \
--require-wasm-unsafe-eval --forbid-unsafe-eval \
--require-no-fallback-directives \
--require-font-data --require-img-data-blob \
--forbid-eval --forbid-new-function --zero-network \
--require-embedded-fonts 5 --require-fonts-ready

diagram_docstring_check: build_assets
$(PYTHON) tools/check_diagram_docstring_examples.py --check
$(PYTHON) tools/check_diagram_docstring_examples.py

diagram_rendering_check: build_assets
$(PYTHON) tools/check_diagram_rendering.py --check
$(PYTHON) tools/check_diagram_rendering.py \
Expand Down Expand Up @@ -278,7 +314,7 @@ diagram_provenance_check:
diagram_reference_check:
$(PYTHON) tools/fetch_diagram_reference.py --check

diagram_assets_verify: diagram_assets_check diagram_rendering_check diagram_parity_check diagram_engine_floor diagram_provenance_check diagram_reference_check
diagram_assets_verify: diagram_assets_check diagram_docstring_check diagram_rendering_check diagram_contract_check diagram_data_check diagram_options_check diagram_csp_check diagram_parity_check diagram_engine_floor diagram_provenance_check diagram_reference_check

diagram_package_check: package

Expand Down
40 changes: 40 additions & 0 deletions docs/source/api_doc/diagram/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
pyfcstm.diagram.api
========================================================

.. currentmodule:: pyfcstm.diagram.api

.. automodule:: pyfcstm.diagram.api


\_\_all\_\_
-----------------------------------------------------

.. autodata:: __all__


DiagramOptions
-----------------------------------------------------

.. autoclass:: DiagramOptions
:members: __post_init__,to_dict,detail_level,direction,palette,mode,cjk_locale


DiagramViewState
-----------------------------------------------------

.. autoclass:: DiagramViewState
:members: __post_init__,to_dict,mode,collapsed_state_ids,zoom,pan_x,pan_y


DiagramData
-----------------------------------------------------

.. autoclass:: DiagramData
:members: __post_init__,__eq__,__hash__,to_dict,to_json,value


Diagram
-----------------------------------------------------

.. autoclass:: Diagram
:members: __init__,__setattr__,__delattr__,to_dict,to_json,with_options,with_view_state,to_svg,to_png,to_pdf,to_html,save,show
18 changes: 18 additions & 0 deletions docs/source/api_doc/diagram/engine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ pyfcstm.diagram.engine
.. automodule:: pyfcstm.diagram.engine


DiagramError
-----------------------------------------------------

.. autoclass:: DiagramError


DiagramUnavailableError
-----------------------------------------------------

.. autoclass:: DiagramUnavailableError


DiagramAssetError
-----------------------------------------------------

Expand All @@ -30,6 +42,12 @@ DiagramEngineConflictError
.. autoclass:: DiagramEngineConflictError


DiagramEngineLoadError
-----------------------------------------------------

.. autoclass:: DiagramEngineLoadError


DiagramAssetEngine
-----------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions docs/source/api_doc/diagram/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ pyfcstm.diagram
.. toctree::
:maxdepth: 3

api
assets/index
engine

Expand Down
18 changes: 18 additions & 0 deletions docs/source/api_doc/entry/diagram.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
pyfcstm.entry.diagram
========================================================

.. currentmodule:: pyfcstm.entry.diagram

.. automodule:: pyfcstm.entry.diagram


\_\_all\_\_
-----------------------------------------------------

.. autodata:: __all__


diagram\_command
-----------------------------------------------------

.. autofunction:: diagram_command
1 change: 1 addition & 0 deletions docs/source/api_doc/entry/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ pyfcstm.entry
base
bmc
cli
diagram
dispatch
generate
inspect
Expand Down
Loading
Loading