Skip to content

Commit

Permalink
chore: Revert compartment-map.json tags to conditions schema migration (
Browse files Browse the repository at this point in the history
#2389)

Refs: #2388 

## Description

See #2388, we cannot at this time change the schema of
`compartment-map.json` as I attempted in
#2373

### Security Considerations

None.

### Scaling Considerations

None.

### Documentation Considerations

None.

### Testing Considerations

None.

### Compatibility Considerations

Restores backward compatibility for production systems.

The file `app.agar` is a zip file generated by a previous version of the
compartment mapper, used as a test fixture to verify that future
versions can import ancient versions. To get tests passing in #2373, I
regenerated `app.agar` and in this change, I revert it to the original
schema. Having to regenerate `app.agar` is supposed to be a hint that
something is broken, and I waltzed through the warnings.

### Upgrade Considerations

None.
  • Loading branch information
kriskowal authored Jul 30, 2024
2 parents b145fe1 + fd2a393 commit 609a3bf
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 13 deletions.
2 changes: 0 additions & 2 deletions packages/bundle-source/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const makeBundleCache = (wr, cwd, readPowers, opts) => {
* @param {Logger} [log]
* @param {object} [options]
* @param {boolean} [options.noTransforms]
* @param {string[]} [options.tags]
* @param {string[]} [options.conditions]
* @param {ModuleFormat} [options.format]
*/
Expand Down Expand Up @@ -154,7 +153,6 @@ export const makeBundleCache = (wr, cwd, readPowers, opts) => {
* @param {object} [options]
* @param {boolean} [options.noTransforms]
* @param {ModuleFormat} [options.format]
* @param {string[]} [options.tags]
* @param {string[]} [options.conditions]
* @returns {Promise<BundleMeta>}
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/bundle-source/src/zip-base64.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const readPowers = makeReadPowers({ fs, url, crypto });
* @param {boolean} [options.dev]
* @param {boolean} [options.cacheSourceMaps]
* @param {boolean} [options.noTransforms]
* @param {string[]} [options.condditions]
* @param {string[]} [options.conditions]
* @param {Record<string, string>} [options.commonDependencies]
* @param {object} [grantedPowers]
* @param {(bytes: string | Uint8Array) => string} [grantedPowers.computeSha512]
Expand Down
2 changes: 1 addition & 1 deletion packages/compartment-mapper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ The compartment map shape:
// CompartmentMap describes how to prepare compartments
// to run an application.
type CompartmentMap = {
conditions: Conditions,
tags: Conditions,
entry: Entry,
compartments: Record<CompartmentName, Compartment>,
realms: Record<RealmName, Realm>, // TODO
Expand Down
4 changes: 3 additions & 1 deletion packages/compartment-mapper/src/archive-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ export const makeArchiveCompartmentMap = (compartmentMap, sources) => {
const archiveSources = renameSources(sources, compartmentRenames);

const archiveCompartmentMap = {
conditions: [],
// TODO migrate tags to conditions
// https://github.com/endojs/endo/issues/2388
tags: [],
entry: {
compartment: archiveEntryCompartmentName,
module: entryModuleSpecifier,
Expand Down
4 changes: 2 additions & 2 deletions packages/compartment-mapper/src/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ export const makeBundle = async (readPowers, moduleLocation, options) => {
const {
moduleTransforms,
dev,
tags,
conditions: conditionsOption = tags,
tags: tagsOption,
conditions: conditionsOption = tagsOption,
searchSuffixes,
commonDependencies,
sourceMapHook = undefined,
Expand Down
4 changes: 3 additions & 1 deletion packages/compartment-mapper/src/capture-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ const captureCompartmentMap = (compartmentMap, sources) => {
const captureSources = renameSources(sources, compartmentRenames);

const captureCompartmentMap = {
conditions: [],
// TODO graceful migration from tags to conditions
// https://github.com/endojs/endo/issues/2388
tags: [],
entry: {
compartment: captureEntryCompartmentName,
module: entryModuleSpecifier,
Expand Down
5 changes: 3 additions & 2 deletions packages/compartment-mapper/src/compartment-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,9 @@ export const assertCompartmentMap = (
)}`,
);
const {
tags,
conditions = tags,
// TODO migrate tags to conditions
// https://github.com/endojs/endo/issues/2388
tags: conditions,
entry,
compartments,
...extra
Expand Down
4 changes: 3 additions & 1 deletion packages/compartment-mapper/src/node-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,9 @@ const translateGraph = (
}

return {
conditions: [...conditions],
// TODO graceful migration from tags to conditions
// https://github.com/endojs/endo/issues/2388
tags: [...conditions],
entry: {
compartment: entryPackageLocation,
module: entryModuleSpecifier,
Expand Down
3 changes: 1 addition & 2 deletions packages/compartment-mapper/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ export {};
* Compartments, each corresponding to Node.js style packaged modules.
*
* @typedef {object} CompartmentMapDescriptor
* @property {Array<string>} [tags] is deprecated in favor of `conditions`
* @property {Array<string>} conditions
* @property {Array<string>} tags
* @property {EntryDescriptor} entry
* @property {Record<string, CompartmentDescriptor>} compartments
*/
Expand Down
Binary file modified packages/compartment-mapper/test/app.agar
Binary file not shown.

0 comments on commit 609a3bf

Please sign in to comment.