Skip to content

Feat/add sync - #9

Merged
BartSte merged 16 commits into
BartSte:developfrom
lyz-code:feat/add-sync
Jul 29, 2026
Merged

BartSte merged 16 commits into
BartSte:developfrom
lyz-code:feat/add-sync

Conversation

@lyz-code

@lyz-code lyz-code commented May 27, 2026 •

Copy link
Copy Markdown

Hi @BartSte , I've been developing today the sync feature.

While i was at it i've also added some features:

  • feat: add uid property and similar method to OrgAgendaItem
  • feat: add from_path and get_item to OrgAgendaFile
  • feat: update dependencies

Corrected some bugs:

  • fix: correct day OrgRegex to work with latin locales

  • fix: set the default logger level to INFO

  • fix: avoid mutable arguments in checker

    It was polluting the state between tests

  • fix: prevent duplicate timestamps when start == end

And done other small improvements:

  • refactor: create _list method to be able to reuse it in sync
  • docs: how to run the tests
  • style: fix typos
  • style: run black on some files
  • style: remove dead code

Sorry if the accumulation of changes makes the PR difficult to read :(

Closes #3

lyz added 8 commits May 27, 2026 20:25
feat: add uid property, similar method to OrgAgendaItem

feat: add from_path, get_item, update, update_item to OrgAgendaFile

fix: correct day OrgRegex to work with latin locales

refactor: create _list method to be able to reuse it in sync

docs: how to run the tests

style: rename the argument parser args to match the subcommand

style: fix typos

style: run black on some files
refactor: sync conditionals so they are clearer

refactor: remove unused update and update_item from OrgAgendaFile

docs: update the sync usage text
fix: set the default logger level to INFO

fix: avoid mutable arguments in checker

It was polluting the state between tests

fix: prevent duplicate timestamps when start == end

style: remove dead code

style: run black on some files
refactor: parametrize dry_run tests
fix: add more debugging information when two items are flagged as different
@BartSte
BartSte changed the base branch from main to develop June 1, 2026 06:03

@BartSte BartSte left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Many thanks for your contribution. The sync feature was something I also wanted so I am very happy with this!

Codex picked up the following. Can you check if these are actually problems?

• The new sync path has functional issues: dry-run still mutates the filesystem for missing paths, and item comparison can miss removed properties. These can cause user-visible incorrect sync behavior.

Full review comments:

  • [P2] Respect dry-run before creating sync files — /home/barts/code/personal/python/khalorg/src/khalorg/commands.py:303-309
    When khalorg sync --dry-run is run with a new org_file or state_dir, these lines still create the org file, state directory, and state file before the later if not dry_run guard. That contradicts the advertised dry-run behavior and can
    leave files behind even though the user asked to only preview actions.

  • [P2] Compare properties symmetrically — /home/barts/code/personal/python/khalorg/src/khalorg/org/agenda_items.py:312-316
    When a property exists only on b, this loop never sees it, so OrgAgendaItem.compare(a, b) can return true even though b.properties has extra data. In sync this means removing a property from the org file can be treated as unchanged
    against the state item, so the removal is skipped and never pushed to khal.

Comment thread src/khalorg/commands.py
Comment thread src/khalorg/commands.py Outdated
@BartSte BartSte self-assigned this Jun 17, 2026

@BartSte BartSte left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Posted this review for codex 🤖.

Comment thread src/khalorg/org/agenda_items.py
Comment thread src/khalorg/commands.py
Comment thread src/khalorg/synchronization.py
@BartSte
BartSte merged commit ce3e8e3 into BartSte:develop Jul 29, 2026
5 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.

Idempotently sync changes between ikhal and orgmode

2 participants