Prepare engine 0.4.150 packaging and clarify final-state wonder badge

This commit is contained in:
coyotte508 2026-11-14 00:56:43 +00:00
commit 9ff814d17b
5 changed files with 108 additions and 1 deletions

View file

@ -1,6 +1,10 @@
# Clash of Cultures achievements
Review-only implementation; no release or BGS publication is implied.
Prepared engine release: `@boardgamers/clash-server` **0.4.150**, BGS `clash/1`
(Clash of Cultures: Monumental edition). Publication awaits release-delta review;
this source document does not assert deployment. Engine-only release; the hosted
viewer remains 0.1.217. See `web-client/release/engine-package.json` for the reproducible
package metadata.
The native Rust evaluator is the single source of truth. The WASM package exports
`achievementDefinitions()` and `achievements(serializedData)` directly, alongside
@ -32,6 +36,12 @@ Additional feats are evaluated independently of victory:
| `two-wonders-built` | At least two recorded wonders built, not merely owned |
| `captured-leader` | At least one recorded captured leader |
The wonder feat deliberately uses the **final surviving `wonders_built` record**,
not a lifetime construction count: `destroy_wonder` removes a destroyed wonder
from that record for every player. Two wonders built earlier do not qualify if
fewer than two remain recorded at completion. Merely capturing/owning a wonder
never substitutes for a built record. This is covered by a destruction regression.
Icons are omitted intentionally: the platform's generic fallback is sufficient.
IDs are permanent identities and must not be repurposed. This catalog is BGS
platform metadata, not text rendered by the game viewer, so the viewer localization

View file

@ -346,6 +346,22 @@ mod tests {
}
}
#[test]
fn destroyed_wonder_no_longer_counts_in_final_built_record() {
let mut game = finish(setup(GameLength::Standard));
let position = game.player(0).cities[0].position;
let owner = crate::events::EventPlayer::new(
0,
EventOrigin::Ability("wonder destruction regression".into()),
);
game.player_mut(0).wonders_built = vec![Wonder::Pyramids, Wonder::Colosseum];
crate::wonder::gain_wonder(&mut game, &owner, Wonder::Pyramids, position);
assert!(has(&game, 0, "two-wonders-built"));
crate::wonder::destroy_wonder(&mut game, &owner, Wonder::Pyramids, position);
assert_eq!(game.player(0).wonders_built, vec![Wonder::Colosseum]);
assert!(!has(&game, 0, "two-wonders-built"));
}
#[test]
fn saved_end_game_fixture_and_nonwinning_feats() {
let data: crate::game_data::GameData = serde_json::from_str(include_str!(

View file

@ -1291,6 +1291,50 @@ map city selection and Settler confirmation. Packed-engine protocol and split
WASM bundle checks pass. Existing Clippy warnings and expected rejected-move
WASM diagnostics remain.
# Engine 0.4.150 (viewer stays 0.1.217)
Engine-only release for **Clash of Cultures: Monumental edition**, BGS `clash/1`.
Adds the revision-1 catalog of 17 achievements and the two optional engine hooks.
See `docs/achievements.md` for exact final-state predicates and the destroyed-wonder
caveat. No rules, saved games, history, practice policy, or creation options change.
Build with the pinned Rust 1.94.1 toolchain using `npm run build:bridge`, then run
`node scripts/package-engine.mjs` from `web-client`. The tracked package identity
is `release/engine-package.json`; the ignored artifact lands in `.engine/releases`.
Test the unpacked package and its named exports, including the official protocol
0.11.0 achievement schemas, before upload.
Artifact/source integrity recipe (run from a clean, committed release checkout):
```sh
git status --porcelain # must be empty
git rev-parse HEAD # record this source commit with the artifact hash
rustup run 1.94.1 rustc --version
wasm-bindgen --version # must match Cargo.lock: 0.2.105
RUSTUP_TOOLCHAIN=1.94.1 npm --prefix web-client run build:bridge
node web-client/scripts/package-engine.mjs
```
The bridge build uses `cargo --locked` and the packager copies only the declared
Node bridge files plus LICENSE; it runs `npm pack --ignore-scripts` and reports
the archive SHA-256. It does not build, upload or publish a viewer, install an
engine, or push Git. It packages existing `.engine` outputs, so **do not skip the
fresh build above**. Unpack the archive and byte-compare every declared file to
`.engine`, run protocol/fixture tests against its `server.js` via dynamic import,
and retain the source commit, toolchain versions and artifact SHA-256 together.
Any later source edits require a fresh build and validation before publication.
For this engine-only release, use the existing authenticated admin endpoint
`POST /api/admin/gameinfo/clash/1/engine` with the raw npm tarball and
`Content-Type: application/octet-stream`. Read credentials from `~/.bgs` in memory;
never put them in source or command arguments. Do not run `publish.mjs`, which also
uploads a viewer. Preserve the engine entry point, viewer, gallery, options,
preferences, settings and tutorial. Verify hosted artifact bytes, then wait for
the asynchronous installer to publish `achievementManifest` revision 1 with all
17 definitions. Check the public `/badges/games/clash` album without creating games.
Commit and non-force push the matching source/version to canonical `main` in the
same delivery task.
# Viewer 0.1.217 / engine 0.4.149
Permanent piece-loss journal notes now name the destroyed city center or building

View file

@ -0,0 +1,10 @@
{
"name": "@boardgamers/clash-server",
"version": "0.4.150",
"description": "Clash of Cultures: Monumental edition engine for Boardgamers Space",
"license": "MIT",
"type": "commonjs",
"main": "server.js",
"types": "server.d.ts",
"files": ["server.js", "server_bg.wasm", "server.d.ts", "server_bg.wasm.d.ts"]
}

View file

@ -0,0 +1,27 @@
// Run build:bridge first. Package exactly that tested Node/WASM bridge, not a viewer.
import { copyFile, mkdir, readFile, rm, writeFile } from 'node:fs/promises';
import { execFileSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';
import { createHash } from 'node:crypto';
import path from 'node:path';
const root = fileURLToPath(new URL('..', import.meta.url));
const metadata = JSON.parse(await readFile(path.join(root, 'release/engine-package.json'), 'utf8'));
const staging = path.join(root, '.engine/releases/package');
const output = path.join(root, '.engine/releases');
await rm(staging, { recursive: true, force: true });
await mkdir(staging, { recursive: true });
for (const file of metadata.files) await copyFile(path.join(root, '.engine', file), path.join(staging, file));
await copyFile(path.join(root, '../LICENSE'), path.join(staging, 'LICENSE'));
await writeFile(path.join(staging, 'package.json'), JSON.stringify(metadata, null, 2) + '\n');
const [packed] = JSON.parse(
execFileSync('npm', ['pack', '--ignore-scripts', '--json', '--pack-destination', output], {
cwd: staging,
encoding: 'utf8',
}),
);
const artifact = path.join(output, packed.filename);
const sha256 = createHash('sha256')
.update(await readFile(artifact))
.digest('hex');
console.log(JSON.stringify({ artifact, name: metadata.name, version: metadata.version, sha256 }, null, 2));