Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
497 commits
Select commit Hold shift + click to select a range
10ae74d
wip: type project index job request handoff
phernandez Jun 20, 2026
ba4bfad
wip: type indexing job request handoffs
phernandez Jun 20, 2026
aff3e2f
wip: type note file job request handoffs
phernandez Jun 20, 2026
11a2962
wip: add runtime job payload enqueue helper
phernandez Jun 20, 2026
847f029
wip: keep accepted note enqueue payloads typed
phernandez Jun 20, 2026
1498f2a
wip: add accepted note mutation runner
phernandez Jun 20, 2026
5b47720
wip: export accepted note mutation contracts
phernandez Jun 20, 2026
073d790
wip: add event indexing orchestration package
phernandez Jun 20, 2026
0e8f07d
wip: add local filesystem storage event adapter
phernandez Jun 20, 2026
5971265
wip: add opt-in watcher event index path
phernandez Jun 20, 2026
38dc020
wip: add inline storage event processor
phernandez Jun 20, 2026
c76a66e
wip: add concrete local event index runtime
phernandez Jun 20, 2026
f8f82dd
wip: wire opt-in watcher event index runtime
phernandez Jun 20, 2026
e653c14
wip: expose project index orchestration surface
phernandez Jun 20, 2026
40ab3ad
wip: move local watch event orchestration into index
phernandez Jun 20, 2026
79c9469
wip: expose local event index runtime surface
phernandez Jun 20, 2026
c700e44
wip: expose storage event source contracts from index
phernandez Jun 20, 2026
d1e63cf
wip: add local project index fanout adapters
phernandez Jun 20, 2026
ff60087
wip: add inline local project batch enqueuer
phernandez Jun 20, 2026
50c9305
wip: add project-index helper recipes
phernandez Jun 20, 2026
31565a6
wip: compose local project index runtime factory
phernandez Jun 20, 2026
e1da9bd
wip: route opt-in startup sync through project index
phernandez Jun 20, 2026
dd09b47
wip: remove sync service dependency from index runtimes
phernandez Jun 20, 2026
ba91ac3
wip: add storage event source runner
phernandez Jun 20, 2026
a4eff8e
wip: make event indexing the startup default
phernandez Jun 20, 2026
e7df3e6
wip: decouple file indexer from sync service
phernandez Jun 20, 2026
23a0319
wip: extract repository relation resolver
phernandez Jun 20, 2026
a4a260a
wip: add sync-free project runtime bundle
phernandez Jun 20, 2026
53286c7
wip: route sync-file through event indexer
phernandez Jun 20, 2026
728ee02
wip: route project sync through event indexer
phernandez Jun 20, 2026
6c689c9
wip: add storage event bucket context runner
phernandez Jun 20, 2026
248efb1
wip: default local indexing to core event runtime
phernandez Jun 20, 2026
812dbbf
wip: move project index maintenance into core coordinator
phernandez Jun 20, 2026
1f9adf8
wip: resolve local project index relations
phernandez Jun 21, 2026
cbd5170
wip: move directory delete acceptance into core
phernandez Jun 21, 2026
b81cdc0
wip: add repository storage event project resolver
phernandez Jun 21, 2026
d10a3d5
wip: add generic storage event operation processor
phernandez Jun 21, 2026
0f72272
wip: share repository external delete adapter
phernandez Jun 21, 2026
d6d9663
wip: add shared gateway service facades
phernandez Jun 21, 2026
384ef0f
wip: simplify gateway behavior contracts
phernandez Jun 21, 2026
7885fab
wip: simplify accepted note repository contracts
phernandez Jun 21, 2026
a0e3b41
wip: simplify note content repository contracts
phernandez Jun 21, 2026
4f198af
wip: simplify note content read repair contracts
phernandez Jun 21, 2026
789db43
wip: simplify project delete repository provider
phernandez Jun 21, 2026
30a43ca
wip: simplify index metadata source contracts
phernandez Jun 21, 2026
8cdbe09
wip: simplify forward reference resolver contract
phernandez Jun 21, 2026
4b7ac43
wip: simplify local index dependency provider
phernandez Jun 21, 2026
4673fc5
wip: simplify project delete session provider
phernandez Jun 21, 2026
4c6856c
wip: simplify orphan cleanup session provider
phernandez Jun 21, 2026
48ea838
wip: simplify note materialization providers
phernandez Jun 21, 2026
c3df529
wip: simplify note content batch providers
phernandez Jun 21, 2026
0928b52
wip: simplify index progress providers
phernandez Jun 21, 2026
07d1632
wip: align local index markdown targets
phernandez Jun 21, 2026
8dc39c8
wip: align markdown suffix indexing
phernandez Jun 21, 2026
b4c8924
wip: filter project index observed markdown
phernandez Jun 21, 2026
cda76ec
wip: report local event index failures
phernandez Jun 21, 2026
6c71e30
wip: require explicit inline event recorders
phernandez Jun 21, 2026
5a5e8b9
wip: require explicit storage resolution loggers
phernandez Jun 21, 2026
c88da2a
wip: make project index workflow hooks optional
phernandez Jun 21, 2026
9ea9469
wip: order local event deletes before creates
phernandez Jun 21, 2026
ce5e781
wip: repair local event-index relations
phernandez Jun 21, 2026
f7afcff
wip: index regular files through event runtime
phernandez Jun 21, 2026
2a1b44f
wip: report inline project index batch outcomes
phernandez Jun 21, 2026
b15158d
wip: route local project index through batch runner
phernandez Jun 21, 2026
280c969
wip: preserve force-full project batch indexing
phernandez Jun 21, 2026
6d922b4
wip: align project move maintenance with indexed note state
phernandez Jun 21, 2026
fd44216
wip: align project move permalink maintenance
phernandez Jun 21, 2026
cd06598
wip: repair moved entity search rows in project index
phernandez Jun 21, 2026
bcc4765
wip: preserve local event index moves
phernandez Jun 21, 2026
25ee730
wip: collapse rapid event index moves
phernandez Jun 21, 2026
ce346e3
wip: skip local directory rename events
phernandez Jun 21, 2026
66523b9
wip: coalesce local event index changes
phernandez Jun 21, 2026
21a8001
wip: seed event index tests via project index
phernandez Jun 21, 2026
faeb653
wip: cover local atomic delete events
phernandez Jun 21, 2026
a8864fc
wip: cover event index deleted project skip
phernandez Jun 21, 2026
eebc664
wip: cover event index update batches
phernandez Jun 21, 2026
0806fdc
wip: cover event index delete add updates
phernandez Jun 21, 2026
c6436eb
wip: delete regular files via event index
phernandez Jun 21, 2026
c85f55a
wip: handle regular file replacement moves
phernandez Jun 21, 2026
cedb554
wip: apply ignore rules to local event index
phernandez Jun 21, 2026
4a35463
wip: repair event delete relation search rows
phernandez Jun 22, 2026
982eeb0
wip: cover regular file relation event parity
phernandez Jun 22, 2026
388fd32
wip: cover directory delete project index parity
phernandez Jun 22, 2026
81acd32
wip: cover project index permalink conflict parity
phernandez Jun 22, 2026
e107d1b
wip: cover project index frontmatter parity
phernandez Jun 22, 2026
744b095
wip: cover project index relation parity
phernandez Jun 22, 2026
ec1aa2d
wip: cover project index duplicate relation parity
phernandez Jun 22, 2026
2f12580
wip: cover project index hidden file parity
phernandez Jun 22, 2026
ca1213c
wip: cover project index timestamp parity
phernandez Jun 22, 2026
74c6a68
wip: cover project index regular file parity
phernandez Jun 22, 2026
ddce601
wip: cover project index changed file parity
phernandez Jun 22, 2026
6e8281f
wip: preserve indexing when semantic deps are missing
phernandez Jun 22, 2026
6ab7085
wip: filter local event editor artifacts
phernandez Jun 22, 2026
6f10bd6
wip: cover local event index stress batches
phernandez Jun 22, 2026
c89731a
wip: cover project index wikilink stability
phernandez Jun 22, 2026
786e2fc
wip: detect project index move over existing path
phernandez Jun 22, 2026
550ad25
wip: cover project index new permalink conflict
phernandez Jun 22, 2026
f42cf62
wip: cover project index thematic break parity
phernandez Jun 22, 2026
e7434ce
wip: cover project index path conflict parity
phernandez Jun 22, 2026
c28b8ca
wip: cover local event atomic relation parity
phernandez Jun 22, 2026
5a99c57
wip: tighten local index dependency contracts
phernandez Jun 22, 2026
fcd2f6a
wip: cover project index category parity
phernandez Jun 22, 2026
2e4cd6b
wip: add sync oracle just recipe
phernandez Jun 22, 2026
4db47ab
wip: skip unreadable local index paths
phernandez Jun 22, 2026
5ab3bb7
wip: skip vanished local index files
phernandez Jun 22, 2026
4158a60
wip: keep local scan results on walk errors
phernandez Jun 22, 2026
1d1d436
wip: skip outside local watch paths
phernandez Jun 22, 2026
8b22a4b
wip: skip unreadable local watch paths
phernandez Jun 22, 2026
4a1c29c
wip: cover rapid atomic local watch writes
phernandez Jun 22, 2026
5264199
wip: skip empty event-index watch batches
phernandez Jun 22, 2026
60586da
wip: treat vanished index metadata as missing
phernandez Jun 22, 2026
b6eb411
wip: treat vanished current index files as missing
phernandez Jun 22, 2026
d973cb3
wip: add storage event test recipe
phernandez Jun 22, 2026
1e4d994
wip: skip empty storage event buckets
phernandez Jun 22, 2026
c244acb
wip: add local watch storage event source
phernandez Jun 22, 2026
ea135b1
wip: move local watch request construction into index
phernandez Jun 22, 2026
3da40f1
wip: move local watch status planning into index
phernandez Jun 22, 2026
10886d8
wip: route local watch changes through index
phernandez Jun 22, 2026
c5feeec
wip: move local watch filtering into index
phernandez Jun 22, 2026
418265e
wip: share local watch project containment
phernandez Jun 22, 2026
7a62aa2
wip: remove sync tests from event index flow
phernandez Jun 22, 2026
a86d33b
wip: make event indexing the active runtime path
phernandez Jun 22, 2026
db3b2c6
Remove cloud-only snapshot history runtime contracts
phernandez Jun 22, 2026
3b8049f
Fix core Postgres indexing test harness
phernandez Jun 22, 2026
c513395
chore(core): split checks from tests
phernandez Jun 22, 2026
c329b04
refactor: replace generic task scheduler with typed schedulers
phernandez Jun 22, 2026
252ba51
refactor(core): split project index observer dep
phernandez Jun 22, 2026
9cf49d2
refactor(core): add project index route command
phernandez Jun 22, 2026
4eaf8bb
refactor(core): add project delete acceptance service
phernandez Jun 22, 2026
da6d4a6
refactor(core): add project index workflow enqueue runner
phernandez Jun 22, 2026
d0df1c0
refactor(core): rename shared gateway package to cloud
phernandez Jun 22, 2026
1de2636
refactor(core): add default accepted note repositories
phernandez Jun 22, 2026
4beaa64
test(core): cover note content read payloads
phernandez Jun 22, 2026
6bd1119
refactor(api): prefer note content reads in v2 routes
phernandez Jun 22, 2026
e8039a4
refactor(api): accept note creates through note content
phernandez Jun 22, 2026
4d75386
refactor(api): route note writes through accepted content
phernandez Jun 22, 2026
3d29d53
refactor(api): expose note content route status
phernandez Jun 22, 2026
f641023
refactor(api): share note content read repair
phernandez Jun 22, 2026
e1d66aa
refactor(api): return accepted status for note mutations
phernandez Jun 23, 2026
1af22a3
refactor(api): route directory deletes through runtime service
phernandez Jun 23, 2026
bf00497
fix(index): keep accepted note search backend-safe
phernandez Jun 23, 2026
8c9295c
fix: address runtime review findings
phernandez Jun 23, 2026
f5fb22c
fix(core): address project index review bugs
phernandez Jun 23, 2026
771dbb5
fix(core): surface note materialization conflicts
phernandez Jun 23, 2026
609dacf
fix(core): support runtime RSS on Windows
phernandez Jun 23, 2026
8334d83
fix(core): return indexed accepted note responses
phernandez Jun 23, 2026
30fbc6f
test(core): cover accepted note external metadata refresh
phernandez Jun 23, 2026
326d47c
fix(core): reuse local note freshener dependencies
phernandez Jun 23, 2026
8d68a15
fix(core): stabilize local note materialization on Windows
phernandez Jun 23, 2026
83de1af
test(core): assert portable note paths and newlines
phernandez Jun 23, 2026
ab0822d
fix(core): address PR feedback regressions
phernandez Jun 23, 2026
0a18979
fix(core): run relation resolution and embedding on both note ingress…
phernandez Jun 23, 2026
96845b0
test(core): rename duplicate job-payload test modules
phernandez Jun 23, 2026
cae7a4b
fix(core): reject local note creates over existing unindexed files
phernandez Jun 23, 2026
5373db8
fix(core): apply create storage check to PUT-as-create branch
phernandez Jun 24, 2026
cf81acd
fix(core): honor legacy sync_changes opt-out after index_changes rename
phernandez Jun 24, 2026
7ecb672
perf(core): coalesce per-write relation resolution into one offline pass
phernandez Jun 24, 2026
696d71b
perf(core): defer local note materialization off the accept path
phernandez Jun 24, 2026
74c10bf
fix(core): run local Postgres startup migrations under uvloop
phernandez Jun 24, 2026
720f6b0
perf(core): bound local note materialization with a worker pool
phernandez Jun 24, 2026
9494f3f
fix(core): pool connections for local Postgres instead of NullPool
phernandez Jun 24, 2026
aeaaaa6
fix(core): seed a default project for fresh local Postgres
phernandez Jun 24, 2026
34cea31
perf(core): make SQLite PRAGMAs tunable (synchronous/mmap/checkpoint/…
phernandez Jun 24, 2026
934ac6f
test(core): skip uvloop-only migration_loop test on Windows
phernandez Jun 25, 2026
9f33eea
fix(core): initialize local Postgres so the seeded default gets a DB row
phernandez Jun 25, 2026
adda3b1
fix(core): initialize local Postgres on the sync CLI path too
phernandez Jun 25, 2026
f496b22
fix(core): create local Postgres project directories
phernandez Jun 25, 2026
5ec8df2
fix(core): preserve cloud-mode init skip via skip_local_initialization
phernandez Jun 25, 2026
56444e0
fix(core): migrate legacy sync_delay debounce setting
phernandez Jun 25, 2026
9c635be
fix(core): mark all storage write failures as failed
phernandez Jun 25, 2026
4b687e7
fix(api): skip local file watching in cloud mode
phernandez Jun 25, 2026
d1f255a
fix(api): release resource DB session before file reads
phernandez Jun 25, 2026
6009070
fix(core): prune ignored dirs and skip symlinks in project scans
phernandez Jun 25, 2026
2886fab
fix(cli): honor search-only reindex (skip embeddings)
phernandez Jun 25, 2026
52ec66f
fix(sync): route nested watch events to the deepest project
phernandez Jun 25, 2026
1394bfc
fix(core): report guarded directory-delete skips as failures
phernandez Jun 25, 2026
e29a92d
fix(core): re-run relation resolution for writes during a pass
phernandez Jun 25, 2026
936d02b
fix(core): drain pending materializations before one-shot client exit
phernandez Jun 25, 2026
39a3ac2
fix(core): resolve relations after deferred index, not just on enqueue
phernandez Jun 25, 2026
9d09d23
fix(core): abort project scan when the root is unreadable
phernandez Jun 25, 2026
9e57636
fix(core): enable SQLite FK cascades for directory deletes
phernandez Jun 25, 2026
6cadc84
fix(core): clean up files orphaned by stale materializations
phernandez Jun 25, 2026
7feb3cd
fix(core): reject moves onto existing unindexed destination files
phernandez Jun 25, 2026
9481248
fix(cli): avoid double embedding on full reindex
phernandez Jun 25, 2026
cc5b391
Merge remote-tracking branch 'origin/main' into codex/repository-expl…
phernandez Jun 25, 2026
1b79318
test(core): satisfy typecheck after merge from main
phernandez Jun 25, 2026
f742ad1
fix(core): verified pre-merge bug fixes from paired-PR review
phernandez Jul 2, 2026
4372640
fix(core): treat post-write cleanup enqueue as reported, non-fatal
phernandez Jul 2, 2026
9f1a816
feat(core): injectable actor resolver for note-content mutations
phernandez Jul 2, 2026
0a056e0
refactor(core): split runtime contracts and project index workflow in…
phernandez Jul 2, 2026
ce43b05
test(core): align rename-over-existing-path and startup-index tests w…
phernandez Jul 2, 2026
0d39222
refactor(core): remove tenant and queue-transport identity from share…
phernandez Jul 2, 2026
3d9c063
refactor(core): remove runtime, indexing, and index barrel exports
phernandez Jul 2, 2026
6470ddf
fix(cli): drain scheduled background tasks before one-shot shutdown
phernandez Jul 2, 2026
46f807a
feat(runtime): accept web_v2 as a note object metadata source
phernandez Jul 2, 2026
40132a0
Merge remote-tracking branch 'origin/main' into codex/repository-expl…
phernandez Jul 7, 2026
c5d2c58
fix(api): drain queued materializations before API shutdown
phernandez Jul 7, 2026
0853f6b
fix(core): carry unobservable files through scan delete reconciliation
phernandez Jul 7, 2026
cf312a4
fix(core): don't delete a note's only file on case-only rename
phernandez Jul 7, 2026
816492c
fix(core): reject path traversal and Windows-absolute note move desti…
phernandez Jul 7, 2026
fe490e1
fix(core): guard accepted note writes with optimistic concurrency
phernandez Jul 7, 2026
8699e03
fix(sync): restore scan-path indexing parity and bound query fan-out
phernandez Jul 7, 2026
ac9a1ae
fix(sync): keep directory delete cleaning past a per-file IO error
phernandez Jul 7, 2026
0e64375
fix(sync): isolate watcher batch failures and guard shutdown drain
phernandez Jul 7, 2026
cbbb79b
fix(core): rescue legacy sync env vars and isolate FTS errors on shar…
phernandez Jul 7, 2026
683513f
fix(core): align tests with P0/concurrency guards and drop dead imports
phernandez Jul 7, 2026
ecad78d
Merge remote-tracking branch 'origin/main' into codex/repository-expl…
phernandez Jul 7, 2026
be17126
fix(core): version-guard reconcile and materialization publish writes
phernandez Jul 7, 2026
d6d1b63
refactor(indexing): collapse single-impl SessionProvider seams
phernandez Jul 7, 2026
3fade3b
refactor(indexing): push clock impl detail out of the interface
phernandez Jul 7, 2026
c785278
refactor(indexing): remove unused VectorSyncProgressReporter seam
phernandez Jul 7, 2026
401f4ee
refactor(core): remove unused ProjectIndexMetadataReporter seam
phernandez Jul 8, 2026
ca8e3b9
refactor(core): remove unused storage-event source runtime scaffolding
phernandez Jul 8, 2026
42c0872
refactor(core): collapse ForwardReferenceLinkResolver to the default …
phernandez Jul 8, 2026
a894596
refactor(core): push logger Protocols down to loguru.Logger
phernandez Jul 8, 2026
133953f
refactor(core): collapse AcceptedNoteDeleteSession to AsyncSession
phernandez Jul 8, 2026
0ab80d5
refactor(core): collapse valueless LocalProjectIndexRuntimeProvider f…
phernandez Jul 8, 2026
f8a2a0f
refactor(core): collapse project-index batch-store Protocols to concrete
phernandez Jul 8, 2026
699c748
fix(sync): re-read file at batch reconcile to avoid reverting newer a…
phernandez Jul 8, 2026
b75f65c
feat(sync): recover materializations stuck in writing/pending on startup
phernandez Jul 8, 2026
4db24af
fix(sync): recover a crash between file write and publish instead of …
phernandez Jul 8, 2026
dd349cc
fix(core): restore LocalProjectIndexRuntimeProvider — it is a real de…
phernandez Jul 8, 2026
4af69aa
test: write fixture files as bytes to survive Windows newline transla…
phernandez Jul 14, 2026
47f27a6
feat(indexing): flag superseded content in observed-object live updates
phernandez Jul 14, 2026
6114f61
chore: remove forked src-old and tests-old sync trees
phernandez Jul 14, 2026
17461d2
fix(mcp): drain queued materializations at MCP server shutdown
phernandez Jul 14, 2026
3db64d0
fix(cli): recover stuck materializations before the reindex scan
phernandez Jul 14, 2026
d39b9ff
fix(core): re-drive note materializations stuck in 'failed'
phernandez Jul 14, 2026
b1b27b1
fix(core): serialize materializations for the same note on one worker
phernandez Jul 14, 2026
fafa6bf
style(core): apply ruff format to materialization-touched files
phernandez Jul 14, 2026
85ee480
fix(core): treat raw FileNotFoundError as missing in run_index_file
phernandez Jul 14, 2026
d9ec20b
fix(core): reject Windows drive-relative and rooted move destinations
phernandez Jul 14, 2026
c6202bc
fix(core): re-check project is_active inside the hard-delete transaction
phernandez Jul 14, 2026
9e5fc9b
fix(core): guard non-note project files with the entity checksum on d…
phernandez Jul 14, 2026
1886b2d
fix(core): log and savepoint-isolate relation resolve failures
phernandez Jul 14, 2026
60ed260
fix(api): serialize directory-delete errors as structured path/error …
phernandez Jul 14, 2026
8d27c31
fix(api): reindex surviving relation sources after directory delete
phernandez Jul 14, 2026
44d2343
fix(api): single-flight local project index runs per project
phernandez Jul 14, 2026
192f115
style: ruff format touched guard fixes
phernandez Jul 14, 2026
7ee7889
feat(api): reject stale note PUTs via base-checksum precondition
phernandez Jul 14, 2026
25337f9
fix(sync): tolerate concurrently deleted entities in moved-entity sea…
phernandez Jul 14, 2026
0a93d07
fix(sync): carry indexed files under unreadable directories through s…
phernandez Jul 14, 2026
67aac01
fix(sync): re-verify planned deletes so concurrent writes survive sca…
phernandez Jul 14, 2026
d2bbb05
fix(sync): stop scan move batches deleting concurrently created desti…
phernandez Jul 14, 2026
f13ad97
fix(sync): defer moved-file frontmatter writes until the move batch c…
phernandez Jul 14, 2026
7d37f9e
style: ruff format superseded-content test additions
phernandez Jul 14, 2026
c9980a6
fix(api): rerun coalesced index request even when the in-flight run f…
phernandez Jul 14, 2026
68c5969
Merge remote-tracking branch 'origin/main' into codex/repository-expl…
phernandez Jul 14, 2026
53863eb
test: satisfy stricter ty protocol inference after dev-deps refresh
phernandez Jul 14, 2026
96533ef
fix(sync): only a confirmed missing file may satisfy the delete probe
phernandez Jul 14, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 9 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ See the [README.md](README.md) file for a project overview.
- Run unit tests (Postgres): `just test-unit-postgres`
- Run integration tests (SQLite): `just test-int-sqlite`
- Run integration tests (Postgres): `just test-int-postgres`
- Run impacted tests: `just testmon` (pytest-testmon; only tests affected by changed code)
- Run impacted tests: `just fast-test` or `just testmon` (pytest-testmon; only tests affected by changed code)
- Run MCP smoke test: `just test-smoke`
- Fast local loop: `just fast-check` (default iteration flow)
- Fast static check: `just fast-check` (fix, format, typecheck)
- Fast test loop: `just fast-test` (pytest-testmon impacted tests)
- Local consistency check: `just doctor`
- Run all consolidated agent package checks: `just package-check`
- Run Claude Code plugin checks: `just package-check-claude-code`
Expand All @@ -39,7 +40,7 @@ See the [README.md](README.md) file for a project overview.
- Type check: `just typecheck` or `uv run ty check src tests test-int`
- Type check (pyright): `just typecheck-pyright` or `uv run pyright`
- Format: `just format` or `uv run ruff format .`
- Run all code checks: `just check` (runs lint, format, typecheck, test)
- Run all static code checks: `just check` (runs lint, format, typecheck)
- Create db migration: `just migration "Your migration message"`
- Run development MCP Inspector: `just run-inspector`

Expand All @@ -54,10 +55,11 @@ See the [README.md](README.md) file for a project overview.
### Code/Test/Verify Loop (fast path)

1) **Code:** make changes.
2) **Test:** `just fast-check` (lint/format/typecheck + pytest-testmon impacted tests for changed code).
3) **Verify:** `just doctor` (end-to-end file ↔ DB loop in a temp project).
4) **Package verify:** `just package-check` when changes touch `plugins/`, `skills/`, `integrations/`, package metadata, or release wiring.
5) **Full gate (when needed):** `just test` or `just check` for SQLite + Postgres.
2) **Check:** `just fast-check` (fix, format, typecheck; no tests).
3) **Test:** `just fast-test` for pytest-testmon impacted tests, or a targeted `uv run pytest ...` command.
4) **Verify:** `just doctor` (end-to-end file ↔ DB loop in a temp project).
5) **Package verify:** `just package-check` when changes touch `plugins/`, `skills/`, `integrations/`, package metadata, or release wiring.
6) **Full gate (when needed):** `just test` for SQLite + Postgres.

