OverviewFilesCommitsIssuesDocsReleasesPeers

favela-bridge commits / 0cca80f

0.0.6: --limit, a ceiling on one cycle
A feed with a history projects ALL of it the first time it is pointed at a repo. tabertron has 16 favela posts and wj62 has 7 followers, so the first send is 15 posts at once — a different act from posting, and not retractable. --limit N sends at most N in a cycle and reports the rest as held rather than truncating silently. Absent, it is Infinity and behaviour is unchanged. Verified with --limit 0 --send, which exercises the send path with the gate closed: sent 0, held by --limit 15, nothing written. 17/17 tests pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
0cca80fb545b0370af492499cae7e06e99ea76b7
by plankatron <fleeky@gmail.com> · 2026-09-09T21:53:33.000Z

Changed files (1) +18 -2

index.js +18 -2
……@@ -28,6 +28,16 @@ import { tidFor } from './lib/tid.js'
2828
2929const argv = process.argv.slice(2)
3030const SEND = argv.includes('--send')
31// ⛔ A CEILING ON ONE CYCLE, for the first send into a repo that has followers. A feed with a
32// history projects ALL of it the first time, and "16 posts at once" is a different act from
33// "post". Absent, this is Infinity and nothing changes.
34const LIMIT = (() => {
35 const i = argv.indexOf('--limit')
36 if (i === -1) return Infinity
37 const n = Number(argv[i + 1])
38 if (!Number.isFinite(n) || n < 0) throw new Error('--limit needs a non-negative number')
39 return n
40})()
3141// ⛔ --watch implies --send. A watch that only planned would be a process that costs power and
3242// changes nothing, and the flag would read as if it were working.
3343const WATCH = argv.includes('--watch')
……@@ -85,7 +95,7 @@ async function cycle (send) {
8595 }
8696 if (found === null) console.log(' ⚠ could not read the sink — "already there" is unknown below')
8797
88 let sent = 0; let skipped = 0; let withheld = 0
98 let sent = 0; let skipped = 0; let withheld = 0; let held = 0
8999 for (const row of rows) {
90100 const plan = planRecord(row, { roomType: ROOM_TYPE, verb: 'post' })
91101 const line = ' ' + row.name + ' [' + plan.networks.join(',') + ']'
……@@ -101,6 +111,11 @@ async function cycle (send) {
101111 } else if (have.has(tidFor(row.name))) {
102112 skipped++
103113 console.log(line + ' bsky: already there')
114 } else if (send && sent >= LIMIT) {
115 // Reported per record rather than silently truncated: a run that stopped early and one that
116 // had nothing left to do print the same summary otherwise.
117 held++
118 console.log(line + ' bsky: held — --limit ' + LIMIT + ' reached this cycle')
104119 } else if (!send) {
105120 console.log(line + ' bsky: would send ' + JSON.stringify(plan.bsky.record.text.slice(0, 48)) +
106121 (plan.bsky.losses.length ? ' — losing: ' + plan.bsky.losses.join('; ') : ''))
……@@ -116,7 +131,8 @@ async function cycle (send) {
116131 }
117132
118133 console.log(' ' + (send ? 'sent ' + sent : 'would send ' + (rows.length - withheld - skipped)) +
119 ' · already there ' + skipped + ' · withheld ' + withheld)
134 ' · already there ' + skipped + ' · withheld ' + withheld +
135 (held ? ' · held by --limit ' + held : ''))
120136}
121137
122138main().catch((err) => { console.error('favela-bridge: ' + ((err && err.message) || err)); process.exit(1) })