diff --git a/Docs/Sprints/2026-11-03-overnight.md b/Docs/Sprints/2026-11-03-overnight.md index 6e532abd..53a3bc20 100644 --- a/Docs/Sprints/2026-11-03-overnight.md +++ b/Docs/Sprints/2026-11-03-overnight.md @@ -16,8 +16,8 @@ 1. Completed: B1 ribbon order and regression coverage. 2. Completed: B2 compact Locations drag controls and PWA width. 3. Completed: B3 clickable project/book covers and titles. -4. In progress: B4 investigate and retire obsolete Phase 1 Checklist safely. -5. C shared workspace resizing and maximisation, starting with Relationships reference. +4. Completed: B4 retire obsolete Phase 1 Checklist safely. +5. In progress: C shared workspace resizing and maximisation, starting with Relationships reference. 6. D UX audit and repairs. 7. E functional reliability repairs. 8. F security and data integrity audit and safe repairs. @@ -52,3 +52,11 @@ B1 commit: 7f19319. Linked active project cover stacks and missing-cover initials to the same Projects/Details route as Open. Linked Project Overview book covers (including the default placeholder) to the existing Books/Details route. Existing titles already use those routes. Edit, Archive and More remain independent siblings. Added pointer, hover and visible keyboard focus treatment. Verification: solution build passed; rendered Razor browser regression passed for real covers, missing covers, title/Open route equality, keyboard activation and focus in browser/PWA modes. Added isolated Projects listing data to the existing browser host. B2 full harness rerun passed (exit 0). B2 commit: d6be496. + +### B4 — Retired Phase 1 Checklist + +Confirmed the only application caller of the legacy aggregate report was Acceptance/Phase1. Removed its overview command, view, exclusive service, repository, model/view model and DI registrations. Kept the authenticated legacy action as a redirect to Projects/Details (or Projects/Index without a positive ID), so standard project authorisation handles bookmarks. Historical SQL migration and database objects remain unchanged; no tables or data removed. + +Security finding fixed by retirement: the old service forwarded a supplied project ID even when absent from the user's project list; its procedure aggregates by project without a user parameter. No live cross-user query was performed. + +Verification: build passed (0 warnings/errors), full harness passed including bookmark routing/authentication regression. B3 commit: 77332a2. Initial new-test build failed because a top-level harness helper shadows Attribute; corrected to System.Attribute and reran successfully. diff --git a/PlotLine.Tests/LegacyAcceptanceTests.cs b/PlotLine.Tests/LegacyAcceptanceTests.cs new file mode 100644 index 00000000..5e70776f --- /dev/null +++ b/PlotLine.Tests/LegacyAcceptanceTests.cs @@ -0,0 +1,22 @@ +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using PlotLine.Controllers; + +internal static class LegacyAcceptanceTests +{ + public static void RedirectsWithoutReporting() + { + if (!System.Attribute.IsDefined(typeof(AcceptanceController), typeof(AuthorizeAttribute))) + throw new Exception("Legacy bookmarks must still require authentication."); + var controller = new AcceptanceController(); + foreach (int? projectId in new int?[] { null, 0, -1, 7, int.MaxValue }) + { + var result = controller.Phase1(projectId) as RedirectToActionResult + ?? throw new Exception("Legacy checklist must redirect rather than query reports."); + if (result.ControllerName != "Projects" || result.ActionName != (projectId is > 0 ? "Details" : "Index")) + throw new Exception("Legacy checklist should use the standard project routes and their access controls."); + if (projectId is > 0 && !Equals(result.RouteValues?["id"], projectId)) + throw new Exception("Legacy bookmark must preserve project identity."); + } + } +} diff --git a/PlotLine.Tests/Program.cs b/PlotLine.Tests/Program.cs index 17811599..31015621 100644 --- a/PlotLine.Tests/Program.cs +++ b/PlotLine.Tests/Program.cs @@ -123,6 +123,7 @@ var tests = new (string Name, Action Test)[] ("Writing Solver anonymous state is protected, expires and rejects stale versions", WritingSolverTests.AnonymousState), ("Writing Solver scoring, multi-select, revision, fallback and graph routes", WritingSolverTests.RoutingAndRevision), ("Writing Solver import rejects invalid graphs and editorial identities", WritingSolverTests.Validation), + ("Retired checklist bookmarks redirect without report access", LegacyAcceptanceTests.RedirectsWithoutReporting), ("Ribbon operation identity and semantic icons stay consistent", RibbonPresentationTests.SemanticMetadata), ("Maps Story projects canonical hierarchy, sequence, journeys and evidence without changing geography", MapStoryTests.ProjectionAndEvidence), ("Maps Story scales to 500 scenes and 5,000 appearances", MapStoryTests.Scale), diff --git a/PlotLine/Controllers/AcceptanceController.cs b/PlotLine/Controllers/AcceptanceController.cs index 86db7324..7fabc9aa 100644 --- a/PlotLine/Controllers/AcceptanceController.cs +++ b/PlotLine/Controllers/AcceptanceController.cs @@ -1,14 +1,13 @@ -using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Authorization; -using PlotLine.Services; +using Microsoft.AspNetCore.Mvc; namespace PlotLine.Controllers; +// Keep old bookmarks useful without exposing the retired development report. [Authorize] -public sealed class AcceptanceController(IAcceptanceService acceptance) : Controller +public sealed class AcceptanceController : Controller { - public async Task Phase1(int? projectId) - { - return View(await acceptance.GetPhase1ChecklistAsync(projectId)); - } + public IActionResult Phase1(int? projectId) => projectId is > 0 + ? RedirectToAction("Details", "Projects", new { id = projectId.Value }) + : RedirectToAction("Index", "Projects"); } diff --git a/PlotLine/Data/Repositories.cs b/PlotLine/Data/Repositories.cs index 11461b2c..f8c2fc24 100644 --- a/PlotLine/Data/Repositories.cs +++ b/PlotLine/Data/Repositories.cs @@ -457,11 +457,6 @@ public interface IArchiveRepository Task DeleteForeverAsync(string entityType, int entityId, string confirmationText, int userId); } -public interface IAcceptanceRepository -{ - Task> GetPhase1ChecklistAsync(int? projectId); -} - public sealed class TimelineData { public Project? Project { get; init; } @@ -1952,19 +1947,6 @@ public sealed class ArchiveRepository(ISqlConnectionFactory connectionFactory) : } } -public sealed class AcceptanceRepository(ISqlConnectionFactory connectionFactory) : IAcceptanceRepository -{ - public async Task> GetPhase1ChecklistAsync(int? projectId) - { - using var connection = connectionFactory.CreateConnection(); - var rows = await connection.QueryAsync( - "dbo.Acceptance_Phase1Checklist", - new { ProjectID = projectId }, - commandType: CommandType.StoredProcedure); - return rows.ToList(); - } -} - public sealed class SceneDependencyRepository(ISqlConnectionFactory connectionFactory) : ISceneDependencyRepository { public async Task GetLookupsAsync() diff --git a/PlotLine/Models/CoreModels.cs b/PlotLine/Models/CoreModels.cs index 5ed9a6b6..ca0adfef 100644 --- a/PlotLine/Models/CoreModels.cs +++ b/PlotLine/Models/CoreModels.cs @@ -2632,15 +2632,6 @@ public sealed class ArchiveDeleteResult public string Message { get; set; } = string.Empty; } -public sealed class Phase1AcceptanceChecklistItem -{ - public string AreaName { get; set; } = string.Empty; - public string CheckName { get; set; } = string.Empty; - public string Status { get; set; } = string.Empty; - public string Detail { get; set; } = string.Empty; - public int SortOrder { get; set; } -} - public sealed class AnalyticsBusyScene { public int SceneID { get; set; } diff --git a/PlotLine/Program.cs b/PlotLine/Program.cs index 3282100e..dbdb9560 100644 --- a/PlotLine/Program.cs +++ b/PlotLine/Program.cs @@ -158,7 +158,6 @@ public class Program builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); - builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); @@ -219,7 +218,6 @@ public class Program builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); - builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddSingleton(); diff --git a/PlotLine/Services/CoreServices.cs b/PlotLine/Services/CoreServices.cs index c393a7eb..5a020321 100644 --- a/PlotLine/Services/CoreServices.cs +++ b/PlotLine/Services/CoreServices.cs @@ -671,11 +671,6 @@ public interface IArchiveService Task DeleteForeverAsync(string entityType, int entityId, string confirmationText); } -public interface IAcceptanceService -{ - Task GetPhase1ChecklistAsync(int? projectId); -} - public sealed class ProjectService( IProjectRepository projects, IBookRepository books, @@ -7798,31 +7793,6 @@ public sealed class ArchiveService( } } -public sealed class AcceptanceService(IProjectRepository projects, IAcceptanceRepository acceptance, ICurrentUserService currentUser) : IAcceptanceService -{ - public async Task GetPhase1ChecklistAsync(int? projectId) - { - var projectRows = currentUser.UserId.HasValue - ? await projects.ListForUserAsync(currentUser.UserId.Value) - : Array.Empty(); - var selectedProject = projectId.HasValue - ? projectRows.FirstOrDefault(x => x.ProjectID == projectId.Value) - : projectRows.FirstOrDefault(); - var effectiveProjectId = projectId ?? selectedProject?.ProjectID; - - return new Phase1AcceptanceViewModel - { - ProjectID = effectiveProjectId, - ProjectName = selectedProject?.ProjectName, - ProjectOptions = projectRows.Select(project => new SelectListItem( - project.ProjectName, - project.ProjectID.ToString(), - project.ProjectID == effectiveProjectId)).ToList(), - Items = await acceptance.GetPhase1ChecklistAsync(effectiveProjectId) - }; - } -} - public sealed class StorageService( IBookRepository books, IChapterRepository chapters, diff --git a/PlotLine/ViewModels/CoreViewModels.cs b/PlotLine/ViewModels/CoreViewModels.cs index 68387a88..662b534b 100644 --- a/PlotLine/ViewModels/CoreViewModels.cs +++ b/PlotLine/ViewModels/CoreViewModels.cs @@ -1199,17 +1199,6 @@ public sealed class ArchivedItemsViewModel public IReadOnlyList Items { get; set; } = []; } -public sealed class Phase1AcceptanceViewModel -{ - public int? ProjectID { get; set; } - public string? ProjectName { get; set; } - public IReadOnlyList ProjectOptions { get; set; } = []; - public IReadOnlyList Items { get; set; } = []; - public int PassCount => Items.Count(x => x.Status == "Pass"); - public int ReviewCount => Items.Count(x => x.Status == "Review"); - public int BlockedCount => Items.Count(x => x.Status == "Blocked"); -} - public sealed class TimelineViewModel { public Project Project { get; set; } = new(); diff --git a/PlotLine/Views/Acceptance/Phase1.cshtml b/PlotLine/Views/Acceptance/Phase1.cshtml deleted file mode 100644 index 38e1339b..00000000 --- a/PlotLine/Views/Acceptance/Phase1.cshtml +++ /dev/null @@ -1,89 +0,0 @@ -@model Phase1AcceptanceViewModel -@{ - ViewData["Title"] = "Phase 1 Acceptance Checklist"; - ViewData["ProjectSection"] = "Overview"; - var projectNavigation = Model.ProjectID.HasValue - ? new Project { ProjectID = Model.ProjectID.Value, ProjectName = Model.ProjectName ?? "Project" } - : null; -} - - - -@if (projectNavigation is not null) -{ - -} - -
-
-

