@openparachute/vault 0.6.4-rc.6 → 0.6.4-rc.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/vault.test.ts CHANGED
@@ -1862,13 +1862,15 @@ describe("HTTP /notes", async () => {
1862
1862
  expect(body.map((n) => n.content)).toEqual(["plain"]);
1863
1863
  });
1864
1864
 
1865
- // ---- updated_at filter via date_field (vault#285 friction point 1.5) ----
1865
+ // ---- updated_at filter via bracket date (vault#285 friction point 1.5) ----
1866
1866
  //
1867
- // HTTP plumbing routes `date_field=updated_at&date_from=…` straight to
1868
- // the core `dateFilter` resolver, which now recognizes `updated_at` as
1869
- // a real column. Smoke-tests the end-to-end HTTP path; the engine-side
1870
- // semantics are exercised in core.test.ts.
1871
- test("GET /notes?date_field=updated_at filters by last-write time", async () => {
1867
+ // HTTP plumbing routes `meta[updated_at][gte]=…` straight to the core
1868
+ // `dateFilter` resolver, which recognizes `updated_at` as a real column.
1869
+ // Smoke-tests the end-to-end HTTP path; the engine-side semantics are
1870
+ // exercised in core.test.ts. (The flat `date_field=updated_at&date_from=…`
1871
+ // shape was removed in 0.6.4 vault#288 bracket-style is the only
1872
+ // query-string date filter.)
1873
+ test("GET /notes?meta[updated_at][gte]=… filters by last-write time", async () => {
1872
1874
  const a = await store.createNote("untouched", { id: "ua", path: "ua" });
1873
1875
  const b = await store.createNote("modified", { id: "ub", path: "ub" });
1874
1876
  // Bump b's updated_at into the test window, leave a's at its createdAt.
@@ -1878,7 +1880,7 @@ describe("HTTP /notes", async () => {
1878
1880
  .run("2026-04-25T00:00:00.000Z", b.id);
1879
1881
 
1880
1882
  const res = await handleNotes(
1881
- mkReq("GET", "/notes?date_field=updated_at&date_from=2026-04-01&include_content=true"),
1883
+ mkReq("GET", "/notes?meta[updated_at][gte]=2026-04-01&include_content=true"),
1882
1884
  store,
1883
1885
  "",
1884
1886
  );
@@ -2880,7 +2882,7 @@ describe("HTTP /notes", async () => {
2880
2882
  });
2881
2883
 
2882
2884
  // ---- Bridge: created_at / updated_at via brackets route to dateFilter ----
2883
- test("`meta[created_at][gte]=…` routes to dateFilter (same result as flat date_field)", async () => {
2885
+ test("`meta[created_at][gte]=…` routes to dateFilter", async () => {
2884
2886
  await store.createNote("old", { created_at: "2026-01-15T00:00:00.000Z" });
2885
2887
  await store.createNote("new", { created_at: "2026-04-15T00:00:00.000Z" });
2886
2888
 
@@ -2890,14 +2892,37 @@ describe("HTTP /notes", async () => {
2890
2892
  "",
2891
2893
  );
2892
2894
  const bracketBody = await bracketRes.json() as any[];
2893
- const flatRes = await handleNotes(
2895
+ expect(bracketBody.map((n) => n.content)).toEqual(["new"]);
2896
+ });
2897
+
2898
+ // ---- Removed: flat date params are now ignored (vault#288, breaking) ----
2899
+ // The flat `date_field` / `date_from` / `date_to` query params were
2900
+ // removed in 0.6.4. A request that passes ONLY the flat shape is no
2901
+ // longer date-filtered — it comes back unfiltered. Use bracket-style
2902
+ // (`meta[created_at][gte]=…`) instead. (The MCP `date_from`/`date_to`
2903
+ // shorthand is a separate, supported path and is unaffected.)
2904
+ test("flat date params (date_field/date_from/date_to) are ignored", async () => {
2905
+ await store.createNote("old", { created_at: "2026-01-15T00:00:00.000Z" });
2906
+ await store.createNote("new", { created_at: "2026-04-15T00:00:00.000Z" });
2907
+
2908
+ const targetedRes = await handleNotes(
2894
2909
  mkReq("GET", "/notes?date_field=created_at&date_from=2026-04-01&include_content=true"),
2895
2910
  store,
2896
2911
  "",
2897
2912
  );
2898
- const flatBody = await flatRes.json() as any[];
2899
- expect(bracketBody.map((n) => n.content)).toEqual(["new"]);
2900
- expect(bracketBody.map((n) => n.content)).toEqual(flatBody.map((n) => n.content));
2913
+ const targetedBody = await targetedRes.json() as any[];
2914
+ expect(targetedRes.status).toBe(200);
2915
+ // Both notes returned — the flat param did not filter.
2916
+ expect(targetedBody.map((n) => n.content).sort()).toEqual(["new", "old"]);
2917
+
2918
+ const bareRes = await handleNotes(
2919
+ mkReq("GET", "/notes?date_from=2026-04-01&include_content=true"),
2920
+ store,
2921
+ "",
2922
+ );
2923
+ const bareBody = await bareRes.json() as any[];
2924
+ expect(bareRes.status).toBe(200);
2925
+ expect(bareBody.map((n) => n.content).sort()).toEqual(["new", "old"]);
2901
2926
  });
2902
2927
 
2903
2928
  test("`meta[updated_at][gte]=…` routes to dateFilter on n.updated_at", async () => {
@@ -3047,13 +3072,14 @@ describe("HTTP /notes", async () => {
3047
3072
  expect(body.error).toContain("not_in");
3048
3073
  });
3049
3074
 
3050
- // ---- Precedence on overlap ----
3051
- test("when both flat and bracket date params overlap, bracket wins", async () => {
3075
+ // ---- Bracket applies; co-passed flat params are ignored (vault#288) ----
3076
+ test("bracket date filter applies even when removed flat params are also passed", async () => {
3052
3077
  await store.createNote("old", { created_at: "2026-01-15T00:00:00.000Z" });
3053
3078
  await store.createNote("new", { created_at: "2026-04-15T00:00:00.000Z" });
3054
- // Bracket says "from 2026-04-01"; flat says "from 2020-01-01". If
3055
- // flat won, both notes would match. The bracket-wins precedence is
3056
- // verified by getting back only the post-April note.
3079
+ // Bracket says "from 2026-04-01"; the (removed) flat params say "from
3080
+ // 2020-01-01". The flat params are now inert, so only the bracket
3081
+ // filter applies back comes only the post-April note. (Pre-0.6.4
3082
+ // this exercised bracket-wins precedence; flat is now simply ignored.)
3057
3083
  const res = await handleNotes(
3058
3084
  mkReq(
3059
3085
  "GET",