Commit graph

2094 commits

Author SHA1 Message Date
48c1a58df9 Fix new bug where re-modeling a background would reset it from ID 0
This bug never made it into production I think, it was a consequence of
some of how I refactored stuff in the recent changes? I think??

But yeah, I refactor how we manage `SwfAsset#body_id`, to be a bit more
explicit about when and how it can change, instead of the weird
callbacks that tbqh have bit us too often…
2024-11-06 13:48:01 -08:00
42e7eabdd8 Fix modeling bug where compatible_body_ids field was not updating
Ah right, the callbacks in `ParentSwfAssetRelationship` don't get
called when Rails does automatic join-model management stuff. We need
the `Item` to call its `update_cached_fields` callback itself, too!

When fixing this, I found a new bug that arose, in how we infer
`body_id` for assets that fit all pets. Fixing that next!
2024-11-06 13:39:32 -08:00
a208fca8d2 Improve modeling tests for records that shouldn't change
This gives better output when they fail, and also avoids spurious
failures like when an array for `cached_compatible_body_ids` is replaced
by an identical one! (I'm running into this right now, and yeah, it
helps a lot lol)
2024-11-06 13:04:50 -08:00
3ac89e830e Announcement about modeling being broken 2024-11-06 11:55:05 -08:00
d82c7f817a Disable modeling in production, while we investigate errors
Hmm, I think I made a mistake on `modeling_snapshot.rb:69`: I'm
assigning the *entire* `item.swf_assets` relation to *just* the assets
for the new model of it, which breaks all the other connections.

First, I'm disabling modeling. Then, I'll restore a backup. Then, I'll
write tests for that case, and fix it up!
2024-11-06 11:54:28 -08:00
5264947608 Minor tweaks to modeling private methods 2024-11-03 12:24:54 -08:00
90407403ba Extract modeling ViewerData class into new Pet::ModelingSnapshot file
Both extracted and renamed!
2024-11-03 12:23:51 -08:00
242b85470d Use our IntegerSet serializer for PetState#swf_asset_ids 2024-11-03 12:16:27 -08:00
43717e2535 Remove unused PetState#reassign_duplicates! 2024-11-03 12:07:57 -08:00
bc1f7152bf Remove unused SwfAsset.from_wardrobe_link_params 2024-11-03 12:07:23 -08:00
9eaee4a2d4 Refactor item modeling
Simpler, more encapsulated, and fixes the pending jank stuff in the
tests!
2024-11-03 12:05:37 -08:00
52ca41dbff Extract biology processing from AltStyle into Pet
I'm trying to pull more of the modeling code out of the individual
classes, and into this encapsulated preprocessing, so it's a lot more
in-one-place!
2024-11-03 11:46:29 -08:00
c03e7446e3 Refactor out biology assets in modeling code a bit 2024-11-03 11:41:18 -08:00
6402e5abc3 Remove the pending marker on some modeling tests 2024-11-02 21:39:34 -07:00
f81415d327 Refactor modeling viewer data handling into a new ViewerData class 2024-11-02 21:34:19 -07:00
13ceec8fcc Simplify modeling code for biology data
We're leaning more into Rails collection management and autosave stuff!
2024-11-02 21:15:12 -07:00
40765c729e Remove unused Pet.with_pet_type_color_ids scope 2024-11-02 20:21:59 -07:00
d26f3a7598 Add tests for modeling alt style assets 2024-11-02 20:15:35 -07:00
06721f77e9 Add alt style modeling tests
I didn't do the assets part of it yet, just the style object!
2024-10-29 22:20:43 -07:00
f9be3dceb1 Oh right, use Blue Jetsam "original biology" for modded Majal_Kita 2024-10-26 14:32:47 -07:00
c9c080e74d Merge branch 'main' into modeling-tests 2024-10-25 17:33:39 -07:00
e65634d8bc Set up tests for Majal_Kita and its alt style
Not actually touching alt style yet, just the very basic stuff about
how alt style can cause loading to fail in certain extremely rare cases
(specifically, if it's our first time seeing the underlying
color/species combo too, which… isn't gonna happen irl on DTI for a long
time if ever, I would guess, but hey!)
2024-10-25 14:47:51 -07:00
4c5d14c591 Add tests for re-modeling Thyassa, in a different mood 2024-10-25 14:15:25 -07:00
28bd6ecca4 Test that modeling items twice doesn't affect them or their assets 2024-10-25 13:47:23 -07:00
7a837edaf6 Use alias they in specs instead of it, when it reads better 2024-10-25 13:38:02 -07:00
f3894759d6 Add tests for modeling item assets 2024-10-25 13:34:02 -07:00
30ada0b7e1 For biology assets, make clearer the weirdness with saving first 2024-10-25 13:04:46 -07:00
8a38ce90dc Refactor tests for saving things when pet is saved
This got more complicated with the items case, and I think this is a
stronger idiom for communicating it!
2024-10-25 12:55:31 -07:00
6d25b3424f Add tests for matts_bat's items
Not their assets yet, just the items
2024-10-24 15:58:16 -07:00
8902527438 Basic modeling spec for my pet, matts_bat
No items yet, just putting in the very basics of biology, more
shortform than the Thyassa case
2024-10-24 15:37:57 -07:00
044dface14 Add RSpec to the commit hook 2024-10-24 15:22:39 -07:00
b1890d4f6f Refactor existing modeling tests to follow more RSpec-y syntax
I'm learning how to group things and stuff!
2024-10-24 15:16:55 -07:00
3a5f33fd56 Add tests that modeling a pet a second time doesn't affect its records
That is, if everything is the same as before, we don't need to change
anything in our database!

