Skip to content

Commit 11824df

Browse files
authored
2026.11.27.1: stated closure, single readers, refusals where known, and six features (#1023)
Release 2026.11.27.1 (design 2026-11-27, v3; §13 records what the implementation changed). - Stated closure: a link that read one file for a DT_NEEDED and a search path that loads another is refused (runtime-closure); a host tool's entry carries its shared objects; the PATH of a build program, a test and a run is composed by one function on every host. - Single readers: code text, dependency tables, library names (a dependency's shared library is named by its package), the child PATH, the scan command. - Refusals where known: a graph C library without a C++ ABI, a shared image over the static TLS dlopen serves (dlopen-static-tls row data), a missing #! interpreter. - Cache entries record their users; the home keeps its given spelling; a BMI is one ninja node in both its spellings (mcpp#1015). - Features: conditional imports through the compiler's scan, exact exports checked on ELF, mcpp add --build and remove --dev/--build, profile dialect_cxxflags, shell completion (mcpplibs.cmdline 0.0.6), feature descriptions. - mcpp's Windows images reserve 8 MiB of stack for the main thread.
1 parent a5450ea commit 11824df

139 files changed

Lines changed: 5206 additions & 1200 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.agents/docs/2026-11-26-clang-bmi-cutoff-and-private-fragment-refinement-design.md‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,15 @@ v3 的 R1 到 R4 与文本不变。变化:`conservative` 的描述,`check`
262262
开关的"取值改变后第一次构建正确"需要它成立,因此一并修复:`toolchain_request_identity` 把这三个环境变量并入请求,未陈述时的标识与此前相同,
263263
只有陈述时才附加。边的条目(`MCPP_BMI_CUTOFF`)在执行时读取,不并入。
264264

265+
**发布后的更正(2026.11.27.1)。** 上述做法在 2026.11.26.1 中有一个缺口,由发布后的净室验证测出:`toolchain_request_identity` 属于构建的记录
266+
(`target/.build_cache`),记录只在构建成功时写下。带陈述的构建失败时,图已按陈述重写,记录仍是此前那次成功构建的;其后不带陈述的构建与记录相符,
267+
快速路径重放了按陈述写的图。GCC 上提示所给的命令 `MCPP_PRIVATE_FRAGMENT=conservative mcpp build` 在片段之前有条件指令时必然失败
268+
(按原样构建,GCC 不支持),于是其后的 `mcpp build` 以 `module already declared` 失败,直到编辑源文件或清单。
269+
270+
更正:陈述并入图自身所记的请求(`request_tag`,`build.ninja` 首行的 `request=`),这是"A、B、A"问题已有的机制,所有快速路径在重放前比较它;
271+
`toolchain_request_identity` 中的那一段删除,不留两处。未陈述时标签与此前相同。e2e 1162、1163 在核对之后增加一次不带陈述的构建,
272+
单元测试 `GraphShape/TheRequestNamesAStatedSwitch` 固定哪些陈述改变标签、哪些不改变。原先的 e2e 1161 E 只覆盖了"带陈述的构建成功之后",没有覆盖失败之后。
273+
265274
## 8. 未决的测量
266275

