Skip to content

doc-tests harness: pass --app-bundle-id (and other widget-cross-compile flags) so home-screen widget targets become exercisable #194

Closed

Description

@proggeramlug

Context

Surfaced during the v0.5.299 docs audit. The 8 home-screen-widget docs pages (docs/src/widgets/{overview,creating-widgets,components,configuration,data-fetching,platforms,watchos,wearos}.md) document a Widget({...}) API that is wired in HIR/codegen (crates/perry-hir/src/lower.rs::try_lower_widget_decl, plus perry-codegen-glance, perry-codegen-wear-tiles, perry-codegen-swiftui for the per-platform output).

The CLI accepts:

  • --target ios-widget
  • --target ios-widget-simulator
  • --target android-widget
  • --target watchos-widget
  • --target watchos-widget-simulator
  • --target wearos-tile

But the doc-tests harness can't drive these targets because:

  1. Each requires --app-bundle-id and the harness's cross_compile_one (crates/perry-doc-tests/src/main.rs:621) doesn't surface that flag.
  2. The host-LLVM target lowers Widget({...}) to a no-op at execution time, so a host run wouldn't certify any widget output even if the harness ran it.

Because of this, all 46 ,no-test fences across the 8 widget pages are kept un-verified — even though the codegen path is real and works when invoked manually with the right CLI flags.

What to do

Two pieces:

1. Banner-driven bundle-id config. Extend the per-example banner format (currently // platforms:, // targets:, // run: false) with a new directive:

// widget-bundle-id: com.example.perry-widget-demo

When the harness sees --target ios-widget (etc.) in the example's targets: list AND has a widget-bundle-id, invoke perry compile with --app-bundle-id filled in.

2. Cross-compile artifact check. Widget-target outputs are bundles or asset directories (.app / .apk / Tile.swift). Extend cross_compile_one's artifact-existence check to handle those layouts.

Acceptance criteria

  • An example with // targets: ios-widget, android-widget, wearos-tile + a widget-bundle-id banner cross-compiles cleanly under the doc-tests harness on a host with the right SDKs (Xcode for iOS/watchOS, Android NDK for android-widget/wearos-tile).
  • All 46 ,no-test fences across the 8 widget pages convert to verified {{#include}} extracts.
  • The widget pages drop their "Status: API wired but harness can't drive it" callouts.
  • CI matrix (.github/workflows/test.yml) gains a widget-targets job that runs the harness with the new flag plumbing on a macOS runner with Xcode installed.

Pointers

  • Cross-compile entrypoint: crates/perry-doc-tests/src/main.rs:621 (cross_compile_one)
  • Banner parser: crates/perry-doc-tests/src/main.rs:390+ (read_banner)
  • Per-target validator: crates/perry-doc-tests/src/main.rs:574+ (target_buildable_reason)
  • HIR widget lowering: crates/perry-hir/src/lower.rs::try_lower_widget_decl
  • Widget codegen crates: crates/perry-codegen-glance, crates/perry-codegen-wear-tiles, crates/perry-codegen-swiftui
  • Existing example with cross-compile targets banner: docs/examples/ui/styling/shadow.ts (uses // targets: ios-simulator, web, wasm).

Estimated size

Small — ~30-50 lines of harness code plus the matching CI step. The actual widget codegen is already done; this is purely test plumbing.

Activity

  1. added
    toolingDeveloper tooling, CI, tests, or release infrastructure
    on Apr 26, 2026
  2. added a commit that references this issue on Apr 26, 2026
    ab925c2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    toolingDeveloper tooling, CI, tests, or release infrastructure

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions