-
Notifications
You must be signed in to change notification settings - Fork 217
SG19-5: enforce package import table #21847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Initial logic, with "debugging packages" ifDebug Move to set, fix
Initial logic, with "debugging packages" ifDebug Move to set, fix
/azp run |
Azure Pipelines will not run the associated pipelines, because the pull request was updated after the run command was issued. Review the pull request again and issue a new run command. |
4ca9c6f
to
6583491
Compare
lg Add imports to EncodeModule rule, fixing tests?🙏
6583491
to
ea1fec0
Compare
stable packages will only depend on existing stable packages, adding its hash to | ||
this list won't change the hash. | ||
-} | ||
stableIds :: [PackageId] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly move to some bazel resource
.withDefault(_ => throw Error.Parsing("BuiltinFunction.UNRECOGNIZED")) | ||
|
||
// need to put at central place | ||
val stableIds: Seq[PackageId] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps to some bazel resource
} | ||
|
||
// need to put at central place | ||
val stableIds: Seq[PackageId] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps to some bazel resource
1a843c2
to
2b36b76
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
first comments.
string no_imported_packages_reason = 8; | ||
PackageImports package_imports = 9; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string no_imported_packages_reason = 8; | |
PackageImports package_imports = 9; | |
string no_imported_packages_reason = 8; // *Available in versions >= 2.dev* | |
PackageImports package_imports = 9; // *Available in versions >= 2.dev* |
private[archive] def decodePackageImports( | ||
lfPackage: PLF.Package | ||
): Either[String, collection.IndexedSeq[String]] = { | ||
lfPackage.getImportsSumCase match { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to reject if the field is set and LF = 2.1.
I think we need to reject if the field is unset and LF 2.dev
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a first round of comments, will review the bulk of the PR tomorrow.
| LfDoesNotSupportPkgImports | ||
| Testing String | ||
| Trace String --to insert callsite, for when reason unclear | ||
| Combined [NoPkgImportsReason] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it ever make sense to nest these reasons? If not maybe you could stratify the types have have another type for a list of reasons. Or are you doing it this way for efficiency reasons? But then you could still use the free monoid.
cannot get the genereated list by DA.Daml.StablePackages because that would | ||
introduce a circular dependency (DA.Daml.StablePackages depends on the encoder). | ||
If changes occur to the stablepackages, we can bootstrap this list: compile with | ||
current list of stable packages, observe hash, add has to list below. Since new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
current list of stable packages, observe hash, add has to list below. Since new | |
current list of stable packages, observe hash, add hash to list below. Since new |
upgradedPackageId = Nothing | ||
|
||
{- | ||
We put a list of stablepackages here, to be used by the proto encoder. These |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it feasible to have a test that this list is consistent with the hashes of stable packages?
ifSupports :: MonadReader r m => Feature -> Getting Version r Version -> m a -> m a -> m a | ||
ifSupports f = ifVersion (`supports` f) | ||
|
||
assertSupports :: MonadReader r m => Feature -> Getting Version r Version -> (Version -> m ()) -> m () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could call this whenNotSupports
for consistency with the when
of monads. Same below.
|
||
|
||
-- The extended implementation | ||
ifVersionWith :: MonadReader r m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: here and below I think it would be a bit more natural to take the lens first, because this seems like the argument you're mostly likely to specialize on.
fixes #21742