No description
Three bugs found while diagnosing a live controller log, all in the worker resource-value path: 1. Every host relying on the documented hosts.yaml auto-detect default (no max_slot, meaning "use CPU count") got 0 scheduling slots, permanently blocking the scheduler from placing jobs on it. mxj is UInt32 on the wire and can't carry the schema's -1 sentinel; mapping.py worked around this by leaving it unset, which defaults to 0 -- and 0 is never < 0, so apply_join_state()'s auto-detect fallback never fired. Fixed by encoding the sentinel as 0xFFFFFFFF, which the controller's `int mxj` field reinterprets back to -1 via its existing implicit uint32_t->int conversion. No C-side or wire schema change needed for this part; the fallback itself was already correct but had zero test coverage for a negative mxj, now added. 2. update_resvals()/update_resval_list() logged the failure reason via PERROR, which reads process-global errno -- but update_resval()'s failure paths return raw negative codes directly and never touch errno, so the controller log filled with misleading "update_resval: Success" / "update_resval: Resource temporarily unavailable" lines instead of the real reason. Fixed to decode the actual rc via xce_strerror_r and name the failing resource. 3. maxmem is canonically stored/wired as raw bytes but had no unit metadata, so resval/workerlist printed it as a bare number that read as garbage (e.g. workerlist's fixed-width columns visually smeared a multi-GB byte count across the MaxCPU/MaxMem headers). Added an optional `unit` field to the Resource/ResourceVal capnp structs (and xce_resource_t/xce_resval_t/resources.yaml) so resval and workerlist can render a human-readable value (e.g. "30.90 GB") while the stored value stays raw bytes -- display-only, every other resource unaffected. Regenerated the xceadmin golden fixture (fixtures/full/expected.bin) twice: once for the mxj sentinel encoding change, once for the new Resource.unit field growing every resource's wire size by one pointer slot. Both diffs verified byte-for-byte isolated to exactly the expected change before regenerating. Verified: 1095/1095 controller_unit_test (stable across repeated runs), 229/229 xceadmin pytest, clean rebuild of lib/controller/xceadmin/xce_test. Two related findings logged to .wolf/buglog.json but deliberately not fixed here (out of scope per discussion): a pre-existing flaky segfault in the combined controller_unit_test binary, and maxswap/maxtmp being hardcoded stub values on the worker side. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> |
||
|---|---|---|
| .claude | ||
| .kiro | ||
| .wolf | ||
| docs/superpowers/plans | ||
| raft | ||
| reports | ||
| scripts | ||
| src | ||
| .clang-format | ||
| .gitignore | ||
| .mcp.json | ||
| .opencode.json | ||
| CLAUDE.md | ||
| README.md | ||
1. commit 规则
- 每个人 fork 自己的 branch, 从自己的 branch 做 PR,review 完再 commit
2. code format
2.1. C
推荐使用 clang-format,公共配置放在源码里面 xce/.clang-format
(理论上直接使用源码里面 xce/.clang-format 文件格式不会变)
2.1.1. vscode 可以在配置中加上如下内容
"C_Cpp.clang_format_style": "WebKit",
"C_Cpp.clang_format_fallbackStyle": "WebKit",
2.1.2. vim & emacs
clang-format -style="{BasedOnStyle: webkit}" -i XX.c
2.2. golang
使用默认 gofmt
3. build environment and build (example of ubuntu)
3.1 build environment
- Install nix package management tool
sh <(curl -L https://nixos.org/nix/install) --daemon
- Edit /etc/nix/nix.conf to make sure
experimental-features = nix-command flakes
sandbox = true
sandbox-fallback = false
substituters = https://mirrors.ustc.edu.cn/nix-channels/store https://cache.nixos.org https://cache.nixos.org/
trusted-users = root <your account>
make sure that you have restarted nix-daemon service after you have changed /etc/nix/nix.conf
- Install socat and config ssh (for clone by ssh protocol)
nix profile add nixpkgs#socat
.ssh/config
Host gitea.shenrs.eu
HostName gitea.shenrs.eu
IdentityFile ~/.ssh/id_ed25519
ProxyCommand socat - openssl-connect:gitea.shenrs.eu:2022,snihost=gitea.shenrs.eu,verify=0
3.2 checkout source code
3.3 build (for package and release)
cd xce/src
# for build debug version
nix build --option sandbox false .#xcecore_debug
# for normal build
nix build --option sandbox false .#xcecore
You can find the generated binaries at =result= directory
3.4 build (for daily develop)
cd xce/src
nix develop
# using meson to generated build configuration (debug and address sanitize)
meson setup build --buildtype=debug -Db_sanitize=address
# run meson to build
meson compile -C build
# The generated files will be in build/
3.5 build AppImage package
cd xce/src
nix bundle --bundler github:ralismark/nix-appimage --option sandbox false .#xce
This will create all in one AppImage file which contains everything for package delivery.
4. misc
4.1. Windows remap ctrl and alt key
create a reg file, e.g. remapkey.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,05,00,00,00,38,00,1d,00,1d,00,38,00,38,e0,1d,e0,1d,e0,38,e0,00,00,00,00
then double click remapkey.reg to import it. Restart OS.