Skip to content

Conversation

roger-bosman-da
Copy link
Contributor

fixes #21742

@roger-bosman-da
Copy link
Contributor Author

/azp run

Copy link
Contributor

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.

@roger-bosman-da roger-bosman-da force-pushed the roger/package-reftable branch 2 times, most recently from 4ca9c6f to 6583491 Compare September 12, 2025 08:47
lg

Add imports to EncodeModule rule, fixing tests?🙏
stable packages will only depend on existing stable packages, adding its hash to
this list won't change the hash.
-}
stableIds :: [PackageId]
Copy link
Contributor Author

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] =
Copy link
Contributor Author

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] =
Copy link
Contributor Author

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

@roger-bosman-da roger-bosman-da marked this pull request as ready for review September 17, 2025 13:22
@roger-bosman-da roger-bosman-da requested a review from a team as a code owner September 17, 2025 13:22
Copy link
Collaborator

@remyhaemmerle-da remyhaemmerle-da left a comment

Choose a reason for hiding this comment

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

first comments.

Comment on lines +1383 to +1384
string no_imported_packages_reason = 8;
PackageImports package_imports = 9;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
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 {
Copy link
Collaborator

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

Copy link
Contributor

@paulbrauner-da paulbrauner-da left a 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]
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
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
Copy link
Contributor

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 ()
Copy link
Contributor

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
Copy link
Contributor

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.

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.

SG19-5: enforce package import table
4 participants