Skip to content

WIP: 2036 S2 introspection faces project from the single registry; disclose live claims - #2075

Merged
caomengxuan666 merged 1 commit into
masterfrom
fix/2036-s2-introspection
Oct 29, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
fix/2036-s2-introspection

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

WIP: #2036 S2 — introspection faces project from the single registry; live in-process claims are disclosed instead of being reported as files.

Fixes #2044
Refs #2036

Convergence (single source: src/executor/command_registry.rs)

Face Before After
type / command -v / -V (executor describe) BUILTIN_NAMES + the executor's 15-name posix-special predicate same table (pinned == registry) + the registry's GNU 16-name special set
compgen -b / -A builtin complete.rs SHELL_BUILTINS hand copy (61, no env) registry projection (62)
compgen -A keyword, command candidates SHELL_KEYWORDS hand copy registry projection
compgen -A helptopic HELP_TOPIC_COMPLETIONS hand copy (90, incl. 13 set -o names GNU does not treat as topics) help topic table projection (78 = measured GNU 77 + env)
enable, enable -a, enable -s, name validation enable.rs ALL_BUILTINS (61) + SPECIAL_BUILTINS hand copies registry projection
builtins/type.rs + builtins/command.rs fallback describe private 62-name matches! copies registry projection
help topics env missing — a builtin with no help face env topic + bare-help entry added; dead HELP_TOPICS copy removed

Rulings recorded in this slice

  • Disclosure (the core ruling): registry rows whose class claims the simple-command point (HiddenFastpath / Fastpath / EmulatedExternal) now carry Introspection::Emulated. While the claim is live, type X prints X is a shell emulation of <path>, type -t X prints emulation, command -V the sentence, command -v the bare name (invoking the name reproduces the in-process behavior; invoking the path would not), type -p is silent-but-found, and type -a prints the claim line plus the file lines. Shape-scoped claims (pipeline-only, comsub-only, the diff shortcut, the display bridge) keep the file answer. When the claim stands down, the plain file / not-found answer returns. Liveness reuses the dispatch test verbatim per face: host flag for the emulation layer, the shared emulated_external_stands_down predicate, the WindowsOnly cfg gate (tput).
  • KD-1 closed: env is in every projection; enable env / enable -n env now manage it.
  • KD-2, report side closed: the registry owns the special-builtin set — GNU's 16 names (builtins/mkbuiltins.c:148-154; the flag is applied by name, mkbuiltins.c:819-820; measured via enable -s on GNU bash 5.3.20). POSIX-mode type source now reports "a special shell builtin" (GNU builtins/type.def:262-270). The execution-side predicate still lacks source; a registry pin holds the remainder at exactly {"source"} for S3.
  • One dispatch-adjacent line, flagged for review: env's primary dispatch arm gains the per-arm enable -n check every sibling arm carries. With enable now managing env, the disable must be real rather than report-only; the S1 battery's shape-13 pin proves the fallthrough to the PATH body after enable -n env.

Boundary

No dispatch or execution change beyond the flagged env guard. Docs: docs/builtins.md introspection contract rewritten for §1/§3/§4.1, stty joins the fastpath machine block and table, tput joins §4.1.

Gates

Local (build slot; CI-uncovered pins are the reason these ran locally): cargo check with -D warnings clean; registry consistency 18/18 (new projection-equivalence, class⇒introspection mapping, and help-topic equation pins; the KD-1 drift pin turned positive); builtin_names doc-sync 8/8; S1 precedence/introspection battery 20/20; regression.rs zsh pin updated (61→62, its subject unchanged) and green; help_pages 12/12; executor_tests full-run failure set identical to baseline master's except one proven flake (part_080 procsub rewrite, fail→pass across isolated reruns).

CI adjudicates the rest at full-green equivalence (canary included), including the new Windows product-form battery tests/issue2036_s2_introspection_windows.rs (WinuxCmd-style applets on PATH; tput live on Windows), which cannot run on this Linux host.

…se live claims

Fixes #2044 (env introspection drift, KD-1), refs #2036.

Name-list unification (one source = executor/command_registry):
- complete.rs: SHELL_BUILTINS / SHELL_KEYWORDS / HELP_TOPIC_COMPLETIONS
  hand copies deleted; compgen -b, the builtin/keyword actions, the
  enabled-builtin candidates and command candidates project from the
  registry; the helptopic action projects from help's topic table
  (drops 13 set -o option names GNU does not treat as help topics;
  GNU 5.3.20 compgen -A helptopic = 77 names, matching help_texts).
