Skip to content

Remove use of Undefined_Set. - #3271

Open
somiaj wants to merge 1 commit into
openwebwork:developfrom
somiaj:remove-undefined-set
Open

somiaj wants to merge 1 commit into
openwebwork:developfrom
somiaj:remove-undefined-set

Conversation

@somiaj

@somiaj somiaj commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

This is an alternative solution to #3267. I don't use this feature and have no strong opinions on which way to go. I do know from comments I've seen in the forums that others do use this feature, so removing it may affect others workflow. I will leave this here, and let approvals decide if we want to keep supporting the Undefined_Set approach, or remove it altogether. Please only merge one of the PRs, and close the other if/when it is decided which approach to use.

Problems can currently be rendered and tested in the problem editor, set details page, and library browser. Support for viewing them in their own window is historical from when it was not always possible to test a problem directly within those pages. To support viewing a a problem using an Undefined_Set required extra handling, fake sets, problems, and extra logic. Furthermore extra care is needed when viewing these problems to not allow submission, showing another version, or doing actions which may alter the database or not be valid for only testing a problem.

This removes links and extra handling around using an Undefined_Set, and problems are now only viewed/tested within the page they are rendered in. This simplifies the logic in many pages, specifically the Problem.pm and GatewayQuiz.pm modules, which need lots of additional logic to handle this case.

This also adds show_me_another to checkSet.

There is now currently no use of fake_test_version, but fake_set, fake_test, and fake_problem are still used by renderRPC.

@dlglin

dlglin commented Nov 9, 2026

Copy link
Copy Markdown
Member

The one use case I can think of is in test mode.

Some PG problems behave differently in test mode (usually to do with legacy named answers), so having the set detail page spawn a new window with a mock test was a quick way to test to see if the problem worked properly in a test.

@drgrice1

drgrice1 commented Nov 9, 2026

Copy link
Copy Markdown
Member

The problem with that is that it was not a proper validation that a problem will properly work in a test. The "Undefined_Set" was a hack that did not give a proper test. The only way to really get that is to create an actual test version. The "Undefined_Set" faked a single page test, and so problems with bad hard coded answer names would actually work for that.

@drgrice1 drgrice1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think I like this approach much better than #3267. It allows for considerable code clean up, and eliminates the hackery of acting like there is a set when there isn't.

I need to review this better yet, but here are a couple of things I see now.

The templates/HelpFiles/InstructorPGProblemEditor.hml.ep file needs to be updated. It still mentions the "Open in new window" option.

@somiaj
somiaj force-pushed the remove-undefined-set branch from 4606bca to ea430d1 Compare November 9, 2026 17:07
@somiaj

somiaj commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Help file updated, removed mention of "Open in new window". There was no "Try it" button mentioned in the Library Browser help, so nothing needed changed there.

@somiaj

somiaj commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@dlglin I think the more subtle issues only occur with multiple problems on the same page, or saving answers between multiple pages, neither of which are tested with the Undefined_Set and a single problem.

@somiaj
somiaj force-pushed the remove-undefined-set branch 4 times, most recently from ae20cae to 493aa98 Compare November 10, 2026 22:26
Problems can currently be rendered and tested in the problem editor,
set details page, and library browser. Support for viewing them in
their own window is historical from when it was not always possible
to test a problem directly within those pages. To support viewing a
a problem using an `Undefined_Set` required extra handling, fake sets,
problems, and extra logic. Furthermore extra care is needed when
viewing these problems to not allow submission, showing another
version, or doing actions which may alter the database or not be
valid for only testing a problem.

This removes links and extra handling around using an `Undefined_Set`,
and problems are now only viewed/tested within the page they are
rendered in. This simplifies the logic in many pages, specifically
the Problem.pm and GatewayQuiz.pm modules, which need lots of
additional logic to handle this case.

This also adds `show_me_another` to checkSet.

There is now currently no use of `fake_test_version`, but `fake_set`,
`fake_test`, and `fake_problem` are still used by renderRPC.

Initial code removal was by me, then tested by Claude and cleaned up
some of the things found I missed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@somiaj
somiaj force-pushed the remove-undefined-set branch from 493aa98 to 14aec6c Compare November 12, 2026 17:29

@drgrice1 drgrice1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good. I really like the massive quantity of code that this cleans up by not having to fake a set or problem and deal with the undefined set case. Now the WeBWorK::ContentGenerator::Problem and WeBWorK::ContentGenerator::GatewayQuiz packages can focus on their true purpose of delivering content for students and making that reviewable by instructors.

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.

3 participants