Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.2.0 — remove the compute envelope

- Remove the `exfa/compute@1` / `exfa/compute-result@1` envelope: the `computeRequest` / `compute_request` helpers, the `Compute*` TypeScript types and `schema/compute.schema.json`. The engine no longer has a `compute` entry; use `resolve` (a fully resolved FitRequest) with the engine's `calc`, or `batch`.
- `compileGroup` now returns a plain engine BatchRequest, `{ batch_version: 1, fits: [{ id, label, fit }] }`, instead of an envelope-wrapped one (**breaking**: read `request.fits`, not `request.batch.fits`).
- Shorthand defaults (skill presets, module states) are a Format concern; they are not part of this release.

## 1.1.0 — next-stage compute media

- Add `exfa/compute@1` request envelopes (`computeRequest`), `exfa/group@1` documents (`newGroup`, `compileGroup` lowering to `batch.fits` with `project`/`command` relations and per-item `select`), and `exfa/package@1` exchange packages (`packageFit`, `packageGroup`, `mergePackage`) plus the `exfa/workspace@1` type.
Expand Down
2 changes: 1 addition & 1 deletion fixtures/engine/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Engine contract fixture

`fit-request.schema.json` is copied from EXFA-Engine (`contract/schema/fit-request.schema.json`, tag `v0.2.0`) and extended for the `exfa/compute@1` contract: equipment entries accept an optional `id` (host-assigned stable id), and projected `kind:"fit"` entries accept an optional `select` whitelist (`module_ids`/`drone_ids`/`fighter_ids`).
`fit-request.schema.json` is copied from EXFA-Engine (`contract/schema/fit-request.schema.json`, tag `v0.2.0`) and extended for host-assigned item ids: equipment entries accept an optional `id` (host-assigned stable id), and projected `kind:"fit"` entries accept an optional `select` whitelist (`module_ids`/`drone_ids`/`fighter_ids`).

There is a contract/schema mismatch with the current App adapter: App `toRequest` deliberately emits explicit `null` for optional request values (for example `ship.mode_type_id`, module `charge_type_id`/`mutation`/`spool`, and absent damage/target profiles), and passes the UI security labels `hisec`/`wspace` through unchanged. The v0.2.0 schema does not accept those nulls and only lists `highsec`/`wormhole`. Changing `resolve` would break the required App request parity. The TypeScript fixture checks therefore validate the raw request against a narrowly widened copy of the schema and validate a schema-normalized view against the unmodified Engine schema. The upstream file remains unchanged.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@exfa/format",
"version": "1.1.0",
"version": "1.2.0",
"description": "EXFA fit library and document format",
"type": "module",
"license": "LGPL-3.0-or-later",
Expand Down
2 changes: 1 addition & 1 deletion rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "exfa-format"
version = "1.1.0"
version = "1.2.0"
edition = "2021"
license = "LGPL-3.0-or-later"
description = "EXFA fit library and document format"
Expand Down
14 changes: 0 additions & 14 deletions rust/src/compute.rs

This file was deleted.

8 changes: 2 additions & 6 deletions rust/src/group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct CompiledGroup {
pub issues: Vec<String>,
}

