SDSM:Historical Changes: Difference between revisions

From SMUSwiki
Jump to navigation Jump to search
No edit summary
(Add sub-sections on dependency changes; prior edit added section on consolidate model classes)
Line 34: Line 34:
Preferences screen. In preview, the revealed underlying symptom was that
Preferences screen. In preview, the revealed underlying symptom was that
the code line in <code>PreferencesController</code> of
the code line in <code>PreferencesController</code> of
<code>$addresses = $user->guardian->addresses;</code> was dying with <code>Attempt to read property addresses on null</code>. The problem occurred for user <code>darren.duncan</code> but not for other users.
<code>$addresses = $user->guardian->addresses;</code> was dying with
<code>Attempt to read property addresses on null</code>. The problem
occurred for user <code>darren.duncan</code> but not for other users.


'''Expected Behavior:''' The User Preferences screen should always display,
'''Expected Behavior:''' The User Preferences screen should always display,
Line 82: Line 84:
referred to in other code, such that any which weren't referred to by their
referred to in other code, such that any which weren't referred to by their
fully-qualified names before were referred to in that way after.
fully-qualified names before were referred to in that way after.
[[#top|RETURN]]
== SDS Laravel: Changes to Third-Party Dependencies ==
=== 2024 May 3: Stop requiring dbal, revisionable-upgrade, laravel-cors ===
Prior to the performance of this task, the ''SDS Laravel'' Composer config
file <code>composer.json</code> explicitly required these 3 third-party
PHP library dependencies, which were not actually used by the app:
* doctrine/dbal (^3.5)
* fico7489/laravel-revisionable-upgrade (*)
* fruitcake/laravel-cors (^2.0)
This task updated <code>composer.json</code> to remove those unused
explicit dependencies, which also had the effect of removing 6 other
Composer-resolved dependencies.
[[#top|RETURN]]
=== 2024 May 6: Reflect rename of fzaninotto to fakerphp ===
This task updated <code>composer.json</code> to reflect that the
third-party PHP library dependency <code>fzaninotto/faker</code> was
renamed to <code>fakerphp/faker</code> (in fact, that rename occurred prior
to the release of Laravel 8), and also require its latest version.
[[#top|RETURN]]
=== 2024 May 6: Upgrade PHPUnit from 9.x to 10.x ===
This task updated <code>composer.json</code> to require the next/newest
major version of the PHP dev dependency PHPUnit from <code>9.6.19</code> to
<code>10.5.20</code>.


[[#top|RETURN]]
[[#top|RETURN]]

Revision as of 16:58, 9 May 2024


This document consists of multiple parts; for a directory to all of the parts, see SDSM:Index.

Description

This part of the SDS Modernization (SDSM) document enumerates a not necessarily exhaustive list of historical changes or improvements that were made to SDS, made by Darren Duncan if by whom is not otherwise specified.

It exists to provide visibility into historical progress of the SDS Modernization (SDSM) project about which this document otherwise mainly just describes the current state of SDS.

This list often but not always corresponds to the list of Git pull requests at https://git.smus.ca which most readers of this document are not privileged to see directly.

RETURN

SDS Laravel: Fixes to Broken Behavior

2024 Apr 18: User Preferences Screen Fails to Display

Context: User darren.duncan attempted to visit their User Preferences screen, example urls https://api.smus.ca/User/Preferences (production) and https://api-latest.smus.ca/User/Preferences (preview).

Observed Behavior: In production, a non-graceful generic 500 internal server error message was displayed rather than the expected User Preferences screen. In preview, the revealed underlying symptom was that the code line in PreferencesController of $addresses = $user->guardian->addresses; was dying with Attempt to read property addresses on null. The problem occurred for user darren.duncan but not for other users.

Expected Behavior: The User Preferences screen should always display, regardless of whether the user in question is a guardian or has guardians. If some functionality of the screen is not applicable for users that aren't or don't have guardians, the screen should either hide that functionality or explain why it doesn't apply or both.

Applied Solution: The dying code line was replaced with code that only tried to fetch and return an address list when it was valid to do so, and it returned an empty list otherwise. As a result, the User Preferences screen never failed to display under this scenario.

Caveat: While the User Preferences screen no longer fails to display, as of the completion of this fix, it still remained true that the functionality to actually display the fetched address list in question was never implemented, and so for every user, the screen carried the placeholder message Shows address info instead of each individual address.

RETURN

SDS Laravel: Internal Design Changes

2024 Apr 19: Consolidate Eloquent model classes to /app/Models

An idiomatic PHP Laravel project has its main files grouped into the specific hierarchy of folders documented here:

https://laravel.com/docs/11.x/structure

Of particular relevance, the folder /app/Models is where all of the Laravel Eloquent model classes go.

Prior to the performance of this task, SDS Laravel conformed to the idiomatic folder layout in all ways except with respect to the Eloquent model classes, which it had instead spread across about a dozen /app/FooModel folders.

This task moved/renamed all of the Eloquent model classes, such that for each class /app/FooModel/Bar.php, it was moved/renamed to /app/Models/Foo/Bar.php. While that described nearly all of those classes, a handful started with other names, but they were appropriately gathered under /app/Models too.

This task also included a normalization of how first-party classes were referred to in other code, such that any which weren't referred to by their fully-qualified names before were referred to in that way after.

RETURN

SDS Laravel: Changes to Third-Party Dependencies

2024 May 3: Stop requiring dbal, revisionable-upgrade, laravel-cors

Prior to the performance of this task, the SDS Laravel Composer config file composer.json explicitly required these 3 third-party PHP library dependencies, which were not actually used by the app:

  • doctrine/dbal (^3.5)
  • fico7489/laravel-revisionable-upgrade (*)
  • fruitcake/laravel-cors (^2.0)

This task updated composer.json to remove those unused explicit dependencies, which also had the effect of removing 6 other Composer-resolved dependencies.

RETURN

2024 May 6: Reflect rename of fzaninotto to fakerphp

This task updated composer.json to reflect that the third-party PHP library dependency fzaninotto/faker was renamed to fakerphp/faker (in fact, that rename occurred prior to the release of Laravel 8), and also require its latest version.

RETURN

2024 May 6: Upgrade PHPUnit from 9.x to 10.x

This task updated composer.json to require the next/newest major version of the PHP dev dependency PHPUnit from 9.6.19 to 10.5.20.

RETURN