Skip to content

Conversation

@nevrome
Copy link
Member

@nevrome nevrome commented Sep 9, 2025

This would enable the automatic sorting of _Note columns in .janno file writing as raised in poseidon-framework/poseidon-schema#110. With this change _Note columns don't have to be definied explicitly any more in the Poseidon schema, but can just be added wherever the user needs them. If this gets merged we can adjust the schema draft for v3.0.0 accordingly, and also update the .janno and trident documentation on the website eventually.

I think the algorithm works excatly as expected. My test to prove it is not particularly clever, though.

Note that this PR is meant to be merged into #357, which is also still under review. That's how confident I am 😉

@nevrome nevrome requested a review from stschiff September 9, 2025 14:52
@codecov
Copy link

codecov bot commented Sep 9, 2025

Codecov Report

❌ Patch coverage is 95.65217% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 55.90%. Comparing base (6c6400c) to head (cb2b59a).
⚠️ Report is 10 commits behind head on poseidon300cols.

Files with missing lines Patch % Lines
src/Poseidon/Janno.hs 95.65% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           poseidon300cols     #358      +/-   ##
===================================================
+ Coverage            55.82%   55.90%   +0.07%     
===================================================
  Files                   33       33              
  Lines                 5123     5109      -14     
  Branches               571      568       -3     
===================================================
- Hits                  2860     2856       -4     
+ Misses                1692     1685       -7     
+ Partials               571      568       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Copy link
Member

@stschiff stschiff left a comment

Choose a reason for hiding this comment

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

OK, looks all good. I've made some cosmetic suggestions which you can feel free to ignore. I don't quite get why findspot with its recursion doesn't loop endlessly, given that there is no termination criterion... but I must be overlooking something, as I've tentatively added a test with a fake note ("Blabla_Note") and it does finish. Maybe you can explain. Otherwise looks good!

findSpot i x
| removeSuffix i == x = LT
| removeSuffix x == x = GT
| otherwise = findSpot i (removeSuffix x)
Copy link
Member

Choose a reason for hiding this comment

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

Wait, why does this function not run endlessly in case there is no match? You did not put in a stopping criterion in case there is no match, did you?

Copy link
Member Author

Choose a reason for hiding this comment

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

removeSuffix eventually produces an empty string:

image

And then removeSuffix x == x is True. That's why findSpot always terminates.

@nevrome nevrome merged commit ca59cd9 into poseidon300cols Sep 13, 2025
4 checks passed
@nevrome nevrome deleted the jannoColOutSort branch September 13, 2025 13:03
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.

3 participants