Skip to content

Expect private tags#8996

Closed
ksen0 wants to merge 3 commits into
mainfrom
priv
Closed

Expect private tags#8996
ksen0 wants to merge 3 commits into
mainfrom
priv

Conversation

@ksen0

@ksen0 ksen0 commented Jul 20, 2026

Copy link
Copy Markdown
Member

Fixes #8980

Local test npm run custom:dev ../p5-20/p5.js#priv

image

@ksen0
ksen0 marked this pull request as draft July 20, 2026 22:01
@ksen0

ksen0 commented Jul 20, 2026

Copy link
Copy Markdown
Member Author

@limzykenneth stuck here. The original commit here fixed the reference docs but broke the tests.

So I am trying to add an "hidden" metadata that parsers/reference.ts could use to exclude but now I can't reproduce the original problem and also the tests still fail.

To be honest my mental model here makes no sense. I expect the p5.js data.json to match what p5.js-website builds and when I was getting the errors, it didn't match (on main on both, cleaned up). Now that's not happening either; I am not ruling out some kind of leftover data somewhere but I was manually deleting any left over reference artifacts.

I can sort of understand why changing exclusion rules in convert would break tests but I definitely dont understand why adding some metadata would.

Stopping here for the day, if you have any ideas would be helpful

@ksen0 ksen0 changed the title Expect privat tags Expect private tags Jul 20, 2026
@perminder-17

Copy link
Copy Markdown
Collaborator

Hi @ksen0 , regarding the test concern, I think the failing test was this one:

suite('saveCanvas', function() {
test('should download a png file', async () => {
myp5.createCanvas(100, 100, myp5.WEBGL);
const fbo = myp5.createFramebuffer();
fbo.draw(() => myp5.background('red'));
myp5.saveCanvas(fbo);
await new Promise(res => setTimeout(res, 500));
expect(document.createElement).toHaveBeenCalledWith('a');
expect(mockAnchorElement.click).toHaveBeenCalledTimes(1);
assert.equal(mockAnchorElement.download, 'untitled.png');
});
});
});

I reran the tests twice, and it passes now. I also remember discussing this particular test with Ken on Discord in the group. I'll take a look at fixing it, but for now I don't think it's related to your changes.

I observed that a test is flaky and occasionally fail (6 out of 10 times on an average) when executed in GitHub Actions.

@limzykenneth

Copy link
Copy Markdown
Member

@ksen0 I had a look, so from what I can see, everything is actually working as intended currently. The reason for the original issue showing the private makeGuardedCallbacks entry in the website build is because the website build automatically fetches the known version the repo is tagged with in src/globals/p5-version.ts and that currently points to 2.3.0. Checking out 2.3.0 in the p5.js repo where makeGuardedCallbacks is called, it is not marked as private, ie. before your commit marking it as private. Which means if we build the website against 2.3.0 which by default it does, it will continue to show the functions even though it has been marked private in the latest commit or RC release.

The website can be made to build against an RC version by just replacing the 2.3.0 version number in src/globals/p5-version.ts to 2.3.0-rc.2.

In other words, I think there's nothing to fix here, we can try to make building against specific version of the p5.js repo by the website easier.

@ksen0

ksen0 commented Jul 21, 2026

Copy link
Copy Markdown
Member Author

Thanks for explaining @limzykenneth . I did npm run build:reference with export const p5Version = "2.3.1-rc.2" as const; and indeed the private methods are not there.

@ksen0 ksen0 closed this Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[p5.js 2.0+ Bug Report]: Reference docs for RC include 2 private methods

3 participants