Run `just test-smoke` when you specifically need the MCP smoke flow.

Expand Down
311 changes: 276 additions & 35 deletions justfile

Large diffs are not rendered by default.

18 changes: 13 additions & 5 deletions src/basic_memory/api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
synchronize_projects,
)
import logfire
from basic_memory.cloud.note_content_materialization import drain_pending_materializations
from basic_memory.config import init_api_logging
from basic_memory.deps.services import drain_background_tasks
from basic_memory.services.exceptions import EntityAlreadyExistsError
from basic_memory.services.initialization import initialize_app
from basic_memory.workspace_context import (
Expand Down Expand Up @@ -67,10 +69,10 @@ async def lifespan(app: FastAPI): # pragma: no cover
app.state.session_maker = session_maker
logger.info("Database connections cached in app state")

# Create and start sync coordinator (lifecycle centralized in coordinator)
sync_coordinator = container.create_sync_coordinator()
await sync_coordinator.start()
app.state.sync_coordinator = sync_coordinator
# Create and start local watch coordinator (lifecycle centralized in coordinator)
watch_coordinator = container.create_watch_coordinator()
await watch_coordinator.start()
app.state.watch_coordinator = watch_coordinator

# Proceed with startup
yield
Expand All @@ -82,7 +84,13 @@ async def lifespan(app: FastAPI): # pragma: no cover
mode=container.mode.name.lower(),
):
logger.info("Shutting down Basic Memory API")
await sync_coordinator.stop()
await watch_coordinator.stop()
# A local note write returns 202 before its markdown file is written;
# SIGTERM can land while that materialization (and the vector sync /
# relation resolution it schedules) is still queued. Drain both queues
# before the engine closes so an accepted write is never lost.
await drain_pending_materializations()
await drain_background_tasks()
await container.shutdown_database()
Comment thread
phernandez marked this conversation as resolved.


