Enhance enum checker to include meta header files#2261
Enhance enum checker to include meta header files#2261tjchadaga wants to merge 1 commit intoopencomputeproject:masterfrom
Conversation
d89ea47 to
452ef75
Compare
meta/checkancestry.sh
Outdated
| #BEGIN_COMMIT=1f2bca1 # to this commit we have history file | ||
| BEGIN_COMMIT=c72635e # from this commit we are backward compatible |
There was a problem hiding this comment.
please revert, you dont have history file with this commits
There was a problem hiding this comment.
there is a file ancestry.1f2bca1.history in meta directory which was generated using ancestry.pl script with -D flag, and this is used to speed up validation in PRs, and first commit must be 3132018, dont change that
There was a problem hiding this comment.
but since you are adding meta directory so from 3132018 this commit (2021) there were some incompatible changes in meta
There was a problem hiding this comment.
thanks for looking at this, @kcudnik. Yes, I'm trying to update the begin commit to a more recent commit where the meta incompatibility was fixed. This way we can check both inc and meta for incompatibilities going forward. What issues do you see with making this update?
There was a problem hiding this comment.
there are enums that were removed, and then added back, since that commit, and validator is checked whether in future there are noconflicts with that, so if you move begin commit to newer one, all previous history will be forgoten
There was a problem hiding this comment.
ok, I changed it to exclude around 20 commits where backward compatibility was broken. Hopefully this is a better compromise, since the history is not fully lost
There was a problem hiding this comment.
i dont agree on that, i want to preserve all history, and you should add exception in ancestry.pl for metadata header explicytly and explicitly at speific commit, please go this route
There was a problem hiding this comment.
made the change to use skipped commits for metadata headers only
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
452ef75 to
3c6b921
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
This PR expands the existing enum value lock/ancestry tooling to also evaluate SAI enums defined under the meta/ header set (and additionally runs the lock check against experimental/), helping detect unintended enum value shifts beyond just inc/.
Changes:
- Update
checkheaders.plto compile enums againstinc/sai.hand (when needed) include headers from non-incdirectories (e.g.,meta/). - Extend
checkenumlock.shto compare enum values formeta/andexperimental/in addition toinc/. - Extend ancestry tooling (
checkancestry.sh,ancestry.pl) to incorporate headers frommeta/and add a commit-range skip mechanism.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| meta/checkheaders.pl | Adjusts include strategy for non-inc directories; updates gcc include path. |
| meta/checkenumlock.sh | Checks enum-lock stability for meta/ and experimental/ in addition to inc/. |
| meta/checkancestry.sh | Checks out meta/ per-commit and adds skip-range filtering to commit list generation. |
| meta/ancestry.pl | Processes meta/ headers alongside inc/ when building enum history. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3c6b921 to
bcdad85
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Tejaswini Chadaga <tchadaga@microsoft.com>
bcdad85 to
b880b86
Compare
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'dir=s' => \$mydir, # Directory to process, e.g. inc or meta (default: inc) | ||
| 'commits=s{,}' => \@mycommits, # --commits c1 c2 c3 ... | ||
| ) or die "Usage: $0 [opts] --dir <dir> --commits <c1> [c2 ...]\n"; | ||
|
|
| local SKIP_LIST=$(git rev-list --ancestry-path ${skip_begin}^..${skip_end} | xargs -n 1 git rev-parse --short | tac) | ||
|
|
||
| LIST_INC=$FULL_LIST | ||
| LIST_META=$(grep -vxFf <(echo "$SKIP_LIST") <<< "$FULL_LIST") |
| use Getopt::Std; | ||
| use Data::Dumper; | ||
| use utils; | ||
|
|
||
| my %options = (); | ||
|
|
| perl ancestry.pl -H "ancestry.1f2bca1.history" --dir "inc" --commits $LIST_INC | ||
| perl ancestry.pl -H "ancestry.1f2bca1.history" --dir "meta" --commits $LIST_META |
There was a problem hiding this comment.
why this is executed twice? since normally history file is based on entire include files, this will basically split it to 2 entries, what i meant in my comment previously to add explicit skip for commits for meta directory inside ancesry.pl file not checkancestry.sh, this will work what you implemented, but it will not generate histroy file for meta directory, with your approach you would need 2 files with histrou, one for inc one for meta
| my $commit = shift; | ||
|
|
||
| my @headers = GetHeaderFiles("temp/commit-$commit/inc"); | ||
| my $dir = defined($mydir) ? $mydir : 'inc'; |
There was a problem hiding this comment.
is this check done here fir inc/meta switch? why then mydirisadded if that directory is given from command line? should it alwys be command line ? and maybe add t hen check here if the dir dont exists then exit(1) ?
|
@tjchadaga remind me again why enum check is done for meta data directory ? since if meta directory are not serialized, and are used only in compilation betweend syncd and sairedis (maybe orchagent? not sure here) so you would get missmatch if you would use differet sairedis library with differetn syncd library which make no sesne to use pleae provide scenario where you got explicit failure of enum shif in meta headers |
This PR expands the existing enum value lock/ancestry tooling to also evaluate SAI enums defined under the meta/ header set (and additionally runs the lock check against experimental/), helping detect unintended enum value shifts beyond just inc/.