Skip to content

Type system for NNModelling#9

Draft
LucaSforza wants to merge 30 commits into
masterfrom
typeSystem
Draft

Type system for NNModelling#9
LucaSforza wants to merge 30 commits into
masterfrom
typeSystem

Conversation

@LucaSforza

Copy link
Copy Markdown
Owner

See the docs relative to type system.

- Full architectural analysis with 3-architecture comparison
- Type model interfaces (ShapeDimension, TensorType, TypeSignature)
- Formal type system definition with inference rules (Input, Linear, ReLU)
- Constraint-based inference algorithm (data-driven, no module-specific logic)
- Stereotype JSON extensions (type_signature field)
- Unit test plan (5 groups, ~15 cases)
- Report update: Section 3.3 Static Tensor Type System added to ase_report.tex
- Future Work section updated with type system roadmap
…mEqual, $ stripping, JSDoc

- Removed premature Phase 5 TypeEngine import from Diagram.svelte.ts (circular dep)
- Cleaned up stray Phase 5 references from FlowCanvas, Sidebar, nodes, styles
- Added non-concat dimension cross-validation for concat joins
- Fixed dimEqual to compare computed dim args
- Aligned $ stripping for computed args with design spec
- Added JSDoc format for resolveComputedArg
@LucaSforza LucaSforza marked this pull request as draft June 30, 2026 15:21
@LucaSforza LucaSforza mentioned this pull request Jul 4, 2026
6 tasks
Resolved conflicts in 6 files:
- .opencode/agents/designer.md: took tool permissions from master
- AGENTS.md: merged coverage tests + architecture + file table from both
- FlowCanvas.svelte: merged TypeEngine init (typeSystem) + RPC handler/undo-redo (master)
- CustomNode.svelte: merged handle id='out' (master) + error indicator/tooltip (typeSystem)
- SubflowNode.svelte: kept Diagram import + error badges/resize (typeSystem)
- stereotype.ts: took StereotypeCore-extended class (master)
…nResizeEnd, svelte-check test exclusion

- CRITICAL: StereotypeJson interface used 'typeSignature' (camelCase) but
  stereotype JSON files use 'type_signature' (snake_case), causing all
  type signatures to be undefined at runtime. Fixed interface + constructor.
- Added $ prefix stripping for symbolic dimension names ( → B) during
  type_signature parsing, as per design spec.
- SubflowNode.svelte: removed dead handleResize callback calling non-existent
  data.onResizeEnd method.
- FlowCanvas.svelte: fixed  cleanup (unsubscribe pattern instead of
  diagram.events.off which doesn't exist on EventBus).
- core/index.ts: removed stale re-exports referencing removed types.
- tsconfig.json: exclude __tests__/ from svelte-check to avoid 44 spurious
  'Cannot find name expect/describe/it' errors.
- Replace tooltipVisible/showTooltip/hideTooltip with isNodeHovered flag
- Tooltip now activates on both .node-body and .output-handle-wrapper hover
- Fix bug where tooltip only worked on output handle, not node body
- Cleaned up unused timer and delay logic
Previously, non-numeric parameter values (e.g. 'cazz') were silently
treated as 'unset', creating symbolic variables instead of reporting
errors. Now resolveParamRef returns a ParamResolution discriminated
union distinguishing 'unset' (valid) from 'invalid' (type error).
- Fixed merge conflict
- Updated test count to 146
- Added ParamResolution to TypeEngine description
- Added Phase 15 section (invalid param validation, output handle alignment)
Previously, 'Undefined' and '' were treated as 'unset' creating symbolic
variables. Now they generate explicit type errors like:
'parameter in_features has undefined value, expected a number'
Covers the complete type model (ShapeDimension, TypeSignature, TypeResult),
stereotype type signatures with formal inference rules (Input, Linear, ReLU),
the constraint-based inference engine algorithm, computed dimensions (Conv2d,
MaxPool2d, Flatten), join type checking (Addition, Concat, MatMul,
ScaledDotProduct), editor integration (Phase 5), and testing patterns.

Style transfers from docs2/source/ (RST + Sphinx conventions) and the
formal math notation from analysis/report/ase_report.tex.
Replaced the reference-manual style with an example-driven narrative:
starts with the problem (runtime shape errors), follows a tensor through
the graph step by step, introduces dimension kinds naturally through
examples, and explains join checking and computed dimensions in context.

Also added type_system.rst to AGENTS.md project structure and updated
Phase 15 documentation notes.
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.

1 participant