Phase 1U

-

Phase 1 Acceptance Checklist

-

A compact stability report for timeline, CRUD, archive, warnings, writer workflow, exports, and scenario readiness.

-
-
- - -
-
- -
-
- Pass - @Model.PassCount -
-
- Needs review - @Model.ReviewCount -
-
- Blocked - @Model.BlockedCount -
-
- -
-
-
-

Acceptance

-

Workflow Checks

-
- @Model.Items.Count check@(Model.Items.Count == 1 ? "" : "s") -
- - @if (!Model.Items.Any()) - { -

No checklist data is available yet. Create a project to begin the Phase 1 acceptance pass.

- } - else - { -
- @foreach (var group in Model.Items.GroupBy(x => x.AreaName)) - { -
-

@group.Key

-
- @foreach (var item in group.OrderBy(x => x.SortOrder)) - { -
- @item.Status -
- @item.CheckName -

@item.Detail

-
-
- } -
-
- } -
- } -
diff --git a/PlotLine/Views/Projects/Details.cshtml b/PlotLine/Views/Projects/Details.cshtml index af767c65..a8183e34 100644 --- a/PlotLine/Views/Projects/Details.cshtml +++ b/PlotLine/Views/Projects/Details.cshtml @@ -56,7 +56,6 @@ Download Project Backup } Restore Points - Phase 1 Checklist @if (Model.Project.IsOwner) {