I also learned a bit more about RSpec syntax sugars, it's cute!
2024-10-24 15:04:25 -07:00
a54a844e03 Refactor modeling spec to use a new "a_record_matching" matcher 2024-10-24 14:42:05 -07:00
c78d45a0b5 Copy edit on pet styles
The NC Pet Styles sentence getting broken across two lines I think
makes it too hard to notice.

Design-wise, it would be nice to just call better attention to this
feature altogether in some higher-level design-language-y way, but!
Whatever!
2024-10-22 16:48:37 -07:00
930bfca028 Add creation date to alt styles listings
Copied from how pet types do it!
2024-10-22 16:46:55 -07:00
29aa769bda Oops, tiny copy edit for alt styles page
Right, missed this when renaming them, lol!
2024-10-22 16:44:42 -07:00
66438eae1a Add mode to keep labeled alt styles until they're all labeled
If you check this box, it'll keep you in a mode where saving an alt
style redirects you to the *next* one that needs labeling, until
they're all done. Useful for big drops!
2024-10-22 16:39:25 -07:00
3b5b13c172 Fewer slowest examples in RSpec, cuz these are fast and it's fine
I want to not turn it off entirely, so that if there's a nasty one it
becomes visible, but we don't need all that vertical space for this
small test suite rn!
2024-10-21 16:47:51 -07:00
5b1d1f0695 Add assets to modeling tests, and also uhh some other fixes
I forget, there was some tricky debugging about getting the fixtures
right, I think the previous commit doesn't *actually* pass from a clean
setting. Ah well, looks good now!
2024-10-21 16:46:10 -07:00
e92e315743 Move modeling tests to RSpec
Also note the jsbundling bump, that was so I can us the relatively-new
`SKIP_YARN_INSTALL=1` flag when running tests, to be a bit faster.
2024-10-21 16:03:58 -07:00
eb2fb125b9 Basic modeling test!
Just getting a basic foothold here. I'm thinking about moving this to
RSpec, cuz I feel like the assertions are gonna get pretty specific
and groupable.
2024-10-21 15:29:22 -07:00
d8ff99475e Add the Rails tests to the pre-commit hook
I'm gonna work on adding modeling tests, and I want to not be breaking
them without realizing! The trade history ones are good to be checking
more often like this, too.
2024-10-21 14:35:26 -07:00
9726ecb1a5 Fix trade activity tests: use a valid item fixture, not a placeholder
In 540ce08caa, I updated the Item class
to be more explicit about what fields are required, so this test would
fail in a more helpful way, instead of just crashing from `name` being
`nil` when trying to infer the Dyeworks info.

Now, we update the test to use Rails's standard "fixture" system to set
up a more-correct placeholder item, instead!
2024-10-21 14:26:36 -07:00
540ce08caa Handle invalid Item state a bit better
Catch missing fields in validation before sending it to the DB, and
skip the Dyeworks stuff if the name is missing.

I ran into this looking into `test/trade_activity_test.rb`, which fails
right now because we try to create a boring placeholder item with
minimal fields, which Dyeworks can't call `name.match()` on!

Now, the test fails with a more helpful error about the item being
invalid. Next, I'll fix that!
2024-10-21 14:24:45 -07:00
881e63cfbd Output JSON from rails pets:load[pet_name]
Gonna use this for making mock data for automatic testing!
2024-10-21 14:03:56 -07:00
09e5a39b4c Whoops, fix alt styles when modeling real pets wearing them
Just never did this, I guess!! 😅
2024-10-18 19:16:41 -07:00
bf20c9bb31 Ah beans, I goofed alt style modeling *again*
Feeling for-real about getting a test suite set up because oh my god
2024-10-18 19:01:26 -07:00
7607c2c015 Oops, fix sloppiness about pet service refactor
I guess I like super didn't test this end-to-end, oops!!
2024-10-18 18:14:01 -07:00
abfe1e6df7 Extract neopets_origin into a config value 2024-10-18 18:00:48 -07:00