Skip to content

Commit 77d1bc8

Browse files
committed
fix: ensure all WasmComponentInfo providers include required fields
All component rules now provide complete WasmComponentInfo with: - component_type: "component" for all component types - imports/exports: empty arrays (to be populated by WIT parsing) - metadata: language-specific information and build details - profile: build optimization profile (release/debug/unknown) - profile_variants: empty dict for future multi-profile support This resolves analysis test failures where tests expected these fields but some component rules were only providing partial WasmComponentInfo providers. Fixed component rules: - js/defs.bzl: Added missing fields for JavaScript components - cpp/defs.bzl: Added missing fields for C++ components - rust/rust_wasm_component.bzl: Added missing profile fields - wkg/defs.bzl: Added missing profile fields for OCI components - wasm/wasm_signing.bzl: Preserve all fields from source component
1 parent 7c345eb commit 77d1bc8

35 files changed

+573
-319
lines changed

.github/workflows/bcr-compatibility.yml

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ jobs:
4545
echo "Test Target: $TEST_TARGET"
4646
echo "Timeout: ${TIMEOUT_MINUTES} minutes"
4747
echo "----------------------------------------"
48-
48+
4949
# Calculate timeout in seconds
5050
TIMEOUT_SECONDS=$((TIMEOUT_MINUTES * 60))
51-
51+
5252
# Run the hermetic build test
5353
docker run --rm -v "$(pwd):/workspace" -w /workspace \
5454
$DOCKER_IMAGE bash -c "
5555
set -euo pipefail
56-
56+
5757
echo '=== BCR Environment Details ==='
5858
echo 'OS Information:'
5959
cat /etc/os-release
@@ -68,14 +68,14 @@ jobs:
6868
which npm || echo 'npm: not found (expected - should be hermetic)'
6969
which go || echo 'go: not found (expected - should be hermetic)'
7070
echo
71-
71+
7272
echo '=== Bazel Setup ==='
7373
# Set up Bazel cache directory with proper permissions
7474
mkdir -p /tmp/bazel_cache
7575
chmod 755 /tmp/bazel_cache
7676
echo 'Cache directory created: /tmp/bazel_cache'
7777
echo
78-
78+
7979
echo '=== Testing Hermetic Build ==='
8080
echo \"Building target: $TEST_TARGET\"
8181
echo \"Timeout: ${TIMEOUT_SECONDS} seconds\"
@@ -84,33 +84,33 @@ jobs:
8484
echo ' ✓ Downloads and builds are hermetic'
8585
echo ' ✓ Build succeeds in minimal Docker environment'
8686
echo
87-
87+
8888
# Run the build with timeout
8989
timeout ${TIMEOUT_SECONDS} bazel --output_base=/tmp/bazel_cache build $TEST_TARGET
90-
90+
9191
BUILD_EXIT_CODE=\$?
9292
echo
93-
93+
9494
if [ \$BUILD_EXIT_CODE -eq 0 ]; then
9595
echo '✅ BCR HERMETIC BUILD SUCCESSFUL!'
9696
echo
9797
echo '=== Build Verification ==='
98-
98+
9999
# Find and verify any WASM outputs
100100
echo 'Looking for WebAssembly component outputs...'
101101
find bazel-bin -name '*.wasm' -type f | head -5 | while read wasm_file; do
102102
echo \"Found: \$wasm_file\"
103103
echo \" Size: \$(stat -c%s \"\$wasm_file\") bytes\"
104104
echo \" Type: \$(file \"\$wasm_file\" | cut -d: -f2)\"
105105
done
106-
106+
107107
wasm_count=\$(find bazel-bin -name '*.wasm' -type f | wc -l)
108108
if [ \$wasm_count -gt 0 ]; then
109109
echo \"✅ Successfully created \$wasm_count WebAssembly component(s)\"
110110
else
111111
echo 'ℹ️ No .wasm files found (may be expected for some targets)'
112112
fi
113-
113+
114114
elif [ \$BUILD_EXIT_CODE -eq 124 ]; then
115115
echo '❌ BCR BUILD TIMED OUT'
116116
echo \"Build exceeded ${TIMEOUT_MINUTES} minute limit\"
@@ -119,7 +119,7 @@ jobs:
119119
echo ' - Non-hermetic system tool dependencies'
120120
echo ' - Infinite loops in toolchain setup'
121121
exit 1
122-
122+
123123
else
124124
echo '❌ BCR BUILD FAILED'
125125
echo \"Exit code: \$BUILD_EXIT_CODE\"
@@ -145,35 +145,35 @@ jobs:
145145
echo "This test validates that all toolchains can be configured"
146146
echo "without requiring system tools or non-hermetic dependencies"
147147
echo "----------------------------------------"
148-
148+
149149
docker run --rm -v "$(pwd):/workspace" -w /workspace \
150150
$DOCKER_IMAGE bash -c "
151151
set -euo pipefail
152-
152+
153153
echo '=== Toolchain Configuration Test ==='
154154
mkdir -p /tmp/bazel_cache
155155
chmod 755 /tmp/bazel_cache
156-
156+
157157
# Test toolchain analysis (faster than full build)
158158
echo 'Testing toolchain resolution and configuration...'
159159
timeout 600 bazel --output_base=/tmp/bazel_cache query --output=label $DEFAULT_TARGET
160-
160+
161161
ANALYZE_EXIT_CODE=\$?
162-
162+
163163
if [ \$ANALYZE_EXIT_CODE -eq 0 ]; then
164164
echo '✅ All toolchains configured successfully in BCR environment'
165165
echo
166166
echo '=== Toolchain Information ==='
167-
167+
168168
# Show configured toolchains
169169
echo 'Registered toolchains:'
170170
bazel --output_base=/tmp/bazel_cache query --output=label 'kind(toolchain, //...)' | head -10 || echo 'Query failed'
171-
171+
172172
elif [ \$ANALYZE_EXIT_CODE -eq 124 ]; then
173173
echo '❌ Toolchain analysis timed out'
174174
echo 'This suggests toolchain setup is hanging or very slow'
175175
exit 1
176-
176+
177177
else
178178
echo '❌ Toolchain analysis failed'
179179
echo \"Exit code: \$ANALYZE_EXIT_CODE\"
@@ -218,7 +218,7 @@ jobs:
218218
echo "Platform: ${{ matrix.os }}"
219219
echo "Bazel: ${{ matrix.bazel_version }}"
220220
echo "----------------------------------------"
221-
221+
222222
# Use the targets from our presubmit.yml
223223
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
224224
echo "Testing Windows-compatible targets only"
@@ -256,17 +256,17 @@ jobs:
256256
echo "🚩 BCR Incompatible Flags Test"
257257
echo "Testing against upcoming Bazel breaking changes"
258258
echo "----------------------------------------"
259-
259+
260260
# Test with commonly problematic incompatible flags
261261
incompatible_flags=(
262262
"--incompatible_enable_cc_toolchain_resolution"
263263
"--incompatible_strict_action_env"
264264
"--incompatible_disable_starlark_host_transitions"
265265
)
266-
266+
267267
for flag in "${incompatible_flags[@]}"; do
268268
echo "Testing with flag: $flag"
269-
269+
270270
# Test basic build with the flag
271271
if bazel build --experimental_enable_bzlmod "$flag" //examples/basic:hello_component; then
272272
echo "✅ Compatible with $flag"
@@ -275,7 +275,7 @@ jobs:
275275
# Log the issue but don't fail (these are future-proofing tests)
276276
fi
277277
done
278-
278+
279279
echo "Incompatible flags testing completed"
280280
281281
bcr-metadata-validation:
@@ -294,17 +294,17 @@ jobs:
294294
echo "📋 BCR Metadata Validation"
295295
echo "Checking BCR-required files and structure"
296296
echo "----------------------------------------"
297-
297+
298298
# Check for required BCR files
299299
echo "Checking for required BCR files..."
300-
300+
301301
if [ -f ".bcr/presubmit.yml" ]; then
302302
echo "✅ presubmit.yml found"
303303
else
304304
echo "❌ presubmit.yml missing"
305305
exit 1
306306
fi
307-
307+
308308
# Validate presubmit.yml structure
309309
echo "Validating presubmit.yml structure..."
310310
if grep -q "bcr_test_module" .bcr/presubmit.yml; then
@@ -313,14 +313,14 @@ jobs:
313313
echo "❌ presubmit.yml missing bcr_test_module"
314314
exit 1
315315
fi
316-
316+
317317
if grep -q "matrix:" .bcr/presubmit.yml; then
318318
echo "✅ presubmit.yml has testing matrix"
319319
else
320320
echo "❌ presubmit.yml missing testing matrix"
321321
exit 1
322322
fi
323-
323+
324324
# Validate test module exists
325325
echo "Checking test module structure..."
326326
if [ -d "test_examples/basic" ]; then
@@ -329,18 +329,18 @@ jobs:
329329
echo "❌ Test module directory missing"
330330
exit 1
331331
fi
332-
332+
333333
if [ -f "test_examples/basic/BUILD.bazel" ]; then
334334
echo "✅ Test module has BUILD.bazel"
335335
else
336336
echo "❌ Test module missing BUILD.bazel"
337337
exit 1
338338
fi
339-
339+
340340
echo "BCR metadata validation completed successfully"
341341
342342
bcr-test-module-validation:
343-
name: BCR Test Module Validation
343+
name: BCR Test Module Validation
344344
runs-on: ubuntu-latest
345345
timeout-minutes: 15
346346

