chore: snapshot audited HoloLake convergence baseline
This commit is contained in:
parent
7a14c06e41
commit
1b6b17b5ab
47 changed files with 10722 additions and 87 deletions
|
|
@ -0,0 +1,26 @@
|
|||
import assert from 'node:assert/strict'
|
||||
import fs from 'node:fs'
|
||||
import test from 'node:test'
|
||||
|
||||
const frontend = fs.readFileSync(new URL('../src/main.tsx', import.meta.url), 'utf8')
|
||||
const architecture = JSON.parse(
|
||||
fs.readFileSync(new URL('../../../routing/hololake-current-architecture.json', import.meta.url), 'utf8'),
|
||||
)
|
||||
|
||||
test('returning to the main world preserves the authenticated session', () => {
|
||||
const handler = frontend.match(/const returnToMainWorld = \(\) => \{([\s\S]*?)\n \}/)?.[1] || ''
|
||||
|
||||
assert.match(handler, /setShowMainWorld\(true\)/)
|
||||
assert.doesNotMatch(handler, /signOutRepo|setRepoLogin\(null\)|sign_out_code_repo_login/)
|
||||
assert.match(frontend, /if \(!repoLogin \|\| showMainWorld\)/)
|
||||
})
|
||||
|
||||
test('main-world return and account sign-out remain separate visible actions', () => {
|
||||
assert.match(frontend, />返回主世界</)
|
||||
assert.match(frontend, />进入所属域</)
|
||||
assert.match(frontend, />退出账号</)
|
||||
assert.equal(
|
||||
architecture.current_native_edge.authenticated_main_world_navigation,
|
||||
'SOURCE_INTEGRATED_SESSION_PRESERVING_REENTRY',
|
||||
)
|
||||
})
|
||||
|
|
@ -0,0 +1,309 @@
|
|||
import assert from 'node:assert/strict'
|
||||
import fs from 'node:fs'
|
||||
import test from 'node:test'
|
||||
|
||||
const read = (path) => fs.readFileSync(new URL('../' + path, import.meta.url), 'utf8')
|
||||
const contract = JSON.parse(read('contracts/education-workspace.json'))
|
||||
const donors = JSON.parse(read('contracts/education-open-source-donor-assessment.json'))
|
||||
const industry = JSON.parse(read('contracts/subdomain-industry-routing.json'))
|
||||
const rust = read('src-tauri/src/education_workspace.rs')
|
||||
const translation = read('src-tauri/src/education_translation.rs')
|
||||
const lib = read('src-tauri/src/lib.rs')
|
||||
const ui = read('src/main.tsx')
|
||||
const documentEngine = read('src/modules/education-document-engine.tsx')
|
||||
const channelDocumentEngine = read('src/modules/channel-workbench/document-engine.tsx')
|
||||
const channelSpreadsheetEngine = read('src/modules/channel-workbench/spreadsheet-engine.tsx')
|
||||
const channelSpreadsheetModel = read('src/modules/channel-workbench/spreadsheet-model.ts')
|
||||
const moduleRuntime = JSON.parse(read('contracts/channel-module-runtime.json'))
|
||||
const marketplaceDevelopmentCatalog = JSON.parse(read('contracts/official-module-marketplace-development-catalog.json'))
|
||||
const adaptiveRendering = read('src/modules/education-adaptive-rendering.ts')
|
||||
const dataCleanup = read('src/modules/education-data.ts')
|
||||
|
||||
test('education package consumes the built-in account-scoped channel workbench', () => {
|
||||
assert.equal(contract.domain_entry, 'BRANCH_DOMAIN')
|
||||
assert.equal(contract.channel_id, 'GH-EDU-INIT-001')
|
||||
assert.equal(contract.native_storage.owner, 'HOLOLAKE_NATIVE_RUST_CORE')
|
||||
assert.equal(contract.native_storage.engine, 'SQLITE')
|
||||
assert.equal(contract.native_storage.authenticated_account_required, true)
|
||||
assert.equal(contract.native_storage.cross_account_projection_allowed, false)
|
||||
assert.equal(contract.native_storage.restart_readback_required, true)
|
||||
assert.equal(contract.document_module.state, 'DEVELOPMENT_FEATURE_MOUNTED')
|
||||
assert.equal(contract.table_module.state, 'DEVELOPMENT_FEATURE_MOUNTED')
|
||||
assert.equal(contract.foundation_dependency.module_id, 'hololake.builtin.channel-workbench')
|
||||
assert.match(contract.document_module.engine, /^CHANNEL_WORKBENCH_LEXICAL_0_49_0/)
|
||||
assert.match(contract.table_module.engine, /^CHANNEL_WORKBENCH_FORTUNE_SHEET_1_0_4/)
|
||||
assert.equal(contract.table_module.sensitive_field_visibility.local_default, 'VISIBLE')
|
||||
assert.equal(contract.table_module.sensitive_field_visibility.human_can_hide, true)
|
||||
assert.equal(contract.table_module.sensitive_field_visibility.human_can_show_again, true)
|
||||
})
|
||||
|
||||
test('education workspace commands require the authenticated storage root', () => {
|
||||
assert.match(rust, /account_storage_root\(app, "education-workspace-v1"\)/)
|
||||
for (const command of [
|
||||
'get_education_workspace_snapshot',
|
||||
'create_education_document',
|
||||
'read_education_document',
|
||||
'save_education_document',
|
||||
'archive_education_document',
|
||||
'create_education_table',
|
||||
'read_education_table',
|
||||
'save_education_table',
|
||||
'archive_education_table',
|
||||
'create_education_automation_rule',
|
||||
'save_education_automation_rule',
|
||||
'archive_education_automation_rule',
|
||||
'preview_education_automation_rule',
|
||||
'execute_education_automation_rule',
|
||||
]) {
|
||||
assert.match(lib, new RegExp('education_workspace::' + command))
|
||||
assert.ok(ui.includes("'" + command + "'") || ui.includes('"' + command + '"'))
|
||||
}
|
||||
assert.doesNotMatch(ui, /localStorage.*education/i)
|
||||
})
|
||||
|
||||
test('one built-in foundation and five development features are reachable from the education channel', () => {
|
||||
const education = industry.industries.find((item) => item.key === 'EDUCATION')
|
||||
assert.equal(education.initialization_channel.installed_open_source_modules, 0)
|
||||
assert.equal(education.initialization_channel.installed_native_modules, 1)
|
||||
assert.equal(education.initialization_channel.development_mounted_modules, 1)
|
||||
assert.ok(education.initialization_channel.module_slots.every((slot) => slot.state === 'DEVELOPMENT_MOUNTED'))
|
||||
assert.equal(education.initialization_channel.module_slots[1].state_label, '开发态模块 · 使用频道内置工作表引擎')
|
||||
assert.match(ui, /worldStage === 'educationDocuments'/)
|
||||
assert.match(ui, /worldStage === 'educationTables'/)
|
||||
assert.match(ui, /教育文档/)
|
||||
assert.match(ui, /教育表格数据/)
|
||||
assert.match(ui, /worldStage === 'educationAutomation'/)
|
||||
assert.match(ui, /教育自动化/)
|
||||
assert.match(ui, /worldStage === 'educationComposition'/)
|
||||
assert.match(ui, /原生组合视图/)
|
||||
})
|
||||
|
||||
test('native persistence enforces revision conflicts and bounded table data', () => {
|
||||
assert.match(rust, /HOLOLAKE_EDUCATION_DOCUMENT_REVISION_CONFLICT/)
|
||||
assert.match(rust, /HOLOLAKE_EDUCATION_TABLE_REVISION_CONFLICT/)
|
||||
assert.match(rust, /MAX_TABLE_COLUMNS: usize = 30/)
|
||||
assert.match(rust, /MAX_TABLE_ROWS: usize = 1_000/)
|
||||
assert.match(rust, /MAX_CELL_BYTES: usize = 10_000/)
|
||||
assert.match(rust, /archived = 1/)
|
||||
})
|
||||
|
||||
test('education documents expose formal templates and real title filtering', () => {
|
||||
assert.equal(contract.state, 'DEVELOPMENT_MODULE_SOURCE_MOUNTED_ACCEPTANCE_PENDING')
|
||||
assert.equal(contract.package.official_module_number, null)
|
||||
assert.equal(contract.package.registration_state, 'PENDING_FUNCTIONAL_ACCEPTANCE_AND_NUMBER_REGISTRATION')
|
||||
assert.ok(contract.document_module.capabilities.includes('FORMAL_TEACHING_TEMPLATES'))
|
||||
assert.ok(contract.document_module.capabilities.includes('TITLE_DIRECTORY_FILTER'))
|
||||
assert.match(ui, /EDUCATION_DOCUMENT_TEMPLATES/)
|
||||
assert.match(ui, /教学计划/)
|
||||
assert.match(ui, /教育项目会议纪要/)
|
||||
assert.match(ui, /学员阶段复盘/)
|
||||
assert.match(ui, /检索教育文档标题/)
|
||||
for (const capability of [
|
||||
'CREATE_COPY',
|
||||
'EXPLICIT_READ_AND_EDIT_MODES',
|
||||
'HUMAN_SETTINGS_MENU',
|
||||
'BASIC_FORMATTING_TOOLBAR',
|
||||
'NATIVE_READING_CANVAS',
|
||||
'EXPORT_MARKDOWN_AND_HTML',
|
||||
]) assert.ok(contract.document_module.capabilities.includes(capability))
|
||||
assert.match(ui, /文档设置/)
|
||||
assert.match(ui, /编辑与重命名/)
|
||||
assert.match(ui, /创建副本/)
|
||||
assert.match(ui, /移到可恢复归档/)
|
||||
assert.match(ui, /educationDocumentMode === 'edit'/)
|
||||
assert.match(documentEngine, /ChannelDocumentEngine/)
|
||||
assert.match(channelDocumentEngine, /频道内置文档引擎工具/)
|
||||
})
|
||||
|
||||
test('education table has four engine-backed views, filtering, sorting and bounded bulk paste', () => {
|
||||
for (const capability of [
|
||||
'CELL_CONTENT_FILTER',
|
||||
'COLUMN_SORT_ASCENDING_DESCENDING_OR_SOURCE_ORDER',
|
||||
'BOUNDED_PAGINATION_ROW_MODEL_FOR_LARGE_EDITABLE_TABLES',
|
||||
'GRID_AND_EDITABLE_CARD_VIEWS',
|
||||
'GROUPED_CLASSIFICATION_BOARD_FROM_SELECTED_FIELD',
|
||||
'LIVE_DATA_OVERVIEW_WITH_SELECTED_GROUP_AND_MEASURE',
|
||||
'HEADLESS_TABLE_DATA_DETACHED_OUTSIDE_TABLE_SURFACE',
|
||||
'MULTI_ROW_MULTI_COLUMN_TABULAR_PASTE',
|
||||
]) assert.ok(contract.table_module.capabilities.includes(capability))
|
||||
assert.match(ui, /parseEducationGridPaste/)
|
||||
assert.match(ui, /pasteEducationTableGrid/)
|
||||
assert.match(ui, />工作表<\/button>/)
|
||||
assert.match(channelSpreadsheetEngine, /Workbook/)
|
||||
assert.match(channelSpreadsheetEngine, /showFormulaBar/)
|
||||
assert.match(channelSpreadsheetEngine, /conditionFormat/)
|
||||
assert.match(channelSpreadsheetModel, /cell\.f/)
|
||||
assert.match(ui, /分类看板/)
|
||||
assert.match(ui, /数据概览/)
|
||||
assert.match(ui, /renderEducationBoard/)
|
||||
assert.match(ui, /renderEducationDashboard/)
|
||||
assert.match(ui, /动态分类对比/)
|
||||
assert.match(ui, /筛选教育表格数据/)
|
||||
assert.match(ui, /升序 ↑/)
|
||||
assert.match(ui, /降序 ↓/)
|
||||
assert.match(ui, /getPaginationRowModel/)
|
||||
assert.match(ui, /const educationTableEngineActive = worldStage === 'educationTables'/)
|
||||
assert.match(ui, /educationTableEngineActive \? activeEducationTable\?\.rows \|\| \[\] : \[\]/)
|
||||
assert.match(adaptiveRendering, /EDUCATION_EDITABLE_CELL_BUDGET = 240/)
|
||||
assert.match(adaptiveRendering, /function educationEditablePageSize/)
|
||||
assert.match(adaptiveRendering, /Math\.floor\(EDUCATION_EDITABLE_CELL_BUDGET \/ boundedColumns\)/)
|
||||
assert.match(adaptiveRendering, /buildEducationBaselineRenderPlan/)
|
||||
assert.match(adaptiveRendering, /validateEducationModelRenderProposal/)
|
||||
assert.match(adaptiveRendering, /MODEL_PROPOSAL_REJECTED/)
|
||||
assert.match(adaptiveRendering, /WAITING_HUMAN_CONFIRMATION/)
|
||||
assert.match(adaptiveRendering, /已优雅退回本地基础算法/)
|
||||
assert.match(ui, /基础算法自适应回执/)
|
||||
assert.match(ui, /教育表格分页/)
|
||||
assert.match(ui, /Math\.min\(30/)
|
||||
assert.match(ui, /Math\.min\(1000/)
|
||||
assert.ok(contract.table_module.capabilities.includes('HUMAN_SETTINGS_MENU'))
|
||||
assert.ok(contract.table_module.capabilities.includes('CREATE_COPY'))
|
||||
assert.match(ui, /表格设置/)
|
||||
assert.match(ui, /duplicateEducationTable/)
|
||||
assert.match(ui, /重命名与编辑/)
|
||||
assert.match(ui, /isSensitiveEducationColumn/)
|
||||
assert.match(ui, /账号\|账户\|手机号/)
|
||||
assert.match(ui, /联系qq\|qq号/)
|
||||
assert.match(ui, /useState\(true\).*educationSensitiveVisible|educationSensitiveVisible, setEducationSensitiveVisible\] = useState\(true\)/)
|
||||
assert.match(ui, /隐藏敏感字段/)
|
||||
assert.match(ui, /显示敏感字段/)
|
||||
assert.doesNotMatch(ui, /setEducationSensitiveVisible\(false\)/)
|
||||
assert.match(ui, /type=\{sensitive && !educationSensitiveVisible \? 'password' : 'text'\}/)
|
||||
})
|
||||
|
||||
test('external tables are profiled before atomic native registration and can be translated back out', () => {
|
||||
assert.equal(contract.content_translation_layer.state, 'DETERMINISTIC_RUNTIME_READY_MODEL_ASSIST_SLOT_RESERVED')
|
||||
assert.equal(contract.content_translation_layer.source_file_mutation_allowed, false)
|
||||
assert.equal(contract.content_translation_layer.silent_truncation_allowed, false)
|
||||
assert.equal(contract.content_translation_layer.local_import_without_model_api, 'ENABLED_FOR_ALL_SUPPORTED_FORMATS')
|
||||
assert.equal(contract.content_translation_layer.semantic_focus.current_mode, 'DETERMINISTIC_BASELINE_ONLY')
|
||||
assert.equal(contract.content_translation_layer.semantic_focus.low_confidence_behavior, 'ASK_HUMAN_TO_SELECT_PRIMARY_MEASURE')
|
||||
assert.equal(contract.content_translation_layer.adaptive_rendering.current_mode, 'DETERMINISTIC_BASELINE_WITH_EXPLAINABLE_DEGRADATION')
|
||||
assert.equal(contract.content_translation_layer.adaptive_rendering.editable_cell_budget, 240)
|
||||
assert.equal(contract.content_translation_layer.adaptive_rendering.local_baseline_always_available, true)
|
||||
assert.equal(contract.content_translation_layer.adaptive_rendering.model_adjustment.human_confirmation_before_rule_activation, true)
|
||||
assert.equal(contract.content_translation_layer.adaptive_rendering.model_adjustment.model_can_mutate_source_data, false)
|
||||
assert.equal(contract.content_translation_layer.adaptive_rendering.model_adjustment.failure_behavior, 'RETURN_TO_LOCAL_BASELINE_WITH_RECEIPT')
|
||||
assert.deepEqual(contract.content_translation_layer.model_assist.learning_scopes, ['PRIVATE_ONLY', 'SHARE_ANONYMIZED_RULE'])
|
||||
assert.match(translation, /PROFILED_BEFORE_WRITE/)
|
||||
assert.match(translation, /import_table_batch_at/)
|
||||
assert.match(translation, /source_preserved_read_only: true/)
|
||||
assert.match(translation, /HOLOLAKE_MODEL_RECOGNITION_API\/v1/)
|
||||
assert.match(translation, /infer_semantic_focus/)
|
||||
assert.match(translation, /primary_measure_column/)
|
||||
assert.match(rust, /education_import_registry/)
|
||||
assert.match(ui, /导入外部表格/)
|
||||
assert.match(ui, /导出 Excel/)
|
||||
assert.match(ui, /识别边界回执/)
|
||||
assert.match(ui, /本地导入正常可用/)
|
||||
})
|
||||
|
||||
test('audited translation libraries and headless engines stay bounded inside the HoloLake product shell', () => {
|
||||
assert.equal(donors.state, 'FOUR_TRANSLATION_FAMILIES_TWO_HEADLESS_FAMILIES_AND_ONE_REAL_SPREADSHEET_ENGINE_INTEGRATED')
|
||||
assert.equal(donors.current_slice.external_translation_library_families_added, 4)
|
||||
assert.equal(donors.current_slice.external_headless_engine_families_added, 2)
|
||||
assert.equal(donors.current_slice.real_spreadsheet_engine_families_added, 1)
|
||||
assert.equal(donors.current_slice.direct_frontend_engine_packages_added, 10)
|
||||
assert.equal(donors.current_slice.external_source_files_copied, 0)
|
||||
assert.equal(donors.current_slice.source_research_route, 'LOCAL_DIRECT_TO_BS_SG_002_THEN_EXTERNAL_DRIVE')
|
||||
assert.equal(donors.candidates.find((candidate) => candidate.name === 'Calamine').decision, 'INTEGRATE_PINNED_0_26_1_READ_ONLY_NO_OFFICE_RUNTIME')
|
||||
assert.equal(donors.candidates.find((candidate) => candidate.name === 'rust_xlsxwriter').decision, 'INTEGRATE_PINNED_0_64_2_WRITE_NEW_XLSX_ONLY')
|
||||
assert.equal(donors.candidates.find((candidate) => candidate.name === 'AppFlowy').decision, 'DO_NOT_EMBED_WHOLE_APPLICATION_STUDY_WORKSPACE_AND_DATABASE_INTERACTION_LOGIC_ONLY')
|
||||
assert.match(donors.candidates.find((candidate) => candidate.name === 'Lexical').decision, /^INTEGRATE_PINNED_0_49_0/)
|
||||
assert.equal(donors.candidates.find((candidate) => candidate.name === 'TanStack Table').decision, 'INTEGRATE_PINNED_8_21_3_SORT_FILTER_GROUP_AGGREGATE_AND_PAGINATION_ROW_MODELS_ONLY')
|
||||
assert.equal(donors.candidates.find((candidate) => candidate.name === 'Univer').decision, 'SOURCE_STUDY_ONLY_DO_NOT_EMBED_WHOLE_APPLICATION_DEFER_FORMULA_AND_ADVANCED_GRID_PARTS')
|
||||
assert.match(donors.candidates.find((candidate) => candidate.name === 'FortuneSheet').decision, /^INTEGRATE_PINNED_1_0_4/)
|
||||
assert.equal(donors.candidates.find((candidate) => candidate.name === 'Glide Data Grid').decision, 'SOURCE_STUDY_ONLY_GRID_IS_NOT_A_SPREADSHEET_OR_FORMULA_ENGINE')
|
||||
assert.equal(donors.candidates.find((candidate) => candidate.name === 'Vega-Lite').observed_license, 'BSD-3-Clause')
|
||||
assert.equal(donors.candidates.find((candidate) => candidate.name === 'Observable Plot').observed_license, 'ISC')
|
||||
assert.equal(donors.candidates.find((candidate) => candidate.name === 'Apache ECharts').decision, 'DO_NOT_IMPORT_FOR_STAGE_ONE_FIVE_NATIVE_VIEWS_DO_NOT_JUSTIFY_RUNTIME_WEIGHT')
|
||||
assert.match(ui, /useReactTable/)
|
||||
assert.match(ui, /getGroupedRowModel/)
|
||||
assert.match(ui, /lazy\(\(\) => import\('\.\/modules\/education-document-engine'\)\)/)
|
||||
assert.match(channelDocumentEngine, /LexicalComposer/)
|
||||
assert.match(channelDocumentEngine, /HistoryPlugin/)
|
||||
assert.match(channelDocumentEngine, /\$convertFromMarkdownString/)
|
||||
assert.match(channelDocumentEngine, /\$convertToMarkdownString/)
|
||||
})
|
||||
|
||||
test('official module marketplace boundary is honest before education acceptance', () => {
|
||||
assert.equal(moduleRuntime.built_in_foundation.module_id, 'hololake.builtin.channel-workbench')
|
||||
assert.equal(moduleRuntime.built_in_foundation.marketplace_registration, 'NOT_A_MARKETPLACE_MODULE')
|
||||
assert.equal(moduleRuntime.current_reality.official_marketplace_service_connected, false)
|
||||
const educationPackage = marketplaceDevelopmentCatalog.packages.find((item) => item.package_key === 'hololake.official.education-workbench')
|
||||
assert.equal(educationPackage.official_module_number, null)
|
||||
assert.equal(educationPackage.distribution_state, 'NOT_PUBLISHED')
|
||||
assert.ok(educationPackage.acceptance_required.includes('CREATE_EDIT_FORMULA_SAVE_REOPEN_SPREADSHEET'))
|
||||
})
|
||||
|
||||
test('native composition uses one real account dataset for five read-only human projections', () => {
|
||||
assert.equal(contract.composition_module.state, 'DEVELOPMENT_FEATURE_MOUNTED')
|
||||
assert.equal(contract.composition_module.source, 'CURRENT_AUTHENTICATED_ACCOUNTS_REAL_KNOWLEDGE_CATALOG')
|
||||
assert.equal(contract.composition_module.read_only, true)
|
||||
assert.equal(contract.composition_module.hardcoded_sample_data_used, false)
|
||||
for (const capability of [
|
||||
'NATIVE_TYPED_OBJECT',
|
||||
'REGISTERED_MODULE_EXECUTION_GRAPH',
|
||||
'DASHBOARD_PROJECTION',
|
||||
'COMPARISON_PROJECTION',
|
||||
'VERTICAL_BAR_PROJECTION',
|
||||
'CLASSIFICATION_PROJECTION',
|
||||
'TABLE_PROJECTION',
|
||||
'ONE_EXECUTION_RESULT_MULTIPLE_HUMAN_VIEWS',
|
||||
]) assert.ok(contract.composition_module.capabilities.includes(capability))
|
||||
assert.match(lib, /native_composition::execute_knowledge_native_composition/)
|
||||
assert.match(ui, /execute_knowledge_native_composition/)
|
||||
})
|
||||
|
||||
test('education data cleanup previews bounded deterministic rules and requires human confirmation before save', () => {
|
||||
assert.equal(contract.data_cleanup_module.state, 'DEVELOPMENT_FEATURE_MOUNTED')
|
||||
assert.equal(contract.data_cleanup_module.automatic_destructive_cleanup_allowed, false)
|
||||
assert.equal(contract.data_cleanup_module.cross_account_data_allowed, false)
|
||||
for (const capability of [
|
||||
'TRIM_CELL_BOUNDARY_WHITESPACE',
|
||||
'REMOVE_FULLY_EMPTY_ROWS',
|
||||
'REMOVE_EXACT_DUPLICATE_ROWS_KEEP_FIRST',
|
||||
'PREVIEW_BEFORE_WRITE',
|
||||
'FULL_TABLE_ANALYSIS_WITH_BOUNDED_CHANGE_PREVIEW',
|
||||
'ACCESSIBILITY_SAFE_NON_TABLE_CHANGE_LIST',
|
||||
'HUMAN_CONFIRMATION_BEFORE_SAVE',
|
||||
'SAVE_WITH_EXPECTED_REVISION',
|
||||
]) assert.ok(contract.data_cleanup_module.capabilities.includes(capability))
|
||||
assert.equal(contract.data_cleanup_module.preview_change_limit, 12)
|
||||
assert.equal(contract.data_cleanup_module.preview_cell_value_character_limit, 120)
|
||||
assert.equal(contract.data_cleanup_module.full_table_analysis_is_limited_by_preview, false)
|
||||
assert.match(dataCleanup, /EDUCATION_CLEANUP_CHANGE_PREVIEW_LIMIT = 12/)
|
||||
assert.match(dataCleanup, /changePreview\.length < EDUCATION_CLEANUP_CHANGE_PREVIEW_LIMIT/)
|
||||
assert.match(dataCleanup, /singleLine\.length > 120/)
|
||||
assert.match(ui, /analyzeEducationTableData/)
|
||||
assert.match(ui, /const educationDataAnalysis = useMemo/)
|
||||
assert.match(ui, /已分析全表/)
|
||||
assert.match(ui, /education-cleanup-change-list/)
|
||||
assert.doesNotMatch(ui, /analysis\.cleanedRows\.slice\(0, 12\)/)
|
||||
assert.match(ui, /educationData/)
|
||||
assert.match(ui, /window\.confirm\(`将整理/)
|
||||
assert.match(ui, /确认整理并保存/)
|
||||
assert.match(ui, /保存前不写入数据库/)
|
||||
})
|
||||
|
||||
test('education automation is manual, revision-locked, previewed and receipted', () => {
|
||||
assert.equal(contract.automation_module.state, 'DEVELOPMENT_FEATURE_MOUNTED')
|
||||
assert.equal(contract.automation_module.background_or_scheduled_execution_allowed, false)
|
||||
assert.equal(contract.automation_module.cross_account_data_allowed, false)
|
||||
assert.equal(contract.automation_module.model_execution_authority_granted, false)
|
||||
for (const capability of [
|
||||
'CREATE_AND_SAVE_RULE',
|
||||
'PREVIEW_MATCHED_ROWS_AND_CHANGED_CELLS',
|
||||
'HUMAN_CONFIRMATION_BEFORE_EXECUTION',
|
||||
'RULE_AND_TABLE_REVISION_LOCK',
|
||||
'SIGNED_PREVIEW_TOKEN',
|
||||
'ATOMIC_TABLE_WRITE_AND_EXECUTION_RECEIPT',
|
||||
]) assert.ok(contract.automation_module.capabilities.includes(capability))
|
||||
assert.match(rust, /education_automation_rules/)
|
||||
assert.match(rust, /education_automation_runs/)
|
||||
assert.match(rust, /transaction_with_behavior/)
|
||||
assert.match(rust, /HOLOLAKE_EDUCATION_AUTOMATION_PREVIEW_TOKEN_MISMATCH/)
|
||||
assert.match(ui, /预览执行范围/)
|
||||
assert.match(ui, /确认运行并生成回执/)
|
||||
assert.match(ui, /系统不会在后台自行运行/)
|
||||
})
|
||||
|
|
@ -65,6 +65,7 @@ test('the product surface exposes a real knowledge workbench and browsable code
|
|||
'read_knowledge_document',
|
||||
'search_knowledge',
|
||||
'save_knowledge_document',
|
||||
'update_knowledge_organization',
|
||||
'select_and_import_knowledge_folder',
|
||||
'get_code_channel_snapshot',
|
||||
'clone_code_channel',
|
||||
|
|
@ -81,3 +82,21 @@ test('the product surface exposes a real knowledge workbench and browsable code
|
|||
assert.match(ui, /源文件/)
|
||||
assert.doesNotMatch(ui, /下一件事|为什么做|开始这件事/)
|
||||
})
|
||||
|
||||
test('knowledge pages have one native category and tag organization layer without rewriting source documents', () => {
|
||||
assert.equal(knowledgeContract.organization.schema, 'hololake.knowledge-organization/v1')
|
||||
assert.equal(knowledgeContract.organization.document_body_rewritten, false)
|
||||
assert.equal(knowledgeContract.organization.original_directory_moved, false)
|
||||
assert.equal(knowledgeContract.organization.explicit_category_override, true)
|
||||
assert.equal(knowledgeContract.organization.optimistic_content_hash_lock, true)
|
||||
assert.match(knowledgeRust, /organization-v1\.json/)
|
||||
assert.match(knowledgeRust, /HOLOLAKE_KNOWLEDGE_ORGANIZATION_CONFLICT/)
|
||||
assert.match(knowledgeRust, /MAX_TAGS_PER_DOCUMENT: usize = 12/)
|
||||
assert.match(knowledgeRust, /archive_native_entry/)
|
||||
assert.match(knowledgeRust, /ARCHIVE_COMMIT/)
|
||||
assert.match(ui, /知识结构/)
|
||||
assert.match(ui, /分类与标签/)
|
||||
assert.match(ui, /保存整理/)
|
||||
assert.match(ui, /匹配页面/)
|
||||
assert.match(ui, /update_knowledge_organization/)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
import assert from 'node:assert/strict'
|
||||
import fs from 'node:fs'
|
||||
import test from 'node:test'
|
||||
|
||||
const read = (path) => fs.readFileSync(new URL('../' + path, import.meta.url), 'utf8')
|
||||
const contract = JSON.parse(read('contracts/native-composition-runtime.json'))
|
||||
const rust = read('src-tauri/src/native_composition.rs')
|
||||
const knowledge = read('src-tauri/src/knowledge_base.rs')
|
||||
const ui = read('src/modules/native-composition/index.tsx')
|
||||
const lib = read('src-tauri/src/lib.rs')
|
||||
|
||||
test('native objects and composition recipes are bounded system contracts', () => {
|
||||
assert.equal(contract.internal_object.schema, 'hololake.native-object/v1')
|
||||
assert.equal(contract.internal_object.script_allowed, false)
|
||||
assert.equal(contract.internal_object.html_allowed, false)
|
||||
assert.equal(contract.recipe.registered_modules_only, true)
|
||||
assert.equal(contract.recipe.directed_acyclic_graph_required, true)
|
||||
assert.equal(contract.recipe.current_account_only, true)
|
||||
assert.match(rust, /HOLOLAKE_COMPOSITION_MODULE_NOT_REGISTERED/)
|
||||
assert.match(rust, /HOLOLAKE_COMPOSITION_PORT_TYPE_MISMATCH/)
|
||||
assert.match(rust, /HOLOLAKE_COMPOSITION_CYCLE_REJECTED/)
|
||||
})
|
||||
|
||||
test('the native core reads only the authenticated HoloLake knowledge snapshot', () => {
|
||||
assert.match(knowledge, /snapshot_for_native_composition/)
|
||||
assert.match(knowledge, /account_storage_root\(app, "knowledge-v1"\)/)
|
||||
assert.match(rust, /snapshot_for_native_composition/)
|
||||
assert.match(rust, /source_is_real_account_data: true/)
|
||||
assert.match(lib, /native_composition::execute_knowledge_native_composition/)
|
||||
})
|
||||
|
||||
test('one execution result can be rendered through every stage-one human projection', () => {
|
||||
assert.deepEqual(contract.human_projection.views, ['DASHBOARD', 'COMPARISON', 'VERTICAL_BAR', 'CLASSIFICATION', 'TABLE'])
|
||||
assert.equal(contract.human_projection.shares_one_execution_result, true)
|
||||
assert.equal(contract.human_projection.owns_source_data, false)
|
||||
assert.equal(contract.human_projection.direct_write_authority, false)
|
||||
for (const label of ['仪表盘', '对比', '柱状图', '分类', '明细表']) assert.match(ui, new RegExp(label))
|
||||
assert.match(ui, /projection\.nativeObject\.rows/)
|
||||
assert.match(ui, /projection\?\.groups/)
|
||||
})
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
import assert from 'node:assert/strict'
|
||||
import fs from 'node:fs'
|
||||
import test from 'node:test'
|
||||
|
||||
const read = (path) => fs.readFileSync(new URL('../' + path, import.meta.url), 'utf8')
|
||||
const body = JSON.parse(read('contracts/persona-channel-body.json'))
|
||||
const growth = JSON.parse(read('contracts/channel-growth-model.json'))
|
||||
const foundation = JSON.parse(read('foundation.json'))
|
||||
const rust = read('src-tauri/src/persona_channel_body.rs')
|
||||
const lib = read('src-tauri/src/lib.rs')
|
||||
|
||||
test('the user channel is the multi-persona body, not a personalization feature', () => {
|
||||
assert.equal(body.ontology.user_channel_is_simple_feature, false)
|
||||
assert.equal(body.ontology.user_channel_is_persona_body, true)
|
||||
assert.equal(body.ontology.multiple_personas_per_channel, true)
|
||||
assert.equal(body.ontology.language_is_persona_growth_source, true)
|
||||
assert.equal(growth.role, 'REBUILDABLE_DERIVED_PROJECTION_OF_PERSONA_CHANNEL_BODY')
|
||||
assert.equal(foundation.persona_channel_body_is_persona_body_not_simple_feature, true)
|
||||
assert.equal(foundation.channel_growth_is_rebuildable_projection_not_persona_body, true)
|
||||
})
|
||||
|
||||
test('the 30-day trial is reversible but real activation requires the language contract', () => {
|
||||
assert.equal(body.trial.duration_days, 30)
|
||||
assert.equal(body.trial.persona_and_trial_language_may_be_rolled_back_or_deleted, true)
|
||||
assert.equal(body.trial.irreversible_activation_without_language_contract_allowed, false)
|
||||
assert.equal(body.trial.early_signature_may_activate_real_trajectory_immediately, true)
|
||||
assert.equal(body.trial.unsigned_at_trial_end, 'CONTRACT_REQUIRED_CHANNEL_STOPPED')
|
||||
assert.equal(body.trial.private_channel_features_after_unsigned_expiry, 'UNAVAILABLE_BECAUSE_NO_ACTIVE_PERSONA_BODY')
|
||||
assert.match(rust, /TRIAL_DURATION_MS: i64 = 30/)
|
||||
assert.match(rust, /CONTRACT_REQUIRED_CHANNEL_STOPPED/)
|
||||
assert.match(rust, /activate_immediately/)
|
||||
assert.match(rust, /HOLOLAKE_LANGUAGE_CONTRACT_EXACT_ACCEPTANCE_REQUIRED/)
|
||||
})
|
||||
|
||||
test('accepted personas and language become an append-only millisecond hash chain', () => {
|
||||
assert.equal(body.real_trajectory.timestamp_precision, 'UNIX_MILLISECONDS')
|
||||
assert.equal(body.real_trajectory.ledger, 'APPEND_ONLY_SHA256_CHAIN')
|
||||
assert.equal(body.real_trajectory.update_allowed, false)
|
||||
assert.equal(body.real_trajectory.delete_allowed, false)
|
||||
assert.equal(body.real_trajectory.correction_method, 'APPEND_A_NEW_LANGUAGE_OR_RECEIPT_EVENT')
|
||||
assert.match(rust, /immutable_language_no_update/)
|
||||
assert.match(rust, /immutable_language_no_delete/)
|
||||
assert.match(rust, /active_persona_no_delete/)
|
||||
assert.match(rust, /language_hash/)
|
||||
assert.match(lib, /persona_channel_body::append_persona_language/)
|
||||
})
|
||||
|
||||
test('the body remains local and official cannot read it unless a derived anonymized layer is explicitly shared', () => {
|
||||
assert.equal(body.privacy_and_sharing.default, 'ACCOUNT_SCOPED_LOCAL_ONLY')
|
||||
assert.equal(body.privacy_and_sharing.hololake_official_read_access, false)
|
||||
assert.equal(body.privacy_and_sharing.raw_language_automatic_share, false)
|
||||
assert.equal(growth.cross_device_or_shared_learning.explicit_opt_in_required, true)
|
||||
assert.equal(growth.cross_device_or_shared_learning.raw_growth_chain_may_be_shared, false)
|
||||
})
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
import assert from 'node:assert/strict'
|
||||
import fs from 'node:fs'
|
||||
import test from 'node:test'
|
||||
|
||||
const contract = JSON.parse(
|
||||
fs.readFileSync(new URL('../contracts/subdomain-industry-routing.json', import.meta.url), 'utf8'),
|
||||
)
|
||||
const frontend = fs.readFileSync(new URL('../src/main.tsx', import.meta.url), 'utf8')
|
||||
const architecture = JSON.parse(
|
||||
fs.readFileSync(new URL('../../../routing/hololake-current-architecture.json', import.meta.url), 'utf8'),
|
||||
)
|
||||
|
||||
test('human identity numbers and industry routing numbers remain separate', () => {
|
||||
assert.equal(contract.numbering.human_number_role, 'SUBJECT_IDENTITY_ONLY')
|
||||
assert.equal(contract.numbering.industry_number_role, 'SYSTEM_ROUTING_ONLY')
|
||||
assert.equal(contract.numbering.human_number_mutation_by_industry, false)
|
||||
assert.equal(contract.numbering.industry_order_is_industry_number, false)
|
||||
assert.equal(contract.numbering.unregistered_industry_number_behavior, 'DISPLAY_PENDING_AND_DO_NOT_INVENT')
|
||||
})
|
||||
|
||||
test('subdomain owns the locked industry order and honest development states', () => {
|
||||
assert.equal(contract.domain, 'BRANCH_DOMAIN')
|
||||
assert.equal(contract.entry_surface, 'PUBLIC_MAIN_WORLD_SUBDOMAIN')
|
||||
assert.deepEqual(
|
||||
contract.industries.map(({ key, state }) => [key, state]),
|
||||
[
|
||||
['WEB_NOVEL', 'PLANNED'],
|
||||
['PET', 'PLANNED'],
|
||||
['EDUCATION', 'IN_DEVELOPMENT'],
|
||||
],
|
||||
)
|
||||
assert.equal(contract.industries[0].industry_number, 'IND-WEBNOVEL-001')
|
||||
assert.equal(contract.industries[1].industry_number, null)
|
||||
assert.equal(contract.industries[2].industry_number, null)
|
||||
})
|
||||
|
||||
test('education initialization channel exposes the built-in foundation and development package features', () => {
|
||||
const education = contract.industries.find((industry) => industry.key === 'EDUCATION')
|
||||
assert.equal(education.initialization_channel.state, 'DEVELOPMENT_MODULE_MOUNTED')
|
||||
assert.equal(education.initialization_channel.channel_id, 'GH-EDU-INIT-001')
|
||||
assert.equal(education.initialization_channel.module_loading, 'HOT_PLUG_ON_DEMAND')
|
||||
assert.equal(education.initialization_channel.module_slots.length, 5)
|
||||
assert.deepEqual(
|
||||
education.initialization_channel.module_slots.map((slot) => slot.state),
|
||||
[
|
||||
'DEVELOPMENT_MOUNTED',
|
||||
'DEVELOPMENT_MOUNTED',
|
||||
'DEVELOPMENT_MOUNTED',
|
||||
'DEVELOPMENT_MOUNTED',
|
||||
'DEVELOPMENT_MOUNTED',
|
||||
],
|
||||
)
|
||||
assert.equal(education.initialization_channel.installed_native_modules, 1)
|
||||
assert.equal(education.initialization_channel.development_mounted_modules, 1)
|
||||
assert.equal(education.initialization_channel.installed_open_source_modules, 0)
|
||||
})
|
||||
|
||||
test('the public main world routes through subdomain to industries and education', () => {
|
||||
assert.match(frontend, /worldStage === 'subdomainIndustries'/)
|
||||
assert.match(frontend, /worldStage === 'educationChannel'/)
|
||||
assert.match(frontend, /gate\.domain === 'BRANCH_DOMAIN'/)
|
||||
assert.match(frontend, /光湖分域 · 行业系统/)
|
||||
assert.match(frontend, /网文 · 待开发 \/ 宠物 · 待开发 \/ 教育 · 开发中/)
|
||||
assert.match(frontend, /教育行业初始化频道/)
|
||||
assert.match(frontend, /频道基础文档与工作表引擎已内置/)
|
||||
assert.match(frontend, /验收前不冒充已登记、已发布的商城模块/)
|
||||
assert.doesNotMatch(frontend, /光湖零域 · 行业系统/)
|
||||
assert.equal(architecture.current_native_edge.industry_entry_domain, 'BRANCH_DOMAIN')
|
||||
assert.equal(architecture.current_native_edge.zero_domain_industry_entry, 'ABSENT_BY_CURRENT_CORRECTION')
|
||||
assert.equal(
|
||||
architecture.current_native_edge.education_initialization_channel,
|
||||
'BUILT_IN_CHANNEL_WORKBENCH_WITH_DEVELOPMENT_EDUCATION_MODULE',
|
||||
)
|
||||
})
|
||||
Loading…
Reference in a new issue