Skip to content

WIP: special-paths: publish the registry consumer face for niu S5 (niubash#627/#628) - #2011

Merged
caomengxuan666 merged 1 commit into
masterfrom
feat/s5-registry-faces
Oct 29, 2026
Merged

caomengxuan666 merged 1 commit into
masterfrom
feat/s5-registry-faces

Conversation

@caomengxuan666

@caomengxuan666 caomengxuan666 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Companion face for the niubash S5 slice (completion #627 + highlighting #628 per the vfs audit, ~/workspace/vfs-audit/REPORT.md §6.2/6.4/6.5): the audit's unified-layer ruling is that both host faces ask the engine's special-path registry — but the registry was unreachable from outside this crate (pub mod special_paths, every item pub(crate)). This PR publishes the consumer face. No semantic change: classification judgments are byte-identical; the existing in-crate test matrix is untouched.

What's here

  • special_paths items pub(crate) → pub: the class enum, classify_special_path, and the per-class queries (is_net_redirect_target, is_shell_null_device, fd_alias_target, synthetic_proc_content, is_synthetic_link_path, synthetic_link_target, synthetic_proc_dir_entries). canonical_fd_number stays internal.
  • special_dev_entries() (new, inside the registry module): the listable children of the shell-namespace /dev — leaf names (null/stdin/stdout/stderr) plus the fd/tcp/udp prefix dirs. Pinned by special_dev_entries_match_classification, a two-way consistency check over the audit's /dev vocabulary: a spelling is listed ⟺ its family is classified special (fd alias / net redirect / null device). A future registry arm (e.g. D5 simulating /dev/zero) trips this pin until the table follows in the same change. /dev/zero, /dev/full, /dev/tty are deliberately not listed: the registry classifies them Filesystem today, so neither face may present them as simulated.
  • Executor::open_fds() -> Vec<u32> (new, public_accessors): the fd table's live fd numbers — the dynamic /dev/fd tier's source (audit §6.4: "the fd table itself", never a name list). Pinned end-to-end in tests/session_api.rs: the live set always holds the standard trio (plus any descriptors adopted from the host process, rubash#1557 — /dev/fd shows those too), exec 3>/dev/null adds 3, exec 3>&- removes it.

Consumers (niubash#677)

  • Completion: /dev static tier = special_dev_entries(); /dev/fd + /proc/self/fd dynamic tier = open_fds() (synced through CompletionState); /proc = synthetic_proc_dir_entries() unchanged. /dev/tcp//dev/udp complete to nothing (GNU has no hostname completion there).
  • Highlighting: classify_special_path + the enumeration faces as a pre-check before the filesystem existence test, so simulated paths stop falling to UnknownToken at command position — a miss still falls through (the existence check is not disabled).

Verification

  • New pin open_fds_reflect_the_session_fd_table (tests/session_api.rs, not in rubash CI's named targets) run locally through the build slot: first run caught the pin's own wrong premise (fresh set [0, 1, 2, 9] — an adopted host descriptor, see the fix-up commit), pin corrected to delta form; re-run queued.
  • lib/roster + regression gates: CI on this PR (per the 2026-10-29 small-task-CI rule).

Merge order: this PR first — niubash#677 calls these faces and its CI builds against master, so it stays red until this lands (transitional state, same shape as #1999 → #668).

Refs unixwin/niubash#627
Refs unixwin/niubash#628

…5 faces

Enabler for niubash#627/#628 (vfs audit slice S5: completion and
highlighting ask the special-path registry). No semantic change —
the classification judgments are byte-identical; this only makes
the registry reachable from outside the crate and adds the two
enumeration faces its consumers need.

- special_paths: the classification enum/function and the
  per-class queries become pub (the module was already pub mod;
  every item was pub(crate), so the host could not ask the registry
  at all). canonical_fd_number stays internal.
- special_dev_entries(): the listable children of the
  shell-namespace /dev — leaf device/alias names plus the fd/tcp/udp
  prefix dirs. A two-way consistency pin
  (special_dev_entries_match_classification) proves the table
  against the classification over the audit's /dev vocabulary, so a
  future registry arm trips the pin until the table follows in the
  same change. Spellings the registry does not classify
  (/dev/zero, /dev/full, /dev/tty — audit D5) are deliberately not
  listed: the open points treat them as plain filesystem paths.
- Executor::open_fds(): the session's open fd numbers from the fd
  table — the dynamic /dev/fd completion tier's source (audit
  §6.4: the fd table itself, never a name list). Pinned end-to-end
  in tests/session_api.rs: a fresh session holds [0, 1, 2],
  `exec 3>/dev/null` adds 3, `exec 3>&-` removes it.

Refs unixwin/niubash#627
Refs unixwin/niubash#628
@caomengxuan666
caomengxuan666 marked this pull request as ready for review October 29, 2026 01:29
@caomengxuan666
caomengxuan666 merged commit fa38665 into master Oct 29, 2026
10 of 11 checks passed
caomengxuan666 added a commit that referenced this pull request Oct 29, 2026
… table with #1898

Master advanced eight PRs while this family was in flight. The
one semantic intersection is PR #2011 (S5 registry faces,
niubash#627): it added special_dev_entries() — the listable /dev
table — with zero/full deliberately absent and a consistency pin
stating that a future /dev/zero simulation (audit D5) must
update the table in the same change. #1898 is that simulation:
the table now lists zero/full as leaf entries and the doc
comment records the move. Everything else auto-merged cleanly
(notably #2022's #1965 guard-strip alongside #1966, and #2010's
-D warnings hygiene).

Verified on the merged tree: cargo check --all-targets -D
warnings is clean for the library and every target this family
touches; the single remaining error (dead 'status' field in
tests/issue1941_1948_sim_layer_option_regressions.rs) is
byte-identical to master 1f007cc — master's own debt, not this
branch's.
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.

1 participant