Repository navigation
feat(db): the Hub's login loses its reach on a company's tables, phase 2 (step 5, U7) - #55
Merged
Merged
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
…t/conexus-e05-build
…at/conexus-e05-build
…s bound each scope's role (step 5, U3) The operator's policies and the invitation scope's read of members come in the next two commits, each provisional until the founder's word; the Central's and the link's tests turn green with them.
…through one SECURITY DEFINER helper (step 5, U3, provisional A) Firstmate's provisional choice A of 2026-10-17, waiting for the founder's word: the helper is owned by hub_administrators, a role that cannot log in and reads only administrators' rows, and only hub_operator executes it. Without it the operator's policies on auth.member and auth.user expand each other, which PostgreSQL refuses. Swapping it for option B replaces this commit.
…company (step 5, U3, provisional A) Firstmate's provisional choice A of 2026-10-17, waiting for the founder's word: Better Auth's accept counts the company's members for its limit and reads back the member it inserts, and step 4.1's link view reads whether the person joined and whether the company has a member yet. Swapping it for option B replaces this commit.
… its people stay (step 5, U4)
DELETE /api/clients/{companyId} deletes the client's record, then its company,
members and invitations through the organization adapter, in one transaction.
The plugin's own deletion route is closed. A correction and a deletion now lock
the company before the operator's row, the order the owner's invitation keeps:
the other order deadlocked a deletion or a correction against a renewal.
…step 5, U5) An alert dialog on the client's page asks for the client's name, sends it with the revision read, and leaves for the list with a notice on 204 or 404. An answer that did not settle keeps the dialog. The old design's danger buttons are built: neutral on the page, full danger at the confirmation (design V55). A reload during a registration loses the key and redoes nothing (J).
…es one (step 5, U6) The journey of the card in Chromium against a real Hub: B's address answers not found to A's owner, the Central deletes B once its name is typed, B's CNPJ registers again, B's owner still signs in, B's link no longer opens, and A stays.
…e Central creates a company
…e 2 (step 5, U7) Drops the transition policies and revokes hub_runtime's grants on auth.company, auth.member, auth.invitation and operations.client, after v0.5.0 runs on the scope roles alone. The test harness and the CI leg that applied this phase ahead of its migration go with it.
…ep 5, U5) Only a reload, which runs no cleanup, keeps the mark; an in-app exit after an undecided answer no longer sends the next registration to the list.
…tep 5) After a database error the transaction is aborted and entering the company scope again fails with 25P02; that error no longer replaces the first one.
…-mail and stamp (step 5, U2) UPDATE on auth.user for hub_invitation narrows to the columns the password command writes; a person's role is not writable from the link scope.
…n patch is read (step 5, U7)
…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.
…at/conexus-e05-build # Conflicts: # apps/server/src/hub/operations/clients.ts # apps/server/src/hub/operations/routes.ts # scripts/removals.json
…exus-e042-build) into feat/conexus-e05-build
…tep 5, U3) operator_all on auth.company splits: the Central still reads and creates any company, but UPDATE and DELETE hold only for the scope's company, as on members, invitations and clients. An unfiltered change in A's scope leaves B and an empty C.
…s company scope (step 5) accept-one-transaction and client-one-transaction name libraryCommandOn's line, which libraryInstallationOn now repeats. membership-page-anchor-scoped survived because the person scope's member policy holds the same rule; its row becomes person-member-policy, caught by isolation 'positivo'. New row operator-company-scope.
deleteCompanyOn's comment cites the plugin's closed endpoint (crud-org.mjs:255) and its membership refusal (:264-268), and no longer C50; boundaries.md says no check follows the deletion, as the code does. deleteClient's body takes the company name schema and a shared Revision, so an empty or over-long name is malformed. The delete dialog invalidates the list by a key derived from the operation (web W11).
A member's invitation, renewal and cancellation now go through the plugin's endpoints, still in the company's scope; the mail after them keeps the sender's scope and takes main's delivered or refused outcome; the owner's mail keeps the operator's scope. Both sides' removal rows stay. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Since step 4.2's closing a member renews through the plugin's endpoint with resend, whose expiry write uses ctx.context.adapter (crud-invites.mjs:135-143) instead of getCurrentAdapter, so it left the company scope's transaction for the Hub's login, and failed in phase 2. The adapter createAuth gives the library now reaches getCurrentAdapter on every call. New test: a refusal after the plugin's write takes the new expiry back; removal library-adapter-joins-transaction.
…conexus-e05-build Its tree is already main's; the merge makes the approved card commit 3fa4793 an ancestor for the approval check.
…t/conexus-e05-phase2
…tep 5, U7) The second phase's migration is generated again after 20261017110517, which v0.5.0 applies, so the history no longer branches (drizzle-kit check); its SQL is unchanged. boundaries.md's deletion entry wraps at 100 columns; library-adapter-joins-transaction also names the phase-2 renewal test, which now catches it. Decision 0039 holds main's A1 and A2 and the result under its 350 words.
Main's tree is the build branch's at ea81cc9, already merged here.
accept-one-transaction and client-one-transaction take out runWithTransaction, but since joiningTransaction the plugin's own transaction joins the Hub's through the adapter as well, so their tests stay green and the rows prove nothing (testing T12). boundaries.md names the tests that guard both joins.
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.
Step 5, U7: the second phase (D11). Aguarda a palavra do fundador on the grant list, and his confirmation of H, before it merges. It ships after v0.5.0 is checked, as v0.5.1.
20261017051515_runtime_loses_company_reachdrops theruntime_transitionpolicies onauth.company,auth.member,auth.invitationandoperations.client. It also revokes all ofhub_runtime's grants on those four tables. A-- contract:line states D6's contraction.database-grants.sqlloseshub_runtime's four table grants. This is the list for the founder's word.CONEXUS_TEST_PHASE) goes, and so does CI's phase matrix leg. The catalog test's phase-2 skips are gone: "o login do Hub não lê nem grava as tabelas de empresa" now always runs.hub_runtime. The narrowing to one column for lock-only UPDATEs is in feat(db): step 5 scope roles and their grants, phase 1 (step 5, U2) #53, which this branch carries through the build.Proof: the full server suite on this branch passes 269 of 269.
catalog.test.tspasses 18 of 18, including the snapshot equality.npm run migrationsis ok.Base:
feat/conexus-e05-build(#54), so the diff is U7 alone. It is retargeted once #54 lands.