interplane-forge
INTERPLANE Forge
Brought by drakestapleton
interplane-forge / docs / GROWTH.md
| 1 | # Growth and social signals |
| 2 | |
| 3 | Owner: this lane (`growth/`). It reads the clone and download journal that `server/counts.om` already keeps. It does not write that journal and it does not change `forge/explore/1` or `forge/repo/1`. |
| 4 | |
| 5 | ## Pages |
| 6 | |
| 7 | | Page | HTML | JSON | |
| 8 | |---|---|---| |
| 9 | | Trending | `<base>trending` or `<base>explore?order=trending` | `<base>trending.json`, `<base>explore.json?order=trending`, or the same paths with `Accept: application/json` | |
| 10 | | New | `<base>explore?order=new` | `<base>explore.json?order=new` | |
| 11 | | Insights | `<base><owner>/<repo>/insights` | `<base><owner>/<repo>/insights.json` | |
| 12 | |
| 13 | `order` must be `trending` or `new`. Anything else is 400. POST is 405. A plain `<base>explore.json` stays `forge/explore/1`. |
| 14 | |
| 15 | ## What a number is |
| 16 | |
| 17 | The window is the last 604800 seconds (7 days; `7*86400` checked with WolframLanguageEvaluator) ending at the request, unless `window=` is a positive number of seconds up to 315360000. Every counted number is 0 when the source was read and nothing matched. A source that was not read is `null` in JSON and "not measured" on the page. Window clones and downloads read the counts journal only up to its last committed cursor, so a torn last batch is not counted (the same rule as `server/counts.om`). When that committed part is larger than one 16777216-byte read, window clones and downloads are not measured. |
| 18 | |
| 19 | | Number | Source | One count | Left out | |
| 20 | |---|---|---|---| |
| 21 | | Clones | front-door nginx download log, via the counts journal | a visitor `info/refs?service=git-upload-pack` answered 200 | our own addresses and user agents naming bot, crawl or spider, same rule as the repo home | |
| 22 | | Downloads | forged access log, via the counts journal | a visitor GET of `/archive/` or `/releases/download/` answered 200 | our own addresses | |
| 23 | | Stars | social log, replayed by the social store | one key currently starring the repo; the window count is star events minus unstar events inside the window, not below 0 | nothing is seeded; a tampered social log is not measured | |
| 24 | | Follows | social log | followers of the owner account | the same | |
| 25 | | Seeds | this node's routing table, `rad node routing --rid <RID> --json` | a node that announced it seeds the repo, this node included | a failed read is not measured; zero nodes is 0 | |
| 26 | | Contributors | `git log --format=%aN` on the default branch | one distinct author name, first 48 bytes, at most 64 names | a branch git cannot read is not measured | |
| 27 | | Patches opened | patch objects in this repo's storage, the same list the patches page uses | one distinct patch id | git failing is not measured | |
| 28 | | Patches merged | the same objects | a patch whose history contains a merge | the same | |
| 29 | |
| 30 | Trending score is window clones + window downloads + window net stars. A part that is not measured is left out of the score. New order is the last commit's committer time, newest first, then the name. A repo with no readable commit sorts last. Every public repo is listed, including those whose score is 0. |
| 31 | |
| 32 | Each insights number carries its source. Log numbers also carry `since` (the first time that log was read). Seeds carry `as_of`, the time the routing table was read. A successful read is appended to `<data>/growth/seeds.log` (`s <epoch> <count> <rid>`) when its count differs from the last line this process wrote for that repo (the first check after a start always writes), so the insights page shows the last 16 changes in seeding. Trending and new do not read the routing table: one read takes about 110 ms and the server answers one request at a time, so each repo's `seeds` there is the last check this process made for it (repo home or insights), null when there was none. Nothing runs on a clock. |
| 33 | |
| 34 | ## Schemas |
| 35 | |
| 36 | `forge/explore-order/1`: `schema`, `order`, `base`, `window_seconds`, `window_start`, `as_of`, `count`, `repos`. Each repo has `owner`, `name`, `rid`, `path`, `score`, `clones` (null when not measured), `downloads` (null when not measured), `stars` (null when not measured), `seeds` (null when not measured), `last_commit` (ISO-8601 or null). |
| 37 | |
| 38 | `forge/insights/1`: the same window fields, then `clones`, `downloads`, `stars`, `follows`, `seeds` (with `series`), `contributors`, `patches`. A count object has `count`, `since` or `as_of`, and `source`. |