Retire obsolete acceptance report and redirect legacy bookmarks

This commit is contained in:
Nick Beckley 2026-11-03 20:29:58 +00:00
parent 77332a25ab
commit a348777b28
11 changed files with 39 additions and 169 deletions

View File

@ -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.

View File

@ -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.");
}
}
}

View File

@ -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),

View File

@ -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<IActionResult> 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");
}

View File

@ -457,11 +457,6 @@ public interface IArchiveRepository
Task<ArchiveDeleteResult> DeleteForeverAsync(string entityType, int entityId, string confirmationText, int userId);
}
public interface IAcceptanceRepository
{
Task<IReadOnlyList<Phase1AcceptanceChecklistItem>> 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<IReadOnlyList<Phase1AcceptanceChecklistItem>> GetPhase1ChecklistAsync(int? projectId)
{
using var connection = connectionFactory.CreateConnection();
var rows = await connection.QueryAsync<Phase1AcceptanceChecklistItem>(
"dbo.Acceptance_Phase1Checklist",
new { ProjectID = projectId },
commandType: CommandType.StoredProcedure);
return rows.ToList();
}
}
public sealed class SceneDependencyRepository(ISqlConnectionFactory connectionFactory) : ISceneDependencyRepository
{
public async Task<SceneDependencyLookupData> GetLookupsAsync()

View File

@ -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; }

View File

@ -158,7 +158,6 @@ public class Program
builder.Services.AddScoped<IDynamicsRepository, DynamicsRepository>();
builder.Services.AddScoped<IScenarioRepository, ScenarioRepository>();
builder.Services.AddScoped<IArchiveRepository, ArchiveRepository>();
builder.Services.AddScoped<IAcceptanceRepository, AcceptanceRepository>();
builder.Services.AddScoped<IImportRepository, ImportRepository>();
builder.Services.AddScoped<IWordCompanionRepository, WordCompanionRepository>();
builder.Services.AddScoped<IOnboardingRepository, OnboardingRepository>();
@ -219,7 +218,6 @@ public class Program
builder.Services.AddScoped<IDynamicsService, DynamicsService>();
builder.Services.AddScoped<IScenarioService, ScenarioService>();
builder.Services.AddScoped<IArchiveService, ArchiveService>();
builder.Services.AddScoped<IAcceptanceService, AcceptanceService>();
builder.Services.AddScoped<IImportService, ImportService>();
builder.Services.AddScoped<IWordCompanionService, WordCompanionService>();
builder.Services.AddSingleton<IWordCompanionPresenceService, WordCompanionPresenceService>();

View File

@ -671,11 +671,6 @@ public interface IArchiveService
Task<ArchiveDeleteResult> DeleteForeverAsync(string entityType, int entityId, string confirmationText);
}
public interface IAcceptanceService
{
Task<Phase1AcceptanceViewModel> 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<Phase1AcceptanceViewModel> GetPhase1ChecklistAsync(int? projectId)
{
var projectRows = currentUser.UserId.HasValue
? await projects.ListForUserAsync(currentUser.UserId.Value)
: Array.Empty<Project>();
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,

View File

@ -1199,17 +1199,6 @@ public sealed class ArchivedItemsViewModel
public IReadOnlyList<ArchivedItem> Items { get; set; } = [];
}
public sealed class Phase1AcceptanceViewModel
{
public int? ProjectID { get; set; }
public string? ProjectName { get; set; }
public IReadOnlyList<SelectListItem> ProjectOptions { get; set; } = [];
public IReadOnlyList<Phase1AcceptanceChecklistItem> 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();

View File

@ -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;
}
<nav data-pwa-identity class="breadcrumb-trail" aria-label="Breadcrumb">
<a asp-controller="Projects" asp-action="Index">Projects</a>
@if (Model.ProjectID.HasValue)
{
<a asp-controller="Projects" asp-action="Details" asp-route-id="@Model.ProjectID">@Model.ProjectName</a>
}
<span>Phase 1 Acceptance Checklist</span>
</nav>
@if (projectNavigation is not null)
{
<partial name="_ProjectSectionNav" model="projectNavigation" />
}
<div data-pwa-header class="page-heading">
<div>
<p class="eyebrow">Phase 1U</p>
<h1>Phase 1 Acceptance Checklist</h1>
<p class="lead-text">A compact stability report for timeline, CRUD, archive, warnings, writer workflow, exports, and scenario readiness.</p>
</div>
<form method="get" class="timeline-filter">
<select class="form-select" name="projectId" asp-items="Model.ProjectOptions">
<option value="">First active project</option>
</select>
<button class="btn btn-outline-primary" type="submit">View report</button>
</form>
</div>
<section class="acceptance-summary-grid">
<article class="plain-card acceptance-summary pass">
<span class="eyebrow">Pass</span>
<strong>@Model.PassCount</strong>
</article>
<article class="plain-card acceptance-summary review">
<span class="eyebrow">Needs review</span>
<strong>@Model.ReviewCount</strong>
</article>
<article class="plain-card acceptance-summary blocked">
<span class="eyebrow">Blocked</span>
<strong>@Model.BlockedCount</strong>
</article>
</section>
<section class="story-bible-section">
<div class="story-bible-section-heading">
<div>
<p class="eyebrow">Acceptance</p>
<h2>Workflow Checks</h2>
</div>
<span class="soft-count">@Model.Items.Count check@(Model.Items.Count == 1 ? "" : "s")</span>
</div>
@if (!Model.Items.Any())
{
<p class="muted">No checklist data is available yet. Create a project to begin the Phase 1 acceptance pass.</p>
}
else
{
<div class="acceptance-check-list">
@foreach (var group in Model.Items.GroupBy(x => x.AreaName))
{
<article class="acceptance-area">
<h3>@group.Key</h3>
<div class="acceptance-check-items">
@foreach (var item in group.OrderBy(x => x.SortOrder))
{
<div class="acceptance-check-item @item.Status.ToLowerInvariant()">
<span class="acceptance-status">@item.Status</span>
<div>
<strong>@item.CheckName</strong>
<p>@item.Detail</p>
</div>
</div>
}
</div>
</article>
}
</div>
}
</section>

View File

@ -56,7 +56,6 @@
<a class="dropdown-item" asp-controller="Exports" asp-action="ProjectBackup" asp-route-projectId="@Model.Project.ProjectID">Download Project Backup</a>
}
<a class="dropdown-item" asp-controller="ProjectRestorePoints" asp-action="Index" asp-route-projectId="@Model.Project.ProjectID">Restore Points</a>
<a class="dropdown-item" asp-controller="Acceptance" asp-action="Phase1" asp-route-projectId="@Model.Project.ProjectID">Phase 1 Checklist</a>
@if (Model.Project.IsOwner)
{
<div class="dropdown-divider"></div>