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) })