Type system for NNModelling#9
Draft
LucaSforza wants to merge 30 commits into
Draft
Conversation
- 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
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See the docs relative to type system.