63 Commits
Author SHA1 Message Date
adminandClaude Opus 5.5 962dde69a4 Fetch private dredd-core from the Haski Gitea, not GitHub
CI / backend (16) (push) Successful in 1m47s
CI / backend (17) (push) Successful in 1m43s
CI / managed-db (push) Successful in 1m47s
CI / compose-smoke (push) Successful in 1m33s
The Dockerfiles still rewrote credentials for github.com only, so the build
token never reached Gitea and installs worked only while dredd-core was
public. Rewrite http://77.216.148.202:3000/ instead, give every workflow
that pip-installs the same rewrite (org secret DREDD_CORE_TOKEN, the
read-only haski-reader token), and drop the GitHub PAT leftovers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 22:18:45 +01:00
adminandClaude Opus 5.5 a70b9282ef CI: allow a manual run (Actions -> CI -> Run workflow)
CI / backend (17) (push) Successful in 2m2s
CI / backend (16) (push) Successful in 2m7s
CI / managed-db (push) Successful in 2m0s
CI / compose-smoke (push) Successful in 1m57s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 20:06:30 +01:00
adminandClaude Opus 5.5 d379ce2288 CI: push runs only on main; branches are tested through their pull request [skip ci]
A push of many branches at once (the migration pushed 100 of Atrium's) started
a run per branch and flooded the runners. Every pull request is still tested.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 16:39:16 +01:00
adminandClaude Opus 5.5 82df340216 CI: compose-smoke drives the stack on 8141, the port it publishes
CI / backend (16) (push) Successful in 1m54s
CI / backend (17) (push) Successful in 1m39s
CI / managed-db (push) Successful in 1m53s
CI / compose-smoke (push) Successful in 47s
The family's standalone ports moved the backend to ${WORKFLOW_PORT:-8141}, and
the smoke test kept asking port 80, so it never saw the stack become ready.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-30 10:41:06 +01:00
adminandClaude Opus 5.5 a1a7d5c196 Build from Gitea instead of GitHub
CI / managed-db (push) Successful in 1m20s
CI / compose-smoke (push) Failing after 6m32s
CI / backend (16) (push) Successful in 1m18s
CI / backend (17) (push) Successful in 1m11s
The Alpaq92 GitHub account is suspended, so nothing can be fetched from it.
dredd-core (and Lexicon's compass packages from Arbiter) now come from the
public Haski repositories on Gitea, so CI no longer authenticates to GitHub:
the "Authenticate to dredd-core" steps and insteadOf rewrites are gone.
The Dockerfile's dredd_core_token build secret stays; any non-empty value
works now (the Haski org secret DREDD_CORE_TOKEN provides one in CI).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-29 17:05:33 +01:00
admin 6f5a004cbe Merge pull request #5 from Alpaq92/fix/initiator-lock-and-round
fix(security): the initiator lock is the moderator's; a stale click fails in a new round
2026-11-28 10:39:53 +01:00
admin 008b35b9c3 Merge pull request #4 from Alpaq92/naprawa-53
Atrium#53: import Galena's old runs, and the document arrives from Galena
2026-11-28 00:22:04 +01:00
Piotr ChojnackiandClaude Opus 5.5 040d41f76e fix(security): the initiator lock is the moderator's; a stale click fails in a new round
1. Nobody approves their own run unless a template allows it.
   `initiator_may_approve` is now off by default, and a run's settings
   override may keep or switch on the lock but never lift it
   (`rules.merge_settings(..., for_run=True)`, 422 `initiator_lock_fixed`).
   Before, anybody could lay out stages naming only themselves - on a Galena
   document with no more than read access - and emit `workflow.approved` /
   `workflow.signed_on_paper`, which Galena moves a contract card on; and a
   moderator's template lock was undone by the override. The console's start
   form shows the box off and disabled when the base locks.

2. `round_seen` joins `stage_key_seen` / `stages_seen`. An edit of the request
   or a rejection on the first stage brings the run back to the same stage
   key in a new round, so a click prepared before it approved content its
   author never saw (or overrode a rejection). `assert_current` answers 409
   `round_changed`; the console sends the round with every action, the scan
   and the request edit. Checked when sent, so API clients keep working.

Tests: DB-free unit tests for both rules and the API passthrough; the
integration tests where the admin approved their own run now use a template
that allows it, or another person; one new integration test for the stale
click after an edit (Atrium#70).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 00:14:03 +01:00
adminandClaude Opus 5.5 f3ee57dff1 Hold scramp below 1.5 (TLS with pg8000 1.31.2)
Fixes Atrium#53 run 2, point 7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 21:21:42 +01:00
adminandClaude Opus 5.5 5e53ac11f1 chore(env): document ARCHIVE_READER_ID (deploy_check)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 13:17:31 +01:00
adminandClaude Opus 5.5 d3cf08d47f feat(evidence): GET /evidence for the Galena archive; technical account fenced to it (Atrium#53)
Finished runs on a Galena document: the timeline as canonical JSON (sha256 stable) and the paper
scan. A person sees what can_read_run lets them; the archive's technical account (fixed id
ARCHIVE_READER_ID, minted by the hub) sees all, is audited as evidence.read, and gets 404 on every
other route.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 13:01:01 +01:00
adminandClaude Opus 5.5 598ba8782f test: malformed rows, unknown event kinds, role stages, paper import; console prefill under Node
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 14:41:11 +01:00
adminandClaude Opus 5.5 e2c821e53d fix(import): a malformed row is skipped, not fatal; existence read once per file
Every field a row is read through sits inside the try that turns errors into
skipped, an unknown event kind skips only its run, and persons, templates and
runs are looked up in three queries for the whole file. Report is a dataclass.
The CLI reports a database failure cleanly. "Wyślij do podpisu" is a plain
button: the stage's approval stays the one primary action. Ticket narration
trimmed from comments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 14:41:09 +01:00
adminandClaude Opus 5.5 d429f4e292 test: the race tests' fake knows the stage's person
Found by running the unit tests: the start refused the unknown person before
it reached the insert, so the race was never exercised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 21:55:09 +01:00
adminandClaude Opus 5.5 1decacd9eb feat: an approved run sends its document to signing in Parafa (Atrium#53)
"Przekazanie do Parafy": on the platform, an approved run on a Galena PDF
gets "Wyślij do podpisu", a link to Parafa's new request with the document
prefilled at the commit the run approved, so exactly the approved bytes are
signed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 19:16:57 +01:00
admin 6dd749790e Merge remote-tracking branch 'origin/feat/send-to-approval' into naprawa-53 2026-11-25 19:04:04 +01:00
adminandClaude Opus 5.5 a27701ac85 fix(import): a paper ending with its scan is podpisany, and the scan reads back
From review: the old engine ended a paper signature as approved, so those
runs came in as zatwierdzony although this module has podpisany for exactly
that; and the imported scan lacked to_dict's kind, so from_dict refused it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 12:41:31 +01:00
adminandClaude Opus 5.5 add9767492 feat: a Galena document arrives chosen from Galena's "Send for approval"
Atrium#53: Galena has no menu entry, so a document is sent for approval from
Galena itself. Its link opens #/runs/new?kind=document&document_id=…&path=…;
the new-run screen fills both fields from it, escaped, and locks them. The
server still re-pins the document with the person's own token at start, so
the link grants nothing. Before, a person had to type a UUID and a path.

Not run here: no Python or Node on this machine and CI is not running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 07:47:33 +01:00
adminandClaude Opus 5.5 656da736ef feat: import Galena's old approval runs and templates as history
Atrium#53 makes this module the one approval engine. Galena drains its own
engine and exports templates and finished runs (Alpaq92/Galena#14,
`python -m app.export_workflows`); this reads that file.

- python -m app.import_galena_runs runs.json [--commit]: a dry run by
  default, one transaction with --commit, idempotent (every id is a uuid5 of
  Galena's), so a later export adds only what is missing.
- Templates keep their stages and keys (quorum "one") and get this module's
  rejection rules (DEFAULT_SETTINGS); one naming a removed person is skipped.
- Runs keep state, stages, people, times and timeline; their settings say
  `end` for rejection, the rule they actually ran under. Each is on the
  DocumentRef Galena pinned (the project's main file). Unpinned, unfinished
  or with a removed person: reported, never written.
- History, not activity: no workflow.* event, no notification; one audit row
  per imported run or template, actor NULL.

Not run here: no Python on this machine and CI is not running.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 23:15:30 +01:00
admin 4adfacaa7e Merge pull request #1 from Alpaq92/feat/workflow-module 2026-11-24 20:21:39 +01:00
adminandClaude Opus 5.5 d505fde978 fix: a paper scan is not left behind when the action fails
The scan was written to Galena or plain files before any of the action's
database writes. It is now read and checked before those writes
(scan_bytes) but stored only after the run's rows have flushed
(keep_scan). A plain-files scan is also deleted if the transaction rolls
back. Galena has no delete here, so a scan committed there can still
outlive a failed final COMMIT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 08:55:09 +01:00
adminandClaude Opus 5.5 31eba36498 fix: a start losing the race on a subject is 409 run_in_progress
Two starts on one subject could both pass the in-progress check; the
partial unique index then refused the second with a generic conflict.
The run's insert now flushes in a savepoint and a violation of the
running-run indexes answers the same 409 run_in_progress as the check.
Other integrity errors still propagate.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 08:37:06 +01:00
tobayahandClaude Opus 5.5 37b5ed660d fix(console): English mode no longer leaks Polish chrome
The breadcrumb was never localized (it sits outside #content and the
sidebar), so "Nowa sprawa", "Ustawienia" and "Plik z komputera" stayed
Polish in EN. The tab title and <html lang> came straight from
index.html, the language button's "Język" tooltip sat inside
data-no-i18n, one toast skipped _tr and "Odśwież zatwierdzających" had
no dictionary entry. Crumb parts that are people's text (a request
type's or a run's name) are marked data so the dictionary never
rewrites them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 16:07:08 +01:00
tobayahandClaude Opus 5.5 5be31ad99a Pola obok siebie w oknie ustawień na jednej wysokości
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_016uwxqKwSiEuE8j2HHdFeD4
2026-11-20 16:01:12 +01:00
tobayahandClaude Opus 5.5 410a82f677 Gotowe obiegi na start i przycisk nowego wzoru
Seed (gdy SEED_DEMO) zakłada cztery typy wniosków ze ścieżkami: akceptacja wydatku, podróż służbowa, urlop szkoleniowy, wniosek urlopowy; grupy puste, obsadza je moderator. Moderator dostaje na ekranie Nowa sprawa przycisk Zdefiniuj nowy wzór workflow (formularz nowego typu wniosku). Test e2e archiwizuje po sobie typ, szablon i grupę, żeby nie zostawiał kart z kodami.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_016uwxqKwSiEuE8j2HHdFeD4
2026-11-20 15:58:17 +01:00
tobayahandClaude Opus 5.5 605217c9ad Nowa sprawa jako pozycja menu w ramce Atrium
Atrium chowa boczny panel modułu i przepisuje do siebie tylko wiersze .nav-item, więc przycisk Nowa sprawa w Atrium znikał.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_016uwxqKwSiEuE8j2HHdFeD4
2026-11-20 10:59:38 +01:00
tobayahandClaude Opus 5.5 3135b844ac fix(console): letters-only initials; a type card lists only live fields
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Claude-Session: https://claude.ai/code/session_016uwxqKwSiEuE8j2HHdFeD4
2026-11-19 16:45:27 +01:00
tobayahandClaude Opus 5.5 9f6d222f00 feat(console): direction A redesign and one "Nowa sprawa" door
- app.css rewritten: white cards on a quiet sidebar, Inter (self-hosted, OFL), radius 16/10,
  light and dark tokens; dead search/stripe styles dropped
- "Nowy wniosek" and "Nowy obieg" become one sidebar button: #/new asks what the case is
  about (a card per request type with its fields and default path, a file, a Galena
  document when enabled), step 2 is the matching form beside its approval path
- run detail: actions in the page head (#runActs), stages as a horizontal path, details
  and a newest-first timeline side by side
- settings: one tab per kind, the tab kept in the hash so a save lands back on it
- lists: subject with kind underneath, initials beside the initiator; inbox badge in the menu
- e2e: picks the request type by its card, settings by tab, actions from #runActs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016uwxqKwSiEuE8j2HHdFeD4
2026-11-19 16:33:24 +01:00
tobayahandClaude Opus 5.5 41147e1d55 test(e2e): the console scenario also runs on the platform
WORKFLOW_E2E_HUB_URL switches the expense happy path to the one-account platform: everybody signs in once at the hub, the people are the hub's accounts already admitted to this module (WORKFLOW_E2E_PEOPLE, WORKFLOW_E2E_PASSWORD), and setup/cleanup use the hub's cookie with a same-origin Origin. Standalone is unchanged. Green on the Atrium showcase (/workflow behind the front door).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016uwxqKwSiEuE8j2HHdFeD4
2026-11-19 00:53:27 +01:00
tobayahandClaude Opus 5.5 422900495c fix: only the uploader may start a run on a file
A FileRef sent to POST /runs is the client's claim. runs.start now answers 404 unless the
actor uploaded that file (audit file.uploaded), before the 409 run_in_progress check, so a
past approver who kept a file's id and hash cannot reopen access to it. uploaded_by is now
public in requests and flushes first (no autoflush).

Verified: 525 unit, 582 integration on Postgres (VPS), e2e passed; mutation-checked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016uwxqKwSiEuE8j2HHdFeD4
2026-11-18 22:21:13 +01:00
tobayahandClaude Opus 5.5 7c1fd9a3fa fix: bugs the Postgres integration and e2e runs exposed
- runs.start flushes the run before its stage row: no relationship() orders the INSERTs,
  so run_stage_state could precede workflow_run (FK violation, 500 on every POST /runs)
- _locked flushes before its populate_existing SELECT: with autoflush off it silently
  undid an earlier unflushed action in the same transaction
- document_roles hides document runs when Galena is disabled instead of 409 on every list
- tests: pg8000 reports CHECK violations as ProgrammingError; flush between in-session
  actions like the API commit does; the fake session no longer counts an empty flush as a write

Verified on the VPS test stack: 581 passed / 5 skipped with WORKFLOW_RUN_INTEGRATION=1,
e2e test_expense_happy_path passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016uwxqKwSiEuE8j2HHdFeD4
2026-11-18 22:13:39 +01:00
tobayahandClaude Opus 5.5 ccc0652acc test: console e2e (expense happy path) and final docs
backend/tests/e2e/test_console.py drives a running stack with Playwright;
skipped unless playwright is installed and WORKFLOW_E2E_BASE_URL is set.
README: screens, API routes, e2e run. CLAUDE.md: lists/routers in Where
things live, e2e command, status after stages 1-7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:59:53 +01:00
tobayahandClaude Opus 5.5 6b4e85c71e feat: run detail console - timeline by round, actions by can_* flags with stale-view refresh, content confirm, paper scan, add stage, request edit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:52:42 +01:00
tobayahandClaude Opus 5.5 a907ce9630 feat: console start screens - new request and new run with template, changed template or own stages
Galena option is shown only when GET /options answers galena_enabled (viewNewRun: const galena = !!opts.galena_enabled). Adds GET /request-fields for any module user: a filer's form needs the pool's labels, kinds and options, and /admin/request-fields is the moderator's. Save as template posts the editor's stages to /admin/templates (keys dropped). A refused start after filing keeps the request and retries only the start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:46:57 +01:00
tobayahandClaude Opus 5.5 e8df94c5b0 feat: moderator settings console - groups, request fields and types, templates with a reusable stage editor
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:40:59 +01:00
tobayahandClaude Opus 5.5 1746a07b71 feat: console skeleton - nav, stats tiles, inbox/mine/archive lists, notification badge
Archive filters live in the hash so a filtered view is a link and the CSV uses the same query;
the CSV button reads the hash at click time instead of splicing it into an onclick (attribute
entities decode before the script runs). New request, new run and settings are placeholders
for 7.2-7.4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:34:48 +01:00
tobayahandClaude Opus 5.5 e961317119 fix: a run's file subject is downloadable only when its initiator uploaded it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:30:32 +01:00
tobayahandClaude Opus 5.5 e63da723fc feat: request fields, request types, requests and file download API
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:27:58 +01:00
tobayahandClaude Opus 5.5 91216de844 feat: templates and approver groups API (/templates, /admin/templates, /admin/groups)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:22:48 +01:00
tobayahandClaude Opus 5.5 139411480c feat: runs API (start, detail, actions, lists, archive CSV, notifications) and real /stats
POST /runs accepts the body dredd_core's WorkflowClient sends (full DocumentRef dict, re-pinned) and answers {run_id, state, link}. POST /files uploads a file subject. /stats counts with the lists' own counters.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:19:08 +01:00
tobayahandClaude Opus 5.5 ed92d2e75f feat: inbox, mine, archive, CSV and run detail lists
services/lists.py: one Galena roles call per list, readability decided by pure
functions mirroring authz, can_* flags asked of the engine itself, CSV with a
formula guard. Mine = running runs the person started (the filer of a request
started by a moderator cannot read it per authz, so it is not listed).
Integration tests written, skipped here (no Postgres).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:12:06 +01:00
tobayahandClaude Opus 5.5 4e7daea4d5 feat: workflow API schemas and empty runs/templates/requests/groups routers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:05:33 +01:00
tobayahandClaude Opus 5.5 f17c635cd7 fix: an approved request is final
requests.update refuses (409 request_approved) once a run approved or
signed the request: the timeline keeps only the snapshot hash, so an
edit would lose what was approved. Rejected or cancelled runs leave it
editable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 20:00:29 +01:00
tobayahandClaude Opus 5.5 720d81b859 feat: add_stage, refresh, paper scan and request edits on approval runs
runs.act now takes every engine action. add_stage re-checks the stage
with the run's subject kind (a role only on a Galena document) and fixes
its list; refresh resolves the current stage again and may close it;
paper_scan stores the signed scan in Galena under podpisane/ as the
person, falling back to plain files when Galena refuses or drafts it
(run.scan holds either ref, the step rests on the scan's hash).
requests.update edits a request: 409 request_locked while a run is in
progress unless editable_in_run, otherwise the run's edit_request in the
same transaction, resting on the new snapshot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 19:57:37 +01:00
tobayahandClaude Opus 5.5 4f53d42865 feat: gray brand and Workflow CLAUDE.md
Open Color gray (gray7 #495057) is the only Atrium tile hue no family module wears (Q1). CLAUDE.md now describes the approval-run domain, the v0.24.0 pin, the workflow schema/roles and port 8141.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 19:49:34 +01:00
tobayah 17d58c0b96 feat: run actions (approve, reject, cancel) and their notifications 2026-11-18 19:44:58 +01:00
tobayahandClaude Opus 5.5 2763ca0068 fix: check subject access before the run-in-progress conflict
A 409 run_in_progress must not tell somebody who cannot read a Galena document that a run exists on it: pin (or read the file) first, then check for a running run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 19:13:51 +01:00
tobayahandClaude Opus 5.5 bc0ae4ba97 feat: start approval runs and read RunState from rows
runs.start pins the subject and resolves stage 0 before any write, then writes the run, the stage 0 list, the start event with evidence, the audit row and workflow.started in one transaction. A DocumentRef is re-pinned by id and path; templates.references is public for reuse.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 19:09:25 +01:00
tobayahandClaude Opus 5.5 11af9ee68c feat: assignee resolution (users, group, Galena role) filtered by module access
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 19:03:55 +01:00
tobayahandClaude Opus 5.5 4992c9dad5 feat: workflow templates and approver groups services
templates.create/update/archive/save_as_template and groups.create/update/archive,
moderator-only, validation delegated to rules, references checked against the
database, every write audited. Group names unique among unarchived ones
(case-insensitive, advisory lock + partial index); template names are not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 18:59:56 +01:00