Skip to content

Conversation

@cdmurph32
Copy link
Collaborator

Settings need to be applied at the beginning of the tokio::spawn, since a thread may be reused and not have settings applied.

});

// Call postValidateCawg to decode CAWG assertions
// this is now a NO-OP
Copy link

Choose a reason for hiding this comment

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

Why leave it in if it's a no-op? Backwards compatibility?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. I just told people they had to use that method.

js-src/Reader.ts Outdated

async postValidateCawg(): Promise<void> {
return getNeonBinary().readerPostValidateCawg.call(this.reader);
// No-op: CAWG validation is now handled automatically by async reader constructors

Choose a reason for hiding this comment

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

Kept for backwards compatibility?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes.

} from "./Settings.js";

describe("Settings", () => {
afterAll(() => {

Choose a reason for hiding this comment

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

Suggestion: Do it in beforeAll too? So if something else would run on the same thread before, only the settings from the tests would be set, no doubts?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I could do it beforeAll in all of the test suites or none of them. It's been a real headache in c2pa-rs finding all of the tests that modify and don't reset the settings. I like the idea of detecting when tests don't put things back as they should.

pub fn reset_settings(mut cx: FunctionContext) -> JsResult<JsUndefined> {
// Create default settings and get their TOML representation
let default_settings = Settings::default();
let default_toml = toml::to_string(&default_settings)

Choose a reason for hiding this comment

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

contentauth/c2pa-rs#1533 may be of interest once it lands

Copy link

@emensch emensch left a comment

Choose a reason for hiding this comment

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

LGTM but I think we might be better off removing postValidateCawg, lest people get confused down the line just looking at the public API surface

@cdmurph32 cdmurph32 merged commit 9e2fb33 into main Oct 31, 2025
3 checks passed
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.

4 participants