Fix base parts not generating

This commit is contained in:
2026-05-17 15:33:21 +02:00
parent b5a3a715a4
commit 92770bbaa0
7 changed files with 38 additions and 71 deletions
@@ -136,11 +136,13 @@ The superseded implementation was correct only if all of the following were true
- `COSTMODIFIER = 0`
- `ACBONUS = 0.00`
6. When configured, rows without discovered models are emitted as dense null
6. Authored base rows remain exposed. Authored `ACBONUS = ****` rows remain
null unless model discovery activates the row.
7. Dense gaps without authored rows or discovered models are emitted as null
rows with `COSTMODIFIER = ****` and `ACBONUS = ****`.
7. File overrides are applied after discovery and take precedence.
8. The final output includes all eligible existing models present in the manifest.
9. Discovery does not require a sibling local `sow-assets` checkout or a Git clone.
8. File overrides are applied after discovery and take precedence.
9. The final output includes all eligible existing models present in the manifest.
10. Discovery does not require a sibling local `sow-assets` checkout or a Git clone.
---
+4 -10
View File
@@ -474,7 +474,9 @@ func normalizePartsRowsACBonus(collected []nativeCollectedDataset, cfg project.P
}
}
rowID, ok := cloned["id"].(int)
if ok {
if isUnsetPartValue(cloned["ACBONUS"]) {
cloned["COSTMODIFIER"] = nullValue
} else if ok {
if value, configured := configuredPartsRowsACBonusValue(rowID, dataset.Dataset.Name, cfg); configured {
cloned["ACBONUS"] = value
}
@@ -663,15 +665,7 @@ func augmentWithAutogeneratedPartsWithConfig(collected []nativeCollectedDataset,
// Add rows for discovered IDs that don't already exist.
newRows := make([]map[string]any, 0, len(dataset.Rows))
for _, row := range dataset.Rows {
rowID, ok := row["id"].(int)
if cfg.NullUndiscoveredRows && ok {
if _, discovered := ids[rowID]; !discovered {
continue
}
}
newRows = append(newRows, row)
}
newRows = append(newRows, dataset.Rows...)
for rowID := range ids {
if row, exists := existingRows[rowID]; exists {
+12 -4
View File
@@ -10533,6 +10533,7 @@ func TestNormalizePartsRowsACBonusUsesConfiguredPolicyBeforeOverrides(t *testing
Rows: []map[string]any{
{"id": 1, "COSTMODIFIER": "5", "ACBONUS": "0.90"},
{"id": 999, "COSTMODIFIER": "0", "ACBONUS": "****"},
{"id": 1000, "COSTMODIFIER": "0", "ACBONUS": "0.00"},
},
},
{
@@ -10569,8 +10570,11 @@ func TestNormalizePartsRowsACBonusUsesConfiguredPolicyBeforeOverrides(t *testing
if got := beltRows[1]["ACBONUS"]; got != "9.98" {
t.Fatalf("expected authored belt ACBONUS to be replaced with computed sort key 9.98, got %v", got)
}
if got := beltRows[999]["ACBONUS"]; got != "0.00" {
t.Fatalf("expected highest belt row to sort at 0.00, got %v", got)
if got := beltRows[999]["ACBONUS"]; got != "****" {
t.Fatalf("expected authored null belt row to remain ****, got %v", got)
}
if got := beltRows[1000]["ACBONUS"]; got != "-0.01" {
t.Fatalf("expected non-null high belt row to use computed sort key, got %v", got)
}
chestRows := rowsByID(got[1].Rows)
if got := chestRows[14]["ACBONUS"]; got != "0.00" {
@@ -10588,8 +10592,9 @@ func TestNormalizePartsRowsACBonusSupportsAscendingRowIDSortKey(t *testing.T) {
Dataset: nativeDataset{Name: "parts/belt", OutputName: "parts_belt.2da"},
Columns: []string{"COSTMODIFIER", "ACBONUS"},
Rows: []map[string]any{
{"id": 1, "COSTMODIFIER": "0", "ACBONUS": "****"},
{"id": 117, "COSTMODIFIER": "0", "ACBONUS": "****"},
{"id": 1, "COSTMODIFIER": "0", "ACBONUS": "0.00"},
{"id": 117, "COSTMODIFIER": "0", "ACBONUS": "0.00"},
{"id": 118, "COSTMODIFIER": "0", "ACBONUS": "****"},
},
},
}
@@ -10611,6 +10616,9 @@ func TestNormalizePartsRowsACBonusSupportsAscendingRowIDSortKey(t *testing.T) {
if got := beltRows[117]["ACBONUS"]; got != "1.17" {
t.Fatalf("expected high belt row to get higher sort key 1.17, got %v", got)
}
if got := beltRows[118]["ACBONUS"]; got != "****" {
t.Fatalf("expected authored null belt row to remain ****, got %v", got)
}
}
func rowsByID(rows []map[string]any) map[int]map[string]any {