Repository navigation
feat: count writer slots by the diary's walk on the clients - #722
Merged
Merged
Conversation
community.join checks the own diary's slot walk instead of the CWs held. A group join that replaces this device's writer (retired by a leave, or naming a retired CW) writes the off join and a cut at the length held before the new join, once the walk has room.
The browser node checks group and community joins against the own diary's slot walk, cuts the writer a join replaces before the new join, and reports the live and frozen slots in group.info and community.info (writersFrozen, frozenRoom, and Geral's). The sync fetches up to 32 cores per (group, diary), as the seeder holds them, and the community fold reads the diary cuts. Leaves and grants name the live writers only, as the core node does.
The sync fetches up to 32 cores per (group, diary), the 8 live, 8 frozen and 16 released writers of the diary's slot walk, as the seeder holds them: a frozen or released writer may hold a leave the fold reads. The slots still go to the earliest proven joins.
The rekey policy's facts skip the group-sealed blocks a frozen or released writer wrote at or past its cut, as the fold drops them. Its key blocks still count. Both nodes pass the fold's cuts.
The diary root adoption keeps the own diary's cuts with its joins, so a writer that takes a slot a cut released binds its root and is chased. liveDiaryWriters moves to the module so a unit test reaches it, and an end-to-end test has a second device fetch such a root.
With a node that reports frozenRoom, the reserve warning says each device uses one of the account's 8 slots and that disconnecting an old one in Aparelhos conectados gives it back, or that it no longer does once the frozen reserve is gone. A full-root refusal at 8 live devices points there too. An older node keeps the old words.
protocol.md and rpc.md say joins count the own diary's live slots, how a replaced writer is cut, the sync cap of 32 per diary, and the new writersFrozen and frozenRoom fields of group.info and community.info. app.md follows the new reserve warning. Changelog and verification fragments for the branch.
Conflict only in the web-member sync.js exports: both the slot walk names of this branch and the retry names of #715 stay.
The reserve warning and the full refusal name the way to the connected devices screen as Ajustes lists it, and the test ties the words to its label.
community.join retires the CW it replaces as group.join does: its off join and its cut count in the walk check before anything is written, then the cut goes after any leave the join appends to that CW and before the new CW's join. Both nodes.
A demotion past MAX_GROUP_CUTS writers names the first by key and is never refused; only a grant past the cap gets COMMUNITY_FULL.
The community fold of the sync catalogue reads the diaries' cuts, like the group fold, as foldCommunity does: a CW a cut let in is awaited before the fold gives the catalogue. The fold moves to foldedCatalogue, a pure helper with its own test.
protocol.md: community.join cuts the retired CW like group.join, the community fold reads the diaries' cuts like the group fold, and a community demotion is never refused for its size. rpc.md 5.37 counts the live slots of the walk. The changelog and the verification file cover the merge of main, the new tests, their proofs and the decisions.
The core node's sync catalogue fold now passes the diaries' cuts to buildCommunity, like the group fold, loadCommunity and the two browser paths. The fold moves to heldCatalogue, a pure module function, so a unit test reaches it.
A group admit, ban or demotion written by the core node left out a frozen writer whose cut was at or below its length, since it takes no probe post. A record that does not name a writer covers it from seq 0, so a core ban hid that writer's posts below its cut while the browser node kept them. groupCuts now also names every frozen writer the fold counts, at its length or the diary's cut when lower, and never a released one, as cutsFor does.
The fold lists the groups by key and the keys are random, so the control assertion compared against a fixed order and failed in some runs.
A rejoin skipped the cut on this device's retired writer when the diary already had a mark at or below it. If that mark came while the frozen reserve was full, the writer stayed live, and every later join planned only the off join and got GROUP_FULL. Both nodes now write the cut again while the walk has the writer live, at the lowest mark when that is lower, never higher, and run makeGroupRoom before the off join and the cut, as communityJoin does.
The full refusal now reads "Para liberar a vaga, desconecte um aparelho antigo em Ajustes, Aparelhos conectados." With frozenRoom 0 the warning says a disconnect may not give the slot back, since a cut at 0 still releases one while releases remain.
rpc.md 5.42 says frozenRoom covers cuts of 1 or more, and 5.63 names the own diary's 8 live slots among the community.join errors, as 5.37 does. protocol.md "Bounds on hints" says both nodes keep the 32 earliest proven joins per group and diary, and that only the diary itself can write joins its walk refuses. The roomFor comment says its count is stricter than the walk. The verification file records this round.
Brings in #716, #717 and #718. Conflicts: the web sync.js exports keep both lists (restartWait and the restart constants with WALK_TYPES, liveDiaryWriters, foldedCatalogue and MAX_GROUP_HELD_PER_DIARY); the test files keep the tests and imports of both sides, and sync-groups-3 drops MAX_GROUP_WRITERS_PER_DIARY, which only the cap loop now replaced by CAP used.
The return in this test replaces this device's cw2 after the leave it writes there, so the diary now holds the cut on cw2 at its length (#350). The assertion pins that cut as the only mark, with the leave below it, and still means no root is marked before the later leave.
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.
Parte da #350.
O que muda e por quê
Os clientes passam a contar as vagas de escritor pela caminhada das vagas do próprio diário (#713), a mesma regra dos semeadores e da dobra.
GROUP_FULL,COMMUNITY_FULL).group.infoecommunity.infodo navegador informamwritersFrozenefrozenRoom, ewritersBoundé o número de vagas vivas (rpc.md 5.37, 5.42, 5.59 e 5.63).docs/protocol.md("Writers named by a node", "Bounds on hints", "Slot walk") descreve as regras. Os Termos não mudam.Como verificar
Os testes, o que cada um cobre, a prova de que falham sem a mudança e o que fica de fora estão em
docs/verification/feat-writer-slot-clients.md.Local, com a
mainem c0f85f2:npm run lintlimpo,npm run demotermina com DEMO OK enpm test -- --affected=origin/maincom 833 arquivos e uma falha, empackages/core/test/community-member-leave-5.test.js: o teste 7 esperava nenhum corte antes da saída final, e a volta agora corta o escritor que ela troca. O teste passou a fixar esse corte (0c9be34) e passa sozinho com 10/10. Depois veio amainem 5ff127c, num merge sem conflito.Não conferi no Android nem no simulador iOS: a recusa e o aviso novos só aparecem com as 8 vagas em uso ou sem reserva, e
apps/app/test/groups.test.jscobre os dois textos.Checklist
npm run lint,npm test -- --affected=origin/mainenpm run demopassamdocs/changelog/feat-writer-slot-clients.mde verificação emdocs/verification/feat-writer-slot-clients.md