Skip to content

feat(encode): add parity helpers#1597

Open
lmeyerov wants to merge 9 commits into
masterfrom
codex/issue-1253-encode-parity
Open

feat(encode): add parity helpers#1597
lmeyerov wants to merge 9 commits into
masterfrom
codex/issue-1253-encode-parity

Conversation

@lmeyerov
Copy link
Copy Markdown
Contributor

@lmeyerov lmeyerov commented May 21, 2026

Summary

  • Add direct public encode helpers for edge size/weight plus point/edge opacity, label, and title.
  • Add GFQL call() safelist/runtime/type parity for the new encode entry points.
  • Extend apply_encodings() key introspection and schema artifacts without adding unsupported React component props; label/title helpers are raw column binding only because Graphistry upload rejects label/title complex encodings.
  • Add anchored validator and direct serialization coverage.

Closes #1253

New Encode Entry Points

  • encode_edge_size: maps edge column values to size encodings with numeric categorical/default mappings.
  • encode_edge_weight: maps edge column values to weight encodings with numeric categorical/default mappings.
  • encode_point_opacity: maps node column values to opacity encodings with numeric categorical/default mappings.
  • encode_edge_opacity: maps edge column values to opacity encodings with numeric categorical/default mappings.
  • encode_point_label: raw-binds the node label column; categorical/default mappings are rejected before complex encoding creation.
  • encode_edge_label: raw-binds the edge label column; categorical/default mappings are rejected before complex encoding creation.
  • encode_point_title: raw-binds the node title column; categorical/default mappings are rejected before complex encoding creation.
  • encode_edge_title: raw-binds the edge title column; categorical/default mappings are rejected before complex encoding creation.

Validator-Error Samples

  • encode_edge_size: Invalid value for parameter 'categorical_mapping' in 'encode_edge_size': categorical_mapping['admin'] must be a number
  • encode_edge_weight: Invalid value for parameter 'categorical_mapping' in 'encode_edge_weight': categorical_mapping['admin'] must be a number
  • encode_point_opacity: Invalid value for parameter 'categorical_mapping' in 'encode_point_opacity': categorical_mapping['admin'] must be a number
  • encode_edge_opacity: Invalid value for parameter 'categorical_mapping' in 'encode_edge_opacity': categorical_mapping['admin'] must be a number
  • encode_point_label: encode_point_label supports raw column binding only; categorical_mapping/default_mapping would create label/title complex encodings that Graphistry upload rejects
  • encode_edge_label: encode_edge_label supports raw column binding only; categorical_mapping/default_mapping would create label/title complex encodings that Graphistry upload rejects
  • encode_point_title: encode_point_title supports raw column binding only; categorical_mapping/default_mapping would create label/title complex encodings that Graphistry upload rejects
  • encode_edge_title: encode_edge_title supports raw column binding only; categorical_mapping/default_mapping would create label/title complex encodings that Graphistry upload rejects
  • apply_encodings({"encodePointLabel": ["role", {"admin": "Admin"}]}): React text binding payload supports only [column]; label/title categorical mappings are not supported

LOC Buckets

  • Production: +389 / -53, net +336 LOC
  • Tests: +227 / -0, net +227 LOC
  • Changelog/schema artifacts: +12 / -3, net +9 LOC

