Skip to content

Conversation

@moseshll
Copy link
Collaborator

@moseshll moseshll commented Oct 24, 2025

The SBCR UI is a combination of the Core and Crown Copyright projects. No attempt has been made to reduce duplication between the new code and the existing UI components (*.tt bits), since we don't have sufficient test coverage, in particular no way to Playwright the thing.

The new Project::SBCR subclass has 100% test coverage, most of that being in the ValidateSubmission method which does a number of checks on user-entered review data. Many of these were written (based on checks in other projects) and not needed for SBCR so they are applied toward better coverage in Project.t (which holds the default set of validations for monographs/state gov docs projects) mostly. More could be done, either by copying the tests to other projects, or by extracting out common validations to the Project class. That's out of scope.

CRMS::Entitlements (also 100% under test) was added because the CRMS.pm methods are gross wrappers around SQL-as-API and I wanted something not horrible for the SBCR.pm tests. The comments indicate this may be a temporary class name because CRMS::Rights is currently taken... but I have to confess Entitlements is growing on me.

The UNIQUE constraint on crms.rights.{attr/reason} has already been applied in production and htdev.

  - Add `Project` subclass and views for UI testing on dev-2
  - Still TODO:
    - Unit tests
    - Input validation
- Add parameter extraction of all fields in SBCR UI
- Review data format
- Extract out `partial/rights.tt` which should be reusable across all projects
…s/reasons/rights routines in CRMS.pm

with a more structured class that is not just a wrapper around SQL queries:
  - `TranslateAttr`
  - `TranslateReason`
  - `TranslateRights`
  - `AllCRMSRights`
  - `Rights`
  - `AllAssignableRights`
  - `GetAttrReasonFromCode`
  - `TranslateAttrReasonFromCode`
  - `GetCodeFromAttrReason`
  - `GetAttrReasonCode`

This class is fully tested. For now it will only be used in the SBCR module and its tests.
- SBCR module tests, first pass
…ts.pm`

- Eager load only when populating the singleton
@moseshll moseshll marked this pull request as ready for review October 29, 2025 18:10
@moseshll moseshll requested a review from aelkiss October 29, 2025 21:03
Copy link
Member

@aelkiss aelkiss left a comment

Choose a reason for hiding this comment

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

Generally the perl side is looking pretty good but I wonder if we might be able to clean up a bit in the templates.

  • individual tests are easy to follow, although I didn't read through each one in detail
  • SBCR.pm and Entitlements.pm look fine to me.
  • I don't know that we have another name for the combination of attr/reason that 'entitlement' represents other than "attribute/reason combination" -- as "rights" typically to me implies the combination of the item ID and the attribute & reason codes. 'entitlement' seems as reasonable as anything.
  • I had some comments on the templates; if they're copied from other existing things that might make it more involved to address the comments. If they're new for this project, maybe it's worth addressing now.

@moseshll moseshll requested a review from aelkiss November 3, 2025 19:45
Copy link
Member

@aelkiss aelkiss left a comment

Choose a reason for hiding this comment

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

Additional changes & reasons for not addressing other items now all make sense to me.

@moseshll moseshll merged commit e5a6d13 into main Nov 14, 2025
1 check passed
@moseshll moseshll deleted the ETT-752_sbcr_project branch November 14, 2025 17:32
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