Skip to content

Enhance enum checker to include meta header files#2261

Open
tjchadaga wants to merge 1 commit intoopencomputeproject:masterfrom
tjchadaga:saimetachecker_fix
Open

Enhance enum checker to include meta header files#2261
tjchadaga wants to merge 1 commit intoopencomputeproject:masterfrom
tjchadaga:saimetachecker_fix

Conversation

@tjchadaga
Copy link
Collaborator

@tjchadaga tjchadaga commented Mar 10, 2026

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/.

@tjchadaga tjchadaga force-pushed the saimetachecker_fix branch from d89ea47 to 452ef75 Compare March 10, 2026 20:52
Comment on lines +126 to +127
#BEGIN_COMMIT=1f2bca1 # to this commit we have history file
BEGIN_COMMIT=c72635e # from this commit we are backward compatible
Copy link
Collaborator

Choose a reason for hiding this comment

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

please revert, you dont have history file with this commits

Copy link
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

but since you are adding meta directory so from 3132018 this commit (2021) there were some incompatible changes in meta

Copy link
Collaborator Author

@tjchadaga tjchadaga Mar 10, 2026

Choose a reason for hiding this comment

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

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?

Copy link
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

made the change to use skipped commits for metadata headers only

@tjchadaga
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tjchadaga tjchadaga force-pushed the saimetachecker_fix branch from 452ef75 to 3c6b921 Compare March 10, 2026 22:14
@tjchadaga
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.pl to compile enums against inc/sai.h and (when needed) include headers from non-inc directories (e.g., meta/).
  • Extend checkenumlock.sh to compare enum values for meta/ and experimental/ in addition to inc/.
  • Extend ancestry tooling (checkancestry.sh, ancestry.pl) to incorporate headers from meta/ 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.

@tjchadaga tjchadaga force-pushed the saimetachecker_fix branch from 3c6b921 to bcdad85 Compare March 10, 2026 22:41
@tjchadaga
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@tjchadaga tjchadaga marked this pull request as ready for review March 10, 2026 23:29
@tjchadaga tjchadaga changed the title [Draft] Enhance enum checker to include meta header files Enhance enum checker to include meta header files Mar 10, 2026
Signed-off-by: Tejaswini Chadaga <tchadaga@microsoft.com>
@tjchadaga tjchadaga force-pushed the saimetachecker_fix branch from bcdad85 to b880b86 Compare March 12, 2026 22:52
@tjchadaga
Copy link
Collaborator Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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")
Comment on lines 33 to 38
use Getopt::Std;
use Data::Dumper;
use utils;

my %options = ();

Copy link
Collaborator

Choose a reason for hiding this comment

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

this could be removed @tjchadaga

Comment on lines +119 to +120
perl ancestry.pl -H "ancestry.1f2bca1.history" --dir "inc" --commits $LIST_INC
perl ancestry.pl -H "ancestry.1f2bca1.history" --dir "meta" --commits $LIST_META
Copy link
Collaborator

Choose a reason for hiding this comment

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

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';
Copy link
Collaborator

Choose a reason for hiding this comment

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

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) ?

@kcudnik
Copy link
Collaborator

kcudnik commented Mar 13, 2026

@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

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