create(['name' => 'Spec350 Detail Blocked']); [$owner, $tenant] = createUserWithTenant(tenant: $tenant, role: 'owner'); $snapshot = seedPartialEnvironmentReviewEvidence($tenant, findingCount: 0, driftCount: 0); $review = composeEnvironmentReviewForTest($tenant, $owner, $snapshot); $summary = array_replace_recursive(is_array($review->summary) ? $review->summary : [], [ 'publish_blockers' => ['Operator approval note is still missing.'], ]); $review->forceFill([ 'status' => EnvironmentReviewStatus::Published->value, 'published_at' => now(), 'published_by_user_id' => (int) $owner->getKey(), 'summary' => $summary, ])->save(); Storage::disk('exports')->put('review-packs/spec350-detail-blocked.zip', 'PK-spec350-detail-blocked'); $pack = ReviewPack::factory()->ready()->create([ 'managed_environment_id' => (int) $tenant->getKey(), 'workspace_id' => (int) $tenant->workspace_id, 'environment_review_id' => (int) $review->getKey(), 'evidence_snapshot_id' => (int) $snapshot->getKey(), 'initiated_by_user_id' => (int) $owner->getKey(), 'options' => [ 'include_pii' => false, 'include_operations' => true, ], 'file_path' => 'review-packs/spec350-detail-blocked.zip', 'file_disk' => 'exports', 'generated_at' => now()->subMinutes(3), ]); $review->forceFill(['current_export_review_pack_id' => (int) $pack->getKey()])->save(); setAdminEnvironmentContext($tenant); $this->actingAs($owner); $state = EnvironmentReviewResource::outputGuidanceState($review->fresh(['tenant', 'evidenceSnapshot', 'currentExportReviewPack.operationRun', 'operationRun'])); expect(data_get($state, 'resolution_case.key'))->toBe('review_output.publication_blocked') ->and(data_get($state, 'resolution_case.primary_action.key'))->toBe('create_next_review') ->and(data_get($state, 'resolution_case.primary_action.action_name'))->toBe('create_next_review') ->and(data_get($state, 'resolution_case.source_refs'))->toContainEqual(['type' => 'environment_review', 'id' => (int) $review->getKey()]) ->and(data_get($state, 'resolution_case.source_refs'))->toContainEqual(['type' => 'review_pack', 'id' => (int) $pack->getKey()]) ->and(data_get($state, 'resolution_case.evidence_refs'))->toHaveCount(1); $this->actingAs($owner) ->get(EnvironmentReviewResource::environmentScopedUrl('view', ['record' => $review], $tenant)) ->assertOk() ->assertSee('Output not customer-ready') ->assertSee('Create next review'); }); it('keeps the customer-workspace detail mode action suppression while retaining the shared case payload', function (): void { $tenant = ManagedEnvironment::factory()->create(['name' => 'Spec350 Detail Context']); [$owner, $tenant] = createUserWithTenant(tenant: $tenant, role: 'owner'); $snapshot = seedPartialEnvironmentReviewEvidence($tenant, findingCount: 0, driftCount: 0); $review = composeEnvironmentReviewForTest($tenant, $owner, $snapshot); $summary = array_replace_recursive(is_array($review->summary) ? $review->summary : [], [ 'publish_blockers' => ['Operator approval note is still missing.'], ]); $review->forceFill([ 'status' => EnvironmentReviewStatus::Published->value, 'published_at' => now(), 'published_by_user_id' => (int) $owner->getKey(), 'summary' => $summary, ])->save(); Storage::disk('exports')->put('review-packs/spec350-detail-context.zip', 'PK-spec350-detail-context'); $pack = ReviewPack::factory()->ready()->create([ 'managed_environment_id' => (int) $tenant->getKey(), 'workspace_id' => (int) $tenant->workspace_id, 'environment_review_id' => (int) $review->getKey(), 'evidence_snapshot_id' => (int) $snapshot->getKey(), 'initiated_by_user_id' => (int) $owner->getKey(), 'options' => [ 'include_pii' => false, 'include_operations' => true, ], 'file_path' => 'review-packs/spec350-detail-context.zip', 'file_disk' => 'exports', 'generated_at' => now()->subMinutes(3), ]); $review->forceFill(['current_export_review_pack_id' => (int) $pack->getKey()])->save(); setAdminEnvironmentContext($tenant); $this->actingAs($owner) ->get(EnvironmentReviewResource::environmentScopedUrl('view', [ 'record' => $review, CustomerReviewWorkspace::DETAIL_CONTEXT_QUERY_KEY => 1, ], $tenant)) ->assertOk() ->assertSee('Output not customer-ready') ->assertSee('Review limitations below') ->assertSee('You are already on the review detail for this output.') ->assertDontSee('Open evidence basis') ->assertDontSee('Open operation proof'); });