Expand Down
43 changes: 23 additions & 20 deletions src/basic_memory/api/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

from basic_memory import db
from basic_memory.config import BasicMemoryConfig, ConfigManager
from basic_memory.runtime import RuntimeMode, resolve_runtime_mode
from basic_memory.runtime.mode import RuntimeMode, resolve_runtime_mode

if TYPE_CHECKING: # pragma: no cover
from basic_memory.sync import SyncCoordinator
from basic_memory.index.watch_coordinator import WatchCoordinator


@dataclass
Expand Down Expand Up @@ -54,40 +54,43 @@ def create(cls) -> "ApiContainer": # pragma: no cover
# --- Runtime Mode Properties ---

@property
def should_sync_files(self) -> bool:
"""Whether file sync should be started.
def should_watch_files(self) -> bool:
"""Whether local file watching should be started.

Sync is enabled when:
- sync_changes is True in config
- Not in test mode (tests manage their own sync)
Watching is enabled when:
- index_changes is True in config
- Not in test mode (tests manage their own watcher lifecycle)
- Not in cloud mode (cloud handles storage events differently)
"""
return self.config.sync_changes and not self.mode.is_test
return self.config.index_changes and not self.mode.is_test and not self.mode.is_cloud

@property
def sync_skip_reason(self) -> str | None: # pragma: no cover
"""Reason why sync is skipped, or None if sync should run.
def watch_skip_reason(self) -> str | None: # pragma: no cover
"""Reason why local watching is skipped, or None if it should run.

Useful for logging why sync was disabled.
Useful for logging why local watching was disabled.
"""
if self.mode.is_test:
return "Test environment detected"
if not self.config.sync_changes:
return "Sync changes disabled"
if self.mode.is_cloud:
return "Cloud mode enabled"
if not self.config.index_changes:
return "Local file watching disabled"
return None

def create_sync_coordinator(self) -> "SyncCoordinator": # pragma: no cover
"""Create a SyncCoordinator with this container's settings.
def create_watch_coordinator(self) -> "WatchCoordinator": # pragma: no cover
"""Create a WatchCoordinator with this container's settings.

Returns:
SyncCoordinator configured for this runtime environment
WatchCoordinator configured for this runtime environment
"""
# Deferred import to avoid circular dependency
from basic_memory.sync import SyncCoordinator
from basic_memory.index.watch_coordinator import WatchCoordinator

return SyncCoordinator(
return WatchCoordinator(
config=self.config,
should_sync=self.should_sync_files,
skip_reason=self.sync_skip_reason,
should_watch=self.should_watch_files,
skip_reason=self.watch_skip_reason,
)

# --- Database Factory ---
Expand Down
Loading
Loading