Support nested partitions and partitions directly targeting services (#122)

* Do the nested partition thing

* Tidy up touched code

* Add nested partition test project, not fully functional

* Clean up variable names, move path_metadata mutation strictly into snapshot_reconciler

* Remove path_metadata, snapshotting is now pure

* Factor out snapshot metadata storage to fix a missing case

* Pull instance_name out of per_path_metadata, closer to what we need

* Refactor to make metadata make more sense, part one

* All appears to be well

* Cull 'metadata_per_path' in favor of 'instances_per_path'

* Remove SnapshotContext

* InstanceMetadata -> PublicInstanceMetadata in web module

* Build in snapshot testing system for testing... snapshots?

* Remove pretty_assertions to see if it fixes a snapshot comparison bug

* Reintroduce pretty assertions, it's not the cause of inequality

* Fix snapshot tests with custom relative path serializer
This commit is contained in:
Lucien Greathouse
2019-02-07 14:55:01 -08:00
committed by GitHub
parent 38e3c198f2
commit ecb9b5e28f
37 changed files with 999 additions and 396 deletions

View File

@@ -0,0 +1,20 @@
{
"name": "empty",
"class_name": "DataModel",
"properties": {},
"children": [],
"metadata": {
"ignore_unknown_instances": true,
"source_path": null,
"project_definition": [
"empty",
{
"class_name": "DataModel",
"children": {},
"properties": {},
"ignore_unknown_instances": null,
"path": null
}
]
}
}

View File

@@ -0,0 +1,9 @@
{
"name": "nested-partitions",
"tree": {
"$path": "outer",
"inner": {
"$path": "inner"
}
}
}

View File

@@ -0,0 +1,82 @@
{
"name": "nested-partitions",
"class_name": "Folder",
"properties": {},
"children": [
{
"name": "inner",
"class_name": "Folder",
"properties": {},
"children": [
{
"name": "hello",
"class_name": "ModuleScript",
"properties": {
"Source": {
"Type": "String",
"Value": "-- inner/hello.lua"
}
},
"children": [],
"metadata": {
"ignore_unknown_instances": false,
"source_path": "inner/hello.lua",
"project_definition": null
}
}
],
"metadata": {
"ignore_unknown_instances": false,
"source_path": "inner",
"project_definition": [
"inner",
{
"class_name": null,
"children": {},
"properties": {},
"ignore_unknown_instances": null,
"path": "inner"
}
]
}
},
{
"name": "world",
"class_name": "ModuleScript",
"properties": {
"Source": {
"Type": "String",
"Value": "-- outer/world.lua"
}
},
"children": [],
"metadata": {
"ignore_unknown_instances": false,
"source_path": "outer/world.lua",
"project_definition": null
}
}
],
"metadata": {
"ignore_unknown_instances": false,
"source_path": "outer",
"project_definition": [
"nested-partitions",
{
"class_name": null,
"children": {
"inner": {
"class_name": null,
"children": {},
"properties": {},
"ignore_unknown_instances": null,
"path": "inner"
}
},
"properties": {},
"ignore_unknown_instances": null,
"path": "outer"
}
]
}
}

View File

@@ -0,0 +1 @@
-- inner/hello.lua

View File

@@ -0,0 +1 @@
-- outer/world.lua

View File

@@ -1,6 +0,0 @@
Key,Context,Example,Source,es-es,de
,ClickableGroup:BuilderGui:TextLabel,You got 22 hearts!,You got {1} hearts!,,
,,"Team ""Red"" wins!","Team ""{1}"" wins!","¡Gana el equipo ""{1}""!","¡Gana el equipo ""{1}""!"
,Frame:TextLabel,,"{1} killed {2}, with a {3}","{1} mató a {2} con
una escopeta","{1} mató a {2} con
una escopeta"
1 Key Context Example Source es-es de
2 ClickableGroup:BuilderGui:TextLabel You got 22 hearts! You got {1} hearts!
3 Team "Red" wins! Team "{1}" wins! ¡Gana el equipo "{1}"! ¡Gana el equipo "{1}"!
4 Frame:TextLabel {1} killed {2}, with a {3} {1} mató a {2} con una escopeta {1} mató a {2} con una escopeta

View File

@@ -0,0 +1,161 @@
{
"name": "single-sync-point",
"class_name": "DataModel",
"properties": {},
"children": [
{
"name": "HttpService",
"class_name": "HttpService",
"properties": {
"HttpEnabled": {
"Type": "Bool",
"Value": true
}
},
"children": [],
"metadata": {
"ignore_unknown_instances": true,
"source_path": null,
"project_definition": [
"HttpService",
{
"class_name": "HttpService",
"children": {},
"properties": {
"HttpEnabled": {
"Type": "Bool",
"Value": true
}
},
"ignore_unknown_instances": null,
"path": null
}
]
}
},
{
"name": "ReplicatedStorage",
"class_name": "ReplicatedStorage",
"properties": {},
"children": [
{
"name": "Foo",
"class_name": "Folder",
"properties": {},
"children": [
{
"name": "foo",
"class_name": "StringValue",
"properties": {
"Value": {
"Type": "String",
"Value": "Hello world, from foo.txt"
}
},
"children": [],
"metadata": {
"ignore_unknown_instances": false,
"source_path": "lib/foo.txt",
"project_definition": null
}
},
{
"name": "main",
"class_name": "ModuleScript",
"properties": {
"Source": {
"Type": "String",
"Value": "-- hello, from main"
}
},
"children": [],
"metadata": {
"ignore_unknown_instances": false,
"source_path": "lib/main.lua",
"project_definition": null
}
}
],
"metadata": {
"ignore_unknown_instances": false,
"source_path": "lib",
"project_definition": [
"Foo",
{
"class_name": null,
"children": {},
"properties": {},
"ignore_unknown_instances": null,
"path": "lib"
}
]
}
}
],
"metadata": {
"ignore_unknown_instances": true,
"source_path": null,
"project_definition": [
"ReplicatedStorage",
{
"class_name": "ReplicatedStorage",
"children": {
"Foo": {
"class_name": null,
"children": {},
"properties": {},
"ignore_unknown_instances": null,
"path": "lib"
}
},
"properties": {},
"ignore_unknown_instances": null,
"path": null
}
]
}
}
],
"metadata": {
"ignore_unknown_instances": true,
"source_path": null,
"project_definition": [
"single-sync-point",
{
"class_name": "DataModel",
"children": {
"HttpService": {
"class_name": "HttpService",
"children": {},
"properties": {
"HttpEnabled": {
"Type": "Bool",
"Value": true
}
},
"ignore_unknown_instances": null,
"path": null
},
"ReplicatedStorage": {
"class_name": "ReplicatedStorage",
"children": {
"Foo": {
"class_name": null,
"children": {},
"properties": {},
"ignore_unknown_instances": null,
"path": "lib"
}
},
"properties": {},
"ignore_unknown_instances": null,
"path": null
}
},
"properties": {},
"ignore_unknown_instances": null,
"path": null
}
]
}
}

View File

@@ -0,0 +1,53 @@
{
"name": "test-model",
"class_name": "Folder",
"properties": {},
"children": [
{
"name": "main",
"class_name": "Script",
"properties": {
"Source": {
"Type": "String",
"Value": "local other = require(script.Parent.other)\n\nprint(other)"
}
},
"children": [],
"metadata": {
"ignore_unknown_instances": false,
"source_path": "src/main.server.lua",
"project_definition": null
}
},
{
"name": "other",
"class_name": "ModuleScript",
"properties": {
"Source": {
"Type": "String",
"Value": "return \"Hello, world!\""
}
},
"children": [],
"metadata": {
"ignore_unknown_instances": false,
"source_path": "src/other.lua",
"project_definition": null
}
}
],
"metadata": {
"ignore_unknown_instances": false,
"source_path": "src",
"project_definition": [
"test-model",
{
"class_name": null,
"children": {},
"properties": {},
"ignore_unknown_instances": null,
"path": "src"
}
]
}
}

View File

@@ -0,0 +1 @@
-- ReplicatedStorage/hello.lua

View File

@@ -0,0 +1,11 @@
{
"name": "transmute-partition",
"tree": {
"$className": "DataModel",
"ReplicatedStorage": {
"$className": "ReplicatedStorage",
"$path": "ReplicatedStorage"
}
}
}

View File

@@ -0,0 +1,66 @@
{
"name": "transmute-partition",
"class_name": "DataModel",
"properties": {},
"children": [
{
"name": "ReplicatedStorage",
"class_name": "ReplicatedStorage",
"properties": {},
"children": [
{
"name": "hello",
"class_name": "ModuleScript",
"properties": {
"Source": {
"Type": "String",
"Value": "-- ReplicatedStorage/hello.lua"
}
},
"children": [],
"metadata": {
"ignore_unknown_instances": false,
"source_path": "ReplicatedStorage/hello.lua",
"project_definition": null
}
}
],
"metadata": {
"ignore_unknown_instances": false,
"source_path": "ReplicatedStorage",
"project_definition": [
"ReplicatedStorage",
{
"class_name": "ReplicatedStorage",
"children": {},
"properties": {},
"ignore_unknown_instances": null,
"path": "ReplicatedStorage"
}
]
}
}
],
"metadata": {
"ignore_unknown_instances": true,
"source_path": null,
"project_definition": [
"transmute-partition",
{
"class_name": "DataModel",
"children": {
"ReplicatedStorage": {
"class_name": "ReplicatedStorage",
"children": {},
"properties": {},
"ignore_unknown_instances": null,
"path": "ReplicatedStorage"
}
},
"properties": {},
"ignore_unknown_instances": null,
"path": null
}
]
}
}