Skip to content

Commit 09bf920

Browse files
2-meancursoragent
andcommitted
refactor: trim spectral compatibility aliases after Gate 6
Move graph vector helper to graphfl source module, canonicalize aggregation targets, and stop mirroring spectral_filter_strength in new result metadata. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 450e3a8 commit 09bf920

30 files changed

Lines changed: 377 additions & 397 deletions
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"gate": "5d-prep",
2+
"gate": "0",
33
"pass": true,
44
"failed_checks": [],
5-
"verified_at": "2026-05-22T13:33:39.051204+00:00",
6-
"commit_sha": "4fa973671850982b5366b976c0599ac2976e4761"
5+
"verified_at": "2026-05-22T13:45:01.273462+00:00",
6+
"commit_sha": "450e3a80659c8a5a0e97666c3532346990c02531"
77
}

docs/maintenance/rename-inventory.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ legacy surface is discovered.
1818
| `general_suite_*` | old suite artifact filename | compatibility mirror; new writes emit `vision_suite_*` first via `write_suite_summary_artifacts()` until Gate 6 |
1919
| `result_vision_*`, `vision_suite_*` | canonical output filenames | prefer in new docs, scripts, and directory listings |
2020
| `graphfl_lab/experiments/suites/vision/artifacts.py` | artifact discovery helper | canonical-first readers for plots/smoke/sweeps |
21-
| `spectral_filter_strength` | old config/result key | schema policy in Gate 2, removal in Gate 6 |
21+
| `graph_filter_strength` | canonical config/result key | prefer in new writes; JSON may still alias `spectral_filter_strength` via `config_io` |
22+
| `spectral_filter_strength` | old config/result key | JSON alias only after Gate 6 phase 2; not written to new traces |
2223
| `spectral_filtered_*` | old aggregation target/result spelling | internal migration in Gate 3, removal in Gate 6 |
2324
| `ours_spectral_filtered_*` | old suite token | keep through deprecation |
2425
| `_spectral_only`, `_speconly` | old suite suffixes | keep through deprecation |

docs/removed-materials.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,24 @@ Execution log (findings and decisions): [`docs/maintenance/cleanup-status.md`](m
3535

3636
Legacy experiment trees with old filenames stay **gitignored** (see root `.gitignore`).
3737

38+
## Post-Gate-6 Phase 2 — Spectral Alias Trim (2026-05-22)
39+
40+
| Removed / changed | Replacement / policy |
41+
|---|---|
42+
| `graphfl_lab/graph/sources/spectral.py` | `graph_vectors_for_graphfl` in `graph/sources/graphfl.py` |
43+
| `graph_vectors_for_spectral` export | removed; import `graph_vectors_for_graphfl` |
44+
| Strategy ctor / trace field `spectral_filter_strength` | `graph_filter_strength` only in new writes |
45+
| Dual CLI `Namespace` setattr for filter strength | JSON key alias in `config_io` only |
46+
| Explicit `spectral_filtered_*` branches in targets | `canonical_aggregation_target()` input map |
47+
3848
## Remaining Compatibility Debt
3949

4050
| Surface | Status | Notes |
4151
|---|---|---|
42-
| Runtime `spectral_filtered_*` aggregation **input** aliases | retained | lifecycle/strategy accept legacy target strings |
43-
| `spectral_filter_strength` in traces / JSON config keys | retained | maps to `graph_filter_strength` |
52+
| Runtime `spectral_filtered_*` aggregation **input** aliases | retained | `targets.canonical_aggregation_target()` + `config_io` JSON keys |
53+
| `spectral_filter_strength` JSON config key | retained | read alias → `graph_filter_strength`; not written to new result meta |
4454
| `ours_spectral_filtered_*` in **reporting** result tags | retained | pairs historical run labels only; not suite launch tokens |
55+
| Diagnostic trace keys `spectral_filter_gain_*` | retained | metric names, not public rename surface |
4556

4657
## Tombstones
4758

graphfl_lab/app/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,6 @@ def args_from_context(context: Context) -> Namespace:
194194
fixed_tau=float(cfg["fixed-tau"]),
195195
tau_source=str(cfg["tau-source"]),
196196
graph_filter_strength=float(cfg["graph-filter-strength"]),
197-
spectral_filter_strength=float(cfg["graph-filter-strength"]),
198197
client_update_ema_alpha=float(cfg["client-update-ema-alpha"]),
199198
diagnostic_only=bool_value(cfg["diagnostic-only"]),
200199
e_std_threshold=float(cfg["e-std-threshold"]),

graphfl_lab/config_io.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111

1212
ARG_DEST_ALIASES = {
1313
"spectral_filter_strength": "graph_filter_strength",
14+
"spectral_filtered_update": "graph_filtered_update",
15+
"spectral_filtered_ema_update": "graph_filtered_ema_update",
16+
"spectral_filtered_weight": "graph_filtered_weight",
1417
}
1518

1619

@@ -114,15 +117,7 @@ def parse_args_with_config(parser: argparse.ArgumentParser) -> argparse.Namespac
114117

115118

116119
def normalize_arg_aliases(args: argparse.Namespace) -> argparse.Namespace:
117-
"""Populate canonical/compatibility argparse attributes after parsing."""
118-
if hasattr(args, "graph_filter_strength") and not hasattr(
119-
args, "spectral_filter_strength"
120-
):
121-
setattr(args, "spectral_filter_strength", args.graph_filter_strength)
122-
if hasattr(args, "spectral_filter_strength") and not hasattr(
123-
args, "graph_filter_strength"
124-
):
125-
setattr(args, "graph_filter_strength", args.spectral_filter_strength)
120+
"""Normalize argparse namespace after parsing (canonical fields only)."""
126121
return args
127122

128123

graphfl_lab/experiments/cora/single_run.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,6 @@ def build_meta(args, client_class_distribution: List[List[int]], out_path: Path)
416416
"fixed_tau": float(args.fixed_tau),
417417
"tau_source": args.tau_source,
418418
"graph_filter_strength": float(args.graph_filter_strength),
419-
"spectral_filter_strength": float(args.graph_filter_strength),
420419
"client_update_ema_alpha": float(args.client_update_ema_alpha),
421420
},
422421

