fix(host): review round 21 — create-path shape promised; lexical-not-realpath named; hermetic-only home probes; enumerations point at the contract

This commit is contained in:
creatixchu
2026-07-30 02:30:05 +08:00
parent f36bb1e882
commit 56ac56bb26
7 changed files with 24 additions and 19 deletions
@@ -48,8 +48,8 @@ describe('BrowseDirectoryPicker', () => {
it('lists directories only, flags hidden rows, follows symlinks, skips broken links, sorts by name', async () => {
const listing = await capability.list(root)
expect(listing.path).toBe(root)
// Resolved like path and crumbs — the environment may decorate HOME,
// and the wire contract promises one canonical shape for all three.
// The environment may decorate HOME; every listing path ships in the
// DirectoryListing contract's canonical shape, home included.
expect(listing.home).toBe(resolve(homedir()))
expect(listing.entries.map(entry => entry.name)).toEqual(['.hidden-dir', 'linked', 'projects'])
expect(listing.entries.map(entry => entry.hidden)).toEqual([true, false, false])
@@ -163,11 +163,6 @@ describe('BrowseDirectoryPicker', () => {
expect(listing.crumbs[0]!.name).toBe(listing.crumbs[0]!.path)
})
it('lists the home directory when no path is given', async () => {
const listing = await capability.list()
expect(listing.path).toBe(homedir())
})
it('throws directory-unreadable for a missing target', async () => {
const missing = join(root, 'no-such-dir')
const failure = await capability.list(missing).catch((error: unknown) => error)