Skip to content

Architecture questions

The subject asks that, at the Plan milestone, "each member identifies at least one significant technical question to investigate or contribute to". By the Final defense, each member explains one architectural decision they materially contributed to: need, alternatives, evidence, decision, trade-offs and observed result.

One section per member. At the Plan milestone a section holds the question, why it matters, the options and how we will get evidence. The decision itself goes later in an ADR (docs/adr/).

Member Question Status
Ethaniel How do hooks detect Actions reliably? Question and evidence plan written
Esteban To choose Not written
Clément To choose Not written
Alexandre To choose Not written

Ethaniel: hooks

The question

How does our server detect the Actions of third-party services while no client is open, without handling the same event twice, and while surviving restarts and failures?

Why it matters

The subject names this point as a decision to defend:

This essential element detects Actions and start the corresponding workflow without a client being open. Hooks must avoid treating the same occurrence as a new event indefinitely. How events are identified, scheduled and persisted is an architectural decision to document and defend.

  • It has no obvious answer: every option has a cost.
  • It can be tested: duplicates, detection delay and number of requests can be measured.
  • It is central: without hooks, no workflow ever starts.
  • It fits Ethaniel's role on the back end. None of the spiked frameworks has background jobs built in (see spikes/DISTANCE.md).

Here the "client" is the web or mobile application, not a person: the hook works while the application is closed.

Sub-questions

They come from walking through the scenario "a new GitHub issue sends a Discord message" and asking "what if it breaks?" at each step.

Step of the scenario What if…? Sub-question
An issue is created on GitHub How does the server learn about it? Polling or webhook
Nobody has the application open Who starts the check? Scheduler or workers
The server restarts Does it see the same issues again? Deduplication
Two workers run at the same time Do they both handle the same issue? Lock or unique constraint
The Discord message fails Do we retry? How many times? Retries and idempotency
The OAuth token has expired Who refreshes it? Token lifecycle, only from the hook side

Storing and refreshing OAuth tokens is a question of its own; here it only covers what the hook does when the token no longer works.

Options to compare

Sub-question Options What decides
Detect Polling, webhooks, or a mix depending on what each service offers Detection delay, rate limits (GitHub: 5,000 requests per hour per token), public URL needed for webhooks, webhook signature check
Schedule and run Scheduler inside the server (APScheduler), or a task queue with workers (Celery and Redis; BullMQ on Node.js) Behavior with two server instances, recovery after a crash, Docker setup
Deduplicate Cursor (last id or date seen), ETag, table of handled events with a unique constraint on (subscription, external id) Behavior after a restart, storage cost
Handle failures Retries with a growing delay, token refresh then subscription disabled if it fails, workflow failing halfway What the user sees in the history

Central trade-off

Handling an event exactly once cannot be guaranteed. The realistic target is "at least once" plus idempotency: a task can be run again safely, because the unique constraint prevents the duplicate.

Evidence plan

Two PoCs with the same target, described in pocs/hooks-celery/POC.md (Ethaniel) and pocs/hooks-apscheduler/POC.md (to assign):

  • poll the issues of a public GitHub repository;
  • show each new issue only once;
  • no duplicate after a restart;
  • poll interval read from POLL_INTERVAL.

Measures: number of duplicates after a restart, detection delay, behavior with two workers started at the same time, number of requests with and without ETag. The Celery PoC must be done before the "engine" stage of the plan (from 2026-12-04).

Esteban

To fill in: the question, why it matters (quote the subject), the options, and the evidence plan.

Clément

To fill in: the question, why it matters (quote the subject), the options, and the evidence plan.

Alexandre

To fill in: the question, why it matters (quote the subject), the options, and the evidence plan.

Ideas for the remaining questions

Method: take a requirement sentence of the subject, spot the strong words ("must", "without", "never"), then ask "how?" and "what if it breaks?". Every answer that starts with "it depends" is an architecture question.

  • Storing and refreshing OAuth tokens, and linking an OIDC identity to a local account.
  • Modeling a workflow (nodes, condition, data passed between nodes) and handling a failed reaction.
  • Format of the service discovery and of the OpenAPI contract between the server and the clients.
  • Reproducible deployment (Docker Compose, server host, Android APK).