Skip to content

Python: count decorators into the function hit_vector (struct_decorators) (#8857) - #8920

Merged
squid-shepherd[bot] merged 4 commits into
mainfrom
churn/8857-20261121T1701Z
Nov 21, 2026
Merged

squid-shepherd[bot] merged 4 commits into
mainfrom
churn/8857-20261121T1701Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #8857

What changed

A Python function's hit_vector is bisected from the spatial map between the def and the end of the body, so the @decorator lines above the def were never counted: struct_decorators was 0 for every Python function while decorated_by was filled. The decorator_edges pass (Python, embedded_python) already finds the decorator lines; it now also writes hit_vector["decorators"] = len(decorators) (key only when non-empty). keyword_density is unchanged.

Tests: tests/extraction/languages/test_python_decorators.py (single, property, stacked and multi-line call, undecorated has no key, embedded_python).

Why the golden output changed

Function archetype distribution moves because log_density_struct_decorators is now non-zero for decorated Python functions: "Annotated & Test Methods" 892 -> 1566 functions, with small shifts in neighbouring archetypes and file composition. Per-file Python hit vectors and the repository fingerprint move accordingly. Both fixtures re-blessed with golden-lock.sh crucible_check.py --update --yes.

Class sweep

Class: a function's hit_vector misses decorator/annotation lines that sit above the function start offset.

  • Fixed here: Python, embedded_python.
  • Probed and already counting: Java, C#, Kotlin, PHP, Rust, Scala.
  • Sibling gap: TypeScript (@Input() f() in a class gives no decorators hit); JavaScript and the other languages with a decorators rule were not probed. No burned estate needs it.

Gates

audit_check.py all clear; ruff format/ruff check clean on changed lines; python/embedded_python/tools_recorders tests 808 passed. No regex changed, so no new regex CPU cost. Rosetta not run locally.

🤖 Generated with Claude Code

@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 21, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 21, 2026 17:23
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 21, 2026 17:37
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md labels Nov 21, 2026
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md labels Nov 21, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot merged commit 103a123 into main Nov 21, 2026
69 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/8857-20261121T1701Z branch November 21, 2026 20:06
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python: struct_decorators is 0 for every function (decorated_by is filled)

1 participant