Restore resourcetype on the addressbook collection
Minimization round 1 broke every sync: the bootstrap PROPFIND (fixture
09, recorded here for the first time — it was in the working logs all
along but the original fixture extraction sampled the wrong ranges and
missed it) needs the collection to identify as an address book. The
client asked, received only getctag and sync-token, retried once, and
dropped the account data.

Assisted-by: GLM 5.2 via pi
change vylkvnrzsmovrtmunknkktnuxvzultxo
commit 6da3a40aa96fb83bab3233ee69d3a167ec09dedb
author Alpha Chen <alpha@kejadlen.dev>
date
parent wypklyxo
diff --git a/lib/pro_tacts/web.rb b/lib/pro_tacts/web.rb
index 9483607..4ca5cf6 100644
--- a/lib/pro_tacts/web.rb
+++ b/lib/pro_tacts/web.rb
@@ -205,6 +205,10 @@ module ProTacts
                   <d:href>/dav/addressbook/</d:href>
                   <d:propstat>
                     <d:prop>
+                      <d:resourcetype>
+                        <d:collection/>
+                        <card:addressbook/>
+                      </d:resourcetype>
                       <cs:getctag>#{collection_ctag}</cs:getctag>
                       <d:sync-token>http://pro-tacts/sync/1</d:sync-token>
                     </d:prop>
diff --git a/test/fixtures/macos-exchange/05-propfind-addressbook-ctag/response b/test/fixtures/macos-exchange/05-propfind-addressbook-ctag/response
index 727e6d6..84ccedf 100644
--- a/test/fixtures/macos-exchange/05-propfind-addressbook-ctag/response
+++ b/test/fixtures/macos-exchange/05-propfind-addressbook-ctag/response
@@ -7,6 +7,10 @@ Content-Type: text/xml
   <d:href>/dav/addressbook/</d:href>
   <d:propstat>
     <d:prop>
+      <d:resourcetype>
+        <d:collection/>
+        <card:addressbook/>
+      </d:resourcetype>
       <cs:getctag>ctag-1</cs:getctag>
       <d:sync-token>http://pro-tacts/sync/1</d:sync-token>
     </d:prop>
diff --git a/test/fixtures/macos-exchange/09-propfind-addressbook-bootstrap/request b/test/fixtures/macos-exchange/09-propfind-addressbook-bootstrap/request
new file mode 100644
index 0000000..436e176
--- /dev/null
+++ b/test/fixtures/macos-exchange/09-propfind-addressbook-bootstrap/request
@@ -0,0 +1,30 @@
+PROPFIND /dav/addressbook/ HTTP/1.1
+Brief: t
+Content-Type: text/xml
+Depth: 1
+Prefer: return=minimal
+
+<?xml version="1.0" encoding="UTF-8"?>
+<A:propfind xmlns:A="DAV:">
+  <A:prop>
+    <A:add-member/>
+    <D:bulk-requests xmlns:D="http://me.com/_namespace/"/>
+    <A:current-user-privilege-set/>
+    <A:displayname/>
+    <D:guardian-restricted xmlns:D="http://me.com/_namespace/"/>
+    <B:max-image-size xmlns:B="urn:ietf:params:xml:ns:carddav"/>
+    <B:max-resource-size xmlns:B="urn:ietf:params:xml:ns:carddav"/>
+    <C:me-card xmlns:C="http://calendarserver.org/ns/"/>
+    <A:owner/>
+    <C:push-transports xmlns:C="http://calendarserver.org/ns/"/>
+    <C:pushkey xmlns:C="http://calendarserver.org/ns/"/>
+    <E:quota-available xmlns:E="urn:mobileme:davservices"/>
+    <A:quota-available-bytes/>
+    <E:quota-used xmlns:E="urn:mobileme:davservices"/>
+    <A:quota-used-bytes/>
+    <A:resource-id/>
+    <A:resourcetype/>
+    <A:supported-report-set/>
+    <A:sync-token/>
+  </A:prop>
+</A:propfind>
diff --git a/test/fixtures/macos-exchange/09-propfind-addressbook-bootstrap/response b/test/fixtures/macos-exchange/09-propfind-addressbook-bootstrap/response
new file mode 100644
index 0000000..949f97e
--- /dev/null
+++ b/test/fixtures/macos-exchange/09-propfind-addressbook-bootstrap/response
@@ -0,0 +1,31 @@
+207
+Content-Type: text/xml
+
+<?xml version="1.0" encoding="UTF-8"?>
+<d:multistatus xmlns:d="DAV:" xmlns:card="urn:ietf:params:xml:ns:carddav" xmlns:cs="http://calendarserver.org/ns/">
+  <d:response>
+  <d:href>/dav/addressbook/</d:href>
+  <d:propstat>
+    <d:prop>
+      <d:resourcetype>
+        <d:collection/>
+        <card:addressbook/>
+      </d:resourcetype>
+      <cs:getctag>ctag-1</cs:getctag>
+      <d:sync-token>http://pro-tacts/sync/1</d:sync-token>
+    </d:prop>
+    <d:status>HTTP/1.1 200 OK</d:status>
+  </d:propstat>
+</d:response>
+
+  <d:response>
+  <d:href>/dav/addressbook/AB12C345-6789-0DEF-1234-567890ABCDEF.vcf</d:href>
+  <d:propstat>
+    <d:prop>
+      <d:getetag>"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2"</d:getetag>
+    </d:prop>
+    <d:status>HTTP/1.1 200 OK</d:status>
+  </d:propstat>
+</d:response>
+
+</d:multistatus>