Skip to content

Log id for dnp#326

Merged
mdroidian merged 3 commits intomainfrom
log-id-for-dnp
Feb 18, 2026
Merged

Log id for dnp#326
mdroidian merged 3 commits intomainfrom
log-id-for-dnp

Conversation

@mdroidian
Copy link
Collaborator

@mdroidian mdroidian commented Feb 18, 2026

Requested by Ivo in slack


Open with Devin

Summary by CodeRabbit

  • Refactor

    • Simplified the logic for handling date conditions, improving efficiency by removing complex pattern-matching steps.
  • Tests

    • Added test coverage for condition processing logic to validate correct behavior.

- Changed the arguments in the getTitleDatalog function to replace title-related constants with log-related constants.
- Updated variable names to reflect the new log ID context.
@coderabbitai
Copy link

coderabbitai bot commented Feb 18, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR modifies conditionToDatalog.ts to simplify date-pattern handling by removing regex-based title matching using DAILY_NOTE_PAGE_TITLE_REGEX. The change eliminates the date-regex binding and re-find validation logic, replacing them with a single data-pattern entry that binds a log ID variable. A new test file (tests/conditionToDatalog.test.ts) is added to validate that a "has title" clause correctly transforms into a data-pattern with specific arguments: a variable, the constant :log/id, and a derived variable name.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Log id for dnp' accurately summarizes the main change: replacing title-based logic with log ID binding for daily note pages.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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

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

@mdroidian
Copy link
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link

coderabbitai bot commented Feb 18, 2026

✅ Actions performed

Full review triggered.

Copy link

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/utils/conditionToDatalog.ts (2)

60-70: 🧹 Nitpick | 🔵 Trivial

Core logic change looks correct; variable naming is inconsistent with file conventions.

The :log/id approach is a cleaner way to identify daily note pages in Roam's Datalog schema compared to the previous regex-based title matching. However, the variable name ${source}-log-id uses lowercase kebab-case, while the rest of the file consistently uses PascalCase suffixes (e.g., ${source}-Title, ${source}-Log, ${source}-CreateTime). Note that :log/id variables elsewhere in this file (lines 737, 795) use -Log as the suffix.

Proposed fix for naming consistency
             { type: "variable", value: source },
             { type: "constant", value: ":log/id" },
-            { type: "variable", value: `${source}-log-id` },
+            { type: "variable", value: `${source}-Log` },

Also update the test expectation accordingly:

{ type: "variable", value: "node-Log" },
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/conditionToDatalog.ts` around lines 60 - 70, The data-pattern
branch returns a variable named `${source}-log-id` which breaks the file's
PascalCase suffix convention; update the variable name to `${source}-Log` in the
returned object inside conditionToDatalog (the block that currently creates the
data-pattern with constant ":log/id") and update any corresponding tests to
expect "node-Log" (or `${source}-Log`) instead of "node-log-id". Ensure the
change is applied where this pattern is built so it matches other occurrences
like the variable names used on lines referencing `-Log` elsewhere in this
module.

1-1: ⚠️ Potential issue | 🟡 Minor

Remove unused import of DAILY_NOTE_PAGE_TITLE_REGEX.

This import is no longer referenced after the {date} branch was changed to use :log/id directly instead of regex-based daily note page title matching.

Fix
-import { DAILY_NOTE_PAGE_TITLE_REGEX } from "roamjs-components/date/constants";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/utils/conditionToDatalog.ts` at line 1, The import
DAILY_NOTE_PAGE_TITLE_REGEX is unused in conditionToDatalog.ts; remove the named
import from the import statement (delete DAILY_NOTE_PAGE_TITLE_REGEX) so the
file no longer imports an unused symbol, and run the linter/format step to
ensure no leftover references remain; search for DAILY_NOTE_PAGE_TITLE_REGEX in
this module to confirm it's not used anywhere before removing.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@src/utils/conditionToDatalog.ts`:
- Around line 60-70: The data-pattern branch returns a variable named
`${source}-log-id` which breaks the file's PascalCase suffix convention; update
the variable name to `${source}-Log` in the returned object inside
conditionToDatalog (the block that currently creates the data-pattern with
constant ":log/id") and update any corresponding tests to expect "node-Log" (or
`${source}-Log`) instead of "node-log-id". Ensure the change is applied where
this pattern is built so it matches other occurrences like the variable names
used on lines referencing `-Log` elsewhere in this module.
- Line 1: The import DAILY_NOTE_PAGE_TITLE_REGEX is unused in
conditionToDatalog.ts; remove the named import from the import statement (delete
DAILY_NOTE_PAGE_TITLE_REGEX) so the file no longer imports an unused symbol, and
run the linter/format step to ensure no leftover references remain; search for
DAILY_NOTE_PAGE_TITLE_REGEX in this module to confirm it's not used anywhere
before removing.

@mdroidian mdroidian merged commit a68d3a8 into main Feb 18, 2026
2 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.

1 participant