Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions audits/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@ These remain because coverage has not fully moved off them yet. Each one goes wh
its users does.

- **Core's legacy fixture loader** (`data.json`, `action.json`, `expected.json` through
`TemplatedTestBase`). It runs 16 legacy fixture directories, each with a documented source:
15 tracked as legacy-only in `cutover.json` with the strict check they fail, and one declaration
that needs alternative commands. 373 cases have moved to the runner; the 167 legacy tests whose
`TemplatedTestBase`). It runs 5 legacy fixture directories, each with a documented source: 4
tracked as legacy-only in `cutover.json` with the strict check they fail, and one declaration
that needs alternative commands. 384 cases have moved to the runner; the 167 legacy tests whose
fixtures no documented source reproduced were deleted and are recorded in
`audits/catalog/deleted-fixtures.json`.
- **The legacy RST extractor** (`rst/`, `model/CodeBlock`). Cutover and the example inventory
Expand Down
44 changes: 0 additions & 44 deletions audits/catalog/cutover.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,9 @@
{
"contexts" : [ "aggregation/expressions", "aggregation/stages", "query" ],
"legacyOnly" : [ {
"check" : "PUBLISHED",
"detail" : "results differ from the printed results at /1: no result matches this constraint",
"fixture" : "aggregation/expressions/addToSet/useInGroupStage"
}, {
"check" : "PUBLISHED",
"detail" : "results differ from the printed results at /0: key order differs",
"fixture" : "aggregation/expressions/cos/cosineOfValueInDegrees"
}, {
"check" : "PUBLISHED",
"detail" : "results differ from the printed results at /0: key order differs",
"fixture" : "aggregation/expressions/cos/cosineOfValueInRadians"
}, {
"check" : "PUBLISHED",
"detail" : "results differ from the printed results at /0: key order differs",
"fixture" : "aggregation/expressions/getField/queryFieldsThatContainPeriods"
}, {
"check" : "PUBLISHED",
"detail" : "results differ from the printed results at /0: key order differs",
"fixture" : "aggregation/expressions/getField/queryFieldsThatStartWithADollarSign"
}, {
"check" : "PUBLISHED",
"detail" : "results differ from the printed results at /0/yearNumber: printed whole 2015 is an Int64 2015",
"fixture" : "aggregation/expressions/isoWeekYear/isoWeekYearExpressionOperator"
}, {
"check" : "PUBLISHED",
"detail" : "results differ from the printed results at /2: no result matches this constraint",
"fixture" : "aggregation/expressions/setUnion/setUnionAccumulatorOperator"
}, {
"check" : "PUBLISHED",
"detail" : "results differ from the printed results at /0: key order differs",
"fixture" : "aggregation/expressions/sin/sineOfValueInDegrees"
}, {
"check" : "PUBLISHED",
"detail" : "results differ from the printed results at /0: key order differs",
"fixture" : "aggregation/expressions/sin/sineOfValueInRadians"
}, {
"check" : "SOURCE",
"detail" : "the shell normalizer cannot read the documented results (expected syntax)",
"fixture" : "aggregation/expressions/tan/tangentOfValueInRadians"
}, {
"check" : "PUBLISHED",
"detail" : "results differ from the printed results at /0: no result matches this constraint",
"fixture" : "aggregation/stages/bucketAuto/multiFacetedAggregation"
}, {
"check" : "PUBLISHED",
"detail" : "results differ from the printed results at /0: no result matches this constraint",
"fixture" : "aggregation/stages/bucketAuto/multiFacetedAggregationAsPipeline"
}, {
"check" : "SOURCE",
"detail" : "the shell normalizer cannot read the documented results (expected syntax)",
Expand Down
673 changes: 673 additions & 0 deletions audits/catalog/fixture-migration.json

Large diffs are not rendered by default.

54 changes: 2 additions & 52 deletions audits/catalog/form-migration.json
Original file line number Diff line number Diff line change
@@ -1,55 +1,5 @@
{
"overrides" : [ {
"blocks" : [ {
"role" : "ACTION",
"sha256" : "505edb1e4bde2908694f17718f020da56a9df0140f79eab66f2d9f3d76ee0318",
"text" : "db.flowers.aggregate(\n [\n { $project: { flowerFieldA:1, flowerFieldB: 1, allValues: { $setUnion: [ \"$flowerFieldA\", \"$flowerFieldB\" ] }, _id: 0 } }\n ]\n)"
}, {
"role" : "DATA",
"sha256" : "6443ea787dad4fdfbd05b758c7838ea1b3cd69c19b2e0fe36fad50c454f6eeed",
"text" : "db.flowers.insertMany( [\n { \"_id\" : 1, \"flowerFieldA\" : [ \"rose\", \"orchid\" ], \"flowerFieldB\" : [ \"rose\", \"orchid\" ] },\n { \"_id\" : 2, \"flowerFieldA\" : [ \"rose\", \"orchid\" ], \"flowerFieldB\" : [ \"orchid\", \"rose\", \"orchid\" ] },\n { \"_id\" : 3, \"flowerFieldA\" : [ \"rose\", \"orchid\" ], \"flowerFieldB\" : [ \"rose\", \"orchid\", \"jasmine\" ] },\n { \"_id\" : 4, \"flowerFieldA\" : [ \"rose\", \"orchid\" ], \"flowerFieldB\" : [ \"jasmine\", \"rose\" ] },\n { \"_id\" : 5, \"flowerFieldA\" : [ \"rose\", \"orchid\" ], \"flowerFieldB\" : [ ] },\n { \"_id\" : 6, \"flowerFieldA\" : [ \"rose\", \"orchid\" ], \"flowerFieldB\" : [ [ \"rose\" ], [ \"orchid\" ] ] },\n { \"_id\" : 7, \"flowerFieldA\" : [ \"rose\", \"orchid\" ], \"flowerFieldB\" : [ [ \"rose\", \"orchid\" ] ] },\n { \"_id\" : 8, \"flowerFieldA\" : [ ], \"flowerFieldB\" : [ ] },\n { \"_id\" : 9, \"flowerFieldA\" : [ ], \"flowerFieldB\" : [ \"rose\" ] }\n] ) "
}, {
"role" : "EXPECTED",
"sha256" : "1512ea57843cc59b806529b1377d79f1a5b4576eae873a1ce12af6a456d87d8b",
"text" : "{ \"flowerFieldA\": [ \"rose\", \"orchid\" ], \"flowerFieldB\": [ \"rose\", \"orchid\" ], \"allValues\": [ \"orchid\", \"rose\" ] }\n{ \"flowerFieldA\": [ \"rose\", \"orchid\" ], \"flowerFieldB\": [ \"orchid\", \"rose\", \"orchid\" ], \"allValues\": [ \"orchid\", \"rose\" ] }\n{ \"flowerFieldA\": [ \"rose\", \"orchid\" ], \"flowerFieldB\": [ \"rose\", \"orchid\", \"jasmine\" ], \"allValues\": [ \"orchid\", \"rose\", \"jasmine\" ] }\n{ \"flowerFieldA\": [ \"rose\", \"orchid\" ], \"flowerFieldB\": [ \"jasmine\", \"rose\" ], \"allValues\": [ \"orchid\", \"rose\", \"jasmine\" ] }\n{ \"flowerFieldA\": [ \"rose\", \"orchid\" ], \"flowerFieldB\": [ ], \"allValues\": [ \"orchid\", \"rose\" ] }\n{ \"flowerFieldA\": [ \"rose\", \"orchid\" ], \"flowerFieldB\": [ [ \"rose\" ], [ \"orchid\" ] ], \"allValues\": [ \"orchid\", \"rose\", [ \"rose\" ], [ \"orchid\" ] ] }\n{ \"flowerFieldA\": [ \"rose\", \"orchid\" ], \"flowerFieldB\": [ [ \"rose\", \"orchid\" ] ], \"allValues\": [ \"orchid\", \"rose\", [ \"rose\", \"orchid\" ] ] }\n{ \"flowerFieldA\": [ ], \"flowerFieldB\": [ ], \"allValues\": [ ] }\n{ \"flowerFieldA\": [ ], \"flowerFieldB\": [ \"rose\" ], \"allValues\": [ \"rose\" ] }"
} ],
"collections" : { },
"corrections" : [ ],
"example" : "main",
"fixture" : "aggregation/expressions/setUnion/setUnionAccumulatorOperator",
"fixtureFiles" : {
"action.json" : "58a773e31fc06aca6ece771f62acaa30b338a6c3a2e6a99c060c1bd7cc7833dd",
"data.json" : "01b6f83876510cb9f326b4cef4476f019a54cd5894b583866e11f34cdeae218a",
"expected.json" : "1512ea57843cc59b806529b1377d79f1a5b4576eae873a1ce12af6a456d87d8b",
"name" : "0d6e4079e36703ebd37c00722f5891d28b0e2811dc114b129215123adcce3605"
},
"includes" : [ {
"blob" : "9ba8fe6005b2e4e5e7a77bbf7c6535da3355c571",
"path" : "source/includes/important-set-operator-semantics.rst"
}, {
"blob" : "3ae8bf736443eaa8cf84e56de8d30b33dd6449bc",
"path" : "source/includes/extracts-fact-agg-top-level-expressions.yaml"
}, {
"blob" : "5366b8d724f1705e143d55a10e620d6fe50b37de",
"path" : "source/includes/extracts-parent-fact-agg-top-level-expressions.yaml"
} ],
"origin" : "948049a3364491f4905246224922d2dbb4197154",
"pageBlob" : "5fb7cb7683edfc6e33c1129ce27a7d763725669c",
"retiredLock" : {
"name" : "lock",
"sha256" : "e17fac3fb207733c3d2910b145f4878ecdbee2a2d8c8f7d6337bb23cd582cc6b",
"text" : "rearrange suppress id\n"
},
"retypes" : [ ],
"rules" : [ "PROJECT_ID_FIRST" ],
"shape" : "PIPELINE",
"source" : {
"commit" : "e0848b6ada3e691ecada5da38e717de2d2545843",
"path" : "source/reference/operator/aggregation/setUnion.txt",
"relation" : "AT_ORIGIN"
},
"unexpandedIncludes" : [ ]
}, {
"blocks" : [ {
"role" : "ACTION",
"sha256" : "f4d68dd8cdbf77d323571973710fe8085111e5956b009ddb032e4a3f44ac8488",
Expand Down Expand Up @@ -257,7 +207,7 @@
"gap.REJECTED" : 0,
"gap.RESIDUAL_DIFFERENCE" : 0,
"gap.SOURCE_UNSUPPORTED" : 0,
"overrides" : 4,
"overrides" : 3,
"overrides.corrected" : 0,
"overrides.exact" : 1,
"overrides.retyped" : 0,
Expand All @@ -267,7 +217,7 @@
"rule.FIELD_OPERATORS_AND" : 0,
"rule.NAMED_ARGUMENTS" : 1,
"rule.PROJECTION_FLAGS" : 0,
"rule.PROJECT_ID_FIRST" : 1,
"rule.PROJECT_ID_FIRST" : 0,
"rule.REGEX_FORM" : 0,
"rule.SINGLE_ARGUMENT_ARRAY" : 0,
"rule.UNWIND_PATH" : 0,
Expand Down
54 changes: 29 additions & 25 deletions audits/catalog/form-review.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,5 @@
{
"declarations" : [ {
"corrections" : [ ],
"fixture" : "aggregation/expressions/setUnion/setUnionAccumulatorOperator",
"includes" : [ {
"blob" : "9ba8fe6005b2e4e5e7a77bbf7c6535da3355c571",
"path" : "source/includes/important-set-operator-semantics.rst"
}, {
"blob" : "3ae8bf736443eaa8cf84e56de8d30b33dd6449bc",
"path" : "source/includes/extracts-fact-agg-top-level-expressions.yaml"
}, {
"blob" : "5366b8d724f1705e143d55a10e620d6fe50b37de",
"path" : "source/includes/extracts-parent-fact-agg-top-level-expressions.yaml"
} ],
"justification" : null,
"lock" : "rearrange suppress id\n",
"marker" : "lock",
"origin" : "948049a3364491f4905246224922d2dbb4197154",
"pageBlob" : "5fb7cb7683edfc6e33c1129ce27a7d763725669c",
"retypes" : [ ],
"rules" : [ "PROJECT_ID_FIRST" ],
"source" : {
"commit" : "e0848b6ada3e691ecada5da38e717de2d2545843",
"path" : "source/reference/operator/aggregation/setUnion.txt",
"relation" : "AT_ORIGIN"
}
}, {
"corrections" : [ ],
"fixture" : "aggregation/stages/densify/densifyTimeSeriesData",
"includes" : [ {
Expand Down Expand Up @@ -1594,6 +1569,35 @@
"path" : "source/reference/operator/aggregation/setIsSubset.txt",
"relation" : "AT_ORIGIN"
}
}, {
"corrections" : [ ],
"fixture" : "aggregation/expressions/setUnion/setUnionAccumulatorOperator",
"includes" : [ {
"blob" : "9ba8fe6005b2e4e5e7a77bbf7c6535da3355c571",
"path" : "source/includes/important-set-operator-semantics.rst"
}, {
"blob" : "3ae8bf736443eaa8cf84e56de8d30b33dd6449bc",
"path" : "source/includes/extracts-fact-agg-top-level-expressions.yaml"
}, {
"blob" : "5366b8d724f1705e143d55a10e620d6fe50b37de",
"path" : "source/includes/extracts-parent-fact-agg-top-level-expressions.yaml"
} ],
"justification" : null,
"lock" : "rearrange suppress id\n",
"marker" : "lock",
"origin" : "948049a3364491f4905246224922d2dbb4197154",
"pageBlob" : "5fb7cb7683edfc6e33c1129ce27a7d763725669c",
"retypes" : [ ],
"rules" : [ "PROJECT_ID_FIRST" ],
"source" : {
"commit" : "e0848b6ada3e691ecada5da38e717de2d2545843",
"path" : "source/reference/operator/aggregation/setUnion.txt",
"relation" : "AT_ORIGIN"
},
"unorderedArrays" : [ {
"path" : "/allValues",
"reason" : "$setUnion does not order the array it returns: the page prints one order, and the server returns another"
} ]
}, {
"corrections" : [ ],
"fixture" : "aggregation/expressions/size/sizeExpressionOperator",
Expand Down
6 changes: 5 additions & 1 deletion audits/catalog/legacy-references.json
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,11 @@
"path" : "source/reference/operator/aggregation/addToSet.txt",
"relation" : "AT_ORIGIN"
},
"unexpandedIncludes" : [ ]
"unexpandedIncludes" : [ ],
"unorderedArrays" : [ {
"path" : "/itemsSold",
"reason" : "$addToSet does not order the array it builds: the server lists the set's members in a different order between runs on identical data, and the page prints one order"
} ]
}, {
"blocks" : [ {
"role" : "ACTION",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ object Candidates {
val ledger = AuditJson.fixtureMigration(Files.readString(root.resolve(LEDGER)))
val contents = sortedMapOf<String, ByteArray>()
ledger.migrations.forEach {
contents[it.scenario] =
FixtureMigration.scenario(it.override, it.ordered, it.options).toByteArray()
contents[it.scenario] = FixtureMigration.scenario(it).toByteArray()
}
val current = currentManifest(root)
val generation = generation(root, current)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ data class MigratedFixture(
*/
@get:JsonInclude(JsonInclude.Include.NON_EMPTY)
val fileEdits: Map<String, FileEdit> = emptyMap(),
/**
* A reviewed reason the published check does not run: the page prints results the server does
* not return (a page error), or that cannot be read. Serialization and behavior stay strict.
*/
@get:JsonInclude(JsonInclude.Include.NON_NULL) val publishedSkip: String? = null,
)

/**
Expand Down Expand Up @@ -259,6 +264,15 @@ object FixtureMigration {

private val unordered = Regex("""\.orderMatters\s*\(\s*false\s*\)""")

/** The scenario of a ledger entry: its override's, with its options and reviewed skip. */
fun scenario(migrated: MigratedFixture): String =
scenario(
migrated.override,
migrated.ordered,
migrated.options,
publishedSkip = migrated.publishedSkip,
)

/**
* The scenario a runner executes for [override]: its documented data, action and results.
* [ordered] is whether the legacy test compared results in order, and [options] are its other
Expand All @@ -271,6 +285,7 @@ object FixtureMigration {
ordered: Boolean,
options: List<OptionCall> = emptyList(),
dataset: String? = null,
publishedSkip: String? = null,
): String {
require(options.all { it.name in mappedOptions && it.name != "orderMatters" }) {
"${override.fixture}: options ${options.map { it.name }} are not mapped"
Expand All @@ -285,6 +300,7 @@ object FixtureMigration {
skipped["results"] =
BsonString("the legacy test skipped its data check (skipDataCheck)")
}
publishedSkip?.let { skipped["published"] = BsonString(it) }
if (dataset != null) {
skipped["results"] =
BsonString(
Expand Down Expand Up @@ -600,7 +616,13 @@ object FixtureMigration {
return ledger.copy(
migrations =
ledger.migrations.map { migrated ->
val text = scenario(migrated.override, migrated.ordered, migrated.options)
val text =
scenario(
migrated.override,
migrated.ordered,
migrated.options,
publishedSkip = migrated.publishedSkip,
)
Files.writeString(root.resolve(migrated.scenario), text)
migrated.copy(scenarioSha256 = sha256(text.toByteArray()))
}
Expand Down Expand Up @@ -847,7 +869,15 @@ object FixtureMigration {
if (sha256(text.toByteArray()) != migrated.scenarioSha256) {
problems += "${migrated.fixture}: scenario changed since the migration"
}
if (text != scenario(migrated.override, migrated.ordered, migrated.options)) {
if (
text !=
scenario(
migrated.override,
migrated.ordered,
migrated.options,
publishedSkip = migrated.publishedSkip,
)
) {
problems +=
"${migrated.fixture}: scenario is not its override's documented source"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ class FixtureMigrationTest {

@Test
fun scenariosAreTheirOverridesDocumentedSource() {
ledger.migrations.forEach {
assertEquals(
FixtureMigration.scenario(it.override, it.ordered, it.options),
read(it.scenario),
)
}
ledger.migrations.forEach { assertEquals(FixtureMigration.scenario(it), read(it.scenario)) }
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ class FormMigrationTest {
.map { it.fixture }
.toSet(),
)
assertEquals(4, report.overrides.size)
assertEquals(3, report.overrides.size)
assertEquals(0, report.unresolved.size)
}

Expand Down
6 changes: 5 additions & 1 deletion core/src/test/java/dev/morphia/test/OperatorCaseRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ private void run(OperatorCase operatorCase, String kind, Shape shape,
referenceResults = without(ignore, referenceResults);
morphiaResults = without(ignore, morphiaResults);
BsonDocument expected = scenario.getDocument("expected");
// A reviewed page error: the page prints results the server does not return.
if (skipped.containsKey("published")) {
return;
}
if (expected.containsKey("documents")) {
List<BsonValue> published = without(ignore, expected.getArray("documents").getValues());
if (!StrictBson.equal(published, morphiaResults, ordered, unordered)) {
Expand Down Expand Up @@ -367,7 +371,7 @@ private static void supported(OperatorCase operatorCase, BsonDocument scenario)
unsupported.add("scenario fields " + scenario.keySet());
}
BsonDocument skipped = scenario.getDocument("skipped", new BsonDocument());
if (!Set.of("serialization", "results").containsAll(skipped.keySet())
if (!Set.of("serialization", "results", "published").containsAll(skipped.keySet())
|| skipped.values().stream().anyMatch(reason -> !reason.isString() || reason.asString().getValue().isBlank())) {
unsupported.add("skipped " + skipped);
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading