Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,12 @@ python3 -m google.adk.scope.extractors.python.extractor \

```

### Feature Matching
### Feature Matching & Reporting

Once you have extracted features from two languages (e.g., Python and TypeScript), you can compare them using the `match.sh` script.
Once you have extracted features from two languages (e.g., Python and TypeScript), you can compare them using the `report.sh` script.

```bash
./match.sh \
./report.sh \
--base output/py.txtpb \
--target output/ts.txtpb \
--output output/ \
Expand Down
3 changes: 2 additions & 1 deletion proto/features.proto
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ enum ParamType {
MAP = 5;
SET = 6;
UNKNOWN = 7;
NULL = 8;
}


Expand Down Expand Up @@ -60,7 +61,7 @@ message Feature {

repeated string original_return_types = 12; // Raw returns (e.g., "Future<String>").
repeated string normalized_return_types = 13; // Canonical returns (e.g., "STRING").

optional bool async = 14; // true if it is an async call.
}

Expand Down
2 changes: 1 addition & 1 deletion match.sh → report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
export PYTHONPATH="${SCRIPT_DIR}/src:${PYTHONPATH}"

# Run the python matcher
python3 "${SCRIPT_DIR}/src/google/adk/scope/matcher/matcher.py" \
python3 "${SCRIPT_DIR}/src/google/adk/scope/reporter/reporter.py" \
--base "${BASE_FILE}" \
--target "${TARGET_FILE}" \
--output "${FULL_OUTPUT_PATH}" \
Expand Down
6 changes: 3 additions & 3 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ echo "Extracting TypeScript features..."
./extract.sh --language typescript --input-repo ../adk-js ./output

echo "Generating symmetric reports..."
./match.sh --base output/py.txtpb --target output/ts.txtpb --output ./output --report-type symmetric
./report.sh --base output/py.txtpb --target output/ts.txtpb --output ./output --report-type symmetric

echo "Generating directional reports.. ."
./match.sh --base output/py.txtpb --target output/ts.txtpb --output ./output --report-type directional
./report.sh --base output/py.txtpb --target output/ts.txtpb --output ./output --report-type directional

echo "Generating raw reports..."
./match.sh --base output/py.txtpb --target output/ts.txtpb --output ./output --report-type raw
./report.sh --base output/py.txtpb --target output/ts.txtpb --output ./output --report-type raw
6 changes: 2 additions & 4 deletions src/google/adk/scope/extractors/converter_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,9 @@ def _process_param_node(self, node: Node) -> Optional[feature_pb2.Param]:
# Protocol Buffer enums don't have NULL usually.
# Let's drop "null" from the enum list for now, or map to
# UNKNOWN if forced.
if s == "null":
continue

try:
enum_val = getattr(feature_pb2.ParamType, s)
# s is lowercase from normalizer, enum is uppercase
enum_val = getattr(feature_pb2.ParamType, s.upper())
normalized_enums.append(enum_val)
except AttributeError:
# Fallback to OBJECT or UNKNOWN?
Expand Down
5 changes: 3 additions & 2 deletions src/google/adk/scope/extractors/converter_ts.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ def _create_single_param(
normalized_enums = []
for s in normalized_strings:
try:
enum_val = getattr(feature_pb2.ParamType, s)
enum_val = getattr(feature_pb2.ParamType, s.upper())
normalized_enums.append(enum_val)
except AttributeError:
normalized_enums.append(feature_pb2.ParamType.OBJECT)
Expand Down Expand Up @@ -613,7 +613,8 @@ def _extract_return_types(self, node: Node) -> Tuple[List[str], List[str]]:
# logically T for async?
# Schema says "original_return_types".
# normalized usually unwrap?
return [raw], self.normalizer.normalize(raw, "typescript")
normalized = self.normalizer.normalize(raw, "typescript")
return [raw], normalized
return [], []

def _is_blocking(self, node: Node, return_types: List[str]) -> bool:
Expand Down
4 changes: 2 additions & 2 deletions src/google/adk/scope/features_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading