Skip to content

Prefer exact matches over partial matches in link resolution#18

Closed
Copilot wants to merge 4 commits into
mainfrom
copilot/update-file-naming-convention
Closed

Prefer exact matches over partial matches in link resolution#18
Copilot wants to merge 4 commits into
mainfrom
copilot/update-file-naming-convention

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 18, 2026

When multiple memos share similar titles (e.g., 20260117_120000_meeting.md and 20260118_150000_important-meeting.md), the link resolver could match the wrong file due to partial matching taking precedence over exact matches.

Changes

  • Link matching logic (fnl/sm/links.fnl, lua/sm/links.lua)

    • Changed find_memo_by_partial() from single-pass OR logic to two-pass matching
    • First pass: exact match (case-insensitive)
    • Second pass: partial match only if no exact match found
  • Tests (fnl/sm/links_test.fnl, lua/sm/links_test.lua)

    • Added test coverage for exact match preference
    • Added test for case-insensitive exact matching
    • Verified partial matching still works as fallback
  • Documentation (README.md)

    • Clarified that links use full filenames with timestamps
    • Updated examples: [[20260117_143052_meeting-notes]]

Behavior

;; Before: OR condition matches first partial hit
(when (or (= filename_lower name_lower)
          (filename_lower:find name_lower 1 true))
  (set result filepath))

;; After: Two-pass with exact match priority
;; Pass 1: exact match
(when (= filename_lower name_lower)
  (set result filepath))
;; Pass 2: partial match only if no exact match
(when (not result)
  (when (filename_lower:find name_lower 1 true)
    (set result filepath)))

This ensures [[20260117_120000_meeting]] matches exactly instead of returning the first partial match like important-meeting.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https fnl/sm/git_test.fnl fnl/sm/init.fnl fnl/sm/init_test.fnl fnl/sm/links.fnl fnl/sm/links_test.fnl fnl/sm/memo.fnl fnl/sm/memo_test.fnl fnl/sm/meta.fnl fnl/sm/meta_test.fnl fnl/sm/state.fnl fnl/sm/state_test.fnl (dns block)
  • fennel-lang.org
    • Triggering command: /usr/bin/wget wget -q REDACTED -O /tmp/fennel (dns block)
    • Triggering command: /usr/bin/curl curl -L -o /tmp/fennel REDACTED (dns block)
  • luarocks.org
    • Triggering command: /usr/bin/lua5.3 /usr/bin/lua5.3 /usr/bin/luarocks install --local fennel (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Linkですが、同じタイトルのファイルが作り得るのでフルパスにしてください


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 18, 2026 16:37
Co-authored-by: Cassin01 <42632201+Cassin01@users.noreply.github.com>
…timestamps

Co-authored-by: Cassin01 <42632201+Cassin01@users.noreply.github.com>
Co-authored-by: Cassin01 <42632201+Cassin01@users.noreply.github.com>
Copilot AI changed the title [WIP] Update file naming convention to include full path Prefer exact matches over partial matches in link resolution Jan 18, 2026
Copilot AI requested a review from Cassin01 January 18, 2026 16:41
@Cassin01 Cassin01 closed this Jan 19, 2026
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.

2 participants