mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-18 03:27:08 +00:00
merge: hapi v0.30.7
Six text conflicts, all resolved:
- cli/apiMachine + runner/run: adopt upstream's MachinePathPolicy; keep the
local policy that browsing stays disabled until --workspace-root is set
(banner text + upstream's browse test adapted to assert the local gate).
- cli/codex root.test.ts: keep both the syncHistory split test and upstream's
change_title/name test; fixture return merges metadata + syncHistory.
- web/SessionList: combine the local personal/global pinned split with
upstream's search-relevance ranking (deps union).
- web/AskUserQuestionFooter: take upstream's draft-restore effect and thread
the local skippedByQuestion through the draft store; the local DSH skip test
moves to AskUserQuestionFooter.skip.test.tsx so upstream's vi.mock setup in
the original file cannot shadow it.
Also: bun install for the assistant-ui 0.15.21 bump, regenerated
shared/fixtures from the merged pipeline.
Test status vs the pre-merge baseline (d6cf54d7), identical pre-existing
failures only: cli 7, hub 2 (opencodeClear), web 35, shared 2 (DSH); relay
clean; typecheck clean across all packages.
This commit is contained in:
@@ -765,6 +765,51 @@ describe('ApiMachineClient list-directory handler', () => {
|
||||
return entries.map((entry) => entry.name).sort()
|
||||
}
|
||||
|
||||
it('refuses browsing when no workspace roots are configured', async () => {
|
||||
// Local deployment policy: a machine without --workspace-root keeps
|
||||
// directory browsing disabled instead of exposing the runner account's
|
||||
// whole filesystem to the web UI.
|
||||
const machine = makeMachine('machine-ls-unrestricted')
|
||||
const client = new ApiMachineClient('cli-token', machine)
|
||||
try {
|
||||
const result = await callListDirectory(client, machine.id, { path: workspaceRoot })
|
||||
expect(result).toMatchObject({
|
||||
success: false,
|
||||
error: 'Workspace browsing is not enabled for this machine'
|
||||
})
|
||||
} finally {
|
||||
client.shutdown()
|
||||
}
|
||||
})
|
||||
|
||||
it('lists in-root directory links and rejects links escaping explicit workspace roots', async () => {
|
||||
const outside = mkdtempSync(join(tmpdir(), 'hapi-machine-ls-outside-'))
|
||||
mkdirSync(join(workspaceRoot, 'visible-dir', '.git'))
|
||||
symlinkSync(join(workspaceRoot, 'visible-dir'), join(workspaceRoot, 'linked-repo'), 'dir')
|
||||
symlinkSync(outside, join(workspaceRoot, 'escape'), 'dir')
|
||||
const machine = makeMachine('machine-ls-links')
|
||||
const client = new ApiMachineClient('cli-token', machine, [workspaceRoot])
|
||||
try {
|
||||
const result = await callListDirectory(client, machine.id, { path: workspaceRoot })
|
||||
expect(result).toMatchObject({
|
||||
success: true,
|
||||
entries: expect.arrayContaining([
|
||||
expect.objectContaining({ name: 'linked-repo', type: 'directory', isGitRepo: true }),
|
||||
]),
|
||||
})
|
||||
expect(entryNames(result)).not.toContain('escape')
|
||||
expect(await callListDirectory(client, machine.id, { path: join(workspaceRoot, 'escape') }))
|
||||
.toEqual({ success: false, error: 'Path is outside workspace roots' })
|
||||
expect(await callListDirectory(client, machine.id, { path: join(workspaceRoot, '..') }))
|
||||
.toEqual({ success: false, error: 'Path is outside workspace roots' })
|
||||
expect(await callListDirectory(client, machine.id, { path: join(workspaceRoot, 'linked-repo') }))
|
||||
.toMatchObject({ success: true })
|
||||
} finally {
|
||||
client.shutdown()
|
||||
rmSync(outside, { recursive: true, force: true })
|
||||
}
|
||||
})
|
||||
|
||||
it('filters dot-prefixed entries by default', async () => {
|
||||
const machine = makeMachine('machine-ls-1')
|
||||
const client = new ApiMachineClient('cli-token', machine, [workspaceRoot])
|
||||
|
||||
Reference in New Issue
Block a user