Repository navigation
feat: the Operations Central registers a client, and its administrator joins as first owner (step 4.2) - #52
Conversation
… as a union (step 4.2, U1)
…ients through identity's ports (step 4.2, U3)
…rrection, behind the operator's menu link (step 4.2, U4)
…ration deletes the test companies (step 4.2, U5)
…' lines to the roadmap's ceiling
…of adding to it, so setup time never counts
…as the lock, not before
… journey runs in Chromium (step 4.2, U6)
…t, and native joins no longer protect a reachable path
…e Central creates a company
|
Reviewer: Claude Opus 5.5 (claude-opus-5-5) Rules read: Ran
Findings
Checked and sound, with the item from the brief:
Verdictrequest changes: A8's must test for the race against acceptance cannot fail, and no removal row guards the correction's company lock (T12). Everything else is Fechamento or Issue futura, and the use script passes in the browser at all three widths and both themes. |
|
Reviewer: Sonnet 5.5 (claude-sonnet-5-5) Rules read: Ran
Findings
Judged, no finding:
Verdictrequest changes: two Bloqueia (1: a bounced administrator address strands the registration form after the client is committed; 2: the A8 "must" test passes with the company lock removed), at head |
…ner's invitation does, so a renewal never deadlocks it
…ow, a bounced administrator lands on the registered client, the first owner's page says P5, the list wraps on phones, a hidden Central names no place, native joins removed
…never scrolls the page
|
Reviewer: Claude Opus 5.5 (delta c131cd8..f65ed8d) Rules read: Ran
The fix list, item by item
Findings
No new defect in the other changed lines. I checked Verdictrequest changes: Bloqueia 2's fix leaves a note that outlives the bounced invitation and tells the operator to cancel the replacement. Every other Bloqueia and Fechamento of both reviews is closed, the A8 removal is caught, and the lock-order fix is proved by mutation. |
…ntence; the rename keeps its own company lock The registration opens the client with the bounced invitation's id, and the note shows only while that invitation is the client's live one, so a cancel or a new invitation removes it. Its words are 4.1's for a refused address. renameCompanyOn locks the company again, a no-op after the correction's lock that keeps the port safe alone; the removal row now checks the lock order by the renewal race.
|
Reviewer: Claude Opus 5.5 (delta f65ed8d..d38b41a) Rules read: Ran
The findings of conferência 1, one by one
Findings
I read every other changed line and found no new defect:
Carrying the invitation id in the operator's own URL exposes nothing new. The operator already receives that id in the client's response, and the server answers with Verdictapprove: conferência 1's Bloqueia is closed and a mutation proves it, all 4 of its Fechamento findings are closed, the A8 removal is caught, the lock order holds, and CI is green at d38b41a. One new Fechamento (the phrase written in rather than read from |
…exus-e042-build) into feat/conexus-e05-build
…AIL_BOUNCED's phrase (#65) The Central's note and its test take 4.1's sentence from the shared failure table instead of a copy of its words, so the two can never drift (second delta check of #52, closing item 1). Co-authored-by: developmentconexus <[email protected]>
Step 4.2, "Cadastro de cliente", built from the card
docs/steps/e042-cadastro-de-cliente.md, approved 2026-10-16 at819b1157ca1edc62fb83a5f31d07faa391e32716("Aprovo"). U2's table and grants came first in #48; this branch carries U1 and U3 to U6 on top of them, and merges #48's branch for its two test-only fixes (session.test.ts,database.test.ts), so the diff shrinks to this step's own once #48 lands.What the founder gets
The operator opens Central de Operação from the account menu and registers a client with CNPJ, razão social, display name and the administrator's e-mail. The company is born with no member, and the administrator receives "Conexus convidou você para ser o primeiro dono de X", creates a password and joins as owner. While the client awaits its administrator, the operator corrects its data and resends, cancels or reissues the owner invitation through step 4.1's routes. Once active, the Central shows the company's data and its owners only. Conexus never becomes a member, and nobody creates a company outside the Central.
Units
operations.client;hub_runtimereads, inserts and updates it, never deletes/api/clients: register, correct, list, read, through identity's ports; every invitation write goes through the plugin's adapterReview fixes, after the two whole-step reviews: 54f8db7 (correction's lock order), then the findings and
main, up to f65ed8d.Criteria and their proof (L19)
apps/server/src/hub/identity/admission.check.tsforges each proof variant;tscrefuses all threecompanies.test.ts"fora: o operador não lê empresa alguma…"operations/clients.test.ts"fora: o membro…"operations/clients.test.ts"sem membro…"; removaloperator-not-memberoperations/clients.test.ts"a chave…"; removalclient-attempt-replayoperations/clients.test.ts"o CNPJ…"operations/clients.test.ts"recusas…"; removalsclient-owner-not-operator,client-one-transactionoperations/client-reads.test.ts"corrigir: aguardando…"; "corrigir: contra o aceite que chega antes…" holds the company from a test connection, queues the acceptance then the correction: 409CLIENT_ACTIVE, name unchanged; "corrigir: contra a renovação…": both 200, never 40P01 (removalclient-correction-company-lock). The accept race is held twice, by the correction's lock and byrenameCompanyOn's, so no single removal reaches the first race testoperations/client-reads.test.ts"ler…"operations/owner-invitation.test.ts"o operador reenvia, cancela e convida de novo…"; removalowner-invitation-awaiting-onlyoperations/clients.test.ts"log…"clients.test.tsx,register-client-form.test.tsx(including "o endereço do administrador recusado…"),correct-client-form.test.tsx;owner-invitation.test.ts"o endereço do administrador recusado pelo provedor…"; the sweep's six Central statesaccount-menu.test.tsx,clients.test.tsx"sem o papel de operador…", the browser walk belowcompanies.test.ts"criar: POST /api/companies não existe mais…",sign-up.test.ts"empresa só pela Central…" (removalcompany-creation-closed),people.test.tsx"/companies/new… não existe mais",route.test.tsx"sem empresas, também para o operador…"platform/migrate.test.ts"a exceção de P6…"operations/owner-invitation.test.ts"primeiro dono…" (mail, read withfirstOwner),invitation.test.tsx"o primeiro dono de um cliente lê a frase de P5…",tests/e2e/client.test.ts(the page's sentence in Chromium); the founder's useThe rule the P6 B migration uses to choose what it deletes
apps/server/migrations/20261017014712_p6b_test_companies/migration.sql, in one transaction atmigrate:DELETE FROM auth.invitationwhere the invitation's company has no row inoperations.client.DELETE FROM auth.memberwhere the member's company has no row inoperations.client.UPDATE auth.session SET active_organization_id = NULLwhere that company has no row inoperations.client.DELETE FROM auth.companywhere the company has no row inoperations.client.Every company that exists before this release was created by the old "Nova empresa" and has no client row, so all of them go, with their members and invitations. People, accounts and sessions stay. The founder confirms the exact list before the release, as the card says. A rollback does not bring them back (the declared exception to data D6).
Declared departures (L7)
getOrgAdapter), not the endpoints, which admit only a member. The Hub's admission stays the single gate (C26, S6). Recorded indocs/reference/boundaries.md, "A company with no member and every invitation, through the plugin's adapter".CLIENT_OWNER_IS_OPERATORalso oncreateInvitation, so the operator cannot invite an operator as first owner through step 4.1's routes either.pageOf,pageKeyandaftermoved fromidentity/companies.tstoplatform/pages.ts, now that two subjects page.Pagermoved fromhub/identitytoui.client-reads.test.tsfromclients.test.ts; A16's server test lives inowner-invitation.test.ts, notinvitation-journey.test.ts.admitOperator, so a non-operator learns nothing from a key.mayCreaterenamedmayOperatein U4 rather than U5, since the menu link needed it first.refetchOnMount: false) to knowmayOperate; two keyboard harness tests now reload to read it.migrateagain.plantCompany), and Ana owns them as a person, not the operator, since the operator is never a member.Menu.LinkItemdefaultscloseOnClickto false; the wrapper now closes like any item,components.mdnotes it), and the client list answered 500 once a first owner accepted (an accepted owner invitation was shaped as if still awaiting).people.test.tsx"Convidar de novo" no longer asserts the order of two parallel reads, which nothing orders; it asserts each list is read once more.database: { joins: true }removed with its removal rowlibrary-joins-native. Its test created a fourth company through the plugin's endpoint, which is closed; the only other caller,/organization/list, is not exposed. Without it the whole server suite passes and pg prints no concurrent-query warning. The rowinvitation-replay-resends-unmailedfollows U6's new text.correct()now locks the company before the operator's row and the client, the order the owner's invitation, its renewal and its accept keep. The card's correction locked the operator's row first and deadlocked a renewal (40P01), found by step 5's build (feat: two companies isolated by scope and row policy, and the Central deletes a client (step 5) #54, departure 1); this is the same fix, through identity'slockCompanyport.client-reads.test.ts"corrigir: contra a renovação do convite de dono…" queues a renewal and then a correction on a held company: 500 with 40P01 before, both 200 after.mailBounced: true, instead of 422MAIL_BOUNCED(removed fromregisterClient's failures). The form opens the client with "Cliente cadastrado. Esse endereço não recebe e-mails. Cancele o convite e use Convidar outro e-mail.", reusing 4.1's sentence for a refused address. The search carries the bounced invitation's id (convite=<invitationId>), and the note shows only while that invitation is the client's live one: a cancel or a new invitation removes it (register-client-form.test.tsx"o aviso do endereço recusado vale só para aquele convite…"), and the invitation is marked mailed, so a replay does not resend. The native, smallest shape: no column, the provider's answer travels with the one response that saw it. A provider that may not have sent still answersMAIL_UNAVAILABLE, and the same key resends (C37).firstOwneron the received invitation (InvitationView, derived from "no member yet", no column), so the page says P5's sentence, "Conexus convidou você para ser o primeiro dono de X.", as the mail does.renameCompanyOnkeeps its own lock of the company, so the port is safe on its own; the correction takes the same lock first, for the lock order, and the second one on a held row changes nothing.invitationExpiryreads the plugin'sinvitationExpiresIninstead of a copy of the number.smand wrap anywhere, so the CNPJ, the administrator's e-mail and a long name stay whole; the client's title and owners wrap instead of cutting. A page the guard hides names no place in the header (Central de Operaçãowas shown on the 404).tests/e2e/invitation-image.test.tscreated its company withPOST /api/companies, which U5 removed (404 in CI's image job). In the image the first person is the operator, so the test now registers a client and checks the owner's invitation mail, with the same checks on sender, link, fallback, expiry and no remote image. Passed locally against an image built from this branch.tests/e2e/live-hub.tsholds what both journeys share (the live Hub, the mail provider's door, the browser's route), moved out ofinvitation.test.ts; knip's root project includestests/e2e.New dependency (L16)
@brazilian-utils/brazilian-utils2.5.0, inpackages/hub-apiandapps/web:isValidCnpj(v, { version: 2 }), the founder's choice in the card. A small validator, cheap to undo, not on the list of expensive choices.Change size
npm run change-budget -- --base origin/main: 2,553 changed lines without tests and generated files, under the card's 3,950. The per-unit split runs over in U1 (901 of 400), U5 (1,529 of 400) and U6 (901 of 300), because a commit's lines count against its unit: U5 carries the migration's generated snapshot and the removal of the old creation path, and U6 the shared e2e module and the two fixes above. U3 (1,380 of 1,650) and U4 (866 of 1,050) are under.Checks run locally
npm run verify(lint, typecheck, deps, knip, docs, openapi, suppressions, every test, build): green.npm run migrations -- --base origin/main: ok.node scripts/removals.ts: every row caught. After the review fixes, the affected suites ran again: server 255, web 119 vitest (the knowncache.test.tsxload timeout passed alone) and 182 node/browser, both e2e journeys, and the touched removal rows, all caught.npm run e2e: both journeys pass.npm run test:imageagainst an image built from this branch: passes. All on PostgreSQL 18 in Docker, shaped like CI.The browser walk (T23)
The repository's Playwright Chromium against a local Hub on PostgreSQL 18 in Docker, the mail provider faked at its door. The use script's 16 states (the operator's home, the menu, the empty Central, the registration with a wrong CNPJ, with the operator's own e-mail and with a CNPJ that exists, the client awaiting, the list, the owner's invitation before and after the password, the owner's company, the active client and list, the operator's home after), each at 1366, 390 and 320 px in light and dark: no horizontal scroll, no console error or CSP refusal, every Tab stop with a 2px outline, and the menu closes after its link. Traces of both browsers kept. The owner's mail rendered at 600 and 320 px, light and dark, says "Conexus convidou você para ser o primeiro dono de X." in subject and body.
Closing list (L19)
docs/architecture.md"Roll back": record the D6 exception, P6 B's one-time deletion.registerClientanswers 201 withmailBouncedwhen the provider refuses the administrator's address, and no longer fails withMAIL_BOUNCED.invitation: ["cancel"]permission; the Hub's admission (admitInviter,invitation: ["create"]) gates them, which gives the same result for today's roles.