Fix the three red master checks at their source
Build check / check (push) Failing after 22m46s
Build check / Publish a new Ziran version (push) Skipped

native_cache_parallel: the Ziran zi2c driver pruned stale generated
sources in a defer that ran after CompileExecutable, while the C driver
it replaced pruned them after lowering and before the compile step.
CompileExecutable collects every top-level C file in the output
directory, so a stale generated file from an earlier layout was compiled
and failed the build before the prune could remove it; the parallel native
build never reached its link gate and the fixture timed out. Prune before
the compile step again.

semantic_edit: the canonical-patch case used / as the edit root, so the
tool opened every system directory above the checkout for reading. A CI
lane under /var/lib/gitea-native-build (mode 0711) cannot read that
ancestor, and the tool correctly rejected the request. The case now uses
the test's work directory as the root with a nested relative path.

site_pages: regenerate site/guide/usage.html from the committed
docs/USAGE.md.
This commit is contained in:
waozi committed 2026-11-23 22:25:11 -03:00
1 parent 611fc150f3
commit 41b5c00628
3 files changed
+54 -11

No files matched your search

+9 -8
View File
@@ -456,14 +456,6 @@ main :: (argc: s32, argv: **u8) -> s32 {
}
}
defer { if output_lock >= 0 { unused close(output_lock) } }
defer {
if result == 0 && prune_stale != 0 &&
GeneratedOutputPrune(out_dir, CStr("/* Generated by zi2c from ")) != 0 {
Diagnostic(NoSpan(), CStr("zir.output"),
CStr("cannot remove stale generated files in %s"), out_dir)
result = 1
}
}
set: IR.ProgramSet = .{}
merged: IR.ZirProgram = .{}
defer { free(cast(*void)merged.modules) }
@@ -698,6 +690,15 @@ main :: (argc: s32, argv: **u8) -> s32 {
}
result = 0
}
/* Stale generated sources go before the compile step: that step also
* collects every C file in the output directory, so a stale file left
* for a later prune would be compiled and fail the build. */
if result == 0 && prune_stale != 0 &&
GeneratedOutputPrune(out_dir, CStr("/* Generated by zi2c from ")) != 0 {
Diagnostic(NoSpan(), CStr("zir.output"),
CStr("cannot remove stale generated files in %s"), out_dir)
result = 1
}
if exe != 0 {
name := strrchr(*entry_module[0], #char "/")
leaf := cast(*u8)*entry_module[0]
+39 -1
View File
@@ -31,10 +31,25 @@ It also warns when a byte is compared with a printable character's code
written as a number, as C ports do: <code>text[i] == 65</code> reads better as
<code>text[i] == #char "A"</code>. And it warns about an integer local that only ever
holds 0 or 1 and is only compared with them, which reads better as a <code>bool</code>.
It also names a local that is never read and a named import
(<code>Alias :: #import "module"</code>) or foreign declaration the module never spells;
write <code>unused NAME</code> on the line below it to keep a deliberate local quiet.
Open and <code>using</code> imports cannot be judged by spelling and are never reported.
Warnings do not fail the check (<code>"severity":"warning"</code> in JSON).
<code>ziran check|ir|api|inspect|build|bundle|run|fmt</code> is a convenience dispatcher
<code>ziran test FILE.zi ...</code> runs every test program the way <code>ziran run --target=c</code>
does, prints one <code>PASS</code> or <code>FAIL</code> line per file followed by
<code>ziran test: N passed, M failed</code>, and exits 1 when any file fails; every file
runs even after a failure. It takes the same <code>--root</code>, <code>--module-path</code>,
<code>--entry</code> and <code>--define</code> options as <code>ziran run</code>.
<code>ziran check|test|serve|ir|api|inspect|build|bundle|run|fmt</code> is a convenience dispatcher
for the same tools. <a href="https://github.com/ziranlang/ziran/blob/master/bench/README.md">Cross-target benchmarks</a> measure the
compiler, downstream toolchains, and validated runtime cases separately.</p>
<p><code>ziran serve</code> starts a foreground session for a series of ordinary commands:
each line is a command line without the leading <code>ziran</code> (<code>check src/main.zi</code>,
<code>build</code>, <code>run -- ARGS</code>), run in the same process, and <code>Exit</code> or the end of
input leaves. The greeting and prompt go to standard error, so a piped
session's standard output is only the commands' own. It is never a daemon,
and the compiler's caches keep repeated commands fast.</p>
<p>Portable bundles run with <code>ziran run app.zx</code>. Graphical
bundles use installed package-provided platform hosts through the same command;
see <a href="zx.html#running-bundles">runtime providers</a>. <code>make install-user</code> also
@@ -141,6 +156,15 @@ accesses it covers in a build without <code>--checks</code>; pointer lifetime ch
need the whole build, because they change what a pointer is. The portable
instruction engine always checks. Go's own bounds checks stay unless its
build uses <code>-gcflags=-B</code>.</p>
<p><code>--thorough</code> builds the most checked program: <code>--checks</code> plus every optional
compile-time verification. <code>--quickest</code> builds the fastest program: it skips
the optional compile-time verification, which today is the optimizer's
per-pass re-verification and the encoder's own re-check of the program the
register allocator just verified. In both modes the lowered IR is verified
before optimization, the allocator verifies what it publishes, and the <code>.zx</code>
loader verifies the bytes it receives; output is identical between the
default and <code>--quickest</code> modes. Pass either switch to <code>ziran build</code>, <code>run</code>
and <code>bundle</code>, or to <code>zi2zx</code>, <code>zx2native</code>, <code>zi2c</code> and <code>zi2go</code>.</p>
<h2 id="imports">Imports</h2>
<p>For ordinary imports, pass the entry file and a library directory with
<code>--module-path DIR</code> (repeat for multiple directories). There is no fixed
@@ -1264,6 +1288,20 @@ execute every check. Explicit <code>CHECK_FILTER</code> runs include every
matching check. Workers follow the build queue's allocation; set <code>CHECK_JOBS=1</code>
to run serially or choose another positive worker count. <code>make sanitize</code> runs
the suite under AddressSanitizer and UBSan.</p>
<p>The frontend keeps each module's parse in a digest-keyed cache and loads it
instead of parsing that module again. The key covers the toolchain executable,
the module text, its source root, the import site's parameter binding, the
defines, the module paths, the package map and the target; only whole modules
are reused and checking still runs on the loaded parse. An entry is published
only when the run ends without a diagnostic, and a module that splices another
file with <code>#load</code> or <code>#insert</code>, or that consults an imported module while
parsing (<code>#if</code> conditions, <code>#run</code>, default parameter inference), is never
stored. <code>--lint</code> needs a fresh parse and never uses the cache. Entries live
under <code>$XDG_CACHE_HOME/ziran/frontend</code> (<code>~/.cache/ziran/frontend</code>);
<code>ZIRAN_FRONTEND_CACHE_DIR</code> puts them elsewhere and <code>ZIRAN_FRONTEND_CACHE=0</code>
disables the cache. A missing or damaged entry is a miss and the module is
parsed again. <code>tests/frontend_cache.sh</code> checks hits, misses, identical
diagnostics and IR, and the exclusions.</p>
<p>A project's GitHub Actions job sets up the Ziran its <code>ziran.lock</code> pins with
<code>uses: ziranlang/ziran/.github/actions/setup@COMMIT</code>. It checks out that
commit with its compiler built and puts <code>build/bin</code> on <code>PATH</code>; <code>fetch: true</code>
+6 -2
View File
@@ -141,8 +141,12 @@ SemanticTests :: (test: *NativeTest) -> bool {
if !SemanticReset(context, CheckConcat("// é\n", SEMANTIC_BASE)) { return false }
split := SemanticEdit.[.{4, 4, "", "x", ""}]; split_patch := SemanticRequest(context, split[:])
if !SemanticTry(context, *split_patch, true, false) || !SemanticReset(context) { return false }
canonical := SemanticEdit.[SemanticSpan(context)]; canonical_patch := SemanticRequest(context, canonical[:]); CheckPut(*canonical_patch, canonical_patch.root, "path", context.source[1:])
if !SemanticTry(context, *canonical_patch, true, true, "/") { return false }
// A root above the document resolves a nested relative path. The work
// directory is the root: walking from / would need read access to every
// system directory above the checkout, which CI lanes do not grant.
canonical := SemanticEdit.[SemanticSpan(context)]; canonical_patch := SemanticRequest(context, canonical[:])
CheckPut(*canonical_patch, canonical_patch.root, "path", context.source[test.work.count + 1:])
if !SemanticTry(context, *canonical_patch, true, true, test.work) { return false }
both_source := CheckConcat(SEMANTIC_BASE, "Other :: () -> s32 { return 7 }\n")
if !SemanticReset(context, both_source) { return false }
both := SemanticEdit.[SemanticSpan(context, "7", "8"), SemanticSpan(context)]; both_patch := SemanticRequest(context, both[:])