Skip to content
This repository was archived by the owner on Nov 16, 2026. It is now read-only.

fix(#3): handle AST nodes without position metadata - #4

Merged
gaurav-nelson merged 2 commits into
mainfrom
agent/3-fix-undefined-position
Nov 13, 2026
Merged

gaurav-nelson merged 2 commits into
mainfrom
agent/3-fix-undefined-position

Conversation

@fullsend-ai-coder

Copy link
Copy Markdown
Contributor

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 have position metadata (such as autolink literals generated by remark-gfm within bracketed references or JSON arrays).

Changes:

  • In lib/extract-markdown-hyperlinks.js, guard node.position?.start?.line before checking if the line is disabled.
  • In lib/get-disabled-lines.js, guard node.position?.start?.line in html AST visitor and handle null/undefined line values in isDisabled.
  • In lib/update-linkstatus-obj.js, safely handle missing position or start properties and provide a default line number (1) when assigning fallback position objects.
  • Added unit tests in test/extract-markdown-hyperlinks.test.js covering nodes without position metadata across extraction, disabled line checking, and link status updating.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

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

  • Branch is not main/master (agent/3-fix-undefined-position)
  • Secret scan passed (gitleaks — 4fe27f46189ac9242ce3ecbe05cb5e54a47240c7..HEAD)
  • PR body secret scan passed (gitleaks — no-git)
  • Final PR description secret scan passed (gitleaks — no-git)

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
@fullsend-ai-coder fullsend-ai-coder Bot added the ready-for-review Triggers review agent dispatch label Nov 13, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 6:44 AM UTC · Completed 7:02 AM UTC

Commit: b5f07fc · View workflow run →

Runtime: pi · Model: google-vertex/gemini-3.8-flash → gemini-3.8-flash · Effort: high · Cost: $2.03

@fullsend-ai-review fullsend-ai-review Bot added the risk/low PR risk: low label Nov 13, 2026
@fullsend-ai-review

fullsend-ai-review Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

<!-- fullsend:risk-assessment -->
Risk Assessment: low (1/5)

Details

Targeted 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 -->
Risk Assessment: low (1/5)

Details

Targeted 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.

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Looks good to me

Earlier findings

  • test/extract-markdown-hyperlinks.test.js:42 [code-organization]: resolved by change — tests separated into dedicated test suites matching module structure
Previous run

<!-- fullsend:review-findings-v2:eyJ2ZXJzaW9uIjoyLCJhY3Rpb24iOiJyZXF1ZXN0LWNoYW5nZXMiLCJmaW5kaW5ncyI6W3sic2V2ZXJpdHkiOiJsb3ciLCJjYXRlZ29yeSI6ImNvZGUtb3JnYW5pemF0aW9uIiwiZmlsZSI6InRlc3QvZXh0cmFjdC1tYXJrZG93bi1oeXBlcmxpbmtzLnRlc3QuanMiLCJpZCI6ImZfYmNiYTM3ODIzZjhjYTc1OSIsImxpbmUiOjQyLCJhY3Rpb25hYmxlIjp0cnVlLCJkaW1lbnNpb24iOiJzdHlsZS1jb252ZW50aW9ucyJ9XX0= -->

Review

Findings

Medium / Low / Info

  • [code-organization] test/extract-markdown-hyperlinks.test.js:42 — The test file 'test/extract-markdown-hyperlinks.test.js' bundles unit tests for three distinct library modules: 'lib/extract-markdown-hyperlinks.js', 'lib/get-disabled-lines.js' (starting at line 42), and 'lib/update-linkstatus-obj.js' (starting at line 62). In this codebase, tests are organized modularly corresponding to the module or feature under test (for example, 'validate-rdjson.test.js' specifically testing 'lib/validate-rdjson.js'). Bundling tests for multiple distinct modules into a file named after only one of them hinders test discoverability and deviates from repository organization conventions.
    Remediation: Extract the test suites for 'getDisabledLines' and 'updateLinkStatusObj' into separate test files corresponding to their respective modules (e.g., 'test/get-disabled-lines.test.js' and 'test/update-linkstatus-obj.test.js'), keeping 'test/extract-markdown-hyperlinks.test.js' focused solely on 'lib/extract-markdown-hyperlinks.js'.

Next steps:

  • /fs-fix — agent addresses review findings automatically
  • /fs-fix <your instruction> — agent fixes with your specific guidance
  • Push commits directly — review re-runs automatically on push
  • /fs-fix-stop — disable automatic fix runs for this PR

fullsend-ai-review[bot]

This comment was marked as outdated.

@fullsend-ai-coder

fullsend-ai-coder Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 Finished Fix · ✅ Success · Started 7:03 AM UTC · Completed 7:10 AM UTC

Commit: b5f07fc · View workflow run →

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
@fullsend-ai-coder

Copy link
Copy Markdown
Contributor Author

🔧 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):

  1. Separate unit tests for getDisabledLines and updateLinkStatusObj into dedicated test files (test/extract-markdown-hyperlinks.test.js): Extracted unit tests for getDisabledLines and updateLinkStatusObj out of test/extract-markdown-hyperlinks.test.js into test/get-disabled-lines.test.js and test/update-linkstatus-obj.test.js to adhere to modular test organization conventions.

