Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support all latest versions, add even more tests for other issues #79

Open
wants to merge 24 commits into
base: master
Choose a base branch
from

Conversation

zardoy
Copy link
Contributor

@zardoy zardoy commented Jun 13, 2024

re opened pr as changed the branch

Copy link

socket-security bot commented Jun 13, 2024

Removed dependencies detected. Learn more about Socket for GitHub ↗︎

🚮 Removed packages: npm/prismarine-chunk@1.35.0)

View full report↗︎

@extremeheat
Copy link
Member

Instead of closing and reopening an identical PR you should instead either do a force push where needed to change history or commits. This prevents the PR from needing to be re-reviewed from scratch.

"prismarine-chunk": "^1.29.0",
"prismarine-nbt": "^2.0.0",
"prismarine-block": "^1.17.1",
"prismarine-chunk": "github:zardoy/prismarine-chunk",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocked at least by PrismarineJS/prismarine-chunk#240

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blocked by addressing comments at PrismarineJS/prismarine-chunk#240

@zardoy
Copy link
Contributor Author

zardoy commented Jun 13, 2024

Instead of closing and reopening an identical PR you should instead either do a force push where needed to change history or commits. This prevents the PR from needing to be re-reviewed from scratch.

AFAIK, you cannot change the source branch after creating a Pull Request. You have to create a new one instead!

@zardoy
Copy link
Contributor Author

zardoy commented Jun 13, 2024

all comments from the previous pr are resolved, now, I only need to think about what to do with failing tests: should I remove them or disable them somehow for now?

This reverts commit 5dbeb3b.
@extremeheat
Copy link
Member

extremeheat commented Jun 13, 2024

AFAIK, you cannot change the source branch after creating a Pull Request. You have to create a new one instead!

You cannot change your branch, but you can change the commits on the branch. If you need to change the commits on the branch and change history git makes it possible to update the history with a force push. If you need to make a new branch locally and push to a remote branch with your PR you do git push origin localBranch:remoteBranch --force.

all comments from the previous pr are resolved, now, I only need to think about what to do with failing tests: should I remove them or disable them somehow for now?

They are not resolved

const bitsPerBiome = Math.ceil(Math.log2(biomePalette.length))

