Skip to content

Commit 4ea4847

Browse files
Shawclaude
andcommitted
fix(chip): clear ruff lint+format and shellcheck on chip scripts
Resolves the e1-chip docker-regression failures: - Remove unused locals (y_front, routing, plugin_java) - Sort imports in test_linux_memory_platform_contract.py - Merge nested with-statements (SIM117) - Apply ruff format across 9 chip scripts - Disable SC2317 on cleanup() in run_pretraining.sh (invoked via trap) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 3e7cd9e commit 4ea4847

10 files changed

Lines changed: 165 additions & 80 deletions

packages/chip/scripts/alphachip/run_pretraining.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ TRAIN_LOG="${ROOT_DIR}/train.log"
131131
: >"${COLLECT_LOG}"
132132
: >"${TRAIN_LOG}"
133133

134-
# shellcheck disable=SC2329
134+
# shellcheck disable=SC2317,SC2329
135135
cleanup() {
136136
if [ -n "${REVERB_PID:-}" ]; then kill "${REVERB_PID}" 2>/dev/null || true; fi
137137
if [ -n "${COLLECT_PID:-}" ]; then kill "${COLLECT_PID}" 2>/dev/null || true; fi

packages/chip/scripts/check_android_app_runtime_contract.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -237,17 +237,17 @@ def add_if(
237237
def run_check(args: argparse.Namespace) -> dict[str, object]:
238238
findings: list[Finding] = []
239239
required_paths = (
240-
APP_GRADLE,
241-
APP_MANIFEST,
242-
AGENT_SERVICE_JAVA,
243-
APP_JAVA_DIR,
244-
NATIVE_BRIDGE_JAVA,
245-
PREBUILT_APK if args.apk is None else Path(args.apk),
246-
*VENDOR_PERMISSION_XMLS,
247-
VENDOR_OVERLAY,
248-
VENDOR_COMMON_MK,
249-
*CHIP_AOSP_SCRIPTS,
250-
)
240+
APP_GRADLE,
241+
APP_MANIFEST,
242+
AGENT_SERVICE_JAVA,
243+
APP_JAVA_DIR,
244+
NATIVE_BRIDGE_JAVA,
245+
PREBUILT_APK if args.apk is None else Path(args.apk),
246+
*VENDOR_PERMISSION_XMLS,
247+
VENDOR_OVERLAY,
248+
VENDOR_COMMON_MK,
249+
*CHIP_AOSP_SCRIPTS,
250+
)
251251
missing = [
252252
path
253253
for path in required_paths
@@ -369,9 +369,7 @@ def run_check(args: argparse.Namespace) -> dict[str, object]:
369369
scripts_use_legacy_self_status = "/api/agent/self-status" in script_endpoint_union
370370
add_if(
371371
findings,
372-
app_health_ok
373-
and scripts_use_legacy_self_status
374-
and not scripts_use_app_health,
372+
app_health_ok and scripts_use_legacy_self_status and not scripts_use_app_health,
375373
"android_agent_health_contract_mismatch",
376374
"chip smoke scripts check /api/agent/self-status while the Android service watchdog uses /api/health",
377375
json.dumps(

packages/chip/scripts/check_e1_phone_board_package.py

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1930,8 +1930,13 @@ def check_routed_release_plan() -> None:
19301930
raise SystemExit(f"unexpected routed release plan status: {plan['status']}")
19311931
if plan["release_target"] != "EVT1-routed-first-article":
19321932
raise SystemExit(f"unexpected routed release target: {plan['release_target']}")
1933-
if "board/kicad/e1-phone/routed-release-plan.yaml" not in manifest["current_artifacts"]["planning"]:
1934-
raise SystemExit("artifact manifest must list routed-release-plan.yaml as planning evidence")
1933+
if (
1934+
"board/kicad/e1-phone/routed-release-plan.yaml"
1935+
not in manifest["current_artifacts"]["planning"]
1936+
):
1937+
raise SystemExit(
1938+
"artifact manifest must list routed-release-plan.yaml as planning evidence"
1939+
)
19351940
for rel in [
19361941
"board/kicad/e1-phone/manufacturing-closure.yaml",
19371942
"board/kicad/e1-phone/production-readiness.yaml",
@@ -2023,15 +2028,22 @@ def check_routed_release_plan() -> None:
20232028
for domain, item in requirements.items():
20242029
if not item.get("required_nets") or not item.get("required_evidence"):
20252030
raise SystemExit(f"routed release domain is too weak: {domain}")
2026-
if requirements["manufacturing"]["required_nets"] != production["factory_test_coverage_required"]["power_rails"]:
2027-
raise SystemExit("routed release manufacturing nets diverge from factory power rail coverage")
2031+
if (
2032+
requirements["manufacturing"]["required_nets"]
2033+
!= production["factory_test_coverage_required"]["power_rails"]
2034+
):
2035+
raise SystemExit(
2036+
"routed release manufacturing nets diverge from factory power rail coverage"
2037+
)
20282038
for net in routing["power_integrity"]["test_points_required"]:
20292039
if net not in plan["power_thermal_release_dependency"]["required_test_points"]:
20302040
raise SystemExit(f"routed release power dependency missing test point {net}")
20312041
if plan["rf_release_dependency"]["required_rf_nets"] != rf["required_rf_nets"]:
20322042
raise SystemExit("routed release RF dependency diverges from RF closure")
20332043
for required in ["VNA", "SAR", "carrier"]:
2034-
if not any(required in item for item in plan["rf_release_dependency"]["requires_measurements"]):
2044+
if not any(
2045+
required in item for item in plan["rf_release_dependency"]["requires_measurements"]
2046+
):
20352047
raise SystemExit(f"routed release RF dependency missing measurement {required}")
20362048

20372049
for flag in ["ready_to_fabricate", "ready_for_enclosure", "ready_for_factory_test"]:

packages/chip/scripts/check_manufacturing_artifacts.py

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,9 @@ def validate_e1_phone_manifest(path: Path, release: bool) -> list[str]:
430430
target = {}
431431
for key, expected in expected_target.items():
432432
if target.get(key) != expected:
433-
failures.append(f"{rel_manifest}: design_target.{key} expected {expected}, got {target.get(key)}")
433+
failures.append(
434+
f"{rel_manifest}: design_target.{key} expected {expected}, got {target.get(key)}"
435+
)
434436
radios = target.get("radios", [])
435437
for radio in ["5g_redcap_cellular", "wifi_6e", "bluetooth_5_3"]:
436438
if radio not in radios:
@@ -449,7 +451,9 @@ def validate_e1_phone_manifest(path: Path, release: bool) -> list[str]:
449451
}
450452
missing_groups = sorted(required_groups - set(groups))
451453
if missing_groups:
452-
failures.append(f"{rel_manifest}: missing current_artifacts groups: {', '.join(missing_groups)}")
454+
failures.append(
455+
f"{rel_manifest}: missing current_artifacts groups: {', '.join(missing_groups)}"
456+
)
453457
required_paths = {
454458
"board/kicad/e1-phone/routed-release-plan.yaml",
455459
"board/kicad/e1-phone/manufacturing-closure.yaml",
@@ -478,7 +482,14 @@ def validate_e1_phone_manifest(path: Path, release: bool) -> list[str]:
478482
if not isinstance(gates, dict):
479483
failures.append(f"{rel_manifest}: release_gates must be a mapping")
480484
gates = {}
481-
required_gates = {"schematic", "routed_pcb", "enclosure", "power_thermal", "rf_si", "manufacturing"}
485+
required_gates = {
486+
"schematic",
487+
"routed_pcb",
488+
"enclosure",
489+
"power_thermal",
490+
"rf_si",
491+
"manufacturing",
492+
}
482493
missing_gates = sorted(required_gates - set(gates))
483494
if missing_gates:
484495
failures.append(f"{rel_manifest}: missing release gates: {', '.join(missing_gates)}")
@@ -494,25 +505,38 @@ def validate_e1_phone_manifest(path: Path, release: bool) -> list[str]:
494505
if not as_list(evidence):
495506
failures.append(f"{rel_manifest}.release_gates.{gate_name}: missing required_evidence")
496507
if release:
497-
failures.append(f"{rel_manifest}.release_gates.{gate_name}: release gate remains missing")
508+
failures.append(
509+
f"{rel_manifest}.release_gates.{gate_name}: release gate remains missing"
510+
)
498511

499512
routed_plan_path = repo_path("board/kicad/e1-phone/routed-release-plan.yaml")
500513
if routed_plan_path.is_file():
501514
routed_plan = yaml.safe_load(routed_plan_path.read_text())
502-
if routed_plan.get("status") != "blocked_routed_release_requires_real_route_and_supplier_outputs":
515+
if (
516+
routed_plan.get("status")
517+
!= "blocked_routed_release_requires_real_route_and_supplier_outputs"
518+
):
503519
failures.append(f"{rel_manifest}: routed release plan status is not fail-closed")
504520
outputs = routed_plan.get("required_release_output_manifest", {})
505521
if not isinstance(outputs, dict) or len(outputs) < 20:
506-
failures.append(f"{rel_manifest}: routed release plan must track at least 20 release outputs")
522+
failures.append(
523+
f"{rel_manifest}: routed release plan must track at least 20 release outputs"
524+
)
507525
else:
508526
for output_name, output in outputs.items():
509527
if not isinstance(output, dict):
510-
failures.append(f"{rel_manifest}: routed output {output_name} must be a mapping")
528+
failures.append(
529+
f"{rel_manifest}: routed output {output_name} must be a mapping"
530+
)
511531
continue
512532
if output.get("present") is not False or output.get("release_required") is not True:
513-
failures.append(f"{rel_manifest}: routed output {output_name} must be blocked and required")
533+
failures.append(
534+
f"{rel_manifest}: routed output {output_name} must be blocked and required"
535+
)
514536
if release:
515-
failures.append(f"{rel_manifest}: release output remains missing: {output_name}")
537+
failures.append(
538+
f"{rel_manifest}: release output remains missing: {output_name}"
539+
)
516540
else:
517541
failures.append(f"{rel_manifest}: routed release plan is missing")
518542

packages/chip/scripts/generate_e1_phone_cad.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ def usb_c_seal_specs(params: dict[str, Any]) -> list[dict[str, Any]]:
340340
height = float(params["device"]["envelope_mm"][1])
341341
aperture_w = 10.2
342342
aperture_z = 3.6
343-
y_front = -height / 2 - 0.08
343+
-height / 2 - 0.08
344344
y_inside = -height / 2 + 0.32
345345
z_center = -1.45
346346
return [
@@ -4574,10 +4574,8 @@ def write_camera_validation_artifacts(
45744574
"pass": bool(
45754575
interface_cases.get("camera_glass_and_under_glass_strategy", {}).get("pass")
45764576
)
4577-
and sum(1 for name in part_names if name.startswith("rear_camera_cover_adhesive_"))
4578-
>= 4
4579-
and sum(1 for name in part_names if name.startswith("rear_camera_light_baffle_"))
4580-
>= 2
4577+
and sum(1 for name in part_names if name.startswith("rear_camera_cover_adhesive_")) >= 4
4578+
and sum(1 for name in part_names if name.startswith("rear_camera_light_baffle_")) >= 2
45814579
and "front_camera_black_mask_window" in part_names,
45824580
},
45834581
]

packages/chip/scripts/generate_e1_phone_routed_release_plan.py

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def main() -> int:
5555
manufacturing = load_yaml(MANUFACTURING)
5656
production = load_yaml(PRODUCTION)
5757
manifest = load_yaml(MANIFEST)
58-
routing = load_yaml(ROUTING)
58+
load_yaml(ROUTING)
5959
pinout = load_yaml(PINOUT)
6060
procurement = load_yaml(PROCUREMENT)
6161
enclosure = load_yaml(ENCLOSURE)
@@ -197,7 +197,13 @@ def main() -> int:
197197
],
198198
},
199199
"display_touch": {
200-
"required_nets": ["DSI_CLK_P", "DSI_D0_P", "DISP_AVDD_5V5", "DISP_AVEE_N5V5", "TOUCH_I2C_SCL"],
200+
"required_nets": [
201+
"DSI_CLK_P",
202+
"DSI_D0_P",
203+
"DISP_AVDD_5V5",
204+
"DISP_AVEE_N5V5",
205+
"TOUCH_I2C_SCL",
206+
],
201207
"required_evidence": [
202208
"selected display/touch FPC pinout converted into real KiCad connector symbol and footprint",
203209
"MIPI D-PHY post-route length/impedance review",
@@ -213,7 +219,13 @@ def main() -> int:
213219
],
214220
},
215221
"radios": {
216-
"required_nets": ["CELL_RF_MAIN", "CELL_RF_DIV", "CELL_GNSS_RF", "WIFI_BT_RF0", "WIFI_BT_RF1"],
222+
"required_nets": [
223+
"CELL_RF_MAIN",
224+
"CELL_RF_DIV",
225+
"CELL_GNSS_RF",
226+
"WIFI_BT_RF0",
227+
"WIFI_BT_RF1",
228+
],
217229
"required_evidence": [
218230
"cellular and Wi-Fi/Bluetooth module reference layout adherence",
219231
"50 ohm feed, matching, conducted access, and antenna keepout closure",
@@ -235,7 +247,15 @@ def main() -> int:
235247
],
236248
},
237249
"split_interconnect": {
238-
"required_nets": ["USB_DP", "USB_DN", "VBUS", "SYS", "I2S_BCLK", "PDM_CLK", "HAPTIC_OUT"],
250+
"required_nets": [
251+
"USB_DP",
252+
"USB_DN",
253+
"VBUS",
254+
"SYS",
255+
"I2S_BCLK",
256+
"PDM_CLK",
257+
"HAPTIC_OUT",
258+
],
239259
"required_evidence": [
240260
"top and bottom connector supplier land patterns and mating-height stack",
241261
"flex cable pinout, stiffener, bend, strain relief, and continuity test",
@@ -249,7 +269,14 @@ def main() -> int:
249269
],
250270
},
251271
"compute_storage": {
252-
"required_nets": ["LPDDR_CK_P", "LPDDR_DQS_P", "UFS_REFCLK_P", "UFS_TX_P", "UFS_RX_P", "JTAG_TCK"],
272+
"required_nets": [
273+
"LPDDR_CK_P",
274+
"LPDDR_DQS_P",
275+
"UFS_REFCLK_P",
276+
"UFS_TX_P",
277+
"UFS_RX_P",
278+
"JTAG_TCK",
279+
],
253280
"required_evidence": [
254281
"SoC, LPDDR, UFS, boot strap, and debug exact footprints",
255282
"post-route memory/storage SI and boot-mode bring-up coverage",

packages/chip/scripts/test_android_app_runtime_contract.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,17 @@ def _patch_paths(self, tmp: Path, apk_entries: list[str]):
4848
""",
4949
)
5050
service_java = write(
51-
tmp / "app-core/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAgentService.java",
51+
tmp
52+
/ "app-core/platforms/android/app/src/main/java/ai/elizaos/app/ElizaAgentService.java",
5253
'class ElizaAgentService { static final String HEALTH_URL = "http://127.0.0.1:31337/api/health"; }\n',
5354
)
54-
plugin_java = write(
55+
write(
5556
tmp / "app-core/platforms/android/app/src/main/java/ai/elizaos/app/AgentPlugin.java",
5657
'class AgentPlugin { String path = "/api/health"; }\n',
5758
)
5859
native_bridge_java = write(
59-
tmp / "app-core/platforms/android/app/src/main/java/ai/elizaos/app/ElizaNativeBridge.java",
60+
tmp
61+
/ "app-core/platforms/android/app/src/main/java/ai/elizaos/app/ElizaNativeBridge.java",
6062
"class ElizaNativeBridge { String getLocalAgentToken() { return null; } }\n",
6163
)
6264
apk = make_apk(tmp / "os/android/vendor/eliza/apps/Eliza/Eliza.apk", apk_entries)

packages/chip/scripts/test_generate_e1_phone_cad.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,9 @@ def test_evt0_phone_interface_validation_tracks_named_mechanical_interfaces(
421421
interfaces = {item["interface"] for item in report["interfaces"]}
422422

423423
assert report["status"] == "cad_interface_validation_pass"
424-
usb_case = next(item for item in report["interfaces"] if item["id"] == "usb_c_insertion_capture")
424+
usb_case = next(
425+
item for item in report["interfaces"] if item["id"] == "usb_c_insertion_capture"
426+
)
425427
assert usb_case["pass"]
426428
assert "usb_c_port_seal_stack" in usb_case["evidence"]
427429
assert {

0 commit comments

Comments
 (0)