Skip to content

Check Starlark contracts in the fork - #1

Draft
tamird wants to merge 24 commits into
mainfrom
type-contracts
Draft

tamird wants to merge 24 commits into
mainfrom
type-contracts

Conversation

@tamird

@tamird tamird commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Run the existing pull-request workflows for the Starlark contracts proposed upstream 1. This fork PR provides CI results while upstream workflows await approval.

Prepared by OpenAI's Codex on behalf of @tamird.

An attempt to (greatly) increase the legibility of the currently
inscrutible error message developers receive when the configured Xcode
is not available locally or remotely.

```text
Bazel couldn’t match the selected Xcode to this project’s supported versions:
  27.0 (build 27A266a)

Supported versions:
  26.5 (build 17F42)
  27.2 (build 27B5019j)

Detected locally:
  26.5 (build 17F42)
  27.0 (build 27A266a)
  27.2 (build 27B5019j)

Install a supported Xcode version and select it with xcode-select.
```

### Validation

- `bazel test //test:xcode_config_test` on Bazel 8.7.0, 9.0.0, 9.0.1,
and 9.2.0: all 51 tests pass on each release, including unsupported,
unknown, ambiguous, duplicate, and empty inventories, plus custom and
empty hints.
- Verified the failure against a consuming project's configuration and
checked the fallback when discovery fails.


A few examples:

<img width="1028" height="298" alt="CleanShot 2026-09-17 at 13 32 56@2x"
src="https://github.com/user-attachments/assets/17020745-7c5a-46e6-9d65-dcab9ae90770"
/>

<img width="1026" height="536" alt="CleanShot 2026-09-17 at 13 33 21@2x"
src="https://github.com/user-attachments/assets/065e5eb8-246f-4009-b698-efd88c376aef"
/>
tamird and others added 2 commits October 22, 2026 16:26
…on wrapper (bazelbuild#667)

Since outputs is required by actions.run, accessing it via
kwargs["outputs"] better reflects the API contract and allows static
analysis to recognize that the value is always present.
The documented `after` argument accepted string references but failed
when passed a `Label`, because companion-target construction called
string methods. Construct the companion with `same_package_label` so the
original repository and package identity survive calls from other
repositories.

---------

Co-authored-by: Adin Cebic <cebic.ad@gmail.com>
@tamird
tamird force-pushed the type-contracts branch 3 times, most recently from 0c4c40e to 9c0cd72 Compare October 22, 2026 16:41
tamird and others added 12 commits October 26, 2026 14:02
…ld#679)

With no `--visionos_cpus`, the test transition selected
`visionos_x86_64`.
[bazelbuild#293](bazelbuild#293) removed
that platform, so Bazel failed to analyze
`//test/test_data:visionos_binary`.

Use `sim_arm64` for the default split. The binary test checks that the
resulting Mach-O binary targets the visionOS simulator.

Codex for Tamir.
Bazel 7.4, the minimum supported release, exports the visionOS platform
type. Use that member directly in the dynamic toolchain helpers, as the
C++ toolchain configuration already does.
…zelbuild#672)

`XcodeVersionConfig.xcode_version()` can return a developer directory
rather than a dotted version. Comparing that string to
`minimum_xcode_version` aborts analysis with `unsupported comparison:
string <=> DottedVersion`.

Treat the directory as a recent Xcode, consistent with bazelbuild#666. A
configuration with no version still fails the condition; numeric
versions retain their existing comparison.
`xcode_execution_info` reads the Xcode configuration through the Apple
fragment. With `--incompatible_remove_ctx_apple_fragment`, its
late-bound attribute becomes `None` and provider lookup fails.

Use `apple_support.action_required_attrs()` to resolve the configuration
through `//xcode:version_config`, which selects the native or
Starlark-backed configuration. Remove the rule's unused Apple fragment
declaration.
The Windows installer entries were swapped: x64 hosts were falling back
to the 32-bit installer after a checksum failure on the mirror, and
32-bit hosts would have received an x64 binary. The unversioned upstream
`7zr.exe` has also already been replaced by 7-zip.org, so that fallback
was dead.
This was working under rules from rules_apple, but this is more correct
and there was already a helper for it.

Closes bazelbuild#676
Fix incremental archive creation when the archiver wrapper is invoked
with `ar q`.
The wrapper currently translates each invocation to `libtool -static
-o`, which replaces the archive with only the current batch of object
files.
Include the existing archive as an input when appending, preserving
objects from previous batches.

This fixes a regression introduced by bazelbuild#601.
In particular, cc-rs constructs archives in multiple `cq` / `cqD`
invocations, and the lost objects cause undefined-symbol linker failures
in native Rust dependencies such as ring.
The wrapper rename also means rules_rust no longer bypasses it using its
legacy `libtool` filename check.
No rules_rust change is needed to address this append regression.
…ld#677)

Both Apple toolchain repositories embed environment flags and include
directories in generated BUILD files. Quotes could make the package fail
to load, and backslashes could change the value. Xcode directories also
passed through a Crosstool helper that doubled literal percent signs,
producing a different absolute path.

Quote both kinds of values as Starlark string literals and retain the
original Xcode directory. The serializer leaves other control characters
unchanged because Bazel 7 accepts them literally but rejects some escape
sequences emitted by `repr`.
@tamird
tamird force-pushed the type-contracts branch 4 times, most recently from f4345a8 to 976acc6 Compare October 29, 2026 18:30
ma-oli and others added 4 commits November 2, 2026 09:50
…azelbuild#682)

In corner cases, Xcode versions may include non-numeric suffixes. These
need to be passed along as part of the SDK platform name, but must not
end up in the clang target triple, where they cannot be parsed.

Use only the numeric part of the minimum OS version for the triple, and
carry any suffix of the SDK version over to the SDK platform name.
Use source comments for ordinary functions and the DMG repository rule.
Describe platform providers and forwarded action keywords in companion
interfaces so callers and implementations use the same types.
Check repository and toolchain implementations and report findings for
the remaining tracked Starlark files. Validate the shell declarations
against Skylib 1.9.0. Apply the pending rules_cc parameter comments
only in the advisory workspace so native builds use the released C++
toolchain.
Describe the repository context and universal tool inputs in the source.
Let sty discover the other adjacent interfaces and select tracked files
through the shared action.
Place the Xcode context and locator types beside their consumers.
Declare the 7-Zip download fields and function parameters in the
implementation. Remove the three companion files and check these
modules directly.
Identify the native types each exceptional comment needs. Document
the language boundary beside its use.
Follow the repository’s release-tag convention for external actions.
Use the same checkout and checker revisions as the previous workflow.
Set one severity for the eleven strict diagnostics. Let the pinned
checker define the group so an upgrade can extend it without edits to
the project configuration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants