Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ Indigo-specific rules:

- Required checks are `CI gate` (`.github/workflows/ci.yml`, waits on `checks`, `host` and `build-3ds`; add any new mandatory job to its `needs`) and `flow / conventions` (`.github/workflows/flow.yml`, Wolfram's reusable workflow). Never edit `.github/PULL_REQUEST_TEMPLATE.md` or the block above here; change them in Wolfram and copy them out.
- Run `scripts/check-flow.sh drift`, `scripts/check-flow.sh protocol` and `scripts/check-flow-selftest.sh` before pushing.
- Protocol guard: `scripts/check-flow.sh protocol` rejects raw `com.atproto.*`, `app.bsky.*` and `uk.ewancroft.*` method strings in `src/` unless listed with a reason in `scripts/flow-protocol-allow.txt`. Shared logic goes to Wolfram; image attachments are `wolfram/attach.h` (type and size filter, folder scan, upload), and `src/app/social.c` and `src/atproto/session.c` only call it. The duplication with Cobalt tracked in #20 is closed (matching, time, failure kinds and pairing are all Wolfram's).
- Protocol guard: `scripts/check-flow.sh protocol` rejects raw `com.atproto.*`, `app.bsky.*` and `uk.ewancroft.*` method strings in `src/` unless listed with a reason in `scripts/flow-protocol-allow.txt`. Shared logic goes to Wolfram; reply gates are `wf_agent_set_reply_gate`; image attachments are `wolfram/attach.h` (type and size filter, folder scan, upload), and `src/app/social.c` and `src/atproto/session.c` only call it. The duplication with Cobalt tracked in #20 is closed (matching, time, failure kinds and pairing are all Wolfram's).
- Doc drift: every `src/`, `scripts/`, `tools/`, `mk/`, `docs/`, `tests/` path and `make` target named in backticks in the docs must exist. Deliberate exceptions go in `scripts/flow-drift-allow.txt` with a reason.
- Never weaken a check to make it pass. A new Indigo check needs a deliberate-violation case in `scripts/check-flow-selftest.sh`.
- Update CHANGELOG under `## [Unreleased]` in the same PR as a user-visible change.
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ as the release notes.
- I can attach one picture to a post, reply or quote: SELECT, or the "Add an image" button in compose, opens a list of the JPEG and PNG files in `sdmc:/3ds/indigo/images` (under 950 KB), then asks for alt text. Wolfram does the filtering and the upload. The upload has not been run on an emulator or a 3DS. ([#58](https://github.com/ewanc26/indigo/pull/58))

### Changed
- Reply gates are set with Wolfram v0.34.0's `wf_agent_set_reply_gate`; my copy of the threadgate rules is deleted. ([#59](https://github.com/ewanc26/indigo/pull/59))
- What kind of failure a call was (wrong credentials, no network, a slow service, a TLS problem, a rate limit, a server fault, a reply I could not read) is Wolfram's `wf_failure_classify` and `wf_failure_tag` now, instead of a copy of them in `session.c` and `errors.c`; only the wording stays here. Nothing you would see changes ([#56](https://github.com/ewanc26/indigo/pull/56), [#20](https://github.com/ewanc26/indigo/issues/20)).
- Muted-word matching and the RFC 3339 timestamp code are Wolfram's now, not copies of Cobalt's: the matcher is `wf_muted_words_match` and the clock-free parsing and formatting are `wolfram/time.h`. A mute's expiry is checked at match time with Wolfram's parser, which also reads numeric offsets (the old one refused them). My copies, about 250 lines, are deleted. The host build now needs a Wolfram checkout and cJSON's headers ([#54](https://github.com/ewanc26/indigo/pull/54), [#20](https://github.com/ewanc26/indigo/issues/20)).

Expand Down
32 changes: 7 additions & 25 deletions src/atproto/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include <wolfram/post_display.h>
#include <wolfram/post_view_typed.h>
#include <wolfram/thread_typed.h>
#include <wolfram/threadgate_postgate.h>

#define WORKER_STACK 0x20000

Expand Down Expand Up @@ -1757,37 +1758,18 @@ do_publish(const job *j)
indigo_log_info("published (mode %d)", (int) j->mode);
/* Reply gate, new top-level posts only: a threadgate attaches to the
* post it names, and gating a reply separately from its thread is not
* something the official client offers either. Gate 0 writes nothing,
* since no threadgate at all already means everyone may reply.
* something the official client offers either. The rules are Wolfram's.
*
* A failure here does not roll the post back. It exists, ungated,
* which is the safer outcome than dropping something the user can see
* themselves have posted. */
if (j->mode == INDIGO_COMPOSE_POST && j->reply_gate > 0 && res.uri && res.uri[0]) {
/* Indexed by reply_gate: 1 allows follows and mentions, 2 is an
* empty rule set, so nobody may reply. */
static const char *const allow[] = {
NULL,
"[{\"$type\":\"app.bsky.feed.threadgate#followingRule\"},"
"{\"$type\":\"app.bsky.feed.threadgate#mentionRule\"}]",
"[]",
};
const int gate = j->reply_gate;

if (gate < (int) (sizeof allow / sizeof allow[0])) {
wf_agent_post_result gated = {0};
wf_status gst =
wf_agent_create_threadgate(s_agent, res.uri, allow[gate], NULL, 0, &gated);

if (gst != WF_OK) {
indigo_log_warn("reply gate failed (wolfram status %d) for %s", (int) gst,
res.uri);
} else {
indigo_log_info("reply gate set on %s", res.uri);
}
wf_agent_post_result_free(&gated);
wf_status gst = wf_agent_set_reply_gate(s_agent, res.uri, (wf_reply_gate) j->reply_gate);

if (gst != WF_OK) {
indigo_log_warn("reply gate failed (wolfram status %d) for %s", (int) gst, res.uri);
} else {
indigo_log_warn("reply gate %d out of range, posted ungated", gate);
indigo_log_info("reply gate set on %s", res.uri);
}
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion wolfram.ref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.33.0
v0.34.0
Loading