From 19ad0ab445bb6fc719c752c5c3da47b7171d2786 Mon Sep 17 00:00:00 2001 From: Antuz tap Date: Fri, 23 Oct 2026 00:30:14 +0000 Subject: [PATCH 1/2] ci: prepare fixed 044 iOS diagnostic artifact readout --- ...artifact.cjs => read-044-ios-artifact.cjs} | 30 +++---- ...s-artifact.py => read-044-ios-artifact.py} | 44 +++++++++-- ....cjs => 044-ios-artifact-readout.test.cjs} | 50 ++++++------ ...ut.py => test_044_ios_artifact_readout.py} | 24 +++++- ...ut.yml => r5-044-ios-artifact-readout.yml} | 20 ++--- docs/r5-044-ios-startup-audit.md | 79 +++++++++++++++++++ 6 files changed, 188 insertions(+), 59 deletions(-) rename .github/scripts/{read-1bc-ios-artifact.cjs => read-044-ios-artifact.cjs} (89%) rename .github/scripts/{read-1bc-ios-artifact.py => read-044-ios-artifact.py} (86%) rename .github/tests/{1bc-ios-artifact-readout.test.cjs => 044-ios-artifact-readout.test.cjs} (83%) rename .github/tests/{test_1bc_ios_artifact_readout.py => test_044_ios_artifact_readout.py} (90%) rename .github/workflows/{r5-1bc-ios-artifact-readout.yml => r5-044-ios-artifact-readout.yml} (59%) create mode 100644 docs/r5-044-ios-startup-audit.md diff --git a/.github/scripts/read-1bc-ios-artifact.cjs b/.github/scripts/read-044-ios-artifact.cjs similarity index 89% rename from .github/scripts/read-1bc-ios-artifact.cjs rename to .github/scripts/read-044-ios-artifact.cjs index a034aa77f..746054967 100644 --- a/.github/scripts/read-1bc-ios-artifact.cjs +++ b/.github/scripts/read-044-ios-artifact.cjs @@ -6,13 +6,13 @@ const fs = require('node:fs'); const path = require('node:path'); const { execFileSync } = require('node:child_process'); const OWNER = 'KeeperCommunity', REPO = 'bitcoin-keeper', REPOSITORY = 470904030; -const RUN = 39858617273, JOB = 120103187854, ANDROID = 120125972406, ARTIFACT = 12462694619; -const SOURCE = '1bc34890cb8618b2fffd446a63924974e0fe15b5'; -const TREE = '2e9cd57bf9f78b92cac73e9343ddbd0eef25e86e'; -const WORKFLOW = '3c44ab6412a8118b183273c402dd08136db05b28'; -const DIGEST = '550142809a0faf812741a586630b17d6f458b2b6c935b5bab4b00f84da67c84f'; +const RUN = 39873063291, JOB = 120151926152, ANDROID = 120167960772, ARTIFACT = 12469536083; +const SOURCE = '044ebb6ea2d465f6a70e9116e3feac5a604cd696'; +const TREE = '4856035ece888230674e061c53115de3d6f025ed'; +const WORKFLOW = '5a7b0c5da0a38197f6dd675ff424f3ba3f441d02'; +const DIGEST = 'e244015128d4aa72e1e1c8be3072bc70d506ba11a804067448122d1318621caf'; const NAME = `keeper-diagnostic-native-IOS-${SOURCE}-${RUN}-1`; -const BRANCH = 'codex/r5-ios-startup-diagnosis-20261022'; +const BRANCH = 'codex/r5-startup-credential-failure-observation-20261022'; function validateRun(value, jobs) { assert.equal(value.id, RUN); assert.equal(value.run_attempt, 1); @@ -24,11 +24,11 @@ function validateRun(value, jobs) { (value.status === 'completed' && value.conclusion === 'failure')); assert.deepEqual(value.referenced_workflows, [{ path: `${OWNER}/${REPO}/.github/workflows/keeper-native-platform.yml@${WORKFLOW}`, - ref: 'refs/pull/7116/merge', sha: WORKFLOW, + ref: 'refs/pull/7131/merge', sha: WORKFLOW, }]); assert.equal(jobs.total_count, 3); assert.equal(jobs.jobs.length, 3); assert.deepEqual(jobs.jobs.map(row => row.id).sort((a, b) => a - b), - [JOB, 120103189932, ANDROID].sort((a, b) => a - b)); + [JOB, 120151928067, ANDROID].sort((a, b) => a - b)); const android = jobs.jobs.find(row => row.id === ANDROID); assert.equal(android.run_id, RUN); assert.equal(android.head_sha, SOURCE); assert.equal(android.name, 'android / Native ANDROID build and probes'); @@ -60,7 +60,7 @@ function validateJob(value) { function validateArtifact(value) { assert.equal(value.id, ARTIFACT); assert.equal(value.name, NAME); - assert.equal(value.expired, false); assert.equal(value.size_in_bytes, 6884); + assert.equal(value.expired, false); assert.equal(value.size_in_bytes, 7232); assert.equal(value.digest, `sha256:${DIGEST}`); assert.equal(value.workflow_run.id, RUN); assert.equal(value.workflow_run.head_sha, SOURCE); assert.equal(value.workflow_run.repository_id, REPOSITORY); @@ -73,7 +73,7 @@ async function run({ github, context, core }) { try { assert.equal(context.repo.owner, OWNER); assert.equal(context.repo.repo, REPO); assert.equal(context.eventName, 'push'); - assert.equal(context.ref, 'refs/heads/codex/r5-1bc-ios-artifact-readout'); + assert.equal(context.ref, 'refs/heads/codex/r5-044-ios-artifact-readout'); const args = { owner: OWNER, repo: REPO, request: { timeout: 30000 } }; async function snapshot() { const [r, j, a, jobs] = await Promise.all([ @@ -87,27 +87,27 @@ async function run({ github, context, core }) { await snapshot(); const [commit, pr] = await Promise.all([ github.rest.repos.getCommit({ ...args, ref: SOURCE }), - github.rest.pulls.get({ ...args, pull_number: 7116 }), + github.rest.pulls.get({ ...args, pull_number: 7131 }), ]); assert.equal(commit.data.sha, SOURCE); assert.equal(commit.data.commit.tree.sha, TREE); - assert.equal(pr.data.number, 7116); assert.equal(pr.data.head.sha, SOURCE); + assert.equal(pr.data.number, 7131); assert.equal(pr.data.head.sha, SOURCE); assert.equal(pr.data.head.ref, BRANCH); assert.equal(pr.data.head.repo.id, REPOSITORY); assert.equal(pr.data.state, 'open'); assert.equal(pr.data.merged, false); const download = await github.rest.actions.downloadArtifact({ ...args, artifact_id: ARTIFACT, archive_format: 'zip' }); const bytes = Buffer.from(download.data); - assert.equal(bytes.length, 6884); + assert.equal(bytes.length, 7232); assert.equal(crypto.createHash('sha256').update(bytes).digest('hex'), DIGEST); await snapshot(); // A later attempt or replacement cannot supply this readout. const temp = process.env.RUNNER_TEMP; assert.ok(temp && path.isAbsolute(temp)); assert.equal(fs.realpathSync(temp), path.resolve(temp)); - const filename = path.join(temp, 'r5-1bc-ios-fixed.zip'); + const filename = path.join(temp, 'r5-044-ios-fixed.zip'); const descriptor = fs.openSync(filename, 'wx', 0o600); owned = { filename }; // A failed stat still reports unresolved private cleanup. try { const info = fs.fstatSync(descriptor); Object.assign(owned, { dev: info.dev, ino: info.ino }); fs.writeFileSync(descriptor, bytes); } finally { fs.closeSync(descriptor); } - output = execFileSync('python3', ['-B', '.github/scripts/read-1bc-ios-artifact.py'], + output = execFileSync('python3', ['-B', '.github/scripts/read-044-ios-artifact.py'], { encoding: 'utf8', timeout: 30000, maxBuffer: 1024 * 1024, stdio: ['ignore', 'pipe', 'pipe'] }); const tag = 'SAFE_R5_IOS_READOUT '; assert.ok(output.startsWith(tag)); diff --git a/.github/scripts/read-1bc-ios-artifact.py b/.github/scripts/read-044-ios-artifact.py similarity index 86% rename from .github/scripts/read-1bc-ios-artifact.py rename to .github/scripts/read-044-ios-artifact.py index 8c25aafbd..344991a45 100644 --- a/.github/scripts/read-1bc-ios-artifact.py +++ b/.github/scripts/read-044-ios-artifact.py @@ -11,12 +11,12 @@ import sys import zipfile -SOURCE = '1bc34890cb8618b2fffd446a63924974e0fe15b5' -WORKFLOW = '3c44ab6412a8118b183273c402dd08136db05b28' -WORKFLOW_REF = 'KeeperCommunity/bitcoin-keeper/.github/workflows/keeper-native-diagnostic.yml@refs/pull/7116/merge' -RUN, ATTEMPT, ARTIFACT = '39858617273', '1', '12462694619' -ZIP_SIZE, LIMIT = 6884, 1024 * 1024 -ZIP_SHA256 = '550142809a0faf812741a586630b17d6f458b2b6c935b5bab4b00f84da67c84f' +SOURCE = '044ebb6ea2d465f6a70e9116e3feac5a604cd696' +WORKFLOW = '5a7b0c5da0a38197f6dd675ff424f3ba3f441d02' +WORKFLOW_REF = 'KeeperCommunity/bitcoin-keeper/.github/workflows/keeper-native-diagnostic.yml@refs/pull/7131/merge' +RUN, ATTEMPT, ARTIFACT = '39873063291', '1', '12469536083' +ZIP_SIZE, LIMIT = 7232, 1024 * 1024 +ZIP_SHA256 = 'e244015128d4aa72e1e1c8be3072bc70d506ba11a804067448122d1318621caf' ERROR_TYPES = ('ValueError', 'TypeError', 'OSError', 'FileNotFoundError', 'PermissionError', 'TimeoutExpired', 'JSONDecodeError', 'RuntimeError', 'OTHER_ERROR') IOS_CATEGORIES = ('JS_TYPE', 'JS_REFERENCE', 'JS_SYNTAX', 'JS_RANGE', 'JS_INVARIANT', @@ -142,6 +142,35 @@ def observations(value): return result +def startup_failure(value): + value = obj(value) + phases = ('ACCOUNT_STATE', 'NATIVE_CREDENTIAL_READ', 'CREDENTIAL_JSON', 'NAVIGATION') + names = ('Error', 'TypeError', 'SyntaxError', 'ReferenceError', 'RangeError', + 'EvalError', 'URIError', 'AggregateError', 'OTHER', 'UNKNOWN') + rows = value.get('records') + safe_rows = [] + for row in rows[:32] if type(rows) is list else []: + row = obj(row) + phase, outcome = enum(row.get('phase'), phases), enum(row.get('outcome'), ('THREW', 'REJECTED')) + code = row.get('code') + safe_rows.append({'phase': phase, 'outcome': outcome, 'error_name': enum(row.get('error_name'), names), + 'code': code if phase == 'NATIVE_CREDENTIAL_READ' and outcome == 'REJECTED' and + type(code) is int and -2147483648 <= code <= 2147483647 else None, + 'window_relation': enum(row.get('window_relation'), ('IN_WINDOW',))}) + reasons = ('MISSING_WINDOW', 'INVALID_WINDOW', 'NO_MARKER_OBSERVED', 'INVALID_COMPACT_RECORD', + 'INVALID_RECORD_FIELDS', 'MALFORMED_MARKER', 'UNSUPPORTED_FRAMING', 'FOREIGN_PROCESS_MARKER', + 'OUTSIDE_WINDOW', 'MULTIPLE_OWN_PIDS', 'DUPLICATE_MARKER', 'MULTIPLE_MARKERS', + 'OBSERVATION_LIMIT', 'PARTIAL_INPUT', 'QUERY_UNAVAILABLE') + return {'status': enum(value.get('status'), ('OBSERVED', 'AMBIGUOUS', 'UNKNOWN')), + 'cause': 'UNDETERMINED', 'window': enum(value.get('window'), ('BOUNDED', 'UNKNOWN', 'INVALID')), + 'records': safe_rows, 'reasons': fixed_list(value.get('reasons'), reasons), + **{key: count(value.get(key), 32) for key in ('marker_records_seen', 'duplicate_records', + 'malformed_markers', 'invalid_compact_markers', 'invalid_record_fields', 'foreign_process_markers', + 'outside_window_markers', 'own_process_count')}, + **flags(value, ('own_process_count_capped', 'limit_reached', 'input_partial')), + 'scope': 'REPORTED_ORIGINAL_MARKERS_NOT_CAUSE_OR_ACCEPTANCE_NO_RAW_PID_OR_TIMESTAMP'} + + def diagnostics(value): value = obj(value) ios, driver, maestro = (obj(value.get(key)) for key in ('ios_errors', 'maestro_preflight', 'maestro')) @@ -153,6 +182,7 @@ def diagnostics(value): 'error_type': enum(obj(row).get('error_type'), ERROR_TYPES)} for row in errors[:32]] if type(errors) is list else [], 'ios_errors': { + 'startup_failure_receipt': startup_failure(ios.get('startup_failure_receipt')), 'cause': 'UNDETERMINED', 'query_status': enum(ios.get('query_status'), ('SUCCESS', 'FAILED', 'TIMEOUT')), 'parse_status': enum(ios.get('parse_status'), ('PARSED', 'PARTIAL', 'UNKNOWN')), 'observation_state': enum(ios.get('observation_state'), ('OWN_RECORDS_OBSERVED', 'UNKNOWN')), @@ -253,7 +283,7 @@ def main(argv=None): temp = Path(os.environ['RUNNER_TEMP']) if not temp.is_absolute() or temp.resolve(strict=True) != temp: raise ValueError('Artifact rejected.') - path = temp / 'r5-1bc-ios-fixed.zip' + path = temp / 'r5-044-ios-fixed.zip' with os.fdopen(os.open(path, os.O_RDONLY | os.O_NOFOLLOW | os.O_NONBLOCK), 'rb') as source: info = os.fstat(source.fileno()) if (not stat.S_ISREG(info.st_mode) or stat.S_IMODE(info.st_mode) != 0o600 or diff --git a/.github/tests/1bc-ios-artifact-readout.test.cjs b/.github/tests/044-ios-artifact-readout.test.cjs similarity index 83% rename from .github/tests/1bc-ios-artifact-readout.test.cjs rename to .github/tests/044-ios-artifact-readout.test.cjs index 3e2ed51f7..6df0d4e0a 100644 --- a/.github/tests/1bc-ios-artifact-readout.test.cjs +++ b/.github/tests/044-ios-artifact-readout.test.cjs @@ -4,21 +4,21 @@ const test = require('node:test'); const fs = require('node:fs'); const path = require('node:path'); const vm = require('node:vm'); -const { run } = require('../scripts/read-1bc-ios-artifact.cjs'); -const SOURCE = '1bc34890cb8618b2fffd446a63924974e0fe15b5'; -const WORKFLOW = '3c44ab6412a8118b183273c402dd08136db05b28'; -const DIGEST = '550142809a0faf812741a586630b17d6f458b2b6c935b5bab4b00f84da67c84f'; +const { run } = require('../scripts/read-044-ios-artifact.cjs'); +const SOURCE = '044ebb6ea2d465f6a70e9116e3feac5a604cd696'; +const WORKFLOW = '5a7b0c5da0a38197f6dd675ff424f3ba3f441d02'; +const DIGEST = 'e244015128d4aa72e1e1c8be3072bc70d506ba11a804067448122d1318621caf'; function fixture() { const context = { repo: { owner: 'KeeperCommunity', repo: 'bitcoin-keeper' }, - eventName: 'push', ref: 'refs/heads/codex/r5-1bc-ios-artifact-readout' }; - const runData = { id: 39858617273, run_attempt: 1, repository: { id: 470904030 }, + eventName: 'push', ref: 'refs/heads/codex/r5-044-ios-artifact-readout' }; + const runData = { id: 39873063291, run_attempt: 1, repository: { id: 470904030 }, head_repository: { id: 470904030 }, head_sha: SOURCE, event: 'pull_request', - head_branch: 'codex/r5-ios-startup-diagnosis-20261022', path: '.github/workflows/keeper-native-diagnostic.yml', + head_branch: 'codex/r5-startup-credential-failure-observation-20261022', path: '.github/workflows/keeper-native-diagnostic.yml', status: 'in_progress', conclusion: null, referenced_workflows: [{ path: `KeeperCommunity/bitcoin-keeper/.github/workflows/keeper-native-platform.yml@${WORKFLOW}`, - ref: 'refs/pull/7116/merge', sha: WORKFLOW }] }; - const jobData = { id: 120103187854, run_id: 39858617273, head_sha: SOURCE, + ref: 'refs/pull/7131/merge', sha: WORKFLOW }] }; + const jobData = { id: 120151926152, run_id: 39873063291, head_sha: SOURCE, name: 'ios / Native IOS build and probes', status: 'completed', conclusion: 'failure', steps: [['Check out exact app source', 'success'], ['Verify current diagnostic source', 'success'], ['Install immutable native dependencies', 'success'], ['Check disposable iOS driver readiness', 'success'], @@ -26,22 +26,22 @@ function fixture() { ['Run disposable native persistence probe', 'skipped'], ['Run R5 production worker native scenarios', 'skipped'], ['Measure five full-product startup and first-wallet runs', 'skipped'], ['Retain safe Phase A evidence', 'success']] .map(([name, conclusion]) => ({ name, conclusion, status: 'completed' })) }; - const jobs = { total_count: 3, jobs: [{ id: 120103187854 }, { id: 120103189932 }, - { id: 120125972406, run_id: 39858617273, head_sha: SOURCE, + const jobs = { total_count: 3, jobs: [{ id: 120151926152 }, { id: 120151928067 }, + { id: 120167960772, run_id: 39873063291, head_sha: SOURCE, name: 'android / Native ANDROID build and probes', status: 'in_progress', conclusion: null }] }; - const artifact = { id: 12462694619, name: `keeper-diagnostic-native-IOS-${SOURCE}-39858617273-1`, - expired: false, size_in_bytes: 6884, digest: `sha256:${DIGEST}`, workflow_run: { - id: 39858617273, head_sha: SOURCE, repository_id: 470904030, head_repository_id: 470904030, - head_branch: 'codex/r5-ios-startup-diagnosis-20261022' } }; - const commit = { sha: SOURCE, commit: { tree: { sha: '2e9cd57bf9f78b92cac73e9343ddbd0eef25e86e' } } }; - const pr = { number: 7116, head: { sha: SOURCE, ref: runData.head_branch, repo: { id: 470904030 } }, + const artifact = { id: 12469536083, name: `keeper-diagnostic-native-IOS-${SOURCE}-39873063291-1`, + expired: false, size_in_bytes: 7232, digest: `sha256:${DIGEST}`, workflow_run: { + id: 39873063291, head_sha: SOURCE, repository_id: 470904030, head_repository_id: 470904030, + head_branch: 'codex/r5-startup-credential-failure-observation-20261022' } }; + const commit = { sha: SOURCE, commit: { tree: { sha: '4856035ece888230674e061c53115de3d6f025ed' } } }; + const pr = { number: 7131, head: { sha: SOURCE, ref: runData.head_branch, repo: { id: 470904030 } }, state: 'open', merged: false }; const calls = [], output = [], actions = {}; for (const [name, data] of [['getWorkflowRun', runData], ['getJobForWorkflowRun', jobData], ['getArtifact', artifact], ['listJobsForWorkflowRun', jobs]]) { actions[name] = async args => { calls.push([name, args]); return { data }; }; } - actions.downloadArtifact = async args => { calls.push(['downloadArtifact', args]); return { data: Buffer.alloc(6884) }; }; + actions.downloadArtifact = async args => { calls.push(['downloadArtifact', args]); return { data: Buffer.alloc(7232) }; }; const inputs = { github: { rest: { actions, repos: { getCommit: async args => { calls.push(['getCommit', args]); return { data: commit }; } }, pulls: { get: async args => { calls.push(['getPR', args]); return { data: pr }; } } } }, context, @@ -54,7 +54,7 @@ test('current iOS provenance reaches only the fixed archive; unknown bytes suppl await assert.rejects(f.invoke, /^Error: FIXED_IOS_ARTIFACT_READOUT_FAILED$/); assert.deepEqual(f.calls.at(-1), ['downloadArtifact', { owner: 'KeeperCommunity', repo: 'bitcoin-keeper', request: { timeout: 30000 }, - artifact_id: 12462694619, archive_format: 'zip' }]); + artifact_id: 12469536083, archive_format: 'zip' }]); assert.deepEqual(f.output, []); }); @@ -92,8 +92,8 @@ test('stale, contradictory or cross-source API evidence fails before download', function synthetic(f, options = {}) { const events = []; - const receipt = { source_sha: SOURCE, workflow_sha: WORKFLOW, run_id: '39858617273', run_attempt: '1', - artifact_id: '12462694619', readout_only: true, authorization_eligible: false, trusted_native_acceptance: false }; + const receipt = { source_sha: SOURCE, workflow_sha: WORKFLOW, run_id: '39873063291', run_attempt: '1', + artifact_id: '12469536083', readout_only: true, authorization_eligible: false, trusted_native_acceptance: false }; const sandbox = { module: { exports: {} }, Buffer, process: { env: { RUNNER_TEMP: '/owned' } }, require(name) { if (name === 'node:assert/strict') return { ...assert, deepEqual(a, b) { assert.deepEqual(JSON.parse(JSON.stringify(a)), JSON.parse(JSON.stringify(b))); @@ -102,7 +102,7 @@ function synthetic(f, options = {}) { if (name === 'node:crypto') return { createHash: () => ({ update() { return this; }, digest: () => DIGEST }) }; if (name === 'node:fs') return { realpathSync: x => x, openSync(filename, flags, mode) { - assert.equal(filename, '/owned/r5-1bc-ios-fixed.zip'); assert.equal(flags, 'wx'); assert.equal(mode, 0o600); + assert.equal(filename, '/owned/r5-044-ios-fixed.zip'); assert.equal(flags, 'wx'); assert.equal(mode, 0o600); events.push('open'); return 42; }, fstatSync() { if (options.stat) throw new Error('PRIVATE_SENTINEL'); return { dev: 1, ino: 2 }; }, writeFileSync() { events.push('write'); if (options.write) throw new Error('PRIVATE_SENTINEL'); }, @@ -111,20 +111,20 @@ function synthetic(f, options = {}) { unlinkSync() { events.push('unlink'); if (options.unlink) throw new Error('PRIVATE_SENTINEL'); }, }; if (name === 'node:child_process') return { execFileSync(command, args) { - assert.equal(command, 'python3'); assert.deepEqual(Array.from(args), ['-B', '.github/scripts/read-1bc-ios-artifact.py']); + assert.equal(command, 'python3'); assert.deepEqual(Array.from(args), ['-B', '.github/scripts/read-044-ios-artifact.py']); events.push('decoder'); if (options.decoder) throw new Error('PRIVATE_SENTINEL'); return options.raw ? 'PRIVATE_SENTINEL' : 'SAFE_R5_IOS_READOUT ' + JSON.stringify(receipt); } }; throw new Error('Unexpected synthetic import'); } }; - vm.runInNewContext(fs.readFileSync(path.join(__dirname, '../scripts/read-1bc-ios-artifact.cjs'), 'utf8'), sandbox); + vm.runInNewContext(fs.readFileSync(path.join(__dirname, '../scripts/read-044-ios-artifact.cjs'), 'utf8'), sandbox); f.inputs.core = { info(value) { events.push('info'); f.output.push(value); }, warning(value) { events.push('warning'); f.output.push(value); } }; return { events, invoke: () => sandbox.module.exports.run(f.inputs) }; } test('post-download freshness rejects a later attempt before private write or decoding', async () => { const f = fixture(); f.inputs.github.rest.actions.downloadArtifact = async () => { - f.runData.run_attempt++; return { data: Buffer.alloc(6884) }; + f.runData.run_attempt++; return { data: Buffer.alloc(7232) }; }; const s = synthetic(f); await assert.rejects(s.invoke, /FIXED_IOS_ARTIFACT_READOUT_FAILED/); assert.deepEqual(s.events, []); assert.deepEqual(f.output, []); diff --git a/.github/tests/test_1bc_ios_artifact_readout.py b/.github/tests/test_044_ios_artifact_readout.py similarity index 90% rename from .github/tests/test_1bc_ios_artifact_readout.py rename to .github/tests/test_044_ios_artifact_readout.py index c28482df5..6947ac33d 100644 --- a/.github/tests/test_1bc_ios_artifact_readout.py +++ b/.github/tests/test_044_ios_artifact_readout.py @@ -15,7 +15,7 @@ import zipfile SPEC = importlib.util.spec_from_file_location('ios_readout', - Path(__file__).resolve().parents[1] / 'scripts/read-1bc-ios-artifact.py') + Path(__file__).resolve().parents[1] / 'scripts/read-044-ios-artifact.py') reader = importlib.util.module_from_spec(SPEC) SPEC.loader.exec_module(reader) @@ -65,6 +65,26 @@ def archive(data=None, raw=None, name='ios/metadata.json', attributes=None, extr class ReadoutTest(unittest.TestCase): + def test_original_failure_phase_and_native_int32_are_preserved_without_raw_fields(self): + value = fixture() + value['startup_diagnostics']['ios_errors']['startup_failure_receipt'] = { + 'status': 'OBSERVED', 'window': 'BOUNDED', 'marker_records_seen': 1, + 'own_process_count': 1, 'reasons': [], 'input_partial': False, + 'records': [{'phase': 'NATIVE_CREDENTIAL_READ', 'outcome': 'REJECTED', + 'error_name': 'Error', 'code': -34018, 'window_relation': 'IN_WINDOW', + 'pid': 'PRIVATE_SENTINEL', 'timestamp': 'PRIVATE_SENTINEL', 'message': 'PRIVATE_SENTINEL'}]} + result = reader.decode(archive(value)) + row = result['startup_diagnostics']['ios_errors']['startup_failure_receipt'] + self.assertEqual(row['status'], 'OBSERVED') + self.assertEqual(row['records'][0]['code'], -34018) + self.assertEqual(row['own_process_count'], 1) + self.assertEqual(row['cause'], 'UNDETERMINED') + self.assertNotIn('PRIVATE_SENTINEL', json.dumps(result)) + for invalid in (True, '-34018', -2147483649, 2147483648, {}, None): + value['startup_diagnostics']['ios_errors']['startup_failure_receipt']['records'][0]['code'] = invalid + self.assertIsNone(reader.decode(archive(value))['startup_diagnostics']['ios_errors'] + ['startup_failure_receipt']['records'][0]['code']) + def rejected(self, blob): with self.assertRaises(ValueError) as error: reader.decode(blob) @@ -199,7 +219,7 @@ def test_cli_exact_digest_mode_alias_and_arguments_are_enforced_without_text_lea blob = archive() with tempfile.TemporaryDirectory() as directory: root = Path(directory).resolve() - file = root / 'r5-1bc-ios-fixed.zip' + file = root / 'r5-044-ios-fixed.zip' file.write_bytes(blob) file.chmod(0o600) environment = {'RUNNER_TEMP': str(root)} diff --git a/.github/workflows/r5-1bc-ios-artifact-readout.yml b/.github/workflows/r5-044-ios-artifact-readout.yml similarity index 59% rename from .github/workflows/r5-1bc-ios-artifact-readout.yml rename to .github/workflows/r5-044-ios-artifact-readout.yml index 708dcc184..cbad76458 100644 --- a/.github/workflows/r5-1bc-ios-artifact-readout.yml +++ b/.github/workflows/r5-044-ios-artifact-readout.yml @@ -1,26 +1,26 @@ -name: Read fixed completed 1bc iOS diagnostic receipt +name: Read fixed completed 044 iOS diagnostic receipt on: push: - branches: [codex/r5-1bc-ios-artifact-readout] + branches: [codex/r5-044-ios-artifact-readout] paths: - - .github/workflows/r5-1bc-ios-artifact-readout.yml - - .github/scripts/read-1bc-ios-artifact.cjs - - .github/scripts/read-1bc-ios-artifact.py - - .github/tests/1bc-ios-artifact-readout.test.cjs - - .github/tests/test_1bc_ios_artifact_readout.py + - .github/workflows/r5-044-ios-artifact-readout.yml + - .github/scripts/read-044-ios-artifact.cjs + - .github/scripts/read-044-ios-artifact.py + - .github/tests/044-ios-artifact-readout.test.cjs + - .github/tests/test_044_ios_artifact_readout.py permissions: contents: read actions: read concurrency: - group: r5-fixed-completed-1bc-ios-artifact-readout + group: r5-fixed-completed-044-ios-artifact-readout cancel-in-progress: false jobs: readout: - if: github.repository == 'KeeperCommunity/bitcoin-keeper' && github.event_name == 'push' && github.ref == 'refs/heads/codex/r5-1bc-ios-artifact-readout' + if: github.repository == 'KeeperCommunity/bitcoin-keeper' && github.event_name == 'push' && github.ref == 'refs/heads/codex/r5-044-ios-artifact-readout' runs-on: ubuntu-24.04 timeout-minutes: 5 steps: @@ -31,6 +31,6 @@ jobs: - run: node .github/scripts/verify-ci-source.cjs - uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 with: - script: await require('./.github/scripts/read-1bc-ios-artifact.cjs').run({ github, context, core }) + script: await require('./.github/scripts/read-044-ios-artifact.cjs').run({ github, context, core }) - if: always() run: node .github/scripts/verify-ci-source.cjs diff --git a/docs/r5-044-ios-startup-audit.md b/docs/r5-044-ios-startup-audit.md new file mode 100644 index 000000000..7bd6f550a --- /dev/null +++ b/docs/r5-044-ios-startup-audit.md @@ -0,0 +1,79 @@ +# Fixed 044 iOS startup readout + +This is a read-only descendant of the fixed #7124 reader at +`60dd4582c6b5e7b983aeed9fa4d3abafc9835edc`. It retrieves only artifact +`12469536083` from run `39873063291`, attempt 1, iOS job `120151926152`. +The frozen application source is `044ebb6ea2d465f6a70e9116e3feac5a604cd696`, +tree `4856035ece888230674e061c53115de3d6f025ed`; workflow control is +`5a7b0c5da0a38197f6dd675ff424f3ba3f441d02` at `refs/pull/7131/merge`. +The original 7,232 ZIP bytes must match SHA-256 +`e244015128d4aa72e1e1c8be3072bc70d506ba11a804067448122d1318621caf`. +No rewritten or reconstructed archive is acceptable. + +The reader checks the live run, iOS job, original artifact, source tree and PR +head, then rechecks run/job/artifact after download. It accepts the already +allocated Android continuation while running or naturally completed. It never +reruns, cancels, labels or edits that work. A single private ZIP file is removed +before the reconstructed fixed-vocabulary receipt is printed. Original PID, +epoch, process messages, paths, arbitrary errors and signed URLs are excluded. +The diagnostic result never grants native acceptance or release authority. + +## Actual observations before reading the ZIP + +The decoded job logs were captured privately with mode 0600. Current diagnostic +source verification, driver readiness and development build steps succeeded. +The smoke reached the disposable passcode assertion, which failed on +`Create a passcode`. Native persistence, production-worker and product +measurement steps were skipped. The log's original bounded receipt reported: + +- `NATIVE_CREDENTIAL_READ / REJECTED / Error`, native code `-34018`. +- One own process PID and one marker in the bounded launch window; no duplicate, + malformed, foreign, outside-window or partial-input reasons. +- Metro errors empty; 36 bare bundle markers do not establish completion. +- Neither CreatePIN nor ConfirmPIN was present in the retained hierarchy signal. + +Raw PID and compact timestamps are deliberately absent from the exported +receipt. Freshness here is the producer's marker epoch/window relation and +single own-process attribution, not an independent reconstruction of raw logs. +The original ZIP has not yet been decoded by this package. A direct `gh api` +download returned zero bytes and a private failure; no connector file-service +or alternate proxy route was used. + +## Narrow causal investigation, not an app correction + +RNKeychain 10.0.0's `getGenericPasswordForOptions` calls `SecItemCopyMatching` +and rejects statuses other than success/item-not-found through a decimal +NSString OSStatus. Its `errSecMissingEntitlement` case describes a missing +required entitlement. The observed code is consistent with that status. +The exact app call supplies a service without a custom access group. The hosted +build explicitly sets `CODE_SIGNING_ALLOWED=NO` and `CODE_SIGNING_REQUIRED=NO`. +These facts justify a development simulator signing comparison. They do not +justify changing Keychain error handling, treating unreadable credentials as +missing, or changing production capabilities. + +Proposed separate hosted comparison, requiring source review before scheduling: + +1. Wait for the active Android allocation to finish naturally. Use one hosted + macOS/Xcode 16.4 window and exact reviewed simulator Debug app source. +2. Build with the current unsigned flags. Record actual signature absence or + presence and actual entitlements with `codesign`, executable SHA-256, and the + fresh simulator's ordinary startup result and original credential marker. +3. Ask Xcode to package the same build with `CODE_SIGNING_ALLOWED=YES`, + `CODE_SIGNING_REQUIRED=NO`, `CODE_SIGN_IDENTITY=-` and empty + `CODE_SIGN_ENTITLEMENTS=`. This requests simulator development ad-hoc signing + and excludes the project's production capability file. Do not supply + `-allowProvisioningUpdates`, identities, profiles, secrets or copied + entitlement values. Preserve unsigned and signed artifact/executable hashes + separately and identify the intentional development signing overlay: Mach-O + signature bytes normally change. Do not claim byte or code equality. Record + both exact Xcode invocations, effective configuration/source hashes and actual + packaging outcomes; an opaque rebuild is not an unchanged-artifact proof. +4. Read back the actual Xcode signature and generated entitlements; do not + synthesize application identifiers/access groups. Repeat ordinary startup + on a second fresh owned simulator and retain only fixed status facts. +5. If Xcode cannot produce a usable simulator signature or the credential read + still fails, record failure and stop. Only an observed unsigned/ad-hoc + difference could support a later simulator-only harness correction. + +This comparison has **NOT RUN**. No native job, signing operation, release +operation or source change to the frozen candidate is performed by this reader. From a8ae507cfafd68e77b6731a4066d7501fc573bc3 Mon Sep 17 00:00:00 2001 From: Antuz tap Date: Fri, 23 Oct 2026 00:34:59 +0000 Subject: [PATCH 2/2] docs: correct fixed iOS reader parent PR --- docs/r5-044-ios-startup-audit.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/r5-044-ios-startup-audit.md b/docs/r5-044-ios-startup-audit.md index 7bd6f550a..23e40a09b 100644 --- a/docs/r5-044-ios-startup-audit.md +++ b/docs/r5-044-ios-startup-audit.md @@ -1,6 +1,6 @@ # Fixed 044 iOS startup readout -This is a read-only descendant of the fixed #7124 reader at +This is a read-only descendant of the fixed #7123 reader at `60dd4582c6b5e7b983aeed9fa4d3abafc9835edc`. It retrieves only artifact `12469536083` from run `39873063291`, attempt 1, iOS job `120151926152`. The frozen application source is `044ebb6ea2d465f6a70e9116e3feac5a604cd696`,