/// Lowers a group into one `exfa/compute@1` batch request: every actor resolves to a `batch.fits[]` entry,
/// Lowers a group into one engine BatchRequest: every actor resolves to a `batch.fits[]` entry,
/// `project` relations push `{kind:"fit"}` entries (with a strict-whitelist `select` when the relation names
/// `source_item_ids`) onto the target's `projected[]`, and `command` relations push the source request onto the
/// target's `fleet.booster_fits[]`. Problems are reported as issues, not returned as errors.
Expand Down Expand Up @@ -111,11 +111,7 @@ pub fn compile_group(library: &Library, group: &Group, options: &ResolveOptions)
})
}).collect::<Vec<_>>();
Ok(CompiledGroup {
request: json!({
"format": "exfa/compute@1",
"operation": "batch",
"batch": { "batch_version": 1, "fits": fits },
}),
request: json!({ "batch_version": 1, "fits": fits }),
issues,
})
}
2 changes: 0 additions & 2 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pub mod compute;
pub mod files;
pub mod group;
pub mod migrate;
Expand Down Expand Up @@ -29,7 +28,6 @@ impl Display for FormatError {

impl std::error::Error for FormatError {}

pub use compute::compute_request;
pub use files::{from_files, read_directory, to_files, write_directory, FormatFile};
pub use group::{compile_group, new_group, CompiledGroup};
pub use migrate::{migrate, migrate_fit_document};
Expand Down
13 changes: 3 additions & 10 deletions rust/tests/format.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use exfa_format::{
compile_group, compute_request, from_files, merge_package, migrate, package_fit, package_group,
compile_group, from_files, merge_package, migrate, package_fit, package_group,
read_directory, resolve, resolve_with_options, to_files, write_directory,
Group, Library, MergePolicy, Package, ResolveOptions,
};
Expand Down Expand Up @@ -114,11 +114,6 @@ fn resolve_passes_item_ids_through() {
assert_eq!(request["drones"][0]["id"], json!("drone-1"));
assert_eq!(request["fighters"][0]["id"], json!("ftr-1"));
assert_eq!(request["cargo"][0]["id"], json!("cargo-1"));
let document = library.fits.get("app-basic").expect("fixture fit should exist").clone();
let request = compute_request(&library, &document, ResolveOptions::default()).expect("compute request should build");
assert_eq!(request["format"], json!("exfa/compute@1"));
assert_eq!(request["operation"], json!("calc"));
assert_eq!(request["fit"]["modules"][0]["id"], json!("mod-1"));
}

#[test]
Expand Down Expand Up @@ -188,10 +183,8 @@ fn compile_group_projects_with_select_and_commands() {
})).expect("group should deserialize");
let compiled = compile_group(&library, &group, &ResolveOptions::default()).expect("group should compile");
let request = &compiled.request;
assert_eq!(request["format"], json!("exfa/compute@1"));
assert_eq!(request["operation"], json!("batch"));
assert_eq!(request["batch"]["batch_version"], json!(1));
let fits = request["batch"]["fits"].as_array().expect("fits list");
assert_eq!(request["batch_version"], json!(1));
let fits = request["fits"].as_array().expect("fits list");
assert_eq!(fits.iter().map(|entry| entry["id"].as_str().unwrap()).collect::<Vec<_>>(), ["logi", "a", "b"]);
assert_eq!(fits[0]["label"], json!("Logi"));
assert_eq!(fits[1]["label"], json!("Doc a"));
Expand Down
28 changes: 0 additions & 28 deletions schema/compute.schema.json

This file was deleted.

2 changes: 1 addition & 1 deletion ts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@exfa/format",
"version": "1.1.0",
"version": "1.2.0",
"description": "EXFA fit library and document format",
"type": "module",
"license": "LGPL-3.0-or-later",
Expand Down
2 changes: 0 additions & 2 deletions ts/scripts/engine-schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export async function loadFormatSchemas() {
readJson('schema/library-index.schema.json'),
readJson('schema/package.schema.json'),
readJson('schema/workspace.schema.json'),
readJson('schema/compute.schema.json'),
]);
const ajv = new Ajv2020({ allErrors: true, strict: false });
addFormats(ajv);
Expand All @@ -112,7 +111,6 @@ export async function loadFormatSchemas() {
validateLibraryIndex: ajv.getSchema('https://github.com/EX-CT/EXFA-Format/schema/library-index.schema.json'),
validatePackage: ajv.getSchema('https://github.com/EX-CT/EXFA-Format/schema/package.schema.json'),
validateWorkspace: ajv.getSchema('https://github.com/EX-CT/EXFA-Format/schema/workspace.schema.json'),
validateCompute: ajv.getSchema('https://github.com/EX-CT/EXFA-Format/schema/compute.schema.json'),
};
}

Expand Down
22 changes: 0 additions & 22 deletions ts/src/compute.ts

This file was deleted.

13 changes: 9 additions & 4 deletions ts/src/group.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { applyBranch } from './branches.js';
import type { ComputeBatchRequest } from './compute.js';
import { resolveFit } from './resolve.js';
import type { FitDocument, FitRequest, FitRequestProjected, Group, Library, ProjectedFitSelect, ResolveOptions } from './types.js';

Expand All @@ -11,13 +10,19 @@ export function newGroup(name?: string, id?: string): Group {
return { format: 'exfa/group@1', id: id ?? uid(), name: name ?? 'New group', actors: [], relations: [] };
}

/** An engine BatchRequest (`fits` form): one resolved FitRequest per group actor. */
export interface GroupBatchRequest {
batch_version: 1;
fits: { id: string; label: string; fit: FitRequest }[];
}

export interface CompiledGroup {
request: ComputeBatchRequest;
request: GroupBatchRequest;
issues: string[];
}

/**
* Lowers a group into one `exfa/compute@1` batch request: every actor resolves to a `batch.fits[]` entry,
* Lowers a group into one engine BatchRequest: every actor resolves to a `fits[]` entry,
* `project` relations push `{kind:'fit'}` entries (with a strict-whitelist `select` when the relation names
* `source_item_ids`) onto the target's `projected[]`, and `command` relations push the source request onto the
* target's `fleet.booster_fits[]`. Problems are reported as issues, not thrown.
Expand Down Expand Up @@ -87,7 +92,7 @@ export function compileGroup(library: Library, group: Group, options: ResolveOpt
return entry ? [{ id: actor.id, label: actor.label ?? entry.doc.name, fit: entry.request }] : [];
});
return {
request: { format: 'exfa/compute@1', operation: 'batch', batch: { batch_version: 1, fits } },
request: { batch_version: 1, fits },
issues,
};
}
1 change: 0 additions & 1 deletion ts/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './types.js';
export * from './branches.js';
export * from './compute.js';
export * from './files.js';
export * from './group.js';
export * from './history.js';
Expand Down
38 changes: 0 additions & 38 deletions ts/test/compute.test.ts

This file was deleted.

14 changes: 7 additions & 7 deletions ts/test/group.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
type Group,
type Library,
} from '../src';
import { loadFormatSchemas } from '../scripts/engine-schema.mjs';
import { loadEngineValidators } from '../scripts/engine-schema.mjs';

const makeDoc = (id: string, name: string, fit?: Partial<Fit>): FitDocument => ({
format: 'exfa/fit@1',
Expand Down Expand Up @@ -59,8 +59,7 @@ const makeLibrary = (): Library => ({
groups: {},
});

const fitsOf = (request: { batch: Record<string, unknown> }) =>
request.batch.fits as { id: string; label: string; fit: FitRequest }[];
const fitsOf = (request: { fits: { id: string; label: string; fit: FitRequest }[] }) => request.fits;

describe('newGroup', () => {
it('creates an empty exfa/group@1 document with a generated id', () => {
Expand All @@ -85,16 +84,17 @@ describe('compileGroup', () => {
};
const { request, issues } = compileGroup(library, group);
expect(issues).toEqual([]);
expect(request).toMatchObject({ format: 'exfa/compute@1', operation: 'batch' });
expect(request.batch.batch_version).toBe(1);
expect(request.batch_version).toBe(1);
const fits = fitsOf(request);
expect(fits.map((entry) => entry.id)).toEqual(['logi', 'dps']);
expect(fits[0].label).toBe('Logi');
expect(fits[1].label).toBe('DPS A');
expect(fits[0].fit.modules.map((module) => module.id)).toEqual(['rep-1', 'rep-2']);

const validators = await loadFormatSchemas();
expect(validators.validateCompute?.(request), JSON.stringify(validators.validateCompute?.errors)).toBe(true);
const { validateAppCompatible } = await loadEngineValidators();
for (const entry of fits) {
expect(validateAppCompatible(entry.fit), JSON.stringify(validateAppCompatible.errors)).toBe(true);
}
});

it('projects the full source fit with a classified select whitelist', () => {
Expand Down
Loading