Skip to content

feat: Implement advice ordering system#704

Merged
kakkoyun merged 10 commits into
mainfrom
advice_order
Sep 26, 2025
Merged

feat: Implement advice ordering system#704
kakkoyun merged 10 commits into
mainfrom
advice_order

Conversation

@kakkoyun

@kakkoyun kakkoyun commented Sep 18, 2025

Copy link
Copy Markdown
Member

Add deterministic and controllable execution order for advice across aspects using namespace
and order fields.

Includes OrderableAdvice interface, sorting logic, and
comprehensive integration tests.

Right now, only "prepend statements" implements OrderableAdvice.
We will implement more when needed.

Signed-off-by: Kemal Akkoyun [email protected]

kakkoyun commented Sep 18, 2025

Copy link
Copy Markdown
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@kakkoyun
kakkoyun marked this pull request as ready for review September 18, 2025 19:35
@kakkoyun
kakkoyun requested a review from a team as a code owner September 18, 2025 19:35
@github-actions github-actions Bot added the conventional-commit/feat Feature work label Sep 18, 2025
@kakkoyun kakkoyun changed the title feat: implement advice ordering system feat: Implement advice ordering system Sep 18, 2025
@kakkoyun
kakkoyun force-pushed the advice_order branch 2 times, most recently from e0b5191 to 12c6fb1 Compare September 19, 2025 12:17
Base automatically changed from adr_aspect_application to init_adr September 19, 2025 14:27
kakkoyun and others added 4 commits September 19, 2025 16:31
Signed-off-by: Kemal Akkoyun <[email protected]>

Signed-off-by: Kemal Akkoyun <[email protected]>
Signed-off-by: Kemal Akkoyun <[email protected]>
Add deterministic execution order for advice across aspects using namespace
and order fields. Includes OrderableAdvice interface, sorting logic, and
comprehensive integration tests.

Signed-off-by: Kemal Akkoyun <[email protected]>
Base automatically changed from init_adr to main September 19, 2025 15:11

@RomainMuller RomainMuller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks pretty good, some tactical comments on certain decisions we have to think hard and deep about before they're impossible to modify...

Comment thread internal/injector/aspect/advice/block.go Outdated

const (
// DefaultNamespace is used when no namespace is specified
DefaultNamespace = "default"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So the namespace participates in ordering -- in the sense that advice is ordered by lexicographic order of namespace, then order...

And now default occupies an arbitrary position that might be...surprising? Using an empty string would, IIUC, make non-namespaced advice consistently apply before namespaced advice... Or maybe we want them to consistently apply after all namespaced advice?

Anyhow -- I think the choice of this value is not neutral and folks may occasionally need to be able to decide if they're before or after this (or do they?). Furthermore, changing this value in the future is a potentially breaking change, so we have to ask ourselves the question now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It was intentional to use rather arbitrary "default" so it would be easier to add a namespace lexicographically before the default namespace. My initial thought was to give some flexibility. I need to meditate on this little further. I like the idea of empty string.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I decided that the default namespace should come last to give control over the aspects that specify a namespace.

Comment thread internal/injector/aspect/advice/order.go Outdated
Comment thread internal/injector/aspect/advice/order_test.go
Comment thread internal/injector/config/schema.json
Comment thread .typos.toml Outdated
Comment thread internal/injector/aspect/advice/block.go Outdated
@kakkoyun
kakkoyun enabled auto-merge September 26, 2025 14:46
@kakkoyun
kakkoyun added this pull request to the merge queue Sep 26, 2025
Merged via the queue into main with commit 95f61b1 Sep 26, 2025
54 checks passed
@kakkoyun
kakkoyun deleted the advice_order branch September 26, 2025 15:50
@codecov

codecov Bot commented Sep 26, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 72.72727% with 21 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.56%. Comparing base (e061d12) to head (98f6162).
⚠️ Report is 24 commits behind head on main.

Files with missing lines Patch % Lines
internal/injector/aspect/advice/block.go 51.35% 16 Missing and 2 partials ⚠️
internal/injector/injector.go 81.25% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #704      +/-   ##
==========================================
- Coverage   65.72%   65.56%   -0.16%     
==========================================
  Files         113      115       +2     
  Lines        7926     8325     +399     
==========================================
+ Hits         5209     5458     +249     
- Misses       2192     2328     +136     
- Partials      525      539      +14     
Components Coverage Δ
Generators 80.24% <ø> (ø)
Instruments ∅ <ø> (∅)
Go Driver 75.66% <69.23%> (-0.15%) ⬇️
Toolexec Driver 67.94% <100.00%> (+0.41%) ⬆️
Aspects 72.10% <75.32%> (+0.19%) ⬆️
Injector 72.94% <75.70%> (+0.14%) ⬆️
Job Server 65.91% <ø> (ø)
Other 65.56% <60.09%> (-0.16%) ⬇️
Files with missing lines Coverage Δ
internal/injector/aspect/advice/order.go 100.00% <100.00%> (ø)
internal/injector/injector.go 76.21% <81.25%> (+1.35%) ⬆️
internal/injector/aspect/advice/block.go 56.45% <51.35%> (-13.55%) ⬇️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants