test: exercise Subject permission management in Chromium

This commit is contained in:
2026-10-29 09:33:58 +09:00
parent 3600843683
commit 2141672310
11 changed files with 1241 additions and 11 deletions
@@ -167,16 +167,16 @@
<style>
.permissions { max-width: 72rem; min-width: 0; }
header { display: flex; flex-wrap: wrap; align-items: baseline; gap: .75rem; }
h2 { margin: 0; font-size: 1.2rem; } h3 { font-size: 1rem; margin: 0 0 .5rem; } h4 { margin: 1rem 0 .4rem; }
p { line-height: 1.55; color: var(--text-muted); } .state { font-size: .8rem; }
h2 { margin: 0; font-size: var(--font-size-body); } h3 { font-size: var(--font-size-body); margin: 0 0 .5rem; } h4 { margin: 1rem 0 .4rem; }
p { line-height: 1.55; color: var(--text-muted); } .state { font-size: var(--font-size-compact); }
.lanes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; margin: 1.5rem 0; }
.lane { min-width: 0; border-top: 1px solid var(--line); padding-top: 1rem; }
ul { list-style: none; padding: 0; margin: .75rem 0; } li { display: flex; align-items: start; gap: .75rem; justify-content: space-between; padding: .75rem 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
li > div { min-width: 0; } .resource, .legacy { display: block; margin-top: .35rem; font-size: .85rem; } .legacy { color: var(--text-muted); }
li > div { min-width: 0; } li button { flex-shrink: 0; white-space: nowrap; } .resource, .legacy { display: block; margin-top: .35rem; font-size: var(--font-size-body); } .legacy { color: var(--text-muted); }
.permission-form, .diff { border-top: 1px solid var(--line); margin-top: 1.5rem; padding-top: 1rem; }
fieldset { border: 0; padding: 0; min-width: 0; display: grid; gap: .75rem; max-width: 38rem; }
label { display: grid; gap: .35rem; font-size: .875rem; } input, select { width: 100%; min-width: 0; padding: .55rem; border: 1px solid var(--line); border-radius: 3px; background: var(--bg); color: var(--text); font: inherit; }
button { background: transparent; color: var(--text); border: 1px solid var(--line); padding: .45rem .7rem; border-radius: 3px; cursor: pointer; font: inherit; font-size: .85rem; } button:disabled { opacity: .5; cursor: default; } button.save { background: var(--text); color: var(--bg); margin-top: .75rem; }
label { display: grid; gap: .35rem; font-size: var(--font-size-body); } input, select { width: 100%; min-width: 0; padding: .55rem; border: 1px solid var(--line); border-radius: 3px; background: var(--bg); color: var(--text); font: inherit; }
button { background: transparent; color: var(--text); border: 1px solid var(--line); padding: .45rem .7rem; border-radius: 3px; cursor: pointer; font: inherit; font-size: var(--font-size-body); } button:disabled { opacity: .5; cursor: default; } button.save { background: var(--text); color: var(--bg); margin-top: .75rem; }
.check { display: flex; align-items: start; gap: .5rem; } .check input { width: auto; margin-top: .2rem; } .reload { margin: 1rem 0; }
.attention { border-left: 3px solid var(--text-muted); padding: .7rem 1rem; overflow-wrap: anywhere; } .help { margin: 1.5rem 0; } summary { cursor: pointer; } code { overflow-wrap: anywhere; }
@media (max-width: 900px) { .lanes { grid-template-columns: 1fr; gap: 1rem; } }
@@ -13,4 +13,4 @@
{#key JSON.stringify([data.workspaceId, data.subjectId])}<SubjectPermissions workspaceId={data.workspaceId} subjectId={data.subjectId} />{/key}
{:else}<p role="alert">Target unavailable. {data.subject.error} An old page cannot recreate a deleted Subject.</p>{/if}
</section>
<style>.permission-page { padding: 1.5rem; min-width: 0; } h1 { font-size: 1.5rem; margin: 1rem 0 1.5rem; overflow-wrap: anywhere; } @media (max-width: 600px) { .permission-page { padding: 1rem; } }</style>
<style>.permission-page { padding: 1.5rem; min-width: 0; } h1 { font-size: var(--font-size-title); margin: 1rem 0 1.5rem; overflow-wrap: anywhere; } @media (max-width: 600px) { .permission-page { padding: 1rem; } }</style>
@@ -44,6 +44,7 @@ function subject() {
function subjectIndexData(items = [subject()]) {
return {
workspace: { permissions: { delete_subjects: false } },
workspaceId: "workspace-1",
cursor: null,
subjects: result({
@@ -57,6 +58,7 @@ function subjectIndexData(items = [subject()]) {
test("renders the subject index as the Memory product entry", () => {
render(SubjectIndexPage, {
data: {
workspace: { permissions: { delete_subjects: false } },
workspaceId: "workspace-1",
cursor: "subject-current",
subjects: result({
@@ -239,6 +241,7 @@ test("warns about an unknown create outcome without replaying the POST", async (
test("renders a ready resident surface and committed Memory lifecycle states", async () => {
render(SubjectPage, {
data: {
workspace: { permissions: { delete_subjects: false } },
workspaceId: "workspace-1",
subjectId: "subject-1",
cursor: "memory-current",
@@ -333,6 +336,7 @@ test("edits and clears user-managed behavior with CAS while distinguishing save
vi.stubGlobal("fetch", fetchMock);
render(SubjectPage, {
data: {
workspace: { permissions: { delete_subjects: false } },
workspaceId: "workspace-1",
subjectId: "subject-1",
subject: result(subject()),
@@ -386,6 +390,7 @@ test("edits and clears user-managed behavior with CAS while distinguishing save
function subjectPageData(record = subject(), workspaceId = "workspace-1") {
return {
workspace: { permissions: { delete_subjects: false } },
workspaceId,
subjectId: record.id,
subject: result(record),
@@ -663,6 +668,7 @@ test("candidate-only Subjects show no committed Memories, not an inferred candid
// the same empty committed list as a new Subject; candidates are not a page input.
render(SubjectPage, {
data: {
workspace: { permissions: { delete_subjects: false } },
workspaceId: "workspace-1",
subjectId: "subject-1",
cursor: null,
@@ -746,6 +752,7 @@ test.each(["ready", "ungenerated", "stale", "failed"] as const)(
test("distinguishes ready-empty, stale, failed, unavailable, and request error surfaces", async () => {
const base = {
workspace: { permissions: { delete_subjects: false } },
workspaceId: "workspace-1",
subjectId: "subject-1",
subject: result(subject()),
@@ -831,6 +838,7 @@ test("distinguishes ready-empty, stale, failed, unavailable, and request error s
test("renders committed Memory detail, provenance, derivation, and immutable changes", async () => {
render(MemoryDetailPage, {
data: {
workspace: { permissions: { delete_subjects: false } },
workspaceId: "workspace-1",
subjectId: "subject-1",
memoryId: "memory-1",