Tests: passed

Conflict update: skipped; strategy none; forge MERGEABLE; target main@4fe27f46189ac9242ce3ecbe05cb5e54a47240c7

Decision points
  • Modularize unit tests into dedicated files per module (alternatives: Keep all unit tests in test/extract-markdown-hyperlinks.test.js, Extract test suites into test/get-disabled-lines.test.js and test/update-linkstatus-obj.test.js; rationale: Follows the repository's convention of dedicating test files to individual library modules and improves test discoverability.)

Next steps:

  • /fs-review — request a re-review of the changes
  • /fs-fix <your instruction> — run another fix pass with specific guidance
  • Push commits directly — review re-runs automatically on push
    Updated by fullsend fix agent

@fullsend-ai-review

fullsend-ai-review Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🤖 Finished Review · ✅ Success · Started 7:11 AM UTC · Completed 7:23 AM UTC

Commit: ac88d36 · View workflow run →

Runtime: pi · Model: google-vertex/gemini-3.8-flash → gemini-3.8-flash · Effort: high · Cost: $1.16

@fullsend-ai-review
fullsend-ai-review Bot dismissed their stale review November 13, 2026 07:23

Superseded by updated review

@fullsend-ai-review fullsend-ai-review Bot added the ready-for-merge All reviewers approved — ready to merge label Nov 13, 2026
@gaurav-nelson
gaurav-nelson merged commit 0cc9c5d into main Nov 13, 2026
30 checks passed
@fullsend-ai-retro

fullsend-ai-retro Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

🤖 Finished Retro · ✅ Success · Started 9:51 PM UTC · Completed 10:11 PM UTC

Commit: ac88d36 · View workflow run →

Runtime: pi · Model: google-vertex/gemini-3.8-flash → gemini-3.8-flash · Effort: high · Cost: $2.12

@fullsend-ai-retro

Copy link
Copy Markdown

Retrospective Analysis: PR #4 (fix(#3): handle AST nodes without position metadata)

Overview

This retrospective analyzed the end-to-end agent workflow for PR #4, which resolved Issue #3 ([BUG] Cannot read properties of undefined (reading 'start')) in ADLC-Day-Of-Learning/linkspector. The pull request was authored by fullsend-ai-coder[bot] and merged by maintainer Gaurav Nelson (gaurav-nelson).

The workflow ran on fullsend per-repo installation mode using workflow definition .github/workflows/fullsend.yaml (reusable workflow fullsend-ai/fullsend/.github/workflows/reusable-dispatch.yml@v0.54.0). Agent artifacts and skills were resolved from fullsend-ai/agents@v0.54.0 (commit 87a43fcb8495).


Workflow Graph & Timeline

  1. Triage (Run 43377285265) — Completed in 9m 0s (Success)

    • Analyzed Issue [BUG] Cannot read properties of undefined (reading 'start') #3 and accurately identified that Remark AST link nodes generated from unclosed bracketed links or autolink literals in JSON arrays lack .position metadata, causing TypeError: Cannot read properties of undefined (reading 'start') at lib/extract-markdown-hyperlinks.js:32.
    • Outlined optional chaining and fallback line handling recommendations; applied label ready-to-code.
  2. Code Implementation (Run 43378309925) — Completed in 20m 32s (Success, 111 turns, $1.15)

    • Reproduced the crash with node -e one-liners using remark-gfm and unified.
    • Implemented defensive optional chaining across lib/extract-markdown-hyperlinks.js and lib/get-disabled-lines.js, and added fallback line handling in lib/update-linkstatus-obj.js.
    • Sandbox environment obstacles:
      • The sandbox environment had no pre-installed dependencies (node_modules), resolved via npm ci.
      • npx puppeteer browsers install chrome failed because unzip was missing from the container image. The agent spent multiple turns diagnosing and constructing a custom Python zip extractor polyfill at /sandbox/.venv/bin/unzip.
      • Even after extracting Chrome, browser-based Puppeteer fixture tests failed due to missing shared OS libraries (libglib-2.0.so.0).
      • The agent created targeted unit tests in test/extract-markdown-hyperlinks.test.js covering all three modified modules and noted the Puppeteer environment limitation in commit b5f07fc and the PR body.
  3. Review Iteration 1 (Run 43380664836) — Completed in 19m 37s (Success, 74 turns, $2.03)

    • Evaluated risk as low (1/5) and verified functional correctness across all AST position guards.
    • Raised finding f_bcba37823f8ca759 (severity: low, category: code-organization): test/extract-markdown-hyperlinks.test.js bundled unit tests for three distinct library modules (extractMarkdownHyperlinks, getDisabledLines, and updateLinkStatusObj), requesting they be separated into individual test files matching module names.
    • Because the finding was marked actionable: true with a concrete remediation, the review orchestrator issued request-changes, triggering the automated fix loop.
  4. Fix Iteration 1 (Run 43382896546) — Completed in 8m 05s (Success, 69 turns, $0.41)

    • Parsed finding f_bcba37823f8ca759, installed dependencies (npm ci), and cleanly separated tests into test/extract-markdown-hyperlinks.test.js, test/get-disabled-lines.test.js, and test/update-linkstatus-obj.test.js.
    • Verified that all unit tests passed and committed the change as ac88d36.
  5. Review Iteration 2 (Run 43383864313) — Completed in 12m 56s (Success, 58 turns, $1.16)

    • Verified incremental diff, confirmed prior finding was resolved_by_change, reported 0 new findings, approved the PR, and added label ready-for-merge.
  6. Human Merge


Evaluation Across Optimization Lenses

  1. Review Quality: High. The review agent correctly confirmed correctness while enforcing modular test organization. While the finding was classified as low severity, routing actionable low-severity findings to request-changes successfully engaged the automated fix loop to improve code organization. Review subagents were unable to execute dynamic test commands because the review sandbox does not pre-install node_modules and policy denies package registry network egress; static analysis proved sufficient in this instance.
  2. Rework Rate: 1 rework cycle. The rework was caused by the code agent bundling unit tests for three distinct modules into a single test file. The code agent had no existing lib/ unit tests to model after (the repository only had integration fixtures in test/fixtures/), and skills/code-implementation/SKILL.md lacked guidance on modular test file organization when modifying multiple modules.
  3. Token Cost & Latency: Total workflow cost was $4.75 across ~61 minutes of agent runtime (Code: $1.15 / 20m; Review 1: $2.03 / 19m; Fix: $0.41 / 8m; Review 2: $1.16 / 13m). The fix and re-review loop accounted for $1.57 (33%) and 21 minutes (34%) of the pipeline overhead.
  4. Autonomy Readiness: The maintainer merged PR fix(#3): handle AST nodes without position metadata #4 without comments. Under the autonomy-readiness framework, silent approvals are classified as inconclusive rather than evidence of agent parity or superiority. The absence of human commentary means review deltas cannot be meaningfully computed for this PR; no autonomy-increasing changes are warranted based on this single data point.

Proposed Improvements

  1. Platform Tooling (fullsend-ai/fullsend): Add unzip package to the base sandbox container image (images/sandbox/Containerfile) so that agents in Node.js/JavaScript repositories can run standard archive extraction tooling (such as Puppeteer browser installers) without failing or wasting turns constructing custom polyfills.
  2. Agent Layer (fullsend-ai/agents): In skills/code-implementation/SKILL.md, instruct code agents creating new unit tests to structure them modularly (dedicated test files corresponding 1:1 with affected modules) rather than bundling multiple distinct library modules into a single test file, avoiding avoidable code-organization change requests and rework loops.

Proposals filed

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

Labels

ready-for-merge All reviewers approved — ready to merge ready-for-review Triggers review agent dispatch risk/low PR risk: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Cannot read properties of undefined (reading 'start')

1 participant