Skip to content

finances: just use pdf text, instead of text, lines, hash#16

Merged
denversc merged 2 commits into
mainfrom
unify2
Jun 23, 2026
Merged

finances: just use pdf text, instead of text, lines, hash#16
denversc merged 2 commits into
mainfrom
unify2

Conversation

@denversc

Copy link
Copy Markdown
Owner

No description provided.

@denversc
denversc merged commit c70eccf into main Jun 23, 2026
3 checks passed
@denversc
denversc deleted the unify2 branch June 23, 2026 04:29

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the PDF parsing and identification pipeline by passing the raw PDF text string directly instead of using intermediate structures like DocumentSource or ReadPdfResult. This simplifies document parsers and utility functions across the codebase. However, two issues were identified: first, RegExp.escape is used in questrade.ts but is not a standard JavaScript/TypeScript feature, which will cause runtime errors; second, an error message in calculate_file_names.ts still references the old fileNameByHash and info.hash variables and should be updated to reflect the refactoring.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +52 to +55
const lineRegex = RegExp(
"\\s" + RegExp.escape(this.#identifyingLine) + "\\s",
"i",
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

RegExp.escape is not a standard JavaScript/TypeScript function (it is currently a Stage 3 ECMAScript proposal and not supported natively in standard environments). Using it will cause a runtime TypeError and a TypeScript compilation error. You should escape the special characters in this.#identifyingLine using a helper function or a simple regex replacement.

Suggested change
const lineRegex = RegExp(
"\\s" + RegExp.escape(this.#identifyingLine) + "\\s",
"i",
);
const escapedLine = this.#identifyingLine.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
const lineRegex = RegExp(
"\\s" + escapedLine + "\\s",
"i",
);


for (const info of infoList) {
const newFileName = fileNameByHash.get(info.hash);
const newFileName = fileNameByPdf.get(info.pdf);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The error message thrown on the subsequent lines (lines 122-123) still references fileNameByHash.get(info.hash). Since fileNameByHash and info.hash have been replaced by fileNameByPdf and info.pdf, please update the error message string to avoid confusion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant