Skip to content

Null comment coordinates become a line-zero selection #51319

Closed as not planned
Closed as not planned

Description

@sdivyanshu90

Description

Comment metadata parsing converts selection fields with Number(...). JavaScript converts null to 0, so malformed metadata containing null coordinates passes the finite-number check and becomes a real {0, 0, 0, 0} selection. This can restore a review comment at line zero instead of treating its invalid selection as absent. Selection coordinates should be accepted only when all four fields are finite numbers.

Plugins

None

OpenCode version

1.18.30

Steps to reproduce

  1. Read comment metadata containing a valid path and comment.
  2. Set startLine, startChar, endLine, and endChar in its selection to null.
  3. Observe the parsed comment metadata.

Expected: the comment is retained with no selection.

Actual: the parser returns a line-zero selection with all four coordinates set to 0.

Screenshot and/or share link

Not applicable; the metadata parser call above reproduces the issue directly.

Operating System

All

Terminal

All

Activity

  1. Serenity-2026 commented on Sep 27, 2026

    @Serenity-2026

    I'd like to take this one. The parser in packages/app/src/utils/comment-note.ts coerces selection fields with Number(...), so null becomes 0 and passes the finite check, restoring a real {0,0,0,0} selection. I'll require all four coordinates to be finite numbers, keep the comment without a selection otherwise, and add a regression test. Please assign if this scope looks right.

  2. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions