feat: admit numbered iPhone companion

This commit is contained in:
冰朔 2026-08-19 07:28:26 +08:00
commit fe1aaade0e
20 changed files with 1563 additions and 7 deletions

View file

@ -0,0 +1,48 @@
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const read = (path) => readFileSync(new URL(`../${path}`, import.meta.url), 'utf8')
const contract = JSON.parse(read('contracts/ios-mobile-client-v1.json'))
const project = read('mobile/ios/project.yml')
const client = read('mobile/ios/Sources/HoloLakeSyncClient.swift')
const keychain = read('mobile/ios/Sources/HoloLakeKeychain.swift')
const models = read('mobile/ios/Sources/HoloLakeModels.swift')
const interfaceSource = read('mobile/ios/Sources/ContentView.swift')
test('iPhone client is the numbered remote body entry of the desktop root node', () => {
assert.equal(contract.record_id, 'HLP-IOS-CLIENT-001')
assert.equal(contract.role, 'REMOTE_BODY_ENTRY_OF_THE_SAME_PERSONA_SYSTEM')
assert.equal(contract.root_node, 'USER_LOCAL_COMPUTER_TERMINAL')
assert.equal(contract.numbered_transport.desktop_module, 'HLP-MOD-OFFICIAL-MOBILE-SYNC-0001')
assert.match(project, /PRODUCT_BUNDLE_IDENTIFIER: com\.guanghulab\.hololake/)
assert.match(client, /static let clientNumber = "HLP-IOS-CLIENT-001"/)
assert.match(interfaceSource, /HLP-IOS-CLIENT-001/)
assert.equal(contract.state, 'NUMBERED_SOURCE_SIMULATOR_AND_DEVELOPMENT_SIGNED_IPA_ACCEPTED')
assert.equal(contract.acceptance.unit_tests, 'PASS_4')
assert.equal(contract.acceptance.real_iphone_pair_and_sync, 'NOT_CLAIMED')
})
test('iPhone secrets stay device local and the transport matches the desktop protocol', () => {
assert.equal(contract.security.key_storage, 'KEYCHAIN_WHEN_UNLOCKED_THIS_DEVICE_ONLY')
assert.equal(contract.security.background_polling, false)
assert.equal(contract.security.remote_desktop_clone, false)
assert.match(keychain, /kSecAttrAccessibleWhenUnlockedThisDeviceOnly/)
assert.match(client, /ChaChaPoly\.seal/)
assert.match(client, /ChaChaPoly\.open/)
assert.match(client, /hololake\.mobile\.pair\/v1/)
assert.match(client, /hololake\.mobile\.sync\/v1:/)
assert.match(client, /response\.rootNodeRole == "USER_LOCAL_COMPUTER_TERMINAL"/)
assert.match(client, /nextSnapshot\.rootNodeOnline/)
assert.ok(client.indexOf('try HoloLakeKeychain.save(current)') < client.indexOf('url: current.baseURL.appending(path: "v1/sync")'))
assert.match(models, /hololake/)
assert.doesNotMatch(client, /Timer|scheduledTimer|setInterval|backgroundTask/)
})
test('mobile interface stays manual and exposes only bounded projections', () => {
assert.equal(contract.interface.idle_state, 'STATIC')
assert.equal(contract.interface.manual_sync_only, true)
assert.match(interfaceSource, /只有你点击同步时才会连接电脑/)
assert.match(interfaceSource, /写入电脑端收件箱/)
assert.doesNotMatch(interfaceSource, /人格执行|模型调用|远程桌面/)
})

View file

@ -6,13 +6,21 @@ const catalog = JSON.parse(readFileSync(new URL('../contracts/module-donor-admis
const numbered = JSON.parse(readFileSync(new URL('../contracts/numbered-ipc-registry.json', import.meta.url), 'utf8'))
test('chaotic donors are read-only candidates and never a bulk merge source', () => {
assert.equal(catalog.state, 'SEVEN_CANDIDATES_ADMITTED_DONOR_SOURCES_REMAIN_READ_ONLY')
assert.equal(catalog.state, 'EIGHT_CANDIDATES_ADMITTED_DONOR_SOURCES_REMAIN_READ_ONLY')
assert.equal(catalog.root_rule.repair_old_application_in_place, false)
assert.equal(catalog.root_rule.bulk_merge_or_wholesale_copy_allowed, false)
assert.equal(catalog.root_rule.one_candidate_per_admission_cycle, true)
assert.ok(catalog.donors.every((donor) => donor.state.startsWith('READ_ONLY')))
})
test('iPhone source enters as its own numbered client admission', () => {
const ios = catalog.candidates.find((candidate) => candidate.client_number === 'HLP-IOS-CLIENT-001')
assert.equal(ios.candidate_number, 'HLP-DONOR-CAND-0008')
assert.equal(ios.desktop_runtime_module_number, 'HLP-MOD-OFFICIAL-MOBILE-SYNC-0001')
assert.equal(ios.numbered_ipc_module, 'HLP-NIPC-MOD-0030')
assert.match(ios.boundary, /NO SECOND PERSONA SYSTEM/)
})
test('candidate coordinates are unique but are not permanent runtime module numbers', () => {
const coordinates = catalog.candidates.map((candidate) => candidate.candidate_number)
const admitted = catalog.candidates.filter((candidate) => candidate.state.startsWith('ADMITTED'))