Skip to content
Merged
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
19 changes: 18 additions & 1 deletion src/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4720,7 +4720,8 @@ def _print_control_center_summary(snapshot: dict) -> None:
("deferred", "Safe to Defer"),
]
for lane, label in lane_labels:
items = [item for item in queue if item.get("lane") == lane]
lane_items = [item for item in queue if item.get("lane") == lane]
items = [item for item in lane_items if _should_print_control_center_item(item)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Filter the summary before hiding experiment rows

When the blocked/urgent pressure is caused by an experiment item, this filters only the lane rows after _print_control_center_summary has already printed the unfiltered operator_summary headline/what-to-do fields. In that case the default console can still announce live blocked/urgent work or recommend acting on the hidden experiment while showing no matching queue row, which defeats the new default-view suppression; the summary/handoff should be derived from the same visible queue or suppressed when its primary item is hidden.

Useful? React with 👍 / 👎.

if not items:
continue
print(f"\n{label}")
Expand All @@ -4737,6 +4738,9 @@ def _print_control_center_summary(snapshot: dict) -> None:
" Intent alignment: "
f"{item.get('intent_alignment')} ({item.get('intent_alignment_reason', 'No alignment reason is recorded yet.')})"
)
omitted_count = len(lane_items) - len(items)
if omitted_count > 0:
print(f" ({omitted_count} experiment/manual-only item(s) hidden from default view.)")
if recent_changes:
print("\nRecently Changed")
for item in recent_changes[:5]:
Expand All @@ -4748,6 +4752,19 @@ def _print_control_center_summary(snapshot: dict) -> None:
)


def _should_print_control_center_item(item: dict) -> bool:
catalog = item.get("portfolio_catalog") or {}
lifecycle = str(catalog.get("lifecycle_state") or "").strip().lower()
intended = str(catalog.get("intended_disposition") or "").strip().lower()
program = str(catalog.get("maturity_program") or "").strip().lower()
operating_path = str(item.get("operating_path") or catalog.get("operating_path") or "").strip().lower()
if lifecycle in {"experiment", "experimental"}:
return False
if intended == "experiment" or program == "experiment" or operating_path == "experiment":
return False
return True


def _fetch_repo_metadata(args, client: GitHubClient) -> tuple[list[RepoMetadata], list[dict]]:
if args.graphql and args.token:
from src.graphql_client import bulk_fetch_repos
Expand Down
21 changes: 21 additions & 0 deletions tests/test_cli_hardening.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,27 @@ def test_main_control_center_suppresses_queue_when_portfolio_truth_is_newer(
assert "Act now on StaleRepo" not in combined


def test_control_center_default_print_hides_experiment_items() -> None:
assert cli._should_print_control_center_item(
{
"repo": "active-repo",
"operating_path": "maintain",
"portfolio_catalog": {"lifecycle_state": "active"},
}
)
assert not cli._should_print_control_center_item(
{
"repo": "experiment-repo",
"operating_path": "experiment",
"portfolio_catalog": {
"lifecycle_state": "experimental",
"intended_disposition": "experiment",
"maturity_program": "experiment",
},
}
)


def test_main_control_center_requires_latest_report(monkeypatch):
args = _make_args(control_center=True)

Expand Down