Skip to content

Commit d43011c

Browse files
committed
fix: align CLI composition chain display with top-down base-finding
Show only contributing layers (base and above) in preset resolve output, matching resolve_content top-down semantics. Layers below the effective base are omitted since they do not contribute.
1 parent 9caf29c commit d43011c

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

src/specify_cli/__init__.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2620,19 +2620,22 @@ def preset_resolve(
26202620
else:
26212621
console.print(" [dim]Final output is composed from multiple preset layers; the path above is the highest-priority contributing layer.[/dim]")
26222622
console.print("\n [bold]Composition chain:[/bold]")
2623-
# Compute the effective base: the last consecutive replace layer
2624-
# from the bottom before the first non-replace (same logic as
2625-
# PresetResolver.resolve_content).
2626-
reversed_display = list(reversed(layers))
2627-
effective_base_idx = 0
2628-
for idx, lyr in enumerate(reversed_display):
2623+
# Compute the effective base: first replace layer scanning from
2624+
# highest priority (matching resolve_content top-down logic).
2625+
# Only show layers from the base upward (lower layers are ignored).
2626+
effective_base_idx = None
2627+
for idx, lyr in enumerate(layers):
26292628
if lyr["strategy"] == "replace":
26302629
effective_base_idx = idx
2631-
else:
26322630
break
2633-
for i, layer in enumerate(reversed_display):
2631+
# Show only contributing layers (base and above)
2632+
if effective_base_idx is not None:
2633+
contributing = layers[:effective_base_idx + 1]
2634+
else:
2635+
contributing = layers
2636+
for i, layer in enumerate(reversed(contributing)):
26342637
strategy_label = layer["strategy"]
2635-
if strategy_label == "replace" and i == effective_base_idx:
2638+
if strategy_label == "replace" and i == 0:
26362639
strategy_label = "base"
26372640
console.print(f" {i + 1}. [{strategy_label}] {layer['source']}{layer['path']}")
26382641
else:

0 commit comments

Comments
 (0)