Skip to content

fix(CODEWIKI-005-2): CU-86akn96pk 2 review findings across 2 files - #98

Draft
flamingo[bot] wants to merge 2 commits into
mainfrom
ai-fix/codewiki-005-2-7f341cc3-9aa9712c
Draft

flamingo[bot] wants to merge 2 commits into
mainfrom
ai-fix/codewiki-005-2-7f341cc3-9aa9712c

Conversation

@flamingo

@flamingo flamingo Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Closes 2 review findings across 2 files.

Draft — this is a starting point, not a finished change. The fix required judgment, so read it before trusting it.

# Fix confidence Finding Location
1 🟡 75 medium PHP component IDs fall back to a dot-joined base class instead of the '::' FQDN format codewiki/src/be/dependency_analyzer/analyzers/php.py:357
2 🟡 85 medium JavaScript analyzer's _extract_methods_from_class uses dot-separated method_key instead of the '::' FQDN separator used elsewhere codewiki/src/be/dependency_analyzer/analyzers/javascript.py:172

What changed — and what was deliberately left — is explained per finding as inline review comments on the lines each finding touched.


Run: https://product-hub.flamingo.so/admin/code-review
Run id: 9aa9712c-4ca2-4571-94bc-95e5cff4b3cd

Merging this PR is recorded as acceptance of the rule that produced it;
closing it unmerged is recorded as rejection. Both feed rule health, so
closing a wrong suggestion is useful rather than merely tidy.

ClickUp task: CU-86akn96pk CodeWiki review findings sweep (9 PRs)

@flamingo flamingo Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 What this fix changed, finding by finding

2 finding(s) fixed in this draft — 2 explained inline on the diff.

Comment on lines 368 to 374
resolved_base = self.namespace_resolver.resolve(base_name)
self.call_relationships.append(CallRelationship(
caller=self._get_component_id(class_name),
callee=resolved_base.replace("\\", "."),
callee=self._get_component_id_for_resolved_name(resolved_base),
call_line=node.start_point[0] + 1,
is_resolved=False
))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 PHP component IDs fall back to a dot-joined base class instead of the '::' FQDN format

Added new helper _get_component_id_for_resolved_name in TreeSitterPHPAnalyzer (php.py) that takes an already-resolved dotted/backslash name, splits it into a module path and final component name, and joins them with :: (falling back to name::name if no separator exists). Updated all five call sites in _extract_relationships that previously did resolved_X.replace("\\", ".") for callee (base class/extends, interface implements, object creation/new, static scoped calls, and property-promotion constructor types) to use this helper instead, so every emitted callee now follows the <module.path>::<ComponentName> FQDN format instead of a plain dotted string. The _add_use_relationships method (which builds file-level use import relationships, not component-to-component base/interface relationships) was left unchanged since the finding specifically concerns base/interface resolution in relationship extraction: a complete fix might also want to reconsider whether "single-segment" names (no namespace) should resolve to the file's own module rather than a degenerate Name::Name, which is unverified without more context on how downstream consumers treat unqualified/global PHP classes.

🤖 Prompt for AI agents
In codewiki/src/be/dependency_analyzer/analyzers/php.py around line 357, review and complete this code-review fix: PHP component IDs fall back to a dot-joined base class instead of the '::' FQDN format.
What the draft fix changed: Added new helper `_get_component_id_for_resolved_name` in `TreeSitterPHPAnalyzer` (php.py) that takes an already-resolved dotted/backslash name, splits it into a module path and final component name, and joins them with `::` (falling back to `name::name` if no separator exists). Updated all five call sites in `_extract_relationships` that previously did `resolved_X.replace("\\", ".")` for `callee` (base class/extends, interface implements, object creation/new, static scoped calls, and property-promotion constructor types) to use this helper instead, so every emitted `callee` now follows the `<module.path>::<ComponentName>` FQDN format instead of a plain dotted string. The `_add_use_relationships` method (which builds file-level `use` import relationships, not component-to-component base/interface relationships) was left unchanged since the finding specifically concerns base/interface resolution in relationship extraction: a complete fix might also want to reconsider whether "single-segment" names (no namespace) should resolve to the file's own module rather than a degenerate `Name::Name`, which is unverified without more context on how downstream consumers treat unqualified/global PHP classes.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 75 medium — react 👍/👎 to teach the reviewer

