Catalogue and console call Compass "Workflow"; revision 0013 renames seeded rows
The compass catalogue entry is now Workflow (Dokumenty, "Obiegi akceptacji dokumentów"); revision 0013 updates an already-seeded row where slug='compass' and name='Compass' (an administrator's rename is left alone). The chat's module labels say Workflow. The slug and every technical name stay compass. deploy/README.md no longer describes an AGPL exception. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
"""The catalogue calls Compass "Workflow": rename the seeded entry on a box seeded before.
|
||||
|
||||
Since its revision 0030 Compass does one thing, approval workflows on documents, and the owner
|
||||
presents it as **Workflow**. `app/seed.py` says so for a fresh install, but the seed writes the
|
||||
catalogue ONCE (`_seed.catalog`) and `ADDED_AFTER_FIRST_SEED` only offers a missing slug, so an
|
||||
already-seeded box would show "Compass" for ever. This revision updates that one row.
|
||||
|
||||
Only what people see changes: `name`, `tagline`, `description`, `category`. The slug stays
|
||||
`compass` — it is the module's path, its schema and roles, and the `module_permission.module_slug`
|
||||
every grant was written under. And only the row the seed wrote: `name = 'Compass'`. An entry an
|
||||
administrator renamed, or a box without the entry, is left alone, so the revision is idempotent
|
||||
(a second run matches nothing) and never overrides a human's choice. Grants are untouched.
|
||||
|
||||
The values travel as bound parameters of a SQLAlchemy `update`, not as SQL text, so nothing here
|
||||
is scanned for `:name` sequences. Downgrade restores the seeded Compass wording on the same terms.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
revision = "0013"
|
||||
down_revision = "0012"
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
_module = sa.table(
|
||||
"module",
|
||||
sa.column("slug", sa.String),
|
||||
sa.column("name", sa.Text),
|
||||
sa.column("tagline", sa.Text),
|
||||
sa.column("description", sa.Text),
|
||||
sa.column("category", sa.Text),
|
||||
)
|
||||
|
||||
WORKFLOW = {
|
||||
"name": "Workflow",
|
||||
"category": "Dokumenty",
|
||||
"tagline": "Obiegi akceptacji dokumentów.",
|
||||
"description": (
|
||||
"Workflow prowadzi dokument przez jego akceptujących, etap po etapie: plik przesłany do "
|
||||
"modułu albo dokument z Galeny, etapy z szablonu lub ustawione ręcznie, a każdy krok "
|
||||
"trafia na niezmienialną oś czasu."
|
||||
),
|
||||
}
|
||||
|
||||
COMPASS = {
|
||||
"name": "Compass",
|
||||
"category": "Umowy",
|
||||
"tagline": "Zarządzanie umowami dla zespołów prawnych.",
|
||||
"description": (
|
||||
"Compass to system zarządzania umowami dla działów prawnych i kancelarii działających "
|
||||
"w wielu jurysdykcjach — z wariantami klauzul i asystą AI. W przygotowaniu."
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def _rename(frm: dict, to: dict) -> None:
|
||||
op.get_bind().execute(
|
||||
_module.update()
|
||||
.where(_module.c.slug == "compass", _module.c.name == frm["name"])
|
||||
.values(**to))
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
_rename(COMPASS, WORKFLOW)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
_rename(WORKFLOW, COMPASS)
|
||||
+10
-5
@@ -96,12 +96,17 @@ FAMILY: list[dict] = [
|
||||
),
|
||||
},
|
||||
{
|
||||
"slug": "compass", "name": "Compass", "hue": "blue", "glyph": "compass", "sort_order": 40,
|
||||
"category": "Umowy", "status": ModuleStatus.coming_soon.value,
|
||||
"tagline": "Zarządzanie umowami dla zespołów prawnych.",
|
||||
# Presented as **Workflow** since Compass's split (its revision 0030): approval workflows on
|
||||
# documents and nothing else. Only what people see changed — the slug, /compass, its schema,
|
||||
# roles and `module_permission` rows stay `compass`. In English the tagline reads "Document
|
||||
# approval workflows". An already-seeded box gets the new name from revision `0013`.
|
||||
"slug": "compass", "name": "Workflow", "hue": "blue", "glyph": "compass", "sort_order": 40,
|
||||
"category": "Dokumenty", "status": ModuleStatus.coming_soon.value,
|
||||
"tagline": "Obiegi akceptacji dokumentów.",
|
||||
"description": (
|
||||
"Compass to system zarządzania umowami dla działów prawnych i kancelarii działających "
|
||||
"w wielu jurysdykcjach — z wariantami klauzul i asystą AI. W przygotowaniu."
|
||||
"Workflow prowadzi dokument przez jego akceptujących, etap po etapie: plik przesłany do "
|
||||
"modułu albo dokument z Galeny, etapy z szablonu lub ustawione ręcznie, a każdy krok "
|
||||
"trafia na niezmienialną oś czasu."
|
||||
),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
"""Compass is presented as Workflow: the seed and revision 0013 say the same thing, slug unchanged."""
|
||||
import importlib.util
|
||||
from pathlib import Path
|
||||
|
||||
from app.seed import FAMILY
|
||||
|
||||
REV = Path(__file__).resolve().parents[1] / "alembic" / "versions" / "0013_workflow_name.py"
|
||||
|
||||
|
||||
def _revision():
|
||||
spec = importlib.util.spec_from_file_location("rev0013", REV)
|
||||
mod = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(mod)
|
||||
return mod
|
||||
|
||||
|
||||
def test_seed_and_revision_agree_and_keep_the_slug():
|
||||
rev = _revision()
|
||||
assert (rev.revision, rev.down_revision) == ("0013", "0012")
|
||||
entry = next(e for e in FAMILY if e["slug"] == "compass")
|
||||
for key, value in rev.WORKFLOW.items():
|
||||
assert entry[key] == value
|
||||
assert "Compass" not in entry["name"] + entry["tagline"] + entry["description"]
|
||||
+3
-3
@@ -71,9 +71,9 @@ Compass; built from the compass submodule's `apps/arbiter`), ships switched off
|
||||
bringing it in is [`RUNBOOK-arbiter.md`](RUNBOOK-arbiter.md). **Lexicon, Agora and Panorama, the eighth to tenth**
|
||||
(the clause library, negotiation rooms and the dashboard, the split plan's M2-M4) ship switched off the same way,
|
||||
each under a profile of its own name; bringing them in is [`RUNBOOK-m2-m4.md`](RUNBOOK-m2-m4.md). **Licences:** Atrium, Galena, Sygna and Counsel
|
||||
Scorecard each run a CI licence gate that refuses GPL, AGPL and SSPL. Compass's image used to be the
|
||||
exception (an AGPL-3.0 analysis engine); since its revision 0030 Compass is the Workflow module
|
||||
only and ships no engine, and Arbiter's image carries none either. See [`../CREDITS.md`](../CREDITS.md#the-platform-kit-deploy).
|
||||
Scorecard each run a CI licence gate that refuses GPL, AGPL and SSPL, and no image in the kit ships
|
||||
copyleft code: Workflow (codename `compass`) dropped its AGPL analysis engine in its revision 0030,
|
||||
and Arbiter's image carries none either. See [`../CREDITS.md`](../CREDITS.md#the-platform-kit-deploy).
|
||||
|
||||
Role names are cluster-wide, so every role carries its app's name. Never create generic `app` or
|
||||
`migrator` roles in this database (provisioning refuses those names), and never put tables in `public`.
|
||||
|
||||
+15
-15
@@ -2109,7 +2109,7 @@ async function chatClauseLaw(rec, index, shown) {
|
||||
texts.forEach((a) => shown.add(a.num));
|
||||
return { slug: 'insider', kind: 'przepis', key: 'insider:graf:' + rec.key, title: rec.title.replace(/^Klauzule/, 'Przepisy Kodeksu cywilnego do klauzul'),
|
||||
inner: insiderInner(doc), url: doc.official_url, members: rec.members,
|
||||
text: `Połączenia klauzul (${rec.title}) z Kodeksem cywilnym według typu klauzuli w bibliotece Compassu albo odwołania w jej treści; to przepisy ogólne, umowa może się od nich różnić w granicach ustawy: ` +
|
||||
text: `Połączenia klauzul (${rec.title}) z Kodeksem cywilnym według typu klauzuli w bibliotece modułu Workflow albo odwołania w jej treści; to przepisy ogólne, umowa może się od nich różnić w granicach ustawy: ` +
|
||||
lines.join('; ') + '. ' + texts.map((a) => chatArtText(a, 1200)).join(' ') };
|
||||
}
|
||||
async function chatLawGraph({ law, topic, clauses }, index) {
|
||||
@@ -2129,17 +2129,17 @@ async function chatIndex() {
|
||||
const names = Object.fromEntries(((await askerGet('sygna', 'users')) || []).map((u) => [u.id, u.full_name]));
|
||||
// Sygna's urgency summary takes Compass's contracts in, so both readers share one fetch.
|
||||
const compass = chatCompass(today);
|
||||
const parts = [['Compass (umowy)', () => compass], ['Sygna (sprawy, terminy, klienci)',
|
||||
const parts = [['Workflow (umowy)', () => compass], ['Sygna (sprawy, terminy, klienci)',
|
||||
async () => chatSygna(today, names, ((await compass) || []).filter((r) => r.contract).map((r) => r.contract))],
|
||||
['Counsel Scorecard (kancelarie zewnętrzne, oceny)', chatCounsel], ['Galena (dokumenty, opinie)', () => chatGalena(names)]];
|
||||
const [got, law] = await Promise.all([Promise.all(parts.map(([, read]) => read())), askerGet('insider', 'sources')]);
|
||||
const blind = parts.filter((_, i) => got[i] === null).map(([name]) => name);
|
||||
// "Do you have access to Insider?" is a question about the chat itself: answered from this record.
|
||||
const seen = parts.filter((_, i) => got[i] !== null).map(([name]) => name);
|
||||
const access = { slug: 'atrium', kind: 'dostęp', key: 'atrium:dostep', title: 'Dostęp czatu: moduły i dane widoczne na Twoim koncie (Insider, Compass, Sygna, Counsel, Galena)', inner: null,
|
||||
const access = { slug: 'atrium', kind: 'dostęp', key: 'atrium:dostep', title: 'Dostęp czatu: moduły i dane widoczne na Twoim koncie (Insider, Workflow, Sygna, Counsel, Galena)', inner: null,
|
||||
text: `Czat czyta dane na koncie pytającego. Ma dostęp do: ${seen.join(', ') || 'żadnego modułu'}. Nie ma dostępu do: ${blind.join(', ') || 'brak takich modułów'}. ` +
|
||||
(law === null ? 'Insider (przepisy i orzeczenia): brak dostępu na tym koncie.'
|
||||
: 'Insider (przepisy i orzeczenia): dostęp jest. Czat pobiera tekst przepisu, akt albo orzeczenie, gdy pytanie podaje konkretne odwołanie, np. art. 471 k.c., art. 6 RODO, Dz.U. 2018 poz. 1000, sygnaturę II C 2145/25. Sprawdza też, czy przepisy, na które powołuje się umowa z Compassu, są aktualne. Szuka też przepisów po samym temacie pytania.') };
|
||||
: 'Insider (przepisy i orzeczenia): dostęp jest. Czat pobiera tekst przepisu, akt albo orzeczenie, gdy pytanie podaje konkretne odwołanie, np. art. 471 k.c., art. 6 RODO, Dz.U. 2018 poz. 1000, sygnaturę II C 2145/25. Sprawdza też, czy przepisy, na które powołuje się umowa z modułu Workflow, są aktualne. Szuka też przepisów po samym temacie pytania.') };
|
||||
const records = got.filter(Boolean).flat();
|
||||
// "What happened lately" read as "what ends soon" until the dates of what was done were one record.
|
||||
|
||||
@@ -2196,7 +2196,7 @@ const CHAT_GRAPH_RULES = new Set(['id', 'nip', 'nazwa', 'nazwa_organizacji', 'na
|
||||
const CHAT_VIA_RANK = { strona: 0, sprawa: 0, klient: 0, termin: 0, k1: 0, k2: 0, numer: 0, osoba: 0, id: 0, nip: 0,
|
||||
nazwa: 1, nazwa_organizacji: 1, k3: 1, nazwa_bez_formy: 2, przedstawiciel: 3 };
|
||||
const chatWeaker = (a, b) => (CHAT_VIA_RANK[b] > CHAT_VIA_RANK[a] ? b : a);
|
||||
const CHAT_VIA_PL = { id: 'ten sam kontrahent z listy Compassu', nazwa: 'ta sama nazwa', nazwa_organizacji: 'ta sama nazwa',
|
||||
const CHAT_VIA_PL = { id: 'ten sam kontrahent z listy modułu Workflow', nazwa: 'ta sama nazwa', nazwa_organizacji: 'ta sama nazwa',
|
||||
nazwa_bez_formy: 'nazwa bez formy prawnej', przedstawiciel: 'strona umowy wg przedstawicieli' };
|
||||
const CHAT_ID_PL = { nip: 'zgodny NIP', krs: 'zgodny KRS', regon: 'zgodny REGON', pesel: 'zgodny PESEL' };
|
||||
const CHAT_KIND_MOD = { umowa: 'compass', sprawa: 'sygna', termin: 'sygna', strona: 'sygna', kancelaria: 'counsel', zlecenie: 'counsel',
|
||||
@@ -2682,7 +2682,7 @@ function chatGraphAsk(ids, index) {
|
||||
// One fact per candidate, counted by code: the module where it has the most records.
|
||||
const fact = (e) => {
|
||||
if (e.type === 'sprawa') { const c = e.client && g.ent.get(e.client); return `Sygna: sprawa${c ? ', klient ' + c.name : ''}`; }
|
||||
const opts = [['Sygna', n(e, 'sygna:sprawa:'), (k) => `klient w ${chatPlural(k, 'sprawie', 'sprawach', 'sprawach')}`], ['Compass', n(e, 'compass:umowa:'), chatUmowy],
|
||||
const opts = [['Sygna', n(e, 'sygna:sprawa:'), (k) => `klient w ${chatPlural(k, 'sprawie', 'sprawach', 'sprawach')}`], ['Workflow', n(e, 'compass:umowa:'), chatUmowy],
|
||||
['Galena', n(e, 'galena:projekt:'), (k) => chatPlural(k, 'projekt dokumentów', 'projekty dokumentów', 'projektów dokumentów')],
|
||||
['Counsel', n(e, 'counsel:zlecenie:'), (k) => chatPlural(k, 'zlecenie', 'zlecenia', 'zleceń')]];
|
||||
const best = opts.reduce((a, b) => (b[1] > a[1] ? b : a));
|
||||
@@ -2809,8 +2809,8 @@ function chatCardLines(e, index, today, kind) {
|
||||
out.total.push(`${chatPlural(dls.length, 'termin niewykonany', 'terminy niewykonane', 'terminów niewykonanych')}${dls.length ? ` (po terminie: ${dls.filter((d) => d.days_left < 0).length})` : ''}`);
|
||||
}
|
||||
// Compass
|
||||
if (kind === 'osoba') L('Compass: umowy nie mają w danych osoby odpowiedzialnej, więc ich tu nie ma.');
|
||||
else if (chatCardBlind(index, 'compass')) L('Compass: brak dostępu na tym koncie, umów nie widzę.');
|
||||
if (kind === 'osoba') L('Workflow: umowy nie mają w danych osoby odpowiedzialnej, więc ich tu nie ma.');
|
||||
else if (chatCardBlind(index, 'compass')) L('Workflow: brak dostępu na tym koncie, umów nie widzę.');
|
||||
else {
|
||||
const sums = new Map();
|
||||
for (const r of contracts) if (r.contract.value_amount) sums.set(r.contract.value_currency, (sums.get(r.contract.value_currency) || 0) + Number(r.contract.value_amount));
|
||||
@@ -2820,11 +2820,11 @@ function chatCardLines(e, index, today, kind) {
|
||||
return `${c.number} „${c.name}”, kontrahent ${c.counterparty || 'brak'}${why(r).length ? ` (powiązanie: ${why(r).join('; ')})` : ''}, status ${c.status}, ` +
|
||||
`${c.value_amount ? `wartość ${chatMoney(c.value_amount)} ${c.value_currency}` : 'bez wartości'}, ${c.ends_on ? `kończy się ${c.ends_on}, ${d >= 0 ? 'za ' + d + ' dni' : -d + ' dni temu'}` : 'bez daty końca'}`;
|
||||
};
|
||||
const head = kind === 'sprawa' ? 'Compass, umowy przypisane do tej sprawy' : 'Compass, umowy';
|
||||
const head = kind === 'sprawa' ? 'Workflow, umowy przypisane do tej sprawy' : 'Workflow, umowy';
|
||||
L(contracts.length ? `${head} (${contracts.length}), łączna wartość ${[...sums].map(([cur, s]) => `${chatMoney(s)} ${cur}`).join(' i ') || 'nieokreślona'}, od najwcześniej kończącej się: ` +
|
||||
chatCap(contracts.map(item), contracts.map((r) => r.contract.number)) + '.'
|
||||
: `${head} (0): ${kind === 'sprawa' ? 'brak, w Compassie żadna widoczna umowa nie jest przypisana do tej sprawy' : 'brak, żadna widoczna umowa nie jest połączona z tym podmiotem po NIP, numerze sprawy ani pełnej nazwie'} (w rejestrze na tym koncie: ${chatUmowy(visible('umowa'))}).`);
|
||||
out.total.push(`${chatUmowy(contracts.length)} w Compassie${contracts.length ? ` (${counts(contracts, (r) => r.contract.status)})` : ''}`);
|
||||
: `${head} (0): ${kind === 'sprawa' ? 'brak, w module Workflow żadna widoczna umowa nie jest przypisana do tej sprawy' : 'brak, żadna widoczna umowa nie jest połączona z tym podmiotem po NIP, numerze sprawy ani pełnej nazwie'} (w rejestrze na tym koncie: ${chatUmowy(visible('umowa'))}).`);
|
||||
out.total.push(`${chatUmowy(contracts.length)} w module Workflow${contracts.length ? ` (${counts(contracts, (r) => r.contract.status)})` : ''}`);
|
||||
}
|
||||
// Galena
|
||||
if (chatCardBlind(index, 'galena')) L('Galena: brak dostępu na tym koncie, dokumentów nie widzę.');
|
||||
@@ -2921,7 +2921,7 @@ function chatCard(entId, index, today, { table = false, ja = false } = {}) {
|
||||
const lead = parts.lead.filter((r) => r.key !== e.rec);
|
||||
const out = { rec, lead, members, names: (r) => chatGraphNames(r.title || '', e, g), table: { head: [], rows: [] } };
|
||||
if (table) {
|
||||
const MOD = { sygna: 'Sygna', compass: 'Compass', galena: 'Galena', counsel: 'Counsel' };
|
||||
const MOD = { sygna: 'Sygna', compass: 'Workflow', galena: 'Galena', counsel: 'Counsel' };
|
||||
const items = new Map(((index.byKey.get('sygna:terminy') || {}).items || []).map((d) => [d.key, d]));
|
||||
const row = (r) => {
|
||||
const why = (e.why.get(r.key) || []).join('; ') || '-';
|
||||
@@ -2966,8 +2966,8 @@ function chatLinkCard(recKey, index, today) {
|
||||
const out = ps.map((e) => `kontrahent ${e.name} (powiązanie: ${(e.why.get(c.key) || []).join('; ')}) ${about(e, [c.key, ...except])}`);
|
||||
const mk = g.contractMatter.get(c.key);
|
||||
// Not assigned is said only when the field is empty: assigned to a matter the asker cannot see leaves no trace.
|
||||
if (mk) out.push(`umowa jest przypisana w Compassie do sprawy ${matter(seen(index.byKey.get(mk)))}`);
|
||||
else if (!c.contract.matter_ref) out.push('umowa nie jest przypisana do sprawy w Compassie');
|
||||
if (mk) out.push(`umowa jest przypisana w module Workflow do sprawy ${matter(seen(index.byKey.get(mk)))}`);
|
||||
else if (!c.contract.matter_ref) out.push('umowa nie jest przypisana do sprawy w module Workflow');
|
||||
return out;
|
||||
};
|
||||
const matterLinks = (m, except) => {
|
||||
@@ -3042,7 +3042,7 @@ function chatSearch(records, question) {
|
||||
|
||||
// ponytail: a module's keywords, enough for four modules; more modules want a question classifier.
|
||||
const CHAT_BLIND_WORDS = {
|
||||
'Compass (umowy)': ['umowa', 'umowy', 'umów', 'umowę', 'umowi', 'kontr', 'contr', 'wygas'],
|
||||
'Workflow (umowy)': ['umowa', 'umowy', 'umów', 'umowę', 'umowi', 'kontr', 'contr', 'wygas'],
|
||||
'Counsel Scorecard (kancelarie zewnętrzne, oceny)': ['zewnę', 'ocena', 'ocenę', 'oceny', 'ocen', 'ranki', 'score'],
|
||||
};
|
||||
// What the code answers itself: told the asker had no access, the model still said "there is none".
|
||||
|
||||
Reference in New Issue
Block a user