267276
| 编号 | 问题 | 结论 |
@@ -293,7 +302,7 @@ e2e:1161(条件放行、宏拒绝、`conservative`、取值改变后的第
293302
| 正确性(B) | 条件内的 `#define` 是否生效不可知 | 只读文本,一律拒绝 |
294303
| 正确性(C) | 续行使物理行与逻辑行不同 | 模块声明与片段之间出现即按原样构建;GMF 中的宏续行不受影响 |
295304
| 开关 | GCC 上没有 `as-written` | `conservative`、`checkGcc` |
296-
| 开关 | 取值改变后第一次构建(7.5) | 请求标识并入三个环境变量;e2e 1161 E |
305+
| 开关 | 取值改变后第一次构建(7.5) | 图自身所记的请求并入三个环境变量(2026.11.27.1 起;此前在构建的记录里);e2e 1161 E,1162、1163 的核对之后一步 |
297306
| 提示 | 以"这次构建用过什么"为条件会在不相干的失败上出现 | 以失败的步骤为条件;e2e 的反例 |
298307
| 提示 | 失败的步骤取自输出格式 | 取不到按 R4,少说而不是多说;`progress` 已依赖同一格式 |
299308
| 提示 | 保留的记录在编译边结束时才写 | 7.3:并行失败的导入者不给 R2;只说已记录的事实 |

‎.agents/docs/2026-11-27-stated-closure-single-reader-and-feature-designs.md‎

Lines changed: 675 additions & 0 deletions
Large diffs are not rendered by default.

‎.agents/docs/README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ superseded_by: 2026-09-07-....md # when status is superseded
1818
---
1919
```
2020

21-
374 records.
21+
375 records.
2222

2323
## By subject
2424

@@ -61,6 +61,7 @@ Records that declare one. Everything else is listed by date below.
6161

6262
### design
6363

64+
- [陈述的闭包、单一读者与六项功能:十四项缺陷的收敛设计](2026-11-27-stated-closure-single-reader-and-feature-designs.md) — landed
6465
- [生态级方案:内核接口的供给与能力,派生状态的核对,存储的引用](2026-11-22-kernel-interface-and-derived-state-ecosystem-design.md) — active
6566
- [程序起点模型:启动者、两层入口与 `main` 的三种陈述(mcpp#845、mcpp#981)](2026-11-20-program-start-model.md) — landed
6667
- [升级的连续性:打包修订不在使用路径上替换载荷、替换失败不拆掉可用状态、home 中的悬空记录自愈、真实的升级 lane](2026-10-17-upgrade-continuity-design.md) — active
@@ -216,6 +217,7 @@ Records that declare one. Everything else is listed by date below.
216217

217218
### 2026-11
218219

220+
- [陈述的闭包、单一读者与六项功能:十四项缺陷的收敛设计](2026-11-27-stated-closure-single-reader-and-feature-designs.md) — landed
219221
- [clang BMI 的截断与私有模块片段判定的收窄](2026-11-26-clang-bmi-cutoff-and-private-fragment-refinement-design.md) — active
220222
- [测试与 CI 一轮的收尾:平台列未命中的刷新条件(mcpp#996)、`i686-windows-msvc` 行、工作区索引与引号键的迁移、索引的全量验证](2026-11-22-test-round-wrap-up-plan.md) — active
221223
- [生态级方案:内核接口的供给与能力,派生状态的核对,存储的引用](2026-11-22-kernel-interface-and-derived-state-ecosystem-design.md) — active
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
# The resolutions of a path to its canonical form only fall (design 2026-11-27 §4.6, mcpp#1024).
3+
#
4+
# A path the user or the environment gives is opened and handed to a program as it is spelled; its
5+
# canonical form is an identity, asked of mcpp.libs.path_identity, which reports when it cannot be
6+
# read. Each file's count of `canonical(` and `weakly_canonical(` called on std::filesystem is at
7+
# most its line in path-identity.baseline; a file not listed has none. A line falls as its calls
8+
# move to the identity module (an identity) or to the given spelling (an address).
9+
set -u
10+
cd "$(dirname "$0")/../.."
11+
12+
baseline=.github/tools/path-identity.baseline
13+
[ -f "$baseline" ] || { echo "::error::missing $baseline"; exit 1; }
14+
15+
current=$(grep -rcE '(filesystem|fs)::(weakly_)?canonical\(' src modules \
16+
--include='*.cpp' --include='*.cppm' 2>/dev/null \
17+
| grep -v ':0$' | grep -v '^modules/libs/src/path_identity.cppm:' | grep -v '/tests/' \
18+
| sed 's/:/ /' | sort)
19+
20+
rc=0
21+
while read -r file n; do
22+
[ -n "$file" ] || continue
23+
allowed=$(awk -v f="$file" '$1 == f { print $2 }' "$baseline")
24+
if [ -z "$allowed" ]; then
25+
echo "::error::$file resolves a path to its canonical form $n time(s); ask mcpp.libs.path_identity, or open the given spelling"
26+
rc=1
27+
elif [ "$n" -gt "$allowed" ]; then
28+
echo "::error::$file resolves a path to its canonical form $n times, more than the $allowed of $baseline"
29+
rc=1
30+
elif [ "$n" -lt "$allowed" ]; then
31+
echo "note: $file resolves $n times, fewer than the $allowed of $baseline; lower its line"
32+
fi
33+
done <<< "$current"
34+
[ "$rc" = 0 ] && echo "OK: no file resolves a path to its canonical form more often than $baseline states"
35+
exit "$rc"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
modules/manifest/src/glob.cppm 5
2+
src/build/engine_package.cppm 2
3+
src/build/hermetic.cppm 1
4+
src/build/plan.cppm 2
5+
src/build/prepare/features.cpp 4
6+
src/build/prepare/graph.cpp 3
7+
src/build/prepare/manifest.cpp 1
8+
src/build/prepare/plan.cpp 2
9+
src/build/prepare/platform.cpp 1
10+
src/build/prepare/state.cppm 1
11+
src/build/prepare/windows_resources.cpp 2
12+
src/build/resources.cppm 1
13+
src/build/runtime_validation.cppm 3
14+
src/build/schedule/compiler_transaction.cppm 2
15+
src/build/schedule/detach_codegen.cppm 2
16+
src/config.cppm 1
17+
src/home/files.cpp 1
18+
src/modgraph/scanner.cppm 1
19+
src/pack/distribution.cppm 2
20+
src/pack/pack.cppm 5
21+
src/pm/lock_io.cppm 1
22+
src/pm/patch.cppm 1
23+
src/project.cppm 3
24+
src/provider/xlings/xlings.cpp 1
25+
src/runtime/binding.cppm 4
26+
src/runtime/elf.cppm 2
27+
src/toolchain/base_probe.cppm 4
28+
src/toolchain/clang.cpp 2
29+
src/toolchain/post_install.cppm 3
30+
src/toolchain/registry.cppm 2

‎.github/tools/system-names.baseline‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ haiku 0
1414
dos 0
1515
uefi 0
1616
is_linux 26
17-
is_windows 123
17+
is_windows 122
1818
is_macos 28
1919
is_apple 5
2020
is_ios 7

‎.github/workflows/ci.yml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,9 @@ jobs:
276276
- name: The tests wait for a time no more often than the baseline states
277277
run: bash .github/tools/check_waits.sh
278278

279+
- name: Paths are resolved to their canonical form no more often than the baseline states
280+
run: bash .github/tools/check_path_identity.sh
281+
279282
- name: Only the adapter and the composition root name the provider
280283
run: python3 .github/tools/check_provider_boundary.py
281284

‎CHANGELOG.md‎

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,137 @@
44
> Each `## [<version>]` section is that release's notes. Entries are written in English
55
> from 2026.9.28.3 on; earlier entries remain as written.
66

7+
## [2026.11.27.1] - 2026-11-27
8+
9+
### Changed
10+
11+
- A dependency's shared library is named by its package. Its file and its SONAME take the
12+
package's qualified name, made a file name by the function that names the package's object
13+
directory: `compat.sdl3`'s target `sdl3` builds `libcompat_sdl3.so`, and a target named
14+
otherwise than its package follows the package's name (`libcompat_sdl3_extra.so`). A package of
15+
the default namespace is spelled by its bare name: a target named as its package keeps its
16+
library's name, and one named otherwise follows the package's name (`libdep_depshared.so`). The
17+
root package and a selected member keep their target's name, and a target that states `soname`
18+
is loaded by the name it states. Two packages whose libraries would be loaded by one name are
19+
refused at planning with `[soname-collision]`, naming both. Before, `compat.sdl3` and
20+
`mcpplibs.mwrap.sdl3` both made `libsdl3.so`. A script outside mcpp that names a dependency's
21+
shared library by its file name follows the change (docs/04, mcpp#975).
22+
- The `PATH` of a build program, a test and the program of `mcpp run` is composed by one
23+
function, the same on every host: the directories of the tools the graph states, then the
24+
declared environment's `bin` when the project declares one, then the `PATH` mcpp was started
25+
with. A build program that calls a tool the graph states by its bare name gets the stated one,
26+
and a test finds a tool stated with `when = "run"` on Windows and macOS as on Linux. Before, a
27+
build program's `PATH` had no stated tool, and a test's held the toolchain's environment `bin`
28+
on Linux only (docs/23, mcpp#926).
29+
- `mcpp add` writes the form the table already uses for the namespace: the short key in an
30+
existing `[dependencies.<ns>]` section, else the dotted key `<ns>.<name>` in `[dependencies]`;
31+
a package of the default namespace is a bare key. Before, it could write a
32+
`[dependencies.<ns>]` header after dotted keys had defined that table, which TOML 1.0 and every
33+
strict reader refuse. `mcpp remove` takes `--dev` and `--build`, as `mcpp add` does
34+
(docs/05, mcpp#964).
35+
- The code text of a source, its text with comments and literals blanked, has one reader, shared
36+
by the module scanner, the build optimizations and the check of module names a package
37+
declares. An `export module` inside a raw string literal or a comment no longer declares a
38+
module (mcpp#963).
39+
- The cache entry of a `path` dependency or a `path` host tool records every tree that uses it,
40+
one file per tree under the entry's `users/`. A tree that writes or hits the entry of an edited
41+
content withdraws itself from the entries of its earlier contents, and an entry is removed when
42+
no tree uses it. Before, an edit in one checkout removed the entry another checkout's plan named. The
43+
`source` record of an earlier mcpp is read as the first user and is not written, so an earlier
44+
mcpp that shares the home removes none of the new entries (docs/09, mcpp#1025).
45+
- The home keeps the spelling it is given: a home named through a symbolic link is used under
46+
that name in every path mcpp opens, starts or prints, and its physical path is used only to
47+
decide whether two paths are one object. A comparison that cannot be made is made on the
48+
spelling and reported as degraded. A check in CI holds the physical-path calls outside the
49+
identity function to a baseline that only shrinks (docs/25, mcpp#1024).
50+
- `mcpp publish` normalizes every dependency table, the tables under `[target.<selector>]` and
51+
each `[feature-deps.<feature>]` included, through one enumeration of a manifest's dependency
52+
tables, which the loader and the manifest editor also walk. A `path` dependency of a feature is
53+
published by its version, and so is a workspace member that lies inside the package's directory
54+
(mcpp#962).
55+
- The `host-module-in-dependencies` warning names the two commands that move the entry:
56+
`mcpp remove <package>`, then `mcpp add --build <package>@<version>` (mcpp#993).
57+
- mcpp's Windows images reserve 8 MiB of stack for the main thread, the size Linux and macOS give
58+
it. A command nests whole builds in one process: `mcpp pack` prepares the program, a host tool
59+
its platform names and that tool's build programs. Measured on the openkal canary, this held
60+
about 1 MiB of frames, the whole of a PE image's default reserve.
61+
62+
### Added
63+
64+
- An `import` inside a conditional block (`#if`, `#ifdef`, ...) is read by the compiler's
65+
dependency scan with the unit's own compile words, on GCC and on Clang (`clang-scan-deps`), and
66+
the unit imports what the condition selects. Before, the lexical scan refused the unit. A module
67+
declaration in a conditional block is read the same way; header units are still refused, and so
68+
is such a unit under MSVC, which has no scan at planning (docs/04, mcpp#1026).
69+
- `mcpp add --build` writes the dependency into `[build-dependencies]` (docs/05, mcpp#993).
70+
- `[profile.<name>] dialect_cxxflags`, with the meaning of `[build] dialect_cxxflags` and appended
71+
after it: it reaches every unit of the graph and the `std` module. A workspace's profile takes
72+
it too. SPEC-004 §9 states that a profile's `cflags` and `cxxflags` reach the root package and
73+
the selected members, and its `opt`, `debug`, `ndebug`, `dialect_cxxflags` and `ldflags` the
74+
whole graph. An unknown key in a profile is reported (docs/04, mcpp#1025).
75+
- Shell completion. `mcpp self completion [bash|zsh|fish|powershell]` writes into
76+
`<home>/config/shell/` a script that passes the words before the cursor to `mcpp __complete`,
77+
and prints the line that loads it. mcpp answers from its command tree, with the profiles,
78+
members and dependencies of the manifest in the directory, its target rows, the installed
79+
toolchains and the packages of the local index copies; a completion reads only what is on disk
80+
and initializes no home. The engine is mcpplibs.cmdline 0.0.6 (docs/01, mcpp#794).
81+
- A host tool's store entry holds, beside the executable, each shared object its link read from
82+
its own build, and lists them; an entry without them is built again. Before, a tool that linked
83+
a library of its graph shared failed to start from the store (docs/30, mcpp#535).
84+
- The file a link reads for a `DT_NEEDED` is the file the loader loads. After an ELF image is
85+
linked, the name is resolved over the image's search path and compared with the shared object
86+
the link recorded reading (`--dependency-file`), as an object and then by content; another file
87+
is refused with `[runtime-closure]`, naming both. A name nothing answers at load time carries
88+
the same token. Under `MCPP_ALLOW_HOST_LIBS` a difference is inconclusive (docs/04, mcpp#537).
89+
- An ELF shared image that asks for the static TLS block (`DF_STATIC_TLS`) with a TLS segment
90+
larger than glibc serves an image loaded by `dlopen` (512 bytes) is reported; when its exact
91+
`exports` say a host enters it by name, it is refused with `[static-tls-image]` (docs/04,
92+
mcpp#907).
93+
- A graph that supplies the C library and no C++ ABI, whose units import the `std` module, is
94+
refused at planning with `[layer-requirement]` and two remedies, a dependency that provides
95+
`mcpp:c++-abi` or `[build] cxx_runtime = "host-coupled"`. Before, the `std` module's precompile
96+
failed inside the toolchain's headers (docs/22, SPEC-002 §3.11, mcpp#898).
97+
- Before `mcpp run` and `mcpp test` execute an artefact whose `#!` line names a program that is
98+
not on its `PATH`, a note names the program and gives the commands that install a toolchain
99+
descriptor, with the toolchain the build used (docs/20, mcpp#621).
100+
- A library a program finds only in the default environment's union view, for a project that
101+
declares no environment, is reported, naming the program and the library (docs/23).
102+
- The features of `examples/11-features` state their descriptions, and a test holds that a
103+
package's descriptions are the same from its manifest, an inline descriptor and an installed
104+
payload (mcpp#1018).
105+
106+
### Deprecated
107+
108+
- `reopened-dotted-table` (until 2027.3): a `[header]` that reopens a table dotted keys defined.
109+
The two are read together and reported; the next `mcpp add` to that table writes the header's
110+
entries as dotted keys (docs/51).
111+
- `implicit-default-environment` (until 2027.3): for a project that declares no environment, the
112+
default environment's union view on the run-time search path and the link's `--sysroot`, and
113+
its `bin` on a test's `PATH` outside Windows (docs/23, docs/51).
114+
- `unmatched-exact-export` (until 2027.3): an exact `exports` name the shared image does not
115+
define, which was dropped from the published set without a word; it is reported (docs/04,
116+
docs/51).
117+
118+
### Fixed
119+
120+
- A build with no edit after an edit of a module compiles nothing under clang. clang names every
121+
BMI an importer read by the absolute path it finds it through (`-fprebuilt-module-path`), and the
122+
graph names the BMI below the build directory; ninja held the two spellings as two files, so the
123+
importer of an importer whose BMI an edit changed was compiled by the next build, which had no
124+
edit. The edge that writes a BMI now states the absolute spelling as an implicit output too
125+
(SPEC-018 §1 item 6, mcpp#1015).
126+
- `examples/11-features/greeter` stated `opt_level` in a profile, which is no profile key, and
127+
the profile built without it; it states `opt`.
128+
- A build after a failed build that stated `MCPP_PRIVATE_FRAGMENT`, `MCPP_BMI_SCHEDULE` or
129+
`MCPP_BUILDOPT` is the build before it. In 2026.11.26.1 the statement was part of the record of
130+
a build, which a build writes when it succeeds: a build that stated one and failed left its
131+
graph under the record of the build before, and a plain build then replayed that graph and
132+
failed the same way until a source or the manifest was edited. On GCC that is the invocation a
133+
failure's `tip:` gives (`MCPP_PRIVATE_FRAGMENT=conservative mcpp build`), which fails where the
134+
purview before the fragment holds a condition. The statement is now part of the request the
135+
graph itself names (`request=` on the first line of `build.ninja`), which every fast path
136+
compares before replaying it (SPEC-019 §9 item 5).
137+
7138
## [2026.11.26.1] - 2026-11-26
8139

9140
### Changed

‎docs/01-getting-started.md‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,32 @@ mcpp --version
7575
> rather than using `source`, and verify the active command with
7676
> `Get-Command mcpp.exe`.
7777
78+
### Shell completion (2026.11.27.1+)
79+
80+
`mcpp self completion` writes the completion script of a shell -- `bash`,
81+
`zsh`, `fish` or `powershell`, named as the argument, taken from `SHELL`, or
82+
`powershell` where `SHELL` is unset and `PSModulePath` is set -- into
83+
`<home>/config/shell/`, and prints the line that loads it. That line goes
84+
into the shell's own configuration, which mcpp does not edit:
85+
86+
```
87+
$ mcpp self completion bash
88+
Wrote /home/user/.mcpp/config/shell/mcpp.bash
89+
source '/home/user/.mcpp/config/shell/mcpp.bash' # in ~/.bashrc
90+
```
91+
92+
The script holds no command of mcpp's: it passes the words before the cursor to
93+
`mcpp __complete`, and mcpp answers from its own command tree, so a later
94+
release that adds a command or an option completes it with the same script.
95+
Beside subcommands and options, the answer holds the profiles and members of
96+
the manifest in the current directory, the dependencies `mcpp remove` takes,
97+
the targets mcpp has rows for, the toolchains installed in the home
98+
(`gcc@16.1.0`) and the packages of the local index copies, each spelled as a
99+
dependency key spells it: a package of the default namespace by its bare name,
100+
and by its qualified name once the word begins with `mcpplibs.`. A completion
101+
reads only what is on disk: it initializes no home, writes nothing and fetches
102+
nothing. `--print` writes the script to standard output instead of the home.
103+
78104
## Creating a Project
79105

80106
```bash

0 commit comments

Comments
 (0)