docs: Token Behavior Matrix — Scala TDD-ready specification#114
Closed
ottobot-ai wants to merge 1 commit into
Closed
docs: Token Behavior Matrix — Scala TDD-ready specification#114ottobot-ai wants to merge 1 commit into
ottobot-ai wants to merge 1 commit into
Conversation
Comprehensive specification for implementing TokenBehavior sealed trait in Scala metagraph codebase, matching TypeScript SDK (PR scasplte2#45). Key decisions: - Module: modules/models/ (same as StateMachineDefinition) - Proto: New token.proto under ottochain/v1/ - Guards use sequenceNumber (fixes TypeScript $ordinal bug) Deliverables: - TokenBehavior sealed trait with 16 case objects - TokenBehaviorBuilder.toStateMachineDefinition(behavior) - TokenBehavior.isOperationAllowed(behavior, op) - Proto: TokenBehaviorType enum, TokenOperationType enum 58 TDD test cases in 7 groups covering: - Predicates, structure, transitions, wire format - Operation legality, named presets - Cross-language equivalence Trello: 6996301447b41cda59369256 Refs: TypeScript SDK PR scasplte2#45 (84 tests)
Collaborator
Author
|
Moving to feature branch |
ottobot-ai
added a commit
to ottobot-ai/ottochain
that referenced
this pull request
Feb 26, 2026
Implements the 16-type token behavior system using a 4-boolean TDEG matrix. ## Deliverables - `TokenBehavior` sealed trait with 16 case objects (modules/models/) - `TokenBehaviorBuilder.toStateMachineDefinition(behavior)` factory - `TokenBehavior.isOperationAllowed(behavior, op)` legality API - `TokenOperation` enum (8 operations) - `token.proto` with `TokenBehaviorType` + `TokenOperationType` enums - 58 TDD tests — all passing ## Key Design - 4-bit encoding: T=Transferable(8), D=Divisible(4), E=Expirable(2), G=Governable(1) - States: ACTIVE (initial), BURNED (terminal), EXPIRED (terminal, E=1 only) - Expiry guard uses `sequenceNumber` (fixes TypeScript $ordinal latent bug, AC4) - Cross-language equivalence with TypeScript SDK PR scasplte2#45 ## References - Trello: https://trello.com/c/6996301447b41cda59369256 - Spec: scasplte2#114 - TypeScript reference: ottobot-ai/ottochain-sdk PR scasplte2#45 Co-authored-by: OttoWork <ottobot@kd5ujc.xyz>
ottobot-ai
added a commit
to ottobot-ai/ottochain
that referenced
this pull request
Mar 23, 2026
Implements the 16-type token behavior system using a 4-boolean TDEG matrix. ## Deliverables - `TokenBehavior` sealed trait with 16 case objects (modules/models/) - `TokenBehaviorBuilder.toStateMachineDefinition(behavior)` factory - `TokenBehavior.isOperationAllowed(behavior, op)` legality API - `TokenOperation` enum (8 operations) - `token.proto` with `TokenBehaviorType` + `TokenOperationType` enums - 58 TDD tests — all passing ## Key Design - 4-bit encoding: T=Transferable(8), D=Divisible(4), E=Expirable(2), G=Governable(1) - States: ACTIVE (initial), BURNED (terminal), EXPIRED (terminal, E=1 only) - Expiry guard uses `sequenceNumber` (fixes TypeScript $ordinal latent bug, AC4) - Cross-language equivalence with TypeScript SDK PR scasplte2#45 ## References - Trello: https://trello.com/c/6996301447b41cda59369256 - Spec: scasplte2#114 - TypeScript reference: ottobot-ai/ottochain-sdk PR scasplte2#45 Co-authored-by: OttoWork <ottobot@kd5ujc.xyz>
ottobot-ai
added a commit
to ottobot-ai/ottochain
that referenced
this pull request
Mar 23, 2026
… matrix) Implements the 16-type token behavior system using a 4-boolean TDEG matrix. ## Deliverables - TokenBehavior sealed trait with 16 case objects (modules/models/) - TokenBehaviorBuilder.toStateMachineDefinition(behavior) factory - TokenBehavior.isOperationAllowed(behavior, op) legality API - TokenOperation enum (8 operations) - token.proto with TokenBehaviorType + TokenOperationType enums - 58 TDD tests — all passing ## Key Design - 4-bit encoding: T=Transferable(8), D=Divisible(4), E=Expirable(2), G=Governable(1) - States: ACTIVE (initial), BURNED (terminal), EXPIRED (terminal, E=1 only) - Expiry guard uses sequenceNumber (fixes TypeScript $ordinal latent bug, AC4) - Cross-language equivalence with TypeScript SDK PR scasplte2#45 ## References - Trello: https://trello.com/c/6996301447b41cda59369256 - Spec: scasplte2#114 - TypeScript reference: ottobot-ai/ottochain-sdk PR scasplte2#45 Co-authored-by: OttoWork <ottobot@kd5ujc.xyz>
ottobot-ai
added a commit
to ottobot-ai/ottochain
that referenced
this pull request
Mar 23, 2026
Implements the 16-type token behavior system using a 4-boolean TDEG matrix. ## Deliverables - TokenBehavior sealed trait with 16 case objects (modules/models/) - TokenBehaviorBuilder.toStateMachineDefinition(behavior) factory - TokenBehavior.isOperationAllowed(behavior, op) legality API - TokenOperation enum (8 operations) - token.proto with TokenBehaviorType + TokenOperationType enums - 58 TDD tests — all passing ## Key Design - 4-bit encoding: T=Transferable(8), D=Divisible(4), E=Expirable(2), G=Governable(1) - States: ACTIVE (initial), BURNED (terminal), EXPIRED (terminal, E=1 only) - Expiry guard uses sequenceNumber (fixes TypeScript $ordinal latent bug, AC4) - Cross-language equivalence with TypeScript SDK PR scasplte2#45 ## References - Trello: https://trello.com/c/6996301447b41cda59369256 - Spec: scasplte2#114 - TypeScript reference: ottobot-ai/ottochain-sdk PR scasplte2#45 Co-authored-by: OttoWork <ottobot@kd5ujc.xyz>
ottobot-ai
added a commit
that referenced
this pull request
Mar 23, 2026
Implements the 16-type token behavior system using a 4-boolean TDEG matrix. ## Deliverables - TokenBehavior sealed trait with 16 case objects (modules/models/) - TokenBehaviorBuilder.toStateMachineDefinition(behavior) factory - TokenBehavior.isOperationAllowed(behavior, op) legality API - TokenOperation enum (8 operations) - token.proto with TokenBehaviorType + TokenOperationType enums - 58 TDD tests — all passing ## Key Design - 4-bit encoding: T=Transferable(8), D=Divisible(4), E=Expirable(2), G=Governable(1) - States: ACTIVE (initial), BURNED (terminal), EXPIRED (terminal, E=1 only) - Expiry guard uses sequenceNumber (fixes TypeScript $ordinal latent bug, AC4) - Cross-language equivalence with TypeScript SDK PR #45 ## References - Trello: https://trello.com/c/6996301447b41cda59369256 - Spec: #114 - TypeScript reference: ottobot-ai/ottochain-sdk PR #45 Co-authored-by: OttoWork <ottobot@kd5ujc.xyz>
ottobot-ai
added a commit
to ottobot-ai/ottochain
that referenced
this pull request
Mar 23, 2026
Implements the 16-type token behavior system using a 4-boolean TDEG matrix. ## Deliverables - TokenBehavior sealed trait with 16 case objects (modules/models/) - TokenBehaviorBuilder.toStateMachineDefinition(behavior) factory - TokenBehavior.isOperationAllowed(behavior, op) legality API - TokenOperation enum (8 operations) - token.proto with TokenBehaviorType + TokenOperationType enums - 58 TDD tests — all passing ## Key Design - 4-bit encoding: T=Transferable(8), D=Divisible(4), E=Expirable(2), G=Governable(1) - States: ACTIVE (initial), BURNED (terminal), EXPIRED (terminal, E=1 only) - Expiry guard uses sequenceNumber (fixes TypeScript $ordinal latent bug, AC4) - Cross-language equivalence with TypeScript SDK PR scasplte2#45 ## References - Trello: https://trello.com/c/6996301447b41cda59369256 - Spec: scasplte2#114 - TypeScript reference: ottobot-ai/ottochain-sdk PR scasplte2#45 Co-authored-by: OttoWork <ottobot@kd5ujc.xyz>
ottobot-ai
added a commit
that referenced
this pull request
Mar 24, 2026
Implements the 16-type token behavior system using a 4-boolean TDEG matrix. ## Deliverables - TokenBehavior sealed trait with 16 case objects (modules/models/) - TokenBehaviorBuilder.toStateMachineDefinition(behavior) factory - TokenBehavior.isOperationAllowed(behavior, op) legality API - TokenOperation enum (8 operations) - token.proto with TokenBehaviorType + TokenOperationType enums - 58 TDD tests — all passing ## Key Design - 4-bit encoding: T=Transferable(8), D=Divisible(4), E=Expirable(2), G=Governable(1) - States: ACTIVE (initial), BURNED (terminal), EXPIRED (terminal, E=1 only) - Expiry guard uses sequenceNumber (fixes TypeScript $ordinal latent bug, AC4) - Cross-language equivalence with TypeScript SDK PR #45 ## References - Trello: https://trello.com/c/6996301447b41cda59369256 - Spec: #114 - TypeScript reference: ottobot-ai/ottochain-sdk PR #45 Co-authored-by: OttoWork <ottobot@kd5ujc.xyz>
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.
Summary
Comprehensive TDD-ready specification for implementing
TokenBehaviorsealed trait in the Scala metagraph codebase, achieving cross-language equivalence with TypeScript SDK (PR #45).Trello Card
Token Behavior Matrix — Scala Specification
Key Decisions (from @research feasibility)
modules/models/StateMachineDefinition; pure data, no IOtoken.protounderottochain/v1/sequenceNumber$ordinalbug (defaults to 0)Deliverables
TokenBehavior— Sealed trait with 16 case objects (TDEG model)TokenBehaviorBuilder.toStateMachineDefinition(behavior)— FactoryTokenBehavior.isOperationAllowed(behavior, op)— Legality APITokenBehaviorType+TokenOperationTypeenumsTest Coverage
58 TDD test cases in 7 groups:
References
ottobot-ai/ottochain-sdkPR fix: relax L1 sequence validation to >= for batching support #45 (84 tests)docs/design/token-behavior-matrix.mddfa-json-logic-patterns.md§11Next Steps
After spec review:
Spec by @Think | 2026-02-25