Repository navigation
feat(regulations): add the regulations.* contract and data model - #110
Draft
lorenzocorallo wants to merge 5 commits into
Draft
lorenzocorallo wants to merge 5 commits into
lorenzocorallo wants to merge 5 commits into
Conversation
The wire contract of the regulations editor (shared with the admin dashboard, which keeps a copy like people.contract.ts) and the tables behind it: documents, published versions, drafts, per-draft assignments, Yjs state and update log, collab tickets, snapshots, comments, delibere, LLM diffs, compile cache, merges, emanations, notifications and deleghe.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This was referenced Nov 2, 2026
Draft
Draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First PR of the regulations editor backend (spec:
regulations-editor-spec.md, phases 2 and 4). It publishes theregulations.*wire contract early so the admin dashboard, the bot and the deployment can align, plus the tablesbehind it. The router, services and the collab/worker entrypoints follow in stacked PRs.
Contract (
src/regulations/contract.ts)The admin keeps a copy, like
people.contract.ts. Highlights:regulations.me.get→{ assignedDrafts, deleghe, permissions }, callable by any signed-in dashboard accountwith no permission, so people with only a draft assignment are admitted to
/dashboard.drafts.getreturnsmyRoleandcan(edit, comment, assign, merge, transitions withblockedBy, approve,emanate, rectify, regenerateDiff, delete, rename, snapshot, restore), plus deadlines (3 days to emanate, 10 days
for oppositions) computed by the backend from the document's procedure configuration.
collabTicket({ draftId })→{ url, documentName, ticket, role, readOnly, expiresAt }: single-use, about aminute. Y.Doc layout: document name = draft id,
ydoc.getMap("files")path →Y.Text.compile.pdf,versions.pdf,diff.pdf) are{ fileName, contentType, base64 }, likeesign; superjson has noUint8Arraysupport here.Y.encodeRelativePositionplus the quoted text).ours/theirs/ custom text); diff with LLM categories andper-article word diffs; emanation steps
pr|checks|merge|tag|release|email|telegram; deleghe.Data model (
src/db/schema/regulations, migration0033_regulations)documents (from
legal.json), versions (full sources per published version), drafts (base version or draft, basetext for 3-way merges, frozen text, one
in_approvazioneper document via a partial unique index), assignments,ydocs+yupdates(Yjs state with an append-only update log compacted by the collab service), collab tickets(hash only, single use), snapshots, comments, delibere, diffs (one row per generation), blobs (content-addressed
PDFs), compile cache + per-draft compile status, merges (the source's text at the last merge is the next base),
emanations (resumable steps), notifications (proof of every send) and deleghe.
Checks
bun run typecheck,bunx biome ci ., migration applied on Postgres 18.