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
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ concurrency:

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
ZIG_VERSION: "0.16.0"
ZIG_URL: https://ziglang.org/download/0.16.0/zig-x86_64-linux-0.16.0.tar.xz
ZIG_SHA256: 70e49664a74374b48b51e6f3fdfbf437f6395d42509050588bd49abe52ba3d00
ZIG_VERSION: "0.17.1"
ZIG_URL: https://ziglang.org/download/0.17.1/zig-x86_64-linux-0.17.1.tar.xz
ZIG_SHA256: 3581863e3cbcfd0fce0efc682ce7e9e93da96668a977791d356a26d2a7e9b17a

jobs:
python:
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ concurrency:

env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
ZIG_VERSION: "0.16.0"
ZIG_URL: https://ziglang.org/download/0.16.0/zig-x86_64-linux-0.16.0.tar.xz
ZIG_SHA256: 70e49664a74374b48b51e6f3fdfbf437f6395d42509050588bd49abe52ba3d00
ZIG_VERSION: "0.17.1"
ZIG_URL: https://ziglang.org/download/0.17.1/zig-x86_64-linux-0.17.1.tar.xz
ZIG_SHA256: 3581863e3cbcfd0fce0efc682ce7e9e93da96668a977791d356a26d2a7e9b17a

jobs:
build-release:
Expand Down Expand Up @@ -76,7 +76,7 @@ jobs:
run: tar -czf dist/a7-docs-site.tar.gz -C site dist

- name: Archive release example artifacts
run: tar -czf dist/a7-example-artifacts-linux-x86_64-zig0.16.0-release.tar.gz -C build release
run: tar -czf dist/a7-example-artifacts-linux-x86_64-zig0.17.1-release.tar.gz -C build release

- name: Verify release archive contents
run: |
Expand All @@ -88,7 +88,7 @@ jobs:
--require dist/docs/agent-usage.md \
--require dist/docs/release.md \
--require dist/docs/status.md
uv run python scripts/verify_archive_contents.py dist/a7-example-artifacts-linux-x86_64-zig0.16.0-release.tar.gz \
uv run python scripts/verify_archive_contents.py dist/a7-example-artifacts-linux-x86_64-zig0.17.1-release.tar.gz \
--require release/zig/src/001_hello.zig \
--require release/zig/bin/001_hello \
--require-glob-count "release/zig/src/*.zig=${example_count}" \
Expand All @@ -103,7 +103,7 @@ jobs:
--require "$sdist" \
--require "$wheel" \
--require dist/a7-docs-site.tar.gz \
--require dist/a7-example-artifacts-linux-x86_64-zig0.16.0-release.tar.gz
--require dist/a7-example-artifacts-linux-x86_64-zig0.17.1-release.tar.gz
uv run python scripts/verify_release_manifest.py dist/SHA256SUMS

- name: Generate release artifact attestations
Expand All @@ -114,7 +114,7 @@ jobs:
dist/a7_py-*.tar.gz
dist/a7_py-*.whl
dist/a7-docs-site.tar.gz
dist/a7-example-artifacts-linux-x86_64-zig0.16.0-release.tar.gz
dist/a7-example-artifacts-linux-x86_64-zig0.17.1-release.tar.gz

- name: Upload release bundles
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
Expand All @@ -123,7 +123,7 @@ jobs:
path: |
dist/SHA256SUMS
dist/a7-docs-site.tar.gz
dist/a7-example-artifacts-linux-x86_64-zig0.16.0-release.tar.gz
dist/a7-example-artifacts-linux-x86_64-zig0.17.1-release.tar.gz
if-no-files-found: error
retention-days: 7

Expand Down Expand Up @@ -167,4 +167,4 @@ jobs:
dist/a7_py-*.tar.gz
dist/a7_py-*.whl
dist/a7-docs-site.tar.gz
dist/a7-example-artifacts-linux-x86_64-zig0.16.0-release.tar.gz
dist/a7-example-artifacts-linux-x86_64-zig0.17.1-release.tar.gz
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ cut the sentence or mark the claim unchecked per S6.
or prefix `*` as reference operations; pass lvalues directly to `ref`
parameters and use ordinary field access after nil checks.
- Native release archives are named with platform/toolchain context
(`a7-example-artifacts-linux-x86_64-zig0.16.0-<profile>.tar.gz`); keep
(`a7-example-artifacts-linux-x86_64-zig0.17.1-<profile>.tar.gz`); keep
any docs or scripts that reference these filenames in sync.
- This rule applies to A7 source only. Compiler internals follow the separate
no-recursion rule (no recursion anywhere in `a7/`).
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The compiler is under development. Read [Status](docs/STATUS.md) for known gaps.
## Quick start

