Count and merge captures by Postulo's posting_key and drop src/lib/address.js #50

Open
opened 2026-10-28 15:14:56 +00:00 by tiagoagueda · 0 comments
Owner

Body:

Postulo core #711 gives every capture on the API a posting_key: an opaque name for the posting at its address, the same for two captures of one posting however the address was spelled, different for two postings. It is a hash keyed by the instance's secret and the account, so the extension cannot compute it itself; Postulo hands it out:

  • on each row of GET /api/v1/captures, on the answer to POST /api/v1/captures and on the answer to PUT /api/v1/captures/{id}/rendering;
  • per asked address, from POST /api/v1/captures/known (posting_key beside url).

It is told to a token holding only captures, which is not told the address (core #761), so it is the one way this extension's token has of grouping the list at all.

What to do

  • src/lib/waiting.js (countPostings) and src/lib/review.js (reviewRows): group Postulo's rows by row.posting_key (or postulo: and the row's id where it is empty) instead of sameUrl(row.url). slimRow keeps posting_key.
  • Unsent captures held here: key each by the posting_key Postulo gives for its address. Ask POST /captures/known for it (the extension already asks it before sending; keep the key on the record), or, for a record that has none yet, fall back to here:${record.id}, so it counts on its own until Postulo has been asked.
  • Delete src/lib/address.js and its 31 cases; parse.js keeps its own sameUrl for picking the JSON-LD posting that names the page (#176), which is not about counting.
  • Against a Postulo older than #711 (no posting_key on a row) fall back to counting one per capture, or keep sameUrl for that case only until the minimum supported Postulo has the key; say which in the commit.
  • Tests: the badge and the review list group two captures with one key, keep two keys apart, and merge an unsent record with the Postulo row of the same key.

Done when

  • Nothing in the extension reduces an address to decide what is one posting for the badge or the review list.
  • src/lib/address.js is gone.

Left over from postulo-chromium#5 (toolbar badge); the core side is postulo#711.

**Body:** Postulo core #711 gives every capture on the API a `posting_key`: an opaque name for the posting at its address, the same for two captures of one posting however the address was spelled, different for two postings. It is a hash keyed by the instance's secret and the account, so the extension cannot compute it itself; Postulo hands it out: - on each row of `GET /api/v1/captures`, on the answer to `POST /api/v1/captures` and on the answer to `PUT /api/v1/captures/{id}/rendering`; - per asked address, from `POST /api/v1/captures/known` (`posting_key` beside `url`). It is told to a token holding only `captures`, which is not told the address (core #761), so it is the one way this extension's token has of grouping the list at all. ## What to do - `src/lib/waiting.js` (`countPostings`) and `src/lib/review.js` (`reviewRows`): group Postulo's rows by `row.posting_key` (or `postulo:` and the row's id where it is empty) instead of `sameUrl(row.url)`. `slimRow` keeps `posting_key`. - Unsent captures held here: key each by the `posting_key` Postulo gives for its address. Ask `POST /captures/known` for it (the extension already asks it before sending; keep the key on the record), or, for a record that has none yet, fall back to `here:${record.id}`, so it counts on its own until Postulo has been asked. - Delete `src/lib/address.js` and its 31 cases; `parse.js` keeps its own `sameUrl` for picking the JSON-LD posting that names the page (#176), which is not about counting. - Against a Postulo older than #711 (no `posting_key` on a row) fall back to counting one per capture, or keep `sameUrl` for that case only until the minimum supported Postulo has the key; say which in the commit. - Tests: the badge and the review list group two captures with one key, keep two keys apart, and merge an unsent record with the Postulo row of the same key. ## Done when - Nothing in the extension reduces an address to decide what is one posting for the badge or the review list. - `src/lib/address.js` is gone. Left over from postulo-chromium#5 (toolbar badge); the core side is postulo#711.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Postulo/postulo-chromium#50
No description provided.