Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ jobs:
env:
PYTHONDONTWRITEBYTECODE: '1'
steps:
- name: Install the CI harness interpreter
# Use the hosted tool cache rather than requiring live Ubuntu mirrors.
- uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
with:
python-version: '3.12.16'
- name: Verify the CI harness interpreter
run: |
apt-get update
apt-get install --yes --no-install-recommends python3
python3 --version
dpkg-query --show python3 python3-minimal
python3 -c 'import ctypes, hashlib, json, sqlite3, ssl, subprocess, tarfile; print("Python runtime imports passed")'
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,24 @@ jobs:
qualification:
name: Native execution / ${{ matrix.lane }}
runs-on: xcode-27
timeout-minutes: 60
timeout-minutes: ${{ matrix.timeout_minutes }}
strategy:
fail-fast: false
matrix:
lane: [native, safety, docs, archive, composition]
lane: [native, safety, docs, archive, composition, platform-floor]
include:
- lane: native
timeout_minutes: 90
- lane: archive
timeout_minutes: 90
- lane: safety
timeout_minutes: 60
- lane: docs
timeout_minutes: 60
- lane: composition
timeout_minutes: 60
- lane: platform-floor
timeout_minutes: 60
env:
DEVELOPER_DIR: /Applications/Xcode_27.2.app/Contents/Developer
PYTHONDONTWRITEBYTECODE: '1'
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## Unreleased — 1.9.1 hygiene

- Add the `platform-floor` native CI lane. It checks the macOS 15 / iOS 18
manifest minimums, cross-compiles all twelve libraries for iOS 18 devices and
the iOS simulator, and builds and runs `Tools/PlatformFloorConsumer`, an
external consumer declaring the same minimums. Runtime tests on macOS 15-26 or
iOS 18 systems remain outside CI.
- The CLI source identity no longer covers DocC catalogs (`*.docc`), so
documentation-only edits no longer require regenerating it.
- Repository housekeeping: superseded remote branches removed; branches without a
PR were first preserved as `archive/<branch>` tags.

## 1.9.0 — prepared source; publication separate

- Report CLI source version `1.9.0` with a regenerated deterministic source
Expand Down
3 changes: 2 additions & 1 deletion Documentation/CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ swift run swift-json --version --json
Human output identifies the source version. JSON adds `revisionKind` with value
`source-sha256`; `revision` is `sha256:` plus a lowercase 64-digit digest. This
digest hashes the ordered content manifest for `Package.swift` and every file in
`Sources`, excluding only generated `CLIBuildIdentity.swift`. The manifest uses
`Sources`, excluding generated `CLIBuildIdentity.swift` and DocC catalogs
(`*.docc`), which are documentation rather than compiled source. The manifest uses
UTF-8 relative paths and SHA-256 file digests. It is a source-content identity,
not a Git commit, binary digest, wall-clock build ID or assertion of publication.

Expand Down
27 changes: 25 additions & 2 deletions Documentation/Qualification/MaintenanceCI.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ development website. A skipped Pages publication on a maintenance branch is
expected. Required product qualification must still execute and pass.

Composition has a separate execution matrix lane on macOS and on each Linux
architecture. The native, safety, docs, archive and composition commands retain
their existing 60-minute execution limits; no command or fixture is omitted.
architecture. Native and archive jobs have 90-minute limits; safety, docs,
composition and Linux jobs retain their 60-minute limits. No command or fixture
is omitted.
The existing `Native / ...` and `Linux / ...` check names are final gates over
their complete workflow execution matrix. They run even after a dependency fails
and accept only its `success` result. Failure, cancellation, a skipped execution
Expand Down Expand Up @@ -58,6 +59,28 @@ measurements as unavailable rather than assigning inferred values.

## Retain build incidents

