Skip to content

IDN-02 (1/5): group identity code by kind folders (moves only) - #61

Open
milanPR15 wants to merge 1 commit into
mainfrom
refactor/identity-kind-folders
Open

milanPR15 wants to merge 1 commit into
mainfrom
refactor/identity-kind-folders

Conversation

@milanPR15

@milanPR15 milanPR15 commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Part 1 of 5 of IDN-02, split from #55 on review request. Review and merge in order: 1 → 2 → 3 → 4 → 5. Each part targets the previous part's branch, so its diff shows only its own changes; after a part merges, GitHub moves the next PR onto main. Please merge without squash, so the next parts stay conflict-free.

Component and requirement IDs

Changes

Identity code is regrouped by kind (Entities/, Enums/, Interfaces/, Models/, Services/, Persistence/), with one public type per file. Only moves and namespace updates; no logic, route or migration content changes. This PR is separate so that the IDN-01 and IDN-03 owners can confirm it on its own.

Owner Files What happens
IDN-01 (Antonija Mitić) Platform.Identity/{Application,Composition,Contracts,Domain,Infrastructure}/*, Platform.Api/Endpoints/AccountEndpoints.cs, Platform.Api/Security/* Moved to the kind folders. AccountSnapshot and CreateAccountRequest get their own files. The AccountDbContext migrations move to Migrations/AccountDb/; InitialAccounts.cs is unchanged, and only the entity type names in the designer and snapshot follow the new namespace.
IDN-03 (CvijicIgor1) Platform.Api/Services/Identity/Adapters.cs, ChangeAccountStatus.cs, the identity interfaces, Domain/Identity/* Adapters.cs is split into one file per class. The interfaces move to Interfaces/Identity/, the records to Models/Identity/ and the enums to Enums/Identity/. UserAccount and AccountStatus move to Platform.Identity, and the two identical AccountStatus enums (IDN-01 and IDN-03) become one.
Team 1 (US-01) IIdentityContext, ISessionManager, AuthenticationLevel Moved to the same folders; content unchanged.
Callers and tests Program.cs, LoginController, LoginAccount, SessionValidationMiddleware, Platform.Tests/Identity/*, Platform.Kt1.Tests/MainCompositionTests.cs Only using lines and namespaces change.

Verification

  • dotnet build backend/SecurityLab.slnx -c Release: 0 errors, 0 warnings. Platform.Identity.Tests, which is not in the solution on main, also builds.
  • dotnet test backend/SecurityLab.slnx -c Release: all pass. Platform.Tests 70, Kt1 65, Audit 95, Authoring 55, Laboratories 31, RateLimiting 24, LabMetadata 7.
  • Git detects most files as renames (60 files, +296 / −210).

Architecture and data flow

No change in behaviour. The folder layout is described in part 5 (docs).

Security checks and negative tests

None added. All existing IDN-03 negative tests (non-admin, self-change, invalid status, audit injection) still pass unchanged.

Dependencies

  • Base: main. Next: part 2.
  • IDN-01 and IDN-03 owners: please confirm the moves.

Stack

  1. IDN-02 (1/5): group identity code by kind folders (moves only) #61 group identity code by kind folders (moves only), base main
  2. IDN-02 (2/5): US-02 US-03 US-09 identity database, session store and seed #62 identity database, session store and seed (US-02, US-03, US-09)
  3. IDN-02 (3/5): US-04 US-05 US-06 login, logout and session check #63 login, logout and session check (US-04, US-05, US-06)
  4. IDN-02 (4/5): US-07 US-08 frontend login, protected routes and logout #64 frontend login, protected routes and logout (US-07, US-08)
  5. IDN-02 (5/5): US-01 US-10 US-11 contracts, DFD, architecture and run instructions #65 contracts, DFD, architecture and run instructions (US-01, US-10, US-11)

Replaces #55.

🤖 Generated with Claude Code

…erfaces, Models, Services)

Move the existing identity code into kind folders with one public type per
file. Moves and namespace updates only; no logic, route or migration changes.

- IDN-01 (Platform.Identity): Application, Composition, Contracts, Domain and
  Infrastructure move to Services, the project root, Interfaces, Entities,
  Enums, Models and Persistence. The AccountDbContext migrations move to
  Migrations/AccountDb with unchanged content.
- IDN-03 (Platform.Api): Adapters.cs is split into one file per class; the
  interfaces move to Interfaces/Identity, records to Models/Identity and
  enums to Enums/Identity. UserAccount and AccountStatus move to
  Platform.Identity; the identical AccountStatus enums of IDN-01 and IDN-03
  become one.
- Callers and tests only get the new namespaces.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

owlCoder commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Pregled 04.11. uveče: CI je zelen i PR je tehnički mergeable, ali ovo nije isključivo refaktor IDN-02 tima 1. Menja putanje/namespaces i usklađuje modele IDN-01 (tim 18) i IDN-03 (tim 2), uključujući zajednički AccountStatus. Po pravilu da svaki tim odgovara za svoju celinu, potrebno je izričito odobrenje oba vlasnika pre merge-a. Zatražio sam review od @miticcantonija (IDN-01) i @CvijicIgor1 (IDN-03). Nakon njihovog odobrenja ponovo proveriti CI i spojiti ovaj PR metodom merge (ne squash), kako bi se zatim PR-ovi #62–#65 integrisali redom, bez preuzimanja tuđih celina. Do tada ostaje otvoren.

@milanPR15

Copy link
Copy Markdown
Collaborator Author

@owlCoder oba vlasnika su odobrila #61, oba na trenutni head 0c9ed2b:

IDN-03 (tim 2): CvijicIgor1
IDN-01 (tim 18): miticcantonija
Posle poslednjeg CI-ja na main su ušli #43, #60 i #66, pa sam ponovo proverio lokalno: spoj sa trenutnim main (eb7ad48) nema konflikata, build prolazi i svi testovi su zeleni.

Da li je u redu da se #61 sada spoji (merge, ne squash)? Posle toga prebacujem base za #62 na main i nastavljamo redom sa #62–#65.

owlCoder commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Pregled 04.11. uveče: #61–#65 su složena IDN-02 serija (tim 1). Pozdravljamo razdvajanje od #55, ali #61 nije samo trivijalno premeštanje: diff obuhvata 60 fajlova, uključujući Platform.Identity/AccountRegistration i IDN-01 infrastrukturu koju je implementirao tim 18. Po pravilu vlasništva potrebno je pokazati da je reorganizacija IDN-01 samo mehanička i odobrena od nadležnog tima, bez promene ponašanja, ili izdvojiti tuđe fajlove. Posle novih merge-ova #61 trenutno ima i konflikt sa main. Pre spajanja početnog PR-a rešiti konflikt, potvrditi saglasnost/obuhvat i ponoviti CI. Ne spajamo #62–#65 nezavisno od #61 jer ciljaju prethodne grane.

@milanPR15

Copy link
Copy Markdown
Collaborator Author

@owlCoder hvala na pregledu. Sve tri tačke su ispunjene, evo detalja.

1. Saglasnost tima 18 (IDN-01)

miticcantonija je odobrio #61 danas u 19:23 na trenutni head 0c9ed2b, posle tvog prvog komentara. Za IDN-03 (tim 2) PR je odobrio i CvijicIgor1.

2. IDN-01 reorganizacija je samo mehanička

#61 dira 16 postojećih IDN-01 fajlova tima 18 i iz njih izdvaja dva recorda u nove fajlove. Nijedan potpis metode, nijedna linija logike i nijedna asertacija testa nisu promenjeni.

Fajlovi u kojima se menjaju samo putanja, namespace i using:

Staro (backend/Platform.Identity/) Novo
Domain/Models/AppUser.cs Entities/AppUser.cs
Domain/Enums/RegistrationOutcome.cs Enums/RegistrationOutcome.cs
Domain/Models/RegisterAccountCommand.cs Models/RegisterAccountCommand.cs
Domain/Models/RegisterAccountResult.cs Models/RegisterAccountResult.cs
Contracts/IAccountRegistration.cs Interfaces/IAccountRegistration.cs
Application/AccountRegistrationService.cs Services/AccountRegistrationService.cs
Application/CreateAccountPolicy.cs Services/CreateAccountPolicy.cs
Composition/IdentityAccessRegistration.cs IdentityAccessRegistration.cs
Composition/IdentityServiceCollectionExtensions.cs IdentityServiceCollectionExtensions.cs
Infrastructure/Persistence/AccountDbContext.cs Persistence/AccountDbContext.cs
Infrastructure/Persistence/Migrations/20261102181215_InitialAccounts.cs Migrations/AccountDb/20261102181215_InitialAccounts.cs (sadržaj 100% isti)
../Platform.Identity.Tests/AccountRegistrationTests.cs ../Platform.Identity.Tests/Services/AccountRegistrationTests.cs

Fajlovi sa još jednom izmenom, takođe bez promene ponašanja:

Fajl Izmena osim namespace/using
Contracts/IIdentityContext.cs → Interfaces/IIdentityContext.cs record AccountSnapshot premešten bez izmene u svoj fajl Models/AccountSnapshot.cs
Platform.Api/Endpoints/AccountEndpoints.cs → Endpoints/Identity/AccountEndpoints.cs record CreateAccountRequest premešten bez izmene u Platform.Api/Models/Identity/CreateAccountRequest.cs (sa istim maskiranim ToString()); dodat alias using IAccessDecision = Platform.Access.Contracts.IAccessDecision; jer sada postoje dva interfejsa tog imena; endpoint koristi isti Access tip kao i do sada
InitialAccounts.Designer.cs i AccountDbContextModelSnapshot.cs ime CLR tipa u EF modelu Platform.Identity.Domain.Models.AppUser → Platform.Identity.Entities.AppUser, u skladu sa novim namespace-om; Up/Down i šema baze se ne menjaju

Testovi tima 18 prolaze bez izmene u asertacijama.

3. Konflikt sa main i CI

Konflikta nema. Proverio sam #61 posle svakog od šest današnjih spajanja (#69, #73, #72, #67, #71, #70) i svaki put prolazi bez konflikta. GitHub sada prikazuje PR kao mergeable. Verovatno si video privremeno stanje dok je GitHub ponovo računao spojivost posle tih spajanja.

Pošto main ima nove module, ponovo sam proverio spoj #61 sa trenutnim main (84166fb): build ima 0 grešaka i 0 upozorenja, a svi testovi prolaze. Preskočeno je samo 15 PostgreSQL testova iz AUD-01 (#73), koji traže AUDIT_TEST_*_CONNECTION_STRING. Mogu da pokrenem i CI na PR-u ako želiš rezultat u Actions.

Da li je ovako u redu da se #61 spoji (merge, ne squash)? Posle toga prebacujem base za #62 na main i nastavljamo redom.

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.

4 participants