Skip to content

refactor(azure)!: retire azure.members.create and setAssocNumber - #127

Merged
BIA3IA merged 1 commit into
mainfrom
refactor/retire-azure-member-writes
Nov 10, 2026
Merged

BIA3IA merged 1 commit into
mainfrom
refactor/retire-azure-member-writes

Conversation

@toto04

@toto04 toto04 commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Closes #122: the last item, retiring the old write procedures now that the dashboard has switched to soci.members.* (PoliNetworkOrg/admin#155, PoliNetworkOrg/admin#158).

Changes

  • azure.members is read-only: only getAll stays. create and setAssocNumber are removed. Their replacements are soci.members.admit and soci.members.setNumber, which also write the Libro Soci.
  • Tests:
    • The removed router tests were the only coverage of src/azure/member-writes.ts (the write lock and pending-number cache), which soci.* still uses. Their scenarios move to tests/azure-member-writes.test.ts, which tests the module directly. Turning rememberNumber into a no-op makes 4 of them fail.
    • The check that logged errors redact email addresses moves there too.
    • tests/idp-router.test.ts now asserts that azure.members.getAll is the only azure.members.* procedure.
  • README and comments no longer mention the removed procedures.

Deploy

  • Breaking: deploy this only after the dashboard build with feat(people)!: add Soci › Register, the socio page and Admit socio admin#158 is live. The admin repo no longer calls either procedure; it only uses azure.members.getAll.
  • After deploying, the azure:members:create and azure:members:write permissions in Auth (each granted by two roles) are no longer used by anything here and can be removed.

Checks

tsc, biome check, vitest (305 passed, 11 skipped: the Postgres suites, which need a database) and build:npm pass locally.

The dashboard now admits soci and changes member numbers through
soci.members.admit and soci.members.setNumber (PoliNetworkOrg/admin#155),
which keep the Libro Soci in step with Microsoft 365. azure.members is
left read-only, with getAll.

The router tests were the only coverage of the shared lock and
pending-number cache in member-writes.ts, which soci.* still uses, so
their scenarios move to direct tests of that module, along with the
check that logged errors redact email addresses.

BREAKING CHANGE: azure.members.create and azure.members.setAssocNumber
are removed. Use soci.members.admit and soci.members.setNumber.

Closes #122
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Azure members router now exposes only directory reads. Admission and member-number changes are identified as Soci procedures. Tests cover Entra-side write serialization and verify the remaining Azure member procedure.

Changes

Azure member write retirement

Layer / File(s) Summary
Entra write serialization coverage
src/soci/service.ts, tests/azure-member-writes.test.ts
The comment describes the Entra-side lock and pending-number cache. New tests cover serialized writes, pending reservations, stale directory reads, external changes, deletion, and email redaction in error details.
Retire Azure member mutations
src/routers/azure/members.ts, src/routers/azure/groups.ts, README.md, tests/azure-router.test.ts, tests/idp-router.test.ts
The Azure members router removes its creation and number-update mutations. Documentation and comments identify soci.members.admit and soci.members.setNumber for those operations. Router tests remove mutation coverage and verify the read-only Azure member policy.

Possibly related PRs

Change: Other

Merge Risk: Minimal · up to a41fe

This removes the two Azure member write procedures and leaves reads in place, with the Soci procedures taking over admission and member-number changes. No concrete problem was found. Deploy it only after the dashboard build that uses the Soci procedures is live, as the PR description says.

Pre-merge checks: Passed 3 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Linked Issues check Inconclusive Issue #122 explicitly requires retiring azure.members.create and azure.members.setAssocNumber after the dashboard switch. The PR summary says those procedures were removed and `azure.members.getAl… Provide reviewable evidence from the reviewed head for the schema and migration, exported soci.* contract types, and the remaining required tests. This evidence is needed to decide whether all #122 coding criteria are met.
Passed Passed checks: 3 passed

Check name Status Explanation
Title check Passed The title clearly identifies the removal of azure.members.create and setAssocNumber, the main change in the pull request.
Out of Scope Changes check Passed The procedure removal implements #122's explicit retirement objective. The moved src/azure/member-writes.ts tests cover behavior that soci.* still uses. The router assertion, README change, and co…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Out of Scope Changes check

Explanation

The procedure removal implements #122's explicit retirement objective. The moved src/azure/member-writes.ts tests cover behavior that soci.* still uses. The router assertion, README change, and comment updates document or verify the retirement. The available change summary shows no unrelated changes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 6 files. (1 skipped: 1 unsupported.)

Full details: Linked Issues check

Explanation

Issue #122 explicitly requires retiring azure.members.create and azure.members.setAssocNumber after the dashboard switch. The PR summary says those procedures were removed and azure.members.getAll remains. At the reviewed head, src/soci/router.ts defines the replacement soci.members.* procedures and policies. src/soci/service.ts shows number-reuse and active codice fiscale checks, admission cleanup after a failed record write, and existing-account registration. The available evidence does not establish the database tables and migration, exported contract types, or the required tests for codice fiscale validation, registration, and mismatches. I cannot confirm every coding requirement in #122.

Resolution

Provide reviewable evidence from the reviewed head for the schema and migration, exported soci.* contract types, and the remaining required tests. This evidence is needed to decide whether all #122 coding criteria are met.

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: PoliNetworkOrg/backend
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: 8714ed0
  • Layers: Repository YAML (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 63ef0569-48c9-4890-abe0-98c34402371a
Commits

Reviewing files that changed from the base of the PR and between 8714ed0 and a41feb4.

Files selected for processing: 7

  • README.md
  • src/routers/azure/groups.ts
  • src/routers/azure/members.ts
  • src/soci/service.ts
  • tests/azure-member-writes.test.ts
  • tests/azure-router.test.ts
  • tests/idp-router.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@toto04
toto04 enabled auto-merge (squash) November 10, 2026 16:40
@toto04
toto04 requested a review from BIA3IA November 10, 2026 16:40
@BIA3IA
BIA3IA disabled auto-merge November 10, 2026 16:51
@BIA3IA
BIA3IA merged commit a0bbec1 into main Nov 10, 2026
2 checks passed
toto04 added a commit that referenced this pull request Nov 17, 2026
Resolve the conflicts with main:
- azure.members is read-only on main (#127): take main's router and tests;
  the audit annotations for create/setAssocNumber go with them.
- Renumber the audit events migration to 0040, after main's 0033–0039. The
  SQL is unchanged; drop common_audit_events on a database that ran the old
  0033 before migrating again.

Declare how main's new mutations are recorded, so the router walk passes:
- soci.*: minimal, naming the socio by member number; the Libro Soci keeps
  its history in soci_activity and its inputs carry personal data.
- regulations.*: full, keeping only reference fields (ids, states, roles,
  titles), never comment bodies, quotes, delibere or notes. collabTicket is
  not recorded: it hands out a connection ticket and changes nothing.
- web.documents.*: full.
- Add regulations and soci to the audit.list area filter.

Also restore the People target's validated fallback on the input id, which
the autofix in b2569ac had dropped while its test still expected it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[People · Phase 2] Soci register and admission

2 participants