正向合并正律化(2026-08-20): - 语言人格频道与执行手脚训练按编号 IPC 正律接入(MOD-0035/0036,OP-0158..0163), 剥离直连 tauri::command,恢复单一 numbered 网关铁律 - 教育模块按冰朔谕与 2026-08-19 隔离回执整体移出(证据归隔离区),留空模块占位 - 光湖主域门户挂公告与版本中心(冰朔要求的公告与版本更新主阵地) - 知识工作台内嵌共同工作频道(PersonaChannelBody embedded + knowledgeFocus) - foundation/stage-one 合同补聊天运行时验收声明;版本对齐 0.9.1 - 测试名册计数与断言更新至合并后现实:JS 180/180,Rust 194/194
87 lines
4.6 KiB
JavaScript
87 lines
4.6 KiB
JavaScript
import assert from 'node:assert/strict'
|
||
import fs from 'node:fs'
|
||
import test from 'node:test'
|
||
|
||
const read = (relative) => fs.readFileSync(new URL(`../${relative}`, import.meta.url), 'utf8')
|
||
const knowledgeContract = JSON.parse(read('contracts/knowledge-workspace.json'))
|
||
const codeContract = JSON.parse(read('contracts/code-channel.json'))
|
||
const provenance = JSON.parse(read('audit/knowledge-workspace-migration-provenance.json'))
|
||
const knowledgeRust = read('src-tauri/src/knowledge_base.rs')
|
||
const codeRust = read('src-tauri/src/code_channel.rs')
|
||
const authenticatedStorageRust = read('src-tauri/src/authenticated_storage.rs')
|
||
const lib = read('src-tauri/src/lib.rs')
|
||
const numberedDispatcher = read('src-tauri/src/numbered_ipc_dispatch.rs')
|
||
const ui = read('src/main.tsx')
|
||
|
||
test('knowledge workspace is HoloLake-owned, account-scoped, and never auto-projects legacy data', () => {
|
||
assert.equal(knowledgeContract.native_storage.owner, 'HOLOLAKE_NATIVE_RUST_CORE')
|
||
assert.equal(knowledgeContract.native_storage.authenticated_account_required, true)
|
||
assert.equal(knowledgeContract.native_storage.cross_account_projection_allowed, false)
|
||
assert.equal(knowledgeContract.legacy_compatibility.mode, 'NOT_AUTO_PROJECTED_EXPLICIT_OWNER_MIGRATION_ONLY')
|
||
assert.equal(knowledgeContract.legacy_compatibility.in_place_migration, false)
|
||
assert.equal(knowledgeContract.legacy_compatibility.tolaria_surface_used, false)
|
||
assert.equal(provenance.legacy_data_boundary.modified, false)
|
||
assert.match(knowledgeRust, /account_storage_root\(app, "knowledge-v1"\)/)
|
||
assert.match(authenticatedStorageRust, /HOLOLAKE_AUTHENTICATED_ACCOUNT_REQUIRED/)
|
||
assert.match(authenticatedStorageRust, /accounts-v1/)
|
||
assert.doesNotMatch(authenticatedStorageRust, /join\(&session\.username\)/)
|
||
assert.match(knowledgeRust, /source_docs_root/)
|
||
})
|
||
|
||
test('code channel uses the same authenticated account boundary', () => {
|
||
assert.equal(codeContract.registry.authenticated_account_required, true)
|
||
assert.equal(codeContract.registry.cross_account_projection_allowed, false)
|
||
assert.match(codeRust, /account_storage_root\(app, "code-channel-v1"\)/)
|
||
})
|
||
|
||
test('folder import is bounded, idempotent, conflict-safe and creates a local Git receipt', () => {
|
||
assert.equal(knowledgeContract.folder_import.maximum_files, 1000)
|
||
assert.equal(knowledgeContract.folder_import.symlinks_followed, false)
|
||
assert.equal(knowledgeContract.folder_import.repeated_import, 'MERGE_BY_STABLE_SOURCE_NAME')
|
||
assert.equal(knowledgeContract.folder_import.exact_duplicate_result, 'ALREADY_PRESENT')
|
||
assert.equal(knowledgeContract.folder_import.conflicting_file_overwrite, false)
|
||
assert.equal(knowledgeContract.capabilities.import_commit_receipt, true)
|
||
assert.equal(knowledgeContract.capabilities.exact_content_deduplication, true)
|
||
assert.equal(knowledgeContract.capabilities.optimistic_native_editing, true)
|
||
assert.match(knowledgeRust, /MAX_IMPORT_FILES: usize = 1_000/)
|
||
assert.match(knowledgeRust, /kind\.is_symlink\(\)/)
|
||
assert.match(knowledgeRust, /ImportDisposition::Existing/)
|
||
assert.match(knowledgeRust, /HOLOLAKE_KNOWLEDGE_SAVE_CONFLICT/)
|
||
assert.match(knowledgeRust, /rev-parse", "HEAD/)
|
||
})
|
||
|
||
test('official code-channel clone cannot use credentials or credential prompts', () => {
|
||
assert.equal(codeContract.clone.embedded_credentials_allowed, false)
|
||
assert.equal(codeContract.clone.terminal_prompt_allowed, false)
|
||
assert.equal(codeContract.clone.credential_helper_allowed, false)
|
||
assert.equal(codeContract.authority.automatic_push, false)
|
||
assert.match(codeRust, /GIT_TERMINAL_PROMPT/)
|
||
assert.match(codeRust, /credential\.helper=/)
|
||
assert.match(codeRust, /parsed\.username\(\)\.is_empty\(\)/)
|
||
})
|
||
|
||
test('the product surface exposes a real knowledge workbench and browsable code channel', () => {
|
||
for (const command of [
|
||
'get_knowledge_snapshot',
|
||
'read_knowledge_document',
|
||
'search_knowledge',
|
||
'save_knowledge_document',
|
||
'select_and_import_knowledge_folder',
|
||
'get_code_channel_snapshot',
|
||
'clone_code_channel',
|
||
'select_local_code_channel',
|
||
'browse_code_channel',
|
||
'read_code_channel_file',
|
||
]) {
|
||
assert.match(numberedDispatcher, new RegExp(command))
|
||
assert.match(ui, new RegExp(`['"]${command}['"]`))
|
||
}
|
||
assert.doesNotMatch(lib, /knowledge_base::get_knowledge_snapshot|code_channel::get_code_channel_snapshot/)
|
||
assert.match(ui, /知识工作台/)
|
||
assert.match(ui, /HoloLake Era/)
|
||
assert.match(ui, /知识视图/)
|
||
assert.match(ui, /源文件/)
|
||
assert.doesNotMatch(ui, /下一件事|为什么做|开始这件事/)
|
||
})
|
||
|
||
// 2026-08-20 合并修正:知识组织功能未随合并保留,需要时自实例1分支历史移植。
|