Install Python 3.13 or newer, [uv](https://docs.astral.sh/uv/), and
[Zig 0.16.0](https://ziglang.org/download/). Native qualification currently targets
[Zig 0.17.1](https://ziglang.org/download/). Native qualification currently targets
Linux x86_64 with Python 3.13. Zig must be on `PATH` for `build` and `run`.

```bash
Expand Down
25 changes: 15 additions & 10 deletions a7/backends/zig.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,8 +319,9 @@ def visitor(node):
" .int, .float => return 0,",
" .bool => return false,",
" .optional => return null,",
' .@"enum" => |info| return @field(T, info.fields[0].name),',
" // Fill in place. A `**` constant of many structs makes LLVM take",
# Zig 0.17: enum/struct/union type info uses field_names/field_types.
' .@"enum" => |info| return @field(T, info.field_names[0]),',
" // Fill in place. A comptime @splat of many structs makes LLVM take",
" // minutes on an optimized build.",
" .array => |info| {",
" var value: T = undefined;",
Expand All @@ -332,10 +333,12 @@ def visitor(node):
" .pointer => |info| return if (info.size == .slice) &.{} else undefined,",
' .@"struct" => |info| {',
" var value: T = undefined;",
" inline for (info.fields) |field| @field(value, field.name) = __a7_zero(field.type);",
" inline for (info.field_names, info.field_types) |name, field_type| {",
" @field(value, name) = __a7_zero(field_type);",
" }",
" return value;",
" },",
' .@"union" => |info| return @unionInit(T, info.fields[0].name, __a7_zero(info.fields[0].type)),',
' .@"union" => |info| return @unionInit(T, info.field_names[0], __a7_zero(info.field_types[0])),',
' else => @compileError("a7: no zero value for " ++ @typeName(T)),',
" }",
"}",
Expand Down Expand Up @@ -425,8 +428,8 @@ def _emit_preamble(self) -> str:
lines.append("pub fn main(init: std.process.Init) void {")
lines.append(" __a7_io = init.io;")
if "stdout" in self._io_streams_needed:
# writerStreaming, not writer: Zig 0.16.0 File.writer starts
# in positional mode at offset 0, so each fresh writer
# writerStreaming, not writer: File.writer starts in
# positional mode at offset 0, so each fresh writer
# overwrote earlier output when the stream is a regular file.
lines.append(" __a7_stdout_writer = std.Io.File.stdout().writerStreaming(__a7_io.?, &__a7_stdout_buf);")
lines.append(" __a7_stdout_is_tty = std.Io.File.stdout().isTty(__a7_io.?) catch false;")
Expand Down Expand Up @@ -1872,7 +1875,7 @@ def _visit_const(self, node: ASTNode) -> None:
element_type = self._emit_semantic_type(declaration_type.element_type)
# Preserve backing constness while normalizing array pointers to slices.
annotation = (
f": (if (@typeInfo(@TypeOf({val})).pointer.is_const) "
f': (if (@typeInfo(@TypeOf({val})).pointer.attrs.@"const") '
f"[]const {element_type} else []{element_type})"
)
name = self._declare_var_in_scope(name) if self._in_function else self._file_scope_name(name)
Expand Down Expand Up @@ -1946,7 +1949,7 @@ def _visit_var(self, node: ASTNode) -> None:
element_type = self._emit_semantic_type(declaration_type.element_type)
# @TypeOf has no runtime side effects; the initializer executes once.
zig_type = (
f"(if (@typeInfo(@TypeOf({initial_value})).pointer.is_const) "
f'(if (@typeInfo(@TypeOf({initial_value})).pointer.attrs.@"const") '
f"[]const {element_type} else []{element_type})"
)
elif concrete_function:
Expand Down Expand Up @@ -3616,7 +3619,8 @@ def _default_value(self, type_node: ASTNode) -> str:
if "__a7_zero(" in inner_default:
# Aggregate elements: let the helper fill the array at run time.
return f"__a7_zero({self._emit_type_node(type_node)})"
return f"[_]{elem}{{{inner_default}}} ** {size}"
# Zig 0.17 removed array multiplication (`a ** b`); use @splat.
return f"@as([{size}]{elem}, @splat({inner_default}))"
elif kind == NodeKind.TYPE_POINTER:
return "null"
elif kind == NodeKind.TYPE_SLICE:
Expand Down Expand Up @@ -3653,7 +3657,8 @@ def _default_value_for_elem(self, type_node: ASTNode) -> str:
for array in reversed(arrays):
elem = self._emit_type_node(array.element_type)
size = self._emit_expr(array.size)
value = f"[_]{elem}{{{value}}} ** {size}"
# Zig 0.17 removed array multiplication (`a ** b`); use @splat.
value = f"@as([{size}]{elem}, @splat({value}))"
return value

# === I/O special-casing ===
Expand Down
4 changes: 2 additions & 2 deletions a7/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@
f" {name:<8} {summary}" for name, summary in COMMANDS.items()
)

ZIG_VERSION = "0.16.0"
ZIG_VERSION = "0.17.1"
DOCTOR_SCHEMA_VERSION = "1.0"
QUALIFICATION_TARGET = "Linux x86_64, Python 3.13, Zig 0.16.0"
QUALIFICATION_TARGET = "Linux x86_64, Python 3.13, Zig 0.17.1"

EXIT_CODE_NAMES = {
int(ExitCode.SUCCESS): "success",
Expand Down
2 changes: 1 addition & 1 deletion a7/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Computes the memory layout the Zig backend produces for each named struct:
field offsets, size, alignment, 64B cache lines touched, and line utilization.
Zig lays out auto structs by sorting fields by alignment, largest first, with
ties keeping declaration order (verified against @offsetOf on Zig 0.16.0),
ties keeping declaration order (verified against @offsetOf on Zig 0.17.1),
then packing sequentially with natural alignment and padding the total to
the struct alignment. The numbers are those of a debug or release build;
`test/test_layout_matches_zig.py` compares them with Zig's @sizeOf and
Expand Down
5 changes: 5 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ belong in git history, not in long Markdown logs.

## Unreleased

- Zig toolchain pin moves from 0.16.0 to 0.17.1. CI/release downloads, doctor
checks, archive names (`zig0.17.1`), docs, and version-asserting tests
follow. Emitted array defaults use `@splat` because Zig 0.17 removed
`a ** b` array multiplication.

- Docs, site coverage, README, and feature pins sync cut-surface and
`--timings` wording after the surface-cut, perf-baseline, and P-MEM packet
tracks. Safety alias / formal-discharge gaps stay open on their own tracks;
Expand Down
4 changes: 2 additions & 2 deletions docs/RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ A release should contain:

- Python 3.13+
- `uv`
- Zig 0.16.0 on `PATH`
- Zig 0.17.1 on `PATH`
- Bun 1.3+ for the docs site

## Shared-machine limits
Expand Down Expand Up @@ -180,7 +180,7 @@ uv run python scripts/verify_release_manifest.py SHA256SUMS
gh attestation verify a7_py-*.tar.gz --repo code5717/a7-py
gh attestation verify a7_py-*.whl --repo code5717/a7-py
gh attestation verify a7-docs-site.tar.gz --repo code5717/a7-py
gh attestation verify a7-example-artifacts-linux-x86_64-zig0.16.0-release.tar.gz --repo code5717/a7-py
gh attestation verify a7-example-artifacts-linux-x86_64-zig0.17.1-release.tar.gz --repo code5717/a7-py
```

When building locally, remove `dist/` before `uv build`. The release workflow
Expand Down
18 changes: 12 additions & 6 deletions docs/STATUS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
This is the single working status document for current gaps, roadmap, and
implementation priorities. Keep `docs/CHANGELOG.md` short and release-facing.

The 2026-11-12 push checkpoint passed package build, docs style, secrets,
61 error-stage checks and site checks. The active Zig 0.17.0 conflicts with
required Zig 0.16.0; native qualification remains incomplete. The non-native
run passed 4,657 tests and failed five CLI cases on that version check.
The site dependency audit reports one high-severity markdown-it advisory.
[Push check record](audits/2026-11-12-push-checks.md).
The toolchain pin is Zig 0.17.1 (`a7/cli.py` `ZIG_VERSION`, CI/release
workflows, archive prefix `zig0.17.1`). Native builds require that exact
version on `PATH`. Local verification on this pin: examples E2E 51/51,
debug/release/fast artifacts, error-stage 61/61, docs-style, secrets,
package build, and wheel/sdist native install all passed. Pytest is
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
5223 passed / 11 failed / 1 xfailed; the 11 failures match `origin/master`
(safety alias / generic-origin / callee-note wording) and are not Zig 0.17
regressions.
[Zig 0.17.1 upgrade verification](audits/2026-11-12-zig-0.17.1-upgrade.md)
(commit `e493e11`). The earlier
[2026-11-12 push checkpoint](audits/2026-11-12-push-checks.md) remains a
historical record of the host Zig 0.17.0 / required 0.16.0 mismatch.

The checked storage-identity adapter passes all sixteen original caller
outcomes, including repeated_site_live. Eleven importer invariants, 23 focused
Expand Down
46 changes: 46 additions & 0 deletions docs/audits/2026-11-12-zig-0.17.1-upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Zig 0.17.1 upgrade verification, 2026-11-12

Evidence for the toolchain pin move from Zig 0.16.0 to 0.17.1.
This record replaces the incomplete [2026-11-12 push checkpoint](2026-11-12-push-checks.md),
which ran against host Zig 0.17.0 while the repository still required 0.16.0.

## Snapshot

| Field | Value |
| --- | --- |
| Branch | `cursor/zig-0.17-upgrade-ac1b` |
| Commit | `e493e11b2436c9a14cfb29688bf5cb5666ce19e3` |
| Zig | `0.17.1` on `PATH` |
| Python | 3.13.15 (uv-managed venv) |
| Platform | V1 qualification target (Linux x86_64) |

Commits on the branch: `4004f41` (pin + emitter), `4324daf` (layout probe
`field_names`/`field_types`), `e493e11` (STATUS link to this verification).

## Commands and results

| Command | Observed result |
| --- | --- |
| `zig version` | `0.17.1` |
| `uv run a7 doctor` | exit 0; `Zig 0.17.1` on qualification target |
| `uv run a7 run examples/001_hello.a7` | `Hello, World!` |
| `uv run a7 run examples/005_for_loop.a7` | expected for-loop output |
| `uv run a7 run examples/035_matrix.a7` | `c = { 6, 8, 10, 12 }` |
| `uv run a7 run examples/042_gradebook.a7` | expected gradebook output |
| Targeted pytest (`test_cli_workflows`, `test_release_tooling`, `test_codegen_zig`, `test_codegen_emit`, `test_layout`, `test_zig_backend_runtime`, `test_pipeline_native`, `test_inferred_slice_declarations`) after emitter fixes | 204 passed |
| `A7_PYTEST_WORKERS=4 ./run_all_tests.sh` (tree with pin + emitter; before layout-probe commit) | 10/11 checks. Pytest: 14 failed, 5220 passed, 1 xfailed (3 layout probe + 11 pre-existing). Examples E2E 51/51. Debug/release/fast artifacts 51/51 each. Bench 17/17. Error-stage 61/61. Docs style, secrets, package build, wheel/sdist native install: pass. |
| `PYTHONPATH=. uv run pytest -q -n 4` after `4324daf` layout-probe fix | **11 failed, 5223 passed, 1 xfailed** |
| Same 11 failing tests on `origin/master` at `5c28441` (semantic/safety only; Zig version irrelevant) | identical 11 failures |

The 11 remaining pytest failures are exact-array alias lifetimes, generic
array-origin / numeric-match escape cases, and callee-origin note wording.
They are not Zig 0.17.1 regressions.

## Limits

- The first full-gate pytest line still includes the three layout failures fixed
in `4324daf`; use the post-fix pytest line above for current counts.
- `./run_all_tests.sh` was not re-run end-to-end after `4324daf`; only the
pytest suite was re-run. Non-pytest checks already passed under Zig 0.17.1
in the first gate.
- This is not a release tag or V1 qualification.
8 changes: 4 additions & 4 deletions docs/research/language-needs/08-native-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ artifact naming/provenance.
import in `a7/` except the Zig keyword table (`zig.py:436`). A7 source
has no `extern` declaration form; SPEC §Interoperability ("Clean C ABI
compatibility") is aspiration, not implementation.
- V1 qualification target is Linux x86-64, Python 3.13, Zig 0.16.0
- V1 qualification target is Linux x86-64, Python 3.13, Zig 0.17.1
(`a7/cli.py:100-105`). Release workflow pins
`zig-x86_64-linux-0.16.0` (`.github/workflows/release.yml:19`).
`zig-x86_64-linux-0.17.1` (`.github/workflows/release.yml:19`).

## 2. ReleaseFast check-stripping vs L39

Expand Down Expand Up @@ -113,7 +113,7 @@ Deferred: async completion, zero-copy mapping, custom allocators.

| Tier | Target | Gate |
|---|---|---|
| 1 supported | Linux x86-64, Zig 0.16.0 | full gate incl. E2E |
| 1 supported | Linux x86-64, Zig 0.17.1 | full gate incl. E2E |
| 2 best-effort | Linux aarch64, macOS arm64 | `build_examples.py` smoke |
| 3 declared-unsupported | Windows, 32-bit | clear diagnostic, no silent UB |

Expand All @@ -126,7 +126,7 @@ state the tier.

## 7. Artifact naming / provenance (current + fix)

- Current: `a7-example-artifacts-linux-x86_64-zig0.16.0-<profile>.tar.gz`
- Current: `a7-example-artifacts-linux-x86_64-zig0.17.1-<profile>.tar.gz`
(release.yml:79) — platform/toolchain/profile encoded. Good.
- Provenance: `scripts/generate_release_manifest.py` → `dist/SHA256SUMS`,
verified by `verify_release_manifest.py`, plus `gh attestation verify`
Expand Down
2 changes: 1 addition & 1 deletion docs/research/language-needs/16-ecosystem-targets.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

- One backend only: `a7/backends/__init__.py` registers `BACKENDS = {"zig": ...}`.
CLI `--backend` accepts only `zig` (`a7/cli.py:234`).
- V1 qualification target is Linux x86-64, Python 3.13, Zig 0.16.0 (`a7/cli.py:101`).
- V1 qualification target is Linux x86-64, Python 3.13, Zig 0.17.1 (`a7/cli.py` `ZIG_VERSION`).
- Emit path is `zig build-exe` on the host (`scripts/build_examples.py:120`); no
`--target` passthrough exists in `a7/` or `scripts/`.
- Stdlib is two virtual modules: `std/io`, `std/math` (`docs/SPEC.md` §10.3).
Expand Down
4 changes: 2 additions & 2 deletions scripts/project_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ def project_status() -> dict[str, object]:
"example_count": len(examples),
"golden_output_count": len(goldens),
"backend": "zig",
"zig_version": "0.16.0",
"release_archive_prefix": "a7-example-artifacts-linux-x86_64-zig0.16.0",
"zig_version": "0.17.1",
"release_archive_prefix": "a7-example-artifacts-linux-x86_64-zig0.17.1",
}


Expand Down
2 changes: 1 addition & 1 deletion scripts/verify_wheel_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def verify_wheel(wheel: Path) -> None:
raise RuntimeError(f"installed CLI version disagrees with wheel metadata: {version.stdout!r}")
doctor = run_cmd([str(a7_cli), "doctor"], cwd=work, env=env)
qualified = sys.version_info[:2] == (3, 13) and sys.platform == "linux" and platform.machine() == "x86_64"
if doctor.returncode != (0 if qualified else 2) or "Zig 0.16.0:" not in doctor.stdout:
if doctor.returncode != (0 if qualified else 2) or "Zig 0.17.1:" not in doctor.stdout:
raise RuntimeError(f"installed CLI doctor failed: {doctor.stdout}\n{doctor.stderr}")
if not qualified and "outside the V1 qualification target" not in doctor.stderr:
raise RuntimeError("installed CLI doctor omitted the unsupported-environment diagnostic")
Expand Down
2 changes: 1 addition & 1 deletion site/docs/agent-retrieval.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The missing-path probe was `http://127.0.0.1:4174/a7-py/docs/retrieval-missing-p

### Install and run a first program

Pass. `docs/start.md` states the prerequisites: Python 3.13 or newer, uv, Git, and Zig 0.16.0 on PATH. It supplies the following commands:
Pass. `docs/start.md` states the prerequisites: Python 3.13 or newer, uv, Git, and Zig 0.17.1 on PATH. It supplies the following commands:

```bash
git clone https://github.com/code5717/a7-py.git
Expand Down
Loading
Loading