On 2026-11-11 Linux jobs on both hosted architectures failed before source
checkout because Ubuntu mirror names did not resolve; an unchanged-source retry
failed the same way. A separate diagnostic observed the same resolution failure
on the hosted runners and in the pinned Swift container, while github.com
resolved. The [diagnostic](https://github.com/ThorFuchs/Swift-JSON/actions/runs/43060752165)
successfully set up CPython 3.12.16 and imported the required standard-library
modules in that container on each architecture. The Linux workflow uses the
pinned setup action and exact interpreter version, preserving the Swift image,
execution lanes and fail-closed gates. Setup and the full Linux runs must still
pass for each actual source revision; this diagnostic is not a Linux test pass.

The same day's Git-free native reproduction exceeded its former 3,300-second limit,
and the separate native job completed with almost no time left in its 60-minute
job. The native and archive job limits are now 90 minutes; the nested native
replay has 5,000 seconds and the outer archive command 5,200 seconds, leaving
time for evidence and artifact upload.
Cleanup then reported a directory-not-empty error while a child build was still
running. The reproduction now stops its ordinary process group and records the
timeout and partial command evidence. The complete reproduction requirement
remains in force; this repair is not an
archive qualification pass.

One Linux Swift 6.4 build-planning SIGSEGV was observed in
[the original job](https://github.com/ThorFuchs/Swift-JSON/actions/runs/39039959928/job/117417228489).
The complete unchanged normal and composition scope subsequently passed in
Expand Down
3 changes: 2 additions & 1 deletion Documentation/Qualification/Release1.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ Evidence is compile-time only, on `49d1c93` with Swift 6.4.2:

No test has run on an actual macOS 15–26 or iOS 18 system or simulator, and this
record claims no such runtime pass. CI checks the manifest minimums but does not
build for iOS.
build for iOS. After the release, the `platform-floor` lane (1.9.1 hygiene) added
this compile-time evidence to CI; it still runs nothing on an older OS.

## Performance gate: maintainer exception

Expand Down
1 change: 1 addition & 0 deletions Scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ separate from the dependency-free library. Native lanes fail on unsupported host
| `python3 Scripts/public_check.py` | Public inventory, links, baseline and finite profiles |
| `python3 Scripts/preflight.py` | Actual native OS/compiler/SDK receipt |
| `python3 Scripts/ci.py --lane native` | Manifests, builds, Swift Testing, consumers and suites |
| `python3 Scripts/ci.py --lane platform-floor` | Manifest minimums macOS 15 / iOS 18, every library cross-compiled for iOS 18 device and simulator, and an external consumer at those minimums built for iOS and run on macOS (Debug/Release) |
| `python3 Scripts/ci.py --lane safety` | Address/Thread Sanitizer and strict memory safety |
| `python3 Scripts/ci.py --lane navigation` | N1 product exact discovery, Debug/Release, strict-memory and real external SwiftPM consumer/compiler/DocC proof; no release action |
| `python3 Scripts/ci.py --lane linux` | Actual Linux preflight, all nine products, exact root/cap/corpus/consumer counts |
Expand Down
14 changes: 11 additions & 3 deletions Scripts/ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from test_discovery import DISCOVERY, ROOT_COUNTS, SHARED_COUNTS, PARAMETER_INVOCATIONS, check_restored

ROOT = pathlib.Path(__file__).resolve().parents[1]
ARCHIVE_COMMAND_TIMEOUT_SECONDS = 5200
SHARED_TESTS = 'independentCodecFacadesAndExactValuesCanBeSharedAcrossTasks|concurrentSchemaEvaluationsHaveExclusiveDynamicRegexAndAnnotationState|sharedRegexProgramHasExclusiveConcurrentSearchState|immutableIndexedObjectCanBeSharedAcrossTasks|qaSharedPayloadAndRootHaveIndependentConcurrentReadScopes|sha256InputCapacityAndConcurrentInvocationsRemainIndependent|sharedFormattedHTMLRendererHasIndependentConcurrentInvocations|sharedAnnotatedDocumentRendererHasIndependentConcurrentInvocations|sharedExportPreparationsHaveIndependentConcurrentState|applePDFSimultaneousJobsHaveIndependentStateAndCancellation|sharedFilterPlanHasIndependentConcurrentInvocations|structuredSharedRendererPlansHaveInvocationOwnedState|sharedProviderBridgeHasIndependentConcurrentInvocations|e2SharedBridgeInputsHaveInvocationOwnedState|e2SharedCompiledPlanFacadeHasIndependentInvocationState'
SHARED_TESTS += '|compositionIndependentScopesCanBeSharedAcrossTasks'
SHARED_TESTS += '|qaStreaming|qaE2E(SharedPlan|RootImport|NDJSONImport|AwaitedSink|ExactWorkflow)'
Expand Down Expand Up @@ -189,6 +190,7 @@ def portable(values):
['python3', '-B', 'Scripts/qualify_navigation.py', '--output', str(output / 'consumer')]]
if lane == 'archive':
return [['python3', '-B', 'Scripts/public_check.py'],
['python3', '-B', 'Scripts/test_native_reproduction_timeout.py'],
['python3', '-B', 'Scripts/qualify_native_reproduction.py', '--output', str(output / 'reproduction')]]
if lane in ('coverage', 'linux-coverage'):
return [['python3', '-B', 'Scripts/test_qualification_harness.py'],
Expand Down Expand Up @@ -242,6 +244,8 @@ def portable(values):
['python3', '-B', 'Scripts/qualify_cli_integration.py', '--binary', '.build/release/swift-json', '--output', str(output / 'integration-subprocess.json')], ['python3', '-B', 'Scripts/qualify_cli_limits.py', '--binary', '.build/release/swift-json', '--output', str(output / 'cli-limits.json')], ['swift', 'build', '-c', 'release', '--package-path', 'Tools/CLIQualification', '--product', 'CLIExactCompare'], ['python3', '-B', 'Scripts/qualify_cli_cases.py', '--binary', '.build/release/swift-json', '--comparator', 'Tools/CLIQualification/.build/release/CLIExactCompare', '--gate', 'C1', '--output', str(output / 'foundation-vectors.json')], ['python3', '-B', 'Scripts/qualify_cli_cases.py', '--binary', '.build/release/swift-json', '--comparator', 'Tools/CLIQualification/.build/release/CLIExactCompare', '--gate', 'C2', '--output', str(output / 'vectors.json')],
['python3', '-B', 'Scripts/qualify_cli_cases.py', '--binary', '.build/release/swift-json', '--comparator', 'Tools/CLIQualification/.build/release/CLIExactCompare', '--gate', 'C3', '--output', str(output / 'arithmetic-vectors.json')],
['python3', '-B', 'Scripts/qualify_cli_cases.py', '--binary', '.build/release/swift-json', '--comparator', 'Tools/CLIQualification/.build/release/CLIExactCompare', '--gate', 'C4', '--output', str(output / 'advanced-vectors.json')], ['python3', '-B', 'Scripts/qualify_cli_cases.py', '--binary', '.build/release/swift-json', '--comparator', 'Tools/CLIQualification/.build/release/CLIExactCompare', '--gate', 'C5', '--output', str(output / 'integration-vectors.json')], ['swift', 'run', '-c', 'release', '--package-path', 'Tools/CLIQualification', 'ProviderConsumer'], ['python3', '-B', 'Scripts/qualify_schema_providers.py', '--binary', '.build/release/swift-json', '--output', str(output / 'providers.json')]]
if lane == 'platform-floor':
return [['python3', '-B', 'Scripts/qualify_platform_floor.py', '--output', str(output / 'platform-floor')]]
if lane == 'native':
return [
['python3', '-B', 'Scripts/public_check.py'],
Expand Down Expand Up @@ -533,7 +537,11 @@ def check_result(command, code, log, events=None):
if command[:3] == ['python3', '-B', 'Scripts/qualify_html_browser.py']:
passed = passed and 'JSONHTML_BROWSER passed engines=3 cases=76 skips=0' in log.splitlines()
if 'Scripts/test_qualification_harness.py' in command:
passed = passed and 'HARNESS_TESTS passed cases=35' in log.splitlines()
passed = passed and 'HARNESS_TESTS passed cases=36' in log.splitlines()
if command[:3] == ['python3', '-B', 'Scripts/qualify_platform_floor.py']:
from qualify_platform_floor import check_receipt
data = json.loads((ROOT / command[command.index('--output') + 1] / 'receipt.json').read_text())
passed = passed and check_receipt(data)
if command[:3] == ['python3', '-B', 'Scripts/qualify_transform_selection.py']:
data = json.loads(log.strip().splitlines()[-1])
passed = passed and data['status'] == 'passed' and len(data['commands']) == 20 and all(x['passed'] for x in data['commands']) and data['witnesses_per_configuration'] == 10 and data['negative_fixture_invocations'] == 14 and data['compiled_guide_fences'] == 1
Expand All @@ -544,7 +552,7 @@ def check_result(command, code, log, events=None):

def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--lane', choices=['transform-bindings', 'transform-bindings-safety', 'structural-acceptance', 'structural-acceptance-safety', 'structural-workflows', 'structural-workflows-safety', 'store', 'store-preparation', 'composition', 'navigation', 'inspection', 'native', 'safety', 'docs', 'r0', 'qa', 'linux', 'linux-safety', 'wasm', 'browser', 'export', 'cli', 'schema-examples', 'schema-examples-safety', 'schema-examples-determinism', 'schema-examples-construction', 'schema-examples-advanced', 'schema-examples-qualification', 'coverage', 'linux-coverage', 'linux-qa', 'wasm-qa', 'archive'], required=True)
parser.add_argument('--lane', choices=['transform-bindings', 'transform-bindings-safety', 'structural-acceptance', 'structural-acceptance-safety', 'structural-workflows', 'structural-workflows-safety', 'store', 'store-preparation', 'composition', 'navigation', 'inspection', 'native', 'safety', 'docs', 'r0', 'qa', 'linux', 'linux-safety', 'wasm', 'browser', 'export', 'cli', 'schema-examples', 'schema-examples-safety', 'schema-examples-determinism', 'schema-examples-construction', 'schema-examples-advanced', 'schema-examples-qualification', 'coverage', 'linux-coverage', 'linux-qa', 'wasm-qa', 'archive', 'platform-floor'], required=True)
parser.add_argument('--output')
parser.add_argument('--skip-host-measurements', action='store_true', help='For WASI runtime qualification only: record optional host timings as NOT RUN.')
args = parser.parse_args()
Expand Down Expand Up @@ -579,7 +587,7 @@ def save():
log_path = output / ('command-%02d.log' % index)
with log_path.open('w') as stream:
try:
result = subprocess.run(command, cwd=ROOT, stdout=stream, stderr=subprocess.STDOUT, timeout=21600 if args.lane in ('wasm', 'wasm-qa') else 3500 if args.lane == 'archive' else 1800)
result = subprocess.run(command, cwd=ROOT, stdout=stream, stderr=subprocess.STDOUT, timeout=21600 if args.lane in ('wasm', 'wasm-qa') else ARCHIVE_COMMAND_TIMEOUT_SECONDS if args.lane == 'archive' else 1800)
code = result.returncode
except (OSError, subprocess.TimeoutExpired) as error:
stream.write('\n' + str(error) + '\n')
Expand Down
9 changes: 6 additions & 3 deletions Scripts/generate_cli_identity.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,18 @@ def rendered(root=ROOT):
paths = [root / 'Package.swift'] + sorted((root / 'Sources').rglob('*'))
records = []
for path in paths:
if not path.is_file() or path.relative_to(root) == GENERATED:
relative = path.relative_to(root)
# DocC catalogs are documentation, not compiled source; editing them does not
# change the executable, so they are outside the source identity.
if not path.is_file() or relative == GENERATED or any(part.endswith('.docc') for part in relative.parts):
continue
if path.is_symlink():
raise ValueError('Source identity cannot follow symlinks')
records.append(hashlib.sha256(path.read_bytes()).hexdigest() + ' ' + path.relative_to(root).as_posix() + '\n')
value = hashlib.sha256(''.join(records).encode()).hexdigest()
return ('// SPDX-License-Identifier: Apache-2.0\n'
'// Generated by Scripts/generate_cli_identity.py; excludes this file.\n'
'// SHA-256 of the ordered Package.swift + Sources content manifest, not a Git commit.\n'
'// SHA-256 of the ordered Package.swift + Sources content manifest (DocC catalogs excluded), not a Git commit.\n'
'package enum CLIBuildIdentity {\n'
' package static let revision = "sha256:' + value + '"\n'
' package static let kind = "source-sha256"\n'
Expand All @@ -41,7 +44,7 @@ def main():
return 1
else:
path.write_text(expected)
print('CLI_IDENTITY passed source_manifest=Package.swift+Sources git_required=false')
print('CLI_IDENTITY passed source_manifest=Package.swift+Sources-without-docc git_required=false')
return 0


Expand Down
45 changes: 39 additions & 6 deletions Scripts/qualify_native_reproduction.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import hashlib
import json
import pathlib
import os
import signal
import shutil
import subprocess
import sys
Expand All @@ -14,6 +16,22 @@
from archive_candidate import archive, files, verify

ROOT = pathlib.Path(__file__).resolve().parents[1]
NATIVE_TIMEOUT_SECONDS = 5000


def run_native(command, cwd, stream, timeout):
"""Stop the native process group on timeout before cleaning its extraction."""
process = subprocess.Popen(command, cwd=cwd, stdout=stream,
stderr=subprocess.STDOUT, start_new_session=True)
try:
return process.wait(timeout=timeout)
except subprocess.TimeoutExpired:
try:
os.killpg(process.pid, signal.SIGKILL)
except ProcessLookupError:
pass
process.wait()
raise


def main():
Expand Down Expand Up @@ -56,16 +74,28 @@ def save():
command = [sys.executable, '-B', 'Scripts/ci.py', '--lane', 'native']
log = output / 'native.log'
start = time.monotonic()
timed_out = False
with log.open('w') as stream:
result = subprocess.run(command, cwd=extracted, stdout=stream,
stderr=subprocess.STDOUT, timeout=3300)
receipt['commands'].append(dict(command=command, exit_code=result.returncode,
seconds=time.monotonic() - start, log=log.name, log_sha256=sha(log)))
try:
code = run_native(command, extracted, stream, timeout=NATIVE_TIMEOUT_SECONDS)
except subprocess.TimeoutExpired:
code = None
timed_out = True
receipt['commands'].append(dict(command=command, exit_code=code,
timed_out=timed_out, seconds=time.monotonic() - start,
log=log.name, log_sha256=sha(log)))
if timed_out:
# Preserve the primary failure even if copying partial evidence
# or removing the temporary extraction subsequently fails.
receipt.update(status='failed', error=f'Git-free native lane exceeded the {NATIVE_TIMEOUT_SECONDS}-second limit')
save()
child = extracted / '.build/ci/native'
if child.is_dir():
shutil.copytree(child, output / 'native', dirs_exist_ok=True,
ignore=shutil.ignore_patterns('ModuleCache', '*.dylib', '*.o', '*.swiftmodule'))
if result.returncode:
if timed_out:
raise ValueError(receipt['error'])
if code:
raise ValueError('Git-free native lane failed')
native = json.loads((output / 'native/receipt.json').read_text())
if native['status'] != 'passed' or native['git_commit'] is not None or not native['source_inputs_unchanged']:
Expand All @@ -84,7 +114,10 @@ def save():
receipt['native_receipt_sha256'] = sha(output / 'native/receipt.json')
receipt['status'] = 'passed'
except (OSError, ValueError, KeyError, subprocess.SubprocessError) as error:
receipt.update(status='failed', error=str(error))
if 'error' in receipt and receipt['error'] != str(error):
receipt['followup_error'] = str(error)
else:
receipt.update(status='failed', error=str(error))
save()
print(json.dumps(receipt, indent=2))
return 0 if receipt['status'] == 'passed' else 1
Expand Down
Loading
Loading