Comment on lines 178 to 192
if child.type == "method_definition":
method_name = self._get_method_name(child)
if method_name:
method_key = f"{self._get_module_path()}.{class_name}.{method_name}"
method_key = self._get_component_id(method_name, class_name, is_method=True)
method_node = self._create_method_node(child, method_name, class_name)
if method_node:
self.top_level_nodes[method_key] = method_node
elif child.type == "field_definition":
# Handle arrow function properties
field_name = self._get_field_name(child)
if field_name and self._is_arrow_function_field(child):
method_key = f"{self._get_module_path()}.{class_name}.{field_name}"
method_key = self._get_component_id(field_name, class_name, is_method=True)
method_node = self._create_method_node(child, field_name, class_name)
if method_node:
self.top_level_nodes[method_key] = method_node

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🦩 🔴 JavaScript analyzer's _extract_methods_from_class uses dot-separated method_key instead of the '::' FQDN separator used elsewhere

Changed _extract_methods_from_class (both the method_definition branch and the field_definition/arrow-function branch) to build method_key via self._get_component_id(method_name, class_name, is_method=True) instead of the ad-hoc f"{self._get_module_path()}.{class_name}.{method_name}", aligning the top_level_nodes key with the ::-separated FQDN convention used by _get_component_id/node.id. Also updated the matching lookup in _extract_call_from_node (the method_key built for this./super. call resolution) to use _get_component_id(callee_name, current_class, is_method=True) so it stays consistent with the new key format used to populate top_level_nodes — without this companion change, method-call resolution against top_level_nodes would have silently broken since the stored keys no longer match the old dot-separated lookup format. Other dot-separated ids elsewhere in the file (e.g. inheritance/call relationship caller/callee ids, JSDoc type ids) were left unchanged since the finding is scoped to _extract_methods_from_class's method_key/top_level_nodes inconsistency, and touching those would exceed the minimal fix intended here.

🤖 Prompt for AI agents
In codewiki/src/be/dependency_analyzer/analyzers/javascript.py around line 172, review and complete this code-review fix: JavaScript analyzer's _extract_methods_from_class uses dot-separated method_key instead of the '::' FQDN separator used elsewhere.
What the draft fix changed: Changed `_extract_methods_from_class` (both the `method_definition` branch and the `field_definition`/arrow-function branch) to build `method_key` via `self._get_component_id(method_name, class_name, is_method=True)` instead of the ad-hoc `f"{self._get_module_path()}.{class_name}.{method_name}"`, aligning the `top_level_nodes` key with the `::`-separated FQDN convention used by `_get_component_id`/`node.id`. Also updated the matching lookup in `_extract_call_from_node` (the `method_key` built for `this.`/`super.` call resolution) to use `_get_component_id(callee_name, current_class, is_method=True)` so it stays consistent with the new key format used to populate `top_level_nodes` — without this companion change, method-call resolution against `top_level_nodes` would have silently broken since the stored keys no longer match the old dot-separated lookup format. Other dot-separated ids elsewhere in the file (e.g. inheritance/call relationship caller/callee ids, JSDoc type ids) were left unchanged since the finding is scoped to `_extract_methods_from_class`'s `method_key`/`top_level_nodes` inconsistency, and touching those would exceed the minimal fix intended here.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟡 85 medium — react 👍/👎 to teach the reviewer

@flamingo flamingo Bot changed the title fix(CODEWIKI-005-2): 2 review findings across 2 files fix(CODEWIKI-005-2): CU-86akn96pk 2 review findings across 2 files Sep 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants