maxon-lang

land

How an agent lands a change on main in minimaxon — `gate land`, the landing queue with its lock on origin, the focused landing gate and which steps a change needs, the rules about red CI, slow tests, tests that are slow only under the interpreter, gate time and what the landing report must carry. Use it before landing or pushing anything to main, when writing a brief that ends in a landing, and when a landing gate or CI fails.

maxon-lang 0 Updated 1d ago
GitHub

Install

npx skillscat add maxon-lang/maxon-rewrite-bootstrap/land

Install via the SkillsCat registry.

SKILL.md

Landing a change on main

Every agent lands its own work, on every machine. A landing is a fast-forward push of a gated, rebased tip to
origin/main. Never force-push, never push a merge commit, never touch seed/ (a seed renewal goes through the
coordinating session).

go run ./cmd/gate land does steps 3 to 5 below and is how every agent lands, so that four agents (three machines and
the cloud agent) never push a tip on a main it was not checked against: see "The landing queue".

The order of a landing

  1. Commit in your own worktree. The patch is cut from commits against the merge base, never as "the diff against
    origin/main": main moves, and such a diff reverts what landed meanwhile.
  2. Look at CI first. gh run list --branch main --limit 3. A red main does not stop a landing when its red has a
    known cause and somebody is fixing it: land, and say in the report what is red and who has it. Hold only when nobody
    owns the red (finding its owner is then the first job) or when your change touches what fails. Never wait for a run
    that is in progress.
  3. Rebase onto origin/main and resolve your own conflicts. A generated file in conflict is regenerated, never
    merged by hand.
  4. Run the focused gate on the rebased tip (below; gate land runs it on the branch as it is, and again after the
    rebase as far as what main gained meanwhile calls for). The full gate (.\check.ps1, ./check.sh) is CI's job on
    main; run it yourself only for what CI cannot see.
  5. Push fast-forward. A refused push means main moved: rebase, run the focused gate again, push.
  6. Report (below), then watch your commit's CI run. A red run is fixed forward at once by whoever landed it;
    when the fault is another machine's (a Windows fault found from the Mac), say so to the coordinating session at once.

On the coordinator's Windows machine the landing is one script,
C:\Users\Eric\.claude\projects\c--Users-Eric-Dev-minimaxon\phase3\land.ps1 -tag <tag> -from <worktree>, which does
step 2, and then steps 3 to 5 by calling gate land --squash --message-file=<file>, in the one landing worktree (-resume after resolving a conflict there, -abandon to give the tree up,
-fixesRed for the fix of a red main, -full for the full gate). Run it to its LANDED line; never end a turn while it
runs, and never leave the landing tree held. When the script itself faults, fix nothing in it: abandon and report the
exact error.

The landing queue

go run ./cmd/gate land [--squash --message-file=<path>] [--gated] [--dry-run] [--who=<name>] [--wait=<duration>] [--rounds=<n>] [--maxon-specs=<dir>] [--maxon-stdlib=<dir>]

Run it in the worktree of the branch to land, with the work committed (a changed tracked file stops it). It runs, in order:

  1. the focused gate on the branch as it is, without the lock (--gated skips this when you have just run it on this
    tip; --maxon-specs and --maxon-stdlib go to it). A branch cut before the last change to cmd/gate runs its own,
    older cmd/gate here, which may stop on a file that the gate regenerates (specs/passed.txt): land such a branch with
    --gated after its own check --focused, and the rebased tip is gated by the new cmd/gate. The files that this gate
    (and the checks of any tier below) writes again, which a generator or the regeneration of specs/ writes (specs/services.md,
    specs/passed.txt, *_gen.*), are amended into your commit and printed, as after a rebase; any other tracked file they
    change stops the landing;
  2. at most --rounds rounds (default 3: two that check without the lock, and the last). A round:
    1. fetches and rebases onto origin/main, without the lock. A conflict in a file that no tool merges aborts the
      rebase and exits 1, naming the files. If main moved since the tip was checked, it chooses what to repeat by the files
      of your commits and of the commits you were rebased over (after a round's recheck passed, only of the commits main
      gained since the main that recheck ran on
      : your changes to stdlib/, cmd/convert/ or cmd/gate/ are the full gate
      once and are not again a reason for it when later commits touch none of them, so the last round, which holds the lock,
      rarely needs the full gate; a hand-written file your commits share with the new ones still is), prints the tier and why, and repeats it: i, no
      common file and neither side touches stdlib/, cmd/convert/ or cmd/gate/: library regenerates (with
      --maxon-stdlib) and the Go tests; ii, both sides touch self/ or runtime/: tier i plus the compiler built and
      the corpus; ii+regenerated, the only files in common are ones that a generator or the regeneration of specs/
      writes (*_gen.*, specs/passed.txt, specs/*.md but the README, self/driver/skips.tsv): tier ii with them
      written again from the merged inputs (go generate, then the regeneration of specs/ when it is called for, needing
      --maxon-specs) and the spec step with the listed passes required, and what the regeneration changed goes into your
      commit; iii, a common hand-written file (README.md merged cleanly does not count) or either side touches
      stdlib/, cmd/convert/ or cmd/gate/: the full focused gate, whose generators and regeneration of specs/ write
      those files again too: what they changed (specs/passed.txt without the scopes a union made full, specs/*.md,
      *_gen.*) is amended into your commit and printed, and any other tracked file the checks changed stops the
      landing. A rebase conflict in those written-again files is
      resolved by tool (specs/passed.txt and skips.tsv: the union of the rows, none that a side deleted, the scopes of a row both
      sides hold united; the others:
      regenerated) and the landing regenerates;
    2. takes the landing lock, the branch land-lock of origin, whose commit says <machine> <branch> <UTC time>. A lock
      held by another is waited for (the holder is printed every 15 s, for at most --wait, 20 minutes, then it exits 1);
      one older than 15 minutes is stale and is broken, saying whose it was. If origin refuses to create the branch (the
      cloud agent may push only its own), it says so and lands without the lock;
    3. fetches. If main is where 2.1 rebased onto, git push origin HEAD:main, fast-forward only. If main moved again, the
      new commits alone are classified: a change that calls for no more than tier i is rebased over, checked under the lock
      and pushed; a bigger one, or a push that main refuses, lets the lock go and starts the next round;
  3. the last round takes the lock first and holds it through its rebase, checks and push (a refused push is tried once
    more, a second refusal exits 1), so a landing always finishes. --rounds=1 is the last round alone, the whole recheck
    under the lock. The lock is therefore held for a fetch, a short check and the push in the common case, and a whole
    recheck only when main moved twice by more than tier i.

Each round prints a line, Round <n> of <rounds>: tier <x>; recheck <t> without the lock and <t> under it; lock held <t>; <how it ended>, and just before the Landed: line Landing time: <work> working, <machine wait> waiting for this machine's lock, <origin wait> waiting for the landing lock, from start to push <wall>. Every time a landing prints counts only the time it
worked
(the Landing time line, the rechecks of the round lines, the step times, gate time: total, the gate time of the Landed:
line): one clock stops while the landing waits for this machine's lock of the heavy commands and for origin's landing lock, so a
landing that sat behind another gate does not read as a slow one, and the 15% gate-time watch compares work with work. Only lock held
is wall time, since it is what other landings wait for. The machine's lock holds every gate, selftime and selfab run and heavy script
for a whole step, so no other gate runs beside a step; only a process that does not take it (a hand-run go test, a build, another tool)
can slow one, and nothing prints that: when a step is over its recent times with no cause in the landing, look at what else ran on the
machine before explaining it. A failing step in any round never pushes: the lock is released (on Ctrl-C too) and the command exits 1
naming the step. It prints a Landing: line when it takes the lock, and at the end one line to paste to the coordinating
session:

Landed: <subject> at <sha> (gate <total>, slowest <two steps>; tier <x>; self compile C2 <ms> ms on <machine> <target> (<ms> ms per 1000 lines of self/); its row is on main)

(tier <x> is the highest tier of any round.) The push is made when Landing time: is printed; the Landed: line follows the timing
of the build (Timing the build of self/ ...), which can wait for the machine's lock, so wait for the command to end and do not report
the landing from the lines before it.

The self compile time is recorded by the landing, not by you. A landing whose commits change self/ or runtime/ (not
the skip table alone, specs, stdlib/, cmd/ or documents) builds self/ on the commit it has pushed with gate selftime
(best of three C2 builds, under the machine lock and not the landing lock), adds a row to docs/self-compile-times.md
and pushes it as a commit of its own that changes only that file (under the landing lock for the fetch, rebase and push),
and says so after tier <x> in the Landed: line. Never run .\selftime.ps1 by hand after a task, never put a row in your
own commit, and do not gate a row. The row's Host cell is this machine's name and its target (eric-pc x64-windows): the
lowercased hostname, or MAXON_SELFTIME_MACHINE when set (the cloud container sets it to cloud), and rows with no machine are the
coordinator's. A landing of other changes has no such part. Read the line for WATCH:: it means C2's
time on this machine is more than 3% over the median of this machine's last five rows, or its time per 1000 lines of self/ is
(compared only with the rows of about the same line count, within 3%, at least three of the five: after a change of the size of self/
the line says line count changed, per-line watch skipped instead, which is no WATCH and needs no word);
quote it in the report and say what in the landing could cause it (a code generator change, a larger table), or that nothing
does. self compile time NOT recorded or its row is committed here and NOT on main means
the landing happened and the row did not: say so, and run go run ./cmd/gate selftime, then commit and land the row. A main
that gained only rows of that table is no change for the checks (tier none), and a conflict in the table is resolved by tool
to the rows of both sides.

The lock replaces the old "landing in 1 minute" message: it is what tells another agent to wait.

--squash --message-file=<path> makes your commits since the merge base with origin/main one commit with that message
(the coordinator's land.ps1 does this), --dry-run does everything but the push to main, the lock included, and
--who=<name> names the holder when the hostname is no good name. Never delete land-lock by hand while its holder's
command runs (a lock whose command died is stale after 15 minutes), and never push to main around it.

The focused gate

One command, the same on every machine and from every script (land.ps1, the Mac's focused-gate.sh, a hand-run landing):

go run ./cmd/gate check --focused [--since=<rev>] [--maxon-specs=<dir>] [--maxon-stdlib=<dir>]

(.\check.ps1 --focused and ./check.sh --focused are the same.) --since defaults to the merge base with origin/main;
the paths that count are those changed since it plus the working tree. The two maxon directories are maxon's specs and
stdlib (or MAXON_SPECS and MAXON_STDLIB); the run asks for them only when the change calls for the step that reads them.
It is built from cmd/gate's own step list, each step having a rule by its name (focusedRules in cmd/gate/focused.go), so
a step added to the gate is either left out of the landing or given its rule there, never listed a second time.

Always, on the rebased tip: build from the seed, fmt --check self runtime tests stdlib,
check self --tests --verify-reads, check runtime, check stdlib (the host's target), selftest, the host corpus
as the gate runs it, the spec step (test specs --require-passed) and the chain (C2 identical to C3).

By the paths changed: Go (internal/, cmd/, any .go file) adds gofmt, go fix, go vet ./... for windows, linux
and darwin and go test ./..., which self/, runtime/ or stdlib/ adds alone too (Go tests read them: the stage rule of
internal/entryreads); internal/, a generator's input (codes.tsv, messages.tsv, skips.tsv, Maxon.g4,
runtime/hashfold.maxon, runtime/textops.maxon) or a *_gen.* file adds the generators, which fail on a stale generated file; runtime/, self/backend/, self/ir/, self/interp/ or a test program that uses the scheduler adds the
behaviours (--worker-counts=1,2,4); cmd/convert/, self/driver/skips*, stdlib/, specs/, self/driver/fix*.maxon,
qualify.maxon, self/check/ or self/diag/codes.tsv/messages.tsv (what fix writes them by) adds the regeneration of
specs/ (gate specs); specs/, stdlib/, cmd/convert/, self/interp/ or self/driver/ puts --interpret on the spec
step; cmd/convert/builtins_gen.go alone counts for neither (the converter reads its tables only for the library's files,
never for a spec, whichever row builtingen changed: TestSpecConversionNeverReadsTheBuiltinTables), and the plan's line says
so; stdlib/, cmd/convert/ or the front end (self/check/, resolve/, ast/, syntax/, diag/, project/, driver/,
whose diagnostics the conversion's fix applies) adds the check that the library regenerates from maxon's (it converts the files
of stdlib/files.txt that have not graduated and runs the curves' generated tables, so a hand edit of a graduated file in
stdlib/ still calls for it: fix and the tables compile the whole library); self/opt/, self/ir/,
self/backend/, self/mxdbg/ or self/debugger/ adds the debug info. The run prints which steps it chose and the paths that
called for them, then each step's time, then gate time: total X min; slowest: .... Not in it, and named in one line:
the cross-target lanes and compiles, fuzz and the cache. CI runs them. The
self-build comparison (cmd/selfab) is not a step either: run it by hand when a layout, a lock or a hot path of the back end,
the IR or the runtime moved.
Main's last finished CI run is printed as a NOTE when it is red, which does not stop the landing.

One spec run per landing. The regeneration runs every spec test and saves the results, and the spec step then replays
them with --require-passed instead of running every test again (record mode does not fail a listed test that stopped
passing; the replay prints LOST and fails). The gate does this by itself, by the stamp of what the results depend on.
The files the regeneration changed in specs/ are named in the output: they are part of the landing.

When the full gate is required: code whose effect only another lane shows and CI has no job for. Otherwise push
the branch as cloud/<name> or eric-pc/<name>, which CI runs on every job, and land when the job that matters is
green: a Mac change to the Windows timed wait is the example.

On the Mac

  • The machine lock. Several agents share the Mac: every build, gate, test, fuzz, bench and selfab run goes through
    python3 ~/Dev/agents/minimaxon/out/dev/spec-triage/withlock.py <script>, heavy steps batched into one script. A
    benchmark runs only under the lock, so nothing else perturbs it.
  • The environment. TMPDIR=/private/tmp/claude-502, MAXON_STDLIB=$HOME/Dev/maxon/stdlib,
    MINIMAXON_CACHE=off; tests get < /dev/null. Nothing ever runs with its working directory inside ~/Dev/maxon,
    which is read-only: name its files by absolute path from elsewhere.
  • No Rosetta. x64 targets are compiled (build self --target=x64-windows), never run.
  • Which lanes are CI's. macOS runs no Linux or Windows executable: the arm64-linux, x64-linux and x64-windows
    lanes are CI's (cloud/<name> for a change only they can see, such as one to the Windows timed wait). The OrbStack
    VM ubuntu is there for a Linux reproduction, never maxon-linux.
  • The focused gate script is ~/Dev/agents/minimaxon/out/dev/scripts/focused-gate.sh <worktree> <log name>: it takes its steps from
    ./check.sh --focused (above), not a list of its own, and keeps a sampler that records a stalled
    FIFO test's process table. Its logs, with the steps by time, are in ~/Dev/agents/minimaxon/out/dev/scripts/logs/<log name>/.

Tests

  • Modest repeats. A fix lands with a test that fails before and passes after. Once a mechanism is proven, do not
    run hundred-fold campaigns.
  • No long test in the gate. A test over about 2 s a run on a quiet machine is // runs: manual (corpus and
    behaviours), <name>.manual.maxtest (module tests) or a manual row of self/driver/skips.tsv (specs), run by name
    when its area is touched. A test that is slow only because it sleeps or polls too long is shortened instead.
  • Slow only under the interpreter is not manual. Compute-heavy library code (big numbers, field arithmetic) runs
    40 to 300 times slower there: give the spec file, or the named tests, a native row of self/driver/skips.tsv.
    Time a new spec both ways before landing it.
  • // runs: alone is for a short test that needs a quiet machine, not for a slow one, and not for a test that
    holds nothing a late wake can break. Each alone run costs its lane a drain.
  • A gate test holds what does not depend on the machine's load. Bounds on a wake's lateness belong in a manual
    test; the gate's version checks order, counts and grid.
  • A failure that does not reproduce is a finding, not a flake. Report it with what the test was waiting on, and make
    the test say so itself next time (a watchdog that names the step, inside the runner's deadline).
  • Never loosen a bound, mark a test unsupported, or edit specs/passed.txt to get green. A status changes through
    the conversion's rows.
  • Rows of specs/passed.txt may be scoped, and the gate writes the scopes, never you. A row is file.md: test (every
    target holds it) or file.md: test @x64-windows,x64-linux (only those targets do; README "Tests", scoped rows). Your gate's
    record step adds each new pass scoped to your own host (x64-windows on Windows, arm64-macos on the Mac, x64-linux in
    the cloud agent's container), adds your host to the scope of a scoped row it passes, and drops the suffix once every recording
    host that runs the test has it, so what a landing commits to specs/passed.txt is the record step's output: commit exactly
    that, and do not widen, narrow or drop a scope by hand, and never remove another host's target. Your host is held only to the
    rows that are unscoped or name it, so a scoped row of another host's passing cannot fail your gate, and a test that fails on
    your host and passes on theirs is theirs to fix, not yours to unscope. arm64-linux (CI) never records and is held to the
    unscoped rows only. On Windows the record step also runs, under WSL, the spec tests of the scoped rows that lack x64-linux
    (the line specs on x64-linux: ... says how many gained it) and adds x64-linux to the scope of each that passes: it adds no
    row and touches no unscoped one, and without WSL it prints one line and skips; commit what it wrote. The gate's spec line
    says how many listed rows are scoped, and the full gate names them; a rebase conflict in the list is merged by tool, uniting
    the scopes of a row both sides hold, and a list that holds one test in two lines (a clean git merge can leave it) is read as
    one row with the scopes united, an unscoped line winning, and written back as one line. A row the parser refuses (a typo in a
    target, a target that does not record, targets out of order) stops the gate and the landing, naming the line.

The landing report

One short message to the coordinating session after the landing (gate land prints it as its Landed: line; the lock tells
the other agents that a landing is on its way, so there is no "landing in 1 minute" message before the push):

  • the commits and what each does, in a line;
  • the gate's total and its slowest steps, and the step list when it changed;
  • the counts: corpus, behaviours, specs passed, lost and new;
  • the state of main's last finished CI run, and when it is red, what is red and who is fixing it;
  • anything that failed once, anything left open.

Gate time is watched: a step more than about 15% over its recent runs on that machine is explained in the report.
A saving found on one machine is sent to the others the same day.

What still goes to the coordinating session first

Seed renewals; a language rule the plan has not decided; a difference from maxon that is not recorded; a landing on a
failing gate (the owner decides, once, for those commits); deleting a branch that is not an ancestor of main; anything
of logging.

Categories