Skip to content

chore: sync main hotfixes into develop before 3.6.0 - #2021

Closed
igorls wants to merge 5 commits into
developfrom
main
Closed

igorls wants to merge 5 commits into
developfrom
main

Conversation

@igorls

@igorls igorls commented Jul 15, 2026

Copy link
Copy Markdown
Member

Sync main hotfixes back into develop

The 3.6.0 promotion PR #2020 is currently behind main because two post-v3.5.0 hotfixes landed directly on the release branch and were never merged back:

This PR carries those two changes into develop before the 3.6.0 promotion. Its effective diff is limited to mempalace/cli.py and mempalace/layers.py.

Release flow

  1. Merge this sync PR into develop.
  2. Let Release v3.6.0 — promote develop to main #2020 refresh and pass CI at the updated develop head.
  3. Merge Release v3.6.0 — promote develop to main #2020 into main.
  4. Create GitHub Release/tag v3.6.0, then approve the gated PyPI publish.

milla-jovovich and others added 5 commits June 6, 2026 01:43
Release v3.4.0 — promote develop to main
Release v3.4.1 — promote develop to main
Release v3.5.0 — promote develop to main
…ments (#1630)

L1's generate() scored drawers by importance/emotional_weight/weight, and
the docstring promised "prefer high importance, recent filing". But no
ingest path (miner, convo_miner, diary, add_drawer) writes any of those
fields, so the sort collapsed to insertion order (oldest first) and
recency was never consulted. A scoped `wake-up --wing X` therefore
surfaced the *oldest* moments: the opposite of useful.

Add filed_at (present on every drawer, ISO-8601, lexically chronological)
as the secondary sort key. Importance stays primary for the day a scoring
pass populates it; filed_at is the effective signal today, making the
"recent filing" half of the promise true with data already present.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Igor Lins e Silva <4753812+igorls@users.noreply.github.com>
On Windows, Path.read_text() and open(path, 'a') use locale encoding
(GBK on Chinese-locale systems) before PEP 686 / Python 3.15. A valid
UTF-8 .gitignore with non-ASCII comments crashes
_ensure_mempalace_files_gitignored() with UnicodeDecodeError, which
aborts 'mempalace init' on Windows for any user whose .gitignore
contains non-ASCII text.

Force encoding='utf-8' on both read and append, with errors='replace'
on read as a defensive fallback for legacy mixed-encoding files.

Co-authored-by: ALaDingAhmad <16530935@qq.com>
Co-authored-by: Igor Lins e Silva <4753812+igorls@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 15, 2026 00:31
@igorls
igorls requested a review from milla-jovovich as a code owner July 15, 2026 00:31
@igorls igorls closed this Jul 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR syncs two post-v3.5.0 hotfixes from main back into develop to keep develop aligned ahead of the 3.6.0 promotion flow. It targets two user-facing reliability/UX issues: Windows .gitignore encoding handling during mempalace init, and L1 wake-up ordering so the most recently filed moments surface first.

Changes:

  • Force UTF-8 (with defensive decode fallback) when reading .gitignore, and UTF-8 when appending, to prevent Windows locale decode crashes in mempalace init.
  • Update L1 scoring/sorting to use filed_at as a recency tie-breaker (after importance) so L1 surfaces newest-first when importance is absent/tied.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
mempalace/cli.py Pins .gitignore read/append encoding to UTF-8 to avoid Windows UnicodeDecodeError during init.
mempalace/layers.py Adjusts L1 scoring/sort to prefer newer filed_at when importance ties, aligning output with “recent filing” behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread mempalace/layers.py
Comment on lines +153 to +161
# filed_at is an ISO-8601 string; ISO strings sort lexicographically
# in chronological order. Coerce to str so a missing/odd value sorts
# oldest rather than raising during the comparison.
recency = str(meta.get("filed_at") or "")
scored.append((importance, recency, meta, doc))

# Sort by importance desc, then recency (filed_at) desc; take top N.
scored.sort(key=lambda x: (x[0], x[1]), reverse=True)
top = [(imp, meta, doc) for imp, _recency, meta, doc in scored[: self.MAX_DRAWERS]]
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.

5 participants