@@ -485,7 +484,6 @@ def build_meta(args, client_class_distribution: List[List[int]], out_path: Path)
485484
"fixed_tau": float(args.fixed_tau),
486485
"tau_source": args.tau_source,
487486
"graph_filter_strength": float(args.graph_filter_strength),
488-
"spectral_filter_strength": float(args.graph_filter_strength),
489487
"min_client_weight": float(args.min_client_weight),
490488
"diagnostic_only": bool(args.diagnostic_only),
491489
"partition": args.partition,

graphfl_lab/experiments/suites/vision/features.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ def trace_value(key: str, default: str = "") -> str:
5858
"server_optimizer": trace_value("server_optimizer"),
5959
"tau_source_used": trace_value("tau_source_used"),
6060
"graph_filter_strength": trace_value(
61-
"graph_filter_strength", trace_value("spectral_filter_strength")
62-
),
63-
"spectral_filter_strength": trace_value(
64-
"spectral_filter_strength", trace_value("graph_filter_strength")
61+
"graph_filter_strength", trace_value("graph_filter_strength")
6562
),
6663
"client_update_ema_alpha": trace_value("client_update_ema_alpha"),
6764
"client_update_ema_source": trace_value("client_update_ema_source"),

graphfl_lab/experiments/suites/vision/summary.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ def build_summary_rows(rows: List[Dict[str, Any]], args: Namespace) -> List[Dict
3535
def gmean(key: str):
3636
return safe_mean([x.get(key) for x in group])
3737

38-
def gfirst(key: str) -> str:
38+
def gfirst(key: str, fallback_key: str | None = None) -> str:
3939
for x in group:
4040
value = x.get(key)
4141
if value not in (None, ""):
4242
return str(value)
43+
if fallback_key is not None:
44+
for x in group:
45+
value = x.get(fallback_key)
46+
if value not in (None, ""):
47+
return str(value)
4348
return ""
4449

4550
row_base = {
@@ -66,8 +71,7 @@ def gfirst(key: str) -> str:
6671
"aggregation_target_used": gfirst("aggregation_target_used"),
6772
"server_optimizer": gfirst("server_optimizer"),
6873
"tau_source_used": gfirst("tau_source_used"),
69-
"graph_filter_strength": gfirst("graph_filter_strength"),
70-
"spectral_filter_strength": gfirst("spectral_filter_strength"),
74+
"graph_filter_strength": gfirst("graph_filter_strength", "spectral_filter_strength"),
7175
"client_update_ema_alpha": gfirst("client_update_ema_alpha"),
7276
"client_update_ema_source": gfirst("client_update_ema_source"),
7377
"server_learning_rate": gfirst("server_learning_rate"),

graphfl_lab/experiments/vision/single_run.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ def build_vision_meta(
116116
"fixed_tau": float(args.fixed_tau),
117117
"tau_source": args.tau_source,
118118
"graph_filter_strength": float(args.graph_filter_strength),
119-
"spectral_filter_strength": float(args.graph_filter_strength),
120119
"client_update_ema_alpha": float(args.client_update_ema_alpha),
121120
},
122121
"aggregation": {
@@ -197,7 +196,6 @@ def build_vision_meta(
197196
"diagnostic_only": bool(args.diagnostic_only),
198197
"tau_source": args.tau_source,
199198
"graph_filter_strength": float(args.graph_filter_strength),
200-
"spectral_filter_strength": float(args.graph_filter_strength),
201199
"client_update_ema_alpha": float(args.client_update_ema_alpha),
202200
"graph_smoothing_lambda": float(getattr(args, "graph_smoothing_lambda", 0.05)),
203201
"graph_smoothing_operator": str(

graphfl_lab/graph/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
graph_source_names,
6565
graph_vectors_for_fedsim,
6666
graph_vectors_for_graphfl,
67-
graph_vectors_for_spectral,
6867
normalize_key,
6968
register_graph_source,
7069
unregister_graph_source,
@@ -101,7 +100,6 @@
101100
"pfedgraph_qp_graph",
102101
"graph_vectors_for_fedsim",
103102
"graph_vectors_for_graphfl",
104-
"graph_vectors_for_spectral",
105103
"apply_graph_preset_to_namespace",
106104
"graph_method_names",
107105
"graph_preset_names",

0 commit comments

Comments
 (0)