Repository navigation
feat(db): operations.client table and the Hub login's grants on it (step 4.2, U2) - #48
Merged
Merged
Conversation
…' lines to the roadmap's ceiling
…of adding to it, so setup time never counts
…as the lock, not before
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.
Adds Conexus's client record, the table
operations.client, and the grants the founder approved for it, in a pull request of its own before the step's code (data D11). Card:docs/steps/e042-cadastro-de-cliente.md, U2.What changes
apps/server/src/hub/operations/tables.ts: schemaoperations(data D4), tableclient:company_id text PRIMARY KEYwith no foreign key to identity (data D17);cnpj text NOT NULL, unique asclient_cnpj_key,CHECK (cnpj ~ '^[0-9A-Z]{12}[0-9]{2}$');legal_name text NOT NULL, 1 to 150 characters byCHECK;revision integer NOT NULL DEFAULT 0 CHECK (revision >= 0);attempt_key text NOT NULL, unique asclient_attempt_key_key;registered_at timestamptz NOT NULL. The two unique constraints are named so the registration maps the 23505 by constraint name (code C52).apps/server/migrations/20261017010336_operations_client: generated by drizzle-kit 1.0.0-rc.4; only adds (data D6).apps/server/migrations/20261017010337_operations_grants: custom SQL.USAGEon schemaoperations,SELECT, INSERT, UPDATEonoperations.clientforhub_runtime, noDELETE.apps/server/database-grants.sql: the snapshot gains the schema and table owners and the two grants.apps/server/src/platform/catalog.test.ts: the Hub login receives 42501 onDELETEfromoperations.client.The founder's word
Card page, "A decisão sua pedida nesta etapa": "Aprovo" (option A:
hub_runtimereads, inserts and updates, never deletes), 2026-10-16. The card was approved at819b1157ca1edc62fb83a5f31d07faa391e32716.The roadmap's approval line
check-approvalrefused every tip since the card merged:docs/roadmap.mdhad no line for step 4.2. This PR addsCartão da etapa 4.2 aprovado em 2026-10-16 (commit 819b1157ca1edc62fb83a5f31d07faa391e32716): "Aprovo". The line puts the roadmap over its 1,500-word ceiling, so three lines of closed steps lose words. No founder answer, approval or use line changes:uma mudança no Hube volta atrás." Removed:uma mudança no Hub.com e-mail e senha,e sai." Removed:com e-mail e senha,.ecancela ou recusa um." Removed:e.Declared departure: a test-only fix in
session.test.tsCI's
removals (1)shard reportedbroken-baseline session-total-lifetimetwice: the test "prazo total: usada a cada 25 min…" failed with the protection in place. Cause:elapseadded each step's span to the session's timestamps, so the session's age was the virtual 8 h minus 1 s plus every real second since sign-in. As the first test of a cold shard, it spent more than 1 s and crossed the boundary at "8 h menos 1 s" (reproduced locally with a 1.5 s pause after sign-in:actual: 'SIGNED_OUT').ageTonow sets the age from the database clock right before each read, so setup time never counts. The steps, limits and assertions stay the same; with the pause the test passes, and bothsession-total-lifetimeandsession-total-at-readare still caught.Declared departure: a test-only fix in
database.test.tsThe next CI run failed
server (4)on "uma leitura parada além do prazo" withMissing expected rejectionafter 112 ms. Cause: the test fired the holder of advisory lock 777 without waiting for it, so a fast runner let the read take 777 first, and the read never stalled. The read now starts oncepg_locksshows 777 granted to the holder (5 s guard). The read deadline, the 15 s check and every assertion are unchanged;read-deadline-is-the-databaseis still caught.Proof
catalog.test.tsandmigrate.test.tson a local PostgreSQL 18 shaped like CI: 25 of 25 pass, including the snapshot equality and the new 42501.npm run migrations -- --base origin/main: ok.biome check .,knip,deps, server typecheck,docs: clean.No new dependency. No code reads the table yet; U3 on the step branch does.