- enable.rs: ALL_BUILTINS / SPECIAL_BUILTINS deleted; listings and
  validation project from the registry (specials = the registry's
  GNU 16-name set, mkbuiltins.c:148-154).
- builtins/type.rs + builtins/command.rs fallback describe: private
  62-name matches! copies replaced by the registry projection.
- help: env gains its missing topic + bare-help entry (it was the
  one builtin with no help face); dead HELP_TOPICS copy removed.

KD-2 (report side): the posix special-builtin wording in
type_describe now reads the registry set, so POSIX-mode
'type source' reports 'a special shell builtin' like GNU
(type.def:262-270; the set is name-based, mkbuiltins.c:819-820).
The execution-side predicate still lacks source; the registry pins
the remainder at exactly {source} for S3.

Disclosure ruling (the slice's core): rows whose class claims the
simple-command point (HiddenFastpath/Fastpath/EmulatedExternal) get
Introspection::Emulated. While the claim is live - tested with the
dispatch test itself per face (host flag for the emulation layer,
the shared stand-down predicate, the WindowsOnly cfg gate) -
type prints 'X is a shell emulation of <path>', type -t prints
'emulation', command -V the sentence, command -v the bare name,
type -p silent-but-found; type -a prints the claim line plus the
file lines. Shape-scoped claims (pipeline/comsub/shortcut/bridge)
keep the file answer. Stand-down returns the plain file/not-found
answer, exactly as dispatch behaves.

One dispatch-adjacent line, flagged for review: env's primary arm
gains the per-arm enable -n check every sibling arm carries - with
enable now managing env, the disable must be real, not report-only.

Pins: registry consistency suite grows projection-equivalence,
class=>introspection mapping and help-topic equation pins (the KD-1
drift pin turned positive); the S1 battery's introspection section
asserts the disclosure forms and the compgen -b / enable -a sets
turned positive; new Windows battery pins the product form
(WinuxCmd-style applets on PATH, incl. tput live on Windows).
Two legacy expectations updated to the unified contract:
regression.rs enable -a count 61->62 (its subject, zsh-isms staying
gone, is unchanged) and cli_tests type -t cat file->emulation.
docs/builtins.md: S2 introspection contract, stty joins the
fastpath machine block + table, tput joins section 4.1.
@caomengxuan666

Copy link
Copy Markdown
Member Author

CI final state (run 40829138475 + niu-canary 40829138487): all jobs success — Rust tests (lib pins incl. the new registry projection/mapping/help-topic pins), Rust tests (macOS), GNU regression goldens and canaries (Windows; runs --lib and --test regression, so the registry pins and the updated enable -a count pin executed on Windows), Shell functionality tests, Cross-target check (linux/android), Cross-target check (darwin), niubash builds against this tree (the -D warnings pairing gate), API ledger tripwire, niu-canary. Mergeable: true.

One coverage note for the record: no CI job targets the integration batteries (same disposition as the S1 battery). The S1 unix battery's 20/20 was run locally through the build slot; the new Windows battery's body was type-checked locally (cfg-flip compile; a full windows-target check is unreachable on this host — the psm assembler step needs a mingw toolchain), and its execution belongs to the Windows comprehensive-test phase. Full gate ledger is in the cluster REPORT.

@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 29, 2026 06:35
@caomengxuan666
caomengxuan666 merged commit b587937 into master Oct 29, 2026
11 checks passed
caomengxuan666 added a commit that referenced this pull request Oct 29, 2026
One conflict, src/executor/command_registry.rs cat row: S2 (#2075)
replaced the row's introspection projection
(ExternalWithHashRecord -> Emulated; the old variant no longer
exists in the enum) while this branch aligned the adjacent gate
comment. Resolution keeps both facts: field = Emulated (S2
projection fact), comment = the #2066 gate fact (the host flag
gates the simple-command face and, since #2066, the pipeline
stage arm; the comsub faces are not flag-gated). No other file
conflicted; S2 did not touch pipeline_exec.rs.
@caomengxuan666
caomengxuan666 deleted the fix/2036-s2-introspection branch October 30, 2026 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[内省面漂移] env 被 type 报为内建却不出现在 compgen -b:BUILTIN_NAMES 62 与补全名单 61 已漂移

1 participant