Skip to content

Commit a7292a5

Browse files
fix(units): raise the blank-unit debt of a unitField re-pointed at a new field; name unused code-keyed mapping entries; say what a capped walk did not judge (#37268)
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH Part of #35885 Clause-②: no Metadata-protocol: none ## 维护者速读 - 管理员在一次保存里把某个数量字段的单位改指向一个新建字段时,保存会先被拦下,提示所有存量行将缺单位并给出补写办法;单位换算工具的报告会点出没被用上的映射条目,只扫了部分行时也会明说其余行未判定。用户的数据本身不变。 - 属于"计量单位"标准里单位换算回填这一块的收尾,替转换大表或改表结构的运维人员补上三个提示缺口。 - 若判断有误,管理员只会多看到一次可强制跳过的拦截提示,或报告里多一两行说明;不改任何已存数据,可以直接撤回。 - 无 ## What changes Three follow-up gaps of the unit-code backfill door (ADR-0158 R1), each inside the claim's file surface: 1. **A `unitField` re-pointed at a new field raises its blank-unit debt.** `detectDestructiveObjectChanges` now raises 409 `DESTRUCTIVE_CHANGE` with `unit_mode_to_record` on a stored `record`-mode quantity whose `unitField` is re-pointed at a field that held no stored unit before the save (new in it, or unstored before it). The message names the re-point, the blank beside every stored quantity, and the `""` entry of the unit-code run, CLI and REST. It reads no row and `force: true` lifts it. The once-only rule of `newlyDeclaredUnitCodeFieldsOf` is kept: a re-point onto a stored text field still raises `unit_code_field_declared` alone (it names the quantity), and a re-point onto a field that already was a unit code field still raises nothing (the `currency_field_repointed` sibling, out of R1). **Code choice:** the existing `unit_mode_to_record`, not a new `unit_field_repointed`. The debt is the same blank-unit debt, the spec's `issues[].code` describe text lists the codes and stays unchanged, and a new code would be a `packages/spec` edit outside the claim. 2. **N3, unused code-keyed mapping entries are named.** A value stored as a unit code (`member`, `retired`, `other-dimension`) that is also a mapping key no row used now carries `unusedEntry` (the code that entry names) in the report, and the printed report adds one line per such entry. An entry that some row did use, for example in another organization where the text is not a unit, is not named. 3. **N4, a truncated walk says what it did not judge. Shape chosen: report, not refusal, to match the currency twin.** `record-currency-backfill.ts` writes over a walk the `maxRecords` cap cut short and reports it. The unit backfill now does the same thing in the same words: the printed report says the rows past the cap were not judged, so any of them may hold a value with no mapping entry, and that an apply run wrote only the rows it examined. An unscoped run also gets the currency report's line that the organization check saw only the rows examined. The CLI prints these lines from the shared formatter, so no `packages/cli` edit was needed. Refusing apply over a truncated preview would be a narrowing the currency twin does not have. The module header of `unit-code-backfill.ts` is amended. "One run converts the whole field or nothing" now holds over the rows the run examines. **Read first** (by risk): 1. `packages/metadata-protocol/src/protocol-write-face.ts`, the new re-point branch ahead of the `unit_mode_to_record` switch branch. The risk is the predicate: `prevUnitField !== unitField` and `!prevUnitCodeFields.has(unitField)`, with the `declaredUnitCodeFields` gate shared with the switch branch. 2. `packages/objectql/src/protocol-destructive-unit-mode.test.ts`, the new pin and the widened once-only `it.each` loop, which now also checks re-points. 3. `packages/objectql/src/unit-code-backfill.ts`, the `unusedEntry` pass after the walk and the truncated lines in the formatter. ## Tests Readings taken on head `0237272ee3f` (final commit; base `d62f9e9c05a`). - New pin: a stored record-mode quantity re-pointed at a new field gets 409 `DESTRUCTIVE_CHANGE` / `unit_mode_to_record`, asserting `code` and `status`. The test checks the message, reads no row, and confirms `force: true` lifts it. The once-only `it.each` gains two re-point cases, and its debt loop now covers re-points as well as switches. - New pins in `unit-code-backfill.test.ts`: `unusedEntry` and its report line, and an apply run capped at 2 rows. That run writes the 2 rows it examined, leaves the unseen unmatched rows as stored, prints the not-judged line, and the uncapped run is still refused `VALIDATION_ERROR` / 400. <details><summary>Package tests and typecheck</summary> - `pnpm --filter @objectstack/objectql --filter @objectstack/metadata-protocol typecheck`, then each package's `pnpm test`, under the verify lock: `VERDICT command-exit 0`. - metadata-protocol: `Test Files 370 passed | 9 skipped (379)`, `Tests 23417 passed | 45 skipped (23462)`. - objectql: `Test Files 638 passed (638)`, `Tests 14428 passed (14428)`. - Targeted run before that: `Test Files 3 passed (3)`, `Tests 75 passed (75)`, for the destructive-unit-mode, unit-code backfill and record-currency backfill test files. </details> <details><summary>Ablations (one per fix, through scripts/ablation-replace.mjs; each restored, blob equals HEAD and git diff HEAD is empty)</summary> - A1, the re-point predicate: `prevUnitField !== unitField` was changed to a never-true comparison. metadata-protocol was rebuilt, and `ablation-dist-preflight` found the marker present in 2 built files. Result: 3 failed, 21 passed, namely the new pin and the two new `it.each` re-point cases. Restore leg: rebuilt, and the marker is absent from all 24 built files. - A2, the `unusedEntry` assignment was removed. Result: 1 failed, 28 passed, the new N3 pin. - A3, the truncated wording was blanked. Result: 1 failed, 28 passed, the new N4 pin. </details> <details><summary>Gates</summary> - Derived with `node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack` (69 families). Each one was run locally, with its exit code captured before any pipe. - 68 exited 0. `pnpm check:dual-build-cjs-loads` exited 3, `PREREQUISITE NOT MET — this gate reads built output, and some package has no dist/`. That is NOT MEASURED, because a full `pnpm build` was not run. CI's `Lint & Repo Gates` measures it. - `--ran` reconciliation: `69 derived, 69 run, 0 NOT-MEASURED, 0 UNRUN`. The runner's NOT-MEASURED claim is corrected by the dual-build line above. - The PR check-runs are read by the seat (no CI polling here). </details> ## Acceptance notes - **ADR-0158 amendment not in this PR.** The card's Done-when asks for Open item 9's trailing note and Open item 12 to be amended. `docs/adr/**` is outside the claim's file surface and is a governed Tier H path, which would make this code PR Tier H. So this PR says `Part of`, and the amendment is left to the owning seat as its own ADR-note PR. Proposed text: in Open item 9, replace the sentence carried by the card with "A `unitField` re-pointed onto a field new in the same save, or unstored before it, raises `unit_mode_to_record` on the quantity, for the blanks beside it; one re-pointed onto a field that already was a unit code field raises nothing in R1 (the sibling of `currency_field_repointed`)". In Open item 12's Dry-run-and-apply point, replace "A preview cut short at its row limit is reported as truncated" with "A walk cut short at its row limit judges only the rows it examined: an apply run writes those, and the report says that the rows past the limit were not judged, as the currency backfill's does; a mapping entry whose key is stored as a unit code and that no row used is named in the report". - The `unit_mode_to_record` describe in the spec (`issues[].code`) and the generated protocol reference are unchanged: the code list did not move. - `packages/cli` untouched: the CLI prints the formatter's lines. Its own `unit-codes` tests were not run locally (the package's public face is additive, an optional field); CI's `Test Core` runs them. ## Verification Run `pnpm --filter @objectstack/objectql exec vitest run --maxWorkers=2 src/protocol-destructive-unit-mode.test.ts src/unit-code-backfill.test.ts` after building metadata-protocol. Expect every test to pass, including the three new pins named above. --- _Generated by [Claude Code](https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 057cedf commit a7292a5

5 files changed

Lines changed: 131 additions & 8 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
'@objectstack/metadata-protocol': patch
3+
'@objectstack/objectql': patch
4+
---
5+
6+
fix(units): a `unitField` re-pointed at a new field raises its blank-unit debt; the unit-code backfill names unused mapping entries and says what a capped walk did not judge
7+
8+
Clause-②: no
9+
Metadata-protocol: none
10+
11+
- A metadata save that re-points a stored `record`-mode quantity's `unitConfig.unitField` at a field that held no stored unit before the save (new in it, or unstored before it) is now answered 409 `DESTRUCTIVE_CHANGE` with `unit_mode_to_record` on the quantity: every stored row then holds its quantity beside a blank unit, and is refused at its next quantity edit until it holds a unit code. The finding names the `""` mapping entry of `os migrate unit-codes` that writes those blanks, reads no row, and is lifted by `force: true`. A re-point onto a stored text field still raises `unit_code_field_declared` alone, and a re-point onto a field that already was a unit code field still raises nothing.
12+
- `os migrate unit-codes` and `POST /api/v1/meta/_migrate-unit-codes`: a mapping entry whose key the rows store as a unit code, which is never rewritten, and that no row used is now named, as `unusedEntry` on that value in the report and as a line of the printed report.
13+
- When the walk stops at `maxRecords`, the printed report now says that the rows past the cap were not judged, so any of them may hold a value with no mapping entry, and that an apply run wrote the rows examined only, as the record-currency backfill's report does; an unscoped run also says its organization check saw only the rows examined. An apply run over such a walk still writes the rows it examined, as before.

‎packages/metadata-protocol/src/protocol-write-face.ts‎

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,33 @@ function detectDestructiveObjectChanges(prev: any, next: any): Array<{
319319
// quantity among its declarers, the blanks beside it and the `""`
320320
// entry, so this one is not raised. Lifted by the same `force`,
321321
// reading no row.
322+
//
323+
// The same debt, raised under the same code: a stored `record`-mode
324+
// quantity whose `unitField` is re-pointed at a field that held no
325+
// stored unit before the save (new in it, or unstored before it).
326+
// Every stored row then holds its quantity beside a blank there. The
327+
// re-point onto a field that already was a unit code field converts
328+
// nothing and strands no blank the save made, so it raises nothing:
329+
// the sibling of `currency_field_repointed`, out of R1 (ADR-0158 Open
330+
// item 9). The re-point onto a stored text field is
331+
// `unit_code_field_declared`'s, under the same once-only rule.
322332
const unitField = recordUnitFieldOf(nextField);
323-
if (
333+
const prevUnitField = recordUnitFieldOf(prevField);
334+
const repointedOntoBlank = prevUnitField !== undefined
335+
&& unitField !== undefined
336+
&& prevUnitField !== unitField
337+
&& !prevUnitCodeFields.has(unitField);
338+
if (repointedOntoBlank && isStored(prevField) && !declaredUnitCodeFields.has(unitField)) {
339+
issues.push({
340+
code: 'unit_mode_to_record',
341+
field: fname,
342+
message: `Field '${fname}' re-pointed its unitField from '${prevUnitField}' to '${unitField}' — '${unitField}' held no `
343+
+ `stored unit before this save (it is new, or was not stored), so every row already stored holds its quantity `
344+
+ `beside a blank '${unitField}', and no longer reads the unit '${prevUnitField}' holds; editing the quantity there `
345+
+ 'is refused until the row holds a unit code; once saved, write those blanks from a "" entry in the mapping of '
346+
+ unitCodeBackfillRemedy(objectName, unitField),
347+
});
348+
} else if (
324349
isStored(prevField)
325350
&& unitField !== undefined
326351
&& unitModeOf(prevField) !== 'record'

‎packages/objectql/src/protocol-destructive-unit-mode.test.ts‎

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ import { unitCodeSources } from './validation/unit-code-membership.js';
1919
* blanks beside it, whatever its `unitField`'s history (already a unit code
2020
* field, or new in the same save), unless the same save raises
2121
* `unit_code_field_declared` on that `unitField`: that finding names the
22-
* quantity, the blanks and the `""` entry, so each debt is reported once. The
22+
* quantity, the blanks and the `""` entry, so each debt is reported once. So
23+
* does a stored `record`-mode quantity whose `unitField` is re-pointed at a
24+
* field that held no stored unit (new in the save, or unstored before it). The
2325
* save is answered with the 409 `DESTRUCTIVE_CHANGE`, whose finding names the
2426
* conversion run, CLI and REST; `force: true` lifts it. It reads no row.
2527
*/
@@ -172,6 +174,22 @@ describe('ObjectStackProtocolImplementation - unit_code_field_declared and unit_
172174
readNoRow('mat_gross');
173175
});
174176

177+
it("a stored record-mode quantity's unitField re-pointed at a field NEW in the same save raises unit_mode_to_record on the quantity, reading no row", async () => {
178+
// Every stored row now holds its quantity beside a blank 'gross_uom': the same blank debt as a switch to 'record'.
179+
const fields = { ...STORED.mat_gross, gross: RECORD('gross', 'gross_uom'), gross_uom: TEXT('gross_uom') };
180+
const err = await refusalOf(save('mat_gross', fields));
181+
expect(err).toMatchObject({ code: 'DESTRUCTIVE_CHANGE', status: 409, issues: [expect.objectContaining({ code: 'unit_mode_to_record', field: 'gross' })] });
182+
expect(err.issues).toHaveLength(1);
183+
const { message } = err.issues[0];
184+
expect(message).toContain("Field 'gross' re-pointed its unitField from 'uom' to 'gross_uom'");
185+
expect(message).toContain("'gross_uom' held no stored unit before this save (it is new, or was not stored)");
186+
expect(message).toContain("every row already stored holds its quantity beside a blank 'gross_uom'");
187+
expect(message).toContain('write those blanks from a "" entry in the mapping of');
188+
for (const part of remedyOf('mat_gross', 'gross_uom')) expect(message).toContain(part);
189+
readNoRow('mat_gross');
190+
expect(await findingsOf(save('mat_gross', fields, { force: true }))).toEqual([]);
191+
});
192+
175193
it('[S1] raises nothing for a field that already was a unit code field, however it is declared now', async () => {
176194
// A new quantity naming a field another quantity already names.
177195
expect(await findingsOf(save('mat_gross', { ...STORED.mat_gross, net: RECORD('net', 'uom') }))).toEqual([]);
@@ -219,6 +237,8 @@ describe('ObjectStackProtocolImplementation - unit_code_field_declared and unit_
219237
['mat_bare', { ...STORED.mat_bare, title: CODE('title'), weight: RECORD('weight', 'uom'), uom: TEXT('uom') }],
220238
['mat_plain', { ...STORED.mat_plain, weight: RECORD('weight', 'weight_uom'), weight_uom: TEXT('weight_uom') }],
221239
['mat_fixed', { ...STORED.mat_fixed, weight: RECORD('weight', 'uom') }],
240+
['mat_gross', { ...STORED.mat_gross, gross: RECORD('gross', 'gross_uom'), gross_uom: TEXT('gross_uom') }],
241+
['mat_pair', { ...STORED.mat_pair, net: RECORD('net', 'uom'), gross: RECORD('gross', 'gross_uom'), gross_uom: TEXT('gross_uom') }],
222242
] as Array<[string, Record<string, unknown>]>)('on %s, the fields raised are those unitCodeSources newly names over a stored field, and each switched quantity\'s blanks are named once (%#)', async (object, next) => {
223243
const before = new Set(unitCodeSources(STORED[object]).map((s) => s.codeField));
224244
const expected = unitCodeSources(next)
@@ -233,12 +253,17 @@ describe('ObjectStackProtocolImplementation - unit_code_field_declared and unit_
233253
.map((i) => i.field)
234254
.sort();
235255
expect(raised).toEqual(expected);
236-
// Every stored quantity this save switches to unitMode 'record' has its blank debt named exactly once: by
237-
// unit_mode_to_record on the quantity, or by unit_code_field_declared on its unitField, which names it.
256+
// Every stored quantity this save switches to unitMode 'record', or re-points at a field that was no unit
257+
// code field before, has its blank debt named exactly once: by unit_mode_to_record on the quantity, or by
258+
// unit_code_field_declared on its unitField, which names it.
238259
const issues = (err?.issues ?? []) as Array<{ code: string; field: string; message: string }>;
239260
for (const [name, field] of Object.entries(next) as Array<[string, any]>) {
240-
const before = STORED[object][name] as any;
241-
if (!before || before.unitConfig?.unitMode === 'record' || field?.unitConfig?.unitMode !== 'record') continue;
261+
const prior = STORED[object][name] as any;
262+
if (!prior || field?.unitConfig?.unitMode !== 'record') continue;
263+
const priorPointer = prior.unitConfig?.unitMode === 'record' ? prior.unitConfig.unitField : undefined;
264+
const owes = priorPointer === undefined
265+
|| (priorPointer !== field.unitConfig.unitField && !before.has(field.unitConfig.unitField));
266+
if (!owes) continue;
242267
const named = issues.filter((i) => (i.code === 'unit_mode_to_record' && i.field === name)
243268
|| (i.code === 'unit_code_field_declared' && i.field === field.unitConfig.unitField && i.message.includes(`'${name}'`)));
244269
expect(named.map((i) => i.code), name).toHaveLength(1);

‎packages/objectql/src/unit-code-backfill.test.ts‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,31 @@ describe('backfillUnitCodes — free text stored before the field was a unit cod
289289
expect(d.finds.uom_material ?? 0).toBe(0);
290290
});
291291

292+
it('a mapping entry whose key the rows store as a unit code, and that no row used, is named in the report', async () => {
293+
const report = await run({ mapping: { ...MAPPING, KGM: 'LBR' } });
294+
expect(report.values.find((v) => v.value === 'KGM')).toEqual({ value: 'KGM', rows: 1, disposition: 'member', unusedEntry: 'LBR' });
295+
// The entries rows did use name nothing.
296+
expect(report.values.filter((v) => v.unusedEntry !== undefined).map((v) => v.value)).toEqual(['KGM']);
297+
expect(formatUnitCodeBackfillReport(report)).toContain(
298+
'⚠ The mapping entry "KGM" → LBR was not used: the rows holding "KGM" store it as a unit code, which is never rewritten.');
299+
expect(formatUnitCodeBackfillReport(await run({ mapping: MAPPING })).some((l) => l.includes('was not used'))).toBe(false);
300+
});
301+
302+
it('an apply run over a walk the cap cut short writes the rows examined, and the report says the rest were not judged', async () => {
303+
// The cap stops after m1 and m2, both mapped: the unmatched 'kg ' and 'lbs' rows past it are not seen.
304+
const report = await run({ mapping: { kg: 'KGM', '公斤': 'KGM' }, apply: true, maxRecords: 2 });
305+
expect(report).toMatchObject({ scannedRecords: 2, mapped: 2, written: 2, unmatched: 0, truncated: true, applied: true });
306+
expect(['m1', 'm2', 'm4', 'm8'].map(uom)).toEqual(['KGM', 'KGM', 'kg ', 'lbs']);
307+
expect(unitCodeBackfillComplete(report)).toBe(false);
308+
const lines = formatUnitCodeBackfillReport(report);
309+
expect(lines).toContain('⚠ Walk incomplete — some rows were not examined; re-run without the cap to finish.');
310+
expect(lines).toContain(' The rows past the cap were not judged: any of them may hold a value with no mapping entry, which this ' +
311+
'run neither named nor refused, and it wrote the rows examined only.');
312+
// Without the cap, the same apply run is refused over the values it now sees.
313+
const err = await refusal(run({ mapping: { kg: 'KGM', '公斤': 'KGM' }, apply: true }));
314+
expect(err).toMatchObject({ code: 'VALIDATION_ERROR', status: 400, field: 'mapping' });
315+
});
316+
292317
it('the dry-run report names each value, what it would write, and claims no row or table', async () => {
293318
const report = await run({ mapping: MAPPING });
294319
expect(formatUnitCodeBackfillReport(report)).toEqual([

‎packages/objectql/src/unit-code-backfill.ts‎

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,16 @@
5555
* sees each spelling before writing.
5656
* - An apply run counts first, read-only, and refuses before any write while a
5757
* non-blank value that is no unit code has no mapping entry, naming each one. So one
58-
* apply run converts the whole field or nothing, and a re-run writes nothing.
58+
* apply run converts the whole field or nothing, and a re-run writes nothing —
59+
* over the rows it examines. A walk the `maxRecords` cap cuts short judges
60+
* only those, as the currency backfill's does: an apply run still writes the
61+
* rows it examined, and the report says that the rows past the cap were not
62+
* judged, so any of them may hold a value with no mapping entry. A re-run
63+
* without the cap finishes, and rewrites nothing already converted.
64+
* - A mapping entry whose key a row stores as a unit code rewrites nothing
65+
* there (above). Where no row used such an entry, the report names it
66+
* (`unusedEntry` on the value), so an operator's entry never goes unused
67+
* without a word.
5968
*
6069
* The walk reads each row and tallies and tests its value here, in the
6170
* application, never in a `GROUP BY` or an anti-join on `sys_unit`: matching is
@@ -103,6 +112,12 @@ export interface UnitCodeBackfillValue {
103112
*/
104113
disposition: 'member' | 'retired' | 'other-dimension' | 'mapped' | 'unmatched';
105114
code?: string;
115+
/**
116+
* On a value stored as a unit code (`member`, `retired`, `other-dimension`)
117+
* that is also a mapping key no row used: the code that entry names, never
118+
* written, since a unit code is never rewritten.
119+
*/
120+
unusedEntry?: string;
106121
}
107122

108123
/** The counts of one organization's rows (`organizationId` null: rows that name none). */
@@ -487,6 +502,11 @@ async function walkUnitCodes(
487502
}
488503
}
489504
if (walk.truncated) report.truncated = true;
505+
// A mapping key stored as a unit code, which no row was rewritten from: named, never silently unused.
506+
const used = new Set([...values.values()].filter((v) => v.disposition === 'mapped').map((v) => v.value));
507+
for (const v of values.values()) {
508+
if (v.disposition !== 'mapped' && v.disposition !== 'unmatched' && has(v.value) && !used.has(v.value)) v.unusedEntry = mapping[v.value];
509+
}
490510
report.values = [...values.values()].sort((a, b) => (a.value < b.value ? -1 : a.value > b.value ? 1 : 0));
491511
report.organizations = [...organizations.values()].sort((a, b) =>
492512
a.organizationId === b.organizationId ? 0 : a.organizationId === null ? 1 : b.organizationId === null ? -1 : a.organizationId < b.organizationId ? -1 : 1,
@@ -573,13 +593,28 @@ export function formatUnitCodeBackfillReport(report: UnitCodeBackfillReport): st
573593
lines.push(`✗ ${report.unmatched} row(s) hold a value with no mapping entry: an apply run is refused until each value is ` +
574594
'mapped or those rows are corrected.');
575595
}
596+
const unused = new Map(report.values.filter((v) => v.unusedEntry !== undefined).map((v) => [v.value, v.unusedEntry!]));
597+
for (const [key, code] of unused) {
598+
lines.push(`⚠ The mapping entry ${JSON.stringify(key)} → ${code} was not used: the rows holding ${JSON.stringify(key)} store ` +
599+
'it as a unit code, which is never rewritten.');
600+
}
576601
if (report.failures.length > 0) {
577602
lines.push(`✗ ${report.failures.length} row(s) could not be written:`);
578603
for (const f of report.failures.slice(0, MAX_SAMPLE_IDS)) lines.push(` • ${f.recordId}: ${f.error}`);
579604
if (report.failures.length > MAX_SAMPLE_IDS) lines.push(` … and ${report.failures.length - MAX_SAMPLE_IDS} more`);
580605
lines.push('Re-running is safe: a row holding a unit code is never rewritten.');
581606
}
582-
if (report.truncated) lines.push('⚠ Walk incomplete — some rows were not examined; re-run without the cap to finish.');
607+
if (report.truncated) {
608+
lines.push('⚠ Walk incomplete — some rows were not examined; re-run without the cap to finish.');
609+
// The counts above, the unmatched check included, saw only the rows examined.
610+
lines.push(' The rows past the cap were not judged: any of them may hold a value with no mapping entry, which this run ' +
611+
(report.applied ? 'neither named nor refused, and it wrote the rows examined only.' : 'does not name, and an apply run would not refuse.'));
612+
// An unscoped run judged "one organization" from the rows it examined, as the currency backfill's report says.
613+
if (report.organizationId === null && !report.allOrganizations) {
614+
lines.push(' The organization check saw only the rows examined: rows past the cap may belong to another ' +
615+
'organization, so name the organization (one run per organization) before writing.');
616+
}
617+
}
583618
if (!report.applied && report.mapped > 0) lines.push('Dry run — no row or table was written. Re-run with --apply to convert.');
584619
return lines;
585620
}

0 commit comments

Comments
 (0)