Service & state modules¶
Configuration, SQLite state store, file watcher, telemetry, and the dashboard read-model.
noesis.core.config
¶
Runtime settings, read once at startup from config.toml (§3.7).
M2 added [embedder] and [qdrant] plus the state-DB path; M4 added
[reranker]; M5 adds [structural]; M7 adds [git]. Everything has
a working default so the service runs with no config file at all.
Path defaults are anchored, never cwd-relative: the HTTP server (run from a checkout) and the stdio MCP server (spawned with the agent host's cwd) must resolve the SAME state DB, or the MCP tools silently answer "unknown project_id" for every project registered via the dashboard. Same failure class — and same cure — as prefetch.default_fastembed_cache.
DEFAULT_QUERY_URL = 'http://127.0.0.1:6333'
module-attribute
¶
CONFIG_ENV = 'NOESIS_CONFIG'
module-attribute
¶
EmbedderSettings(model='nomic-ai/CodeRankEmbed', dim=768, batch_size=32, device=None)
dataclass
¶
RerankerSettings(model='BAAI/bge-reranker-v2-m3', enabled=False, preload=False, candidates=50, batch_size=16, device=None)
dataclass
¶
§3.7 [reranker]. enabled is both the kill switch and the
per-request default: enabled=false (the pre-gate default, Finding 2)
never loads the model and requests cannot opt in; enabled=true makes
rerank default on with per-request opt-out. The M4 gate decision
flips the shipped default from measured NDCG@10 data.
model = 'BAAI/bge-reranker-v2-m3'
class-attribute
instance-attribute
¶
enabled = False
class-attribute
instance-attribute
¶
preload = False
class-attribute
instance-attribute
¶
candidates = 50
class-attribute
instance-attribute
¶
batch_size = 16
class-attribute
instance-attribute
¶
device = None
class-attribute
instance-attribute
¶
StructuralSettings(max_results=100, timeout_s=10.0)
dataclass
¶
§3.7 [structural]. max_results caps matches per query (the
request may ask for less, never more); timeout_s is the wall-clock
scan budget — on expiry the scan stops and returns partial results with
timed_out: true rather than erroring, since partial matches are
still actionable to an iterating agent.
GitSettings(fast_path=True)
dataclass
¶
§3.7 [git]. fast_path=false disables candidate narrowing
entirely — every run full hash-walks (the correctness baseline the
fast path must match, §3.2 rule 1).
fast_path = True
class-attribute
instance-attribute
¶
IndexingSettings(promote_after_scoped_runs=20, promote_candidate_fraction=0.25, unwalkable_quarantine_runs=5, max_concurrent_index_runs=4)
dataclass
¶
§3.7 [indexing] — the automatic path back to a full, anchored walk
(ADR-56/57). Every automated trigger in the service is scoped, and only a
full run drains the H1 dirty set or advances the anchor, so without these a
project has no way out of a latched state (issue #25).
promote_after_scoped_runs: promote a scoped run to a full walk once
this many scoped runs have started since the last completed full one.
promote_candidate_fraction: promote when the effective candidate set
(pending ∪ dirty) reaches this fraction of the indexed file count — the
point where a scoped run stops being cheaper than the full walk it already
pays for, since discovery stats and binary-sniffs every file either way.
unwalkable_quarantine_runs: consecutive runs a directory must fail to
be walked before the paths it hides stop being re-queued for retry.
0 disables each independently, restoring the pre-ADR-56 behaviour.
max_concurrent_index_runs (ADR-85) caps index runs across the whole
machine, not per project — try_start_run already guarantees one run
per project, and this bounds how many projects may run at once. The
default of 4 is a judgment call, NOT a measurement: concurrent runs
serialize on the single embedder worker (ADR-20) regardless, so a larger
number buys no indexing throughput and only multiplies simultaneous file
walks, open descriptors and executor pressure; a value of 1 would be a
visible behaviour change, since today a second project need not wait
behind a long run. Set it explicitly if your machine says otherwise.
WatcherSettings(poll_interval_s=1.0)
dataclass
¶
§3.7 [watcher]. poll_interval_s is the PollingObserver
snapshot cadence used only for watched roots on inotify-blind
filesystems (9p/cifs/nfs/fuse/…, e.g. WSL2's /mnt/c); roots watched
natively via inotify never poll and ignore it.
poll_interval_s = 1.0
class-attribute
instance-attribute
¶
ServerSettings(port=8000)
dataclass
¶
§3.8 [server]. Only the port is configurable: the host is fixed at
127.0.0.1 by CLAUDE.md rule 2, and exposing it as a knob would make a
wildcard bind one config edit away. The shim (ADR-86) reads this to know
where to find — or start — the shared server, so the port has to live
somewhere both it and the operator agree on.
port = 8000
class-attribute
instance-attribute
¶
QdrantSettings(url=DEFAULT_QUERY_URL, collection='noesis_chunks', query_connections=None, query_queue_depth=None)
dataclass
¶
§3.3 [qdrant].
query_connections sizes the search connection pool and, 1:1, the
search executor's slots (ADR-83/84). None means derive from the
machine — the same "None means auto" convention embedder.device
already uses — because the right value is a property of the host, not
of the project. See derive_query_connections for the rule and the
measurements behind it. Set it explicitly to override on a machine
whose shape the rule guesses wrong.
query_queue_depth bounds how many searches may WAIT for a slot
before the service starts rejecting instead of queueing without limit.
None derives it from query_connections.
Settings(db_path=default_db_path(), embedder=EmbedderSettings(), reranker=RerankerSettings(), structural=StructuralSettings(), git=GitSettings(), watcher=WatcherSettings(), indexing=IndexingSettings(), qdrant=QdrantSettings(), server=ServerSettings())
dataclass
¶
db_path = field(default_factory=default_db_path)
class-attribute
instance-attribute
¶
embedder = field(default_factory=EmbedderSettings)
class-attribute
instance-attribute
¶
reranker = field(default_factory=RerankerSettings)
class-attribute
instance-attribute
¶
structural = field(default_factory=StructuralSettings)
class-attribute
instance-attribute
¶
git = field(default_factory=GitSettings)
class-attribute
instance-attribute
¶
watcher = field(default_factory=WatcherSettings)
class-attribute
instance-attribute
¶
indexing = field(default_factory=IndexingSettings)
class-attribute
instance-attribute
¶
qdrant = field(default_factory=QdrantSettings)
class-attribute
instance-attribute
¶
server = field(default_factory=ServerSettings)
class-attribute
instance-attribute
¶
default_db_path()
¶
Absolute, cwd-independent default location for the state DB
(user data dir, ~/.local/share/noesis/noesis.sqlite).
Source code in src/noesis/core/config.py
28 29 30 31 32 | |
default_config_path()
¶
Config lookup when neither an explicit path nor $NOESIS_CONFIG is
given: ./config.toml when present (deliberate dev override for
running from a checkout), else the anchored user config dir.
Source code in src/noesis/core/config.py
35 36 37 38 39 40 41 42 43 | |
available_cpus()
¶
CPUs this process may actually run on.
os.cpu_count() reports the host's CPUs, which is wrong inside a
cgroup-limited container — it would size the pool for hardware the
process cannot use. sched_getaffinity reports the real allowance
where it exists (Linux); everything else falls back.
Source code in src/noesis/core/config.py
173 174 175 176 177 178 179 180 181 182 183 184 185 186 | |
derive_query_connections(configured=None)
¶
Resolve the search pool size; configured wins when given.
Rule: clamp(available_cpus(), 2, 8).
Measured on a 4-CPU box, 16 concurrent searches, 5,000 points, hybrid,
prefetch 50, against a live Qdrant 1.18.3 — throughput saturates
exactly at cpu_count and stays flat well past it while latency
climbs monotonically:
K=1 258 q/s p95 4.7ms K=6 375 q/s p95 23.7ms
K=2 353 q/s p95 8.1ms K=8 375 q/s p95 33.3ms
K=4 384 q/s p95 16.0ms K=12 379 q/s p95 48.4ms
The knee sits at the CPU count because Qdrant is co-resident and competing for the same cores: past it, queries queue inside Qdrant instead of in our pool, buying latency for no throughput.
The ceiling of 8 is explicitly NOT measured — a bigger box was not available — which is precisely why the override exists.
Source code in src/noesis/core/config.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | |
derive_query_queue_depth(connections, configured=None)
¶
Resolve how many searches may queue for a slot; configured wins.
Source code in src/noesis/core/config.py
230 231 232 233 234 | |
load_settings(config_path=None)
¶
Load settings, falling back to defaults per key.
Resolution order: explicit config_path → $NOESIS_CONFIG →
./config.toml (dev override) → $XDG_CONFIG_HOME/noesis/config.toml.
A relative db_path inside the file resolves against the file's own
directory, never the process cwd — the cwd belongs to whoever spawned us.
Source code in src/noesis/core/config.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
noesis.core.state
¶
SQLite state store — projects, per-file state, index runs.
WAL-mode single-file DB per the approved Overview §7 schema plus the
last_indexed_commit column from the expanded doc §3.7. All mutating
functions commit before returning; callers never manage transactions.
MixedModelError
¶
Bases: ValueError
A project is already indexed with a different embedding model. Typed so adapters can map it to 409 without matching message text (PR #10 review).
IndexCapacityReached(running, limit, project_id=None)
¶
Bases: Exception
Raised by try_start_run when the machine-wide cap is already met.
A distinct exception rather than a third return status, deliberately: the
watcher's re-arm path matches the already_running status by string, so
a new status value would have fallen through it silently — counting a run
that never started and leaving pending files stuck. An unhandled exception
is loud; a silently mishandled status is the bug this whole change is
about.
Source code in src/noesis/core/state.py
637 638 639 640 641 642 643 644 645 646 647 648 | |
running = running
instance-attribute
¶
limit = limit
instance-attribute
¶
project_id = project_id
instance-attribute
¶
retry_after_seconds = 30
instance-attribute
¶
agent_message()
¶
Source code in src/noesis/core/state.py
650 651 652 653 654 655 656 657 | |
connect(db_path)
¶
Source code in src/noesis/core/state.py
271 272 273 274 275 276 277 278 279 280 | |
init_db(conn)
¶
Source code in src/noesis/core/state.py
283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
register_project(conn, root_path, embedding_model)
¶
Source code in src/noesis/core/state.py
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | |
get_project(conn, project_id)
¶
Source code in src/noesis/core/state.py
353 354 | |
list_projects(conn)
¶
Source code in src/noesis/core/state.py
357 358 | |
set_last_indexed_commit(conn, project_id, commit, *, dirty_paths=None)
¶
Record the git fast-path anchor. Callers must invoke this only after a run completes successfully (§3.2 rule 4) — an anchor from a failed run would let the next fast path skip files the failed run never finished indexing.
dirty_paths (when provided) records the set the next run must re-admit as candidates (H1). Two populations since ADR-60, and the second is why this parameter is load-bearing rather than bookkeeping: the working-tree -dirty paths as of this anchor, PLUS every path the run could not verify. A run is allowed to anchor past a nameable failure precisely because those paths ride along here — the guarantee "the next fast path never skips a file whose state is unknown" is met by recording them, not by refusing to move (issue #28). The anchor and the set are written in ONE statement, so there is no window where the anchor advanced but the re-admission list did not.
Passing an empty iterable clears the stored set; None leaves it untouched.
Source code in src/noesis/core/state.py
361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | |
add_dirty_paths(conn, project_id, paths)
¶
Union paths into the persisted dirty set (H1) WITHOUT touching
last_indexed_commit. Scoped (watcher) runs never advance the anchor,
so :func:set_last_indexed_commit never fires for them — yet the dirty
content they indexed must still be re-admitted by the next fast path.
Union-only: it can only widen the candidate set (§3.2 rule-1 safe).
The read and the write run in one BEGIN IMMEDIATE transaction. In
practice try_start_run already serializes runs per project, even
across processes, and this is only called from inside a run — but that
invariant lives in another function, and a lost union here silently
reopens the H1 gap this exists to close. Self-protecting beats
depending on a caller's lock.
Runs on the caller's thread — execute_run calls it directly from the
event loop — and BEGIN IMMEDIATE takes SQLite's write lock at the
first statement rather than at commit. Under a foreign writer (the other
transport mid-run) it can therefore block the loop for up to the shared
connection's busy_timeout of 5s, once per scoped run. Accepted
deliberately: the alternative is a dedicated short-timeout connection
like telemetry's, which DROPS its write when the lock is contended — and
unlike a telemetry row, a dropped union is a correctness loss that
silently reopens the H1 gap. A bounded stall beats silent data loss. It
must not be moved to a worker thread either: the shared connection is
loop-owned, and a worker-thread write interleaving inside another
operation's open transaction is the hazard jobs.index_status
documents.
Source code in src/noesis/core/state.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | |
set_dirty_paths(conn, project_id, paths)
¶
REPLACE the persisted H1 dirty set without touching the anchor.
:func:set_last_indexed_commit is the only other writer that shrinks it,
and it requires a commit — so a project with no git anchor (non-git root,
or git unavailable) had no way to shrink the set at all and grew it
without bound. Callers must have completed a FULL walk: that re-hashes
every discovered file, so the only paths still owed H1 re-admission are
the ones the walk could not verify.
paths is exactly that remainder (ADR-60). It was an unconditional clear until the caller was allowed to finish a walk that had contained failures: a full walk with, say, one unreadable subdirectory has re-hashed everything else, so clearing outright would drop the one set that must survive, while refusing to write at all is what froze the set in the first place (issue #28). Pass an empty iterable for the clean case — that is still the common one, and it behaves exactly as the old clear did.
A blind write, unlike :func:add_dirty_paths's read-modify-write, so it
needs no explicit transaction: the caller is replacing the set with a value
it derived from a walk of the whole tree, not merging into what is there.
Source code in src/noesis/core/state.py
454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 | |
get_dirty_paths(conn, project_id)
¶
The dirty-path set persisted at the last anchor advance (H1). Empty when unset or the project is unknown.
Source code in src/noesis/core/state.py
484 485 486 487 488 489 490 491 492 | |
get_file_states(conn, project_id)
¶
Source code in src/noesis/core/state.py
495 496 497 498 499 | |
get_file_chunk_counts(conn, project_id)
¶
Stored per-file chunk_count for a project — the number of points the vector store should hold for each file. Drift self-heal compares this, file by file, against the live per-file point counts in Qdrant.
Source code in src/noesis/core/state.py
502 503 504 505 506 507 508 509 | |
expected_chunk_total(conn, project_id)
¶
Sum of stored per-file chunk_count for a project — the number of points the vector store should hold in total. COALESCE so a never-indexed project reads 0, never NULL.
Source code in src/noesis/core/state.py
512 513 514 515 516 517 518 519 520 | |
indexed_file_total(conn)
¶
Total tracked files across all projects — the wipe-signature check (a vector collection created while state already tracks indexed files).
Source code in src/noesis/core/state.py
523 524 525 526 527 | |
indexed_file_count(conn, project_id)
¶
Files tracked for one project — the denominator the promotion trigger measures a scoped run's effective candidate set against (ADR-57).
Source code in src/noesis/core/state.py
530 531 532 533 534 535 536 | |
upsert_file(conn, project_id, path, content_hash, language=None, chunk_count=0)
¶
Source code in src/noesis/core/state.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 | |
delete_files(conn, project_id, paths)
¶
Source code in src/noesis/core/state.py
571 572 573 574 575 576 577 578 | |
fail_orphaned_runs(conn)
¶
Mark 'running' runs whose OWNING PROCESS IS DEAD as failed. Called at process startup to clear crash leftovers — the launch guard would otherwise return a dead run id forever, silently no-opping every future launch (PR #10 review).
Owner-gated (M7): in the documented two-process deployment (HTTP + stdio MCP sharing the DB, m6 guide) a starting process must NOT fail the other process's LIVE run — that both loses the run and disarms the concurrent-run guard. Rows with no owner (pre-M7 DBs) predate ownership tracking and are treated as dead.
Source code in src/noesis/core/state.py
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 | |
start_run(conn, project_id, *, triggered_by='manual', scoped=False)
¶
Source code in src/noesis/core/state.py
610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | |
try_start_run(conn, project_id, *, triggered_by='manual', scoped=False, max_concurrent=None)
¶
Atomically open a run — or return the one already running.
BEGIN IMMEDIATE takes SQLite's write lock up front, so the
running-check and the insert are a single unit even across processes:
the documented dual-transport deployment (HTTP server + stdio MCP on
one DB) cannot both pass a read-then-insert guard and race two runs
onto the same collection. Stale running rows whose owning process
is dead are failed here (same owner probe as fail_orphaned_runs),
so a crashed co-process can never jam the guard until a restart.
Returns (run_id, created) — created False means a live run
already exists and run_id is that run's id.
max_concurrent (ADR-85) caps how many runs may be alive across the
WHOLE machine, not per project. It is enforced here rather than in
jobs.launch_index_run because only this transaction is atomic across
processes: an asyncio.Semaphore would bound one process while the
co-process proceeds unaware, which for the documented HTTP + stdio
deployment is no cap at all. None means uncapped, which keeps every
direct caller (indexer.prepare_run, tests) behaving exactly as
before — only launch_index_run passes a limit, because it is the
fan-out path where N projects can pile up.
The running-row scan is global for the same reason, so the dead-owner
cleanup now covers other projects' orphans too. That is the same
operation fail_orphaned_runs already performs at startup, and it has
to happen here or a crashed co-process's stale row would count against
the cap until the next restart.
scoped records whether this run was given an explicit candidate set,
written at INSERT rather than at finish_run so a run that crashes still
counts toward the promotion trigger (ADR-57) — otherwise a project that
keeps dying mid-run would never promote.
Source code in src/noesis/core/state.py
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 | |
get_latest_run(conn, project_id)
¶
Most recent index run for a project — the M6 get_index_status
surface. Ordered by started_at (ISO-8601 UTC, lexicographically
sortable); ties broken by rowid (insertion order).
Source code in src/noesis/core/state.py
755 756 757 758 759 760 761 762 763 | |
finish_run(conn, run_id, status, *, files_total=None, files_changed=None, chunks_written=None, fast_path_used=None, candidate_count=None, files_failed=None, clean=None, error=None)
¶
Close out a run row: status, counters, finish time, error.
The counters are written with COALESCE(?, col) so passing None
leaves the stored value alone instead of erasing it. That matters because
this can legitimately be called twice for one run: execute_run
writes "done" with a full set of counters, and only afterwards does its
remaining bookkeeping — add_dirty_paths (which takes SQLite's write
lock under BEGIN IMMEDIATE and raises OperationalError past the
5s busy_timeout), the anchor write, and a git status subprocess.
Any of those raising lands in the except BaseException handler, which
calls this again with a status and an error and nothing else. Under the
old unconditional SET, that second call blanked every counter the
first had committed — a run whose content was fully indexed showed up on
the dashboard as failed with no numbers at all (PR #24 round-8 review).
status, error and finished_at stay unconditional: the whole
point of the second call is to overwrite those three, and error must
be able to move back to NULL as well as to a message.
clean is the caller's own clean_run verdict and is COALESCE'd with
the counters rather than written unconditionally, for the same reason: the
second call does not recompute it. That is safe because every reader pairs
it with status, so a run that reaches the failure path is excluded by
the status test regardless of the verdict recorded before it (ADR-58).
Source code in src/noesis/core/state.py
766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 | |
set_project_flags(conn, project_id, *, watch_enabled=None, auto_reindex=None)
¶
Update the per-project watcher flags (ADR-40). None leaves a flag untouched.
Source code in src/noesis/core/state.py
836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 | |
set_index_config(conn, project_id, *, index_languages=None, max_file_bytes=None, follow_symlinks=False, extra_ignores=None)
¶
Persist a project's index scope (ADR-42). index_languages /
extra_ignores are JSON-encoded; an empty or None list stores NULL
(meaning 'no filter' / 'all languages'). max_file_bytes None stores
NULL (DiscoveryConfig default applies).
Source code in src/noesis/core/state.py
860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 | |
delete_project(conn, project_id)
¶
Remove a project and all its state rows, child-first so the FK
constraints hold (ADR-43). query_log rows are deliberately kept:
metadata-only aggregates with no FK — deleting them would silently
rewrite usage history.
Source code in src/noesis/core/state.py
890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 | |
watched_projects(conn)
¶
Source code in src/noesis/core/state.py
909 910 911 912 | |
upsert_pending_changes(conn, project_id, changes)
¶
Record watcher-detected dirty files: (path, event_type) pairs. A re-event on the same path refreshes event_type and detected_at, so the row survives a clear cut at an earlier timestamp (the reindex race is resolved toward re-examination, never toward silent loss).
Source code in src/noesis/core/state.py
915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 | |
list_pending_changes(conn, project_id)
¶
Source code in src/noesis/core/state.py
943 944 945 946 947 948 949 950 | |
clear_pending_changes(conn, project_id, *, paths=None, before=None)
¶
Clear pending rows after a run examined them. paths limits the clear to a scoped run's candidate set (None = full run cleared all); before keeps rows re-dirtied while the run was executing.
Source code in src/noesis/core/state.py
953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 | |
record_file_errors(conn, run_id, errors)
¶
Source code in src/noesis/core/state.py
978 979 980 981 982 983 984 985 | |
list_file_errors(conn, run_id)
¶
Source code in src/noesis/core/state.py
988 989 990 991 992 | |
list_unwalkable_dirs(conn, project_id)
¶
Directories discovery could not walk, longest-standing first (ADR-56).
Empty is the healthy state. A row here does NOT mean anything was deleted or will be — it means part of the tree went unseen, so nothing under it can be proven absent.
Source code in src/noesis/core/state.py
995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 | |
count_unwalkable_dirs(conn, project_id)
¶
(unwalkable, quarantined) counts for the status surfaces. The second
is a subset of the first: COUNT(col) skips NULLs.
Source code in src/noesis/core/state.py
1011 1012 1013 1014 1015 1016 1017 1018 1019 | |
reconcile_unwalkable_dirs(conn, project_id, *, reported, cleared, quarantine_after)
¶
Fold one run's directory-level discovery result into the ledger (ADR-56).
reported are this run's DiscoveryErrors.dirs pairs — each bumps its
row's consecutive-failure count. cleared are recorded paths this run
proved walkable; their rows are deleted, which is what resets the count.
The caller decides what "proved walkable" means, because that is path
reasoning (indexer._under against the run's unwalked prefixes) and this
module owns SQL only.
Deletes run before inserts. They are disjoint by construction — a path reported this run is by definition under this run's failures — but if that ever stopped holding, this order re-inserts at count 1 and merely DELAYS a quarantine. The other order would drop a row that had just been counted. Erring toward retrying too long is the same fail-safe direction as ADR-51.
quarantine_after is the consecutive-run threshold; 0 disables
quarantine entirely and leaves quarantined_at NULL, so the retry
behaviour reverts to what shipped in PR #24. quarantined_at is only
ever set, never cleared: recovery deletes the whole row.
One BEGIN IMMEDIATE transaction for the same reason
:func:add_dirty_paths uses one — a half-applied reconcile would either
quarantine on a stale count or lose a recovery.
Source code in src/noesis/core/state.py
1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 | |
last_full_run_was_clean(conn, project_id)
¶
Did the most recent finished full walk complete with no failures?
This is the best available answer to "could a promotion drain the H1 dirty set?", which is what the fraction trigger needs to know (ADR-57).
Deliberately left conservative by ADR-60, and this is the one paragraph
to read before "fixing" it. The drains are no longer gated on
clean_run: a full walk whose failures are all attributable now
rewrites the dirty set to just the paths it could not verify. So a
not-clean full walk does drain — but only down to a pinned floor, the
unresolved set, which the next run re-derives identically while the fault
is live. Counting that floor here would promote on a number promotion
cannot move, which is exactly the latch the PR #30 review closed over two
rounds: a broken subtree holding more than promote_candidate_fraction
of the index would satisfy the threshold on every launch, forever. So this
keeps reading clean, and keeps meaning "could a promotion drain the set
to empty". The cost is a deferred promotion on a faulted project, which
is the safe direction and no worse than before ADR-60.
Reads the run's persisted clean verdict rather than re-deriving it
(ADR-58). It used to reconstruct it as files_failed == 0, which was
true only while every term of clean_run was a file-level failure — and
that has now drifted twice. Directory errors were the first (PR #30
round 2). Screening-held deletions were the second: they are deliberately
absent from files_failed because nothing failed to index, so a degraded
run reported files_failed == 0 while clean_run was False, and this
function said "clean" about a run that had drained nothing — re-latching
the fraction trigger on a dirty set promotion cannot shrink (PR #31
review). Persisting the writer's own verdict removes the class.
clean IS NULL means the row predates the column, so it falls back to
the old derivation. That is right rather than merely compatible: those rows
were written by code whose clean_run had no term the derivation missed.
Keyed on the outcome rather than the cause. Keying on unwalkable_dirs
rows instead — the first version of this guard — covered only dir_errors,
one of clean_run's terms (three then, four since ADR-58 added
screening_held); a persistently unreadable file pins
the set identically with no ledger row and latched the trigger just the same
(PR #30 round-2 review). This subsumes the ledger check rather than sitting
beside it.
Full runs only, and that restriction is the whole subtlety. A scoped run does not hash what is not in its candidate set, so a file that always fails to hash is simply never touched by one — every scoped run comes back clean while the fault is still there. Asking "was the last run clean" therefore flip-flops: clean scoped run → promote → the full walk hits the fault → not clean → no promote → clean scoped run → promote again. Only a full walk exercises what a full walk would exercise.
Runs still in flight are skipped (finished_at IS NOT NULL): their
files_failed is NULL because they have not reported yet, not because
they succeeded. scoped IS NULL rows predate the column and are read as
full walks, consistently with :func:scoped_runs_since_full.
A project with no finished full run reads clean — there is nothing to drain
either way, and the first full walk is exactly what reveals whether there is
a fault. A NULL files_failed on a finished run (pre-ADR-41) reads NOT
clean: the safe direction, since what this guards against is a permanent
latch and the cost of being wrong is a deferred promotion.
Known gap, documented rather than coded (PR #30 round-3 review). What
re-enables the caller's dirty term is a later clean full walk, and full
walks come from the other two promotion triggers. So setting
indexing.promote_after_scoped_runs = 0 while leaving
promote_candidate_fraction on removes the fraction trigger's own
recovery path: one transient failure during a full walk disables its
dirty-driven half until some other full run happens. At the shipped
defaults this is self-healing — the run-count trigger delivers a clean full
walk within its threshold and the term comes back — and pending keeps
counting either way, so the trigger is never wholly dead. Left as a
documented interaction because the alternative is config-dependent guard
logic that trades this latch for the one the guard exists to prevent.
Source code in src/noesis/core/state.py
1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 | |
scoped_runs_since_full(conn, project_id)
¶
Scoped runs started since the last completed full walk (ADR-57).
What this measures is "has a full walk happened recently", not "has a drain happened". The two come apart, and the distinction is deliberate.
A full run that finishes done with contained per-file failures
(ADR-41) is not a clean run, and it still resets this counter. Since
ADR-60 such a run does take the drain branch when its failures are all
attributable — the set is rewritten to the paths it could not verify — but
it does not drain to empty, and an unattributable failure still takes no
drain at all. So the gap between "a full walk happened" and "a drain
happened" narrowed without closing, and what this counter measures is
still the former. That looks
wrong until you price the alternative: requiring a clean full run means a
project with a permanently unreadable directory can never reset, so
every launch past the threshold promotes. Measured at threshold 3 over 12
watcher runs on such a project: 3 full walks under this rule versus 9 under
a clean-only rule — every run, on the population issue #25 is about, where
the walk is slowest (9p/network mounts, ADR-45).
That comparison isolates this trigger (promote_candidate_fraction at
0), and it is only representative of the shipped defaults because the
fraction trigger is separately stopped from latching the same way: it
excludes the H1 dirty set once a ledger row makes that set undrainable
(see jobs._promotion_reason). Before that fix the two latches
compounded and the real figure at defaults was worse than the 3 quoted here
— which is what the PR #30 review caught.
Nor would that have bought a drain at the time. Until ADR-60 the drain was blocked by the discovery error itself rather than by the promotion cadence, so promoting harder just re-walked a tree that still could not be drained — the gap issue #28 recorded. ADR-60 closed it in the other direction: a promoted full walk on a project with an attributable fault now rewrites the dirty set to the unverified remainder instead of leaving it pinned, so the periodic promotion this counter drives is what turns the old unbounded ramp into a bounded sawtooth. Promoting harder still would not help — the remainder is the floor, and no cadence gets under it.
The cost of this rule is bounded and self-healing: a transient failure on a full run delays the drain by one promotion cycle, and the next full run is clean and drains to empty.
A failed full run is different and does not reset: it may have stopped before walking anything, so it is not evidence a full walk happened at all.
scoped IS NULL rows predate the column. They are read as full walks for
the baseline and never counted as scoped, so the counter simply starts from
zero on an upgraded DB rather than inheriting a fabricated history.
Source code in src/noesis/core/state.py
1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 | |
log_query(conn, *, interface, kind, project_id, channel=None, reranked=None, latency_ms=None, result_count=None)
¶
Metadata-only usage telemetry (ADR-40): never stores query text.
Source code in src/noesis/core/state.py
1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 | |
bump_watcher_stats(conn, project_id, *, events_seen=0, events_coalesced=0, auto_runs=0)
¶
Source code in src/noesis/core/state.py
1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 | |
get_setting(conn, key)
¶
Source code in src/noesis/core/state.py
1297 1298 1299 1300 1301 | |
set_setting(conn, key, value)
¶
Source code in src/noesis/core/state.py
1304 1305 1306 1307 1308 1309 1310 | |
noesis.core.watcher
¶
File watcher — near-real-time index freshness (Overview §4.9, ADR-40).
At most two watchdog observers serve every watched project: the native
Observer (inotify on Linux) for roots on ordinary filesystems, and a
PollingObserver for roots on filesystems where inotify is silently blind —
network/host-passthrough mounts like WSL2's 9p drvfs (/mnt/c), CIFS,
NFS, sshfs. On those, the kernel never delivers inotify events, so a watch
schedules cleanly yet the handler never fires; polling is the only signal.
Each observer's event thread does string checks only — no hashing, no file
reads, no DB access — so watching never contends with the editor writing
the file (stakeholder requirement: lightweight). Events are marshalled onto the
asyncio loop, debounced and coalesced per (project, path), then written to
pending_changes — the dashboard's "files awaiting reindex" view. For a
project with auto_reindex enabled, a quiet period after the last event
triggers a scoped run over exactly the pending paths (never a full
re-embed; the run's own discovery + hash comparison stay authoritative).
Filtering here is deliberately a cheap approximation of discovery's rules (EXCLUDED_DIRS, secret + lockfile skip-lists, editor temp noise, the root .gitignore). Anything that slips through is at worst a cosmetic pending row: the scoped run re-applies discovery in full, and its clear step removes the row afterward. Nested .gitignore semantics are intentionally not replicated in the event path — correctness lives in the run, not the filter.
logger = logging.getLogger(__name__)
module-attribute
¶
WatcherManager(ctx, *, debounce_s=0.5, quiet_s=2.0, poll_interval_s=1.0)
¶
Owns the observers, the debounce consumer, and per-project watches.
Constructed once in the app lifespan (ctx.watcher). Each observer
thread (native inotify, and the polling fallback for inotify-blind
mounts) starts lazily on the first watch that needs it, so test apps
with no watched projects never spawn either. debounce_s is the flush
cadence for pending rows; quiet_s is the no-events window required
before an auto-reindex fires (a save burst becomes one scoped run, not
N); poll_interval_s is the PollingObserver snapshot cadence (config
watcher.poll_interval_s) — only polled roots pay it.
Source code in src/noesis/core/watcher.py
195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
debounce_s = debounce_s
instance-attribute
¶
quiet_s = quiet_s
instance-attribute
¶
poll_interval_s = poll_interval_s
instance-attribute
¶
start()
¶
Register watches for every watch_enabled project and start the consumer. Called from the app lifespan (loop is running).
Source code in src/noesis/core/watcher.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | |
stop()
async
¶
Source code in src/noesis/core/watcher.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 | |
set_watch(project_id, enabled)
¶
Live toggle from the dashboard. The flag is already persisted by the caller (core.dashboard); this only (un)schedules the OS watch.
Source code in src/noesis/core/watcher.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | |
watching(project_id)
¶
Source code in src/noesis/core/watcher.py
314 315 | |
mode(project_id)
¶
"polling"/"native" for a watched project, None otherwise.
The dashboard shows a "polling" tag so degraded-signal roots (9p,
network mounts) are visible, not just logged.
Source code in src/noesis/core/watcher.py
317 318 319 320 321 322 323 324 325 326 | |
noesis.core.telemetry
¶
Usage telemetry — metadata-only query logging (ADR-40).
Feeds the dashboard's usage page. Records that a query happened and how it performed (interface, kind, channel, latency, result count) — never the query text: queries routinely quote proprietary code, and a local DB is still a file that gets backed up, synced, and pasted into bug reports (ADR-25 spirit). Logging is fire-and-forget: a telemetry failure must never fail — or delay — the search that triggered it.
Writes are handed to a dedicated writer thread over a bounded queue and
never touch the caller's ctx.conn. Two reasons, both from the
dual-transport deployment (HTTP server + stdio MCP sharing one DB file):
ctx.connhasbusy_timeout=5000, so an INSERT contending with the other process's index-run writes would stall the event loop up to 5s.- Even off the loop, an awaited write keeps the response waiting on that contention. Enqueueing returns immediately, so the query path pays nothing beyond a queue put.
The writer owns its own connections (one per DB path, busy_timeout=250)
and is the only thread that touches them, so no lock is needed. On a full
queue or a busy DB the row is dropped: telemetry may lose a row, never slow
a query.
:class:QueryTelemetry holds all of that as instance state, and every
AppContext owns one (ADR-59). That is what makes close() terminal:
once a context tears its writer down, a late record_query drops its row
instead of opening a fresh state.connect() handle the closing context
will never reap. Terminality costs nothing here because there is no global
to reset — a second context simply constructs a second writer, open from
birth. LocalSTEmbedder is the same shape for the same reason
(embedder.py: _closed, a terminal idempotent close(), and a
_submit that refuses afterwards).
Dropping a late row is the right side to err on, and is not the same choice
LocalSTEmbedder makes: a refused embedding is a correctness loss, so it
raises; a refused telemetry row is this module's documented contract, so it
returns quietly at DEBUG.
The bounded join at teardown is MCP-1's, not a caveat about ownership: a
writer stuck on a foreign lock is abandoned rather than waited on forever.
An abandoned writer keeps its own queue with the shutdown sentinel still in
it, so it stops itself once the backlog clears, and it holds no reference
back to the :class:QueryTelemetry that started it — an abandoned thread
must not keep an entire AppContext alive.
Consequence worth knowing: the usage page is eventually consistent. A query
is normally readable within microseconds, but it is not guaranteed to be
there the instant the response returns — under the contention above it can
lag up to 250ms or be dropped entirely. Anything that needs read-your-writes
(tests, mainly) must await :meth:QueryTelemetry.flush.
logger = logging.getLogger(__name__)
module-attribute
¶
QueryTelemetry(queue_max=_QUEUE_MAX)
¶
One query-telemetry writer, owned by one AppContext (ADR-59).
The worker thread starts lazily on the first accepted row (daemon, so
never calling :meth:close is safe) and stops at :meth:close, which
is terminal and idempotent. Two live contexts in one process therefore
have two independent writers: neither one's teardown can discard the
other's queued rows, retire the other's worker, or leave a handle to the
other's DB open. That is a mechanism, not an invariant — the point of
issue #27.
queue_max bounds the backlog. It is a constructor argument rather than a module constant to monkeypatch, which is the same thing instance state buys everywhere else here: a test that wants a small queue builds a small writer instead of mutating one every other test shares.
Source code in src/noesis/core/telemetry.py
165 166 167 168 169 | |
record_query(conn, *, interface, kind, project_id, channel=None, reranked=None, latency_ms=None, result_count=None)
async
¶
Queue one metadata-only usage row and return.
conn is the caller's shared connection, and is used on the caller's own thread only — to name the DB file the writer should open, or to write inline when there is no file to open. The writer thread never touches it.
Source code in src/noesis/core/telemetry.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
flush(timeout=5.0)
async
¶
Wait until every row queued so far has been written.
The write is asynchronous by design, so anything that reads a row back right after recording it (tests, and the dashboard's usage page if it ever wants read-your-writes) needs this barrier. Returns when the rows land or timeout elapses; it never raises.
Source code in src/noesis/core/telemetry.py
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 | |
close(timeout=5.0)
¶
Stop the writer thread, draining what is already queued.
Terminal and idempotent: after this, :meth:record_query drops rows
rather than starting a second worker. Called from
close_runtime_context beside ctx.conn.close() so the
telemetry handles do not outlive the runtime that created them — an
open second handle to the state DB blocks temp-directory cleanup on
Windows and WSL, and survives a DB file removal. Bounded like the
model workers (MCP-1): a stuck writer is abandoned, never waited on
forever.
Source code in src/noesis/core/telemetry.py
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
noesis.core.dashboard
¶
Dashboard read models + settings mutations (M8, ADR-40).
All SQL and aggregation for the human monitoring surface lives here —
api/dashboard.py renders templates and forwards JSON, nothing more
(thin-adapter rule). Everything reads the local SQLite state; nothing here
may perform network I/O (CLAUDE.md rule 2).
logger = logging.getLogger(__name__)
module-attribute
¶
VALID_DEVICES = ('auto', 'cuda', 'mps', 'cpu')
module-attribute
¶
overview(ctx)
¶
The GET / read model: every project's health at a glance.
Source code in src/noesis/core/dashboard.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | |
project_detail(ctx, project_id)
¶
Per-project drill-down: pending files, recent runs, failed files.
Source code in src/noesis/core/dashboard.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | |
usage(ctx, days=30)
¶
The usage-page read model (ADR-40): index activity, index health, search usage, watcher activity — everything derived, nothing stored beyond what the run/query/watcher tables already hold.
Source code in src/noesis/core/dashboard.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | |
set_project_flags(ctx, project_id, *, watch_enabled=None, auto_reindex=None)
¶
Persist watcher flags and apply them live. Enabling auto_reindex on a project with pending changes triggers an immediate catch-up scoped run — the toggle means "keep me fresh", not "keep me fresh starting with the next keystroke".
Source code in src/noesis/core/dashboard.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | |
reindex_pending(ctx, project_id)
¶
Dashboard action: scoped run over the current pending set (or a plain incremental run when nothing is pending — the button always means "make it fresh now").
Source code in src/noesis/core/dashboard.py
412 413 414 415 416 417 418 419 420 421 422 423 | |
device_info(ctx)
¶
Current compute-device state for the dashboard settings surface.
Source code in src/noesis/core/dashboard.py
436 437 438 439 440 441 442 443 444 445 446 447 | |
set_compute_device(ctx, device)
¶
Persist the device choice and hot-retarget the loaded models (generation-bump reload, ADR-40). Raises ValueError on an invalid value or when config.toml pins either model's device (operator config wins).
Source code in src/noesis/core/dashboard.py
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 | |
delete_project(ctx, project_id)
async
¶
Remove a project's index state entirely (ADR-43): cancel its running index task, unschedule its watch, drop its Qdrant points, delete its SQLite rows. Touches ONLY derived index state — never the project's source tree. Returns False for an unknown project.
Order matters: the watch goes first, then runs are drained, then points, then rows — everything that could write must be silenced before the wipe.
The watch is unscheduled before the drain because draining awaits, and
an await hands the loop back to the watcher's consumer task. Its
_maybe_auto_reindex gates on auto_reindex alone — never on
watch_enabled — so the instant the cancelled run is marked failed it
would happily start a fresh one for this project and that run, never
cancelled, would write points after the wipe. set_watch(False) is
what actually disarms it: it drops the project's _last_event bucket,
which is the collection that method iterates.
The drain loops rather than cancelling once: the watcher is not the only
launcher. A concurrent REST/MCP reindex can win the same window, and
a single cancel-then-wipe would sail straight past it. Each pass costs at
most one file's upsert, and the bound keeps a pathological relaunch storm
from wedging the request — the startup sweep reclaims anything that
somehow still slips through.
The cancelled task is awaited, not just cancelled, and that await is
only meaningful because indexer.execute_run shields its upsert and waits
out the in-flight write before dying: cancelling a task parked on
await asyncio.to_thread(...) otherwise returns at once while the
worker thread runs on, landing its points after the wipe and orphaning
them under a dead project_id. The two halves are one fix — dropping
either reopens the leak. runtime.py's startup sweep is the backstop for
the orphans no wipe could prevent (a killed process).
Source code in src/noesis/core/dashboard.py
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 | |
supported_languages()
¶
Canonical languages Noesis indexes, with their extensions and whether structural (AST) search supports them. Static — derived from the language maps.
Source code in src/noesis/core/dashboard.py
532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 | |
browse_dir(path=None)
¶
List sub-directories for the register folder-picker (ADR-42).
Directories only, never file contents — the picker chooses a project root. Localhost-only surface (rule 2); errors on an unreadable or non-directory path. Defaults to the user's home directory.
Source code in src/noesis/core/dashboard.py
566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 | |
preview_scan(ctx, root_path, *, index_languages=None, max_file_bytes=None, follow_symlinks=False, extra_ignores=None)
async
¶
Pre-flight: run discovery only (no hashing, no embed, no state write) and report what WOULD be indexed — file count + per-language breakdown (ADR-42). The same walk a real index does, in a threadpool so it never blocks the event loop.
Source code in src/noesis/core/dashboard.py
593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 | |
register_project(ctx, root_path, *, watch=False, auto_reindex=False, index_languages=None, max_file_bytes=None, follow_symlinks=False, extra_ignores=None, index_now=False)
¶
Register a project from the dashboard (ADR-42), persist its index scope + watcher flags, optionally start the first index. Raises ValueError on a missing directory or the mixed-model guard.
index_now=False registers without indexing (the 'Add only' action);
True also launches the first run ('Add + index now').
Source code in src/noesis/core/dashboard.py
631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 | |