@@ -361,27 +361,27 @@ jobs:
361361
echo "🧪 BCR Test Module Validation"
362362
echo "Testing the BCR test module functionality"
363363
echo "----------------------------------------"
364-
364+
365365
# Test the specific module path from presubmit.yml
366366
echo "Testing BCR test module: test_examples/basic"
367-
367+
368368
# Build the test module targets
369369
bazel build //test_examples/basic:hello_component
370-
370+
371371
# Verify the test module can use the main module
372372
echo "Verifying test module can use rules_wasm_component..."
373-
373+
374374
# Check that the test module BUILD file references the main module correctly
375375
if grep -q "rules_wasm_component" test_examples/basic/BUILD.bazel; then
376376
echo "✅ Test module properly references rules_wasm_component"
377377
else
378378
echo "ℹ️ Test module may be using local_path_override (normal for BCR)"
379379
fi
380-
380+
381381
# Test example usage patterns
382382
echo "Testing example usage patterns..."
383383
bazel build //examples/basic:hello_component
384-
384+
385385
echo "BCR test module validation completed"
386386
387387
bcr-summary:
@@ -396,23 +396,23 @@ jobs:
396396
echo "📋 BCR Compatibility Test Summary"
397397
echo "=================================="
398398
echo
399-
399+
400400
# Check individual job results
401401
if [ "${{ needs.bcr-hermetic-test.result }}" = "success" ]; then
402402
echo "✅ Hermetic Build Test: PASSED"
403403
else
404404
echo "❌ Hermetic Build Test: FAILED"
405405
fi
406-
406+
407407
if [ "${{ needs.bcr-toolchain-validation.result }}" = "success" ]; then
408408
echo "✅ Toolchain Validation: PASSED"
409409
else
410410
echo "❌ Toolchain Validation: FAILED"
411411
fi
412-
412+
413413
echo
414414
echo "BCR Compatibility Status:"
415-
415+
416416
if [ "${{ needs.bcr-hermetic-test.result }}" = "success" ] && \
417417
[ "${{ needs.bcr-toolchain-validation.result }}" = "success" ]; then
418418
echo "🎉 ALL TESTS PASSED - Ready for BCR submission"
@@ -426,4 +426,4 @@ jobs:
426426
echo
427427
echo "Please review failed tests before BCR submission"
428428
exit 1
429-
fi
429+
fi

.markdownlint.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"default": true,
3+
"MD001": true,
4+
"MD003": {
5+
"style": "atx"
6+
},
7+
"MD004": {
8+
"style": "dash"
9+
},
10+
"MD007": {
11+
"indent": 2
12+
},
13+
"MD013": {
14+
"line_length": 120,
15+
"code_blocks": false,
16+
"tables": false
17+
},
18+
"MD022": {
19+
"lines_above": 1,
20+
"lines_below": 1
21+
},
22+
"MD024": {
23+
"allow_different_nesting": true
24+
},
25+
"MD025": {
26+
"front_matter_title": "^\\s*title\\s*[:=]"
27+
},
28+
"MD033": {
29+
"allowed_elements": [
30+
"details",
31+
"summary",
32+
"br",
33+
"kbd",
34+
"mark",
35+
"sub",
36+
"sup"
37+
]
38+
},
39+
"MD036": false,
40+
"MD041": false,
41+
"MD046": {
42+
"style": "fenced"
43+
},
44+
"MD049": {
45+
"style": "underscore"
46+
},
47+
"MD050": {
48+
"style": "asterisk"
49+
}
50+
}

0 commit comments

Comments
 (0)