ThatAIguyA world of ideas

THE CONSCIOUSNESS ATLAS
Read. Experiment. Follow the evidence.

ConsciousnessLearn · Explore · Joseph Anady

Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.go

Source identity, revision, and recovered contents.

GitHub sourceSource text recovered

Source identity

FieldRecorded value
Source typeGitHub source
Original recordJanady13/missionmatch / internal/modules/ontology/adapters/calc_test.go
DateNot specified in source
RepositoryJanady13/missionmatch
Revision720d47fae476b0d38477ae4401697d372b1ea2bc
Branchfeature/opportunity-to-outcome
Path or archive memberinternal/modules/ontology/adapters/calc_test.go
Original SHA-2560bd8fda79f2095336d802241d3a35143c8dbdd1cd4cdd2e68b008bd83c71954f
Git blob SHA0857242ad5f553b708c7b1ff64a2fdda1a8c8b72
Reading-copy SHA-2560bd8fda79f2095336d802241d3a35143c8dbdd1cd4cdd2e68b008bd83c71954f

Original source ↗

Every recorded occurrence

These 20 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/ontology/adapters/calc_test.gofeature/opportunity-to-outcome720d47fae476b0d38477ae4401697d372b1ea2bcOpen original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gocollision-deconfliction4ee5a09972608ed89f8377c6665542d5f450f0a6Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gows6-retrieval6c56e29231ec05735927fa265c97d517499dfeafOpen original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gom5-price-to-win41000ad30fff4129fdaf5ec84e15ba14c27d4890Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gows1-ontology-syncb596f449a32a1016fbd403c36505cc00a1ac9ee6Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gomaster1e9249840a4302ec82e123b9c9cb6f75badea3e4Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gows8-teaching-loopc823f0fb6bb2aba0f39001eb6de96f4000d9321fOpen original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gomag-substrateb82c7100a492dec67dfd1eda6b3f53def859be35Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gows3-clearance4b8e7ce594c068621867f9c9deed0ec64ae6c553Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gophase2-eval-fairnessd361af254701975fe239927656ababb56374655eOpen original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gotime-to-fill-survivalb66e1e505863d4f17741a4b9ede73509e45bd6c6Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gographrag-foundationb0ddeb9f633fd138d09309d1a17b7d13bc3a67f7Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gows9-bench-ingestionf585a9ef32fa554663ce1fba9a414a54b6e49cf0Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gows2-alias-relationshipe4dada4601c6eb101830f9d223a9655dfa120616Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gopresentation-readinesseb574acaa29d71ce4d0f852572e87c275c79fdb7Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.govendor-intelligencefe9796a19c261951d3f2565206c0c1b5ac294465Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gows7-federal-signal6a9f6ce9cfb13345ffb47770d4960e7c2d9c17c2Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gophase2-connectorse038d4c687aec16f8bd9bc4d907eea14d91f8704Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gofeature/aioe-upgrade2178e7298d0e5d9af83afa12402fd587f0ba6ed8Open original
Janady13/missionmatch / internal/modules/ontology/adapters/calc_test.gocapture-readinessbae6af7cb2997e819174a9e9cfff5e16067a1975Open original

Recovered source transcript

package adapters import ( "context" "errors" "net/http" "net/http/httptest" "sort" "strings" "testing" "github.com/missionworkforce/missionmatch/internal/modules/ontology" ) // calcFixture is a minimal GSA CALC v3 ceiling rates response shaped exactly like the real // Elasticsearch backed API (confirmed from https://api.gsa.gov/acquisition/calc/v3/api/ceilingrates/?q=engineer). // The labor category is at hits.hits[]._source.labor_category. // Two results share "Software Engineer I" to exercise deduplication; one is distinct. const calcFixture = `{ "took": 3, "timed_out": false, "_shards": {"total": 1, "successful": 1, "skipped": 0, "failed": 0}, "hits": { "total": {"value": 3, "relation": "eq"}, "hits": [ { "_index": "calc", "_id": "100001", "_score": 1.0, "_source": { "labor_category": "Software Engineer I", "vendor_name": "Acme Federal LLC", "current_price": 85.00, "education_level": "Bachelors", "min_years_experience": 3, "security_clearance": "None", "worksite": "Both" } }, { "_index": "calc", "_id": "100002", "_score": 1.0, "_source": { "labor_category": "Software Engineer I", "vendor_name": "Beta Solutions Inc", "current_price": 92.00, "education_level": "Masters", "min_years_experience": 5, "security_clearance": "Secret", "worksite": "Customer Site" } }, { "_index": "calc", "_id": "100003", "_score": 1.0, "_source": { "labor_category": "Systems Analyst II", "vendor_name": "GovCon Corp", "current_price": 110.00, "education_level": "Bachelors", "min_years_experience": 7, "security_clearance": "TS", "worksite": "Contractor Site" } } ] } }` // TestParseCALC feeds a literal fixture (two results with the same labor category and one // distinct) to parseCALC and confirms the returned slice contains the two distinct strings. func TestParseCALC(t *testing.T) { got, err := parseCALC([]byte(calcFixture)) if err != nil { t.Fatalf("parseCALC returned an error: %v", err) } // The fixture has 3 hits but only 2 distinct labor categories. // parseCALC returns them deduplicated; order is not guaranteed. want := map[string]bool{ "Software Engineer I": true, "Systems Analyst II": true, } if len(got) != 2 { t.Fatalf("want 2 distinct labor categories, got %d: %v", len(got), got) } for _, lc := range got { if !want[lc] { t.Errorf("unexpected labor category %q", lc) } } } // TestParseCALCEmpty confirms parseCALC handles an empty hits.hits array without error. func TestParseCALCEmpty(t *testing.T) { empty := `{"hits":{"total":{"value":0,"relation":"eq"},"hits":[]}}` got, err := parseCALC([]byte(empty)) if err != nil { t.Fatalf("parseCALC on empty hits returned error: %v", err) } if len(got) != 0 { t.Fatalf("want 0 results for empty hits, got %d", len(got)) } } // TestCALCSourceDedupes stands up an httptest.Server returning the calcFixture for every // query. It uses a two item seed list where both queries return the same fixture, confirming // that Fetch deduplicates across seeds and yields each distinct labor category exactly once. func TestCALCSourceDedupes(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) _, _ = w.Write([]byte(calcFixture)) })) defer srv.Close() // Two seeds that both return the same fixture: total 4 hits but only 2 distinct categories. src := NewCALCSource(srv.URL+"/", "", []string{"engineer", "analyst"}, srv.Client()) var records []ontology.VocabRecord err := src.Fetch(context.Background(), func(r ontology.VocabRecord) error { records = append(records, r) return nil }) if err != nil { t.Fatalf("Fetch returned an error: %v", err) } // Exactly 2 distinct labor categories must be yielded regardless of seed count. if len(records) != 2 { t.Fatalf("want 2 records (deduplicated across seeds), got %d", len(records)) } // Sort for deterministic assertion order. sort.Slice(records, func(i, j int) bool { return records[i].Term < records[j].Term }) wantTerms := []string{"Software Engineer I", "Systems Analyst II"} for i, r := range records { if r.Kind != ontology.KindLaborCategory { t.Errorf("record[%d]: want Kind %q, got %q", i, ontology.KindLaborCategory, r.Kind) } if r.SourceName != "GSA CALC" { t.Errorf("record[%d]: want SourceName %q, got %q", i, "GSA CALC", r.SourceName) } if r.Category != "labor_category" { t.Errorf("record[%d]: want Category %q, got %q", i, "labor_category", r.Category) } if r.Term != wantTerms[i] { t.Errorf("record[%d]: want Term %q, got %q", i, wantTerms[i], r.Term) } } // SourceRecordID must be the lowercased labor category text. byTerm := make(map[string]ontology.VocabRecord, len(records)) for _, r := range records { byTerm[r.Term] = r } for _, term := range wantTerms { r := byTerm[term] wantID := strings.ToLower(term) if r.SourceRecordID != wantID { t.Errorf("Term %q: want SourceRecordID %q, got %q", term, wantID, r.SourceRecordID) } } } // TestCALCSourceThrottled confirms that a 429 response is surfaced as ontology.ErrThrottled. func TestCALCSourceThrottled(t *testing.T) { srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.WriteHeader(http.StatusTooManyRequests) })) defer srv.Close() src := NewCALCSource(srv.URL+"/", "", []string{"engineer"}, srv.Client()) err := src.Fetch(context.Background(), func(r ontology.VocabRecord) error { return nil }) if err == nil { t.Fatal("expected an error on 429, got nil") } // The error must wrap or equal ErrThrottled. if !errors.Is(err, ontology.ErrThrottled) { t.Errorf("want ErrThrottled, got %v", err) } }

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