Skip to content

DID-python: class_name-first superclass resolution (schema-v2 lockstep) — review — do not merge#25

Open
audriB wants to merge 4 commits into
VH-Lab:mainfrom
audriB:feat/schema-v2-superclass-class-name
Open

DID-python: class_name-first superclass resolution (schema-v2 lockstep) — review — do not merge#25
audriB wants to merge 4 commits into
VH-Lab:mainfrom
audriB:feat/schema-v2-superclass-class-name

Conversation

@audriB

@audriB audriB commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review — do not merge.

Schema-v2 lockstep with NDI-python (fix/app-residuals / PR #57) and the already-merged ndi-cloud-node api/src/dal/class_lineage.ts.

doc2sql._get_superclass_str now reads class_name first and unions the definition-derived name in both branches (top-level superclasses and document_class.superclasses), so schema-v2 (V_delta / V_epsilon) documents whose superclasses are bare {"class_name": ...} objects produce the correct sorted meta.superclass string and isa() membership — across both the SQL regexp path (sqlitedb) and the brute-force split path (datastructures).

  • v1 byte-identical: the entire current corpus carries {definition} superclasses (0 with class_name), and a dict with neither key still contributes nothing — no existing meta.superclass string changes.
  • Union semantics match cloud-node computeClassLineage and NDI-python ndi.document.doc_superclass (read class_name first, never short-circuit), verified by an executable cross-stack check: all three stacks agree on a battery of dict-shaped fixtures including the discriminator {class_name:'X', definition:'.../Y.json'} -> {X, Y}.
  • Tests: +11 cases in tests/test_doc2sql_superclass.py; the isa-parity regression guard stays green. Full unit suite 73 passed.

…step)

_get_superclass_str now reads class_name first and UNIONs the
definition-derived name in BOTH branches (top-level 'superclasses' and
'document_class.superclasses'), so schema-v2 documents with bare
{class_name} superclass objects produce the correct sorted meta.superclass
string and isa() membership. The v1 definition-only corpus is byte-for-byte
unchanged (a dict with neither key still contributes nothing).

Mirrors the merged ndi-cloud-node reference (api/src/dal/class_lineage.ts
computeClassLineage) and NDI-python ndi.document.doc_superclass, keeping
meta.superclass and both isa paths (SQL regexp + brute-force split)
consistent across all three stacks. Adds class_name + union test coverage.
@stevevanhooser

stevevanhooser commented Jun 17, 2026 via email

Copy link
Copy Markdown
Contributor

audriB added 3 commits June 21, 2026 10:53
get_docs built a single 'doc_id IN (?,?,...)' with one host parameter per
requested id. A cross-document query over thousands of ids on a large cloud
dataset (e.g. NDI's whole-dataset relationship checks) exceeded
SQLITE_MAX_VARIABLE_NUMBER (999 on older builds) → 'too many SQL variables'.
Batch the id list at 900/query and accumulate; result order is restored from
the doc_map, so behaviour is unchanged for small lists.
Adversarial-review remediation: hasfield interpolated field names into a LIKE
pattern with '_' unescaped (single-char wildcard -> false positives); isa
interpolated the class name into a regexp() pattern without escaping
metacharacters (e.g. '.' over-matched dotted NDI class names). Escape both +
add an ESCAPE clause; fall back to brute force on a non-numeric numeric-query
operand instead of aborting the whole search. + correctness tests.
Lockstep with NDI-python: a V_epsilon flattened-diamond document (bare
{class_name} superclasses) must resolve isa() for every ancestor (both parents
+ the shared root) identically via the SQL meta.superclass path and the
brute-force field_search path. Pins the new observation-tier diamond shape; no
runtime change. 10 passed, ruff + black clean.
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.

2 participants