Commit 0f3cea5
committed
fix(mcp): report an absent integrity verdict instead of a clean one (#2290)
sqlite_integrity_errors answers [] when chroma.sqlite3 is not there, and the
MCP startup gate published that as checked: true, ok: true. A clean bill of
health and an unopened database were the same answer, and /statusz built its
health flag from it.
os.path.exists cannot separate the two: it is genericpath.exists, which calls
os.stat inside a try whose except folds every OSError and ValueError into
False, and os.stat follows symlinks. ENOENT from lstat is now the only answer
accepted as proof of absence; everything else falls through to the open
attempt, where SQLite reports it. An absent database gets the not-applicable
shape #1931 introduced, checked: false / ok: null plus a reason.
ENOENT does not say which path component was missing, so it proves something
about the path and not about the palace: a palace directory that is itself a
dangling symlink, and an unmounted mount point, both report no verdict rather
than a failed probe. That is the answer develop gives too, without develop's
claim that the check passed.
Every state that is not proven absent reaches the probe. Measured against
develop, six palace states out of nine answered checked: true, ok: true: an
absent database, a palace directory that does not exist, an intact database
under a mode-000 directory, a dangling symlink, a symlink loop, and a path
whose parent is a file. The last four now report PRAGMA quick_check failed and
so trip the existing -32002 refusal, as do an over-long name and an embedded
NUL. A database file at mode 000 already reported ok: false, because
os.path.exists is true there and the probe ran.
The absence question is asked once per call. Reaching the probe through
sqlite_integrity_errors would ask it again, and a database unlinked between
the two would answer [] the second time, which is the clean verdict this
change exists to withhold. The quick_check body moved to _quick_check_errors,
which has no absence gate, and both callers use it.
/statusz reads an absent verdict as healthy rather than unhealthy. develop
already answered ok: true for a palace with no database, through the clean
verdict this removes, so the change is what keeps the new ok: null from
turning a fresh install red; the visible flip is the non-chroma backends,
unhealthy since the #1931 fix. The default in integrity.get("ok", False) keeps
a payload with no ok key failing closed.
SqliteIntegrityStatus carries its errors as a tuple. With a list field the
generated __hash__ raised TypeError on every call and a caller could append to
a verdict it had been handed, so frozen=True described nothing.
Windows raises ENOENT where POSIX raises ENOTDIR for a file used as a
directory component, so there the palace path is proven absent and reported as
no verdict rather than as a failed probe. Both answers are safe; the
difference belongs to the platform, not to the gate. The ENOTDIR test is
scoped to POSIX for that reason.
The refresh clears the no-verdict reason on every one of its five exits,
including the two that return before any probe runs, so a server pointed at a
new palace cannot keep naming the old one's database.
The payload still reads those globals one at a time without the lock, and the
comments there no longer claim otherwise: a refresh landing between two reads
can publish ok: true for a palace with no database, and snapshotting into
locals moves that window rather than closing it. Closing it means publishing
the verdict as one value, which is a change to what the gate stores.1 parent 639c69a commit 0f3cea5
6 files changed
Lines changed: 727 additions & 31 deletions
File tree
- mempalace
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
355 | 362 | | |
356 | 363 | | |
357 | 364 | | |
| |||
838 | 845 | | |
839 | 846 | | |
840 | 847 | | |
841 | | - | |
842 | | - | |
843 | | - | |
844 | | - | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
845 | 853 | | |
846 | 854 | | |
847 | 855 | | |
| |||
853 | 861 | | |
854 | 862 | | |
855 | 863 | | |
| 864 | + | |
856 | 865 | | |
857 | 866 | | |
858 | 867 | | |
859 | 868 | | |
860 | 869 | | |
| 870 | + | |
861 | 871 | | |
862 | 872 | | |
863 | 873 | | |
| |||
871 | 881 | | |
872 | 882 | | |
873 | 883 | | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
874 | 890 | | |
875 | 891 | | |
876 | 892 | | |
| |||
884 | 900 | | |
885 | 901 | | |
886 | 902 | | |
887 | | - | |
| 903 | + | |
888 | 904 | | |
889 | | - | |
| 905 | + | |
890 | 906 | | |
891 | 907 | | |
892 | 908 | | |
893 | 909 | | |
894 | 910 | | |
| 911 | + | |
895 | 912 | | |
896 | | - | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
897 | 932 | | |
898 | 933 | | |
899 | 934 | | |
| |||
920 | 955 | | |
921 | 956 | | |
922 | 957 | | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
923 | 969 | | |
924 | 970 | | |
925 | 971 | | |
| |||
947 | 993 | | |
948 | 994 | | |
949 | 995 | | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
950 | 1014 | | |
951 | 1015 | | |
952 | 1016 | | |
| |||
6979 | 7043 | | |
6980 | 7044 | | |
6981 | 7045 | | |
6982 | | - | |
| 7046 | + | |
| 7047 | + | |
| 7048 | + | |
| 7049 | + | |
| 7050 | + | |
| 7051 | + | |
6983 | 7052 | | |
6984 | 7053 | | |
6985 | 7054 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
732 | 733 | | |
733 | 734 | | |
734 | 735 | | |
735 | | - | |
736 | | - | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
737 | 739 | | |
738 | | - | |
739 | | - | |
740 | | - | |
741 | | - | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
742 | 744 | | |
743 | | - | |
744 | | - | |
745 | | - | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
746 | 749 | | |
747 | 750 | | |
748 | | - | |
749 | | - | |
750 | | - | |
751 | | - | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 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 | + | |
752 | 801 | | |
753 | 802 | | |
754 | 803 | | |
| |||
775 | 824 | | |
776 | 825 | | |
777 | 826 | | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 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 | + | |
778 | 886 | | |
779 | 887 | | |
780 | 888 | | |
| |||
0 commit comments