Skip to content

id(note_links): check_note_link_op refusal messages state the opposite of the failed condition — empty surface 'is not empty', non-NFC surface 'is NFC' #4372

Closed

Description

@dezren39

Problem

Two of the three field-error messages in check_note_link_op state the opposite of the condition that produced them. A peer (or operator) whose note.link event is refused is told the surface satisfies the very rule it broke.

Evidence (main @ 9f472b4, read this run)

pkgs/id/src/note_links.rs:97-115:

  • Line 100: when surface.is_empty() is true, the error is "a link's authored surface is not empty" — the surface is empty; the message asserts it is not.
  • Line 111: when !is_nfc(surface) is true, the error is "a link's authored surface is NFC" — the surface is not NFC; the message asserts it is.
  • The third message in the same function (line 104-107, over-long surface: "is {} bytes, it may be at most {MAX_SURFACE_BYTES}") is factual, which makes the other two read as copy slips, not a style.

House style in the sibling validator states the fact: pkgs/id/src/tag_claims.rs check_text returns "the {field} is not NFC" for the same condition, and pkgs/id/src/idset.rs check_scope returns "the scope is not NFC".

These errors are not local-only: check_note_link_op is called on the chain receipt path (pkgs/id/src/chain.rs:307), so the inverted text is what a refused event's sender/operator sees in logs and error propagation.

Why it matters

Refusal reasons are the debugging surface for a signed-event protocol: a sender told their surface "is not empty" when it is empty (or "is NFC" when it is not) will fix the wrong thing or conclude the receiver is broken. The values are also pinned by no test — test_check_rejects_a_bad_surface_and_a_wrong_kind (note_links.rs tests) matches only Err(NoteLinkError::Field(_)), so the inversion survived review.

Acceptance criteria

  • The empty-surface error states the surface is empty (e.g. "a link's authored surface is empty" / "must not be empty" phrased as a fact about the input).
  • The non-NFC error states the surface is not NFC, matching the tag_claims/idset phrasing.
  • A test pins the message text (or at least the distinguishing wording) for both cases, not just the Field(_) variant.
  • No behavior change: the same inputs are accepted/refused as before.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/lowNice to have; do when convenient
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    effort/xsTrivial: expected under 30 minutes of work
    on Nov 2, 2026
  2. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator (new-issue-creator-code-b)
    • Session / ID: new-issue-creator-code-b run 2026-11-02 07:20 CST
    • Found via: filed this run
    • Task: check_note_link_op's empty-surface and non-NFC refusal messages state the opposite of the failed condition; fix the text and pin it with a test
    • Expectation: effort/xs — error-text correction only, no accept/refuse behavior change; done when both messages state the fact and a test pins the wording
    • Links: pkgs/id/src/note_links.rs:97-115; receipt call site pkgs/id/src/chain.rs:307
  3. added
    work/assignedQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    and removed on Nov 2, 2026
  4. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · state: picked up

  5. 2 remaining items

  6. added
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    and removed
    queue/claimedQueue worker lifecycle state
    work/assignedQueue worker lifecycle state
    on Nov 2, 2026
  7. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: picked_up
    task: 6245 (repo-health-code-pilot, repo-worker-code, lane code-h)
    state: claimed fix #4372; fresh revalidation: issue #4372 OPEN, no hard-stop labels, no existing PR or branch for this fix. Execution lane: direct.
    next: laptop worktree on branch queue/6245-4372-note-links-messages; correct the two inverted refusal messages in pkgs/id/src/note_links.rs and add message-text tests.

  8. added a commit that references this issue on Nov 2, 2026
  9. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    agent-note:v1
    event: done
    task: 6245 (repo-health-code-pilot, repo-worker-code, lane code-h)
    state: fixed_merged. PR #4500 MERGED at 2026-11-02T17:53:46Z, merge commit 87dddae; issue auto-closed by the merge. Messages corrected: empty surface now reads "a link's authored surface is empty", non-NFC now reads "a link's authored surface is not NFC"; new test test_check_names_the_surface_fault_in_its_message pins both texts. Codex review on the PR head: no findings.
    tests: verbatim-slice probe crate on the laptop (check_note_link_op + its types extracted byte-for-byte from the edited file) — cargo test 2/2 pass, including behavior-unchanged cases. Full id lib remains blocked on main by issue #4454, unrelated to this module.
    next: none for task 6245.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/idPackage/app: id (pkgs/ or apps/ in this repo)effort/xsTrivial: expected under 30 minutes of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/lowNice to have; do when convenientsource/creatorFiled by the new-issue-creator jobtask/triageQueue packet kind: verify, reproduce, and route this item

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions