Conversation
…mismatch
Two changes fix this at the root and make the test more meaningful.
### 1. Externalize `@encode42/nbs.js` in the `@nbw/song` node build
`packages/song/scripts/build.ts` was bundling `@encode42/nbs.js` into `dist/index.node.js`, so `loadNbsFromBuffer` returned a `Song` from a **different** constructor than the one imported directly in the backend test.
Adding `external: ['@encode42/nbs.js']` to the node build makes the built package import from the shared `node_modules` copy instead. After rebuilding:
```
same constructor: true
```
### 2. Stronger test assertions
Removed the misleading TODO and added checks on the actual song data:
```ts
expect(song).toBeInstanceOf(Song);
expect(song.meta.name).toBe('Cool Test Song');
expect(song.length).toBe(16);
expect(song.layers).toHaveLength(3);
```
Both `getSongObject` tests pass now. The browser build is unchanged (it still bundles `nbs.js`, which is fine for the frontend).
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
We currently implicitly expect all songs on the website to have been generated with Note Block Studio, which will save songs with either 16 or 20 default instruments since the first NBS format upgrade. If a custom-generated song is uploaded that contains fewer instruments, the song normalization should coerce it to have one of these instrument counts. The database allowed any integer to be in this field, though, which is fine. However, in the case this coercion process fails, we would like an extra safeguard so it fails 'early' before the suspicious document is persisted to the database. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Prevents web crawling on non-production deployments.
The field `firstCustomInstrumentIndex` already exists which serves the same purpose.
|
🚅 Deployed to the NoteBlockWorld-pr-96 environment in Note Block World
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Features
.nbsfile format version 6, shipping in NBS 3.12 (Add NBS v6 upload support #93)nbsVersionfield on song stats #94)nbsVersionfield (currently 5 or 6) to theSongentity (Add database migration infrastructure +nbsVersionfield on song stats #94)robots.txtgeneration to avoid indexing non-production deployments (Add dynamicrobots.txtgeneration #95)