Repository navigation
fix(#3): handle AST nodes without position metadata - #4
Conversation
Remark AST nodes generated in certain contexts (such as autolink literals within JSON arrays parsed as markdown or bracketed references) do not have position metadata attached. Attempting to access node.position.start caused a TypeError. - Guard node.position access in lib/extract-markdown-hyperlinks.js - Guard node.position access and check line presence in lib/get-disabled-lines.js - Guard position properties and provide fallback line numbers in lib/update-linkstatus-obj.js - Add unit tests for AST nodes lacking position metadata Note: Browser-based puppeteer integration tests could not run due to missing libglib-2.0.so.0 in the sandbox environment. Targeted unit tests and parser suites passed. Closes #3
|
🤖 Finished Review · ✅ Success · Started 6:44 AM UTC · Completed 7:02 AM UTC Commit: Runtime: pi · Model: google-vertex/gemini-3.8-flash → gemini-3.8-flash · Effort: high · Cost: $2.03 |
|
<!-- fullsend:risk-assessment --> DetailsTargeted bug fix by an automated bot contributor addressing AST position metadata errors with accompanying unit tests, minimal repository churn, and no protected or security-sensitive paths touched. Previous run<!-- fullsend:risk-assessment --> DetailsTargeted bug fix by an automated bot contributor addressing AST position metadata errors with accompanying unit tests, minimal repository churn, and no protected or security-sensitive paths touched. |
|
Looks good to me Earlier findings
Previous run<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6ImNvZGUtb3JnYW5pemF0aW9uIiwiZmlsZSI6InRlc3QvZXh0cmFjdC1tYXJrZG93bi1oeXBlcmxpbmtzLnRlc3QuanMiLCJpZCI6ImZfYmNiYTM3ODIzZjhjYTc1OSIsImxpbmUiOjQyLCJhY3Rpb25hYmxlIjp0cnVlLCJkaW1lbnNpb24iOiJzdHlsZS1jb252ZW50aW9ucyJ9XX0= --> ReviewFindingsMedium / Low / Info
Next steps:
|
|
🤖 Finished Fix · ✅ Success · Started 7:03 AM UTC · Completed 7:10 AM UTC Commit: Runtime: pi · Model: google-vertex/gemini-3.8-flash → gemini-3.8-flash · Effort: high · Cost: $0.41 |
Separate unit tests from test/extract-markdown-hyperlinks.test.js into dedicated test files test/get-disabled-lines.test.js and test/update-linkstatus-obj.test.js to match module structure. Addresses #4
🔧 Fix agent — iteration 1 (bot-triggered)Extracted unit tests for getDisabledLines and updateLinkStatusObj from test/extract-markdown-hyperlinks.test.js into separate test files test/get-disabled-lines.test.js and test/update-linkstatus-obj.test.js, adhering to repository conventions and improving test discoverability. Fixed (1):
Tests: passed Conflict update: skipped; strategy Decision points
Next steps:
|
|
🤖 Finished Review · ✅ Success · Started 7:11 AM UTC · Completed 7:23 AM UTC Commit: Runtime: pi · Model: google-vertex/gemini-3.8-flash → gemini-3.8-flash · Effort: high · Cost: $1.16 |
Superseded by updated review
|
🤖 Finished Retro · ✅ Success · Started 9:51 PM UTC · Completed 10:11 PM UTC Commit: Runtime: pi · Model: google-vertex/gemini-3.8-flash → gemini-3.8-flash · Effort: high · Cost: $2.12 |
Retrospective Analysis: PR #4 (
|
Description
This PR fixes a
TypeError: Cannot read properties of undefined (reading 'start')when parsing markdown or JSON files containing links whose AST nodes do not havepositionmetadata (such as autolink literals generated by remark-gfm within bracketed references or JSON arrays).Changes:
lib/extract-markdown-hyperlinks.js, guardnode.position?.start?.linebefore checking if the line is disabled.lib/get-disabled-lines.js, guardnode.position?.start?.linein html AST visitor and handle null/undefined line values inisDisabled.lib/update-linkstatus-obj.js, safely handle missingpositionorstartproperties and provide a default line number (1) when assigning fallback position objects.test/extract-markdown-hyperlinks.test.jscovering nodes without position metadata across extraction, disabled line checking, and link status updating.Type of Change
Checklist:
Additional Information
Targeted unit tests and parser test suites pass locally. Full browser-based puppeteer tests could not run in the sandbox container due to missing system libraries (
libglib-2.0.so.0).Closes #3
Post-script verification
agent/3-fix-undefined-position)4fe27f46189ac9242ce3ecbe05cb5e54a47240c7..HEAD)