Compare commits

..
3 Commits
Author SHA1 Message Date
Andrew S Erwin dbf4a896c3 release 0.3.5: bump federated service VERSION, installer image version and mcp package version
release gate / check (push) Failing after 5m43s
release / smoke (push) Successful in 10m28s
release / publish (push) Failing after 9m54s
2026-11-24 11:13:38 -06:00
Andrew S Erwin 0ce74551ac CalDAV: send comp-filter, not comp, in calendar-query (RFC 4791)
sabre/dav (Nextcloud) silently ignores unknown elements inside <filter>
and 400s with 'The {caldav}filter element is required' when no comp-filter
parses — so every calendar REPORT failed against real Nextcloud while the
fakes (which ignored REPORT bodies) stayed green. Reproduced against
Nextcloud 34.0.3 with a throwaway user: comp -> 400, comp-filter -> 207.
fakeCaldav now validates the REPORT body like sabre and returns the same
400, so the integration suite catches this class of bug.
2026-11-23 21:45:22 -06:00
Andrew S Erwin eff81e4d8d Settings: remove the Contacts sync tab; the sync API remains
The single-config Nextcloud Contacts sync tab is gone — the unified
Nextcloud tab is the UI path for connecting an account. POST
/api/contacts/sync is untouched (Contact rows still feed contact-linking;
the handler is stateless, so no persisted config orphans). Legacy
?tab=nextcloud deep links map to the unified tab on first render and clean
the URL; CardDAV/help wording follows. Regression asserts the tab is gone
and the legacy deep link lands on the Nextcloud form.
2026-11-23 16:09:17 -06:00
13 changed files with 69 additions and 69 deletions
+3 -1
View File
@@ -242,7 +242,9 @@ against each protocol (parallel netguard-pinned probes sharing the siblings'
that passes. This is orchestration, not a fourth connector: every sibling's that passes. This is orchestration, not a fourth connector: every sibling's
plan gate, validation (including CardDAV's https/443 pin), caps and projections plan gate, validation (including CardDAV's https/443 pin), caps and projections
apply unchanged, and materialization stays on the siblings' `/sync` surfaces. apply unchanged, and materialization stays on the siblings' `/sync` surfaces.
The separate Contacts sync is untouched. The separate Contacts sync API (`POST /api/contacts/sync`) is untouched, but
its settings tab was removed — the unified Nextcloud tab is the UI path, and
legacy `?tab=nextcloud` deep links redirect to it.
| Method | Path | Returns / behavior | | Method | Path | Returns / behavior |
|---|---|---| |---|---|---|
+20
View File
@@ -7,6 +7,26 @@ Versions correspond to git tags and to the published image set
(the line was reset to 0.2.x at 0.2.14 — Superbrain is pre-beta). (the line was reset to 0.2.x at 0.2.14 — Superbrain is pre-beta).
Dates are tag dates. Dates are tag dates.
## 0.3.5 — 2026-11-24
### Fixed
- **CalDAV against real Nextcloud**: the calendar-query REPORT now sends
`comp-filter` (RFC 4791 §9.8) instead of `comp`. sabre/dav silently ignores
unknown elements inside `<filter>` and answers 400 ("The {caldav}filter
element is required") when no `comp-filter` parses, so every calendar's
event fetch failed against Nextcloud while discovery succeeded — syncs
recorded success with zero events and no `lastError`. Reproduced against
Nextcloud 34.0.3 (`comp` → 400, `comp-filter` → 207); `fakeCaldav` now
validates REPORT bodies like sabre so the integration suite catches this
class of bug.
### Removed
- **Contacts sync settings tab**: the single-config Nextcloud Contacts sync
UI is gone — the unified Nextcloud tab is the UI path.
`POST /api/contacts/sync` is untouched (Contact rows still feed
contact-linking; the handler is stateless). Legacy `?tab=nextcloud` deep
links land on the unified tab.
## 0.3.4 — 2026-11-23 ## 0.3.4 — 2026-11-23
### Changed ### Changed
+1 -1
View File
@@ -48,7 +48,7 @@ SUPERBRAIN_APP_IP="192.168.0.94"
SUPERBRAIN_MIGRATE_IP="192.168.0.95" SUPERBRAIN_MIGRATE_IP="192.168.0.95"
# Release to install; the generic `upgrade` flow keeps .env in step with the # Release to install; the generic `upgrade` flow keeps .env in step with the
# service file's VERSION afterwards. # service file's VERSION afterwards.
SUPERBRAIN_IMAGE_VERSION="0.3.4" SUPERBRAIN_IMAGE_VERSION="0.3.5"
# render_superbrain_compose writes the app-dir compose file. Called by # render_superbrain_compose writes the app-dir compose file. Called by
# config_superbrain (install) and by deploy/federated/update.sh after a lib # config_superbrain (install) and by deploy/federated/update.sh after a lib
+1 -1
View File
@@ -2,7 +2,7 @@ NAME=superbrain
DESCRIPTION="Bookmark & Knowledge Base" DESCRIPTION="Bookmark & Knowledge Base"
DOCS=https://github.com/andrew/superbrain DOCS=https://github.com/andrew/superbrain
CONTAINER=federatedcomputer/superbrain-app CONTAINER=federatedcomputer/superbrain-app
VERSION=0.3.4 VERSION=0.3.5
INTERNAL_IP=192.168.0.93 INTERNAL_IP=192.168.0.93
DEPENDS="postgresql" DEPENDS="postgresql"
PORTS=3000 PORTS=3000
+7 -2
View File
@@ -228,12 +228,17 @@ func Events(ctx context.Context, conn Conn, calURL string) (*EventResult, error)
return out, nil return out, nil
} }
// calQueryBody uses comp-filter (RFC 4791 §9.8) — NOT "comp": sabre/dav
// (Nextcloud) silently ignores unknown elements inside <filter>, then 400s
// with "The {caldav}filter element is required" when no comp-filter parsed.
// The fakes once ignored REPORT bodies entirely and missed this; fakeCaldav
// now validates the body like sabre does.
const calQueryBody = `<?xml version="1.0" encoding="utf-8"?>` + const calQueryBody = `<?xml version="1.0" encoding="utf-8"?>` +
`<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">` + `<C:calendar-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav">` +
`<D:prop><D:getetag/><C:calendar-data/></D:prop>` + `<D:prop><D:getetag/><C:calendar-data/></D:prop>` +
`<C:filter><C:comp name="VCALENDAR"><C:comp name="VEVENT">` + `<C:filter><C:comp-filter name="VCALENDAR"><C:comp-filter name="VEVENT">` +
`<C:time-range start="%s" end="%s"/>` + `<C:time-range start="%s" end="%s"/>` +
`</C:comp></C:comp></C:filter></C:calendar-query>` `</C:comp-filter></C:comp-filter></C:filter></C:calendar-query>`
// --- PROPFIND plumbing ------------------------------------------------------- // --- PROPFIND plumbing -------------------------------------------------------
+12
View File
@@ -78,6 +78,18 @@ func (f *fakeCaldav) serve(w http.ResponseWriter, r *http.Request) {
<response><href>%s/personal/</href><propstat><prop xmlns:C="urn:ietf:params:xml:ns:caldav"><resourcetype><C:calendar/></resourcetype><displayname>Personal</displayname></prop></propstat></response> <response><href>%s/personal/</href><propstat><prop xmlns:C="urn:ietf:params:xml:ns:caldav"><resourcetype><C:calendar/></resourcetype><displayname>Personal</displayname></prop></propstat></response>
</multistatus>`, f.root, f.root, f.root) </multistatus>`, f.root, f.root, f.root)
case "REPORT": case "REPORT":
// Validate the query body like sabre/dav does: a calendar-query
// without a <filter> containing <comp-filter> is a 400 ("The
// {caldav}filter element is required"). The old fake ignored the
// body, which let a wrong element name ("comp" instead of
// "comp-filter") ship and fail against real Nextcloud.
raw, _ := io.ReadAll(io.LimitReader(r.Body, 1<<20))
if !strings.Contains(string(raw), "comp-filter") {
w.Header().Set("Content-Type", "application/xml")
w.WriteHeader(http.StatusBadRequest)
io.WriteString(w, `<?xml version="1.0"?><d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns"><s:exception>Sabre\DAV\Exception\BadRequest</s:exception><s:message>The {urn:ietf:params:xml:ns:caldav}filter element is required for this request</s:message></d:error>`)
return
}
key := strings.Trim(strings.TrimPrefix(r.URL.Path, f.root+"/"), "/") key := strings.Trim(strings.TrimPrefix(r.URL.Path, f.root+"/"), "/")
collection := f.events collection := f.events
if key == "personal" { if key == "personal" {
+1 -1
View File
@@ -91,7 +91,7 @@ func httpClient(conn Conn) *http.Client {
// ListTools connects, initializes and lists the server's tools, then closes // ListTools connects, initializes and lists the server's tools, then closes
// the session. The context bounds the whole exchange. // the session. The context bounds the whole exchange.
func ListTools(ctx context.Context, conn Conn) ([]Tool, error) { func ListTools(ctx context.Context, conn Conn) ([]Tool, error) {
client := mcpsdk.NewClient(&mcpsdk.Implementation{Name: "superbrain", Version: "0.3.4"}, nil) client := mcpsdk.NewClient(&mcpsdk.Implementation{Name: "superbrain", Version: "0.3.5"}, nil)
var transport mcpsdk.Transport var transport mcpsdk.Transport
hc := httpClient(conn) hc := httpClient(conn)
switch conn.Transport { switch conn.Transport {
+1 -1
View File
@@ -7,7 +7,7 @@ name = "superbrain-mcp"
# Versioned in lockstep with the Superbrain release it speaks to (house # Versioned in lockstep with the Superbrain release it speaks to (house
# tooling tracks one version per app); the federated mcpserver gateway # tooling tracks one version per app); the federated mcpserver gateway
# installs this package and spawns `superbrain-mcp` per linked instance. # installs this package and spawns `superbrain-mcp` per linked instance.
version = "0.3.4" version = "0.3.5"
description = "MCP server for Superbrain — bookmarks, tags and pages over the Superbrain REST API" description = "MCP server for Superbrain — bookmarks, tags and pages over the Superbrain REST API"
readme = "README.md" readme = "README.md"
requires-python = ">=3.10" requires-python = ">=3.10"
+1 -1
View File
@@ -1,3 +1,3 @@
"""Superbrain MCP server — bookmarks, tags and pages for AI tooling.""" """Superbrain MCP server — bookmarks, tags and pages for AI tooling."""
__version__ = "0.3.4" __version__ = "0.3.5"
+5
View File
@@ -908,6 +908,11 @@ try {
await page.goto(`${base}/settings`) await page.goto(`${base}/settings`)
await page.getByRole('tab', { name: 'Profile' }).click() await page.getByRole('tab', { name: 'Profile' }).click()
assert.equal(await page.getByRole('tab', { name: 'Automations', exact: true }).count(), 0, 'Automations tab still present in Settings') assert.equal(await page.getByRole('tab', { name: 'Automations', exact: true }).count(), 0, 'Automations tab still present in Settings')
// The Contacts sync tab is removed too; its legacy deep link lands on the
// unified Nextcloud tab (the sync API itself remains).
assert.equal(await page.getByRole('tab', { name: 'Contacts sync' }).count(), 0, 'Contacts sync tab still present in Settings')
await page.goto(`${base}/settings?tab=nextcloud`)
await page.getByPlaceholder('https://cloud.example.com').waitFor()
console.log('PASS: Automations lives in the sidebar with a task dropdown, deep-links to /automations, and the legacy settings tab redirects') console.log('PASS: Automations lives in the sidebar with a task dropdown, deep-links to /automations, and the legacy settings tab redirects')
// Mobile pass (390x844): the shell becomes a drawer, tables become cards, // Mobile pass (390x844): the shell becomes a drawer, tables become cards,
+14 -58
View File
@@ -5,9 +5,8 @@ import { useSearchParams, useRouter } from 'next/navigation'
import { Button } from '@/components/ui/button' import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input' import { Input } from '@/components/ui/input'
import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs' import { Tabs, TabsList, TabsTrigger, TabsContent } from '@/components/ui/tabs'
import { User, Mail, Server, Cloud, CloudCog, Shield, Bell, Bot, KeyRound, PlugZap, FolderSync, CalendarDays, BookUser, ArrowLeft, Check, X, AlertTriangle } from 'lucide-react' import { User, Mail, Server, CloudCog, Shield, Bell, Bot, KeyRound, PlugZap, FolderSync, CalendarDays, BookUser, ArrowLeft, Check, X, AlertTriangle } from 'lucide-react'
import { toast } from 'sonner' import { toast } from 'sonner'
import { invalidateReference } from '@/lib/reference-data'
import { NotificationsSettings } from '@/components/notifications-settings' import { NotificationsSettings } from '@/components/notifications-settings'
import { ProfileSettings } from '@/components/profile-settings' import { ProfileSettings } from '@/components/profile-settings'
import { AiSettings } from '@/components/ai-settings' import { AiSettings } from '@/components/ai-settings'
@@ -36,7 +35,6 @@ const NAV_GROUPS = [
{ value: 'webdav', label: 'WebDAV', icon: FolderSync }, { value: 'webdav', label: 'WebDAV', icon: FolderSync },
{ value: 'caldav', label: 'CalDAV', icon: CalendarDays }, { value: 'caldav', label: 'CalDAV', icon: CalendarDays },
{ value: 'carddav', label: 'CardDAV', icon: BookUser }, { value: 'carddav', label: 'CardDAV', icon: BookUser },
{ value: 'nextcloud', label: 'Contacts sync', icon: Cloud },
{ value: 'imap', label: 'IMAP', icon: Mail }, { value: 'imap', label: 'IMAP', icon: Mail },
] }, ] },
{ label: 'AI & Automation', items: [ { label: 'AI & Automation', items: [
@@ -57,15 +55,23 @@ export function SettingsClient({ oidc, callbackUrl }: { oidc: OidcStatus; callba
const router = useRouter() const router = useRouter()
// Automations moved out of Settings to its own workspace; legacy deep // Automations moved out of Settings to its own workspace; legacy deep
// links (?tab=automations) redirect there instead of falling back to profile. // links (?tab=automations) redirect there instead of falling back to profile.
useEffect(() => { if (requestedTab === 'automations') router.replace('/automations') }, [requestedTab, router]) // The Contacts sync tab was removed — its legacy ?tab=nextcloud deep link
const initialSection = NAV_GROUPS.some(g => g.items.some(i => i.value === requestedTab)) // lands on the unified Nextcloud tab (the sync API itself remains).
? requestedTab useEffect(() => {
if (requestedTab === 'automations') router.replace('/automations')
if (requestedTab === 'nextcloud') router.replace('/settings?tab=nextcloud-connect')
}, [requestedTab, router])
// The Contacts sync tab was removed — its legacy ?tab=nextcloud deep link
// lands on the unified Nextcloud tab (the sync API itself remains). Map the
// legacy value BEFORE deriving the initial section so the tab is selected
// on first render; the effect above only cleans the URL.
const mappedTab = requestedTab === 'nextcloud' ? 'nextcloud-connect' : requestedTab
const initialSection = NAV_GROUPS.some(g => g.items.some(i => i.value === mappedTab))
? mappedTab
: 'profile' : 'profile'
const [imapConfig, setImapConfig] = useState({ host: '', port: 993, tls: true, username: '', password: '', folder: 'INBOX' }) const [imapConfig, setImapConfig] = useState({ host: '', port: 993, tls: true, username: '', password: '', folder: 'INBOX' })
const [ncConfig, setNcConfig] = useState({ nextcloudUrl: '', cardDavPath: '', username: '', password: '' })
const [savingImap, setSavingImap] = useState(false) const [savingImap, setSavingImap] = useState(false)
const [testingImap, setTestingImap] = useState(false) const [testingImap, setTestingImap] = useState(false)
const [syncingContacts, setSyncingContacts] = useState(false)
const [section, setSection] = useState(initialSection) const [section, setSection] = useState(initialSection)
// Below md the grouped nav becomes a list -> detail flow (same // Below md the grouped nav becomes a list -> detail flow (same
// master-detail pattern as collections/tags/contacts); at md+ the // master-detail pattern as collections/tags/contacts); at md+ the
@@ -113,32 +119,6 @@ export function SettingsClient({ oidc, callbackUrl }: { oidc: OidcStatus; callba
finally { setTestingImap(false) } finally { setTestingImap(false) }
} }
const syncContacts = async () => {
if (!ncConfig.nextcloudUrl || !ncConfig.username || !ncConfig.password) {
toast.error('Fill in Nextcloud URL, username, and password')
return
}
setSyncingContacts(true)
try {
const res = await fetch('/api/contacts/sync', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(ncConfig),
})
const data = await res.json().catch(() => null)
if (res.ok && data?.synced !== undefined) {
// Review CR-07: the sync mirrors the address book — remotely deleted
// contacts are removed too (scoped to this source, never from partial
// responses). Surface both counts so the policy is visible.
const removed = typeof data.removed === 'number' && data.removed > 0 ? `, removed ${data.removed} deleted on the server` : ''
toast.success(`Synced ${data.synced} contacts${removed}`)
invalidateReference('contacts')
}
else toast.error(data?.error ?? 'Sync failed')
} catch { toast.error('Sync failed') }
finally { setSyncingContacts(false) }
}
return ( return (
<div className="max-w-5xl space-y-6"> <div className="max-w-5xl space-y-6">
<div> <div>
@@ -223,30 +203,6 @@ export function SettingsClient({ oidc, callbackUrl }: { oidc: OidcStatus; callba
</TabsContent> </TabsContent>
<TabsContent value="carddav" className="mt-0 space-y-4"> <TabsContent value="carddav" className="mt-0 space-y-4">
<CardDavSettings /> <CardDavSettings />
</TabsContent>
<TabsContent value="nextcloud" className="mt-0 space-y-4">
<div className="rounded-lg border p-4 space-y-3">
<h3 className="font-medium flex items-center gap-2"><Cloud className="h-4 w-4" /> Contacts sync (Nextcloud)</h3>
<div className="grid grid-cols-2 gap-3">
<div className="col-span-2">
<label className="text-xs font-medium text-muted-foreground">Nextcloud URL</label>
<Input value={ncConfig.nextcloudUrl} onChange={(e: React.ChangeEvent<HTMLInputElement>) => setNcConfig(p => ({ ...p, nextcloudUrl: e.target.value }))} placeholder="https://nextcloud.example.com" />
</div>
<div className="col-span-2">
<label className="text-xs font-medium text-muted-foreground">CardDAV Path (optional)</label>
<Input value={ncConfig.cardDavPath} onChange={(e: React.ChangeEvent<HTMLInputElement>) => setNcConfig(p => ({ ...p, cardDavPath: e.target.value }))} placeholder="/remote.php/dav/addressbooks/users/USER/contacts/" />
</div>
<div>
<label className="text-xs font-medium text-muted-foreground">Username</label>
<Input value={ncConfig.username} onChange={(e: React.ChangeEvent<HTMLInputElement>) => setNcConfig(p => ({ ...p, username: e.target.value }))} />
</div>
<div>
<label className="text-xs font-medium text-muted-foreground">App Password</label>
<Input type="password" value={ncConfig.password} onChange={(e: React.ChangeEvent<HTMLInputElement>) => setNcConfig(p => ({ ...p, password: e.target.value }))} />
</div>
</div>
<Button onClick={syncContacts} loading={syncingContacts}>Sync Contacts Now</Button>
</div>
</TabsContent> </TabsContent>
<TabsContent value="imap" className="mt-0 space-y-4"> <TabsContent value="imap" className="mt-0 space-y-4">
<div className="rounded-lg border p-4 space-y-3"> <div className="rounded-lg border p-4 space-y-3">
+1 -1
View File
@@ -94,7 +94,7 @@ const SECTIONS = [
icon: FolderSync, icon: FolderSync,
title: 'Connections', title: 'Connections',
body: [ body: [
'Settings connects Superbrain to your services: WebDAV shares, CalDAV calendars, CardDAV address books, Nextcloud contacts sync, and IMAP mailboxes. Credentials are stored encrypted and are write-only — the app never shows them back to you.', 'Settings connects Superbrain to your services: a unified Nextcloud connect (files, calendars & contacts), WebDAV shares, CalDAV calendars, CardDAV address books, and IMAP mailboxes. Credentials are stored encrypted and are write-only — the app never shows them back to you.',
'On Core deployments with Nextcloud, the connection forms offer a one-click prefill for your account.', 'On Core deployments with Nextcloud, the connection forms offer a one-click prefill for your account.',
], ],
where: 'Settings → Connections', where: 'Settings → Connections',
+2 -2
View File
@@ -167,8 +167,8 @@ export function CardDavSettings() {
<p className="text-sm text-muted-foreground mt-1"> <p className="text-sm text-muted-foreground mt-1">
Connect an address book from any CardDAV service. Each book becomes a Collection, one Connect an address book from any CardDAV service. Each book becomes a Collection, one
bookmark per contact, re-checked in the background every 30 minutes. Passwords are bookmark per contact, re-checked in the background every 30 minutes. Passwords are
encrypted at rest and never shown again. (This is separate from Contacts sync, which encrypted at rest and never shown again. (This is separate from the Contacts page,
feeds contact-linking.) which feeds contact-linking.)
</p> </p>
</div> </div>
{allowed && <Button size="sm" onClick={openCreate}><Plus className="h-4 w-4 mr-1" /> Connect address book</Button>} {allowed && <Button size="sm" onClick={openCreate}><Plus className="h-4 w-4 mr-1" /> Connect address book</Button>}