fix(SUP-3404): make journal backlinks Obsidian-owned - #97
Conversation
|
@codex review |
|
✅ Action performedReview finished.
|
📝 WalkthroughWalkthrough
ChangesJournal mutation flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant linkNoteToJournal
participant mutateJournalThroughObsidian
participant ObsidianCLI
participant DeferredBacklinks
Caller->>linkNoteToJournal: request journal backlink
linkNoteToJournal->>linkNoteToJournal: normalize section and inspect content
linkNoteToJournal->>mutateJournalThroughObsidian: update today's journal
mutateJournalThroughObsidian->>ObsidianCLI: run vault eval mutation
ObsidianCLI-->>mutateJournalThroughObsidian: return mutation result
mutateJournalThroughObsidian-->>linkNoteToJournal: verify committed backlink
linkNoteToJournal-->>Caller: return link result
linkNoteToJournal->>DeferredBacklinks: record failed backlink on error
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 600bdfd75b
ℹ️ 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".
|
@codex review |
|
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@modules/jarvos-secondbrain/bridge/provenance/src/link-to-journal.js`:
- Around line 50-60: Update readJsonSafe to use the fallback only for ENOENT
errors and propagate malformed JSON or other read failures; make
deferred-backlink read-modify-write operations serialized to prevent overlapping
updates; update writeJson to write through a same-directory temporary file and
atomically rename it into place, preserving existing corrupt state and queued
recovery entries.
- Around line 229-232: Update the missing-journal handling around the visible
existsSync/ensureJournalFile flow so active journals are created through the
Obsidian-owned transaction or mutation path instead of an external whole-file
write. Preserve the createIfMissing behavior and add a regression test covering
concurrent journal creation without overwriting content created between the
existence check and mutation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f42e1124-5eee-4698-8e5b-cdc0a1eb37c9
📒 Files selected for processing (3)
modules/jarvos-secondbrain/bridge/provenance/src/link-to-journal.jsmodules/jarvos-secondbrain/tests/link-to-journal.test.jsmodules/jarvos-secondbrain/tests/personality-note-journal-contract.test.js
|
The active-journal creation finding is also fixed at Verification: focused 13/13; full secondbrain 195/195; @codex review |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
git fetch origin pull/97/head:pr97 2>&1 | tail -5
git checkout pr97 2>&1 | tail -5
git log --oneline -10
echo "---"
git show 46a8348 --stat 2>&1 | head -30Length of output: 1430 🏁 Script executed: #!/bin/bash
set -euo pipefail
git show 46a8348 -- modules/jarvos-secondbrain/bridge/provenance/src/link-to-journal.jsLength of output: 11438 🏁 Script executed: #!/bin/bash
set -euo pipefail
git show 46a8348 -- modules/jarvos-secondbrain/tests/link-to-journal.test.jsLength of output: 4148 🏁 Script executed: #!/bin/bash
set -euo pipefail
sed -n '1,400p' modules/jarvos-secondbrain/bridge/provenance/src/link-to-journal.jsLength of output: 14502
I don't see any correctness issues in this diff — the fix and its test coverage line up well with the stated finding. Nice work closing this race condition. ᕦ(ò_óˇ)ᕤ ✅ Action performedReview finished.
|
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
Vault.process, preserving editor/mobile changes that arrive immediately before the mutation.eval, verifies the link exists on disk, and fails visibly with a recovery record when Obsidian cannot commit.Verification
node --test modules/jarvos-secondbrain/tests/link-to-journal.test.js(13/13)@jarvos/secondbrainsuite (195/195)git diff --checkVault v3andapp.vault.processavailability in the deployed environment.Related