Compatibility / Planner Surface

  • Compiler-plan surface touched: no. This is public API, GFQL call validation/type parity, apply-encodings contract, and schema artifact work only.
  • Public viz payload compatibility: this PR does not add label/title complex payload support because current Graphistry upload rejects Label/Title complex encoding names. The new label/title helpers bind raw columns only.
  • React/component compatibility: audited /home/lmeyerov/Work/graphistry-js/projects/client-api-react/src/bindings.js; the React component exposes only the existing encodePointSize, point/edge color, axis, and point/edge icon props, so this PR does not add the new helpers to REACT_SETTING_NAMES / KnownReactSettingsDict. New keys are scoped to pygraphistry public helpers, GFQL call(), and apply_encodings() introspection.
  • Frontend contract version: kept GRAPHISTRY_FRONTEND_CONTRACT_VERSION = 1; no server-facing or React component prop contract bump. The version-1 signature was refreshed for the compatible apply_encodings introspection key additions.
  • Cross-lib consumer audit: these helpers are pygraphistry-surface parity, not a claim of end-to-end renderer parity for every target. Local findings are under plans/issue-1253-encode-parity/findings/:
    • encode_edge_size: upload accepts Size; pygraphistry serializes categorical mapping, but core viz has an edgeSize branch that does not currently consume mapping.categorical for edge size.
    • encode_edge_weight: upload accepts Weight; pygraphistry + forge ETL have edge-weight mapping paths, while core viz currently skips weight server-side interpretation.
    • encode_point_opacity / encode_edge_opacity: upload accepts Opacity; core viz treats opacity primarily as scalar settings and skips opacity server-side interpretation.
    • encode_point_label / encode_edge_label / encode_point_title / encode_edge_title: upload rejects Label/Title complex names, so this PR keeps these as raw column binding helpers and rejects mapping/default payloads.
  • JSON Schema exporter/checker passes: python3 -m graphistry.devschemas.export --check.

Validation

  • python3 -m pytest -q graphistry/tests/test_plotter.py -k "encode_parity or apply_encodings or label_complex" -> 11 passed, 66 deselected
  • python3 -m pytest -q graphistry/tests/compute/test_call_operations.py -k "encode" -> 10 passed, 16 deselected
  • python3 -m pytest -q graphistry/tests/test_dataset_id_invalidation.py -k "encoding_method_invalidates_dataset_id" -> 16 passed, 17 deselected
  • python3 -m pytest -q graphistry/tests/compute/test_gfql_call_validation.py -k "encode_parity" -> 12 passed, 62 deselected
  • python3 -m pytest -q graphistry/tests/test_schema_artifacts.py graphistry/tests/test_viz_settings.py graphistry/tests/test_validate_settings.py -> 28 passed
  • python3 -m pytest -q graphistry/tests/ -k "encode" -> 87 passed, 6 skipped, 5053 deselected
  • ./bin/ruff.sh [touched python files] -> passed
  • ./bin/typecheck.sh [touched production python files] -> passed
  • python3 -m graphistry.devschemas.export --check -> passed
  • git diff --check origin/master -> passed
  • Rebased onto origin/master @ 991c2dfcc44823e8cfeaf3d6653c7237e67a464e after master moved ahead; no conflicts.
  • Review skill Waves 8-9 after current-master and CI verification -> converged, 0 BLOCKER/IMPORTANT findings before the DRY reduction.
  • Review skill Waves 12-13 after py3.8 mypy fix -> converged, 0 BLOCKER/IMPORTANT findings.
  • Review skill Waves 14-15 after final DRY alias cleanup -> converged, 0 BLOCKER/IMPORTANT findings.
  • Reviewer follow-up validation for formatting, generic GFQL params, stable contract version, and client-api-react audit -> passed.
  • Review skill Waves 18-19 after mapped-property rename and latest rebase -> converged, 0 BLOCKER/IMPORTANT findings.
  • Second LOC reduction pass removed unnecessary facade type-alias re-exports and folded duplicate tests: +9 / -59, net -50 LOC vs the prior pushed head.
  • Review skill Waves 20-21 after second LOC reduction and latest rebase -> converged, 0 BLOCKER/IMPORTANT findings.
  • Full PR CI is green on rebased/reduced head 5c010060dd4a08584b37343a725522117eb3f1ba / run 26272586189, including changed-line coverage, schema artifacts, tck-gfql, full matrix, CodeQL, and Read the Docs.

DGX/RAPIDS not run: this touches public encode metadata/control-plane validation and schema artifacts, not DataFrame/cuDF/GPU execution paths.

@lmeyerov lmeyerov force-pushed the codex/issue-1253-encode-parity branch 8 times, most recently from 3be0a3f to ff839e2 Compare May 22, 2026 03:01
@lmeyerov lmeyerov force-pushed the codex/issue-1253-encode-parity branch from ff839e2 to 5c01006 Compare May 22, 2026 06:38
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.

Add encode_edge_size, encode_edge_weight, encode_*_opacity/label/title for parity with encode_point_color style

1 participant