@jacebenson/jsn 5.5.9-dev.225.1 → 5.5.9-dev.226.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/commands/upgrade.js +12 -0
- package/src/upgrade-prep.js +258 -0
package/package.json
CHANGED
package/src/commands/upgrade.js
CHANGED
|
@@ -2,6 +2,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
2
2
|
import { declareCapabilities } from '../capabilities.js';
|
|
3
3
|
import { AppError, CodeAPI, CodeNetwork } from '../errors.js';
|
|
4
4
|
import { checkLatest, getReleaseChannel, getVersion } from './version.js';
|
|
5
|
+
import { collectUpgradePrep, prepSummary } from '../upgrade-prep.js';
|
|
5
6
|
|
|
6
7
|
for (const name of ['upgrade', 'update']) {
|
|
7
8
|
declareCapabilities(name, { noInstance: true, skipDailyChecks: true });
|
|
@@ -43,6 +44,17 @@ export function upgradeCmd(wrap, { version = getVersion, check = checkLatest, in
|
|
|
43
44
|
aliases: ['update'],
|
|
44
45
|
describe: 'Upgrade jsn through npm (preserves the installed release channel)',
|
|
45
46
|
builder: (y) => y
|
|
47
|
+
.command({ command: 'prep', describe: 'Collect read-only platform and Store upgrade preparation evidence',
|
|
48
|
+
builder: p => p
|
|
49
|
+
.option('target', { type: 'string', describe: 'Optional exact offered target label/value/sys_id; never selected automatically' })
|
|
50
|
+
.option('related-profile', { type: 'array', string: true, describe: 'Explicit related lower-environment profiles for update-set evidence' })
|
|
51
|
+
.option('customizations', { type: 'string', describe: 'Existing local customization capture ID' })
|
|
52
|
+
.option('limit', { type: 'number', default: 50, describe: 'Maximum rows per evidence source (1–200)' }),
|
|
53
|
+
handler: wrap(async (argv, app) => {
|
|
54
|
+
const data = await collectUpgradePrep(argv, app);
|
|
55
|
+
app.ok(data, { summary: prepSummary(data) });
|
|
56
|
+
}),
|
|
57
|
+
})
|
|
46
58
|
.option('channel', { type: 'string', choices: ['dev', 'main', 'latest'], describe: 'Choose dev or stable (main/latest)' })
|
|
47
59
|
.option('dry-run', { type: 'boolean', describe: 'Show the install command without installing' })
|
|
48
60
|
.option('force', { type: 'boolean', describe: 'Reinstall even when the selected version is not newer' }),
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { errUsage } from './errors.js';
|
|
2
|
+
import { App } from './app.js';
|
|
3
|
+
import { applySession } from './session.js';
|
|
4
|
+
import { quoteShellArg } from './helpers.js';
|
|
5
|
+
import { discoverSkippedUpdates, raw } from './skipped-updates.js';
|
|
6
|
+
import { fetchTableResult } from './commands/atf.js';
|
|
7
|
+
import { scanResults } from './scan.js';
|
|
8
|
+
import { getReport } from './customizations.js';
|
|
9
|
+
import { tableReadParams } from './table-read-params.js';
|
|
10
|
+
|
|
11
|
+
const fieldName = /^[a-z][a-z0-9_]*$/;
|
|
12
|
+
const idPattern = /^[0-9a-f]{32}$/i;
|
|
13
|
+
const value = (row, field) => raw(row?.[field]);
|
|
14
|
+
const timestamp = row => value(row, 'sys_updated_on') || value(row, 'sys_created_on') || null;
|
|
15
|
+
const fieldsMissing = (fields, rows) => fields.filter(field => rows.some(row => !Object.hasOwn(row, field)));
|
|
16
|
+
const safeFields = new Set(['sys_id', 'sys_updated_on', 'sys_created_on', 'name', 'number', 'state', 'status',
|
|
17
|
+
'severity', 'priority', 'disposition', 'resolution_status', 'short_description', 'description',
|
|
18
|
+
'upgrade_preview', 'preview', 'version', 'target_version', 'source', 'target', 'source_instance',
|
|
19
|
+
'target_instance', 'requested', 'scheduled', 'started', 'completed', 'start_time', 'end_time',
|
|
20
|
+
'table', 'condition', 'active', 'preserve', 'exclude', 'upgrade_history', 'test', 'test_suite',
|
|
21
|
+
'type', 'result', 'percent_complete', 'message']);
|
|
22
|
+
|
|
23
|
+
export function validatePrep(argv) {
|
|
24
|
+
if (!argv.profile && !argv.instance) throw errUsage('Upgrade preparation requires explicit --profile or --instance.');
|
|
25
|
+
if (!Number.isInteger(argv.limit) || argv.limit < 1 || argv.limit > 200) throw errUsage('--limit must be an integer from 1 to 200.');
|
|
26
|
+
if (argv.target !== undefined && (typeof argv.target !== 'string' || !argv.target.trim())) throw errUsage('--target must be nonempty.');
|
|
27
|
+
for (const name of argv.relatedProfile || []) if (typeof name !== 'string' || !name) throw errUsage('Supply explicit related profile names.');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** Only Table API GETs are exposed to collectors, including reused readers. */
|
|
31
|
+
export async function collectUpgradePrep(argv, app) {
|
|
32
|
+
validatePrep(argv);
|
|
33
|
+
app.requireInstance();
|
|
34
|
+
const related = (argv.relatedProfile || []).map(name => {
|
|
35
|
+
const profile = app.config.profiles[name];
|
|
36
|
+
if (!profile?.instance_url) throw errUsage(`Unknown related profile: ${name}`);
|
|
37
|
+
const relatedApp = new App(app.config);
|
|
38
|
+
applySession(relatedApp, { profile: name });
|
|
39
|
+
return { profile: name, instance: relatedApp.getEffectiveInstance(), sdk: relatedApp.sdk };
|
|
40
|
+
});
|
|
41
|
+
const report = { generated_at: new Date().toISOString(), status: 'incomplete', target: argv.target || null,
|
|
42
|
+
target_basis: argv.target ? 'operator_selection_not_eligibility_guarantee' : 'not_selected',
|
|
43
|
+
sources: [], findings: [], activities: [], limitations: [
|
|
44
|
+
'Read-only preparation evidence, not a readiness certification or upgrade executor.',
|
|
45
|
+
'Offered targets are local metadata, not a fresh eligibility guarantee. No future target is selected automatically.',
|
|
46
|
+
'Last completed platform history is not the live node build. Historical skips are not predicted skips.',
|
|
47
|
+
'Version suffixes are not security advisories. Store metadata is not target compatibility or purchase authorization.',
|
|
48
|
+
'Missing retrieval evidence does not establish absence of backups. ATF/scan success does not establish UAT or coverage.',
|
|
49
|
+
'All reads are bounded; timestamps and inaccessible fields require human review. No topology is inferred from profile names.',
|
|
50
|
+
] };
|
|
51
|
+
const addFinding = (kind, status, source, detail, metadata = {}) => {
|
|
52
|
+
const finding = { id: `finding-${report.findings.length + 1}`, kind, status,
|
|
53
|
+
source_refs: source ? [source.id] : [], record_ids: metadata.record_ids || [], detail, ...metadata };
|
|
54
|
+
report.findings.push(finding);
|
|
55
|
+
return finding;
|
|
56
|
+
};
|
|
57
|
+
const activity = (kind, action, refs = [], dependencies = [], completion = '') => report.activities.push({
|
|
58
|
+
id: `activity-${report.activities.length + 1}`, kind, status: 'pending', action,
|
|
59
|
+
source_refs: refs, depends_on: dependencies, completion_check: completion,
|
|
60
|
+
});
|
|
61
|
+
async function collectContext(context, lower = false) {
|
|
62
|
+
const { profile, instance } = context;
|
|
63
|
+
function reference(table, params, id) {
|
|
64
|
+
const fields = (params.get('sysparm_fields') || '').split(',').filter(Boolean);
|
|
65
|
+
const query = params.get('sysparm_query') || '';
|
|
66
|
+
const path = `/api/now/table/${table}${id ? `/${id}` : ''}`;
|
|
67
|
+
const source = { id: `source-${report.sources.length + 1}`, profile: profile || null, instance, table,
|
|
68
|
+
fields, encoded_query: query, requested_record_ids: id ? [id] : [], record_ids: [], observed_at: new Date().toISOString(), source_timestamps: [],
|
|
69
|
+
bounds: { limit: Number(params.get('sysparm_limit')) || 1, offset: Number(params.get('sysparm_offset')) || 0,
|
|
70
|
+
truncation: 'unknown' }, status: 'not_checked', method: 'GET', path, params: Object.fromEntries(params),
|
|
71
|
+
read_command: `jsn records ${id ? `get --table ${table} --sys-id ${quoteShellArg(id)}` : `list --table ${table}`} --instance ${quoteShellArg(instance)}${profile ? ` --profile ${quoteShellArg(profile)}` : ''}${!id ? ` --query ${quoteShellArg(query)} --limit ${params.get('sysparm_limit') || 1} --offset ${params.get('sysparm_offset') || 0} --display-values ${params.get('sysparm_display_value') === 'all' ? 'both' : params.get('sysparm_display_value') === 'true' ? 'display' : 'raw'} --no-count` : ''}${fields.length ? ` --fields ${quoteShellArg(fields.join(','))}` : ''} --json` };
|
|
72
|
+
report.sources.push(source);
|
|
73
|
+
return source;
|
|
74
|
+
}
|
|
75
|
+
const sdk = Object.fromEntries(['list', 'listStrict', 'get'].map(method => [method, async (table, argument) => {
|
|
76
|
+
if (!fieldName.test(table)) throw errUsage('Unsafe evidence table.');
|
|
77
|
+
const params = method === 'get' ? new URLSearchParams() : tableReadParams(argument, context.sdk);
|
|
78
|
+
const source = reference(table, params, method === 'get' ? argument : null);
|
|
79
|
+
try {
|
|
80
|
+
const result = await context.sdk[method === 'list' ? 'listStrict' : method](table, argument);
|
|
81
|
+
const rows = Array.isArray(result) ? result : result ? [result] : [];
|
|
82
|
+
source.records = rows;
|
|
83
|
+
source.record_ids = rows.map(row => value(row, 'sys_id')).filter(Boolean);
|
|
84
|
+
source.missing_fields = fieldsMissing(source.fields, rows);
|
|
85
|
+
source.source_timestamps = rows.map(row => ({ sys_id: value(row, 'sys_id'), timestamp: timestamp(row) }));
|
|
86
|
+
source.bounds.truncation = method === 'get' ? 'no' : rows.length >= source.bounds.limit ? 'possible' : 'no';
|
|
87
|
+
source.status = rows.length ? 'observed' : 'missing';
|
|
88
|
+
source.stale_record_ids = rows.filter(row => timestamp(row) && Date.parse(timestamp(row)) < Date.now() - 30 * 86400000).map(row => value(row, 'sys_id'));
|
|
89
|
+
return result;
|
|
90
|
+
} catch (error) {
|
|
91
|
+
source.status = [401, 403].includes(error.status) ? 'inaccessible' : error.status === 404 ? 'missing' : 'error';
|
|
92
|
+
source.http_status = error.status || null;
|
|
93
|
+
// Do not expose transport messages, which can include credentials/URLs.
|
|
94
|
+
throw error;
|
|
95
|
+
}
|
|
96
|
+
}]));
|
|
97
|
+
async function read(table, fields, query = 'ORDERBYsys_id', limit = argv.limit) {
|
|
98
|
+
try { return await sdk.listStrict(table, new URLSearchParams({ sysparm_fields: fields,
|
|
99
|
+
sysparm_query: query, sysparm_limit: String(limit), sysparm_display_value: 'false' })); }
|
|
100
|
+
catch { return []; }
|
|
101
|
+
}
|
|
102
|
+
const last = () => report.sources.at(-1);
|
|
103
|
+
async function schema(table) {
|
|
104
|
+
const rows = await read('sys_dictionary', 'sys_id,name,element,reference,sys_updated_on',
|
|
105
|
+
`name=${table}^elementISNOTEMPTY^ORDERBYelement`, 200);
|
|
106
|
+
return rows.map(row => value(row, 'element')).filter(field => fieldName.test(field));
|
|
107
|
+
}
|
|
108
|
+
async function dynamic(table, query) {
|
|
109
|
+
const known = await schema(table);
|
|
110
|
+
if (!known.length) {
|
|
111
|
+
addFinding('schema_gap', last().status === 'observed' ? 'missing' : last().status, last(), `Readable dictionary fields for ${table} are incomplete; no data query attempted.`);
|
|
112
|
+
return [];
|
|
113
|
+
}
|
|
114
|
+
const fields = [...new Set(['sys_id', ...known.filter(field => safeFields.has(field))])];
|
|
115
|
+
const rows = await read(table, fields.join(','), query || 'ORDERBYsys_id');
|
|
116
|
+
return rows;
|
|
117
|
+
}
|
|
118
|
+
if (lower) {
|
|
119
|
+
for (const table of ['sys_update_set', 'sys_remote_update_set']) {
|
|
120
|
+
const rows = await dynamic(table);
|
|
121
|
+
addFinding('lower_environment_preservation', rows.length ? 'observed' : last().status, last(),
|
|
122
|
+
`${table} evidence for explicitly related profile; retrieval is not a backup or proof of recoverability.`, { records: rows });
|
|
123
|
+
}
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
await read('upgrade_center_metadata', 'sys_id,scheduled_version,upgrade_scheduled_on,end_of_life,near_end_of_life,sys_updated_on');
|
|
127
|
+
const schedules = last();
|
|
128
|
+
addFinding('scheduling', schedules.status, schedules, 'Recorded scheduling and lifecycle metadata only; blank schedules do not select an upgrade.');
|
|
129
|
+
const targets = await read('upgrade_preview_version', 'sys_id,label,value,upgrade_center_metadata,sys_updated_on');
|
|
130
|
+
const targetSource = last();
|
|
131
|
+
addFinding('offered_targets', targetSource.status, targetSource, 'Locally offered platform targets; eligibility must be confirmed separately.', { records: targets });
|
|
132
|
+
if (argv.target) {
|
|
133
|
+
const matches = targets.filter(row => [value(row, 'sys_id'), value(row, 'value'), value(row, 'label')].includes(argv.target));
|
|
134
|
+
addFinding('target_selection', matches.length === 1 ? 'observed' : 'missing', targetSource,
|
|
135
|
+
matches.length === 1 ? 'Exact local target metadata match, not eligibility certification.' : 'Target was not uniquely observed in this bounded catalog.', { records: matches });
|
|
136
|
+
}
|
|
137
|
+
const history = await read('sys_upgrade_history', 'sys_id,from_version,to_version,upgrade_started,upgrade_finished,sys_updated_on',
|
|
138
|
+
'to_versionSTARTSWITHglide^upgrade_finishedISNOTEMPTY^ORDERBYDESCupgrade_finished');
|
|
139
|
+
addFinding('last_completed_platform_history', last().status, last(), 'Historical completed platform upgrade, not live node build.', { records: history.slice(0, 1) });
|
|
140
|
+
const apps = await read('sys_store_app', 'sys_id,name,scope,version,latest_version,update_available,sys_updated_on',
|
|
141
|
+
'update_available=true^NQlatest_versionISNOTEMPTY^ORDERBYsys_id');
|
|
142
|
+
const storeSource = last();
|
|
143
|
+
for (const row of apps) {
|
|
144
|
+
// raw() stringifies scalar and reference values, including booleans.
|
|
145
|
+
const flagValue = value(row, 'update_available');
|
|
146
|
+
const flag = ['true', '1'].includes(flagValue) ? true : ['false', '0'].includes(flagValue) ? false : null;
|
|
147
|
+
const readableVersion = field => {
|
|
148
|
+
const fieldValue = row[field]?.value ?? row[field];
|
|
149
|
+
return typeof fieldValue === 'string' && fieldValue.trim() ? fieldValue : '';
|
|
150
|
+
};
|
|
151
|
+
const installed = readableVersion('version'), latest = readableVersion('latest_version');
|
|
152
|
+
if (flag === false && (!latest || latest === installed)) continue;
|
|
153
|
+
const contradictory = Boolean(flag !== null && installed && latest && flag === (installed === latest));
|
|
154
|
+
addFinding(contradictory ? 'store_metadata_conflict' : 'store_update_candidate', contradictory ? 'verified_problem' : flag === null ? 'missing' : 'observed', storeSource,
|
|
155
|
+
contradictory ? 'Update flag contradicts recorded versions; verify catalog metadata before deciding.'
|
|
156
|
+
: flag === null ? 'Update availability flag is missing or unrecognized; recorded versions are candidate evidence only, not a verified contradiction.'
|
|
157
|
+
: 'Store update candidate; target compatibility remains unverified.',
|
|
158
|
+
{ record_ids: [value(row, 'sys_id')], record: row });
|
|
159
|
+
}
|
|
160
|
+
for (const table of ['upgrade_preview', 'upgrade_preview_log']) {
|
|
161
|
+
const rows = await dynamic(table);
|
|
162
|
+
const source = last();
|
|
163
|
+
addFinding('existing_preview', source.status, source, 'Existing preview only; scope/target/time must be checked. Severity and priority are retained exactly, never inferred.', { records: rows });
|
|
164
|
+
for (const row of rows.filter(row => ['severity', 'priority', 'disposition'].some(field => value(row, field)))) {
|
|
165
|
+
addFinding('preview_finding', 'observed', source, 'Provider preview metadata requires operator triage; numeric priority is not interpreted as severity.',
|
|
166
|
+
{ record_ids: [value(row, 'sys_id')], metadata: Object.fromEntries(['severity', 'priority', 'disposition', 'resolution_status'].filter(field => Object.hasOwn(row, field)).map(field => [field, row[field]])) });
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
try {
|
|
170
|
+
const skipped = await discoverSkippedUpdates(sdk, { limit: argv.limit });
|
|
171
|
+
addFinding('historical_skips', last().status, last(), 'Unresolved historical skipped updates, not predicted future skips.', { evidence: skipped });
|
|
172
|
+
} catch { addFinding('historical_skips', last()?.status || 'error', last(), 'Historical skip reader could not establish valid unresolved evidence.'); }
|
|
173
|
+
const cloneTables = await read('sys_db_object', 'sys_id,name,label,sys_updated_on', 'nameLIKEclone^ORDERBYname', 5);
|
|
174
|
+
for (const row of cloneTables.slice(0, 4)) {
|
|
175
|
+
const table = value(row, 'name');
|
|
176
|
+
if (!fieldName.test(table)) continue;
|
|
177
|
+
const rows = await dynamic(table);
|
|
178
|
+
addFinding('clone_evidence', last().status, last(), `Dictionary-established ${table}; role and relation to this upgrade need operator confirmation.`, { records: rows });
|
|
179
|
+
}
|
|
180
|
+
if (!cloneTables.length) addFinding('clone_gap', last().status, last(), 'Clone requests/history/preservers/exclusions were not established. Ask an administrator for readable schema and recovery evidence.');
|
|
181
|
+
for (const table of ['sys_atf_test_result', 'sys_atf_test_suite_result']) {
|
|
182
|
+
const rows = await read(table, 'sys_id,sys_created_on,sys_updated_on', 'ORDERBYDESCsys_created_on', Math.min(argv.limit, 3));
|
|
183
|
+
for (const row of rows) if (idPattern.test(value(row, 'sys_id'))) {
|
|
184
|
+
try {
|
|
185
|
+
const firstSource = report.sources.length;
|
|
186
|
+
const evidence = await fetchTableResult({ sdk }, value(row, 'sys_id'));
|
|
187
|
+
addFinding('existing_atf', evidence?.status === 'failed' ? 'verified_problem' : evidence ? 'observed' : 'missing', last(), 'Existing ATF result; reader may infer status. Verify scope, timestamp, target relevance and business coverage.',
|
|
188
|
+
{ evidence, source_refs: report.sources.slice(firstSource).map(source => source.id) });
|
|
189
|
+
} catch { /* Exact failed read is retained in sources. */ }
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
const scans = await read('sys_execution_tracker', 'sys_id,type,sys_created_on,sys_updated_on', 'type=instance_scan^ORDERBYDESCsys_created_on', Math.min(argv.limit, 3));
|
|
193
|
+
for (const row of scans) if (idPattern.test(value(row, 'sys_id'))) {
|
|
194
|
+
try {
|
|
195
|
+
const firstSource = report.sources.length;
|
|
196
|
+
const evidence = await scanResults(sdk, value(row, 'sys_id'), argv.limit);
|
|
197
|
+
addFinding('existing_scan', evidence.findings.length ? 'verified_problem' : evidence.incomplete ? 'missing' : 'observed', last(), 'Existing scan result only; inspect target scope/time and incomplete evidence.',
|
|
198
|
+
{ evidence, source_refs: report.sources.slice(firstSource).map(source => source.id) });
|
|
199
|
+
} catch { /* Exact failed read is retained in sources. */ }
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
await collectContext({ profile: argv.profile || null, instance: app.getEffectiveInstance(), sdk: app.sdk });
|
|
203
|
+
for (const context of related) await collectContext(context, true);
|
|
204
|
+
if (!related.length) addFinding('lower_environment_preservation', 'not_checked', null,
|
|
205
|
+
'No related profiles supplied. Provide --related-profile explicitly to inspect lower-environment update-set preservation/retrieval; topology is not inferred.');
|
|
206
|
+
if (argv.customizations) {
|
|
207
|
+
const capture = getReport(argv.customizations);
|
|
208
|
+
if (!capture || capture.instance !== app.getEffectiveInstance()) throw errUsage('Customization capture must exist and match the selected instance exactly.');
|
|
209
|
+
addFinding('customization_capture', 'observed', null, 'Existing local customization capture; assess age and bounds before reuse.', { evidence: capture });
|
|
210
|
+
} else addFinding('customization_capture', 'not_checked', null, 'Supply --customizations with an existing local capture; no capture is persisted by this briefing.');
|
|
211
|
+
for (const source of report.sources) {
|
|
212
|
+
if (source.missing_fields?.length) addFinding('unreadable_fields', 'missing', source,
|
|
213
|
+
'Requested fields were absent in returned records; absent fields are not blank values.', { fields: source.missing_fields });
|
|
214
|
+
if (source.stale_record_ids?.length) addFinding('stale_evidence', 'stale', source, 'Records older than 30 days; revalidate relevance, not necessarily invalid.', { record_ids: source.stale_record_ids });
|
|
215
|
+
if (source.bounds.truncation !== 'no') addFinding('bounded_evidence', 'missing', source, 'Evidence may be truncated; paginate this exact read before drawing absence conclusions.');
|
|
216
|
+
if (['missing', 'inaccessible', 'error'].includes(source.status) || source.missing_fields?.length
|
|
217
|
+
|| source.stale_record_ids?.length || source.bounds.truncation !== 'no') {
|
|
218
|
+
activity('evidence_gap', 'Obtain readable, current, completely paginated evidence or document why unavailable.',
|
|
219
|
+
[source.id], [], 'Rerun exact GET; resolve absent fields, revalidate old records and record complete bounds.');
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
activity('preserve_workflows', 'Inventory customizations, lower-environment update sets, clone preservation/exclusions and recovery ownership before a technical upgrade.',
|
|
223
|
+
report.sources.filter(s => /update_set|clone|upgrade_history/.test(s.table)).map(s => s.id), [], 'Owners verify preservation and retrieval evidence; absence of retrieval is not absence of backups.');
|
|
224
|
+
activity('technical_upgrade_review', 'Review exact platform/Store targets and preview dispositions with owners; preserve existing workflows where supported.',
|
|
225
|
+
report.sources.filter(s => /upgrade|store/.test(s.table)).map(s => s.id), ['activity-' + report.activities.length], 'Document chosen targets, compatibility, unavoidable behavior changes and resolved preview decisions.');
|
|
226
|
+
const technicalReviewId = report.activities.at(-1).id;
|
|
227
|
+
for (const [kind, action, completion] of [
|
|
228
|
+
['release_changes', 'Obtain official target-specific deprecations, migrations, security advisories and default changes; never infer them from a version suffix.', 'Owners cite authoritative release documentation and validate affected workflows.'],
|
|
229
|
+
['recovery', 'Validate backups, restore rehearsal, downtime, rollback decision points and accountable owners.', 'Recovery owner records tested procedure and acceptable recovery point/time.'],
|
|
230
|
+
['uat', 'Define integration regression scope and business-owner UAT; map existing ATF/scan evidence to that scope.', 'Owners sign off representative workflows and document uncovered scope.'],
|
|
231
|
+
['optional_activation', 'Plan controlled later optional feature activation separately from technical upgrade; identify unavoidable changes first.', 'Feature owners approve opt-in rollout, testing and rollback separately.'],
|
|
232
|
+
]) activity(kind, action, [], kind === 'optional_activation' ? [technicalReviewId] : [], completion);
|
|
233
|
+
return report;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function findingSummary(finding) {
|
|
237
|
+
const parts = [`${finding.id} [${finding.status}] ${finding.kind}: ${finding.detail}`,
|
|
238
|
+
`(${finding.source_refs.join(', ') || 'human/local evidence'})`];
|
|
239
|
+
if (finding.record) {
|
|
240
|
+
const row = finding.record;
|
|
241
|
+
parts.push(`${value(row, 'name')}: installed=${value(row, 'version')} catalog=${value(row, 'latest_version')} update_available=${value(row, 'update_available')}`);
|
|
242
|
+
}
|
|
243
|
+
if (finding.metadata) parts.push(JSON.stringify(finding.metadata));
|
|
244
|
+
if (finding.records?.length) {
|
|
245
|
+
const row = finding.records[0];
|
|
246
|
+
parts.push(`Observed records: ${finding.records.length}; first=${value(row, 'label') || value(row, 'name') || value(row, 'to_version') || value(row, 'sys_id')}`);
|
|
247
|
+
}
|
|
248
|
+
return parts.join(' ');
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
export function prepSummary(report) {
|
|
252
|
+
return ['Upgrade preparation — incomplete evidence, not readiness certification',
|
|
253
|
+
`Target: ${report.target || 'not selected (discovery only)'}`,
|
|
254
|
+
`Sources: ${report.sources.length}; findings: ${report.findings.length}; activities: ${report.activities.length}`,
|
|
255
|
+
...report.findings.map(findingSummary),
|
|
256
|
+
...report.activities.map(a => `${a.id}: ${a.action} Completion: ${a.completion_check}`),
|
|
257
|
+
'Use --json or --get data.sources for exact GET provenance and bounds.'].join('\n');
|
|
258
|
+
}
|