ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision720d47fae476b0d38477ae4401697d372b1ea2bc
Branchfeature/opportunity-to-outcome
Path or archive memberinternal/modules/federalsignal/tenant_tag_repo.go
Original SHA-2563ff34f442c259cf300583c602e568dc3ecbfb7172f3d0a9d67e52f585ce0c2b5
Git blob SHA0182ea0579380cf692b398b42fe60135f185007f
Reading-copy SHA-2563ff34f442c259cf300583c602e568dc3ecbfb7172f3d0a9d67e52f585ce0c2b5

Original source ↗

Every recorded occurrence

These 15 records contain identical original source bytes. Their paths and revisions remain part of the archive.

Original recordBranch or archiveRevision / identifierOriginal location
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gofeature/opportunity-to-outcome720d47fae476b0d38477ae4401697d372b1ea2bcOpen original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gocollision-deconfliction4ee5a09972608ed89f8377c6665542d5f450f0a6Open original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gom5-price-to-win41000ad30fff4129fdaf5ec84e15ba14c27d4890Open original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gomaster1e9249840a4302ec82e123b9c9cb6f75badea3e4Open original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gows8-teaching-loopc823f0fb6bb2aba0f39001eb6de96f4000d9321fOpen original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gomag-substrateb82c7100a492dec67dfd1eda6b3f53def859be35Open original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gotime-to-fill-survivalb66e1e505863d4f17741a4b9ede73509e45bd6c6Open original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gographrag-foundationb0ddeb9f633fd138d09309d1a17b7d13bc3a67f7Open original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gows9-bench-ingestionf585a9ef32fa554663ce1fba9a414a54b6e49cf0Open original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gopresentation-readinesseb574acaa29d71ce4d0f852572e87c275c79fdb7Open original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.govendor-intelligencefe9796a19c261951d3f2565206c0c1b5ac294465Open original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gows7-federal-signal6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2Open original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gophase2-connectorse038d4c687aec16f8bd9bc4d907eea14d91f8704Open original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gofeature/aioe-upgrade2178e7298d0e5d9af83afa12402fd587f0ba6ed8Open original
Janady13/missionmatch / internal/modules/federalsignal/tenant_tag_repo.gocapture-readinessbae6af7cb2997e819174a9e9cfff5e16067a1975Open original

Recovered source transcript

package federalsignal // Production TenantTagRepo: the DB backed adapter that makes every read and every write of the Phase 5a // tenant tagging service run inside RunInTenantTx as the application role. RLS is therefore exercised on // every row, the org id is set transaction locally from the validated context GUC, and a child row can // never reference a parent in another tenant (the composite FK). This adapter never touches the migrator // bypass: it holds a *tenant.DB whose pool authenticates as the NOBYPASSRLS application role. import ( "context" "fmt" "github.com/jackc/pgx/v5" "github.com/missionworkforce/missionmatch/internal/platform/database/dbgen" "github.com/missionworkforce/missionmatch/internal/platform/missionclass" "github.com/missionworkforce/missionmatch/internal/platform/tenant" ) // tenantTagRepo is the production TenantTagRepo over a tenant scoped application DB. type tenantTagRepo struct{ db *tenant.DB } // NewTenantTagRepo builds the production TenantTagRepo. db MUST be a tenant.DB whose pool authenticates as // the application role, so RunInTenantTx is the only path to the rows and RLS cannot be bypassed. func NewTenantTagRepo(db *tenant.DB) TenantTagRepo { return &tenantTagRepo{db: db} } func (r *tenantTagRepo) ListCandidatesForTagging(ctx context.Context) ([]dbgen.ListCandidatesForMissionTaggingRow, error) { var out []dbgen.ListCandidatesForMissionTaggingRow err := r.db.RunInTenantTx(ctx, func(ctx context.Context, tx pgx.Tx) error { var e error out, e = dbgen.New(tx).ListCandidatesForMissionTagging(ctx) return e }) return out, err } func (r *tenantTagRepo) ListRequirementsForTagging(ctx context.Context) ([]dbgen.ListRequirementsForMissionTaggingRow, error) { var out []dbgen.ListRequirementsForMissionTaggingRow err := r.db.RunInTenantTx(ctx, func(ctx context.Context, tx pgx.Tx) error { var e error out, e = dbgen.New(tx).ListRequirementsForMissionTagging(ctx) return e }) return out, err } // UpsertCandidateMissionTags writes every tag inside ONE tenant transaction as the application role, so // the whole org's candidate tags commit or roll back together and RLS scopes each insert to the org GUC. func (r *tenantTagRepo) UpsertCandidateMissionTags(ctx context.Context, tags []dbgen.UpsertCandidateMissionTagParams) error { if len(tags) == 0 { return nil } return r.db.RunInTenantTx(ctx, func(ctx context.Context, tx pgx.Tx) error { q := dbgen.New(tx) for _, t := range tags { if err := q.UpsertCandidateMissionTag(ctx, t); err != nil { return err } } return nil }) } // UpsertRequirementMissionTags writes every requirement tag inside one tenant transaction as the // application role, same isolation guarantees as the candidate path. func (r *tenantTagRepo) UpsertRequirementMissionTags(ctx context.Context, tags []dbgen.UpsertRequirementMissionTagParams) error { if len(tags) == 0 { return nil } return r.db.RunInTenantTx(ctx, func(ctx context.Context, tx pgx.Tx) error { q := dbgen.New(tx) for _, t := range tags { if err := q.UpsertRequirementMissionTag(ctx, t); err != nil { return err } } return nil }) } // AliasPairReader is the single method the backfill needs to seed the AliasIndex. The production Repo (from // NewRepo) satisfies it, so the backfill reuses the same MissionAliasPairs read the global pass uses, which // means the tenant pass and the global pass classify against an identical curated alias layer. type AliasPairReader interface { AliasPairs(ctx context.Context) (map[string]string, error) } // BuildAliasIndex loads the global (phrase, code) alias pairs through the given reader and compiles them // into a missionclass.AliasIndex ONCE. The backfill builds the index a single time and shares it across // every org, because the alias layer is global reference data the application role may read. func BuildAliasIndex(ctx context.Context, r AliasPairReader) (missionclass.AliasIndex, error) { pairs, err := r.AliasPairs(ctx) if err != nil { return missionclass.AliasIndex{}, fmt.Errorf("federalsignal: load alias pairs: %w", err) } return missionclass.NewAliasIndex(pairs), nil }

Search equations, builds, manuscript text, and recovered sources.