feat: discover and parse project-maintained affiliations (CM-361)#4280
Open
skwowet wants to merge 23 commits into
Open
feat: discover and parse project-maintained affiliations (CM-361)#4280skwowet wants to merge 23 commits into
skwowet wants to merge 23 commits into
Conversation
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new AffiliationService to the git_integration worker pipeline to discover and AI-parse project-maintained contributor→employer/organization mapping files, cache parsed snapshots per repo, and (currently) dry-run the apply/guard logic while recording service executions and registry state.
Changes:
- Added
AffiliationServiceand wired it intoRepositoryWorker/server lifespan for first-clone batches. - Added Bedrock LLM client module under
services/llm/and updated maintainer processing to import it. - Extended the git_integration DB CRUD layer with affiliation registry read/upsert plus bulk identity lookup helpers.
Reviewed changes
Copilot reviewed 11 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| services/apps/git_integration/src/test/conftest.py | Adds default env vars for affiliation retry/update intervals in tests. |
| services/apps/git_integration/src/crowdgit/worker/repository_worker.py | Injects and invokes AffiliationService in the repository processing pipeline. |
| services/apps/git_integration/src/crowdgit/settings.py | Adds AFFILIATION_* interval settings. |
| services/apps/git_integration/src/crowdgit/services/maintainer/maintainer_service.py | Switches Bedrock import to the new shared LLM module. |
| services/apps/git_integration/src/crowdgit/services/llm/bedrock.py | New shared Bedrock invocation helper (retry, JSON extraction, pydantic validation, cost calc). |
| services/apps/git_integration/src/crowdgit/services/llm/init.py | Initializes the new llm service package. |
| services/apps/git_integration/src/crowdgit/services/affiliation/affiliation_service.py | Implements discovery, AI parsing (including chunking), snapshot caching, and dry-run apply/guards. |
| services/apps/git_integration/src/crowdgit/services/init.py | Exports AffiliationService for DI/wiring. |
| services/apps/git_integration/src/crowdgit/server.py | Instantiates and passes AffiliationService into RepositoryWorker. |
| services/apps/git_integration/src/crowdgit/models/affiliation_info.py | Adds pydantic models for file-picker and parsed affiliation snapshot rows. |
| services/apps/git_integration/src/crowdgit/errors.py | Adds new affiliation-specific error types. |
| services/apps/git_integration/src/crowdgit/enums.py | Adds new error codes, registry status enum, and OperationType.REPO_AFFILIATION. |
| services/apps/git_integration/src/crowdgit/database/crud.py | Adds registry CRUD + snapshot (de)serialization + bulk identity lookup helpers + insert helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
mbani01
reviewed
Jun 30, 2026
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
…de text file extensions Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
…ntity Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
…pe and add date parsing util Signed-off-by: Yeganathan S <63534555+skwowet@users.noreply.github.com>
Comment on lines
+352
to
+356
| def _parse_optional_date(value: str | None) -> date | None: | ||
| stripped = AffiliationService._strip(value) | ||
| if not stripped: | ||
| return None | ||
| return date.fromisoformat(stripped) |
Comment on lines
+605
to
+619
| for idx, identity in enumerate(identities): | ||
| values_parts.append( | ||
| f"(${param_index}::int, ${param_index + 1}::text, ${param_index + 2}::boolean," | ||
| f" ${param_index + 3}::text, ${param_index + 4}::text)" | ||
| ) | ||
| params.extend( | ||
| [ | ||
| idx, | ||
| identity["type"], | ||
| identity.get("verified", True), | ||
| identity.get("platform"), | ||
| identity["value"], | ||
| ] | ||
| ) | ||
| param_index += 5 |
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.
Summary
This PR adds processing for project-maintained contributor-to-employer files inside
git_integration.Many LF projects publish who works for which company in repo files (gitdm,
.organizationmap, SIG YAML, etc.). Formats and filenames vary, so we reuse the existing clone pipeline: find the file on disk, parse it with AI into a normalized snapshot, track per-repo state, and resolve rows against CDP members and organizations.The worker runs this on the first clone batch, alongside maintainer processing. Each repo gets one registry row (
git.repoAffiliationRegistry) plus aserviceExecutionsrecord with operation typeAffiliation.Run flow
Parsed snapshot shape
Each snapshot entry is one contributor with their organization stints over time:
dateStart/dateEnd, andisUnaffiliatedfor independent/unaffiliated rows (normalized toindividual-noaccount.com). AI returns flat contributor–org rows; code groups by contributor and dedupes stints. Rows missing email/github or domain are dropped during normalization.Registry status:
success(including zero-row parses),not_found,unusable(parsed but nothing applyable; stable until file content changes),error(unexpected parse failure; retry on next interval).Apply rules (implemented, writes disabled for now)
primary-domainonly (no display-name lookup).project-registrywhen inserts are enabled.Repos without a segment skip apply. Unexpected parse failures set registry status to
error, clearfileHash, and keep the previous snapshot so the next interval run retries parsing.Changes
AffiliationService (
services/affiliation/affiliation_service.py)group_parse_rowsmerges into contributor +organizations[]snapshot shape.executemanycalls commented out with a TODO.Worker wiring (
repository_worker.py,server.py)AffiliationServiceregistered and invoked onis_first_batchafter maintainer processing.Database layer (
crud.py)ON CONFLICT DO NOTHINGaligned to partial unique indexes) and MSA.Shared infrastructure
maintainer/bedrock.pytoservices/llm/bedrock.py; maintainer import updated.affiliation_info.py), error types,AffiliationRegistryStatus,OperationType.AFFILIATION, andAFFILIATION_*settings insettings.py/conftest.py.