Files
team-go/pkg/transactor/model_fixture_test.go
zeekay 238dd248ed Read the platform model, do not ship it
The model was compiled in with go:embed, so every clone and every binary
carried a 1.9MB artifact this repository does not own, under a licence that
needed its own carve-out in LICENSE, its own section in NOTICE, and a
LICENSE-EPL beside them.

It is now read at start from model.json in the data directory. A deployment
that has the artifact supplies it; this repository redistributes nothing.
Absent is not an error -- loadModel returns nil for a file that is not there
and buildHierarchy already answered an empty hierarchy for input it cannot
parse -- so a server without one starts and serves an empty model rather
than refusing to boot over a file it cannot carry.

The model moves onto the server, which is where a value read at Register
belongs; sessions reach it through the server they already hold. Tests carry
their own small model, the ten classes they exercise, hand-written: they
never depended on its contents, only that the model served is the model
held.

LICENSE is MIT OR Apache-2.0 with no exception. NOTICE lists dependencies
only.
2026-09-01 00:48:49 -07:00

33 lines
2.1 KiB
Go

package transactor
// testModel is a small platform model: the classes these tests actually exercise.
//
// The real artifact is not in this repository and is not compiled in (model.go),
// so the tests carry their own. Naming the protocol's identifiers is what talking
// to it requires — the same reason the Go in this package names them — and a
// hand-written handful is not a copy of anybody's bundle.
//
// ClassifierKind: CLASS=0, INTERFACE=1, MIXIN=2 (hierarchy.go).
var testModel = []byte(`[
{"_class":"core:class:TxCreateDoc","objectClass":"core:class:Class",
"objectId":"core:class:Doc","attributes":{"kind":0}},
{"_class":"core:class:TxCreateDoc","objectClass":"core:class:Class",
"objectId":"core:class:Space","attributes":{"kind":0,"extends":"core:class:Doc"}},
{"_class":"core:class:TxCreateDoc","objectClass":"core:class:Class",
"objectId":"core:class:SystemSpace","attributes":{"kind":0,"extends":"core:class:Space"}},
{"_class":"core:class:TxCreateDoc","objectClass":"core:class:Class",
"objectId":"contact:class:Person","attributes":{"kind":0,"extends":"core:class:Doc"}},
{"_class":"core:class:TxCreateDoc","objectClass":"core:class:Class",
"objectId":"contact:class:SocialIdentity","attributes":{"kind":0,"extends":"core:class:Doc"}},
{"_class":"core:class:TxCreateDoc","objectClass":"core:class:Class",
"objectId":"contact:class:PersonSpace","attributes":{"kind":0,"extends":"core:class:Space"}},
{"_class":"core:class:TxCreateDoc","objectClass":"core:class:Class",
"objectId":"contact:mixin:Employee","attributes":{"kind":2,"extends":"contact:class:Person"}},
{"_class":"core:class:TxCreateDoc","objectClass":"core:class:Class",
"objectId":"chunter:class:Channel","attributes":{"kind":0,"extends":"core:class:Space"}},
{"_class":"core:class:TxCreateDoc","objectClass":"core:class:Class",
"objectId":"chunter:class:ChatMessage","attributes":{"kind":0,"extends":"core:class:Doc"}},
{"_class":"core:class:TxCreateDoc","objectClass":"core:class:Class",
"objectId":"tracker:class:Project","attributes":{"kind":0,"extends":"core:class:Space"}}
]`)