Skip to content

fix(docs): name the target note in the geocoding prompt so Peek can't mislead - #1813

Merged
chhoumann merged 2 commits into
masterfrom
fix/longlat-script-peek-target
Sep 26, 2026
Merged

chhoumann merged 2 commits into
masterfrom
fix/longlat-script-peek-target

Conversation

@chhoumann

@chhoumann chhoumann commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Follow-up to #1810. I was wrong in #1810 when I declined Macroscope's comment on the active-note lookup by saying "the prompt is a modal, so the user can't switch notes while it's open". That isn't true. quickAddApi.inputPrompt enables Peek at note by default (allowPeek: true in src/api/promptApi.ts), and while peeking the user can open other notes.

The script already does the right thing: it captures the note that is active when the macro starts and writes to it, so opening another note to copy an address doesn't redirect the write. What was missing was letting the user see that. This PR:

  • names the target note by its vault path in the prompt header, for example 🏠 Address for Places/Home.md. After a peek the prompt still says which note gets the location, even when another folder has a note with the same name;
  • explains this on the docs page, with a link to Peek at the note, and adds a comment in the script;
  • adds a regression test in which the active note changes during the prompt. The test asserts that processFrontMatter receives the note that was active at the start, and checks the header. It fails against the fix(docs): write Map View lat,lng location without MetaEdit in geocoding example #1810 script (the header didn't name the note).

I kept "capture before the prompt" instead of Macroscope's "resolve after". Resolving after would write to whichever note the user ended up on, for example the contact note they opened to copy the address.

Proof (real Obsidian 1.13.7, throwaway vault, made-up notes)

Steps: open Places/Home.md → run Mapper → Peek at note → open Contacts/Home.md (same name, different folder) → chip Return → type Notre-Dame de Paris → Enter. Run against the final commit (433b237).

header: 🏠 Address for Places/Home.md
peeking; active=Contacts/Home.md; chip buttons=Insert selection|Return|Cancel
returned; active on submit=Contacts/Home.md

Places/Home.md →
---
location: 48.8529371,2.3500501
---
Contacts/Home.md → unchanged

After returning from the peek: Contacts/Home.md is active, and the prompt still names Places/Home.md.

Prompt "Address for Places/Home.md" shown while Contacts/Home is the active note

For reference, the #1810 result in Map View (unchanged by this PR):

Raw frontmatter location: 48.8582599,2.2945006 and its pin at the Eiffel Tower in Map View

Checks

  • pnpm run test: 447 files / 5809 tests passed.
  • pnpm run build-with-lint: passed; main.js, manifest.json and versions.json unchanged.
  • docs/: pnpm run build passed; the built page contains the new sentence and the #peek link.

Release / migration impact

Docs only. Users who re-download the script get the note name in the prompt.

Note

Show target note path in getLongLatFromAddress prompt so Peek can't mislead

  • The address prompt heading in getLongLatFromAddress.js now includes the path of the note captured when the macro starts. Front matter updates keep targeting that captured file, even if the user opens another note with Peek while the prompt is open.
  • Updates the example doc Macro_AddLocationLongLatFromAddress.md to describe the prompt behavior.
  • The test fixture in getLongLatFromAddress.test.ts now simulates an active-file switch while the prompt is open, and asserts the starting file is passed to front matter processing.

Macroscope summarized 433b237.

Summary by CodeRabbit

  • Bug Fixes
    • Address prompts now display the active note’s full path, including folders and the file extension, rather than only its name.
    • The note active when the macro starts remains the destination, even if you open another note before submitting the address.
  • Documentation
    • Updated the example prompt to show the full path for the Eiffel Tower note.

… mislead

quickAddApi.inputPrompt allows Peek by default, so users can open other
notes while the address prompt is parked. The script already writes to
the note that was active when the macro started; show that note's name
in the prompt header and document the behaviour.

Co-authored-by: Christian Bager Bach Houmann <christian@bagerbach.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T20:47:46.070802Z 614afb9 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 482c727a-3eaf-4f20-a126-5fd6ad51bcac

📥 Commits

Reviewing files that changed from the base of the PR and between 614afb9 and 433b237.

📒 Files selected for processing (3)
  • docs/public/scripts/getLongLatFromAddress.js
  • docs/src/content/docs/docs/Examples/Macro_AddLocationLongLatFromAddress.md
  • tests/examples/getLongLatFromAddress.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/src/content/docs/docs/Examples/Macro_AddLocationLongLatFromAddress.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review.


📝 Walkthrough

Walkthrough

The address prompt displays the full path of the note active when the macro starts. The example documentation and test use a note path with a folder and file extension. The test changes the active note to one with the same basename.

Changes

Address prompt and note destination

Layer / File(s) Summary
Prompt and note destination
docs/public/scripts/getLongLatFromAddress.js, tests/examples/getLongLatFromAddress.test.ts, docs/src/content/docs/docs/Examples/Macro_AddLocationLongLatFromAddress.md
The prompt displays the starting note’s full path. The test switches to another note with the same basename and checks the prompt path. The example prompt name includes the Places/ folder and .md extension.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Merge Risk: ⚪ Minimal · up to 433b2

The prompt identifies the note that will receive the update, even if another note is opened while it is displayed. No actionable merge risk is evident.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: naming the target note in the geocoding prompt to prevent misleading behavior when Peek is enabled.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit taps the path in view,
The note stays tied to where it grew.
A same-name trail appears nearby,
Yet folders tell the notes apart.
The prompt shows the starting place,
And tests confirm that path with care.

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 614afb9f0f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/public/scripts/getLongLatFromAddress.js Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Deploying quickadd with  Cloudflare Pages  Cloudflare Pages

Latest commit: 433b237
Status: ✅  Deploy successful!
Preview URL: https://cdc2bcfd.quickadd.pages.dev
Branch Preview URL: https://fix-longlat-script-peek-targ.quickadd.pages.dev

View logs

Notes in different folders can share a basename; the path keeps the
target unambiguous after a peek.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0df48-b10a-71ff-bdb9-a74681bbf152
Co-authored-by: Christian Bager Bach Houmann <christian@bagerbach.com>
@chhoumann
chhoumann merged commit 82fcd33 into master Sep 26, 2026
14 of 15 checks passed
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