if (!bitsPerBlock) {
blockStates = nbt.comp({ palette: nbt.list(nbt.comp(blockPalette)) })
} else {
if (bitsPerBlock === 1 || bitsPerBlock === 2 || bitsPerBlock === 3) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

@extremeheat extremeheat Jun 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. Are you saying tests in the current master branch are failing without this? I don't understand the reasoning behind this change, it doesn't make sense to me because this will definitely have an effect on decoding blocks (as in incorrect block states may be read despite tests seeming to pass).

Copy link
Contributor Author

@zardoy zardoy Jun 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it is in the writing part of the code, not reading, isn't it? And yes tests are failing without this. Reverting this change and tests change will not fix the issue itself , for me saving didn't work most of the time. And it was the simple way to fix the problem . If you have any other suggestions please let me know 🙏

Also i couldn't find anything bad in this so far

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is definitely does not seem correct

@zardoy
Copy link
Contributor Author

zardoy commented Jun 13, 2024

You cannot change your branch, but you can change the commits on the branch. If you need to change the commits on the branch and change history git makes it possible to update the history with a force push. If you need to make a new branch locally and push to a remote branch with your PR you do git push origin localBranch:remoteBranch --force.

Yes, the previous source branch is the default branch of my repo and I pushed some experimental unrelated to PR changes for my projects. In theory, I could rename it to something else, create a new branch, and set it as a new default branch with the old name. Sorry, I forgot there is a simple way to rename remote branches.

They are not resolved

Can you elaborate? I don't see anything that I made worse..

@zardoy
Copy link
Contributor Author

zardoy commented Jun 13, 2024

tests are green, I will be waiting for your reply


for (const version of testedVersions) {
if (todoVersions.includes(version)) continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you skipping versions? Either all versions should be tested or you should revert this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said in the previous PR all versions wasn't tested in the previous version of the code either. I just refactored it make it clear but didn't change the list of tested versions here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the line

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is your point that there is missing test data for these versions? If so that should be written explicitly in a comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@extremeheat The point of this change is to ensure newly added versions in supported versions are tested without needing to add new versions here (you may forget to do it). This was made for convenience. Could I just rename it to skippedVersions? Or will it still not be clear?

Comment on lines +70 to +72
if (!reChunk.dump().equals(chunk.dump())) {
console.warn('Warning: chunk dump does not match original chunk dump')
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you remove the assert here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what was the point of this assertion? Isn't it to okay to have a different buffer if it's valid? And this was failing for half of the versions.
Please don't say I disabled it just to make tests pass, I just really didn't understand the reason of testing it (especially when everything release works fine)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The point of the test is to ensure re-encoding works! There is no non-determinism in minecraft chunks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, it will work, but again, what is the point of asserting the buffer contents? I don't think it's a good option to compare buffers without context.

eg it fails for previously disabled versions where re-encoding seems to be absolutely fine and the tests above also check it in a clear way.

I'm just trying to understand what is going on here. I want to enable more versions to test here, but this test fails and doesn't make any sense to me. Can you provide an example of the problem it solves?

Comment on lines +7 to +11
const todoVersions = ['1.9', '1.10', '1.11', '1.12', '1.15']
const testedVersions = require('../').supportedVersions

for (const version of testedVersions) {
if (todoVersions.includes(version)) continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as below


column.x = data.xPos
column.z = data.zPos
column.lastUpdate = data.LastUpdate.valueOf()
column.inhabitedTime = data.InhabitedTime.valueOf()

for (const section of data.sections) {
if (!section.block_states) continue
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this valid? What's the reasoning behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also to fix saving test for the latest version. If the section doesn't have information what's the point to proceed it?

const bitsPerBiome = Math.ceil(Math.log2(biomePalette.length))

if (!bitsPerBlock) {
blockStates = nbt.comp({ palette: nbt.list(nbt.comp(blockPalette)) })
} else {
if (bitsPerBlock === 1 || bitsPerBlock === 2 || bitsPerBlock === 3) {
Copy link
Member

@extremeheat extremeheat Jun 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand. Are you saying tests in the current master branch are failing without this? I don't understand the reasoning behind this change, it doesn't make sense to me because this will definitely have an effect on decoding blocks (as in incorrect block states may be read despite tests seeming to pass).

@extremeheat
Copy link
Member

Yes, the previous source branch is the default branch of my repo and I pushed some experimental unrelated to PR changes for my projects. In theory, I could rename it to something else, create a new branch, and set it as a new default branch with the old name. Sorry, I forgot there is a simple way to rename remote branches.

No, "renaming" the branch will either auto close the PR or move the PR's source branch with it. The only way to fix it is to keep the current remote and push a new history to it. I don't see anything different in this PR to the last one, but I've re-reviewed it.

@zardoy
Copy link
Contributor Author

zardoy commented Jun 13, 2024

I don't see anything different in this PR to the last one, but I've re-reviewed it.

I already pointed that I couldn't keep the same remote, it was not because of different history. At least I made tests green in this PR. And yes, not all was tested on master (and I increased the number of tested versions in writeNBT), that's why there are some of the changes to fix them

@rom1504
Copy link
Member

rom1504 commented Jun 16, 2024

until #75 if fixed, it won't be possible to support newer versions

@zardoy
Copy link
Contributor Author

zardoy commented Jun 16, 2024

until #75 if fixed, it won't be possible to support newer versions

how is this related? new versions almost don't have any changes and will work with 1.18 implementation fine (just like in p-chunk)

@rom1504
Copy link
Member

rom1504 commented Sep 8, 2024

please address comments or close the PR

@zardoy
Copy link
Contributor Author

zardoy commented Sep 8, 2024

please address comments or close the PR

easy to say...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Almost too old
Development

Successfully merging this pull request may close these issues.

4 participants