Skip to content

Commit 28eca70

Browse files
adhorodyskiclaude
andcommitted
refactor: drop the comments the code already says
Keep only the lines naming a constraint the code cannot show: the extension wiping its folder, and the move emptying the shared path. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent 13ca3c5 commit 28eca70

3 files changed

Lines changed: 6 additions & 14 deletions

File tree

src/libs/telemetry/ReceiptObservability.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,6 @@ function logReceiptDropped({
178178
});
179179
}
180180

181-
/**
182-
* Records a stat failure behind checkFileExists. A locked device rejects the stat with a permission error, which is
183-
* not the same as a missing file, and both otherwise collapse into the same dropped line.
184-
*/
185181
function logReceiptStatFailed(code: string | undefined) {
186182
Log.info(`${RECEIPT_LOG_PREFIX} stat failed`, false, {
187183
event: 'statFailed',

src/pages/Share/SubmitDetailsPage.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -564,12 +564,12 @@ function SubmitDetailsPage({
564564
return;
565565
}
566566
formHasBeenSubmitted.current = true;
567-
// The share extension wipes its folder on the next share, so upload from the receipts folder instead. Adopting
568-
// here rather than at ingestion keeps abandoned shares out of a folder nothing prunes.
567+
// The share extension wipes its folder on the next share. Adopting at submit, not at ingestion, keeps cancelled
568+
// shares out of a folder nothing prunes.
569569
ReceiptStorage.adopt(currentReceiptSource, currentReceiptName)
570570
.then((durableName) => {
571571
const uri = ReceiptStorage.toLocalUri(durableName);
572-
// The draft is what a retry, the preview and the size check all re-read, and the shared path is gone once the move lands.
572+
// The shared path is empty once the move lands, and the draft is what a retry re-reads.
573573
setMoneyRequestReceipt(CONST.IOU.OPTIMISTIC_TRANSACTION_ID, uri, currentReceiptName, true, currentReceiptType);
574574
return uri;
575575
})
@@ -583,7 +583,6 @@ function SubmitDetailsPage({
583583
currentReceiptName,
584584
(file) => onSuccess(file, locationPermissionGranted),
585585
() => {
586-
// Allow retry after a file-read failure.
587586
formHasBeenSubmitted.current = false;
588587
setIsConfirming(false);
589588
},

tests/ui/SubmitDetailsPageTest.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,7 @@ describe('SubmitDetailsPage', () => {
355355
expect(jest.mocked(readFileAsync)).not.toHaveBeenCalled();
356356
});
357357

358-
// Error #12 — the share extension wipes its folder on the next share, so the receipt must be read from the
359-
// receipts folder, not from the app-group folder it was shared into.
358+
// Error #12 — the share extension wipes its folder on the next share, so the read must come from the receipts folder.
360359
it('adopts the shared file into the receipts folder and uploads from there', async () => {
361360
// Given a share whose file adopt moves into the receipts folder
362361
const durableUri = 'file:///Documents/Receipts-Upload/shared_1234.jpg';
@@ -371,8 +370,7 @@ describe('SubmitDetailsPage', () => {
371370
expect(jest.mocked(readFileAsync).mock.calls.at(0)?.[0]).toBe(durableUri);
372371
});
373372

374-
// Error #12b — a failed move must not block the submit: the shared path still works for this session,
375-
// so falling back keeps a rare failure from turning every share into a dead end.
373+
// Error #12b — a failed move must not block the submit: the shared path still works for this session.
376374
it('submits with the shared path when adopting the file fails', async () => {
377375
// Given adopt rejects
378376
const logAlertSpy = jest.spyOn(Log, 'alert').mockImplementation(() => {});
@@ -389,8 +387,7 @@ describe('SubmitDetailsPage', () => {
389387
logAlertSpy.mockRestore();
390388
});
391389

392-
// Error #12c — adopt is a move, so the shared path is empty once it lands. A retry after a read failure has to read
393-
// the durable copy, or it adopts a path that no longer exists and the advertised retry can never recover.
390+
// Error #12c — adopt is a move, so a retry after a read failure has to work off the durable copy.
394391
it('retries from the durable copy after a file-read failure', async () => {
395392
// Given a share that adopts fine but fails its first read
396393
const durableUri = 'file:///Documents/Receipts-Upload/shared_1234.jpg';

0 commit comments

Comments
 (0)