asterism branch T-2336/remove-article-mode commits 17 + review fixes files 190 touched lines 5362 insertions(+), 5462 deletions(-)

Pre-push review: T-2336/remove-article-mode

Articles mode removed in three commits: the mode, schema V16, archive 15/16. Rebased onto main at 36d874e9.

At a glance

  • A Site is untaught or taught; SiteMode.articles, its UI, its repository operations and the article work-type seed are gone.
  • Schema V16 = V15 minus exactly Site.junkSuffixRule; one lightweight stage, marker "16", V14 retired.
  • Archive 15/16: one field off the Site record; 14/15 backups no longer import.
  • A raw articles row is quarantined, hidden, refused on export, and does not block bootstrap.
  • Rebased over #82 with two conflicts; no removed symbol reintroduced; Today path read through for interaction.
  • Net -171 lines across 190 files.

Verdict

Ready to push, with recorded verification debt

No correctness finding survived four reviews; every fix applied here is residue or documentation. make test-ui-ipad passes on the rebased tree (30 tests). make test-quick passes on the final tree (Test Succeeded, Mac compile clean, no new warnings). make test-core passes everywhere except the three pending-capture suites, which fail on this host with 119 file-protection errors that reproduce on untouched commits. make test is red for six UI cases that fail on main itself. None of that is this branch's, but none of it has been seen green here either.

Review findings

15 raised · 12 fixed · 3 skipped

Jump to findings →

Tests

Pass rate: n/a

New tests: 22

Diff coverage: n/a

Jump to tests →

Commits

Three-level explanation

What changed

Asterism keeps a reading library: it remembers the pages you save and works out which story and chapter each one belongs to. For every website it knows, it used to be in one of three states: untaught (it has not been shown how the site's page titles work), taught (it has), or articles (a special setting meaning "every page here is a standalone article, don't look for chapters"). This change removes the third state. A site is now untaught or taught, and nothing else.

The removal goes all the way down: the buttons and dialogs that offered the setting, the code that behaved differently because of it, the one database column only that setting used, and the one field in backup files that carried that column.

Why it matters

Nobody was using articles mode, and it made many other parts of the app carry a third case they had to think about. Removing it makes the rest simpler. The one thing a user can notice: backup files saved by earlier versions can no longer be restored, because the backup format moved on. Take a fresh backup after updating.

Key concepts

  • Schema version: the shape of the database, numbered. Removing a column is a new number (V15 to V16), and the app has to convert an existing library carefully, like renovating a house while people live in it.
  • Frozen snapshot: a copy of the previous shape kept in the code so the app can still read an old library long enough to convert it.
  • Readiness marker: a small file that says "this library is at generation 16 and has been checked". It is a door sign: the share extension reads it before it opens anything.
  • Quarantine: if a site row somehow still says "articles", the app does not crash or guess. It sets that one site aside, reports it, and carries on.

Changes overview

Three feature commits, each compiling and green on its own, each followed by a review-fix commit:

  1. Remove the mode. Entry points first (SitesView, ComposedTeachingView and its view model, the share extension's CaptureView, the permitsArticlesConversion parameter threaded from PendingReteach to RuleSuggester), then Core: LibraryProviding.projectArticles/commitArticles, LibraryRepository+Articles.swift, ArticleTitlePlanning.swift, the contract types, SiteMode.articles with every arm over it, and the article work-type seed.
  2. Schema V16. AsterismSchemaV15 is frozen, V16 is V15 minus exactly Site.junkSuffixRule, the plan is [V15, V16] with one lightweight stage and no data pass, markers move to "15" lagging / "16" current, and AsterismSchemaV14 retires with every fixture that opened it.
  3. Archive 15/16. BackupV15* replaces BackupV14* outright; BackupV15Site loses one field; a 14/15 archive is refused by the version check before any payload decode; the golden is re-recorded; documents follow.

Implementation approach

Deletion in dependency order: callers, then the API, then the storage, then the wire. An unknown stored mode rides the project's existing ToleratedEnum policy: tolerant on read (defaults to untaught, raises a .siteTuple diagnosis, hidden from the sites list), strict on write (export refuses by hostname, field and raw value). The schema removal is pinned at the schema level: ModelContractTests compares every entity of V15 and V16 attribute by attribute (type, optionality, uniqueness, options) and relationship by relationship (destination, delete rule, inverse), so "minus exactly one column" is a falsifiable statement. The recorded-store test seeds a populated rule through the frozen snapshot and proves every other field of every row survives the stage.

Trade-offs

  • No conversion is built. The owner confirmed no articles Site exists on any device, so an import mapping or migration pass would be code with no input. The cost is that a stray row is quarantined with no in-app repair.
  • Old backups stop importing. Keeping a V14 importer beside V15 was rejected (Q12): the project deletes each predecessor outright so there is one codec to reason about.
  • Three commits, not one. The archive rename touches 55 Swift files and would drown the schema diff; between commits 2 and 3 one self-clearing withKnownIssue held the envelope-follows-schema test open.

Technical deep dive

V16 is the project's first removing bump since V9, and the first one where the removed column was on the wire. That inverts two things the procedure had assumed from a run of adding bumps. First, the live stored shape is a subset of the frozen one again, so a stale frozen registration answers a key the live schema lacks: the failure mode is an abort, not a quietly lost write, which is why LibraryRepository+BackupImportGates' Schema(versionedSchema:) was the first hit re-checked and why its comment was rewritten and not renumbered. Second, the removal needs neither a default nor a data pass, so the .markerLagging("15") arm is open, validate, publish, clear: one container, no reconciler, marker written only after validation, so a throw leaves "15" and re-entry over a converted store is a no-op.

The validator's Req 3.3 change is the one behavioural edge: .none now requires !intentionallyUnattached on both modes, where the articles arm had been the exception. .manual with no Work and the flag set stays valid. Capture and reparse no longer write the flag, and CaptureOutcome.intentionallyUnattached went with its last producer. Convergence is untouched: SiteUnionProjection elects between two modes from synced content only, and an unknown raw spelling on the survivor reads untaught.

Architecture impact

The capability ladder lost the one predicate that told m2_1 from m2_2; the gate stays because its raw value is persisted. JunkSuffixRule survives in ValueObjects.swift frozen by reference, its only consumer the V15 snapshot, and leaves when V15 retires. The archive's typed SiteMode is now pinned: an unnameable mode refuses the document on decode, and a stray junkSuffixRule key on a 15/16 Site fails the checksum like any unwritten key.

Potential issues

  • Mixed builds under mirroring. A V15 build left on a second device can still mint an articles Site and sync it in. Every device updates together; the quarantine is the backstop.
  • Rebase over #82. Four files changed on both sides. Only AppLibraryModel.swift conflicted textually; the Today path auto-merged and was read through for semantic interaction (none: #82's additions read no site mode, flag or display title).
  • Verification debt. make test is red for six UI cases main owns (two only on the week's first day). make test-core shows 119 file-protection issues in the pending-capture suites on this host, identical on untouched commits. Neither is this branch's, and neither has been seen green here.
  • The duplicate-resolution writers are now the only producers of a .none row with the flag set, and the path that used to promote such rows to .manual went with the mode.

Important changes — detailed

AsterismSchemaV16: V15 minus exactly one column

Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV16.swift

Why it matters. The persisted shape of every user library changes here. Any drift beyond the one column breaks the lightweight stage or silently mismatches on-disk stores.

What to look at. AsterismSchemaV16.swift (whole file), AsterismSchemaV15.swift (the freeze), AsterismV16MigrationPlan

Takeaway. A removing bump needs no default and no data pass, but it restores the subset relation between live and frozen schemas, which changes which failure a stale registration produces.
Rationale. Schema V16 drops the column only articles mode used; one lightweight stage, custom stages being forbidden because they would run inside the share extension (CLAUDE.md, Q14).

ModelContractTests: the delta pin compares stored shape, not names

Packages/AsterismCore/Tests/AsterismCoreTests/ModelContractTests.swift

Why it matters. This is what makes "nothing else moved" a tested claim. The first version compared property-name sets and passed a dropped attribute option.

What to look at. propertyShapes(of:in:), shapeDifferences(live:frozen:)

Takeaway. Schema.Attribute and Schema.Relationship expose enough (valueType, isOptional, isUnique, options; destination, deleteRule, inverseName) to pin a schema delta without reflection. Exclude a relationship's valueType: two versioned schemas nest different classes under one entity name.
Rationale. Review found the name-set version would pass a retype or a dropped .externalStorage; shown falsifiable by removing that option locally (Q25).

LibraryValidator: Req 3.3 tightened, dead sorts removed

Packages/AsterismCore/Sources/AsterismCore/LibraryValidator.swift

Why it matters. Correctness of what counts as a valid entry tuple, on a pass that runs at every open and every commit gate.

What to look at. validateAssignment (.none arm, ~1313); validate(hostnames:context:) ~238; validate(graph:) ~432

Takeaway. When a deletion removes the last reader of a value, check what was computing it: two content-ordered sorts survived only to answer "is there a row".
Rationale. A none assignment is invalid with intentionallyUnattached set on either mode (Q6); the sorts went in this review as free wins on the open path.

UnknownSiteModeTests: a raw articles row is quarantined, not fatal

Packages/AsterismCore/Tests/AsterismCoreTests/UnknownSiteModeTests.swift

Why it matters. This is the whole safety story for building no conversion: quarantine, hidden from the sites list, refused by name on export, and the bootstrap still publishes the marker.

What to look at. all four tests; note the bootstrap case seeds the lagging marker so the certifying arm really runs

Takeaway. A test that asserts a marker its own fixture wrote proves nothing. Seed the state before the transition you claim to test.
Rationale. Decision 1: no articles Site exists, so no conversion; Req 3.4 defines the behaviour if one turns up anyway. The only file allowed to spell the retired value (Req 7.2).

BackupV15Types: the wire loses one field, and mode stays typed

Packages/AsterismCore/Sources/AsterismCore/BackupV15Types.swift

Why it matters. User-visible: 14/15 backups stop importing. Any other accidental wire change would corrupt round-trips.

What to look at. BackupV15Site; supportedVersions; BackupV15ArchiveTests.siteWithAnUnknownModeRefuses

Takeaway. Fixtures that exist to reach a decode failure should take their envelope pair from the document constants, or the next generation move turns them into version refusals that prove nothing.
Rationale. Q12: replace the predecessor outright. Q29: the typed-mode refusal is half the argument for no import mapping, so it is pinned.

AppLibraryModel: the one real rebase conflict

Asterism/Asterism/ViewModels/AppLibraryModel.swift

Why it matters. PR #82 added repositoryEpoch directly above the two lines the archive commit renames. A wrong resolution drops #82's teardown guard.

What to look at. the backupRepository declaration and the property above it

Takeaway. After a rebase, grep the merged tree for the symbols your branch removed: auto-merged code that still uses them compiles on neither side's CI until someone builds.
Rationale. Both kept: #82's property and the V15 protocol name.

Key decisions

No conversion for articles Sites (Decision 1, Q10).

The owner confirmed no articles Site exists on any device and every device is past marker "15". A stray row is quarantined by the existing unknown-enum policy.

EntryTeachingDetail.displayTitle stays (Q19).

design.md listed it for removal with CaptureOutcome.displayTitle. It carries presentationTitle's affix trimming for the entry title card; removing it would regress a trimmed entry's heading.

The delta pin compares stored shape for every entity (Q25).

A removing bump moves Site; "nothing else moved" needs all seventeen entities and more than names.

The baseline dump format moves 12 to 13 (Q24).

A field leaving is a shape change by the fixture's own rule. Hand-edited, header written in the fixture and the serializer both.

The rename takes every generation-spelled name, the export filename included (Q28).

FrozenLibraryPathTests pins them, so a partial rename does not compile. Nothing parses the filename component.

The seven UI failures are not this branch's (Q34).

Run on main: four fail verbatim, one was fixed by #82 (cleared by the rebase; make test-ui-ipad now passes), two fail only on the week's first day. Whether Req 7.1 is waived for failures main owns is the owner's call.

Test-fixture consolidation is left alone.

The reuse review found duplicated test roots and marker helpers. They are refactors of test files, not defects, and the generation-to-generation fixture copy is the documented procedure.

Review findings

SeverityAreaFindingResolution
minorLibraryValidator.swift:238A full content-ordered sort of a hostname's Site rows ran only to test non-emptiness, on every commit gate.guard !rows.isEmpty
minorLibraryValidator.swift:432validate(graph:), which runs at open, built a map of winning rows that was only ever nil-tested, sorting every duplicated hostname's rows.A Set of hostnames; three call sites use contains.
minorLibraryRepository+TodayPresentation.swift:388The last switch over the two-case SiteMode kept a default: arm.Exhaustive over .untaught and .taught.
minorBackupV15Exporter.swift:453Export filename hand-spells "v15"; nothing pins it, so the next bump could ship a misnamed archive.Interpolates BackupV15Document.formatVersion.
minorAsterismCapabilities.swiftWith supportsArticles gone, gates m2_1 and m2_2 answer identically on every capability.Doc comment on m2_1 saying so; the gate stays because its raw value is persisted.
minorAppLibraryModel.swift:1676Doc comment still cites Reqs 6.2-6.4; 6.3 and 6.4 were the articles switch.(Req 6.2)
minorLibraryGraphBaselineTests.swift:757json(_:) helper dead since its one caller, the junkSuffixRule field, was deleted.Deleted.
nitMarkerGenerationSixteenTests.swift:33Temp directory prefix still MarkerFifteen-.MarkerSixteen-
majorimplementation.mdTwo commit SHAs cited five times were orphaned by the rebase; rebase described in the future tense; no post-rebase run recorded.SHAs remapped, an "After the rebase" section added with the runs on the rebased tree.
majordocs/agent-notes/schema-migration.md:349-392Five statements in the marker-fork paragraphs still described the V14 to V15 arm ("14" lagging, adding a column, eleven moves).Corrected to "15", removing a column, twelve moves.
majorCHANGELOG.md [Unreleased]Commit 1's entry said V16 "drops it next" and that UI suites were owed; commit 3's entry promised a re-export path that does not exist.Rewritten; the backup consequence now says plainly that a 14/15 file cannot be restored.
majordesign.md, tasks.md, requirements.md, OVERVIEW.mdDesign and task text still stated positions Q19, Q24 and Q34 overruled; Req 7.1 unannotated beside a Done status; overview detail section still Planned.Amended in place with pointers to the overruling decisions.
majorUnknownSiteModeTests / V15 marker suitesRoot fixtures duplicate the shared WriteFixture and each other; marker read/write and the retired-digit array are copied across five suites.Test-file refactor, out of scope for a pre-push fix; worth a ticket.
nitPendingReteach, CaptureOutcome.hasParsedTitle, LibraryValidator Q6 referencesOne-field wrapper and a one-field forwarder left by the removal; two differently-qualified "Q6" citations.Left: each still has a reader that uses it as a concept.
minorrelease-notes-0.7.0.mdThe in-app release note does not mention that older backup files stop importing. Outside Req 7.5, which names only CHANGELOG.md.Owner's call; suggested bullet is in the review report.

Tests

Source: local run at 2026-09-22T02:10:00+10:00 · snapshot c6034e88d9debf46e13b93aef5fc5342b6b314f1 (dirty working tree)

Baseline: none

Execution: failed · JUnit: none · Coverage: none · Baseline: absent

Coverage scope: as the project configures it

No test results

The test runner could not be detected.

New and removed tests

Derived by declaration name, from the diff (no baseline run).

Blast radius

Files that import a changed file on the left, changed files in the centre, files a changed file imports on the right. Snapshot working-tree against base 36d874e9.

Dependents none found Changed Dependencies none found . Asterism/Asterism …erism/Announcements/Documents Asterism/Asterism/Layout …erism/Asterism/RuleSuggestion Asterism/Asterism/ViewModels Asterism/Asterism/Views …terism/AsterismShareExtension Asterism/AsterismTests Asterism/AsterismTests/Helpers Asterism/AsterismUITests …rismCore/Sources/AsterismCore …urces/AsterismCore/Thumbnails …Core/Sources/ConstellationKit …mCore/Tests/AsterismCoreTests …ts/AsterismCoreTests/Fixtures docs docs/agent-notes specs specs/remove-article-mode specs/retire-migration-chain CHANGELOG.mdCHANGELOG.md CLAUDE.mdCLAUDE.md Asterism/Asterism/ContentView.swift…sm/Asterism/ContentView.swift Asterism/Asterism/Announcements/Documents/getting-started-mac.md…uments/getting-started-mac.md Asterism/Asterism/Announcements/Documents/getting-started.md…/Documents/getting-started.md Asterism/Asterism/Layout/AppNavigation.swift…sm/Layout/AppNavigation.swift Asterism/Asterism/Layout/SettingsScreen.swift…m/Layout/SettingsScreen.swift Asterism/Asterism/RuleSuggestion/RuleSuggester.swift…uggestion/RuleSuggester.swift Asterism/Asterism/RuleSuggestion/RuleSuggestionCoordinator.swift…leSuggestionCoordinator.swift Asterism/Asterism/ViewModels/AppLibraryModel.swift…wModels/AppLibraryModel.swift Asterism/Asterism/ViewModels/ComposedTeachingViewModel.swift…mposedTeachingViewModel.swift Asterism/Asterism/ViewModels/EntryDetailModel.swift…Models/EntryDetailModel.swift Asterism/Asterism/ViewModels/SettingsBackupModel.swift…els/SettingsBackupModel.swift Asterism/Asterism/ViewModels/SitesModels.swift…/ViewModels/SitesModels.swift Asterism/Asterism/ViewModels/WorkTypesModels.swift…wModels/WorkTypesModels.swift Asterism/Asterism/Views/ComposedTeachingView.swift…ws/ComposedTeachingView.swift Asterism/Asterism/Views/EntryDetailView.swift…m/Views/EntryDetailView.swift Asterism/Asterism/Views/SitesView.swift…sterism/Views/SitesView.swift Asterism/Asterism/Views/WorkTypesView.swift…ism/Views/WorkTypesView.swift Asterism/Asterism/Views/WorksView.swift…sterism/Views/WorksView.swift Asterism/AsterismShareExtension/CaptureView.swift…reExtension/CaptureView.swift Asterism/AsterismTests/AppNavigationTests.swift…ests/AppNavigationTests.swift Asterism/AsterismTests/BackupExportStageTests.swift…/BackupExportStageTests.swift Asterism/AsterismTests/ComposedTeachingViewModelTests.swift…dTeachingViewModelTests.swift Asterism/AsterismTests/EmptyLibraryModelTests.swift…/EmptyLibraryModelTests.swift Asterism/AsterismTests/EntryDetailModelTests.swift…s/EntryDetailModelTests.swift Asterism/AsterismTests/IntegrationSafetyNetTests.swift…tegrationSafetyNetTests.swift Asterism/AsterismTests/RuleSuggesterTests.swift…ests/RuleSuggesterTests.swift Asterism/AsterismTests/RuleSuggestionCoordinatorTests.swift…gestionCoordinatorTests.swift Asterism/AsterismTests/SettingsBackupModelTests.swift…ettingsBackupModelTests.swift Asterism/AsterismTests/SettingsImportTests.swift…sts/SettingsImportTests.swift Asterism/AsterismTests/SitesModelTests.swift…smTests/SitesModelTests.swift Asterism/AsterismTests/WorkTypesModelTests.swift…sts/WorkTypesModelTests.swift Asterism/AsterismTests/Helpers/MockLibraryProvider.swift…ers/MockLibraryProvider.swift Asterism/AsterismUITests/ComposedSurfaceUITests.swift…/ComposedSurfaceUITests.swift Asterism/AsterismUITests/SitesSettingsUITests.swift…ts/SitesSettingsUITests.swift Asterism/AsterismUITests/WorkTypesSettingsUITests.swift…orkTypesSettingsUITests.swift Packages/AsterismCore/Sources/AsterismCore/ArchiveRecordBuilders.swift…e/ArchiveRecordBuilders.swift Packages/AsterismCore/Sources/AsterismCore/ArticleTitlePlanning.swift…re/ArticleTitlePlanning.swift Packages/AsterismCore/Sources/AsterismCore/AsterismCapabilities.swift…re/AsterismCapabilities.swift Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV14.swift…mCore/AsterismSchemaV14.swift Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV15.swift…mCore/AsterismSchemaV15.swift Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV16.swift…mCore/AsterismSchemaV16.swift Packages/AsterismCore/Sources/AsterismCore/BackupArchiveProjection.swift…BackupArchiveProjection.swift Packages/AsterismCore/Sources/AsterismCore/BackupArchiveReferenceChecks.swift…pArchiveReferenceChecks.swift Packages/AsterismCore/Sources/AsterismCore/BackupExporter.swift…rismCore/BackupExporter.swift Packages/AsterismCore/Sources/AsterismCore/BackupGroupProjection.swift…e/BackupGroupProjection.swift Packages/AsterismCore/Sources/AsterismCore/BackupImportCreators.swift…re/BackupImportCreators.swift Packages/AsterismCore/Sources/AsterismCore/BackupImportRecords.swift…ore/BackupImportRecords.swift Packages/AsterismCore/Sources/AsterismCore/BackupImportWorkTypes.swift…e/BackupImportWorkTypes.swift Packages/AsterismCore/Sources/AsterismCore/BackupImporter.swift…rismCore/BackupImporter.swift Packages/AsterismCore/Sources/AsterismCore/BackupJSONCodecSupport.swift…/BackupJSONCodecSupport.swift Packages/AsterismCore/Sources/AsterismCore/BackupV15Codec.swift…rismCore/BackupV15Codec.swift Packages/AsterismCore/Sources/AsterismCore/BackupV15Exporter.swift…mCore/BackupV15Exporter.swift Packages/AsterismCore/Sources/AsterismCore/BackupV15Types.swift…rismCore/BackupV15Types.swift Packages/AsterismCore/Sources/AsterismCore/ComposedTeachingProjection.swift…posedTeachingProjection.swift Packages/AsterismCore/Sources/AsterismCore/DomainEnums.swift…sterismCore/DomainEnums.swift Packages/AsterismCore/Sources/AsterismCore/EntryCitations.swift…rismCore/EntryCitations.swift Packages/AsterismCore/Sources/AsterismCore/GroupOrdering.swift…erismCore/GroupOrdering.swift Packages/AsterismCore/Sources/AsterismCore/LibraryProviding.swift…smCore/LibraryProviding.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Articles.swift…raryRepository+Articles.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+BackupImportGates.swift…itory+BackupImportGates.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Bootstrap.swift…aryRepository+Bootstrap.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+BootstrapState.swift…pository+BootstrapState.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Capture.swift…braryRepository+Capture.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ComposedTeaching.swift…sitory+ComposedTeaching.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ConfirmImport.swift…epository+ConfirmImport.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Contracts.swift…aryRepository+Contracts.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+EmptyLibrary.swift…Repository+EmptyLibrary.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+EntryDetail.swift…yRepository+EntryDetail.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Export.swift…ibraryRepository+Export.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+OutcomeComputation.swift…tory+OutcomeComputation.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ReparseCapture.swift…pository+ReparseCapture.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+RuleSuggestion.swift…pository+RuleSuggestion.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Sites.swift…LibraryRepository+Sites.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+TodayPresentation.swift…itory+TodayPresentation.swift Packages/AsterismCore/Sources/AsterismCore/LibraryRepository.swift…mCore/LibraryRepository.swift Packages/AsterismCore/Sources/AsterismCore/LibraryValidator.swift…smCore/LibraryValidator.swift Packages/AsterismCore/Sources/AsterismCore/MembershipReconciler.swift…re/MembershipReconciler.swift Packages/AsterismCore/Sources/AsterismCore/Models.swift…ces/AsterismCore/Models.swift Packages/AsterismCore/Sources/AsterismCore/ProjectionContract.swift…Core/ProjectionContract.swift Packages/AsterismCore/Sources/AsterismCore/RecordRow.swift…/AsterismCore/RecordRow.swift Packages/AsterismCore/Sources/AsterismCore/SiteReconciler.swift…rismCore/SiteReconciler.swift Packages/AsterismCore/Sources/AsterismCore/SiteUnionProjection.swift…ore/SiteUnionProjection.swift Packages/AsterismCore/Sources/AsterismCore/Snapshots.swift…/AsterismCore/Snapshots.swift Packages/AsterismCore/Sources/AsterismCore/TodayPresentation.swift…mCore/TodayPresentation.swift Packages/AsterismCore/Sources/AsterismCore/WorkTypeSeeding.swift…ismCore/WorkTypeSeeding.swift Packages/AsterismCore/Sources/AsterismCore/Thumbnails/ThumbnailValues.swift…mbnails/ThumbnailValues.swift Packages/AsterismCore/Sources/ConstellationKit/SiteGlyph.swift…stellationKit/SiteGlyph.swift Packages/AsterismCore/Tests/AsterismCoreTests/ArticlesModeTests.swift…Tests/ArticlesModeTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/ArticlesReteachFlagTests.swift…rticlesReteachFlagTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/BackupExportDegradedRefusalTests.swift…ortDegradedRefusalTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/BackupGoldenExportTests.swift…BackupGoldenExportTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/BackupGroupProjectionTests.swift…kupGroupProjectionTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/BackupGroupRoundTripTests.swift…ckupGroupRoundTripTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/BackupImportTransactionTests.swift…pImportTransactionTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15ArchiveTests.swift…s/BackupV15ArchiveTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15Fixtures.swift…Tests/BackupV15Fixtures.swift Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15ImportMatrixTests.swift…kupV15ImportMatrixTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapActionTests.swift…ts/BootstrapActionTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapClassifierTests.swift…ootstrapClassifierTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapStateCoverageTests.swift…strapStateCoverageTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/CapabilityGatingTests.swift…s/CapabilityGatingTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/CaptureStateTests.swift…Tests/CaptureStateTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/CertificationPathTests.swift…/CertificationPathTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/CharacterDuplicateMachineryTests.swift…DuplicateMachineryTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/CitationBlobRefreshTests.swift…itationBlobRefreshTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/ComposedCaptureTests.swift…ts/ComposedCaptureTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/ConvergedRuleGroupValidationTests.swift…uleGroupValidationTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/CreatorConvergenceTests.swift…CreatorConvergenceTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/CreditReconcilerTests.swift…s/CreditReconcilerTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/CrossSiteDuplicateScanTests.swift…sSiteDuplicateScanTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/DuplicateReconcilerTestSupport.swift…teReconcilerTestSupport.swift Packages/AsterismCore/Tests/AsterismCoreTests/DuplicateScanTests.swift…ests/DuplicateScanTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/EmptyLibraryTests.swift…Tests/EmptyLibraryTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/EnumTolerancePolicyTests.swift…numTolerancePolicyTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/ExportInputReadTests.swift…ts/ExportInputReadTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/FanOutWriteTests.swift…eTests/FanOutWriteTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/FixtureArchiveGeneratorTests.swift…reArchiveGeneratorTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/FrozenLibraryPathTests.swift…/FrozenLibraryPathTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/GroupBulkWriteTests.swift…sts/GroupBulkWriteTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/GroupFetchTests.swift…reTests/GroupFetchTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/GroupOrderingTests.swift…ests/GroupOrderingTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/HeldStoreLock.swift…CoreTests/HeldStoreLock.swift Packages/AsterismCore/Tests/AsterismCoreTests/IdentityResolutionTests.swift…IdentityResolutionTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/LibraryGraphBaselineTests.swift…braryGraphBaselineTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/LibraryToleranceScanTests.swift…braryToleranceScanTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorNilSiteToleranceTests.swift…orNilSiteToleranceTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorTests.swift…s/LibraryValidatorTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorToleranceTests.swift…ValidatorToleranceTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/LookupFirstCaptureStateTests.swift…pFirstCaptureStateTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/M4BulkChunkPerformanceTests.swift…lkChunkPerformanceTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/M4DuplicateScalePerformanceTests.swift…teScalePerformanceTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/M5RepositoryTestSupport.swift…M5RepositoryTestSupport.swift Packages/AsterismCore/Tests/AsterismCoreTests/MarkerContractTests.swift…sts/MarkerContractTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/MarkerGenerationSixteenTests.swift…rGenerationSixteenTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/MembershipReconcilerTests.swift…mbershipReconcilerTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/MembershipTestSupport.swift…s/MembershipTestSupport.swift Packages/AsterismCore/Tests/AsterismCoreTests/MembershipValidationTests.swift…mbershipValidationTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/MirroringBootstrapLifecycleTests.swift…BootstrapLifecycleTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/ModelContractTests.swift…ests/ModelContractTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/MultiSiteReadPathTests.swift…/MultiSiteReadPathTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/MultiSiteReviewFixTests.swift…MultiSiteReviewFixTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/PendingCaptureDrainTests.swift…endingCaptureDrainTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/PlaceDuplicateMachineryTests.swift…DuplicateMachineryTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/RecordRowTests.swift…oreTests/RecordRowTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/RefreshUnionInvariantTests.swift…reshUnionInvariantTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/RepositoryTeachingTests.swift…RepositoryTeachingTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/RetiredUnreadableRuleTests.swift…iredUnreadableRuleTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/RuleOrderingTests.swift…Tests/RuleOrderingTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/RuleSelectionTests.swift…ests/RuleSelectionTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/RuleSuggestionCandidatesTests.swift…ggestionCandidatesTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swift…sts/SiteReconcilerTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/SiteUnionProjectionTests.swift…iteUnionProjectionTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/SitesListReadTests.swift…ests/SitesListReadTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/StoreMetadataTests.swift…ests/StoreMetadataTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailBytesReachTests.swift…humbnailBytesReachTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailIdentityTests.swift…/ThumbnailIdentityTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailStoreProbeTests.swift…humbnailStoreProbeTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/URLOptionalSequenceTests.swift…RLOptionalSequenceTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/UnknownSiteModeTests.swift…ts/UnknownSiteModeTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/V15RecordedStoreFixture.swift…V15RecordedStoreFixture.swift Packages/AsterismCore/Tests/AsterismCoreTests/V15RecordedStoreTests.swift…s/V15RecordedStoreTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/V4RecordedStoreTests.swift…ts/V4RecordedStoreTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/ValidatorFixtures.swift…Tests/ValidatorFixtures.swift Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeConvergenceTests.swift…orkTypeConvergenceTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeOrderingTests.swift…s/WorkTypeOrderingTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypePlumbingTests.swift…s/WorkTypePlumbingTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeSeedingTests.swift…ts/WorkTypeSeedingTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeSettingsAPITests.swift…orkTypeSettingsAPITests.swift Packages/AsterismCore/Tests/AsterismCoreTests/WritePathQuarantineTests.swift…ritePathQuarantineTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/WriteSiteRelationshipTests.swift…teSiteRelationshipTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLCompatibilityTests.swift…rkURLCompatibilityTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLImportTests.swift…gHostWorkURLImportTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLValidatorTests.swift…stWorkURLValidatorTests.swift Packages/AsterismCore/Tests/AsterismCoreTests/Fixtures/backup-14-15-golden.json…ures/backup-14-15-golden.json Packages/AsterismCore/Tests/AsterismCoreTests/Fixtures/backup-15-16-golden.json…ures/backup-15-16-golden.json docs/asterism-design.mddocs/asterism-design.md docs/asterism-style-guide.mddocs/asterism-style-guide.md docs/asterism-v2-plan.mddocs/asterism-v2-plan.md docs/agent-notes/rule-wire-format.md…ent-notes/rule-wire-format.md docs/agent-notes/schema-migration.md…ent-notes/schema-migration.md docs/agent-notes/testing.mddocs/agent-notes/testing.md specs/OVERVIEW.mdspecs/OVERVIEW.md specs/remove-article-mode/decision_log.md…-article-mode/decision_log.md specs/remove-article-mode/design.md…remove-article-mode/design.md specs/remove-article-mode/implementation.md…rticle-mode/implementation.md specs/remove-article-mode/requirements.md…-article-mode/requirements.md specs/remove-article-mode/tasks.md…/remove-article-mode/tasks.md specs/retire-migration-chain/library-graph-baseline.txt…in/library-graph-baseline.txt
addedmodifieddeletedrenamedunchangedcollapsed package group or +N more⚑N test files with an edge to the node

Per-file diffs

Click to expand.

Asterism/Asterism/Announcements/Documents/getting-started-mac.md Modified +0 / -4
diff --git a/Asterism/Asterism/Announcements/Documents/getting-started-mac.md b/Asterism/Asterism/Announcements/Documents/getting-started-mac.mdindex d021355f..9d35ecb3 100644--- a/Asterism/Asterism/Announcements/Documents/getting-started-mac.md+++ b/Asterism/Asterism/Announcements/Documents/getting-started-mac.md@@ -79,10 +79,6 @@ needed. A chapter title you set by hand is never overwritten, and an entry the rule cannot make sense of keeps what it has and stays on the list of things needing attention. -Not every site is a site with chapters. If the pages you capture are articles-that stand on their own, use **Treat every page as an article** at the foot of-the teaching screen.- A site can be taught again at any time, and Settings has a **Sites** screen listing every site your library knows, with the same route into teaching. 
Asterism/Asterism/Announcements/Documents/getting-started.md Modified +0 / -4
diff --git a/Asterism/Asterism/Announcements/Documents/getting-started.md b/Asterism/Asterism/Announcements/Documents/getting-started.mdindex d6ef1bb8..4be51e3b 100644--- a/Asterism/Asterism/Announcements/Documents/getting-started.md+++ b/Asterism/Asterism/Announcements/Documents/getting-started.md@@ -77,10 +77,6 @@ needed. A chapter title you set by hand is never overwritten, and an entry the rule cannot make sense of keeps what it has and stays on the list of things needing attention. -Not every site is a site with chapters. If the pages you capture are articles-that stand on their own, use **Treat every page as an article** at the foot of-the teaching screen.- A site can be taught again at any time, and Settings has a **Sites** screen listing every site your library knows, with the same route into teaching. 
Asterism/Asterism/ContentView.swift Modified +1 / -2
diff --git a/Asterism/Asterism/ContentView.swift b/Asterism/Asterism/ContentView.swiftindex 5ce41f02..1ef2ec9b 100644--- a/Asterism/Asterism/ContentView.swift+++ b/Asterism/Asterism/ContentView.swift@@ -717,8 +717,7 @@ struct ContentView: View {             // no action, so there is no pill to enter it from.             .sheet(item: $navigation.showingTeachingForHostname) { pending in                 if let teachModel = model.composedTeachingModel(-                    forHostname: pending.hostname,-                    permitsArticlesConversion: pending.permitsArticlesConversion) {+                    forHostname: pending.hostname) {                     ComposedTeachingContainerView(model: teachModel)                 }             }
Asterism/Asterism/Layout/AppNavigation.swift Modified +1 / -8
diff --git a/Asterism/Asterism/Layout/AppNavigation.swift b/Asterism/Asterism/Layout/AppNavigation.swiftindex 54a72ff4..202f72a3 100644--- a/Asterism/Asterism/Layout/AppNavigation.swift+++ b/Asterism/Asterism/Layout/AppNavigation.swift@@ -854,13 +854,8 @@ nonisolated struct PresentedWork: Identifiable, Equatable { }  /// A re-teach route waiting for Settings to close, or presented directly.-///-/// The flag travels with the hostname rather than beside it so a route can-/// never be dispatched having lost it — Decision 3's gate is only as good as-/// the one place that sets it. nonisolated struct PendingReteach: Identifiable, Equatable {     let hostname: String-    var permitsArticlesConversion = false     var id: String { hostname } } @@ -875,9 +870,7 @@ nonisolated struct PendingReteach: Identifiable, Equatable { /// asking for two presentations in one turn drops the second, so "at most one" /// is not tidiness here but the invariant the plumbing exists to hold. nonisolated enum PendingRoute: Equatable {-    /// The Settings-hosted diagnosis and Sites screens. Carries the-    /// articles-conversion flag, because only one of those two routes may set it-    /// (Decision 3 of `specs/polish-and-export`).+    /// The Settings-hosted diagnosis and Sites screens.     case reteach(PendingReteach)     /// The Settings-hosted Check Library screen's Resolve.     case resolve(DuplicateSetKey)
Asterism/Asterism/Layout/SettingsScreen.swift Modified +3 / -8
diff --git a/Asterism/Asterism/Layout/SettingsScreen.swift b/Asterism/Asterism/Layout/SettingsScreen.swiftindex 889bac9a..fe8c8c3b 100644--- a/Asterism/Asterism/Layout/SettingsScreen.swift+++ b/Asterism/Asterism/Layout/SettingsScreen.swift@@ -70,15 +70,10 @@ struct SettingsScreen: View {             interruptedImportNotice: model.interruptedImportNotice,             interruptedEmptyNotice: model.interruptedEmptyNotice,             sitesModel: model.sitesListModel(),-            // Req 6.2 rides the same pending-route plumbing Library Check-            // uses. The flag is Decision 3's one exception, and this is the-            // only route that ever sets it.+            // Req 6.2 rides the same pending-route plumbing Library Check uses.             siteDetailModel: { site, onChanged in-                model.siteDetailModel(for: site, onChanged: onChanged) { hostname, permits in-                    navigation.pendingRoute = .reteach(-                        PendingReteach(-                            hostname: hostname,-                            permitsArticlesConversion: permits))+                model.siteDetailModel(for: site, onChanged: onChanged) { hostname in+                    navigation.pendingRoute = .reteach(PendingReteach(hostname: hostname))                     leaveSettings()                 }             },
Asterism/Asterism/RuleSuggestion/RuleSuggester.swift Modified +3 / -3
diff --git a/Asterism/Asterism/RuleSuggestion/RuleSuggester.swift b/Asterism/Asterism/RuleSuggestion/RuleSuggester.swiftindex 2108af6e..715a64da 100644--- a/Asterism/Asterism/RuleSuggestion/RuleSuggester.swift+++ b/Asterism/Asterism/RuleSuggestion/RuleSuggester.swift@@ -66,12 +66,12 @@ actor RuleSuggester: RuleSuggesting {     /// hostname exactly as the editor will.     private nonisolated static let basisRequest = ComposedTeachingRequest(         titleDefinition: .wholeTitle, trimPrefix: nil, trimSuffix: nil,-        urlDefinition: nil, acknowledgeUnsettled: false, permitsArticlesConversion: false)+        urlDefinition: nil, acknowledgeUnsettled: false)      func attempt(         hostname: String     ) async throws -> (suggestion: RuleSuggestion?, modelPhase: Duration) {-        // Step 1. An articles-mode Site makes this throw, and so does an+        // Step 1. A quarantined hostname makes this throw, and so does an         // unreadable library; both settle the attempt with nothing to show.         let basis: ComposedTeachingBasis         do {@@ -379,7 +379,7 @@ actor RuleSuggester: RuleSuggesting {         ComposedTeachingRequest(             titleDefinition: title.definition, trimPrefix: title.trimPrefix,             trimSuffix: title.trimSuffix, urlDefinition: url,-            acknowledgeUnsettled: false, permitsArticlesConversion: false)+            acknowledgeUnsettled: false)     }      /// Req 3.4 / Q48: a single-side set fills the other slot with what the Site
Asterism/Asterism/RuleSuggestion/RuleSuggestionCoordinator.swift Modified +3 / -3
diff --git a/Asterism/Asterism/RuleSuggestion/RuleSuggestionCoordinator.swift b/Asterism/Asterism/RuleSuggestion/RuleSuggestionCoordinator.swiftindex 4bc40f2b..ade28fae 100644--- a/Asterism/Asterism/RuleSuggestion/RuleSuggestionCoordinator.swift+++ b/Asterism/Asterism/RuleSuggestion/RuleSuggestionCoordinator.swift@@ -417,10 +417,10 @@ final class RuleSuggestionCoordinator {      // MARK: - Candidate rows -    /// The definition in the requirements: not articles, at least one capture,-    /// and a rule missing on one side.+    /// The definition in the requirements: at least one capture, and a rule+    /// missing on one side.     private static func isAutoEligible(_ candidate: RuleSuggestionCandidate) -> Bool {-        candidate.siteMode != .articles && candidate.entryCount > 0+        candidate.entryCount > 0             && (candidate.titleRuleID == nil || candidate.urlRuleID == nil)     } 
Asterism/Asterism/ViewModels/AppLibraryModel.swift Modified +7 / -12
diff --git a/Asterism/Asterism/ViewModels/AppLibraryModel.swift b/Asterism/Asterism/ViewModels/AppLibraryModel.swiftindex f4432c58..a4bf1ea7 100644--- a/Asterism/Asterism/ViewModels/AppLibraryModel.swift+++ b/Asterism/Asterism/ViewModels/AppLibraryModel.swift@@ -319,8 +319,8 @@ public final class AppLibraryModel {     /// class-bound, and teardown clears the reference only after awaiting the     /// shutdown, where the counter moves before that suspension.     private var repositoryEpoch = 0-    /// Retains the concrete repository for backup export (conforms to BackupV14SnapshotProviding).-    private var backupRepository: (any BackupV14SnapshotProviding)?+    /// Retains the concrete repository for backup export (conforms to BackupV15SnapshotProviding).+    private var backupRepository: (any BackupV15SnapshotProviding)?     /// A pre-bootstrap failure used to fail closed on invalid debug launch input.     private let startupFailureMessage: String?     /// Seeds only a fresh, explicit temporary configuration used by UI tests.@@ -1634,12 +1634,8 @@ public final class AppLibraryModel {     /// Returns nil when no Entry exists on the hostname: the composed surface is     /// entered from an Entry, so a diagnosed Site with nothing captured from it     /// has nothing to teach against. The screen still lists the diagnosis.-    /// `permitsArticlesConversion` is Decision 3's one exception: only the-    /// Sites screen's re-teach route sets it, and only with it will the-    /// projection and commit accept an articles Site.     public func composedTeachingModel(-        forHostname hostname: String,-        permitsArticlesConversion: Bool = false+        forHostname hostname: String     ) -> ComposedTeachingViewModel? {         guard capabilities.supportsSegmentTeaching,               let repo = repository,@@ -1652,7 +1648,6 @@ public final class AppLibraryModel {             library: repo,             capabilities: capabilities,             entryContext: .titleFocused,-            permitsArticlesConversion: permitsArticlesConversion,             onMutation: { [weak self] in                 await self?.refreshDiagnosesAndSnapshots()             },@@ -1678,7 +1673,7 @@ public final class AppLibraryModel {         return SitesListModel(library: repo)     } -    /// One site's screen (Reqs 6.2–6.4). The caller supplies the re-teach route+    /// One site's screen (Req 6.2). The caller supplies the re-teach route     /// because navigation is its concern — the Settings host has to dismiss     /// itself before the teaching sheet can present.     /// `onChanged` is the Sites list's own reload, so a rename is on the row the@@ -1688,7 +1683,7 @@ public final class AppLibraryModel {     public func siteDetailModel(         for site: SiteSnapshot,         onChanged: @escaping @MainActor () async -> Void,-        onReteach: @escaping @MainActor (String, Bool) -> Void+        onReteach: @escaping @MainActor (String) -> Void     ) -> SiteDetailModel? {         guard let repo = repository else { return nil }         return SiteDetailModel(@@ -2651,11 +2646,11 @@ public final class AppLibraryModel {     /// the other abandoned. Which means only one of them needs to sweep it:     /// the backup row's stage does, and Empty Library's is built with     /// `scavengesOnInit: false` because both are constructed in the same render.-    private func backupExporter() -> BackupV14Exporter? {+    private func backupExporter() -> BackupV15Exporter? {         guard let repo = backupRepository, let config = resolvedConfiguration else { return nil }         let stagingDir = config.rootDirectory             .appending(path: "Library/Caches/BackupExports")-        return BackupV14Exporter(repository: repo, stagingDirectory: stagingDir)+        return BackupV15Exporter(repository: repo, stagingDirectory: stagingDir)     }      /// The per-entry markdown export model (Req 1.5), staged beside the backup
Asterism/Asterism/ViewModels/ComposedTeachingViewModel.swift Modified +9 / -175
diff --git a/Asterism/Asterism/ViewModels/ComposedTeachingViewModel.swift b/Asterism/Asterism/ViewModels/ComposedTeachingViewModel.swiftindex 3985724b..37321a4f 100644--- a/Asterism/Asterism/ViewModels/ComposedTeachingViewModel.swift+++ b/Asterism/Asterism/ViewModels/ComposedTeachingViewModel.swift@@ -21,9 +21,6 @@ import OSLog ///   presentation-only and retains the selection with a summary and an explicit ///   clear (Q11). /// - Per-commit unsettled-chapters acknowledgment (Req 2.1, Q3), never persisted.-/// - The Articles affordance (Req 8.7): a one-way Site transition kept out of-///   title selection, projected and committed through `projectArticles` /-///   `commitArticles`, never the composed commit. /// - Generation-gated preview publication carried from `URLTeachingViewModel` ///   (Req 8.5): only the latest edit generation may publish a preview. @MainActor @Observable@@ -130,12 +127,6 @@ public final class ComposedTeachingViewModel {     /// replaces the stored rule.     public private(set) var storedTitleRuleNotice: String? -    // Articles (Req 8.7) — separate from title selection-    /// Whether the reader has opened the Articles affordance's confirmation.-    public private(set) var articlesRequested: Bool = false-    public private(set) var junkSuffixSegmentCount = 0-    public private(set) var articleValidationMessage: String?-     // URL rule (absorbed from URLTeachingViewModel)     public private(set) var urlRuleDefinition: URLRuleDefinition?     /// What the URL editor currently authors (Q22). The optional definition alone@@ -186,12 +177,6 @@ public final class ComposedTeachingViewModel {     private let library: any LibraryProviding     private let capabilities: AsterismCapabilities     private let entryContext: EntryContext-    /// Decision 3: whether this surface may re-teach an **articles** site.-    ///-    /// False everywhere but the Sites screen's route. Both teaching gates refuse-    /// an articles site without it, which is what keeps an inbox-driven teach-    /// from converting one by accident.-    private let permitsArticlesConversion: Bool     private let onMutation: (@Sendable () async -> Void)?     /// The run's suggestion state. Nil wherever suggestions are not wired —     /// previews, and every test that does not exercise them.@@ -236,11 +221,6 @@ public final class ComposedTeachingViewModel {     /// the coordinator's and continues (Req 5.7).     private var suggestionTask: Task<Void, Never>? -    /// Articles mode is a one-way Site transition, not a composed title rule, so-    /// it keeps its own contract and commits through `commitArticles` rather than-    /// `commitComposedTeaching` (which requires an active title rule).-    private var articlesContract: ArticlesContract?-     // MARK: - Derived, presentation-facing      public var exampleTitle: String { entry.captureTitle }@@ -250,7 +230,6 @@ public final class ComposedTeachingViewModel {     /// The backing library, exposed so a container can drive the post-commit     /// Work landing-URL queue without a second dependency handle.     public var provider: any LibraryProviding { library }-    public var supportsArticles: Bool { capabilities.supportsArticles }      /// Whether any segment is currently shown as its parts.     public var isSubdivided: Bool { !subdividedSegments.isEmpty }@@ -638,24 +617,11 @@ public final class ComposedTeachingViewModel {     /// carries. No preview is generated in those states either, so `contract` is     /// already nil — this states the gate rather than relying on that.     public var canConfirm: Bool {-        guard !articlesRequested, urlRuleSettled, state == .previewReady,-              previewGeneration == generation+        guard urlRuleSettled, state == .previewReady, previewGeneration == generation         else { return false }         return contract != nil     } -    public var canConfirmArticles: Bool {-        articlesRequested && state == .previewReady && previewGeneration == generation-            && articlesContract != nil-    }--    /// The articles preview: how many Entries the one-way transition would-    /// detach and rename. Nil until the affordance's projection lands.-    public var articlesPreviewEntryCount: Int? {-        guard articlesRequested else { return nil }-        return articlesContract?.outcome.plan.entryProjections.count-    }-     // MARK: - Init      /// Internal, unlike the other view models' initializers: `suggestions` names@@ -667,7 +633,6 @@ public final class ComposedTeachingViewModel {         library: any LibraryProviding,         capabilities: AsterismCapabilities = .current,         entryContext: EntryContext = .titleFocused,-        permitsArticlesConversion: Bool = false,         onMutation: (@Sendable () async -> Void)? = nil,         suggestions: RuleSuggestionCoordinator? = nil     ) {@@ -675,7 +640,6 @@ public final class ComposedTeachingViewModel {         self.library = library         self.capabilities = capabilities         self.entryContext = entryContext-        self.permitsArticlesConversion = permitsArticlesConversion         self.onMutation = onMutation         self.suggestions = suggestions     }@@ -856,48 +820,6 @@ public final class ComposedTeachingViewModel {         commitTitleEdit()     } -    // MARK: - Articles affordance (Req 8.7)--    /// Opens the Articles confirmation. Articles is a one-way Site transition,-    /// not a title rule form, so it never enters the composed request.-    public func requestArticles() {-        guard supportsArticles, !articlesRequested else { return }-        articlesRequested = true-        junkSuffixSegmentCount = 0-        articleValidationMessage = nil-        titleSelectionNotice = nil-        previewTask?.cancel()-        invalidatePreview()-        Task { await projectArticlesAndPublish() }-    }--    public func cancelArticles() {-        guard articlesRequested else { return }-        articlesRequested = false-        articlesContract = nil-        articleValidationMessage = nil-        invalidatePreview()-        Task { await generatePreviewIfValid() }-    }--    public func setJunkSuffixSegmentCount(_ count: Int) {-        guard articlesRequested else { return }-        junkSuffixSegmentCount = count-        invalidatePreview()-        do {-            _ = try ArticleTitleCleaner.deriveRule(from: entry.captureTitle, suffixSegmentCount: count)-            articleValidationMessage = nil-            Task { await projectArticlesAndPublish() }-        } catch {-            articleValidationMessage = error.localizedDescription-        }-    }--    public func confirmArticles() async {-        guard canConfirmArticles else { return }-        await commitArticlesContract()-    }-     // MARK: - URL rule editing (absorbed)      /// Takes what the URL editor authors — a finished rule, a deliberate clear, or@@ -944,10 +866,9 @@ public final class ComposedTeachingViewModel {     /// Req 6.4's wording, in the same register as the editor's other notices.     public static let noSuggestionNotice = "No suggestion available for this site." -    /// Req 6.1: the action exists only while the model is there and the Site is-    /// something a rule can be taught for.+    /// Req 6.1: the action exists only while the model is there.     public var offersSuggestAction: Bool {-        suggestions?.isModelAvailable == true && frozenBasis?.siteMode != .articles+        suggestions?.isModelAvailable == true     }      /// Req 6: ask for a suggestion now. A held one is applied without a model@@ -1061,11 +982,10 @@ public final class ComposedTeachingViewModel {     }      /// The requirements' auto-eligibility, asked of the basis this editor froze:-    /// not articles, and a rule missing on one side.+    /// a rule missing on one side.     private var isAutoEligibleForSuggestion: Bool {         guard let basis = frozenBasis else { return false }-        return basis.siteMode != .articles-            && (basis.currentTitleRule == nil || basis.currentURLRule == nil)+        return basis.currentTitleRule == nil || basis.currentURLRule == nil     }      /// Whether one side may take a suggestion from this origin. The automatic@@ -1260,13 +1180,8 @@ public final class ComposedTeachingViewModel {      public func reconfirm() async {         guard requiresReconfirmation, state == .refreshed, previewGeneration == generation else { return }-        if articlesRequested {-            guard articlesContract != nil else { return }-            await commitArticlesContract()-        } else {-            guard contract != nil else { return }-            await commitCurrentContract()-        }+        guard contract != nil else { return }+        await commitCurrentContract()     }      public func retry() async {@@ -1294,10 +1209,6 @@ public final class ComposedTeachingViewModel {     /// the latest when the projection returns.     private func generatePreviewIfValid() async {         previewTask?.cancel()-        if articlesRequested {-            await projectArticlesAndPublish()-            return-        }         guard let request = buildRequest() else {             invalidateContractOnly()             return@@ -1330,10 +1241,6 @@ public final class ComposedTeachingViewModel {     /// Awaitable projection used by the acknowledgment and retry paths, which must     /// have a fresh contract in hand before proceeding.     private func projectAndPublish() async {-        if articlesRequested {-            await projectArticlesAndPublish()-            return-        }         guard let request = buildRequest() else {             invalidateContractOnly()             return@@ -1351,43 +1258,6 @@ public final class ComposedTeachingViewModel {         }     } -    /// Project the one-way articles transition. Articles carries no title rule,-    /// so it never builds a `ComposedTeachingRequest`.-    private func projectArticlesAndPublish() async {-        guard articleValidationMessage == nil else {-            invalidateContractOnly()-            return-        }-        let rule: JunkSuffixRule?-        if junkSuffixSegmentCount > 0 {-            guard let derived = try? ArticleTitleCleaner.deriveRule(-                from: entry.captureTitle, suffixSegmentCount: junkSuffixSegmentCount) else {-                invalidateContractOnly()-                return-            }-            rule = derived-        } else {-            rule = nil-        }--        let currentGeneration = generation-        state = .previewing-        do {-            let projected = try await library.projectArticles(hostname: entry.hostname, junkSuffixRule: rule)-            guard currentGeneration == generation else { return }-            articlesContract = projected-            contract = nil-            previewOutcome = nil-            previewGeneration = currentGeneration-            state = .previewReady-        } catch {-            guard currentGeneration == generation else { return }-            errorMessage = "Unable to generate preview. Library unchanged."-            state = .error-            Self.logger.error("Articles preview failed: \(String(describing: error), privacy: .public)")-        }-    }-     private func publish(_ projected: ComposedTeachingContract, generation: Int) {         contract = projected         previewOutcome = projected.outcome@@ -1414,38 +1284,6 @@ public final class ComposedTeachingViewModel {         }     } -    private func commitArticlesContract() async {-        guard !isSubmitting, let articlesContract else { return }-        isSubmitting = true-        defer { isSubmitting = false }-        state = .confirming-        errorMessage = nil--        do {-            switch try await library.commitArticles(articlesContract) {-            case .committed:-                committedOutcome = nil-                requiresReconfirmation = false-                state = .committed-                Task { await onMutation?() }-                Self.logger.debug("Articles mode committed for \(self.hostname, privacy: .public)")-            case .refreshed(let fresh):-                self.articlesContract = fresh-                previewGeneration = generation-                requiresReconfirmation = true-                state = .refreshed-            case .invalidated(let reason):-                invalidationReason = reason-                requiresReconfirmation = false-                state = .invalidated-            }-        } catch {-            errorMessage = "Unable to save articles mode. Library unchanged."-            state = .error-            Self.logger.error("Articles commit failed: \(String(describing: error), privacy: .public)")-        }-    }-     private func handleCommitOutcome(_ outcome: ComposedTeachingCommitOutcome) {         switch outcome {         case .committed:@@ -1494,8 +1332,7 @@ public final class ComposedTeachingViewModel {             trimPrefix: title.trimPrefix,             trimSuffix: title.trimSuffix,             urlDefinition: urlRuleDefinition,-            acknowledgeUnsettled: acknowledgedUnsettled,-            permitsArticlesConversion: permitsArticlesConversion)+            acknowledgeUnsettled: acknowledgedUnsettled)     }      // MARK: - Projection@@ -1506,8 +1343,7 @@ public final class ComposedTeachingViewModel {     ) async throws -> ComposedTeachingContract {         let request = ComposedTeachingRequest(             titleDefinition: titleDefinition, trimPrefix: trimPrefix, trimSuffix: trimSuffix,-            urlDefinition: urlDefinition, acknowledgeUnsettled: acknowledge,-            permitsArticlesConversion: permitsArticlesConversion)+            urlDefinition: urlDefinition, acknowledgeUnsettled: acknowledge)         return try await library.projectComposedTeaching(hostname: entry.hostname, request: request)     } @@ -1519,7 +1355,6 @@ public final class ComposedTeachingViewModel {         defer { Self.performanceSignposter.endInterval("ComposedEditAcknowledgement", signpostState) }         generation += 1         contract = nil-        articlesContract = nil         previewOutcome = nil         requiresReconfirmation = false         if state == .previewReady || state == .previewing || state == .requiresAcknowledgment {@@ -1531,7 +1366,6 @@ public final class ComposedTeachingViewModel {     /// counter — used when the selection is not yet a valid rule.     private func invalidateContractOnly() {         contract = nil-        articlesContract = nil         previewOutcome = nil         if state == .previewReady || state == .previewing { state = .ready }     }
Asterism/Asterism/ViewModels/EntryDetailModel.swift Modified +2 / -2
diff --git a/Asterism/Asterism/ViewModels/EntryDetailModel.swift b/Asterism/Asterism/ViewModels/EntryDetailModel.swiftindex 39ab8092..b31b8e67 100644--- a/Asterism/Asterism/ViewModels/EntryDetailModel.swift+++ b/Asterism/Asterism/ViewModels/EntryDetailModel.swift@@ -351,8 +351,8 @@ public final class EntryDetailModel {     /// which is ``cancelDelete()`` — *before* it runs the tapped button's action,     /// so anything the commit needs that lives only in the model is already gone     /// by then. `WorkDetailModel.WorkDeletionPrompt` and-    /// `SiteDetailModel.ArticlesPrompt` record the same hazard; this app has been-    /// bitten by it twice.+    /// `WorkTypeDetailModel.RemovalPrompt` record the same hazard; this app has+    /// been bitten by it more than once.     public struct DeletionPrompt: Identifiable, Equatable, Sendable {         public let id: UUID         /// What the reader is deleting, as the screen loaded it — the identity
Asterism/Asterism/ViewModels/SettingsBackupModel.swift Modified +12 / -12
diff --git a/Asterism/Asterism/ViewModels/SettingsBackupModel.swift b/Asterism/Asterism/ViewModels/SettingsBackupModel.swiftindex f5220f76..d9826ac9 100644--- a/Asterism/Asterism/ViewModels/SettingsBackupModel.swift+++ b/Asterism/Asterism/ViewModels/SettingsBackupModel.swift@@ -5,20 +5,20 @@ import OSLog // MARK: - Backup Exporting Protocol  /// Test seam abstracting the exporter's operations needed by the Settings-/// surface. Conforms `BackupV14Exporter` to this protocol via extension below.+/// surface. Conforms `BackupV15Exporter` to this protocol via extension below. ///-/// Settings exports 14/15 (`work-thumbnails` Req 8.1): the archive+/// Settings exports 15/16 (`work-thumbnails` Req 8.1): the archive /// carries the reader's named places and their suppressions, a Work's site /// memberships, the reader's dismissed pairs, citations that name a rule by UUID /// alone, and the Work's two statuses and verdict. It is also the only format /// the app reads, so there is one exporter and one importer. public protocol BackupExporting: Sendable {-    func export(metadata: BackupV14Metadata) async throws -> BackupExportResult+    func export(metadata: BackupV15Metadata) async throws -> BackupExportResult     func cleanup(_ result: BackupExportResult)     func scavengeStaleFiles() } -extension BackupV14Exporter: BackupExporting {}+extension BackupV15Exporter: BackupExporting {}  // MARK: - Export Stage @@ -87,7 +87,7 @@ nonisolated struct ExportRefusal: Error, Equatable, Sendable {         stagedFileURL = nil          do {-            let metadata = BackupV14Metadata(+            let metadata = BackupV15Metadata(                 appBuild: Self.currentAppBuild(),                 exportedAt: Date()             )@@ -120,7 +120,7 @@ nonisolated struct ExportRefusal: Error, Equatable, Sendable {     // MARK: - Refusal wording      private static func routesToCheckLibrary(for error: Error) -> Bool {-        guard let exportError = error as? BackupV14ExportError,+        guard let exportError = error as? BackupV15ExportError,               case .tornGroups = exportError         else { return false }         return true@@ -141,7 +141,7 @@ nonisolated struct ExportRefusal: Error, Equatable, Sendable {         switch error {         case is BackupCodecError:             "Backup export failed due to an encoding error. Please try again."-        case let error as BackupV14ExportError:+        case let error as BackupV15ExportError:             exportMessage(for: error)         default:             "Backup export failed. Please try again."@@ -165,7 +165,7 @@ nonisolated struct ExportRefusal: Error, Equatable, Sendable {     /// (`character-extraction` Req 6.5, Q105). It needs no new sentence: the     /// payload carries a count and a route, not a record kind, and Check Library     /// is where every torn group is resolved.-    private static func exportMessage(for error: BackupV14ExportError) -> String {+    private static func exportMessage(for error: BackupV15ExportError) -> String {         switch error {         case .tornGroups(let payload):             tornGroupsMessage(payload)@@ -182,7 +182,7 @@ nonisolated struct ExportRefusal: Error, Equatable, Sendable {         // whole purpose is to send them to that work. Nothing else about the         // record travels: not the bytes, not the digest, not the shape.         case .unrepresentableValue(let record, let field, _)-        where field == BackupV14ExportError.thumbnailField:+        where field == BackupV15ExportError.thumbnailField:             "\(record) has a cover this backup cannot carry. Remove the cover in the work's "                 + "editor and export again — or, if the work is flagged as a duplicate, "                 + "resolve it first and the cover you keep will be backed up."@@ -220,7 +220,7 @@ nonisolated struct ExportRefusal: Error, Equatable, Sendable {         switch error {         case let e as BackupCodecError:             "codec: \(e)"-        case let e as BackupV14ExportError:+        case let e as BackupV15ExportError:             exportDiagnosticCategory(e)         case let e as LibraryRepositoryError:             "repository: \(e)"@@ -231,7 +231,7 @@ nonisolated struct ExportRefusal: Error, Equatable, Sendable {      /// The export refusals, by **category** rather than by message.     ///-    /// `BackupV14ExportError.description` is written for the reader and names+    /// `BackupV15ExportError.description` is written for the reader and names     /// the record: `Work “<title>”` for a cover (`work-thumbnails` Req 8.3) and     /// `Site <hostname>` for an unrepresentable site mode. The line above is     /// logged `privacy: .public`, so interpolating that description would put a@@ -239,7 +239,7 @@ nonisolated struct ExportRefusal: Error, Equatable, Sendable {     /// process on the device can read. The refusal that names a record     /// therefore logs its **field** — a compile-time constant — and the reader     /// gets the title on screen, where it belongs.-    private static func exportDiagnosticCategory(_ error: BackupV14ExportError) -> String {+    private static func exportDiagnosticCategory(_ error: BackupV15ExportError) -> String {         switch error {         case .unrepresentableValue(_, let field, _):             "export: unrepresentable \(field)"
Asterism/Asterism/ViewModels/SitesModels.swift Modified +11 / -108
diff --git a/Asterism/Asterism/ViewModels/SitesModels.swift b/Asterism/Asterism/ViewModels/SitesModels.swiftindex 4e8b119b..8e231e25 100644--- a/Asterism/Asterism/ViewModels/SitesModels.swift+++ b/Asterism/Asterism/ViewModels/SitesModels.swift@@ -70,51 +70,26 @@ public final class SitesListModel {     } } -/// One site's screen: what mode it is in, the re-teach route, and — for a site-/// not already in articles mode — the one-way switch (Reqs 6.2–6.4).+/// One site's screen: what mode it is in, its name, and the re-teach route+/// (Req 6.2). @MainActor @Observable public final class SiteDetailModel {     private static let logger = Logger(subsystem: "me.nore.ig.Asterism", category: "SiteDetailModel") -    /// What the articles confirmation is offering, built from the projection so-    /// the count it names is the one the commit will apply.-    ///-    /// The contract rides **on the presented value**, not beside it in the-    /// model, for the reason `WorkDetailModel.WorkDeletionPrompt` records:-    /// SwiftUI runs a dialog's `isPresented` setter — the dismissal, which is-    /// `cancelArticlesSwitch()` — *before* it runs the tapped button's action,-    /// so a confirm that re-read a model property found it already cleared and-    /// committed nothing, silently.-    public struct ArticlesPrompt: Equatable, Sendable {-        public let contract: ArticlesContract-        public let entryCount: Int--        public var message: String {-            let subject = Pluralisation.count(-                entryCount, "note from this site becomes", "notes from this site become")-            return "\(subject) independent articles: they stop being chapters of a work, "-                + "and the site's title and URL rules are retired. This cannot be undone from "-                + "here — the way back is to teach the site again."-        }-    }-     public let site: SiteSnapshot     /// Opens on the stored name, because a rename is nearly always a correction     /// of it (the `WorkTypeDetailModel` precedent).     public var draftName: String     /// The name the screen is currently showing the site under — the snapshot's     /// at first, then whatever the last successful rename resolved to. The-    /// navigation title follows it, because unlike the mode changes below a+    /// navigation title follows it, because unlike the re-teach route below a     /// rename leaves the reader on this screen.     public private(set) var currentName: String-    public private(set) var articlesPrompt: ArticlesPrompt?     public private(set) var errorMessage: String?     public private(set) var isSubmitting = false-    /// Set once the switch commits, so the screen can leave.-    public private(set) var didSwitchToArticles = false      private let library: any LibraryProviding-    private let onReteach: @MainActor (String, Bool) -> Void+    private let onReteach: @MainActor (String) -> Void     private let onMutation: @Sendable () async -> Void     private let onChanged: @MainActor () async -> Void @@ -130,7 +105,7 @@ public final class SiteDetailModel {         site: SiteSnapshot,         library: any LibraryProviding,         canReteach: Bool,-        onReteach: @escaping @MainActor (String, Bool) -> Void,+        onReteach: @escaping @MainActor (String) -> Void,         onMutation: @escaping @Sendable () async -> Void,         onChanged: @escaping @MainActor () async -> Void     ) {@@ -155,9 +130,6 @@ public final class SiteDetailModel {                 + "their page titles."         case .taught:             "Asterism reads a work and a chapter out of this site's page titles."-        case .articles:-            "Every page from this site stands on its own. Teaching the site again returns it "-                + "to reading works and chapters."         }     } @@ -173,10 +145,6 @@ public final class SiteDetailModel {             : "Asterism has no notes from this site yet, so there is nothing to teach it with."     } -    /// Req 6.3: articles mode is one-way, so a site already in it is not offered-    /// the switch; its way out is the re-teach above (Decision 3).-    public var canSwitchToArticles: Bool { site.mode != .articles }-     // MARK: - Rename      /// What the rename would settle on: the trimmed draft, or the hostname where@@ -201,9 +169,10 @@ public final class SiteDetailModel {      /// Sets the name this site presents under everywhere (Req 6 of this feature).     ///-    /// Unlike the mode changes below, this leaves the reader on the screen: the-    /// title follows `currentName`, and the hosts are told so the list behind-    /// this screen and every other surface show the new name without a relaunch.+    /// Unlike the re-teach route below, this leaves the reader on the screen:+    /// the title follows `currentName`, and the hosts are told so the list+    /// behind this screen and every other surface show the new name without a+    /// relaunch.     public func rename() async {         guard canRename else { return }         isSubmitting = true@@ -242,77 +211,12 @@ public final class SiteDetailModel {         URL(string: "https://\(hostname)/")     } -    // MARK: - Re-teach (Req 6.2, 6.3)+    // MARK: - Re-teach (Req 6.2)      /// Routes to the composed teaching surface.-    ///-    /// The flag is what makes this screen the one place an articles site can be-    /// re-taught (Decision 3): every other entry point leaves it false, and the-    /// projection and commit refuse an articles site without it.     public func reteach() {         guard canReteach else { return }-        onReteach(site.hostname, site.mode == .articles)-    }--    // MARK: - Articles switch (Req 6.3, 6.4)--    /// Projects the switch and raises its confirmation. Nothing is written.-    public func requestArticlesSwitch() async {-        guard canSwitchToArticles, !isSubmitting else { return }-        errorMessage = nil-        do {-            present(try await library.projectArticles(-                hostname: site.hostname, junkSuffixRule: nil))-        } catch {-            errorMessage = error.localizedDescription-            Self.logger.error(-                "Articles projection failed: \(String(describing: error), privacy: .public)")-        }-    }--    public func cancelArticlesSwitch() {-        articlesPrompt = nil-    }--    /// Commits the projected contract — the same one teach mode commits, so the-    /// retroactive semantics are identical by construction (Req 6.4).-    ///-    /// The contract comes from the prompt the dialog rendered, never from this-    /// model: SwiftUI has already run the dismissal by the time this action-    /// fires (see `ArticlesPrompt`).-    public func confirmArticlesSwitch(_ prompt: ArticlesPrompt) async {-        guard !isSubmitting else { return }-        isSubmitting = true-        errorMessage = nil-        defer { isSubmitting = false }--        do {-            switch try await library.commitArticles(prompt.contract) {-            case .committed:-                articlesPrompt = nil-                didSwitchToArticles = true-                await onMutation()-            case .refreshed(let fresh):-                // The confirmation named a count; something moved under it, so-                // the reader answers the current one rather than the old one.-                present(fresh)-                errorMessage =-                    "This site changed while you were deciding. Check what will happen and "-                    + "confirm again."-            case .invalidated(let reason):-                errorMessage = reason-            }-        } catch {-            errorMessage = error.localizedDescription-            Self.logger.error(-                "Articles commit failed: \(String(describing: error), privacy: .public)")-        }-    }--    private func present(_ contract: ArticlesContract) {-        articlesPrompt = ArticlesPrompt(-            contract: contract,-            entryCount: contract.outcome.plan.entryProjections.count)+        onReteach(site.hostname)     } } @@ -335,7 +239,6 @@ enum SiteModePresentation {         switch mode {         case .untaught: "Not taught"         case .taught: "Taught"-        case .articles: "Articles"         }     } }
Asterism/Asterism/ViewModels/WorkTypesModels.swift Modified +4 / -5
diff --git a/Asterism/Asterism/ViewModels/WorkTypesModels.swift b/Asterism/Asterism/ViewModels/WorkTypesModels.swiftindex dd042b38..9adc4e88 100644--- a/Asterism/Asterism/ViewModels/WorkTypesModels.swift+++ b/Asterism/Asterism/ViewModels/WorkTypesModels.swift@@ -161,11 +161,10 @@ public final class WorkTypeDetailModel {      /// What the removal confirmation is offering.     ///-    /// The count rides **on the presented value**, not beside it in the model,-    /// for the reason `SiteDetailModel.ArticlesPrompt` records: SwiftUI runs a-    /// dialog's `isPresented` setter — the dismissal — *before* it runs the-    /// tapped button's action, so a confirm that re-read a model property found-    /// it already cleared and committed nothing, silently.+    /// The count rides **on the presented value**, not beside it in the model:+    /// SwiftUI runs a dialog's `isPresented` setter — the dismissal — *before*+    /// it runs the tapped button's action, so a confirm that re-read a model+    /// property found it already cleared and committed nothing, silently.     public struct RemovalPrompt: Identifiable, Equatable, Sendable {         public let id: UUID         public let name: String
Asterism/Asterism/Views/ComposedTeachingView.swift Modified +15 / -88
diff --git a/Asterism/Asterism/Views/ComposedTeachingView.swift b/Asterism/Asterism/Views/ComposedTeachingView.swiftindex 3cff1ac8..4a77fb47 100644--- a/Asterism/Asterism/Views/ComposedTeachingView.swift+++ b/Asterism/Asterism/Views/ComposedTeachingView.swift@@ -66,17 +66,13 @@ struct ComposedTeachingView: View {             EmptyView()         case .ready, .previewing, .previewReady:             editorContent-            if model.articlesRequested {-                articlesConfirmButton-            } else {-                // Req 1.8: the reason the commit is refused sits where the-                // commit control does, so a collapsed disclosure cannot hide it.-                if let message = model.urlAnchoringPendingMessage {-                    urlAnchoringPendingRow(message)-                }-                if model.state == .previewReady || model.state == .previewing {-                    confirmButton-                }+            // Req 1.8: the reason the commit is refused sits where the commit+            // control does, so a collapsed disclosure cannot hide it.+            if let message = model.urlAnchoringPendingMessage {+                urlAnchoringPendingRow(message)+            }+            if model.state == .previewReady || model.state == .previewing {+                confirmButton             }         }     }@@ -86,19 +82,14 @@ struct ComposedTeachingView: View {     @ViewBuilder     private var editorContent: some View {         titleExampleSection-        if model.articlesRequested {-            articlesConfirmation-        } else {-            // rule-suggestion Req 6.1: the on-request action is the first-            // actionable thing on the screen, above the selection it fills in —-            // beside the commit control it went unnoticed.-            suggestRow-            titleChipSelector-            urlDisclosure-            if let outcome = model.previewOutcome {-                previewSection(outcome)-            }-            articlesAffordance+        // rule-suggestion Req 6.1: the on-request action is the first+        // actionable thing on the screen, above the selection it fills in —+        // beside the commit control it went unnoticed.+        suggestRow+        titleChipSelector+        urlDisclosure+        if let outcome = model.previewOutcome {+            previewSection(outcome)         }     } @@ -307,70 +298,6 @@ struct ComposedTeachingView: View {         }     } -    // MARK: - Articles affordance (Req 8.7)--    /// Articles is a one-way Site transition, not a title rule form, so it sits-    /// apart from title selection with its own confirmation of the consequences.-    @ViewBuilder-    private var articlesAffordance: some View {-        if model.supportsArticles {-            VStack(alignment: .leading, spacing: 8) {-                Divider()-                Text("Not a site with chapters?").font(.caption).foregroundStyle(.secondary)-                Button("Treat every page as an article") { model.requestArticles() }-                    .font(.footnote)-                    .frame(minHeight: AsterismLayout.minHitTarget)-                    .accessibilityIdentifier("composed-articles-affordance")-            }-            .frame(maxWidth: .infinity, alignment: .leading)-        }-    }--    private var articlesConfirmation: some View {-        VStack(alignment: .leading, spacing: 12) {-            Label("Treat every page as an article", systemImage: "doc.plaintext")-                .font(.subheadline.weight(.semibold))-            Text("This retires the site's title rule and its URL rule. Entries stop being chapters of a Work and stand on their own.")-                .font(.footnote).foregroundStyle(.secondary)-            Stepper("Remove last \(model.junkSuffixSegmentCount) title segment(s)",-                    value: Binding(get: { model.junkSuffixSegmentCount },-                                   set: { model.setJunkSuffixSegmentCount($0) }),-                    in: 0...max(0, model.titleSegments.count - 1))-                .frame(minHeight: AsterismLayout.minHitTarget)-                .accessibilityIdentifier("composed-articles-stepper")-            if let message = model.articleValidationMessage {-                Text(message).font(.caption).foregroundStyle(AsterismColors.amberText)-            }-            if let count = model.articlesPreviewEntryCount {-                Text("^[\(count) entry](inflect: true) will become independent articles.")-                    .font(.footnote)-                    .accessibilityIdentifier("composed-articles-preview")-            }-            Button("Keep teaching a title instead") { model.cancelArticles() }-                .font(.footnote)-                .frame(minHeight: AsterismLayout.minHitTarget)-                .accessibilityIdentifier("composed-articles-cancel")-        }-        .padding(12)-        // §4: flat field fill for content inside a sheet.-        .constellationField(cornerRadius: AsterismLayout.cardRadius)-        .accessibilityElement(children: .contain)-        .accessibilityIdentifier("composed-articles-confirmation")-    }--    private var articlesConfirmButton: some View {-        Button {-            Task { await model.confirmArticles() }-        } label: {-            Text("Turn on Articles mode")-                .font(.headline)-                .frame(maxWidth: .infinity, minHeight: AsterismLayout.minHitTarget)-        }-        .buttonStyle(.constellationPrimary)-        .disabled(!model.canConfirmArticles)-        .accessibilityIdentifier("composed-articles-confirm")-    }-     // MARK: - URL details disclosure (Req 8.2, 8.4)      private var urlDisclosure: some View {
Asterism/Asterism/Views/EntryDetailView.swift Modified +1 / -1
diff --git a/Asterism/Asterism/Views/EntryDetailView.swift b/Asterism/Asterism/Views/EntryDetailView.swiftindex 94dc2ffa..95df87f5 100644--- a/Asterism/Asterism/Views/EntryDetailView.swift+++ b/Asterism/Asterism/Views/EntryDetailView.swift@@ -246,7 +246,7 @@ struct EntryDetailView: View {         // built from, because SwiftUI runs the dismissal below — which clears         // the model — before it runs the tapped action. The house pattern, for         // the third time (`WorkDetailModel.WorkDeletionPrompt`,-        // `SiteDetailModel.ArticlesPrompt`).+        // `WorkTypeDetailModel.RemovalPrompt`).         .confirmationDialog(             "Delete this entry?",             isPresented: Binding(
Asterism/Asterism/Views/SitesView.swift Modified +5 / -44
diff --git a/Asterism/Asterism/Views/SitesView.swift b/Asterism/Asterism/Views/SitesView.swiftindex aca94b2f..a384dfd2 100644--- a/Asterism/Asterism/Views/SitesView.swift+++ b/Asterism/Asterism/Views/SitesView.swift@@ -97,22 +97,20 @@ struct SitesListView: View {         .accessibilityLabel("\(row.displayName), \(row.workCountLabel), \(row.modeLabel)")     } -    /// An untaught site has nothing behind it yet and an articles site is-    /// deliberately not a work — both read as the flat, dim glyphs (9.2).+    /// An untaught site has nothing behind it yet, so it reads as the flat, dim+    /// glyph (9.2).     private func glyphKind(_ mode: SiteMode) -> SiteGlyphKind {         switch mode {         case .untaught: .unknown-        case .articles: .articles         case .taught: .site         }     } } -/// One site's screen (Reqs 6.2–6.4): what mode it is in, the re-teach route,-/// and the one-way switch to articles.+/// One site's screen (Req 6.2): what mode it is in, its name, and the re-teach+/// route. struct SiteDetailView: View {     @State private var model: SiteDetailModel-    @Environment(\.dismiss) private var dismiss      init(model: SiteDetailModel) {         _model = State(initialValue: model)@@ -166,9 +164,7 @@ struct SiteDetailView: View {             }              Section {-                // Req 9.1: this screen's one gradient control. The articles-                // switch below it is deliberately not — it is a one-way change-                // the reader should have to mean.+                // Req 9.1: this screen's one gradient control.                 Button(model.reteachLabel) { model.reteach() }                     .buttonStyle(.constellationPrimary)                     .disabled(!model.canReteach)@@ -183,15 +179,6 @@ struct SiteDetailView: View {                         .foregroundStyle(.secondary)                         .accessibilityIdentifier("site-detail-reteach-unavailable")                 }--                if model.canSwitchToArticles {-                    Button("Treat every page as an article") {-                        Task { await model.requestArticlesSwitch() }-                    }-                    .buttonStyle(.constellationSecondary)-                    .disabled(model.isSubmitting)-                    .accessibilityIdentifier("site-detail-articles-button")-                }             }              if let message = model.errorMessage {@@ -208,31 +195,5 @@ struct SiteDetailView: View {         .navigationTitle(model.currentName)         .inlineNavigationTitle()         .accessibilityIdentifier("site-detail-view")-        // The consequences, then the choice — the same shape teach mode's own-        // articles confirmation has, and the same contracts underneath (6.4).-        .confirmationDialog(-            "Treat every page as an article?",-            isPresented: Binding(-                get: { model.articlesPrompt != nil },-                set: { if !$0 { model.cancelArticlesSwitch() } }),-            presenting: model.articlesPrompt-        ) { prompt in-            // The prompt is taken as a parameter, not re-read from the model:-            // SwiftUI runs the dismissal below before this action (see-            // `SiteDetailModel.ArticlesPrompt`).-            Button("Turn on Articles mode", role: .destructive) {-                Task { await model.confirmArticlesSwitch(prompt) }-            }-            .accessibilityIdentifier("site-detail-articles-confirm")-            Button("Cancel", role: .cancel) { model.cancelArticlesSwitch() }-                .accessibilityIdentifier("site-detail-articles-cancel")-        } message: { prompt in-            Text(prompt.message)-        }-        // The screen holds an immutable snapshot, so once the mode has changed-        // everything on it describes the site as it was. Back to the list.-        .onChange(of: model.didSwitchToArticles) { _, switched in-            if switched { dismiss() }-        }     } }
Asterism/Asterism/Views/WorkTypesView.swift Modified +1 / -2
diff --git a/Asterism/Asterism/Views/WorkTypesView.swift b/Asterism/Asterism/Views/WorkTypesView.swiftindex 05e96eee..8ec0f3de 100644--- a/Asterism/Asterism/Views/WorkTypesView.swift+++ b/Asterism/Asterism/Views/WorkTypesView.swift@@ -174,8 +174,7 @@ struct WorkTypeDetailView: View {                     .accessibilityIdentifier("work-type-detail-usage")                  // Not a gradient control: removal takes away a future choice,-                // and the reader should have to mean it (the articles-switch-                // precedent).+                // and the reader should have to mean it.                 Button("Remove from picker") { model.requestRemoval() }                     .buttonStyle(.constellationSecondary)                     .disabled(model.isSubmitting)
Asterism/Asterism/Views/WorksView.swift Modified +1 / -1
diff --git a/Asterism/Asterism/Views/WorksView.swift b/Asterism/Asterism/Views/WorksView.swiftindex 7f1450c7..7af5fa8a 100644--- a/Asterism/Asterism/Views/WorksView.swift+++ b/Asterism/Asterism/Views/WorksView.swift@@ -1084,7 +1084,7 @@ struct UnattachedEntryRow: View {             HStack(spacing: 6) {                 // §7's dim ✎ glyph marks the group; an unattached entry has no                 // taught identity to colour a site glyph with.-                SiteGlyph(hostname: entry.hostname, kind: .articles, size: 18)+                SiteGlyph(hostname: entry.hostname, kind: .unattached, size: 18)                     .accessibilityIdentifier("entry-hostname")                 Spacer()                 if let rating = entry.rating {
Asterism/AsterismShareExtension/CaptureView.swift Modified +3 / -17
diff --git a/Asterism/AsterismShareExtension/CaptureView.swift b/Asterism/AsterismShareExtension/CaptureView.swiftindex d2b71f78..e43709ca 100644--- a/Asterism/AsterismShareExtension/CaptureView.swift+++ b/Asterism/AsterismShareExtension/CaptureView.swift@@ -223,20 +223,6 @@ struct CaptureView: View {     @ViewBuilder     private func projectedMetadataSection(outcome: CaptureOutcome) -> some View {         VStack(alignment: .leading, spacing: 8) {-            if let displayTitle = outcome.displayTitle {-                HStack(spacing: 6) {-                    Image(systemName: "doc.text")-                        .font(.caption)-                        .foregroundStyle(.secondary)-                        .accessibilityHidden(true)-                    Text("Article: \(displayTitle)")-                        .font(.subheadline)-                }-                .accessibilityElement(children: .combine)-                .accessibilityLabel("Article title: \(displayTitle)")-                .accessibilityIdentifier("capture.articleTitle")-            }-             // Work information — above the chapter: the work names what the             // capture belongs to, the chapter locates it within (Q13).             if let workTitle = outcome.projectedWorkTitle {@@ -263,7 +249,7 @@ struct CaptureView: View {                 .accessibilityElement(children: .combine)                 .accessibilityLabel(workDescription)                 .accessibilityIdentifier("capture.projectedWork")-            } else if outcome.projectedChapter == nil, !outcome.intentionallyUnattached {+            } else if outcome.projectedChapter == nil {                 // Parse failure — no work from parse                 HStack(spacing: 6) {                     Image(systemName: "exclamationmark.circle")@@ -298,12 +284,12 @@ struct CaptureView: View {                         .font(.caption)                         .foregroundStyle(.secondary)                         .accessibilityHidden(true)-                    Text(outcome.intentionallyUnattached ? "Independent article" : "No chapter parsed from title")+                    Text("No chapter parsed from title")                         .font(.subheadline)                         .foregroundStyle(.secondary)                 }                 .accessibilityElement(children: .combine)-                .accessibilityLabel(outcome.intentionallyUnattached ? "Independent article" : "No chapter parsed from title")+                .accessibilityLabel("No chapter parsed from title")                 .accessibilityIdentifier("capture.noChapter")             } 
Asterism/AsterismTests/AppNavigationTests.swift Modified +1 / -3
diff --git a/Asterism/AsterismTests/AppNavigationTests.swift b/Asterism/AsterismTests/AppNavigationTests.swiftindex 77d05e00..745a0b9e 100644--- a/Asterism/AsterismTests/AppNavigationTests.swift+++ b/Asterism/AsterismTests/AppNavigationTests.swift@@ -849,13 +849,11 @@ struct AppNavigationTests {     @Test("the re-teach route hands the hostname to the teaching sheet once")     func pendingReteachPresentsOnce() {         let navigation = AppNavigation()-        navigation.pendingRoute = .reteach(-            PendingReteach(hostname: "royalroad.com", permitsArticlesConversion: true))+        navigation.pendingRoute = .reteach(PendingReteach(hostname: "royalroad.com"))          navigation.takePendingRoute(in: .empty)          #expect(navigation.showingTeachingForHostname?.hostname == "royalroad.com")-        #expect(navigation.showingTeachingForHostname?.permitsArticlesConversion == true)         #expect(navigation.pendingRoute == nil)          // Taken once: a second drain has nothing left to do.
Asterism/AsterismTests/BackupExportStageTests.swift Modified +16 / -16
diff --git a/Asterism/AsterismTests/BackupExportStageTests.swift b/Asterism/AsterismTests/BackupExportStageTests.swiftindex c9023a11..198bd0f9 100644--- a/Asterism/AsterismTests/BackupExportStageTests.swift+++ b/Asterism/AsterismTests/BackupExportStageTests.swift@@ -48,7 +48,7 @@ struct BackupExportStageTests {     @MainActor func tornRefusalRoutesToCheckLibrary() async {         let exporter = RecordingBackupExporter()         exporter.exportResult = .failure(-            BackupV14ExportError.tornGroups(+            BackupV15ExportError.tornGroups(                 TornGroupsPayload(count: 3, blockingWorkSet: nil)))         let stage = BackupExportStage(exporter: exporter) @@ -68,14 +68,14 @@ struct BackupExportStageTests {     /// Every other refusal is either transient or a state no screen can act on,     /// and a button routing to neither is worse than no button.     @Test("Every other refusal has a message and no route", arguments: [-        BackupV14ExportError.referencesStillArriving(detail: "rule 1"),-        BackupV14ExportError.unrepresentableValue(+        BackupV15ExportError.referencesStillArriving(detail: "rule 1"),+        BackupV15ExportError.unrepresentableValue(             record: "Character", field: "factsData", value: "…"),-        BackupV14ExportError.snapshotFailed(reason: "read"),-        BackupV14ExportError.encodingFailed(reason: "encode"),-        BackupV14ExportError.stagingFailed(reason: "stage"),+        BackupV15ExportError.snapshotFailed(reason: "read"),+        BackupV15ExportError.encodingFailed(reason: "encode"),+        BackupV15ExportError.stagingFailed(reason: "stage"),     ])-    @MainActor func otherRefusalsOfferNoRoute(error: BackupV14ExportError) async {+    @MainActor func otherRefusalsOfferNoRoute(error: BackupV15ExportError) async {         let exporter = RecordingBackupExporter()         exporter.exportResult = .failure(error)         let stage = BackupExportStage(exporter: exporter)@@ -100,9 +100,9 @@ struct BackupExportStageTests {     @MainActor func coverRefusalNamesTheWorkAndNothingElse() async {         let exporter = RecordingBackupExporter()         exporter.exportResult = .failure(-            BackupV14ExportError.unrepresentableValue(+            BackupV15ExportError.unrepresentableValue(                 record: "Work “Actual Title”",-                field: BackupV14ExportError.thumbnailField,+                field: BackupV15ExportError.thumbnailField,                 value: "17 bytes that are not a portrait cover"))         let stage = BackupExportStage(exporter: exporter) @@ -129,9 +129,9 @@ struct BackupExportStageTests {     @Test("The logged category names the field, never the record")     @MainActor func diagnosticCategoryCarriesNoReaderContent() {         let cover = BackupExportStage.diagnosticCategory(-            for: BackupV14ExportError.unrepresentableValue(+            for: BackupV15ExportError.unrepresentableValue(                 record: "Work “Actual Title”",-                field: BackupV14ExportError.thumbnailField,+                field: BackupV15ExportError.thumbnailField,                 value: "17 bytes that are not a portrait cover"))          #expect(cover == "export: unrepresentable thumbnail")@@ -141,7 +141,7 @@ struct BackupExportStageTests {         // The same hole the cover arm would have opened has been standing on         // the site arm since the refusal was written.         let site = BackupExportStage.diagnosticCategory(-            for: BackupV14ExportError.unrepresentableValue(+            for: BackupV15ExportError.unrepresentableValue(                 record: "Site reader.example", field: "mode", value: "hexagonal"))          #expect(site == "export: unrepresentable mode")@@ -151,7 +151,7 @@ struct BackupExportStageTests {         // The refusals that name no record keep their whole description: a         // count and a route carry nothing of the reader's.         let torn = BackupExportStage.diagnosticCategory(-            for: BackupV14ExportError.tornGroups(+            for: BackupV15ExportError.tornGroups(                 TornGroupsPayload(count: 2, blockingWorkSet: nil)))         #expect(torn.hasPrefix("export: "))         #expect(torn.contains("2 records"))@@ -235,7 +235,7 @@ private struct TemporaryStaging { }  /// Records what the stage asked of the exporter, and — unlike the backup row's-/// mock — removes the staged file on cleanup, as `BackupV14Exporter` does.+/// mock — removes the staged file on cleanup, as `BackupV15Exporter` does. private final class RecordingBackupExporter: BackupExporting, @unchecked Sendable {     var exportCallCount = 0     var cleanupCallCount = 0@@ -243,9 +243,9 @@ private final class RecordingBackupExporter: BackupExporting, @unchecked Sendabl     var lastCleanupURL: URL?      var exportResult: Result<BackupExportResult, Error> = .failure(-        BackupV14ExportError.snapshotFailed(reason: "not configured"))+        BackupV15ExportError.snapshotFailed(reason: "not configured")) -    func export(metadata: BackupV14Metadata) async throws -> BackupExportResult {+    func export(metadata: BackupV15Metadata) async throws -> BackupExportResult {         exportCallCount += 1         return try exportResult.get()     }
Asterism/AsterismTests/ComposedTeachingViewModelTests.swift Modified +1 / -52
diff --git a/Asterism/AsterismTests/ComposedTeachingViewModelTests.swift b/Asterism/AsterismTests/ComposedTeachingViewModelTests.swiftindex e95db5b4..80929e28 100644--- a/Asterism/AsterismTests/ComposedTeachingViewModelTests.swift+++ b/Asterism/AsterismTests/ComposedTeachingViewModelTests.swift@@ -49,15 +49,6 @@ struct ComposedTeachingViewModelTests {             definition: .sequence(locator: .query(name: ExactScalarString("chapter"))))     } -    private static func makeArticlesContract() -> ArticlesContract {-        ArticlesContract(-            basis: TeachingBasis(-                siteMode: .untaught, hostname: hostname, patterns: [], entries: [], works: []),-            request: ArticlesRequest(junkSuffixRule: nil),-            outcome: ArticlesOutcome(-                plan: TitleProjectionPlanner.planArticles(entries: [], junkSuffixRule: nil)))-    }-     /// A retained rule that sources a chapter, so the chapter-remedy auto-expand     /// (Req 8.2 as amended) does not fire and the disclosure default is testable.     private static func chapterBearingContract() throws -> ComposedTeachingContract {@@ -77,8 +68,6 @@ struct ComposedTeachingViewModelTests {         let c = contract ?? Self.makeContract()         mock.projectComposedTeachingResult = .success(c)         mock.commitComposedTeachingResult = .success(commitOutcome)-        mock.projectArticlesResult = .success(Self.makeArticlesContract())-        mock.commitArticlesResult = .success(.committed)         let vm = ComposedTeachingViewModel(             entry: entry ?? Self.makeEntry(), library: mock, capabilities: .multiSite,             entryContext: entryContext, onMutation: {}, suggestions: suggestions)@@ -659,46 +648,6 @@ struct ComposedTeachingViewModelTests {         #expect(vm.effectiveTitleRule?.definition == .wholeTitle)     } -    // MARK: - Articles affordance (Req 8.7)--    @Test("Articles is not a title form: it projects and commits through its own contract")-    func articlesCommitsThroughArticlesContract() async throws {-        let (vm, mock) = makeSUT()-        await vm.load()-        try await Task.sleep(for: .milliseconds(30))--        vm.requestArticles()-        try await Task.sleep(for: .milliseconds(30))--        #expect(vm.articlesRequested)-        #expect(mock.projectArticlesCallCount >= 1)-        #expect(vm.articlesPreviewEntryCount == 0)-        #expect(!vm.canConfirm)-        #expect(vm.canConfirmArticles)--        await vm.confirmArticles()--        #expect(vm.state == .committed)-        #expect(mock.commitArticlesCallCount == 1)-        #expect(mock.commitComposedTeachingCallCount == 0)-    }--    @Test("Cancelling the Articles confirmation returns to title selection")-    func cancelArticlesReturnsToTitleSelection() async throws {-        let (vm, mock) = makeSUT()-        await vm.load()-        vm.requestArticles()-        try await Task.sleep(for: .milliseconds(30))--        vm.cancelArticles()-        try await Task.sleep(for: .milliseconds(30))--        #expect(!vm.articlesRequested)-        #expect(vm.articlesPreviewEntryCount == nil)-        #expect(mock.commitArticlesCallCount == 0)-        #expect(vm.state == .previewReady)-    }-     // MARK: - Re-teach restores the Site's retained title rule (Req 1.3)      private static func titleRuleBasis(@@ -1467,7 +1416,7 @@ struct ComposedTeachingViewModelTests {         #expect(vm.state == .previewReady)     } -    @Test("The Suggest action is offered only while the model is available and the Site is not articles")+    @Test("The Suggest action is offered only while the model is available")     func suggestActionVisibility() async throws {         let (available, _) = await makeCoordinator()         let (shown, _) = makeSUT(entry: Self.suggestionEntry(), suggestions: available)
Asterism/AsterismTests/EmptyLibraryModelTests.swift Modified +6 / -6
diff --git a/Asterism/AsterismTests/EmptyLibraryModelTests.swift b/Asterism/AsterismTests/EmptyLibraryModelTests.swiftindex f3c655d0..26749997 100644--- a/Asterism/AsterismTests/EmptyLibraryModelTests.swift+++ b/Asterism/AsterismTests/EmptyLibraryModelTests.swift@@ -158,7 +158,7 @@ struct EmptyLibraryModelTests {     func aTornRefusalRoutesToCheckLibrary() async {         let harness = Harness()         harness.exporter.exportResult = .failure(-            BackupV14ExportError.tornGroups(TornGroupsPayload(count: 3, blockingWorkSet: nil)))+            BackupV15ExportError.tornGroups(TornGroupsPayload(count: 3, blockingWorkSet: nil)))          await harness.confirm() @@ -175,7 +175,7 @@ struct EmptyLibraryModelTests {     func anUnroutedRefusalOffersNoRoute() async {         let harness = Harness()         harness.exporter.exportResult = .failure(-            BackupV14ExportError.referencesStillArriving(detail: "rule 1"))+            BackupV15ExportError.referencesStillArriving(detail: "rule 1"))          await harness.confirm() @@ -397,7 +397,7 @@ struct EmptyLibraryModelTests {         harness.model.cancelConfirmation()          harness.exporter.exportResult = .failure(-            BackupV14ExportError.encodingFailed(reason: "encode"))+            BackupV15ExportError.encodingFailed(reason: "encode"))         await harness.confirm()         #expect(harness.failureMessage != nil) @@ -568,14 +568,14 @@ private actor PassGate { }  /// Records what the stage asked of the exporter, and removes the staged file on-/// cleanup as `BackupV14Exporter` does.+/// cleanup as `BackupV15Exporter` does. private final class RecordingBackupExporter: BackupExporting, @unchecked Sendable {     var exportCallCount = 0     var cleanupCallCount = 0     var exportResult: Result<BackupExportResult, Error> = .failure(-        BackupV14ExportError.snapshotFailed(reason: "not configured"))+        BackupV15ExportError.snapshotFailed(reason: "not configured")) -    func export(metadata: BackupV14Metadata) async throws -> BackupExportResult {+    func export(metadata: BackupV15Metadata) async throws -> BackupExportResult {         exportCallCount += 1         return try exportResult.get()     }
Asterism/AsterismTests/EntryDetailModelTests.swift Modified +3 / -3
diff --git a/Asterism/AsterismTests/EntryDetailModelTests.swift b/Asterism/AsterismTests/EntryDetailModelTests.swiftindex 9f962ad9..8c5de0ca 100644--- a/Asterism/AsterismTests/EntryDetailModelTests.swift+++ b/Asterism/AsterismTests/EntryDetailModelTests.swift@@ -331,7 +331,7 @@ struct EntryDetailModelTests {     }      /// The order SwiftUI actually uses, and the bug it caused twice in this app-    /// (`WorkDetailModel.WorkDeletionPrompt`, `SiteDetailModel.ArticlesPrompt`):+    /// (`WorkDetailModel.WorkDeletionPrompt`, `WorkTypeDetailModel.RemovalPrompt`):     /// tapping a confirmation-dialog button dismisses the dialog first — running     /// the `isPresented` setter, which is `cancelDelete()` — and only then runs     /// the button's action. An action that re-read model state would find it@@ -450,14 +450,14 @@ struct EntryDetailModelTests {     @MainActor func headingFallsBackToTheSequence() async {         let entry = TestFixtures.makeEntry(captureTitle: "Raw capture", chapterSequence: "14")         let (model, _, _) = makeSUT(-            entry: entry, detail: Self.detail(for: entry, displayTitle: "Cleaned capture"))+            entry: entry, detail: Self.detail(for: entry, displayTitle: "Trimmed capture"))          await model.load()          #expect(model.titleCardHeading == "14")     } -    @Test("With no parsed chapter the heading is the cleaned capture title")+    @Test("With no parsed chapter the heading is the trimmed capture title")     @MainActor func headingFallsBackToThePresentationTitle() async {         let entry = TestFixtures.makeEntry(captureTitle: "Raw capture - HostSite")         let (model, _, _) = makeSUT(
Asterism/AsterismTests/Helpers/MockLibraryProvider.swift Modified +0 / -18
diff --git a/Asterism/AsterismTests/Helpers/MockLibraryProvider.swift b/Asterism/AsterismTests/Helpers/MockLibraryProvider.swiftindex a7cb01dd..59135779 100644--- a/Asterism/AsterismTests/Helpers/MockLibraryProvider.swift+++ b/Asterism/AsterismTests/Helpers/MockLibraryProvider.swift@@ -468,13 +468,6 @@ final class MockLibraryProvider: LibraryProviding, @unchecked Sendable {     var commitTeachingCallCount = 0     var lastCommittedTeachingContract: TeachingContract? -    var projectArticlesResult: Result<ArticlesContract, Error> = .failure(MockError.notConfigured)-    var projectArticlesCallCount = 0--    var commitArticlesResult: Result<ArticlesCommitOutcome, Error> = .failure(MockError.notConfigured)-    var commitArticlesCallCount = 0-    var lastCommittedArticlesContract: ArticlesContract?-     var projectReparseResult: Result<ReparseContract, Error> = .failure(MockError.notConfigured)     var projectReparseCallCount = 0 @@ -612,17 +605,6 @@ final class MockLibraryProvider: LibraryProviding, @unchecked Sendable {         return try commitTeachingResult.get()     } -    func projectArticles(hostname: String, junkSuffixRule: JunkSuffixRule?) async throws -> ArticlesContract {-        projectArticlesCallCount += 1-        return try projectArticlesResult.get()-    }--    func commitArticles(_ contract: ArticlesContract) async throws -> ArticlesCommitOutcome {-        commitArticlesCallCount += 1-        lastCommittedArticlesContract = contract-        return try commitArticlesResult.get()-    }-     func projectReparse(entryID: UUID) async throws -> ReparseContract {         projectReparseCallCount += 1         return try projectReparseResult.get()
Asterism/AsterismTests/IntegrationSafetyNetTests.swift Modified +17 / -82
diff --git a/Asterism/AsterismTests/IntegrationSafetyNetTests.swift b/Asterism/AsterismTests/IntegrationSafetyNetTests.swiftindex f26924e5..b3191332 100644--- a/Asterism/AsterismTests/IntegrationSafetyNetTests.swift+++ b/Asterism/AsterismTests/IntegrationSafetyNetTests.swift@@ -9,7 +9,7 @@ import AsterismCore // Owns: cross-target integration and safety-net tests. // Must not edit: production source or redesign feature contracts. // Covers: fill/replace setup, app/extension readiness, Backup V3, teaching,-// re-share, Work URL, Merge, articles, conflicts, corruption, accessibility,+// re-share, Work URL, Merge, conflicts, corruption, accessibility, // and obsolete-migration nonlinkage.  @Suite("Cross-target M3 integration safety net", .serialized)@@ -155,10 +155,10 @@ struct IntegrationSafetyNetTests {         )          let stagingDirectory = fixture.baseDirectory.appending(path: "validated-backups")-        let exporter = BackupV14Exporter(repository: repository, stagingDirectory: stagingDirectory)+        let exporter = BackupV15Exporter(repository: repository, stagingDirectory: stagingDirectory)         let exportedAt = Date(timeIntervalSince1970: 1_784_246_400)         let result = try await exporter.export(-            metadata: BackupV14Metadata(+            metadata: BackupV15Metadata(                 appBuild: "integration-1",                 exportedAt: exportedAt             )@@ -166,8 +166,8 @@ struct IntegrationSafetyNetTests {         defer { exporter.cleanup(result) }          let encoded = try Data(contentsOf: result.fileURL)-        let decoded = try BackupV14Codec.decode(encoded)-        let source = try await repository.backupV14Snapshot()+        let decoded = try BackupV15Codec.decode(encoded)+        let source = try await repository.backupV15Snapshot()          #expect(decoded.payload == source)         #expect(decoded.payload.entries.count == 1)@@ -247,7 +247,7 @@ struct IntegrationSafetyNetTests {                 // verdict, so the round-trip is reachable from the surface the                 // reader uses. The gate the file declares is still the running                 // one.-                let document = try BackupV14Codec.decode(Data(contentsOf: backupURL))+                let document = try BackupV15Codec.decode(Data(contentsOf: backupURL))                 #expect(document.capabilityGate == AsterismCapabilities.current.gate.rawValue)                 backup.handleShareCancellation()             }@@ -332,9 +332,9 @@ struct IntegrationSafetyNetTests {         try await sourceRepo.moveEntry(entry.id, to: .existing(work.id))          let stagingDir = fixture.baseDirectory.appending(path: "export-stage")-        let exporter = BackupV14Exporter(repository: sourceRepo, stagingDirectory: stagingDir)+        let exporter = BackupV15Exporter(repository: sourceRepo, stagingDirectory: stagingDir)         let exportResult = try await exporter.export(-            metadata: BackupV14Metadata(appBuild: "fill-test", exportedAt: Date())+            metadata: BackupV15Metadata(appBuild: "fill-test", exportedAt: Date())         )         defer { exporter.cleanup(exportResult) }         let backupData = try Data(contentsOf: exportResult.fileURL)@@ -397,9 +397,9 @@ struct IntegrationSafetyNetTests {             )         )         let stagingDir = fixture.baseDirectory.appending(path: "restore-stage")-        let exporter = BackupV14Exporter(repository: sourceRepo, stagingDirectory: stagingDir)+        let exporter = BackupV15Exporter(repository: sourceRepo, stagingDirectory: stagingDir)         let exportResult = try await exporter.export(-            metadata: BackupV14Metadata(appBuild: "restore-test", exportedAt: Date())+            metadata: BackupV15Metadata(appBuild: "restore-test", exportedAt: Date())         )         defer { exporter.cleanup(exportResult) }         let plan = try BackupImporter.plan(from: try Data(contentsOf: exportResult.fileURL))@@ -732,71 +732,6 @@ struct IntegrationSafetyNetTests {         }     } -    // MARK: - Articles transition (Req 8.11)--    @Test("Articles transition makes URL rule historical and restores conservative keys")-    func articlesTransitionRestoresConservativeKeys() async throws {-        let fixture = try IntegrationFixture()-        defer { fixture.cleanup() }-        let config = fixture.developmentConfiguration--        let repo = try await openAppRepository(config)-        let entry = try await repo.capture(-            CaptureDraft(-                captureTitle: "Work :: Chapter 1",-                captureTitleSource: .manual,-                rawURLString: "https://articles.test/series/novel/chapter/1"-            )-        )--        // Composed teaching: phrase title + Work-and-sequence URL rule.-        let urlRule = URLRuleDefinition.workAndSequence(-            work: URLFieldSelector(-                locator: .pathBracketed(-                    left: .literal(ExactScalarString("series")),-                    right: .literal(ExactScalarString("chapter"))-                )-            ),-            sequence: URLFieldSelector(-                locator: .pathBracketed(-                    left: .literal(ExactScalarString("chapter")),-                    right: .end-                )-            )-        )-        let teachContract = try await repo.projectComposedTeaching(-            hostname: "articles.test",-            request: ComposedTeachingRequest(-                titleDefinition: .phrase(prefix: "", separator: " :: ", suffix: "", order: .workThenChapter),-                urlDefinition: urlRule-            )-        )-        guard case .committed = try await repo.commitComposedTeaching(teachContract) else {-            Issue.record("Expected committed composed teaching")-            return-        }--        // Verify identity key changed from conservative-        let preArticles = try await repo.entry(id: entry.id)-        let preKey = preArticles.entryIdentityKey--        // Transition to articles-        let articlesContract = try await repo.projectArticles(-            hostname: "articles.test",-            junkSuffixRule: nil-        )-        let articlesResult = try await repo.commitArticles(articlesContract)-        guard case .committed = articlesResult else {-            Issue.record("Expected committed articles, got \(articlesResult)")-            return-        }--        // After articles: conservative key restored-        let postArticles = try await repo.entry(id: entry.id)-        // The key should change back to conservative (raw URL derived)-        #expect(postArticles.entryIdentityKey != preKey || postArticles.identityKeyVersion == 1)-    }-     // MARK: - URL teaching collision (Reqs 3.3, 3.4)      @Test("URL teaching with collision flags both Works without merging")@@ -906,15 +841,15 @@ struct IntegrationSafetyNetTests {         )          let stagingDir = fixture.baseDirectory.appending(path: "corrupt-stage")-        let exporter = BackupV14Exporter(repository: repo, stagingDirectory: stagingDir)+        let exporter = BackupV15Exporter(repository: repo, stagingDirectory: stagingDir)         let exportResult = try await exporter.export(-            metadata: BackupV14Metadata(appBuild: "corrupt-test", exportedAt: Date())+            metadata: BackupV15Metadata(appBuild: "corrupt-test", exportedAt: Date())         )         defer { exporter.cleanup(exportResult) }          // Verify good backup decodes         let goodData = try Data(contentsOf: exportResult.fileURL)-        let decoded = try BackupV14Codec.decode(goodData)+        let decoded = try BackupV15Codec.decode(goodData)         #expect(decoded.payload.entries.count == 1)          // Corrupt the data by flipping bytes in the payload area@@ -927,7 +862,7 @@ struct IntegrationSafetyNetTests {          // Corrupted backup should fail decode/checksum         do {-            _ = try BackupV14Codec.decode(corruptData)+            _ = try BackupV15Codec.decode(corruptData)             Issue.record("Expected corrupted backup to fail validation")         } catch {             // Expected: checksum or decode failure@@ -1014,13 +949,13 @@ struct IntegrationSafetyNetTests {          // Export the archive         let stagingDir = fixture.baseDirectory.appending(path: "url-backup-stage")-        let exporter = BackupV14Exporter(repository: repo, stagingDirectory: stagingDir)+        let exporter = BackupV15Exporter(repository: repo, stagingDirectory: stagingDir)         let exportResult = try await exporter.export(-            metadata: BackupV14Metadata(appBuild: "url-backup-test", exportedAt: Date())+            metadata: BackupV15Metadata(appBuild: "url-backup-test", exportedAt: Date())         )         defer { exporter.cleanup(exportResult) }         let backupData = try Data(contentsOf: exportResult.fileURL)-        let decoded = try BackupV14Codec.decode(backupData)+        let decoded = try BackupV15Codec.decode(backupData)          // Site should be present in the payload.         let site = decoded.payload.sites.first { $0.hostname == "backupurl.test" }
Asterism/AsterismTests/RuleSuggesterTests.swift Modified +7 / -3
diff --git a/Asterism/AsterismTests/RuleSuggesterTests.swift b/Asterism/AsterismTests/RuleSuggesterTests.swiftindex 866c9883..58ad5182 100644--- a/Asterism/AsterismTests/RuleSuggesterTests.swift+++ b/Asterism/AsterismTests/RuleSuggesterTests.swift@@ -339,11 +339,15 @@ struct RuleSuggesterTests {         #expect(mock.projectComposedRequests.count == 1)     } -    @Test("A basis read that throws — an articles Site — settles the attempt with nothing")-    func articlesBasisThrowYieldsNothing() async throws {+    /// The basis read comes before anything else the attempt does, so *any*+    /// throw from it settles the attempt with nothing and spends no model time.+    /// The error is a stand-in: what is pinned is the throw, not which one, so+    /// this case builds no particular library state behind it.+    @Test("A basis read that throws settles the attempt with nothing, model untouched")+    func basisReadThrowYieldsNothing() async throws {         let (suggester, _, stub) = makeSUT(             basisFailure: ComposedTeachingProjectionError.invalidTitleDefinition(-                reason: "articles"))+                reason: "the basis could not be projected"))          let result = try await suggester.attempt(hostname: Self.hostname)         #expect(result.suggestion == nil)
Asterism/AsterismTests/RuleSuggestionCoordinatorTests.swift Modified +1 / -2
diff --git a/Asterism/AsterismTests/RuleSuggestionCoordinatorTests.swift b/Asterism/AsterismTests/RuleSuggestionCoordinatorTests.swiftindex eb55e356..59d39ebf 100644--- a/Asterism/AsterismTests/RuleSuggestionCoordinatorTests.swift+++ b/Asterism/AsterismTests/RuleSuggestionCoordinatorTests.swift@@ -186,8 +186,7 @@ struct RuleSuggestionCoordinatorTests {             Self.candidate("newest.test", capturedAt: 50),             Self.candidate("middle.test", capturedAt: 30),             Self.candidate("second.test", capturedAt: 40),-            // Not auto-eligible: articles mode, no captures, both rules stored.-            Self.candidate("articles.test", capturedAt: 60, mode: .articles),+            // Not auto-eligible: no captures, both rules stored.             Self.candidate("empty.test", capturedAt: 70, entryCount: 0),             Self.candidate(                 "taught.test", capturedAt: 80, mode: .taught,
Asterism/AsterismTests/SettingsBackupModelTests.swift Modified +22 / -22
diff --git a/Asterism/AsterismTests/SettingsBackupModelTests.swift b/Asterism/AsterismTests/SettingsBackupModelTests.swiftindex 935614fc..502001ce 100644--- a/Asterism/AsterismTests/SettingsBackupModelTests.swift+++ b/Asterism/AsterismTests/SettingsBackupModelTests.swift@@ -213,7 +213,7 @@ struct SettingsBackupModelTests {     @MainActor func tornGroupsMessageStatesTheCount() async {         let mock = MockBackupExporting()         mock.exportResult = .failure(-            BackupV14ExportError.tornGroups(+            BackupV15ExportError.tornGroups(                 TornGroupsPayload(count: 3, blockingWorkSet: nil)))          let model = SettingsBackupModel(exporter: mock)@@ -234,7 +234,7 @@ struct SettingsBackupModelTests {     @MainActor func tornGroupsMessageReadsSingular() async {         let mock = MockBackupExporting()         mock.exportResult = .failure(-            BackupV14ExportError.tornGroups(+            BackupV15ExportError.tornGroups(                 TornGroupsPayload(count: 1, blockingWorkSet: nil)))          let model = SettingsBackupModel(exporter: mock)@@ -252,7 +252,7 @@ struct SettingsBackupModelTests {     @MainActor func tornGroupsMessagePointsAtTheBlockingWorkSet() async {         let mock = MockBackupExporting()         mock.exportResult = .failure(-            BackupV14ExportError.tornGroups(+            BackupV15ExportError.tornGroups(                 TornGroupsPayload(                     count: 1,                     blockingWorkSet: DuplicateSetKey(@@ -288,7 +288,7 @@ struct SettingsBackupModelTests {          let mock = MockBackupExporting()         mock.exportResult = .failure(-            BackupV14ExportError.tornGroups(+            BackupV15ExportError.tornGroups(                 TornGroupsPayload(count: 1, blockingWorkSet: nil)))         let model = SettingsBackupModel(exporter: mock)         await model.startExport()@@ -302,14 +302,14 @@ struct SettingsBackupModelTests {         #expect(!model.routesToCheckLibrary)     } -    // MARK: - Archive generation 14/15 (`work-thumbnails` Req 8.5)+    // MARK: - Archive generation 15/16 (`work-thumbnails` Req 8.5)      /// The Settings surface is the only place the app *writes* an archive, so a     /// seam left asking for an older generation than the repository writes would     /// leave the round-trip `multi-site-works` Req 9.2 promises unreachable. The     /// metadata type is the tell: the exporter this model holds is the one whose     /// payload carries the creator, role and credit tables.-    @Test("The export surface asks the 14/15 exporter for the archive")+    @Test("The export surface asks the 15/16 exporter for the archive")     @MainActor func exportsArchiveGenerationNineTen() async {         let tempDir = FileManager.default.temporaryDirectory.appending(path: UUID().uuidString)         try? FileManager.default.createDirectory(at: tempDir, withIntermediateDirectories: true)@@ -323,7 +323,7 @@ struct SettingsBackupModelTests {         let model = SettingsBackupModel(exporter: mock)         await model.startExport() -        let metadata: BackupV14Metadata? = mock.lastMetadata+        let metadata: BackupV15Metadata? = mock.lastMetadata         #expect(metadata != nil)         #expect(metadata?.appBuild.isEmpty == false)     }@@ -331,14 +331,14 @@ struct SettingsBackupModelTests {     /// Req 6.5, through Q105: a torn **character** group refuses the export the     /// same way a torn Work or Entry does, and the reader is sent to the same     /// place. The payload carries a count, not a record kind, so what this pins-    /// is that the 14/15 refusal reaches a message arm at all — an unhandled case+    /// is that the 15/16 refusal reaches a message arm at all — an unhandled case     /// would fall through to the generic "please try again", which is the dead     /// end Decision 20 already removed once.-    @Test("A 14/15 torn refusal routes the reader to Check Library")+    @Test("A 15/16 torn refusal routes the reader to Check Library")     @MainActor func nineTenTornRefusalRoutes() async {         let mock = MockBackupExporting()         mock.exportResult = .failure(-            BackupV14ExportError.tornGroups(+            BackupV15ExportError.tornGroups(                 TornGroupsPayload(count: 2, blockingWorkSet: nil)))          let model = SettingsBackupModel(exporter: mock)@@ -351,18 +351,18 @@ struct SettingsBackupModelTests {         #expect(model.routesToCheckLibrary)     } -    /// Every case of the 14/15 refusal has a message of its own. A case that fell+    /// Every case of the 15/16 refusal has a message of its own. A case that fell     /// through to the default arm would be indistinguishable from an error the     /// app has never heard of.-    @Test("Every 14/15 export refusal has its own message", arguments: [-        BackupV14ExportError.referencesStillArriving(detail: "rule 1"),-        BackupV14ExportError.unrepresentableValue(+    @Test("Every 15/16 export refusal has its own message", arguments: [+        BackupV15ExportError.referencesStillArriving(detail: "rule 1"),+        BackupV15ExportError.unrepresentableValue(             record: "Character", field: "factsData", value: "…"),-        BackupV14ExportError.snapshotFailed(reason: "read"),-        BackupV14ExportError.encodingFailed(reason: "encode"),-        BackupV14ExportError.stagingFailed(reason: "stage"),+        BackupV15ExportError.snapshotFailed(reason: "read"),+        BackupV15ExportError.encodingFailed(reason: "encode"),+        BackupV15ExportError.stagingFailed(reason: "stage"),     ])-    @MainActor func everyNineTenRefusalHasAMessage(error: BackupV14ExportError) async {+    @MainActor func everyNineTenRefusalHasAMessage(error: BackupV15ExportError) async {         let mock = MockBackupExporting()         mock.exportResult = .failure(error) @@ -389,9 +389,9 @@ struct SettingsBackupModelTests {     @MainActor func coverRefusalNamesTheWork() async {         let mock = MockBackupExporting()         mock.exportResult = .failure(-            BackupV14ExportError.unrepresentableValue(+            BackupV15ExportError.unrepresentableValue(                 record: "Work “Actual Title”",-                field: BackupV14ExportError.thumbnailField,+                field: BackupV15ExportError.thumbnailField,                 value: "17 bytes that are not a portrait cover"))          let model = SettingsBackupModel(exporter: mock)@@ -430,12 +430,12 @@ final class MockBackupExporting: BackupExporting, @unchecked Sendable {     var cleanupCallCount = 0     var scavengeCallCount = 0     var lastCleanupURL: URL?-    var lastMetadata: BackupV14Metadata?+    var lastMetadata: BackupV15Metadata?      var exportResult: Result<BackupExportResult, Error> = .failure(MockBackupError.notConfigured)     var exportDelay: Duration? -    func export(metadata: BackupV14Metadata) async throws -> BackupExportResult {+    func export(metadata: BackupV15Metadata) async throws -> BackupExportResult {         exportCallCount += 1         lastMetadata = metadata         if let delay = exportDelay {
Asterism/AsterismTests/SettingsImportTests.swift Modified +6 / -7
diff --git a/Asterism/AsterismTests/SettingsImportTests.swift b/Asterism/AsterismTests/SettingsImportTests.swiftindex bd2d65c3..cc965a1d 100644--- a/Asterism/AsterismTests/SettingsImportTests.swift+++ b/Asterism/AsterismTests/SettingsImportTests.swift@@ -67,9 +67,9 @@ struct SettingsBackupImportModelTests {     static let minimalBackupData: Data = {         let hostname = "settings-import.example"         let rawURL = "https://\(hostname)/read?chapter=1"-        let payload = BackupV14Payload(+        let payload = BackupV15Payload(             entries: [-                BackupV14Entry(+                BackupV15Entry(                     id: UUID(), captureTitle: "Chapter 1", captureTitleSource: .host,                     rawURL: rawURL, canonicalURL: nil, hostname: hostname,                     entryIdentityKey: rawURL,@@ -84,14 +84,13 @@ struct SettingsBackupImportModelTests {             ],             works: [],             sites: [-                BackupV14Site(-                    hostname: hostname, displayName: hostname, mode: .untaught,-                    junkSuffixRule: nil)+                BackupV15Site(+                    hostname: hostname, displayName: hostname, mode: .untaught)             ],             titlePatterns: [], urlRules: [], workTypes: [])-        return try! BackupV14Codec.encode(+        return try! BackupV15Codec.encode(             payload: payload,-            metadata: BackupV14Metadata(+            metadata: BackupV15Metadata(                 appBuild: "test", exportedAt: Date(timeIntervalSince1970: 1_800_000_000)))     }() 
Asterism/AsterismTests/SitesModelTests.swift Modified +8 / -164
diff --git a/Asterism/AsterismTests/SitesModelTests.swift b/Asterism/AsterismTests/SitesModelTests.swiftindex f1c54b7f..dd48ca38 100644--- a/Asterism/AsterismTests/SitesModelTests.swift+++ b/Asterism/AsterismTests/SitesModelTests.swift@@ -21,7 +21,6 @@ struct SitesListModelTests {         let mock = MockLibraryProvider()         mock.sitesResult = .success([             snapshot(hostname: "royalroad.com", displayName: "Royal Road", mode: .taught),-            snapshot(hostname: "news.example", displayName: "News", mode: .articles),             snapshot(hostname: "unknown.test", mode: .untaught),         ])         let model = SitesListModel(library: mock)@@ -29,11 +28,11 @@ struct SitesListModelTests {         await model.load()          #expect(model.state == .ready)-        #expect(model.rows.map(\.hostname) == ["royalroad.com", "news.example", "unknown.test"])-        #expect(model.rows.map(\.displayName) == ["Royal Road", "News", "unknown.test"])+        #expect(model.rows.map(\.hostname) == ["royalroad.com", "unknown.test"])+        #expect(model.rows.map(\.displayName) == ["Royal Road", "unknown.test"])         // Distinct, plain-language labels — the reader is choosing what to do         // next from them.-        #expect(Set(model.rows.map(\.modeLabel)).count == 3)+        #expect(Set(model.rows.map(\.modeLabel)).count == 2)     }      /// Q10: the untaught sites are exactly the ones the screen exists to send@@ -84,22 +83,6 @@ struct SiteDetailModelTests {         SiteSnapshot.fixture(hostname: hostname, displayName: displayName, mode: mode)     } -    /// Built through the planner teach mode uses, not hand-assembled: the count-    /// the prompt shows has to be the one a real projection would produce.-    private func articlesContract(entryCount: Int) -> ArticlesContract {-        let entries = (0..<entryCount).map { index in-            TestFixtures.makeEntry(captureTitle: "Page \(index)", hostname: "royalroad.com")-        }-        return ArticlesContract(-            basis: TeachingBasis(-                siteMode: .taught, hostname: "royalroad.com", patterns: [], entries: [],-                works: []),-            request: ArticlesRequest(junkSuffixRule: nil),-            outcome: ArticlesOutcome(-                plan: TitleProjectionPlanner.planArticles(-                    entries: entries, junkSuffixRule: nil)))-    }-     @MainActor private func makeSUT(         mode: SiteMode = .taught,         displayName: String = "Royal Road",@@ -111,7 +94,7 @@ struct SiteDetailModelTests {             site: snapshot(displayName: displayName, mode: mode),             library: mock,             canReteach: canReteach,-            onReteach: { hostname, permits in recorder.record(hostname, permits) },+            onReteach: { hostname in recorder.record(hostname) },             onMutation: {},             onChanged: {})         return (model, mock, recorder)@@ -153,7 +136,7 @@ struct SiteDetailModelTests {         let changes = MutationRecorder()         let model = SiteDetailModel(             site: snapshot(mode: .taught), library: mock, canReteach: true,-            onReteach: { _, _ in }, onMutation: { mutations.record() },+            onReteach: { _ in }, onMutation: { mutations.record() },             onChanged: { changes.record() })         model.draftName = "  Royal Road Fiction  " @@ -249,9 +232,9 @@ struct SiteDetailModelTests {         #expect(model.siteURL != nil)     } -    // MARK: - Re-teach (Req 6.2, 6.3)+    // MARK: - Re-teach (Req 6.2) -    @Test("Re-teaching a taught site routes without the articles-conversion flag")+    @Test("Re-teaching a taught site routes by hostname")     @MainActor func reteachTaughtSite() {         let (model, _, recorder) = makeSUT(mode: .taught) @@ -260,18 +243,6 @@ struct SiteDetailModelTests {         model.reteach()          #expect(recorder.hostnames == ["royalroad.com"])-        #expect(recorder.permits == [false])-    }--    /// Decision 3: the Sites screen is the **only** route allowed to convert an-    /// articles site back, so it is the only one that sets the flag.-    @Test("Re-teaching an articles site carries the conversion flag")-    @MainActor func reteachArticlesSite() {-        let (model, _, recorder) = makeSUT(mode: .articles)--        model.reteach()--        #expect(recorder.permits == [true])     }      /// The composed surface is entered from an Entry, so a site with nothing@@ -287,141 +258,14 @@ struct SiteDetailModelTests {          #expect(recorder.hostnames.isEmpty)     }--    // MARK: - Articles switch (Req 6.3, 6.4)--    @Test("A taught site offers the articles switch; an articles site does not")-    @MainActor func articlesSwitchAvailability() {-        #expect(makeSUT(mode: .taught).0.canSwitchToArticles)-        #expect(makeSUT(mode: .untaught).0.canSwitchToArticles)-        #expect(!makeSUT(mode: .articles).0.canSwitchToArticles)-    }--    @Test("Requesting the switch projects it and names the entry count")-    @MainActor func requestArticlesProjects() async {-        let (model, mock, _) = makeSUT(mode: .taught)-        mock.projectArticlesResult = .success(articlesContract(entryCount: 3))--        await model.requestArticlesSwitch()--        #expect(mock.projectArticlesCallCount == 1)-        #expect(model.articlesPrompt?.entryCount == 3)-        #expect(model.articlesPrompt?.message.contains("3") == true)-        #expect(mock.commitArticlesCallCount == 0)-    }--    /// Req 6.4: the same contracts teach mode uses, so the retroactive semantics-    /// are identical by construction rather than by re-implementation.-    @Test("Confirming commits the projected contract and reports the mutation")-    @MainActor func confirmArticlesCommits() async throws {-        let mock = MockLibraryProvider()-        let mutations = MutationRecorder()-        let model = SiteDetailModel(-            site: snapshot(mode: .taught), library: mock, canReteach: true,-            onReteach: { _, _ in }, onMutation: { mutations.record() }, onChanged: {})-        let contract = articlesContract(entryCount: 2)-        mock.projectArticlesResult = .success(contract)-        mock.commitArticlesResult = .success(.committed)--        await model.requestArticlesSwitch()-        let prompt = try #require(model.articlesPrompt)-        await model.confirmArticlesSwitch(prompt)--        #expect(mock.commitArticlesCallCount == 1)-        #expect(mock.lastCommittedArticlesContract == contract)-        #expect(model.didSwitchToArticles)-        #expect(mutations.count == 1)-        #expect(model.articlesPrompt == nil)-    }--    @Test("Cancelling the switch writes nothing")-    @MainActor func cancelArticles() async {-        let (model, mock, _) = makeSUT(mode: .taught)-        mock.projectArticlesResult = .success(articlesContract(entryCount: 1))-        await model.requestArticlesSwitch()--        model.cancelArticlesSwitch()--        #expect(model.articlesPrompt == nil)-        #expect(mock.commitArticlesCallCount == 0)-    }--    /// Regression, found by `SitesSettingsUITests`: the confirm button did-    /// nothing at all on the real screen. SwiftUI runs a `confirmationDialog`'s-    /// `isPresented` setter — the dismissal, which is `cancelArticlesSwitch()` —-    /// *before* the tapped button's action, and the commit used to read the-    /// contract back off the model, where the dismissal had already cleared it.-    /// The tests above never saw it because they call the two methods in the-    /// order a reader would expect rather than the order SwiftUI uses.-    @Test("A dismissal running before the confirm action still commits (Q101)")-    @MainActor func confirmSurvivesTheDismissalRunningFirst() async throws {-        let (model, mock, _) = makeSUT(mode: .taught)-        let contract = articlesContract(entryCount: 2)-        mock.projectArticlesResult = .success(contract)-        mock.commitArticlesResult = .success(.committed)-        await model.requestArticlesSwitch()-        let prompt = try #require(model.articlesPrompt)--        // SwiftUI's order, not the reader's.-        model.cancelArticlesSwitch()-        await model.confirmArticlesSwitch(prompt)--        #expect(mock.commitArticlesCallCount == 1)-        #expect(mock.lastCommittedArticlesContract == contract)-        #expect(model.didSwitchToArticles)-    }--    @Test("A refreshed commit re-presents the fresh counts instead of switching")-    @MainActor func refreshedRepresents() async throws {-        let (model, mock, _) = makeSUT(mode: .taught)-        mock.projectArticlesResult = .success(articlesContract(entryCount: 1))-        mock.commitArticlesResult = .success(.refreshed(articlesContract(entryCount: 5)))--        await model.requestArticlesSwitch()-        let prompt = try #require(model.articlesPrompt)-        await model.confirmArticlesSwitch(prompt)--        #expect(!model.didSwitchToArticles)-        #expect(model.articlesPrompt?.entryCount == 5)-        #expect(model.errorMessage != nil)-    }--    @Test("An invalidated commit reports the repository's reason")-    @MainActor func invalidatedReportsReason() async throws {-        let (model, mock, _) = makeSUT(mode: .taught)-        mock.projectArticlesResult = .success(articlesContract(entryCount: 1))-        mock.commitArticlesResult = .success(.invalidated(reason: "This site is quarantined."))--        await model.requestArticlesSwitch()-        let prompt = try #require(model.articlesPrompt)-        await model.confirmArticlesSwitch(prompt)--        #expect(!model.didSwitchToArticles)-        #expect(model.errorMessage == "This site is quarantined.")-    }--    @Test("A projection failure is reported without a commit")-    @MainActor func projectionFailure() async {-        let (model, mock, _) = makeSUT(mode: .taught)-        mock.projectArticlesResult = .failure(-            MockLibraryProvider.MockError.simulatedFailure("nope"))--        await model.requestArticlesSwitch()--        #expect(model.articlesPrompt == nil)-        #expect(model.errorMessage != nil)-        #expect(mock.commitArticlesCallCount == 0)-    } }  /// Records the re-teach routes a site detail hands back to its host. final class ReteachRecorder: @unchecked Sendable {     private(set) var hostnames: [String] = []-    private(set) var permits: [Bool] = [] -    func record(_ hostname: String, _ permitsArticlesConversion: Bool) {+    func record(_ hostname: String) {         hostnames.append(hostname)-        permits.append(permitsArticlesConversion)     } } 
Asterism/AsterismTests/WorkTypesModelTests.swift Modified +1 / -1
diff --git a/Asterism/AsterismTests/WorkTypesModelTests.swift b/Asterism/AsterismTests/WorkTypesModelTests.swiftindex 879fe4ab..5b820139 100644--- a/Asterism/AsterismTests/WorkTypesModelTests.swift+++ b/Asterism/AsterismTests/WorkTypesModelTests.swift@@ -251,7 +251,7 @@ struct WorkTypeDetailModelTests {         #expect(mock.lastRemovedWorkTypeID == nil)     } -    /// The `ArticlesPrompt` hazard, restated: SwiftUI runs a confirmation+    /// The confirmation-dialog hazard, restated: SwiftUI runs a confirmation     /// dialog's dismissal *before* the tapped button's action, so the confirm     /// takes the rendered prompt as a parameter and never re-reads the model.     @Test("A dismissal running before the confirm action still removes the type")
Asterism/AsterismUITests/ComposedSurfaceUITests.swift Modified +0 / -29
diff --git a/Asterism/AsterismUITests/ComposedSurfaceUITests.swift b/Asterism/AsterismUITests/ComposedSurfaceUITests.swiftindex beb464d8..4e9f8311 100644--- a/Asterism/AsterismUITests/ComposedSurfaceUITests.swift+++ b/Asterism/AsterismUITests/ComposedSurfaceUITests.swift@@ -351,35 +351,6 @@ final class ComposedSurfaceUITests: XCTestCase {                 "A collapsed disclosure summarises the retained URL selection")     } -    // MARK: - Articles affordance (Req 8.7)--    /// Articles is not a title form: it has its own affordance, its own-    /// confirmation of consequences, and its own commit.-    func testArticlesAffordanceIsSeparateFromTitleSelection() {-        openComposedSurfaceViaPill()--        scrollAndTap(app.buttons["composed-articles-affordance"],-                     "Articles has its own affordance, separated from title selection")-        require(any("composed-articles-confirmation"),-                "Articles states its consequences before committing")-        require(app.buttons["composed-articles-confirm"], "Articles carries its own commit button")-        XCTAssertFalse(app.buttons["composed-title-chip-0"].exists,-                       "The Articles confirmation replaces title selection rather than sitting inside it")--        // Backing out returns to title selection untouched.-        scrollAndTap(app.buttons["composed-articles-cancel"], "The confirmation can be declined")-        require(app.buttons["composed-title-chip-0"], "Declining returns to title selection")--        // Committing goes through the articles contract, not the composed one.-        scrollAndTap(app.buttons["composed-articles-affordance"], "Articles can be reopened")-        let confirm = app.buttons["composed-articles-confirm"]-        require(confirm, "Articles carries its own commit button")-        requireEnabled(confirm, "The Articles commit enables once its preview lands")-        scrollAndTap(confirm, "The Articles commit should be tappable")-        requireGone(app.buttons["composed-teaching-cancel"],-                    "Committing Articles leaves the composed surface")-    }-     // MARK: - Rule suggestion (rule-suggestion Reqs 1.1, 2.1, 2.2, 4.1, 6.1)      /// Relaunches the same seeded scenario with a scripted model client. `setUp`
Asterism/AsterismUITests/SitesSettingsUITests.swift Modified +6 / -41
diff --git a/Asterism/AsterismUITests/SitesSettingsUITests.swift b/Asterism/AsterismUITests/SitesSettingsUITests.swiftindex 0980d7e5..72727c61 100644--- a/Asterism/AsterismUITests/SitesSettingsUITests.swift+++ b/Asterism/AsterismUITests/SitesSettingsUITests.swift@@ -2,15 +2,14 @@ import XCTest  /// The Sites settings screen (Req 6), driven from app launch. ///-/// Three things only a journey can prove here. The re-teach route has to cross a+/// Two things only a journey can prove here. The re-teach route has to cross a /// sheet dismissal — the composed surface is presented from `ContentView`, which /// is covered while Settings is up, so the hostname is parked and the sheet-/// opens only after Settings has actually gone (`pendingReteachHostname`). The-/// articles switch is a confirmation over a projection, which is the shape that-/// has silently done nothing before. And `site-display-names`' rename has to-/// reach surfaces this screen does not draw — the list behind it and the work-/// page outside Settings entirely, both of which read the name through the-/// environment rather than from the screen that wrote it.+/// opens only after Settings has actually gone (`pendingReteachHostname`). And+/// `site-display-names`' rename has to reach surfaces this screen does not draw+/// — the list behind it and the work page outside Settings entirely, both of+/// which read the name through the environment rather than from the screen that+/// wrote it. /// /// `seeded-composed` carries both site modes the screen distinguishes: an /// untaught `composed.test` and a taught `id.test`.@@ -94,40 +93,6 @@ final class SitesSettingsUITests: XCTestCase {             "The parked route opens the composed teaching surface")     } -    // MARK: - Articles switch (Req 6.3)--    func testTheArticlesSwitchConfirmsBeforeItWrites() {-        openSitesList()-        openSiteDetail("composed.test")--        scrollUntilTappableAndTap(-            app.buttons["site-detail-articles-button"], in: app,-            "A non-articles site offers the switch")-        waitFor(-            app.dialogButton("site-detail-articles-confirm"),-            "The switch states its consequences before writing")-        declineConfirmationDialog(-            cancel: "site-detail-articles-cancel", dismissing: "site-detail-articles-confirm",-            in: app)--        waitFor(app.anyElement("site-detail-view"), "Declining leaves the site as it was")-        XCTAssertFalse(-            app.anyElement("site-detail-error").exists, "Declining is not a failure")--        // Confirming commits and the screen leaves: everything on it describes-        // the site as it was.-        scrollUntilTappableAndTap(-            app.buttons["site-detail-articles-button"], in: app, "The switch can be reopened")-        waitFor(app.dialogButton("site-detail-articles-confirm"), "The confirmation returns").tap()-        // A committed switch leaves the screen — everything on it describes the-        // site as it was. Staying put with no error is the shape the confirm-        // took before the contract moved onto the prompt: silently nothing.-        waitFor(-            app.anyElement("settings-sites-list"), "A committed switch returns to the list")-        XCTAssertFalse(-            app.anyElement("site-detail-error").exists, "The switch reported no failure")-    }-     // MARK: - Rename (`site-display-names`)      /// The rename, and the two places it has to land: the list the reader comes
Asterism/AsterismUITests/WorkTypesSettingsUITests.swift Modified +1 / -1
diff --git a/Asterism/AsterismUITests/WorkTypesSettingsUITests.swift b/Asterism/AsterismUITests/WorkTypesSettingsUITests.swiftindex 85a2e5d9..b8781829 100644--- a/Asterism/AsterismUITests/WorkTypesSettingsUITests.swift+++ b/Asterism/AsterismUITests/WorkTypesSettingsUITests.swift@@ -57,7 +57,7 @@ final class WorkTypesSettingsUITests: XCTestCase {     func testSettingsRoutesToTheSeededTypeList() {         openWorkTypes() -        for seed in ["novel", "webtoon", "article"] {+        for seed in ["novel", "webtoon"] {             waitFor(row(named: seed), "The seeded \(seed) type is listed")         }         XCTAssertFalse(
CHANGELOG.md Modified +41 / -0
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 653f0d9a..a8d602f3 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -172,6 +172,47 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).  ### Removed +- **Backups move to generation 15/16, and 14/15 backups stop importing+  (T-2336, commit 3 of 3).** The Site record loses `junkSuffixRule`, the+  only change on the wire. `BackupV15Codec`, `BackupV15Exporter` and+  `BackupV15Types` replace the V14 set outright, the exported file is named+  `v15`, and the golden is re-recorded as `backup-15-16-golden.json`. A+  14/15 archive is refused by the version check, which names both pairs and+  writes nothing, so an existing 14/15 backup file can no longer be+  restored: take a fresh backup from this build, and keep the old file only+  as a record. A Site whose `mode` this+  build cannot name refuses the archive as malformed. The envelope follows+  the live schema again, so `make test-core` is back to zero known issues.+  The in-app Getting Started guides, the design document, the agent notes+  and `CLAUDE.md` describe V16, marker `"16"`, the frozen V15 and archive+  15/16, and no longer describe articles mode as something the app does.++- **Schema V16 drops `Site.junkSuffixRule` (T-2336, commit 2 of 3).** The+  column only articles mode used is gone. `AsterismSchemaV15` is the frozen+  snapshot, the plan is `[V15, V16]` with one lightweight stage and no data+  pass, and the readiness marker generation is `"16"`: a store at `"15"`+  converts and is re-marked only after it validates, and `"14"` is refused.+  `AsterismSchemaV14`, its recorded-store fixture and+  `MarkerGenerationFifteenTests` are retired in the same commit, the owner+  having confirmed every device is past marker `"15"` (Q10). The archive+  followed one commit later (above); between the two `make test-core`+  carried one known issue, the envelope trailing the schema (Q17). `JunkSuffixRule` itself+  stays, frozen by reference from the V15 snapshot (Q8).++- **Articles mode (T-2336, commit 1 of 3).** A Site is now untaught or+  taught, and nothing else. The switch on the site page and in composed+  teaching, the junk-suffix stepper, the share extension's article title+  row, `projectArticles` and `commitArticles` with their contract types,+  `SiteMode.articles` with every arm over it, and the `article` default+  work type are gone. A library that already holds the `article` work type+  keeps it; a new library is seeded with `novel` and `webtoon`. A Site row+  whose stored mode this build cannot read is quarantined under+  `siteTuple`, left out of the sites list and refused by name on export,+  and it does not stop the bootstrap publishing the marker. No conversion+  is built, because no articles Site exists. `Site.junkSuffixRule` survived+  this commit as an unread column, written nil; the entry above drops it at+  schema V16.+ - **Today has no search field (`specs/launch-to-today/`, Decision 1).**   Today is a dashboard, and its search field is gone from `TodayView`   with the state and the ⌘F focus token that served it. The filter
CLAUDE.md Modified +6 / -6
diff --git a/CLAUDE.md b/CLAUDE.mdindex 08c2deee..8cd661af 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -83,11 +83,11 @@ bar. `make verify-identity` (a `test-core` prerequisite) is an identity lint, not a style one: it checks the App Group / CloudKit identifier declarations without building anything — see `specs/configuration-identity/`. -**The live store schema is V15** (`specs/update-schedule/`), the readiness-marker generation is `"15"`, `AsterismSchemaV14` is the one frozen snapshot left,-and the archive generation is **14/15**. All four have moved for that feature,-the archive a few commits behind the other three by design;-`BackupV14ArchiveTests.envelopeVersionsFollowTheLiveSchema` ties the envelope to+**The live store schema is V16** (`specs/remove-article-mode/`), the readiness+marker generation is `"16"`, `AsterismSchemaV15` is the one frozen snapshot left,+and the archive generation is **15/16**. All four have moved for that feature,+the archive one commit behind the other three by design;+`BackupV15ArchiveTests.envelopeVersionsFollowTheLiveSchema` ties the envelope to the live schema, so the archive is the one of the four that cannot be forgotten silently — between a schema bump and its archive phase that tie is held open by a self-clearing `withKnownIssue`, which the archive commit must remove. There is@@ -184,7 +184,7 @@ before touching `Models.swift`.  **Every model lives in `AsterismCore`, nested inside the live schema enum.** There are zero top-level `@Model` types; `Entry`, `Work`, `Site` and the rest-are typealiases onto `AsterismSchemaV15`. One frozen snapshot is kept beside+are typealiases onto `AsterismSchemaV16`. One frozen snapshot is kept beside it, and the migration plan is always `[V(n-1), V(n)]` with one lightweight stage. A custom migration stage is forbidden: it never fires between structurally identical models and it would run inside the share extension,
Packages/AsterismCore/Sources/AsterismCore/ArchiveRecordBuilders.swift Modified +19 / -20
diff --git a/Packages/AsterismCore/Sources/AsterismCore/ArchiveRecordBuilders.swift b/Packages/AsterismCore/Sources/AsterismCore/ArchiveRecordBuilders.swiftindex bc898338..09777ce6 100644--- a/Packages/AsterismCore/Sources/AsterismCore/ArchiveRecordBuilders.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/ArchiveRecordBuilders.swift@@ -48,7 +48,7 @@ internal enum ArchiveThumbnail: Equatable, Sendable {     /// shape with no bytes, or bytes with no shape, claims a cover this import     /// cannot honour, so it is `.dropped` and named rather than silently half     /// applied.-    static func of(_ record: BackupV14Work) -> ArchiveThumbnail {+    static func of(_ record: BackupV15Work) -> ArchiveThumbnail {         switch (record.thumbnailShape, record.thumbnail) {         case (nil, nil):             return .none@@ -65,15 +65,14 @@ internal enum ArchiveThumbnail: Equatable, Sendable {  internal enum ArchiveRecordBuilders { -    static func makeSite(_ record: BackupV14Site) -> Site {+    static func makeSite(_ record: BackupV15Site) -> Site {         let site = Site(hostname: record.hostname, displayName: record.displayName)         site.modeRaw = record.mode.rawValue-        site.junkSuffixRule = record.junkSuffixRule         return site     }      static func makeTitlePattern(-        _ record: BackupV14TitlePattern, site: Site?+        _ record: BackupV15TitlePattern, site: Site?     ) throws -> TitlePattern {         return try TitlePattern(             id: record.id,@@ -88,7 +87,7 @@ internal enum ArchiveRecordBuilders {     }      static func makeURLRule(-        _ record: BackupV14URLRule, site: Site?+        _ record: BackupV15URLRule, site: Site?     ) throws -> URLRulePattern {         try URLRulePattern(             id: record.id,@@ -104,7 +103,7 @@ internal enum ArchiveRecordBuilders {     /// The wire timestamps are what an import-created row carries on both fields     /// (Q33), and an unrecognised state coerces to `.active` rather than     /// refusing — a type row from a later build's wider set is legal data.-    static func makeWorkType(_ record: BackupV14WorkType) -> WorkTypeEntity {+    static func makeWorkType(_ record: BackupV15WorkType) -> WorkTypeEntity {         makeWorkType(             id: record.id, name: record.name,             state: ToleratedEnum.read(record.stateRaw, default: .active),@@ -132,7 +131,7 @@ internal enum ArchiveRecordBuilders {     /// `WorkSiteMembership`, which `makeMembership` below builds from the     /// archive's own records.     static func makeWork(-        _ record: BackupV14Work, thumbnail: ArchiveThumbnail = .none+        _ record: BackupV15Work, thumbnail: ArchiveThumbnail = .none     ) -> Work {         let work = Work(             id: record.id,@@ -147,7 +146,7 @@ internal enum ArchiveRecordBuilders {     /// carries it. `workID` travels whether or not the Work is there (Q37), so an     /// orphan re-attaches when its Work arrives (Req 8.3, 9.5).     static func makeMembership(-        _ record: BackupV14Membership, work: Work?, site: Site?+        _ record: BackupV15Membership, work: Work?, site: Site?     ) -> WorkSiteMembership {         WorkSiteMembership(             id: record.id,@@ -165,7 +164,7 @@ internal enum ArchiveRecordBuilders {     /// One dismissed pair. The record's ids are already in the canonical sorted     /// order — `BackupImportPayload` normalises them at the door — so nothing     /// here re-sorts and then disagrees about which end is which.-    static func makeDistinctPair(_ record: BackupV14DistinctPair) -> WorkDistinctPair {+    static func makeDistinctPair(_ record: BackupV15DistinctPair) -> WorkDistinctPair {         WorkDistinctPair(             id: record.id, lowerWorkID: record.lowerWorkID,             higherWorkID: record.higherWorkID, recordedAt: record.recordedAt)@@ -175,7 +174,7 @@ internal enum ArchiveRecordBuilders {     /// nothing derived: the name and notes are stored trimmed by every writer     /// and the reference checks refuse an empty name, so the record's values go     /// in as they arrived.-    static func makeSeries(_ record: BackupV14Series) -> Series {+    static func makeSeries(_ record: BackupV15Series) -> Series {         Series(             id: record.id, name: record.name, notes: record.notes,             createdAt: record.createdAt, modifiedAt: record.modifiedAt)@@ -184,7 +183,7 @@ internal enum ArchiveRecordBuilders {     /// One link row. The record's ids are already in the canonical sorted order     /// — `BackupImportPayload` normalises them at the door — so nothing here     /// re-sorts and then disagrees about which end is which.-    static func makeLink(_ record: BackupV14Link) -> WorkLink {+    static func makeLink(_ record: BackupV15Link) -> WorkLink {         WorkLink(             id: record.id, lowerWorkID: record.lowerWorkID,             higherWorkID: record.higherWorkID, linkType: record.linkType,@@ -198,7 +197,7 @@ internal enum ArchiveRecordBuilders {     /// import once and stay put: the next sync fold and a repeated import see     /// exactly what the exporting device saw and write nothing. An unrecognised     /// state coerces to `.active` at every read site, so the raw column travels.-    static func makeCreator(_ record: BackupV14Creator) -> Creator {+    static func makeCreator(_ record: BackupV15Creator) -> Creator {         let row = Creator(             id: record.id, name: record.name, notes: record.notes,             stateRaw: record.stateRaw, canonicalID: record.canonicalID)@@ -211,7 +210,7 @@ internal enum ArchiveRecordBuilders {     }      /// One role row, the same way, with the archive's list position.-    static func makeCreatorRole(_ record: BackupV14CreatorRole) -> CreatorRole {+    static func makeCreatorRole(_ record: BackupV15CreatorRole) -> CreatorRole {         makeCreatorRole(record, position: record.position, at: record.positionModifiedAt)     } @@ -220,7 +219,7 @@ internal enum ArchiveRecordBuilders {     /// stamped at import time so a later-arriving sync row cannot undo the     /// placement (Req 9.4, Q38).     static func makeCreatorRole(-        _ record: BackupV14CreatorRole, position: Int, at positionModifiedAt: Date+        _ record: BackupV15CreatorRole, position: Int, at positionModifiedAt: Date     ) -> CreatorRole {         let row = CreatorRole(             id: record.id, name: record.name, position: position,@@ -240,14 +239,14 @@ internal enum ArchiveRecordBuilders {     /// render, never a row to drop. `roleIDs` is normalised on the way in for     /// the reason every writer normalises it: equal sets have to be equal     /// arrays.-    static func makeCredit(_ record: BackupV14Credit) -> WorkCredit {+    static func makeCredit(_ record: BackupV15Credit) -> WorkCredit {         WorkCredit(             id: record.id, workID: record.workID, creatorID: record.creatorID,             roleIDs: WorkCreditSupport.roleIDs(record.roleIDs),             createdAt: record.createdAt, modifiedAt: record.modifiedAt)     } -    static func makeEntry(_ record: BackupV14Entry) -> Entry {+    static func makeEntry(_ record: BackupV15Entry) -> Entry {         let entry = Entry(             id: record.id,             captureTitle: record.captureTitle,@@ -300,19 +299,19 @@ internal enum ArchiveRecordBuilders {     // The four named entry points stay: each table's `make(imported:)` names its     // own archive record, and the generic pair above is the body they share. -    static func makeCharacter(_ record: BackupV14Character) -> CharacterRecord {+    static func makeCharacter(_ record: BackupV15Character) -> CharacterRecord {         makeRecord(CharacterRecord.self, record)     } -    static func makeSuppression(_ record: BackupV14Suppression) -> CharacterSuppression {+    static func makeSuppression(_ record: BackupV15Suppression) -> CharacterSuppression {         makeSuppressionRow(CharacterSuppression.self, record)     } -    static func makePlace(_ record: BackupV14Place) -> Place {+    static func makePlace(_ record: BackupV15Place) -> Place {         makeRecord(Place.self, record)     } -    static func makePlaceSuppression(_ record: BackupV14PlaceSuppression) -> PlaceSuppression {+    static func makePlaceSuppression(_ record: BackupV15PlaceSuppression) -> PlaceSuppression {         makeSuppressionRow(PlaceSuppression.self, record)     } }
Packages/AsterismCore/Sources/AsterismCore/ArticleTitlePlanning.swift Deleted +0 / -144
diff --git a/Packages/AsterismCore/Sources/AsterismCore/ArticleTitlePlanning.swift b/Packages/AsterismCore/Sources/AsterismCore/ArticleTitlePlanning.swiftdeleted file mode 100644index 4fc65647..00000000--- a/Packages/AsterismCore/Sources/AsterismCore/ArticleTitlePlanning.swift+++ /dev/null@@ -1,144 +0,0 @@-import Foundation--public enum ArticleTitleCleaningError: Error, Equatable, Sendable, LocalizedError {-    case invalidSuffixSegmentCount(Int)-    case titleCannotBeTokenized(TokenizationError)-    case suffixWouldLeaveBlankTitle-    case invalidRule--    public var errorDescription: String? {-        switch self {-        case .invalidSuffixSegmentCount(let count):-            "Junk suffix selection must contain zero or more end segments; received \(count)."-        case .titleCannotBeTokenized(let error):-            "The example title cannot be split into suffix segments: \(error.localizedDescription)"-        case .suffixWouldLeaveBlankTitle:-            "The selected junk suffix would remove the entire example title."-        case .invalidRule:-            "The junk suffix rule must contain contiguous end-relative segment positions."-        }-    }-}--/// Pure authoring and presentation logic for articles-mode junk suffixes.-/// Cleaning never mutates or feeds back into immutable capture evidence.-public enum ArticleTitleCleaner {-    public static func deriveRule(-        from exampleTitle: String,-        suffixSegmentCount: Int-    ) throws -> JunkSuffixRule? {-        guard suffixSegmentCount >= 0 else {-            throw ArticleTitleCleaningError.invalidSuffixSegmentCount(suffixSegmentCount)-        }-        guard suffixSegmentCount > 0 else { return nil }--        let tokenized: TokenizedTitle-        switch DelimiterTokenizer.tokenize(exampleTitle) {-        case .success(let value): tokenized = value-        case .failure(let error): throw ArticleTitleCleaningError.titleCannotBeTokenized(error)-        }-        guard suffixSegmentCount < tokenized.segments.count else {-            throw ArticleTitleCleaningError.suffixWouldLeaveBlankTitle-        }--        let anchors = try (0..<suffixSegmentCount).reversed().map {-            try SegmentPositionSpec(origin: .end, offset: $0)-        }-        let rule = try JunkSuffixRule(version: 1, anchors: anchors)-        try validate(rule)-        guard !M2Unicode.isBlank(clean(exampleTitle, using: rule)) else {-            throw ArticleTitleCleaningError.suffixWouldLeaveBlankTitle-        }-        return rule-    }--    public static func validate(_ rule: JunkSuffixRule) throws {-        guard rule.version > 0, !rule.anchors.isEmpty else {-            throw ArticleTitleCleaningError.invalidRule-        }-        let offsets = rule.anchors.map(\.offset)-        guard rule.anchors.allSatisfy({ $0.origin == .end }),-              offsets == Array((0..<offsets.count).reversed()) else {-            throw ArticleTitleCleaningError.invalidRule-        }-    }--    /// Returns the immutable source title when the rule cannot safely retain a-    /// nonblank prefix, as required for short or differently formatted titles.-    public static func clean(_ captureTitle: String, using rule: JunkSuffixRule?) -> String {-        guard let rule, (try? validate(rule)) != nil else { return captureTitle }-        guard case .success(let tokenized) = DelimiterTokenizer.tokenize(captureTitle) else {-            return captureTitle-        }--        let suffixCount = rule.anchors.count-        let retainedCount = tokenized.segments.count - suffixCount-        guard retainedCount > 0 else { return captureTitle }-        guard retainedCount - 1 < tokenized.delimiters.count else { return captureTitle }--        let endScalar = tokenized.delimiters[retainedCount - 1].start-        let scalars = Array(captureTitle.unicodeScalars)-        var result = ""-        result.reserveCapacity(endScalar)-        for scalar in scalars[..<endScalar] {-            result.unicodeScalars.append(scalar)-        }-        return M2Unicode.isBlank(result) ? captureTitle : result-    }-}--public struct ArticleEntryProjection: Equatable, Sendable, Identifiable {-    public let entryID: UUID-    public let projectedChapter: String?-    public let projectedWorkID: UUID?-    public let chapterProvenance: ProjectedProvenance-    public let assignmentProvenance: ProjectedProvenance-    public let chapterProtected: Bool-    public let assignmentProtected: Bool-    public let intentionallyUnattached: Bool-    public let displayTitle: String-    public let actionableAfter: Bool--    public var id: UUID { entryID }-}--public struct ArticleProjectionPlan: Equatable, Sendable {-    public let entryProjections: [ArticleEntryProjection]-    public let junkSuffixRule: JunkSuffixRule?-}--public extension TitleProjectionPlanner {-    static func planArticles(-        entries: [EntrySnapshot],-        junkSuffixRule: JunkSuffixRule?-    ) -> ArticleProjectionPlan {-        let projections = sortEntries(entries).map { entry in-            let chapterProtected = entry.chapterTitleProvenance.kind == .manual-            let assignmentProtected = entry.workAssignmentProvenance.kind == .manual-                || entry.intentionallyUnattached--            return ArticleEntryProjection(-                entryID: entry.id,-                projectedChapter: chapterProtected ? entry.chapterTitle : nil,-                projectedWorkID: assignmentProtected ? entry.workID : nil,-                chapterProvenance: chapterProtected-                    ? .preserved(entry.chapterTitleProvenance)-                    : .cleared,-                assignmentProvenance: assignmentProtected-                    ? .preserved(entry.workAssignmentProvenance)-                    : .cleared,-                chapterProtected: chapterProtected,-                assignmentProtected: assignmentProtected,-                intentionallyUnattached: assignmentProtected-                    ? entry.intentionallyUnattached-                    : true,-                displayTitle: ArticleTitleCleaner.clean(entry.captureTitle, using: junkSuffixRule),-                actionableAfter: false-            )-        }-        return ArticleProjectionPlan(-            entryProjections: projections,-            junkSuffixRule: junkSuffixRule-        )-    }-}
Packages/AsterismCore/Sources/AsterismCore/AsterismCapabilities.swift Modified +6 / -12
diff --git a/Packages/AsterismCore/Sources/AsterismCore/AsterismCapabilities.swift b/Packages/AsterismCore/Sources/AsterismCore/AsterismCapabilities.swiftindex 4ee317a5..4b276dfa 100644--- a/Packages/AsterismCore/Sources/AsterismCore/AsterismCapabilities.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/AsterismCapabilities.swift@@ -6,6 +6,9 @@ import Foundation public struct AsterismCapabilities: Codable, Equatable, Sendable {     public enum Gate: String, CaseIterable, Codable, Sendable {         case m2_0 = "m2.0"+        /// Answers every capability as `m2_2` does since `remove-article-mode`+        /// retired `supportsArticles`, the one capability that told them apart.+        /// Kept because the raw value is persisted and fixtures name it.         case m2_1 = "m2.1"         case m2_2 = "m2.2"         case m2_3 = "m2.3"@@ -15,8 +18,8 @@ public struct AsterismCapabilities: Codable, Equatable, Sendable {         /// and the archive it writes is format 11 over schema 12. Nothing about a         /// *rule form* changes with it — every `supports…` answer below is m4's         /// — so the case exists to name the store shape and the rule-form set,-        /// which is what `BackupV14Codec` stamps. The literal has not moved with-        /// any archive generation since: none of 8/9 through 14/15 changes those+        /// which is what `BackupV15Codec` stamps. The literal has not moved with+        /// any archive generation since: none of 8/9 through 15/16 changes those         /// two things (`rule-citation-by-uuid` Q19), and the generation is named         /// by its format and schema numbers, which are what the importer gates         /// on.@@ -32,7 +35,7 @@ public struct AsterismCapabilities: Codable, Equatable, Sendable {     public static let multiSite = AsterismCapabilities(gate: .multiSite)      /// The current runtime gate is `.multiSite` (`multi-site-works` Q29).-    /// `BackupV14Codec` stamps the literal `"multi-site"` rather than reading+    /// `BackupV15Codec` stamps the literal `"multi-site"` rather than reading     /// this value, so the archive's gate is independent of the runtime's.     /// Earlier gates stay available because the schema and teaching suites still     /// exercise them — `CapabilityGatingTests`, `PhraseParsingTests`,@@ -46,12 +49,6 @@ public struct AsterismCapabilities: Codable, Equatable, Sendable {     }      public var supportsSegmentTeaching: Bool { gate != .m2_0 }-    public var supportsArticles: Bool {-        switch gate {-        case .m2_0, .m2_1: false-        case .m2_2, .m2_3, .m3, .m4, .multiSite: true-        }-    }     // Q10 of `specs/cloudkit-mirroring`: these three were `gate == .m3 || gate ==     // .m4` equality chains, which is why a proposed `.m5` gate would have turned     // all three *off* with nothing failing to compile. Exhaustive switches make@@ -132,7 +129,6 @@ public struct AsterismCapabilities: Codable, Equatable, Sendable {  public enum AsterismCapabilityError: Error, Equatable, Sendable, CustomStringConvertible {     case unavailablePatternForm(form: PatternForm, gate: AsterismCapabilities.Gate)-    case articlesUnavailable(gate: AsterismCapabilities.Gate)     /// An M4 composed feature (chapter-less title rule, title affix trim, or     /// sequence-only URL rule) was used below the `.m4` gate.     case unavailableComposedForm(gate: AsterismCapabilities.Gate)@@ -141,8 +137,6 @@ public enum AsterismCapabilityError: Error, Equatable, Sendable, CustomStringCon         switch self {         case .unavailablePatternForm(let form, let gate):             "Pattern form \(form.rawValue) is unavailable at gate \(gate.rawValue)"-        case .articlesUnavailable(let gate):-            "Articles mode is unavailable at gate \(gate.rawValue)"         case .unavailableComposedForm(let gate):             "M4 composed rule forms are unavailable at gate \(gate.rawValue)"         }
Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV14.swift Deleted +0 / -379
diff --git a/Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV14.swift b/Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV14.swiftdeleted file mode 100644index 9baffc4d..00000000--- a/Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV14.swift+++ /dev/null@@ -1,379 +0,0 @@-import Foundation-import SwiftData--/// The frozen `work-thumbnails` schema — the shape every installed library was-/// written by before `update-schedule`, and the `from` version of the-/// V14 → V15 lightweight stage.-///-/// V14 was V13 **plus three optional `Work` columns** — `thumbnailData`,-/// `thumbnailShapeRaw` and `thumbnailDigest` — and no table at all. V15 adds a-/// single `Work` column, `releaseDaysRaw`, and no table either; unlike V14's-/// three it is *defaulted* rather than optional, so its property initialiser is-/// the Core Data attribute default the stage writes into every existing row.-///-/// V14 is frozen for the same reason V5 through V13 were: *any* edit to its body-/// makes a V14-recorded store refuse to open with `NSCocoaErrorDomain` 134504,-/// "Cannot use staged migration with an unknown model version". The live classes-/// therefore moved to `AsterismSchemaV15`, and this declaration exists only to-/// give `AsterismV15MigrationPlan` the `from` version of its **only** stage —-/// and to let `V14RecordedStoreFixture` seed a genuinely 14.0.0-recorded store-/// in-process. It is the last snapshot the package declares: the V13 → V14 stage-/// and `AsterismSchemaV13` retired with this freeze, on-/// `retire-migration-chain` Decision 6's population precondition, confirmed by-/// the owner on 2026-09-15 (`update-schedule` `prerequisites.md`).-///-/// The classes are nested so they can carry the same SwiftData entity names-/// ("Entry", "Site", …) as the live V15 classes without a top-level collision:-/// the only top-level references are typealiases, and two *top-level* `@Model`s-/// sharing an entity name crash `ModelContext`-/// (`docs/agent-notes/schema-migration.md`). Nothing reads a V14-shaped object-/// at runtime, so these carry stored columns and attribute options only — no-/// accessors, no business logic.-///-/// # These snapshots are frozen *by reference*, not only by file-///-/// The nesting freezes the class bodies; it does **not** freeze anything a body-/// *names*. Editing one of those changes the stored shape of this frozen schema-/// silently — and that is exactly what makes a recorded store refuse to open-/// (134504). Two families of referent, both live and both shared with V15:-///-/// * **The stored value types.** `JunkSuffixRule` is a top-level type in-///   `ValueObjects.swift`; its stored properties are this schema's stored-///   properties.-/// * **Every enum whose raw value is baked into a default.** A default is part-///   of the shape, so `CaptureTitleSource.manual.rawValue`,-///   `EntryIdentityBasis.conservative.rawValue`, `TitleProvenance.manual`,-///   `SiteMode.untaught.rawValue`, `URLRuleOrigin.readerTaught`,-///   `WorkTypeState.active`, `CharacterSuppressionKind.candidate`,-///   `CharacterSuppressionStatus.active`, `WorkURLIdentityState.none`,-///   `WorkStatus.ongoing` and `ReadingStatus.reading` are all frozen *spellings*-///   here, not merely frozen references. Renaming a case, or reordering one-///   whose raw value is derived rather than written out, edits this file without-///   touching it.-///-///   **V15 adds no new baked-in raw value to this file.** `Work.releaseDaysRaw`-///   defaults to the empty array, so no `ReleaseDay` spelling becomes a default-///   here; the spellings are stored *values* all the same, and-///   `ModelContractTests` pins them beside the other persisted enums.-///-/// # What this generation freezes beyond the columns-///-/// `@Attribute(.externalStorage)` on `thumbnailData` is the schema's only-/// attribute option and it is part of the **stored** shape, so it is carried-/// across verbatim (`work-thumbnails` Decision 2). `ThumbnailShape`'s two raw-/// spellings and the SHA-256 digest function are frozen for this generation-/// too — they are bytes in every installed library — but no *default* here-/// names them, because all three columns are optional.-public enum AsterismSchemaV14: VersionedSchema {-    public static let versionIdentifier = Schema.Version(14, 0, 0)--    public static var models: [any PersistentModel.Type] {-        [Entry.self, Work.self, Site.self, TitlePattern.self, URLRulePattern.self,-         WorkTypeEntity.self, Character.self, CharacterSuppression.self,-         WorkSiteMembership.self, WorkDistinctPair.self,-         Series.self, WorkLink.self,-         Creator.self, CreatorRole.self, WorkCredit.self,-         Place.self, PlaceSuppression.self]-    }-}--extension AsterismSchemaV14 {-    @Model-    public final class Entry {-        public var id: UUID = UUID()-        public var captureTitle: String = ""-        public var captureTitleSourceRaw: String = CaptureTitleSource.manual.rawValue-        public var rawURLString: String = ""-        public var canonicalURLString: String?-        public var hostname: String = ""-        public var site: Site?-        public var entryIdentityKey: String = ""-        public var conservativeIdentityKey: String = ""-        public var identityBasisRaw: String = EntryIdentityBasis.conservative.rawValue-        public var urlWorkIdentity: String?-        public var chapterSequence: String?-        public var chapterTitle: String?-        public var note: String = ""-        public var ratingRaw: String?-        public var firstCapturedAt: Date = Date(timeIntervalSince1970: 0)-        public var lastSharedAt: Date = Date(timeIntervalSince1970: 0)-        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)-        public var work: Work?-        public var intentionallyUnattached: Bool = false-        public var characterExtractionFingerprint: String?-        public var citationsData: Data?--        public init() {}-    }--    @Model-    public final class Work {-        public var id: UUID = UUID()-        public var displayTitle: String = ""-        public var lastParsedTitle: String?-        public var genericNotes: String = ""-        public var workTypeID: UUID?-        public var genreTags: [String] = []-        public var titleProvenanceRaw: String = TitleProvenance.manual.rawValue-        /// V10's three additions. Their property initialisers are the Core Data-        /// attribute defaults the V9 → V10 stage wrote into every existing row,-        /// which is why the two enum spellings are frozen here (see the header).-        public var workStatusRaw: String = WorkStatus.ongoing.rawValue-        public var readingStatusRaw: String = ReadingStatus.reading.rawValue-        public var verdict: String = ""-        /// V11's two additions, both **optional**: nil is "this work is in no-        /// series", so the V10 → V11 stage had no attribute default to write.-        public var seriesID: UUID?-        public var seriesPosition: Double?-        /// V14's three additions, all **optional**, so the V13 → V14 stage had-        /// no attribute default to write either.-        ///-        /// **`.externalStorage` is part of the stored shape**, not a hint: it-        /// puts the blob in a sidecar under the store's `_SUPPORT` directory and-        /// leaves a reference on the row (`work-thumbnails` Decision 2). It is-        /// the schema's only `@Attribute`, and it is carried across verbatim-        /// here for the reason this whole file exists — a snapshot whose stored-        /// shape differs from the recorded one by so much as an option makes a-        /// V14-recorded store refuse to open.-        @Attribute(.externalStorage)-        public var thumbnailData: Data?-        public var thumbnailShapeRaw: String?-        public var thumbnailDigest: String?-        public var createdAt: Date = Date(timeIntervalSince1970: 0)-        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)-        public var genericNotesExtractionFingerprint: String?-        @Relationship(deleteRule: .nullify, inverse: \Entry.work)-        public var entries: [Entry]?-        @Relationship(deleteRule: .nullify, inverse: \Character.work)-        public var characters: [Character]?-        @Relationship(deleteRule: .nullify, inverse: \CharacterSuppression.work)-        public var characterSuppressions: [CharacterSuppression]?-        @Relationship(deleteRule: .nullify, inverse: \WorkSiteMembership.work)-        public var siteMemberships: [WorkSiteMembership]? = []--        public init() {}-    }--    @Model-    public final class Site {-        public var hostname: String = ""-        public var displayName: String = ""-        public var modeRaw: String = SiteMode.untaught.rawValue-        @Relationship(deleteRule: .cascade, inverse: \TitlePattern.site)-        public var patterns: [TitlePattern]?-        @Relationship(deleteRule: .cascade, inverse: \URLRulePattern.site)-        public var urlRules: [URLRulePattern]?-        /// Inverse of `Entry.site`, present only because CloudKit requires every-        /// relationship to have one. Internal for the same reason the live class-        /// keeps it internal (Q17): traversing it faults every Entry for a-        /// hostname.-        @Relationship(deleteRule: .nullify, inverse: \Entry.site)-        var entries: [Entry]?-        /// Inverse of `WorkSiteMembership.site`. Same reasoning again.-        @Relationship(deleteRule: .nullify, inverse: \WorkSiteMembership.site)-        var workMemberships: [WorkSiteMembership]?-        public var junkSuffixRule: JunkSuffixRule?--        public init() {}-    }--    @Model-    public final class TitlePattern {-        public var id: UUID = UUID()-        public var version: Int = 1-        public var isActive: Bool = false-        public var createdAt: Date = Date(timeIntervalSince1970: 0)-        public var definitionData: Data?-        public var site: Site?--        public init() {}-    }--    @Model-    public final class URLRulePattern {-        public var id: UUID = UUID()-        public var version: Int = 1-        public var isCurrent: Bool = false-        public var createdAt: Date = Date(timeIntervalSince1970: 0)-        public var originRaw: String = URLRuleOrigin.readerTaught.rawValue-        public var definitionData: Data = Data()-        public var site: Site?--        public init() {}-    }--    @Model-    public final class WorkTypeEntity {-        public var id: UUID = UUID()-        public var name: String = ""-        public var nameModifiedAt: Date = Date(timeIntervalSince1970: 0)-        public var stateRaw: String = WorkTypeState.active.rawValue-        public var stateModifiedAt: Date = Date(timeIntervalSince1970: 0)-        public var canonicalID: UUID?-        public var createdAt: Date = Date(timeIntervalSince1970: 0)-        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)--        public init() {}-    }--    @Model-    public final class Character {-        public var id: UUID = UUID()-        public var name: String = ""-        public var nameKey: String = ""-        public var aliases: [String] = []-        public var note: String = ""-        public var factsData: Data?-        public var createdAt: Date = Date(timeIntervalSince1970: 0)-        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)-        public var work: Work?--        public init() {}-    }--    @Model-    public final class CharacterSuppression {-        public var id: UUID = UUID()-        public var work: Work?-        public var kindRaw: String = CharacterSuppressionKind.candidate.rawValue-        public var nameKey: String = ""-        public var sourceKindRaw: String?-        public var sourceEntryID: UUID?-        public var evidence: String?-        public var statusRaw: String = CharacterSuppressionStatus.active.rawValue-        public var actionAt: Date = Date(timeIntervalSince1970: 0)--        public init() {}-    }--    @Model-    public final class WorkSiteMembership {-        public var id: UUID = UUID()-        public var hostname: String = ""-        public var createdAt: Date = Date(timeIntervalSince1970: 0)-        public var urlIdentity: String?-        public var urlIdentityStateRaw: String = WorkURLIdentityState.none.rawValue-        public var urlIdentityRuleID: UUID?-        public var workURLString: String?-        public var workID: UUID?-        public var work: Work?-        public var site: Site?--        public init() {}-    }--    @Model-    public final class WorkDistinctPair {-        public var id: UUID = UUID()-        public var lowerWorkID: UUID = UUID()-        public var higherWorkID: UUID = UUID()-        public var recordedAt: Date = Date(timeIntervalSince1970: 0)--        public init() {}-    }--    @Model-    public final class Series {-        public var id: UUID = UUID()-        public var name: String = ""-        public var notes: String = ""-        public var createdAt: Date = Date(timeIntervalSince1970: 0)-        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)--        public init() {}-    }--    @Model-    public final class WorkLink {-        public var id: UUID = UUID()-        public var lowerWorkID: UUID = UUID()-        public var higherWorkID: UUID = UUID()-        public var linkType: String = ""-        public var createdAt: Date = Date(timeIntervalSince1970: 0)-        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)--        public init() {}-    }--    /// V12's three additions. `stateRaw` defaults to the **literal** `"active"`-    /// rather than to `CreatorState.active.rawValue`, which is why neither of-    /// the two new enums appears in the header's frozen-spelling list.-    @Model-    public final class Creator {-        public var id: UUID = UUID()-        public var name: String = ""-        public var nameModifiedAt: Date = Date(timeIntervalSince1970: 0)-        public var notes: String = ""-        public var notesModifiedAt: Date = Date(timeIntervalSince1970: 0)-        public var stateRaw: String = "active"-        public var stateModifiedAt: Date = Date(timeIntervalSince1970: 0)-        public var canonicalID: UUID?-        public var createdAt: Date = Date(timeIntervalSince1970: 0)-        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)--        public init() {}-    }--    @Model-    public final class CreatorRole {-        public var id: UUID = UUID()-        public var name: String = ""-        public var nameModifiedAt: Date = Date(timeIntervalSince1970: 0)-        public var position: Int = 0-        public var positionModifiedAt: Date = Date(timeIntervalSince1970: 0)-        public var stateRaw: String = "active"-        public var stateModifiedAt: Date = Date(timeIntervalSince1970: 0)-        public var canonicalID: UUID?-        public var createdAt: Date = Date(timeIntervalSince1970: 0)-        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)--        public init() {}-    }--    @Model-    public final class WorkCredit {-        public var id: UUID = UUID()-        public var workID: UUID = UUID()-        public var creatorID: UUID = UUID()-        public var roleIDs: [String] = []-        public var createdAt: Date = Date(timeIntervalSince1970: 0)-        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)--        public init() {}-    }--    /// V13's two additions. Both name their work by **UUID column** rather than-    /// by relationship, which is why neither declares a `@Relationship` at all,-    /// and both enum columns default to the *shared* suppression enums already-    /// frozen through `CharacterSuppression` above — so V13 brought no new-    /// frozen spelling into this file either.-    @Model-    public final class Place {-        public var id: UUID = UUID()-        public var name: String = ""-        public var nameKey: String = ""-        public var aliases: [String] = []-        public var note: String = ""-        public var factsData: Data?-        public var createdAt: Date = Date(timeIntervalSince1970: 0)-        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)-        public var workID: UUID = UUID()--        public init() {}-    }--    @Model-    public final class PlaceSuppression {-        public var id: UUID = UUID()-        public var workID: UUID = UUID()-        public var kindRaw: String = CharacterSuppressionKind.candidate.rawValue-        public var nameKey: String = ""-        public var sourceKindRaw: String?-        public var sourceEntryID: UUID?-        public var evidence: String?-        public var statusRaw: String = CharacterSuppressionStatus.active.rawValue-        public var actionAt: Date = Date(timeIntervalSince1970: 0)--        public init() {}-    }-}
Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV15.swift Modified +375 / -66
diff --git a/Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV15.swift b/Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV15.swiftindex 12fd82cf..d77f1cee 100644--- a/Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV15.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV15.swift@@ -1,39 +1,81 @@ import Foundation import SwiftData -/// The runtime schema. Its body is `Models.swift`, which opens-/// `extension AsterismSchemaV15`.+/// The frozen `update-schedule` schema — the shape every installed library was+/// written by before `remove-article-mode`, and the `from` version of the+/// V15 → V16 lightweight stage. ///-/// V15 is V14 **plus one `Work` column** — `releaseDaysRaw`, the reader's-/// release weekdays (`update-schedule`). Nothing else moves: no table is added-/// or removed, no existing column changes type, and no relationship changes-/// shape. It is the second stage in a row to add a column and the entity list is-/// unchanged at seventeen.+/// V15 was V14 **plus one defaulted `Work` column**, `releaseDaysRaw`, and no+/// table at all. V16 **removes** one `Site` column, `junkSuffixRule`, and adds+/// nothing: it is the second removing stage in the project's history, after+/// V8 → V9, and the entity list stays at seventeen. ///-/// The column is **defaulted and non-optional** — a `[String]` on the shape-/// `genreTags` has had since V5 (Q27) — so unlike V14's three optional columns-/// there *is* an attribute default here: the property initialiser `= []` is what-/// SwiftData turns into the Core Data attribute default, and that default is-/// what fills the column on every existing row inside `ModelContainer.init`.-/// There is still no data pass. `V14RecordedStoreTests` asserts it comes out-/// empty on a converted row, through the **raw** column rather than through the-/// `releaseDays` accessor, which maps and canonicalises and would answer an-/// empty array either way.+/// V15 is frozen for the same reason V5 through V14 were: *any* edit to its body+/// makes a V15-recorded store refuse to open with `NSCocoaErrorDomain` 134504,+/// "Cannot use staged migration with an unknown model version". The live classes+/// therefore moved to `AsterismSchemaV16`, and this declaration exists only to+/// give `AsterismV16MigrationPlan` the `from` version of its **only** stage —+/// and to let `V15RecordedStoreFixture` seed a genuinely 15.0.0-recorded store+/// in-process. It is the last snapshot the package declares: the V14 → V15 stage+/// and `AsterismSchemaV14` retired with this freeze, on+/// `retire-migration-chain` Decision 6's population precondition, confirmed by+/// the owner on 2026-09-21 (`remove-article-mode` Q10). ///-/// # What this generation freezes+/// The classes are nested so they can carry the same SwiftData entity names+/// ("Entry", "Site", …) as the live V16 classes without a top-level collision:+/// the only top-level references are typealiases, and two *top-level* `@Model`s+/// sharing an entity name crash `ModelContext`+/// (`docs/agent-notes/schema-migration.md`). Nothing reads a V15-shaped object+/// at runtime, so these carry stored columns and attribute options only — no+/// accessors, no business logic. ///-/// The next freeze inherits everything V14's header named — `ThumbnailShape`'s-/// raw spellings, the SHA-256 digest function, and-/// `@Attribute(.externalStorage)` on `thumbnailData`, which is part of the-/// *stored* shape rather than a hint — and one thing of its own:+/// # These snapshots are frozen *by reference*, not only by file ///-/// * **`ReleaseDay`'s seven raw spellings**, the lowercase English day names.-///   They are the bytes `releaseDaysRaw` holds in every installed library. No-///   column *default* names them — the default is the empty array — but a stored-///   spelling is a stored spelling, and an unrecognised one is *ignored* on read-///   rather than substituted (Req 1.6, Q21), while the export refuses it by name-///   (Req 8.3). `ModelContractTests` pins the spellings and the case order on-///   the live schema.+/// The nesting freezes the class bodies; it does **not** freeze anything a body+/// *names*. Editing one of those changes the stored shape of this frozen schema+/// silently — and that is exactly what makes a recorded store refuse to open+/// (134504). Two families of referent:+///+/// * **The stored value types.** `Site.junkSuffixRule` is a `JunkSuffixRule`,+///   a top-level type in `ValueObjects.swift`, and it stores+///   `[SegmentPositionSpec]`; the stored properties of **both** are this+///   schema's stored properties. After `remove-article-mode` this file is+///   `JunkSuffixRule`'s only consumer — the live `Site` has no such column —+///   which is precisely why the type stays where it is, unchanged, until V15+///   itself retires (Q8). Do not move it, nest it, rename its properties or+///   touch its `Codable` representation.+/// * **Every enum whose raw value is baked into a default.** A default is part+///   of the shape, so `CaptureTitleSource.manual.rawValue`,+///   `EntryIdentityBasis.conservative.rawValue`, `TitleProvenance.manual`,+///   `SiteMode.untaught.rawValue`, `URLRuleOrigin.readerTaught`,+///   `WorkTypeState.active`, `CharacterSuppressionKind.candidate`,+///   `CharacterSuppressionStatus.active`, `WorkURLIdentityState.none`,+///   `WorkStatus.ongoing` and `ReadingStatus.reading` are all frozen *spellings*+///   here, not merely frozen references. Renaming a case, or reordering one+///   whose raw value is derived rather than written out, edits this file without+///   touching it.+///+///   **`SiteMode.articles` was never one of them.** `modeRaw` defaults to+///   `untaught`, so removing the `articles` case changed no default in this+///   file; an `articles` row is a stored *value* a V15 build wrote, and the+///   live build reads it as any other unknown mode (Decision 1).+///+/// # What this generation freezes beyond the columns+///+/// Everything V14's header named, carried across verbatim:+///+/// `@Attribute(.externalStorage)` on `thumbnailData` is the schema's only+/// attribute option and it is part of the **stored** shape, so it is carried+/// across verbatim (`work-thumbnails` Decision 2). `ThumbnailShape`'s two raw+/// spellings and the SHA-256 digest function are frozen for this generation+/// too — they are bytes in every installed library — but no *default* here+/// names them, because all three columns are optional.+///+/// And one of V15's own: **`ReleaseDay`'s seven raw spellings**, the lowercase+/// English day names `releaseDaysRaw` holds in every installed library. No+/// column default names them either — the default is the empty array — but a+/// stored spelling is a stored spelling. `ModelContractTests` pins the+/// spellings and the case order on the live schema. public enum AsterismSchemaV15: VersionedSchema {     public static let versionIdentifier = Schema.Version(15, 0, 0) @@ -47,43 +89,310 @@ public enum AsterismSchemaV15: VersionedSchema {     } } -/// The migration plan: `[V14, V15]`, one lightweight stage.-///-/// The V13 → V14 stage retired here, with `AsterismSchemaV13`,-/// `V13RecordedStoreFixture` and `V13RecordedStoreTests`, on-/// `retire-migration-chain` Decision 6's population precondition: every device-/// was confirmed on marker `"14"` on 2026-09-15 (`update-schedule`-/// `prerequisites.md`). As at the previous four bumps, the verification landed-/// *before* the freeze rather than a commit after it, so the marker set and the-/// plan have never disagreed at this generation.-///-/// The retirement is **one commit** with the freeze, because a fixture that-/// opens a deleted snapshot does not compile (Q43 of `work-and-reading-status`,-/// Q60 of `series-and-related-works`, Q15 of `work-creators`, Q65 of-/// `place-extraction`, and `work-thumbnails` again).-///-/// A store older than V14 fails closed — `NSCocoaErrorDomain` 134504, "Cannot-/// use staged migration with an unknown model version" — and the recovery is the-/// backup archive, which is what `V4RecordedStoreTests` pins.-///-/// The stage is `.lightweight` and purely **adds**. `.custom` is not an option-/// here for the reason it never is: a custom stage would also run inside the-/// share extension, which must never migrate, and the extension is kept out by-/// the marker instead.-///-/// The live stored shape is not a **subset** of the frozen one — V15 adds a-/// column — so `V14RecordedStoreFixture`'s create-seed-save-**release** ordering-/// is the only thing holding SwiftData's global entity registry coherent,-/// together with `make test-core`'s `--no-parallel`-/// (`docs/agent-notes/schema-migration.md`).-public enum AsterismV15MigrationPlan: SchemaMigrationPlan {-    public static var schemas: [any VersionedSchema.Type] {-        [AsterismSchemaV14.self, AsterismSchemaV15.self]-    }--    public static var stages: [MigrationStage] {-        [-            .lightweight(fromVersion: AsterismSchemaV14.self, toVersion: AsterismSchemaV15.self),-        ]+extension AsterismSchemaV15 {+    @Model+    public final class Entry {+        public var id: UUID = UUID()+        public var captureTitle: String = ""+        public var captureTitleSourceRaw: String = CaptureTitleSource.manual.rawValue+        public var rawURLString: String = ""+        public var canonicalURLString: String?+        public var hostname: String = ""+        public var site: Site?+        public var entryIdentityKey: String = ""+        public var conservativeIdentityKey: String = ""+        public var identityBasisRaw: String = EntryIdentityBasis.conservative.rawValue+        public var urlWorkIdentity: String?+        public var chapterSequence: String?+        public var chapterTitle: String?+        public var note: String = ""+        public var ratingRaw: String?+        public var firstCapturedAt: Date = Date(timeIntervalSince1970: 0)+        public var lastSharedAt: Date = Date(timeIntervalSince1970: 0)+        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)+        public var work: Work?+        public var intentionallyUnattached: Bool = false+        public var characterExtractionFingerprint: String?+        public var citationsData: Data?++        public init() {}+    }++    @Model+    public final class Work {+        public var id: UUID = UUID()+        public var displayTitle: String = ""+        public var lastParsedTitle: String?+        public var genericNotes: String = ""+        public var workTypeID: UUID?+        public var genreTags: [String] = []+        public var titleProvenanceRaw: String = TitleProvenance.manual.rawValue+        /// V10's three additions. Their property initialisers are the Core Data+        /// attribute defaults the V9 → V10 stage wrote into every existing row,+        /// which is why the two enum spellings are frozen here (see the header).+        public var workStatusRaw: String = WorkStatus.ongoing.rawValue+        public var readingStatusRaw: String = ReadingStatus.reading.rawValue+        public var verdict: String = ""+        /// V11's two additions, both **optional**: nil is "this work is in no+        /// series", so the V10 → V11 stage had no attribute default to write.+        public var seriesID: UUID?+        public var seriesPosition: Double?+        /// V15's one addition, and the only **defaulted** column any stage has+        /// added to this table since V10's three: a `[String]` on the+        /// `genreTags` shape (`update-schedule` Q27). Its property initialiser+        /// `= []` is the Core Data attribute default the V14 → V15 stage wrote+        /// into every existing row, which is why the empty array — and not any+        /// `ReleaseDay` spelling — is what is baked in here.+        public var releaseDaysRaw: [String] = []+        /// V14's three additions, all **optional**, so the V13 → V14 stage had+        /// no attribute default to write either.+        ///+        /// **`.externalStorage` is part of the stored shape**, not a hint: it+        /// puts the blob in a sidecar under the store's `_SUPPORT` directory and+        /// leaves a reference on the row (`work-thumbnails` Decision 2). It is+        /// the schema's only `@Attribute`, and it is carried across verbatim+        /// here for the reason this whole file exists — a snapshot whose stored+        /// shape differs from the recorded one by so much as an option makes a+        /// V14-recorded store refuse to open.+        @Attribute(.externalStorage)+        public var thumbnailData: Data?+        public var thumbnailShapeRaw: String?+        public var thumbnailDigest: String?+        public var createdAt: Date = Date(timeIntervalSince1970: 0)+        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)+        public var genericNotesExtractionFingerprint: String?+        @Relationship(deleteRule: .nullify, inverse: \Entry.work)+        public var entries: [Entry]?+        @Relationship(deleteRule: .nullify, inverse: \Character.work)+        public var characters: [Character]?+        @Relationship(deleteRule: .nullify, inverse: \CharacterSuppression.work)+        public var characterSuppressions: [CharacterSuppression]?+        @Relationship(deleteRule: .nullify, inverse: \WorkSiteMembership.work)+        public var siteMemberships: [WorkSiteMembership]? = []++        public init() {}+    }++    @Model+    public final class Site {+        public var hostname: String = ""+        public var displayName: String = ""+        public var modeRaw: String = SiteMode.untaught.rawValue+        @Relationship(deleteRule: .cascade, inverse: \TitlePattern.site)+        public var patterns: [TitlePattern]?+        @Relationship(deleteRule: .cascade, inverse: \URLRulePattern.site)+        public var urlRules: [URLRulePattern]?+        /// Inverse of `Entry.site`, present only because CloudKit requires every+        /// relationship to have one. Internal for the same reason the live class+        /// keeps it internal (Q17): traversing it faults every Entry for a+        /// hostname.+        @Relationship(deleteRule: .nullify, inverse: \Entry.site)+        var entries: [Entry]?+        /// Inverse of `WorkSiteMembership.site`. Same reasoning again.+        @Relationship(deleteRule: .nullify, inverse: \WorkSiteMembership.site)+        var workMemberships: [WorkSiteMembership]?+        public var junkSuffixRule: JunkSuffixRule?++        public init() {}+    }++    @Model+    public final class TitlePattern {+        public var id: UUID = UUID()+        public var version: Int = 1+        public var isActive: Bool = false+        public var createdAt: Date = Date(timeIntervalSince1970: 0)+        public var definitionData: Data?+        public var site: Site?++        public init() {}+    }++    @Model+    public final class URLRulePattern {+        public var id: UUID = UUID()+        public var version: Int = 1+        public var isCurrent: Bool = false+        public var createdAt: Date = Date(timeIntervalSince1970: 0)+        public var originRaw: String = URLRuleOrigin.readerTaught.rawValue+        public var definitionData: Data = Data()+        public var site: Site?++        public init() {}+    }++    @Model+    public final class WorkTypeEntity {+        public var id: UUID = UUID()+        public var name: String = ""+        public var nameModifiedAt: Date = Date(timeIntervalSince1970: 0)+        public var stateRaw: String = WorkTypeState.active.rawValue+        public var stateModifiedAt: Date = Date(timeIntervalSince1970: 0)+        public var canonicalID: UUID?+        public var createdAt: Date = Date(timeIntervalSince1970: 0)+        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)++        public init() {}+    }++    @Model+    public final class Character {+        public var id: UUID = UUID()+        public var name: String = ""+        public var nameKey: String = ""+        public var aliases: [String] = []+        public var note: String = ""+        public var factsData: Data?+        public var createdAt: Date = Date(timeIntervalSince1970: 0)+        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)+        public var work: Work?++        public init() {}+    }++    @Model+    public final class CharacterSuppression {+        public var id: UUID = UUID()+        public var work: Work?+        public var kindRaw: String = CharacterSuppressionKind.candidate.rawValue+        public var nameKey: String = ""+        public var sourceKindRaw: String?+        public var sourceEntryID: UUID?+        public var evidence: String?+        public var statusRaw: String = CharacterSuppressionStatus.active.rawValue+        public var actionAt: Date = Date(timeIntervalSince1970: 0)++        public init() {}+    }++    @Model+    public final class WorkSiteMembership {+        public var id: UUID = UUID()+        public var hostname: String = ""+        public var createdAt: Date = Date(timeIntervalSince1970: 0)+        public var urlIdentity: String?+        public var urlIdentityStateRaw: String = WorkURLIdentityState.none.rawValue+        public var urlIdentityRuleID: UUID?+        public var workURLString: String?+        public var workID: UUID?+        public var work: Work?+        public var site: Site?++        public init() {}+    }++    @Model+    public final class WorkDistinctPair {+        public var id: UUID = UUID()+        public var lowerWorkID: UUID = UUID()+        public var higherWorkID: UUID = UUID()+        public var recordedAt: Date = Date(timeIntervalSince1970: 0)++        public init() {}+    }++    @Model+    public final class Series {+        public var id: UUID = UUID()+        public var name: String = ""+        public var notes: String = ""+        public var createdAt: Date = Date(timeIntervalSince1970: 0)+        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)++        public init() {}+    }++    @Model+    public final class WorkLink {+        public var id: UUID = UUID()+        public var lowerWorkID: UUID = UUID()+        public var higherWorkID: UUID = UUID()+        public var linkType: String = ""+        public var createdAt: Date = Date(timeIntervalSince1970: 0)+        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)++        public init() {}+    }++    /// V12's three additions. `stateRaw` defaults to the **literal** `"active"`+    /// rather than to `CreatorState.active.rawValue`, which is why neither of+    /// the two new enums appears in the header's frozen-spelling list.+    @Model+    public final class Creator {+        public var id: UUID = UUID()+        public var name: String = ""+        public var nameModifiedAt: Date = Date(timeIntervalSince1970: 0)+        public var notes: String = ""+        public var notesModifiedAt: Date = Date(timeIntervalSince1970: 0)+        public var stateRaw: String = "active"+        public var stateModifiedAt: Date = Date(timeIntervalSince1970: 0)+        public var canonicalID: UUID?+        public var createdAt: Date = Date(timeIntervalSince1970: 0)+        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)++        public init() {}+    }++    @Model+    public final class CreatorRole {+        public var id: UUID = UUID()+        public var name: String = ""+        public var nameModifiedAt: Date = Date(timeIntervalSince1970: 0)+        public var position: Int = 0+        public var positionModifiedAt: Date = Date(timeIntervalSince1970: 0)+        public var stateRaw: String = "active"+        public var stateModifiedAt: Date = Date(timeIntervalSince1970: 0)+        public var canonicalID: UUID?+        public var createdAt: Date = Date(timeIntervalSince1970: 0)+        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)++        public init() {}+    }++    @Model+    public final class WorkCredit {+        public var id: UUID = UUID()+        public var workID: UUID = UUID()+        public var creatorID: UUID = UUID()+        public var roleIDs: [String] = []+        public var createdAt: Date = Date(timeIntervalSince1970: 0)+        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)++        public init() {}+    }++    /// V13's two additions. Both name their work by **UUID column** rather than+    /// by relationship, which is why neither declares a `@Relationship` at all,+    /// and both enum columns default to the *shared* suppression enums already+    /// frozen through `CharacterSuppression` above — so V13 brought no new+    /// frozen spelling into this file either.+    @Model+    public final class Place {+        public var id: UUID = UUID()+        public var name: String = ""+        public var nameKey: String = ""+        public var aliases: [String] = []+        public var note: String = ""+        public var factsData: Data?+        public var createdAt: Date = Date(timeIntervalSince1970: 0)+        public var modifiedAt: Date = Date(timeIntervalSince1970: 0)+        public var workID: UUID = UUID()++        public init() {}+    }++    @Model+    public final class PlaceSuppression {+        public var id: UUID = UUID()+        public var workID: UUID = UUID()+        public var kindRaw: String = CharacterSuppressionKind.candidate.rawValue+        public var nameKey: String = ""+        public var sourceKindRaw: String?+        public var sourceEntryID: UUID?+        public var evidence: String?+        public var statusRaw: String = CharacterSuppressionStatus.active.rawValue+        public var actionAt: Date = Date(timeIntervalSince1970: 0)++        public init() {}     } }
Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV16.swift Added +95 / -0
diff --git a/Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV16.swift b/Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV16.swiftnew file mode 100644index 00000000..506a63d2--- /dev/null+++ b/Packages/AsterismCore/Sources/AsterismCore/AsterismSchemaV16.swift@@ -0,0 +1,95 @@+import Foundation+import SwiftData++/// The runtime schema. Its body is `Models.swift`, which opens+/// `extension AsterismSchemaV16`.+///+/// V16 is V15 **minus one `Site` column** — `junkSuffixRule`, the title cleaner+/// only articles mode ever wrote (`remove-article-mode`). Nothing else moves: no+/// table is added or removed, no existing column changes type, no relationship+/// changes shape, and the entity list stays at seventeen.+///+/// **It is the second stage in the project's history to remove anything**, after+/// V8 → V9, and the first since. A removing stage has no attribute default to+/// write: the column simply stops existing, and Core Data drops it inside+/// `ModelContainer.init`. There is no data pass, and there is nothing for one to+/// do — the value the column held has no reader left, which is what+/// `remove-article-mode`'s first commit established.+///+/// A store that arrives here carrying `modeRaw = "articles"` — written by a V15+/// build on another device — keeps that value. It is a stored *value*, not a+/// stored shape, and the live build reads it as any other unknown mode:+/// quarantined under `.siteTuple`, omitted from the sites list, refused by name+/// on export, and no obstacle to the library opening or to marker `"16"` being+/// published (Req 3.4, Decision 1).+///+/// # What this generation freezes+///+/// The next freeze inherits everything V15's header named, unchanged:+/// `ThumbnailShape`'s two raw spellings, the SHA-256 digest function,+/// `@Attribute(.externalStorage)` on `thumbnailData` — part of the *stored*+/// shape rather than a hint — and `ReleaseDay`'s seven lowercase English day+/// names. V16 brings nothing of its own: a stage that only removes bakes no new+/// raw value in anywhere.+public enum AsterismSchemaV16: VersionedSchema {+    public static let versionIdentifier = Schema.Version(16, 0, 0)++    public static var models: [any PersistentModel.Type] {+        [Entry.self, Work.self, Site.self, TitlePattern.self, URLRulePattern.self,+         WorkTypeEntity.self, Character.self, CharacterSuppression.self,+         WorkSiteMembership.self, WorkDistinctPair.self,+         Series.self, WorkLink.self,+         Creator.self, CreatorRole.self, WorkCredit.self,+         Place.self, PlaceSuppression.self]+    }+}++/// The migration plan: `[V15, V16]`, one lightweight stage.+///+/// The V14 → V15 stage retired here, with `AsterismSchemaV14`,+/// `V14RecordedStoreFixture` and `V14RecordedStoreTests`, on+/// `retire-migration-chain` Decision 6's population precondition: every device+/// was confirmed on marker `"15"` on 2026-09-21 (`remove-article-mode` Q10). As+/// at the previous five bumps, the verification landed *before* the freeze+/// rather than a commit after it, so the marker set and the plan have never+/// disagreed at this generation.+///+/// The retirement is **one commit** with the freeze, because a fixture that+/// opens a deleted snapshot does not compile (Q43 of `work-and-reading-status`,+/// Q60 of `series-and-related-works`, Q15 of `work-creators`, Q65 of+/// `place-extraction`, and `work-thumbnails` and `update-schedule` again).+///+/// A store older than V15 fails closed — `NSCocoaErrorDomain` 134504, "Cannot+/// use staged migration with an unknown model version" — and the recovery is the+/// backup archive, which is what `V4RecordedStoreTests` pins.+///+/// The stage is `.lightweight` and purely **removes**. `.custom` is not an+/// option here, and for a removing stage the reason is sharper than usual: a+/// custom stage would also run inside the share extension, which must never+/// migrate, and a concurrent share-sheet open part-way through a *removal* is+/// destructive rather than merely early. The extension is kept out by the+/// marker instead — it opens `"16"` only.+///+/// V8 → V9 is the precedent for the shape of this stage: it dropped optional+/// `Codable` struct attributes of exactly `JunkSuffixRule`'s kind+/// (`Site.urlIdentityRule`, `TitlePattern.segmentWorkAnchor`) under one+/// lightweight stage, which is why no spike preceded this one (Q14).+///+/// The live stored shape is a strict **subset** of the frozen one again, for the+/// first time since V9 — V16 only removes — so a stale snapshot registration+/// cannot meet a live key it is unable to answer. That is a safety net V10+/// through V15 did not have, and it is not the one being relied on:+/// `V15RecordedStoreFixture`'s create-seed-save-**release** ordering, together+/// with `make test-core`'s `--no-parallel`, is still what holds SwiftData's+/// global entity registry coherent (`docs/agent-notes/schema-migration.md`).+public enum AsterismV16MigrationPlan: SchemaMigrationPlan {+    public static var schemas: [any VersionedSchema.Type] {+        [AsterismSchemaV15.self, AsterismSchemaV16.self]+    }++    public static var stages: [MigrationStage] {+        [+            .lightweight(fromVersion: AsterismSchemaV15.self, toVersion: AsterismSchemaV16.self),+        ]+    }+}
Packages/AsterismCore/Sources/AsterismCore/BackupArchiveProjection.swift Modified +69 / -76
diff --git a/Packages/AsterismCore/Sources/AsterismCore/BackupArchiveProjection.swift b/Packages/AsterismCore/Sources/AsterismCore/BackupArchiveProjection.swiftindex c6524155..6e4d8a4b 100644--- a/Packages/AsterismCore/Sources/AsterismCore/BackupArchiveProjection.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/BackupArchiveProjection.swift@@ -4,7 +4,7 @@ import SwiftData  private let exportLogger = Logger(subsystem: "AsterismCore", category: "BackupExport") -// The record projection every 14/15 export runs through, and the three refusals it+// The record projection every 15/16 export runs through, and the three refusals it // names. It stood in the 4/4 exporter while three generations shared it; // those generations are gone and this is the live export path, so it stands on // its own.@@ -15,14 +15,14 @@ private let exportLogger = Logger(subsystem: "AsterismCore", category: "BackupEx /// the Work mapper, plus the identity groups it needs. internal struct ArchiveCommonProjection {     let groups: BackupGroupProjection.Projection-    let entries: [BackupV14Entry]-    let sites: [BackupV14Site]-    let titlePatterns: [BackupV14TitlePattern]-    let urlRules: [BackupV14URLRule]+    let entries: [BackupV15Entry]+    let sites: [BackupV15Site]+    let titlePatterns: [BackupV15TitlePattern]+    let urlRules: [BackupV15URLRule]     /// One record per Work and hostname (Req 9.1), enumerated whole rather than     /// works→children (Q17): a membership whose Work has not arrived exports     /// naming the Work it belongs to instead of vanishing from the backup.-    let memberships: [BackupV14Membership]+    let memberships: [BackupV15Membership] }  /// Every Entry row's citations, decoded **once** for the whole projection.@@ -129,7 +129,7 @@ extension LibraryRepository {         var additionalPatterns: [String: [TitlePattern]] = [:]         for pattern in archivablePatterns where pattern.site == nil {             guard let hostname = citers[pattern.id] else {-                throw BackupV14ExportError.referencesStillArriving(+                throw BackupV15ExportError.referencesStillArriving(                     detail: "title rule \(pattern.id) has no site and no entry naming one")             }             additionalPatterns[hostname, default: []].append(pattern)@@ -137,7 +137,7 @@ extension LibraryRepository {         var additionalURLRules: [String: [URLRulePattern]] = [:]         for rule in archivableURLRules where rule.site == nil {             guard let hostname = citers[rule.id] else {-                throw BackupV14ExportError.referencesStillArriving(+                throw BackupV15ExportError.referencesStillArriving(                     detail: "URL rule \(rule.id) has no site and no record naming one")             }             additionalURLRules[hostname, default: []].append(rule)@@ -164,25 +164,25 @@ extension LibraryRepository {             ruleMembership: .oneRowPerIdentityGroup)         try requireProjectedTuplesRepresentable(projected) -        var wireSites: [BackupV14Site] = []-        var wirePatterns: [BackupV14TitlePattern] = []-        var wireRules: [BackupV14URLRule] = []+        var wireSites: [BackupV15Site] = []+        var wirePatterns: [BackupV15TitlePattern] = []+        var wireRules: [BackupV15URLRule] = []         for site in projected {-            wireSites.append(mapV14SiteRecord(site))+            wireSites.append(mapV15SiteRecord(site))             for projectedPattern in site.patterns             where !omittedTitlePatternIDs.contains(projectedPattern.pattern.id) {                 wirePatterns.append(-                    try mapV14TitlePatternRecord(projectedPattern, hostname: site.hostname))+                    try mapV15TitlePatternRecord(projectedPattern, hostname: site.hostname))             }             for projectedRule in site.urlRules             where !omittedURLRuleIDs.contains(projectedRule.rule.id) {-                wireRules.append(try mapV14URLRuleRecord(projectedRule, hostname: site.hostname))+                wireRules.append(try mapV15URLRuleRecord(projectedRule, hostname: site.hostname))             }         }          return ArchiveCommonProjection(             groups: groups,-            entries: try groups.entries.map { try mapV14EntryRecord($0, citations: citations) },+            entries: try groups.entries.map { try mapV15EntryRecord($0, citations: citations) },             sites: wireSites.sorted { $0.hostname < $1.hostname },             titlePatterns: wirePatterns.sorted { $0.id.uuidString < $1.id.uuidString },             urlRules: wireRules.sorted { $0.id.uuidString < $1.id.uuidString },@@ -225,7 +225,7 @@ extension LibraryRepository {             // than reached by a mapper that would throw a raw `DecodingError`.             do { _ = try citations.value(of: entry) }             catch {-                throw BackupV14ExportError.unrepresentableValue(+                throw BackupV15ExportError.unrepresentableValue(                     record: record, field: "citations", value: String(describing: error))             }         }@@ -252,22 +252,22 @@ extension LibraryRepository {             case (nil, nil):                 break             case (let id?, nil):-                throw BackupV14ExportError.unrepresentableValue(+                throw BackupV15ExportError.unrepresentableValue(                     record: record, field: "series membership",                     value: "series \(id) with no position")             case (nil, let position?):-                throw BackupV14ExportError.unrepresentableValue(+                throw BackupV15ExportError.unrepresentableValue(                     record: record, field: "series membership",                     value: "position \(position) with no series")             case (_?, let position?):                 guard position.isFinite else {-                    throw BackupV14ExportError.unrepresentableValue(+                    throw BackupV15ExportError.unrepresentableValue(                         record: record, field: "series position", value: String(position))                 }                 // Q15: at most one fraction digit. Rounding here would move a                 // reader's value inside their own backup.                 guard position == SeriesPosition.rounded(position) else {-                    throw BackupV14ExportError.unrepresentableValue(+                    throw BackupV15ExportError.unrepresentableValue(                         record: record, field: "series position", value: String(position))                 }             }@@ -275,7 +275,7 @@ extension LibraryRepository {             // one refusal of this generation that is not: the cover the file             // carries is chosen over the whole identity group rather than off             // one row, so the row this loop is holding may not be the row the-            // archive exports. It is refused in `mapV14WorkRecord`, against+            // archive exports. It is refused in `mapV15WorkRecord`, against             // exactly the bytes the record takes (Q79).             //             // `update-schedule` Req 8.3, on the statuses' terms: the accessor@@ -315,7 +315,7 @@ extension LibraryRepository {             // `formRaw` that no longer exists.             do { _ = try pattern.storedDefinition }             catch {-                throw BackupV14ExportError.unrepresentableValue(+                throw BackupV15ExportError.unrepresentableValue(                     record: record, field: "definition", value: String(describing: error))             }         }@@ -353,7 +353,7 @@ extension LibraryRepository {         var omitted: Set<UUID> = []         for (id, rule) in unreadable.sorted(by: { $0.key.uuidString < $1.key.uuidString }) {             guard !cited.contains(id) else {-                throw BackupV14ExportError.unrepresentableValue(+                throw BackupV15ExportError.unrepresentableValue(                     record: "URL rule \(id)", field: "definition",                     value: "\(rule.definitionData.count) bytes that do not decode")             }@@ -404,7 +404,7 @@ extension LibraryRepository {         var omitted: Set<UUID> = []         for (id, pattern) in unreadable.sorted(by: { $0.key.uuidString < $1.key.uuidString }) {             guard !pattern.isActive, !cited.contains(id) else {-                throw BackupV14ExportError.unrepresentableValue(+                throw BackupV15ExportError.unrepresentableValue(                     record: "Title rule \(id)", field: "definition",                     value: pattern.definitionData.map { "\($0.count) bytes that do not decode" }                         ?? "no stored definition")@@ -460,16 +460,15 @@ extension LibraryRepository {         _ value: Value?, _ record: String, _ field: String, _ raw: String     ) throws {         guard value == nil else { return }-        throw BackupV14ExportError.unrepresentableValue(record: record, field: field, value: raw)+        throw BackupV15ExportError.unrepresentableValue(record: record, field: field, value: raw)     }      /// Req 3.7's third face: a hostname whose *projected* tuple the archive     /// format has no case for.     ///     /// The archive's closed tuple table (`BackupArchiveReferenceChecks`) wants a-    /// `.taught` Site to hold exactly one active title rule, an `.untaught` one-    /// to hold nothing but imported V2 URL history, and an `.articles` one to-    /// hold neither an active title rule nor a current URL rule.+    /// `.taught` Site to hold exactly one active title rule and an `.untaught`+    /// one to hold nothing but imported V2 URL history.     /// `SiteUnionProjection.mode` deliberately *preserves* a row that satisfies     /// none of those rather than inventing a mode for it.     ///@@ -486,7 +485,7 @@ extension LibraryRepository {             switch site.mode {             case .taught:                 guard activePatterns != 1 else { continue }-                throw BackupV14ExportError.referencesStillArriving(+                throw BackupV15ExportError.referencesStillArriving(                     detail: "site \(site.hostname) is taught, and the one active title rule "                         + "that state needs is not in the library")             case .untaught:@@ -494,14 +493,9 @@ extension LibraryRepository {                     $0.rule.origin == .importedV2 && !$0.isCurrent                 }                 guard !site.patterns.isEmpty || currentRules > 0 || !historyOnly else { continue }-                throw BackupV14ExportError.referencesStillArriving(+                throw BackupV15ExportError.referencesStillArriving(                     detail: "site \(site.hostname) is untaught while still holding rules, "                         + "so the teaching that owns them has not arrived")-            case .articles:-                guard activePatterns > 0 || currentRules > 0 else { continue }-                throw BackupV14ExportError.referencesStillArriving(-                    detail: "site \(site.hostname) reads as articles while still holding an "-                        + "active rule, so the change that cleared them has not arrived")             }         }     }@@ -520,10 +514,10 @@ extension LibraryRepository {     /// problem surfacing as a broken file, which is exactly what this gate     /// exists to say first.     internal static func requireCitationsResolve(-        entries: [BackupV14Entry],-        memberships: [BackupV14Membership],-        titlePatterns: [BackupV14TitlePattern],-        urlRules: [BackupV14URLRule]+        entries: [BackupV15Entry],+        memberships: [BackupV15Membership],+        titlePatterns: [BackupV15TitlePattern],+        urlRules: [BackupV15URLRule]     ) throws {         let rulesByID = Dictionary(urlRules.map { ($0.id, $0) }, uniquingKeysWith: { lhs, _ in lhs })         let patternHostnames = Dictionary(@@ -563,14 +557,14 @@ extension LibraryRepository {      private static func crossSiteCitation(         _ record: String, _ field: String, taughtFor hostname: String-    ) -> BackupV14ExportError {+    ) -> BackupV15ExportError {         .referencesStillArriving(             detail: "\(record) names \(field), which is taught for \(hostname)")     }      private static func missingCitation(         _ record: String, _ field: String-    ) -> BackupV14ExportError {+    ) -> BackupV15ExportError {         .referencesStillArriving(             detail: "\(record) names \(field), which the library does not hold")     }@@ -617,9 +611,9 @@ extension LibraryRepository {     /// a citation of a rule the projection renumbered was archived at the     /// version the archive actually held (Decision 7). A citation is a UUID     /// (T-2281) and nothing renumbers, so the map and the parameter are gone.-    internal static func mapV14EntryRecord(+    internal static func mapV15EntryRecord(         _ group: EntryGroup, citations cache: EntryCitationsCache-    ) throws -> BackupV14Entry {+    ) throws -> BackupV15Entry {         let snap = try snapshot(group)         let entry = group.representative         let carrier = group.carrier@@ -629,7 +623,7 @@ extension LibraryRepository {             citations.chapterTitle = carried.chapterTitle             citations.workAssignment = carried.workAssignment         }-        return BackupV14Entry(+        return BackupV15Entry(             id: snap.id,             captureTitle: snap.captureTitle,             captureTitleSource: snap.captureTitleSource,@@ -709,32 +703,32 @@ extension LibraryRepository {         guard let raw = group.carrier.thumbnailShapeRaw else { return nil }         let titled = "Work “\(group.carrier.displayTitle)”"         guard let shape = ThumbnailShape(rawValue: raw) else {-            throw BackupV14ExportError.unrepresentableValue(-                record: titled, field: BackupV14ExportError.thumbnailField, value: raw)+            throw BackupV15ExportError.unrepresentableValue(+                record: titled, field: BackupV15ExportError.thumbnailField, value: raw)         }         guard let identity = group.carrier.thumbnailIdentity,               let bytes = GroupOrdering.thumbnailBytes(forDigest: identity.digest, in: group.rows)         else { return nil }         guard ThumbnailCodec.validate(bytes, shape: shape) else {-            throw BackupV14ExportError.unrepresentableValue(-                record: titled, field: BackupV14ExportError.thumbnailField,+            throw BackupV15ExportError.unrepresentableValue(+                record: titled, field: BackupV15ExportError.thumbnailField,                 value: "\(bytes.count) bytes that are not a \(raw) cover")         }         return bytes     } -    internal static func mapV14WorkRecord(+    internal static func mapV15WorkRecord(         _ group: WorkGroup,         canonicalWorkIDs: [UUID: UUID],         types: WorkTypeDirectory-    ) throws -> BackupV14Work {+    ) throws -> BackupV15Work {         let snap = try snapshot(             group, canonicalWorkIDs: canonicalWorkIDs, types: types, series: .empty,             // An **empty** credit index for the empty directory's reason: this             // mapper reads the `Work` record's own fields, and a credit is a             // record of its own that the archive projects beside them             // (`work-creators` Decision 6). Folding the whole credit table per-            // exported work to fill a field no `BackupV14Work` carries is a read+            // exported work to fill a field no `BackupV15Work` carries is a read             // this path skips.             credits: .empty)         let thumbnailBytes = try requireRepresentableCover(group)@@ -748,7 +742,7 @@ extension LibraryRepository {         case .configured(let id):             (workTypeID, typeName) = (id, types.resolve(id)?.name)         }-        return BackupV14Work(+        return BackupV15Work(             id: snap.id,             displayTitle: snap.displayTitle,             lastParsedTitle: snap.lastParsedTitle,@@ -819,7 +813,7 @@ extension LibraryRepository {     /// there.     private static func mapMembershipRecords(         _ rows: [WorkSiteMembership]-    ) -> [BackupV14Membership] {+    ) -> [BackupV15Membership] {         var byKey: [MembershipReconciler.Key: [WorkSiteMembership]] = [:]         var unattributed: [WorkSiteMembership] = []         for row in rows {@@ -830,8 +824,8 @@ extension LibraryRepository {             byKey[MembershipReconciler.Key(workID: workID, hostname: row.hostname), default: []]                 .append(row)         }-        func record(_ row: WorkSiteMembership, workURLString: String?) -> BackupV14Membership {-            BackupV14Membership(+        func record(_ row: WorkSiteMembership, workURLString: String?) -> BackupV15Membership {+            BackupV15Membership(                 id: row.id, workID: row.resolvedWorkID, hostname: row.hostname,                 createdAt: row.createdAt, urlIdentity: row.urlIdentity,                 urlIdentityState: row.urlIdentityState,@@ -846,7 +840,7 @@ extension LibraryRepository {         // [4.2](../../../../specs/wrong-host-work-url-heal/requirements.md#42)         // cannot survive. Nothing is written back: the fold returns the value         // and the record carries it (Q54).-        var records: [BackupV14Membership] = []+        var records: [BackupV15Membership] = []         for rows in byKey.values {             let ordered = MembershipReconciler.survivorFirst(rows)             guard let keeper = ordered.first else { continue }@@ -884,7 +878,7 @@ extension LibraryRepository {     /// clauses are this projection's own: the directory's tie-break is the     /// identifier, which two rows of one series share, and a tie the fetch order     /// broke would put two devices' archives one byte apart.-    internal static func projectSeries(context: ModelContext) throws -> [BackupV14Series] {+    internal static func projectSeries(context: ModelContext) throws -> [BackupV15Series] {         var byID: [UUID: Series] = [:]         for row in try context.fetch(FetchDescriptor<Series>()) {             guard let held = byID[row.id] else {@@ -895,7 +889,7 @@ extension LibraryRepository {         }         return byID.values             .map {-                BackupV14Series(+                BackupV15Series(                     id: $0.id, name: $0.name, notes: $0.notes,                     createdAt: $0.createdAt, modifiedAt: $0.modifiedAt)             }@@ -917,7 +911,7 @@ extension LibraryRepository {     /// a self-naming pair is — Req 6.1 forbids a link from a work to itself, so     /// such a row is not a link a reader can have meant, and `dedupeLinks`     /// deletes it too.-    internal static func projectLinks(context: ModelContext) throws -> [BackupV14Link] {+    internal static func projectLinks(context: ModelContext) throws -> [BackupV15Link] {         var byKey: [WorkPairKey: [WorkLink]] = [:]         for row in try context.fetch(FetchDescriptor<WorkLink>())         where row.lowerWorkID != row.higherWorkID {@@ -927,7 +921,7 @@ extension LibraryRepository {             guard let survivor = MembershipReconciler.survivorFirstLinks(rows).first else {                 return nil             }-            return BackupV14Link(+            return BackupV15Link(                 id: survivor.id, lowerWorkID: key.lower, higherWorkID: key.higher,                 linkType: survivor.linkType, createdAt: survivor.createdAt,                 modifiedAt: survivor.modifiedAt)@@ -959,7 +953,7 @@ extension LibraryRepository {     /// the same number the next local pass would.     internal static func projectCredits(         context: ModelContext, creators: CreatorDirectory-    ) throws -> [BackupV14Credit] {+    ) throws -> [BackupV15Credit] {         var byKey: [CreditReconciler.Key: [WorkCredit]] = [:]         for row in try context.fetch(FetchDescriptor<WorkCredit>()) {             let key = CreditReconciler.Key(@@ -969,7 +963,7 @@ extension LibraryRepository {         return byKey.compactMap { _, rows in             let ordered = WorkCreditSupport.survivorFirstCredits(rows)             guard let head = ordered.first else { return nil }-            return BackupV14Credit(+            return BackupV15Credit(                 id: head.id, workID: head.workID, creatorID: head.creatorID,                 roleIDs: WorkCreditSupport.roleIDs(ordered.flatMap(\.roleIDs)),                 createdAt: head.createdAt,@@ -980,7 +974,7 @@ extension LibraryRepository {      internal static func projectDistinctPairs(         context: ModelContext-    ) throws -> [BackupV14DistinctPair] {+    ) throws -> [BackupV15DistinctPair] {         var byKey: [WorkPairKey: [WorkDistinctPair]] = [:]         for row in try context.fetch(FetchDescriptor<WorkDistinctPair>())         where row.lowerWorkID != row.higherWorkID {@@ -992,7 +986,7 @@ extension LibraryRepository {             guard let survivor = MembershipReconciler.survivorFirstPairs(rows).first else {                 return nil             }-            return BackupV14DistinctPair(+            return BackupV15DistinctPair(                 id: survivor.id, lowerWorkID: key.lower, higherWorkID: key.higher,                 recordedAt: survivor.recordedAt)         }@@ -1002,21 +996,20 @@ extension LibraryRepository {     /// The wire Site for a hostname: exactly one, whatever the store holds     /// (Q38). It names no children (Req 9.3) — the union still decides which     /// rules are archived, and each of them names this hostname back.-    internal static func mapV14SiteRecord(+    internal static func mapV15SiteRecord(         _ projected: SiteUnionProjection.ProjectedSite-    ) -> BackupV14Site {-        BackupV14Site(+    ) -> BackupV15Site {+        BackupV15Site(             hostname: projected.hostname,             displayName: projected.displayName,-            mode: projected.mode,-            junkSuffixRule: projected.junkSuffixRule+            mode: projected.mode         )     } -    internal static func mapV14TitlePatternRecord(+    internal static func mapV15TitlePatternRecord(         _ projected: SiteUnionProjection.ProjectedTitlePattern, hostname: String-    ) throws -> BackupV14TitlePattern {-        BackupV14TitlePattern(+    ) throws -> BackupV15TitlePattern {+        BackupV15TitlePattern(             id: projected.pattern.id,             siteHostname: hostname,             // The version stored on the row the per-UUID reduction kept, without@@ -1031,17 +1024,17 @@ extension LibraryRepository {     /// `throws` because the definition does (Req 4.5): the mapper needs a typed     /// `URLRuleDefinition` for every row it writes, so a row that will not     /// decode cannot be archived at all.-    internal static func mapV14URLRuleRecord(+    internal static func mapV15URLRuleRecord(         _ projected: SiteUnionProjection.ProjectedURLRule, hostname: String-    ) throws -> BackupV14URLRule {+    ) throws -> BackupV15URLRule {         let definition: URLRuleDefinition         do { definition = try projected.rule.definition }         catch {-            throw BackupV14ExportError.unrepresentableValue(+            throw BackupV15ExportError.unrepresentableValue(                 record: "URL rule \(projected.rule.id)", field: "definition",                 value: "\(projected.rule.definitionData.count) bytes that do not decode")         }-        return BackupV14URLRule(+        return BackupV15URLRule(             id: projected.rule.id,             version: projected.rule.version,             isCurrent: projected.isCurrent,
Packages/AsterismCore/Sources/AsterismCore/BackupArchiveReferenceChecks.swift Modified +27 / -31
diff --git a/Packages/AsterismCore/Sources/AsterismCore/BackupArchiveReferenceChecks.swift b/Packages/AsterismCore/Sources/AsterismCore/BackupArchiveReferenceChecks.swiftindex 8f60bd0a..9871da2b 100644--- a/Packages/AsterismCore/Sources/AsterismCore/BackupArchiveReferenceChecks.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/BackupArchiveReferenceChecks.swift@@ -24,18 +24,18 @@ internal enum BackupArchiveReferenceChecks {     ///   refusal — the one message here that has to say which archive format it     ///   is talking about.     static func validate(-        entries: [BackupV14Entry],-        works: [BackupV14Work],-        memberships: [BackupV14Membership],-        distinctPairs: [BackupV14DistinctPair],-        sites: [BackupV14Site],-        titlePatterns: [BackupV14TitlePattern],-        urlRules: [BackupV14URLRule],-        series: [BackupV14Series],-        links: [BackupV14Link],-        creators: [BackupV14Creator],-        creatorRoles: [BackupV14CreatorRole],-        credits: [BackupV14Credit],+        entries: [BackupV15Entry],+        works: [BackupV15Work],+        memberships: [BackupV15Membership],+        distinctPairs: [BackupV15DistinctPair],+        sites: [BackupV15Site],+        titlePatterns: [BackupV15TitlePattern],+        urlRules: [BackupV15URLRule],+        series: [BackupV15Series],+        links: [BackupV15Link],+        creators: [BackupV15Creator],+        creatorRoles: [BackupV15CreatorRole],+        credits: [BackupV15Credit],         formatLabel: String     ) throws {         let siteHostnames = Set(sites.map(\.hostname))@@ -306,9 +306,9 @@ internal enum BackupArchiveReferenceChecks {     // MARK: Site closed tuple (supersedes M3 8.1)      private static func validateSiteTuple(-        _ site: BackupV14Site,-        patterns: [BackupV14TitlePattern],-        rules: [BackupV14URLRule]+        _ site: BackupV15Site,+        patterns: [BackupV15TitlePattern],+        rules: [BackupV15URLRule]     ) throws {         let id = site.hostname         guard !M2Unicode.isBlank(site.hostname) else { throw invalid("Site", id, "hostname is blank") }@@ -340,15 +340,11 @@ internal enum BackupArchiveReferenceChecks {                 throw invalid("Site", id, "untaught tuple may retain only imported V2 URL history")             }         case .taught:-            // Decision 5: a taught non-articles Site always holds exactly one-            // active title rule; any URL field set is legal.+            // Decision 5: a taught Site always holds exactly one active title+            // rule; any URL field set is legal.             guard activePatternCount == 1 else {                 throw invalid("Site", id, "taught tuple requires exactly one active title rule")             }-        case .articles:-            guard activePatternCount == 0, currentRules.isEmpty else {-                throw invalid("Site", id, "articles tuple cannot have active title or URL rules")-            }         }     } @@ -373,9 +369,9 @@ internal enum BackupArchiveReferenceChecks {     /// (Req 9.5, Q22); its own tuple is still checked, because an orphan is a     /// row like any other.     private static func validateMembership(-        _ membership: BackupV14Membership,+        _ membership: BackupV15Membership,         siteHostnames: Set<String>,-        rulesByID: [UUID: BackupV14URLRule]+        rulesByID: [UUID: BackupV15URLRule]     ) throws {         let id = membership.id.uuidString         guard !M2Unicode.isBlank(membership.hostname) else {@@ -404,12 +400,12 @@ internal enum BackupArchiveReferenceChecks {     // MARK: Entry (Entry-state enumeration, supersedes M3 8.12)      private static func validateEntry(-        _ entry: BackupV14Entry,+        _ entry: BackupV15Entry,         siteHostnames: Set<String>,         workIDs: Set<UUID>,         hostnamesByWork: [UUID: Set<String>],-        patternsByID: [UUID: BackupV14TitlePattern],-        rulesByID: [UUID: BackupV14URLRule]+        patternsByID: [UUID: BackupV15TitlePattern],+        rulesByID: [UUID: BackupV15URLRule]     ) throws {         let id = entry.id.uuidString         guard siteHostnames.contains(entry.hostname) else {@@ -490,15 +486,15 @@ internal enum BackupArchiveReferenceChecks {     /// dangling citation is an unresolved reference — so the predicate is stated     /// once and each caller names its own failure.     private static func resolvesSameSite(-        _ cited: CitedRule, entry: BackupV14Entry, rulesByID: [UUID: BackupV14URLRule]+        _ cited: CitedRule, entry: BackupV15Entry, rulesByID: [UUID: BackupV15URLRule]     ) -> Bool {         rulesByID[cited.id]?.siteHostname == entry.hostname     }      private static func requireSameSiteRule(         _ cited: CitedRule,-        entry: BackupV14Entry,-        rulesByID: [UUID: BackupV14URLRule]+        entry: BackupV15Entry,+        rulesByID: [UUID: BackupV15URLRule]     ) throws {         guard resolvesSameSite(cited, entry: entry, rulesByID: rulesByID) else {             throw invalid(@@ -508,10 +504,10 @@ internal enum BackupArchiveReferenceChecks {     }      private static func validateEntryRuleReference(-        _ entry: BackupV14Entry,+        _ entry: BackupV15Entry,         field: String,         cited: CitedRule?,-        rulesByID: [UUID: BackupV14URLRule]+        rulesByID: [UUID: BackupV15URLRule]     ) throws {         guard let cited else { return }         guard resolvesSameSite(cited, entry: entry, rulesByID: rulesByID) else {
Packages/AsterismCore/Sources/AsterismCore/BackupExporter.swift Modified +1 / -1
diff --git a/Packages/AsterismCore/Sources/AsterismCore/BackupExporter.swift b/Packages/AsterismCore/Sources/AsterismCore/BackupExporter.swiftindex 6b61efb6..e638c784 100644--- a/Packages/AsterismCore/Sources/AsterismCore/BackupExporter.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/BackupExporter.swift@@ -1,7 +1,7 @@ import Foundation  /// The file a completed backup export produced, handed to the share sheet and-/// cleaned up afterwards. `BackupV14Exporter` is the only producer.+/// cleaned up afterwards. `BackupV15Exporter` is the only producer. public struct BackupExportResult: Sendable {     public let fileURL: URL 
Packages/AsterismCore/Sources/AsterismCore/BackupGroupProjection.swift Modified +3 / -3
diff --git a/Packages/AsterismCore/Sources/AsterismCore/BackupGroupProjection.swift b/Packages/AsterismCore/Sources/AsterismCore/BackupGroupProjection.swiftindex 6ec77b75..56806ed6 100644--- a/Packages/AsterismCore/Sources/AsterismCore/BackupGroupProjection.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/BackupGroupProjection.swift@@ -71,12 +71,12 @@ enum BackupGroupProjection {         /// that can carry them takes it from here rather than repeating it.         let characters: [CharacterGroup]         /// Every place in the store, as logical records, on the same terms.-        /// Read by the 14/15 payload; the 11/12 one had nowhere to write them,+        /// Read by the 15/16 payload; the 11/12 one had nowhere to write them,         /// and the torn refusal below applies to every format regardless.         let places: [RecordGroup<Place>]     } -    /// - Throws: `BackupV14ExportError.tornGroups` when the store holds a torn+    /// - Throws: `BackupV15ExportError.tornGroups` when the store holds a torn     ///   group — the biconditional of Req 8.1, since nothing else here refuses.     /// - Parameter distinctPairs: the reader's recorded "not the same work"     ///   dismissals (Req 5.6). **Not defaulted**: an export that cannot see them@@ -112,7 +112,7 @@ enum BackupGroupProjection {         let tornPlaces = placeGroups.values.filter(\.isTorn)         guard tornEntries.isEmpty, tornWorks.isEmpty, tornCharacters.isEmpty, tornPlaces.isEmpty         else {-            throw BackupV14ExportError.tornGroups(+            throw BackupV15ExportError.tornGroups(                 tornGroupsPayload(                     tornEntries: tornEntries, tornWorks: tornWorks,                     tornRecordCount: tornCharacters.count + tornPlaces.count,
Packages/AsterismCore/Sources/AsterismCore/BackupImportCreators.swift Modified +6 / -6
diff --git a/Packages/AsterismCore/Sources/AsterismCore/BackupImportCreators.swift b/Packages/AsterismCore/Sources/AsterismCore/BackupImportCreators.swiftindex 68db1839..0be29954 100644--- a/Packages/AsterismCore/Sources/AsterismCore/BackupImportCreators.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/BackupImportCreators.swift@@ -34,8 +34,8 @@ extension LibraryRepository {     ///   of which are the reader acting *now* and have to assert over what is     ///   already there.     internal static func mergeImportedCreatorDirectories(-        creators: [BackupV14Creator],-        creatorRoles: [BackupV14CreatorRole],+        creators: [BackupV15Creator],+        creatorRoles: [BackupV15CreatorRole],         importedAt: Date,         context: ModelContext,         saveStrategy: any RepositorySaveStrategy@@ -72,7 +72,7 @@ extension LibraryRepository {      /// - Returns: whether anything was written.     private static func mergeImportedCreators(-        _ records: [BackupV14Creator], context: ModelContext+        _ records: [BackupV15Creator], context: ModelContext     ) throws -> Bool {         guard !records.isEmpty else { return false }         let rows = try context.fetch(FetchDescriptor<Creator>())@@ -149,7 +149,7 @@ extension LibraryRepository {     /// that is absent or itself merged; anything the checks tolerate and this     /// does not answer for leaves the local record as it stands.     private static func answersForACreator(-        _ survivor: UUID, local: CreatorDirectory, archive: [UUID: BackupV14Creator]+        _ survivor: UUID, local: CreatorDirectory, archive: [UUID: BackupV15Creator]     ) -> Bool {         if let record = archive[survivor],             ToleratedEnum.read(record.stateRaw, default: CreatorState.active) != .merged@@ -172,7 +172,7 @@ extension LibraryRepository {     /// sides follows the per-field rule either way, so an order the archive     /// recorded later than the local one still wins.     private static func mergeImportedCreatorRoles(-        _ records: [BackupV14CreatorRole], importedAt: Date, context: ModelContext+        _ records: [BackupV15CreatorRole], importedAt: Date, context: ModelContext     ) throws -> Bool {         guard !records.isEmpty else { return false }         let rows = try context.fetch(FetchDescriptor<CreatorRole>())@@ -257,7 +257,7 @@ extension LibraryRepository {      /// `answersForACreator` over the role table.     private static func answersForARole(-        _ survivor: UUID, local: CreatorRoleDirectory, archive: [UUID: BackupV14CreatorRole]+        _ survivor: UUID, local: CreatorRoleDirectory, archive: [UUID: BackupV15CreatorRole]     ) -> Bool {         if let record = archive[survivor],             ToleratedEnum.read(record.stateRaw, default: CreatorRoleState.active) != .merged
Packages/AsterismCore/Sources/AsterismCore/BackupImportRecords.swift Modified +4 / -4
diff --git a/Packages/AsterismCore/Sources/AsterismCore/BackupImportRecords.swift b/Packages/AsterismCore/Sources/AsterismCore/BackupImportRecords.swiftindex 2e0dc559..3e8df06c 100644--- a/Packages/AsterismCore/Sources/AsterismCore/BackupImportRecords.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/BackupImportRecords.swift@@ -61,22 +61,22 @@ internal protocol ArchivedSuppression {     var actionAt: Date { get } } -extension BackupV14Character: ArchivedRecord {+extension BackupV15Character: ArchivedRecord {     var recordID: UUID { id }     var archivedWorkID: UUID? { workID } } -extension BackupV14Place: ArchivedRecord {+extension BackupV15Place: ArchivedRecord {     var recordID: UUID { id }     var archivedWorkID: UUID? { workID } } -extension BackupV14Suppression: ArchivedSuppression {+extension BackupV15Suppression: ArchivedSuppression {     var recordID: UUID { id }     var archivedWorkID: UUID? { workID } } -extension BackupV14PlaceSuppression: ArchivedSuppression {+extension BackupV15PlaceSuppression: ArchivedSuppression {     var recordID: UUID { id }     var archivedWorkID: UUID? { workID } }
Packages/AsterismCore/Sources/AsterismCore/BackupImportWorkTypes.swift Modified +4 / -4
diff --git a/Packages/AsterismCore/Sources/AsterismCore/BackupImportWorkTypes.swift b/Packages/AsterismCore/Sources/AsterismCore/BackupImportWorkTypes.swiftindex bf454e80..df1689f6 100644--- a/Packages/AsterismCore/Sources/AsterismCore/BackupImportWorkTypes.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/BackupImportWorkTypes.swift@@ -31,8 +31,8 @@ extension LibraryRepository {     ///     restore of an entry this library already held. That one write is the     ///     reader acting now, and it has to assert over a removal older than it.     internal static func mergeImportedWorkTypes(-        workTypes: [BackupV14WorkType],-        works: [BackupV14Work],+        workTypes: [BackupV15WorkType],+        works: [BackupV15Work],         exportedAt: Date,         importedAt: Date,         context: ModelContext,@@ -171,7 +171,7 @@ extension LibraryRepository {     /// Returned in identifier order, so an interrupted import resumes into the     /// same shape on any device.     private static func archivedTypeIdentities(-        _ records: [BackupV14WorkType]+        _ records: [BackupV15WorkType]     ) -> [ArchivedTypeIdentity] {         let directory = WorkTypeDirectory(             rows: records.map {@@ -266,7 +266,7 @@ extension LibraryRepository {     /// A citation with no snapshot is deliberately absent: it stays on the work     /// as unresolved rather than being invented a name (Q24).     private static func unresolvedTypeCitations(-        _ works: [BackupV14Work], in local: WorkTypeDirectory+        _ works: [BackupV15Work], in local: WorkTypeDirectory     ) -> [ArchivedTypeCitation] {         var seen: Set<UUID> = []         var citations: [ArchivedTypeCitation] = []
Packages/AsterismCore/Sources/AsterismCore/BackupImporter.swift Modified +46 / -46
diff --git a/Packages/AsterismCore/Sources/AsterismCore/BackupImporter.swift b/Packages/AsterismCore/Sources/AsterismCore/BackupImporter.swiftindex ea8b617c..316e16ab 100644--- a/Packages/AsterismCore/Sources/AsterismCore/BackupImporter.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/BackupImporter.swift@@ -11,47 +11,47 @@ import OSLog /// longer exist and every accessor answered the same arm three times. What /// remains is the payload's arrays, named. ///-/// This is `BackupV14Payload`'s content rather than the type itself: the wire+/// This is `BackupV15Payload`'s content rather than the type itself: the wire /// struct is a `Codable` frozen shape and the plan is what the commit reads, and /// keeping them separate is what lets a future generation arrive without the /// upsert learning its envelope. public struct BackupImportPayload: Sendable, Equatable {-    public let entries: [BackupV14Entry]-    public let works: [BackupV14Work]-    public let sites: [BackupV14Site]-    public let titlePatterns: [BackupV14TitlePattern]-    public let urlRules: [BackupV14URLRule]-    public let workTypes: [BackupV14WorkType]-    public let memberships: [BackupV14Membership]-    public let distinctPairs: [BackupV14DistinctPair]-    public let characters: [BackupV14Character]-    public let suppressions: [BackupV14Suppression]-    public let places: [BackupV14Place]-    public let placeSuppressions: [BackupV14PlaceSuppression]-    public let series: [BackupV14Series]-    public let links: [BackupV14Link]-    public let creators: [BackupV14Creator]-    public let creatorRoles: [BackupV14CreatorRole]-    public let credits: [BackupV14Credit]+    public let entries: [BackupV15Entry]+    public let works: [BackupV15Work]+    public let sites: [BackupV15Site]+    public let titlePatterns: [BackupV15TitlePattern]+    public let urlRules: [BackupV15URLRule]+    public let workTypes: [BackupV15WorkType]+    public let memberships: [BackupV15Membership]+    public let distinctPairs: [BackupV15DistinctPair]+    public let characters: [BackupV15Character]+    public let suppressions: [BackupV15Suppression]+    public let places: [BackupV15Place]+    public let placeSuppressions: [BackupV15PlaceSuppression]+    public let series: [BackupV15Series]+    public let links: [BackupV15Link]+    public let creators: [BackupV15Creator]+    public let creatorRoles: [BackupV15CreatorRole]+    public let credits: [BackupV15Credit]      public init(-        entries: [BackupV14Entry],-        works: [BackupV14Work],-        sites: [BackupV14Site],-        titlePatterns: [BackupV14TitlePattern],-        urlRules: [BackupV14URLRule],-        workTypes: [BackupV14WorkType] = [],-        memberships: [BackupV14Membership] = [],-        distinctPairs: [BackupV14DistinctPair] = [],-        characters: [BackupV14Character] = [],-        suppressions: [BackupV14Suppression] = [],-        places: [BackupV14Place] = [],-        placeSuppressions: [BackupV14PlaceSuppression] = [],-        series: [BackupV14Series] = [],-        links: [BackupV14Link] = [],-        creators: [BackupV14Creator] = [],-        creatorRoles: [BackupV14CreatorRole] = [],-        credits: [BackupV14Credit] = []+        entries: [BackupV15Entry],+        works: [BackupV15Work],+        sites: [BackupV15Site],+        titlePatterns: [BackupV15TitlePattern],+        urlRules: [BackupV15URLRule],+        workTypes: [BackupV15WorkType] = [],+        memberships: [BackupV15Membership] = [],+        distinctPairs: [BackupV15DistinctPair] = [],+        characters: [BackupV15Character] = [],+        suppressions: [BackupV15Suppression] = [],+        places: [BackupV15Place] = [],+        placeSuppressions: [BackupV15PlaceSuppression] = [],+        series: [BackupV15Series] = [],+        links: [BackupV15Link] = [],+        creators: [BackupV15Creator] = [],+        creatorRoles: [BackupV15CreatorRole] = [],+        credits: [BackupV15Credit] = []     ) {         self.entries = entries         self.works = works@@ -83,7 +83,7 @@ public struct BackupImportPayload: Sendable, Equatable {         self.credits = credits.map(\.normalized)     } -    public init(_ payload: BackupV14Payload) {+    public init(_ payload: BackupV15Payload) {         self.init(             entries: payload.entries, works: payload.works, sites: payload.sites,             titlePatterns: payload.titlePatterns, urlRules: payload.urlRules,@@ -113,7 +113,7 @@ public struct BackupImportPayload: Sendable, Equatable { /// process lease. Represents a complete validated prospective graph ready to be /// materialized atomically. ///-/// One source version is accepted, `14/15`. Every earlier generation's read path+/// One source version is accepted, `15/16`. Every earlier generation's read path /// has been retired in turn, `9/10` included (`series-and-related-works` Q13): a /// Work carries a series membership now, and the library carries a series table /// and a link table that a 9/10 record has no room for.@@ -134,7 +134,7 @@ public struct BackupImportPlan: Sendable, Equatable {      /// A plan over a wire payload, which is how every archive reaches one.     public init(-        metadata: BackupImportMetadata, payload: BackupV14Payload,+        metadata: BackupImportMetadata, payload: BackupV15Payload,         counts: LibraryRecordCounts     ) {         self.init(@@ -241,18 +241,18 @@ public enum BackupImportError: Error, Equatable, Sendable, CustomStringConvertib /// repository actor and without a process lease. Never mutates the selected /// file. ///-/// Import supports exact native `14/15` and nothing else. Mixed pairs, older+/// Import supports exact native `15/16` and nothing else. Mixed pairs, older /// generations and future headers reject before repository mutation — which is-/// the same door a *pre-feature* build meets `(12, 13)` at, and why a 14/15+/// the same door a *pre-feature* build meets `(12, 13)` at, and why a 15/16 /// archive cannot half-apply on one (Req 13.1). public enum BackupImporter {     private static let logger = Logger(subsystem: "me.nore.ig.Asterism", category: "BackupImporter") -    /// The pair this app reads and writes: format 12 over schema 13. It follows-    /// the document's own constants, so the one accepted pair moves with the-    /// generation rather than being restated here.+    /// The one pair this app reads and writes. It follows the document's own+    /// constants, so the accepted pair moves with the generation rather than+    /// being restated here.     private static let supportedVersions = (-        format: BackupV14Document.formatVersion, schema: BackupV14Document.schemaVersion+        format: BackupV15Document.formatVersion, schema: BackupV15Document.schemaVersion     )      // MARK: - Plan Dispatch (Req 5.1, 5.2, Decision 2)@@ -283,9 +283,9 @@ public enum BackupImporter {     }      private static func planFromArchive(_ data: Data) throws -> BackupImportPlan {-        let document: BackupV14Document+        let document: BackupV15Document         do {-            document = try BackupV14Codec.decode(data)+            document = try BackupV15Codec.decode(data)         } catch {             throw BackupImportError.decodingFailed(reason: String(describing: error))         }
Packages/AsterismCore/Sources/AsterismCore/BackupJSONCodecSupport.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Sources/AsterismCore/BackupJSONCodecSupport.swift b/Packages/AsterismCore/Sources/AsterismCore/BackupJSONCodecSupport.swiftindex a6fcd498..e1370b71 100644--- a/Packages/AsterismCore/Sources/AsterismCore/BackupJSONCodecSupport.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/BackupJSONCodecSupport.swift@@ -1,7 +1,7 @@ import Foundation  // Extracted from the retired `LegacyBackupV2Codec` when the 2/2 and 3/3 import-// paths were removed. Both helpers are used by the live `BackupV14Codec`: the+// paths were removed. Both helpers are used by the live `BackupV15Codec`: the // date formatter fixes the archive's timestamp encoding, and the duplicate-key // validator is what makes a decode strict rather than last-key-wins. //@@ -166,7 +166,7 @@ internal enum BackupArchiveDateFormatter { /// /// Load-bearing on the live decode path: it is the only thing standing between a /// two-`payload` archive and importing the wrong one, and it enforces-/// no-trailing-bytes. `BackupV14ArchiveTests` covers both properties by editing+/// no-trailing-bytes. `BackupV15ArchiveTests` covers both properties by editing /// encoded bytes directly. /// /// **The root keys come from here because this walk is already paying for
Packages/AsterismCore/Sources/AsterismCore/BackupV15Codec.swift Renamed +28 / -28
diff --git a/Packages/AsterismCore/Sources/AsterismCore/BackupV14Codec.swift b/Packages/AsterismCore/Sources/AsterismCore/BackupV15Codec.swiftsimilarity index 88%rename from Packages/AsterismCore/Sources/AsterismCore/BackupV14Codec.swiftrename to Packages/AsterismCore/Sources/AsterismCore/BackupV15Codec.swiftindex ed8fe3b2..2fecc082 100644--- a/Packages/AsterismCore/Sources/AsterismCore/BackupV14Codec.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/BackupV15Codec.swift@@ -1,6 +1,6 @@ import Foundation -/// The strict 14/15 archive codec: canonical JSON, a SHA-256 checksum over the+/// The strict 15/16 archive codec: canonical JSON, a SHA-256 checksum over the /// payload bytes, entry/work counts, root-strict envelope validation, typed /// nested decode, and a reference validator over the shared record checks plus /// this generation's own rules.@@ -15,16 +15,16 @@ import Foundation /// /// The capability gate is pinned to the literal `"multi-site"`: the payload is /// frozen the moment it ships, and a later `AsterismCapabilities.current` must-/// not change what a 14/15 backup declares. 14/15 changes neither the store shape+/// not change what a 15/16 backup declares. 15/16 changes neither the store shape /// the gate names nor the rule-form set, so it keeps stamping it /// (`rule-citation-by-uuid` Q19).-public enum BackupV14Codec {-    /// Pinned literally. 14/15 ships at the multi-site gate; a future gate flip+public enum BackupV15Codec {+    /// Pinned literally. 15/16 ships at the multi-site gate; a future gate flip     /// cannot retroactively change what these files say.     static let gate = "multi-site"      /// The generation this codec speaks, as it appears in decode diagnostics.-    static let label = "V13"+    static let label = "V15"      // MARK: - Encode @@ -32,7 +32,7 @@ public enum BackupV14Codec {     /// sorts after it.     ///     /// The payload is encoded once, for the checksum, and then spliced into the-    /// envelope rather than encoded a second time as `BackupV14Document.payload`+    /// envelope rather than encoded a second time as `BackupV15Document.payload`     /// would be. Over a covered library the payload is tens of megabytes and the     /// envelope is a hundred bytes, so the second encode was the whole file     /// written twice to add nine keys to it.@@ -56,8 +56,8 @@ public enum BackupV14Codec {     }      public static func encode(-        payload: BackupV14Payload,-        metadata: BackupV14Metadata+        payload: BackupV15Payload,+        metadata: BackupV15Metadata     ) throws -> Data {         let encoder = BackupCanonicalJSON.encoder() @@ -66,10 +66,10 @@ public enum BackupV14Codec {          let head = try encoder.encode(EnvelopeHead(             appBuild: metadata.appBuild,-            backupFormatVersion: BackupV14Document.formatVersion,+            backupFormatVersion: BackupV15Document.formatVersion,             capabilityGate: Self.gate,             checksum: checksum,-            databaseSchemaVersion: BackupV14Document.schemaVersion,+            databaseSchemaVersion: BackupV15Document.schemaVersion,             entryCount: payload.entries.count,             exportedAt: metadata.exportedAt))         let tail = try encoder.encode(EnvelopeTail(workCount: payload.works.count))@@ -91,7 +91,7 @@ public enum BackupV14Codec {      // MARK: - Decode -    /// Decodes and validates a 14/15 document. Validates: envelope format/schema,+    /// Decodes and validates a 15/16 document. Validates: envelope format/schema,     /// capability gate, duplicate keys, strict root shape, entry/work counts,     /// payload checksum, and all references and tuples.     ///@@ -101,21 +101,21 @@ public enum BackupV14Codec {     ///     /// The checksum step is also a refusal in its own right: it is taken over     /// the bytes as they arrived and compared against a re-encoding of what-    /// decoded, so a 14/15 file carrying a key this build does not write back —+    /// decoded, so a 15/16 file carrying a key this build does not write back —     /// a citation `version`, the shape a build before T-2281 wrote — fails here     /// rather than importing with the key silently dropped.-    public static func decode(_ data: Data) throws -> BackupV14Document {+    public static func decode(_ data: Data) throws -> BackupV15Document {         do {             let rootKeys = try DuplicateJSONKeyValidator.validate(data)             try BackupArchiveShapeValidator.validate(rootKeys: rootKeys)              let document = try BackupCanonicalJSON.decoder()-                .decode(BackupV14Document.self, from: data)+                .decode(BackupV15Document.self, from: data) -            guard document.backupFormatVersion == BackupV14Document.formatVersion else {+            guard document.backupFormatVersion == BackupV15Document.formatVersion else {                 throw BackupCodecError.invalidFormatVersion(document.backupFormatVersion)             }-            guard document.databaseSchemaVersion == BackupV14Document.schemaVersion else {+            guard document.databaseSchemaVersion == BackupV15Document.schemaVersion else {                 throw BackupCodecError.invalidSchemaVersion(document.databaseSchemaVersion)             }             guard document.capabilityGate == Self.gate else {@@ -147,7 +147,7 @@ public enum BackupV14Codec {                 )             } -            try BackupV14ReferenceValidator.validate(payload: document.payload)+            try BackupV15ReferenceValidator.validate(payload: document.payload)              return document         } catch let error as BackupCodecError { throw error }@@ -157,9 +157,9 @@ public enum BackupV14Codec {     } } -// MARK: - V13 Metadata+// MARK: - V15 Metadata -public struct BackupV14Metadata: Sendable {+public struct BackupV15Metadata: Sendable {     public let appBuild: String     public let exportedAt: Date @@ -199,7 +199,7 @@ internal enum BackupArchiveShapeValidator {     } } -// MARK: - V13 Reference Validator+// MARK: - V15 Reference Validator  /// The shared record checks, the type-list rules, the two character arrays and /// the two place arrays.@@ -214,8 +214,8 @@ internal enum BackupArchiveShapeValidator { /// character or suppression, and a character or suppression naming a Work the /// file does not hold. The work reference is **optional, checked when present** /// — the `validateEntry` `workID` pattern — so an orphan passes.-internal enum BackupV14ReferenceValidator {-    static func validate(payload: BackupV14Payload) throws {+internal enum BackupV15ReferenceValidator {+    static func validate(payload: BackupV15Payload) throws {         do {             try BackupArchiveReferenceChecks.validate(                 entries: payload.entries,@@ -230,7 +230,7 @@ internal enum BackupV14ReferenceValidator {                 creators: payload.creators,                 creatorRoles: payload.creatorRoles,                 credits: payload.credits,-                formatLabel: BackupV14Codec.label)+                formatLabel: BackupV15Codec.label)         } catch let issue as BackupArchiveReferenceIssue {             throw BackupCodecError(issue)         }@@ -238,7 +238,7 @@ internal enum BackupV14ReferenceValidator {         let typeIDs = Set(payload.workTypes.map(\.id))         guard typeIDs.count == payload.workTypes.count else {             throw BackupCodecError.invalidStateTuple(-                type: "Payload", id: BackupV14Codec.label, reason: "duplicate work type ID")+                type: "Payload", id: BackupV15Codec.label, reason: "duplicate work type ID")         }          let workIDs = Set(payload.works.map(\.id))@@ -247,7 +247,7 @@ internal enum BackupV14ReferenceValidator {         for character in payload.characters {             guard characterIDs.insert(character.id).inserted else {                 throw BackupCodecError.invalidStateTuple(-                    type: "Payload", id: BackupV14Codec.label, reason: "duplicate Character ID")+                    type: "Payload", id: BackupV15Codec.label, reason: "duplicate Character ID")             }             if let workID = character.workID, !workIDs.contains(workID) {                 throw BackupCodecError.unresolvedReference(@@ -259,7 +259,7 @@ internal enum BackupV14ReferenceValidator {         for suppression in payload.suppressions {             guard suppressionIDs.insert(suppression.id).inserted else {                 throw BackupCodecError.invalidStateTuple(-                    type: "Payload", id: BackupV14Codec.label, reason: "duplicate CharacterSuppression ID")+                    type: "Payload", id: BackupV15Codec.label, reason: "duplicate CharacterSuppression ID")             }             if let workID = suppression.workID, !workIDs.contains(workID) {                 throw BackupCodecError.unresolvedReference(@@ -279,7 +279,7 @@ internal enum BackupV14ReferenceValidator {         for place in payload.places {             guard placeIDs.insert(place.id).inserted else {                 throw BackupCodecError.invalidStateTuple(-                    type: "Payload", id: BackupV14Codec.label, reason: "duplicate Place ID")+                    type: "Payload", id: BackupV15Codec.label, reason: "duplicate Place ID")             }         } @@ -287,7 +287,7 @@ internal enum BackupV14ReferenceValidator {         for suppression in payload.placeSuppressions {             guard placeSuppressionIDs.insert(suppression.id).inserted else {                 throw BackupCodecError.invalidStateTuple(-                    type: "Payload", id: BackupV14Codec.label,+                    type: "Payload", id: BackupV15Codec.label,                     reason: "duplicate PlaceSuppression ID")             }         }
Packages/AsterismCore/Sources/AsterismCore/BackupV15Exporter.swift Renamed +62 / -61
diff --git a/Packages/AsterismCore/Sources/AsterismCore/BackupV14Exporter.swift b/Packages/AsterismCore/Sources/AsterismCore/BackupV15Exporter.swiftsimilarity index 85%rename from Packages/AsterismCore/Sources/AsterismCore/BackupV14Exporter.swiftrename to Packages/AsterismCore/Sources/AsterismCore/BackupV15Exporter.swiftindex 9203fc8a..444f5b71 100644--- a/Packages/AsterismCore/Sources/AsterismCore/BackupV14Exporter.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/BackupV15Exporter.swift@@ -3,10 +3,10 @@ import SwiftData  // MARK: - Snapshot Providing -/// Provides one coherent 14/15 payload under a shared lock. Isolated from+/// Provides one coherent 15/16 payload under a shared lock. Isolated from /// persistence so export can be unit-tested with injected snapshots.-public protocol BackupV14SnapshotProviding: Sendable {-    func backupV14Snapshot() async throws -> BackupV14Payload+public protocol BackupV15SnapshotProviding: Sendable {+    func backupV15Snapshot() async throws -> BackupV15Payload }  // MARK: - Export Errors@@ -24,7 +24,7 @@ public protocol BackupV14SnapshotProviding: Sendable { /// the reader wrote exactly as it covers a torn Entry or Work. What does *not* /// refuse is a fact whose citation dangles — `character-extraction` Decision 2 /// makes that a tolerated state.-public enum BackupV14ExportError: Error, Equatable, Sendable, CustomStringConvertible {+public enum BackupV15ExportError: Error, Equatable, Sendable, CustomStringConvertible {     /// The store holds a **torn** identity group: one application UUID over rows     /// that disagree about something the reader wrote. The archive keys records     /// by UUID and cannot hold both variants, and silently dropping one is data@@ -85,8 +85,8 @@ public enum BackupV14ExportError: Error, Equatable, Sendable, CustomStringConver  // MARK: - LibraryRepository Snapshot -extension LibraryRepository: BackupV14SnapshotProviding {-    /// Provides a coherent 14/15 backup payload under a shared lock.+extension LibraryRepository: BackupV15SnapshotProviding {+    /// Provides a coherent 15/16 backup payload under a shared lock.     ///     /// **The quarantine and unresolved gates are gone** (Req 3.1 of     /// `cloudkit-mirroring`). They refused a file at exactly the moment one is@@ -104,16 +104,16 @@ extension LibraryRepository: BackupV14SnapshotProviding {     /// backup cannot mutate the library on the way out (Q38); the archive it     /// produces is nonetheless the shape reconciliation settles on, which is what     /// makes Req 3.5's round-trip hold.-    public func backupV14Snapshot() async throws -> BackupV14Payload {-        let outcome: Result<BackupV14Payload, BackupV14ExportError> =+    public func backupV15Snapshot() async throws -> BackupV15Payload {+        let outcome: Result<BackupV15Payload, BackupV15ExportError> =             try await withLockedBackupContext { context in-                do { return .success(try Self.projectV14Payload(context: context)) }-                catch let error as BackupV14ExportError { return .failure(error) }+                do { return .success(try Self.projectV15Payload(context: context)) }+                catch let error as BackupV15ExportError { return .failure(error) }             }         return try outcome.get()     } -    /// The whole 14/15 snapshot, from a context. Static and pure so the projection+    /// The whole 15/16 snapshot, from a context. Static and pure so the projection     /// can be exercised without an actor.     ///     /// **One projection pass.** `projectCommonArchiveRecords` already enumerated@@ -122,7 +122,7 @@ extension LibraryRepository: BackupV14SnapshotProviding {     /// vanishing), already refused a torn group, and already sorted by UUID.     /// Re-deriving any of it would be a second walk of the two largest tables and     /// a second chance to describe two moments.-    internal static func projectV14Payload(context: ModelContext) throws -> BackupV14Payload {+    internal static func projectV15Payload(context: ModelContext) throws -> BackupV15Payload {         let common = try projectCommonArchiveRecords(context: context)          // Req 7.2 and Q32: the **folded** list, one record per identity. Rows@@ -132,14 +132,14 @@ extension LibraryRepository: BackupV14SnapshotProviding {         // devices holding the same rows write the same bytes.         let directory = common.groups.types         let workTypes = directory.identities.map {-            BackupV14WorkType(+            BackupV15WorkType(                 id: $0.id, name: $0.name, stateRaw: $0.state.rawValue,                 canonicalID: $0.canonicalID, createdAt: $0.createdAt,                 modifiedAt: $0.modifiedAt)         }          let works = try common.groups.works.map {-            try mapV14WorkRecord(+            try mapV15WorkRecord(                 $0, canonicalWorkIDs: common.groups.canonicalWorkIDs, types: directory)         } @@ -153,20 +153,20 @@ extension LibraryRepository: BackupV14SnapshotProviding {             titlePatterns: common.titlePatterns,             urlRules: common.urlRules) -        let characters = common.groups.characters.map(mapV14CharacterRecord)+        let characters = common.groups.characters.map(mapV15CharacterRecord)          let suppressions = try context.fetch(FetchDescriptor<CharacterSuppression>())-            .map(mapV14SuppressionRecord)+            .map(mapV15SuppressionRecord)             .sorted { $0.id.uuidString < $1.id.uuidString }          // `place-extraction` Req 5.1. The place groups the common projection         // already formed — enumerated whole and already refused if torn — and         // the suppression table read whole beside them, on the character arms'         // terms exactly.-        let places = common.groups.places.map(mapV14PlaceRecord)+        let places = common.groups.places.map(mapV15PlaceRecord)          let placeSuppressions = try context.fetch(FetchDescriptor<PlaceSuppression>())-            .map(mapV14PlaceSuppressionRecord)+            .map(mapV15PlaceSuppressionRecord)             .sorted { $0.id.uuidString < $1.id.uuidString }          // `work-creators` Req 9.1: the two directories folded, one record per@@ -182,7 +182,7 @@ extension LibraryRepository: BackupV14SnapshotProviding {         let creators = electedCreators(try creatorDirectory(context: context))         let creatorRoles = electedCreatorRoles(try creatorRoleDirectory(context: context)) -        return BackupV14Payload(+        return BackupV15Payload(             entries: common.entries,             works: works,             sites: common.sites,@@ -200,8 +200,8 @@ extension LibraryRepository: BackupV14SnapshotProviding {             // keep, so an archive never carries a row that pass deletes.             series: try projectSeries(context: context),             links: try projectLinks(context: context),-            creators: mapV14CreatorRecords(creators),-            creatorRoles: mapV14CreatorRoleRecords(creatorRoles),+            creators: mapV15CreatorRecords(creators),+            creatorRoles: mapV15CreatorRoleRecords(creatorRoles),             // Req 9.2: one record per work-and-creator pair, the row             // `dedupeCredits` would keep carrying the union it would write —             // so an archive never carries a state the next pass changes.@@ -282,11 +282,11 @@ extension LibraryRepository: BackupV14SnapshotProviding {     /// (Q68). Both shapes read identically on every device (unresolved, and     /// healing when the target arrives), and only one of them is a file the     /// reference checks accept.-    private static func mapV14CreatorRecords(+    private static func mapV15CreatorRecords(         _ directory: CreatorDirectory-    ) -> [BackupV14Creator] {+    ) -> [BackupV15Creator] {         directory.identities.map { identity in-            BackupV14Creator(+            BackupV15Creator(                 id: identity.id, name: identity.name,                 nameModifiedAt: identity.nameModifiedAt,                 notes: identity.notes, notesModifiedAt: identity.notesModifiedAt,@@ -298,11 +298,11 @@ extension LibraryRepository: BackupV14SnapshotProviding {         }     } -    private static func mapV14CreatorRoleRecords(+    private static func mapV15CreatorRoleRecords(         _ directory: CreatorRoleDirectory-    ) -> [BackupV14CreatorRole] {+    ) -> [BackupV15CreatorRole] {         directory.identities.map { identity in-            BackupV14CreatorRole(+            BackupV15CreatorRole(                 id: identity.id, name: identity.name,                 nameModifiedAt: identity.nameModifiedAt,                 position: identity.position,@@ -338,9 +338,9 @@ extension LibraryRepository: BackupV14SnapshotProviding {     /// The group's presented content, plus the immutable evidence its carrier     /// holds. One record per identity, like every other archive record: rows     /// sharing a UUID are one character everywhere else in the app.-    private static func mapV14CharacterRecord(_ group: CharacterGroup) -> BackupV14Character {+    private static func mapV15CharacterRecord(_ group: CharacterGroup) -> BackupV15Character {         let content = group.presentedContent-        return BackupV14Character(+        return BackupV15Character(             id: group.id,             workID: group.carrier.ownerWorkID,             name: content.name,@@ -355,28 +355,28 @@ extension LibraryRepository: BackupV14SnapshotProviding {     /// Suppression rows travel one-for-one, duplicates included (Q82): the store     /// reads them through by `actionAt` rather than folding them, so folding     /// here would be a second convergence rule that only archives obey.-    private static func mapV14SuppressionRecord(+    private static func mapV15SuppressionRecord(         _ row: CharacterSuppression-    ) -> BackupV14Suppression {-        BackupV14Suppression(+    ) -> BackupV15Suppression {+        BackupV15Suppression(             id: row.id, workID: row.ownerWorkID, kindRaw: row.kindRaw, nameKey: row.nameKey,             sourceKindRaw: row.sourceKindRaw, sourceEntryID: row.sourceEntryID,             evidence: row.evidence, statusRaw: row.statusRaw, actionAt: row.actionAt)     } -    /// `mapV14CharacterRecord` over a place group. The owner comes from the+    /// `mapV15CharacterRecord` over a place group. The owner comes from the     /// carrier's **column**, resolved or not: a place whose work has not arrived     /// exports naming it, which is the only thing that lets Req 5.5's orphan     /// round-trip (Q60).     ///     /// It names `workID` rather than `RecordRow.ownerWorkID` because the two-    /// archive records genuinely differ here: `BackupV14Place.workID` is a-    /// `UUID` and `BackupV14Character.workID` a `UUID?`, which is the same+    /// archive records genuinely differ here: `BackupV15Place.workID` is a+    /// `UUID` and `BackupV15Character.workID` a `UUID?`, which is the same     /// asymmetry the two tables have. That is also why the pair does not     /// collapse into one generic mapper.-    private static func mapV14PlaceRecord(_ group: RecordGroup<Place>) -> BackupV14Place {+    private static func mapV15PlaceRecord(_ group: RecordGroup<Place>) -> BackupV15Place {         let content = group.presentedContent-        return BackupV14Place(+        return BackupV15Place(             id: group.id,             workID: group.carrier.workID,             name: content.name,@@ -388,11 +388,11 @@ extension LibraryRepository: BackupV14SnapshotProviding {             modifiedAt: group.modifiedAt)     } -    /// One-for-one, duplicates included, for `mapV14SuppressionRecord`'s reason.-    private static func mapV14PlaceSuppressionRecord(+    /// One-for-one, duplicates included, for `mapV15SuppressionRecord`'s reason.+    private static func mapV15PlaceSuppressionRecord(         _ row: PlaceSuppression-    ) -> BackupV14PlaceSuppression {-        BackupV14PlaceSuppression(+    ) -> BackupV15PlaceSuppression {+        BackupV15PlaceSuppression(             id: row.id, workID: row.workID, kindRaw: row.kindRaw, nameKey: row.nameKey,             sourceKindRaw: row.sourceKindRaw, sourceEntryID: row.sourceEntryID,             evidence: row.evidence, statusRaw: row.statusRaw, actionAt: row.actionAt)@@ -401,48 +401,48 @@ extension LibraryRepository: BackupV14SnapshotProviding {  // MARK: - The Exporter -/// Orchestrates coherent 14/15 snapshot → validated encoding → staging.+/// Orchestrates coherent 15/16 snapshot → validated encoding → staging. /// /// The only exporter. It decode-validates its own bytes before sharing, so a-/// produced file is always a valid strict 14/15 document.-public final class BackupV14Exporter: Sendable {-    private let repository: any BackupV14SnapshotProviding+/// produced file is always a valid strict 15/16 document.+public final class BackupV15Exporter: Sendable {+    private let repository: any BackupV15SnapshotProviding     private let stagingDirectory: URL      public init(-        repository: any BackupV14SnapshotProviding,+        repository: any BackupV15SnapshotProviding,         stagingDirectory: URL     ) {         self.repository = repository         self.stagingDirectory = stagingDirectory     } -    public func export(metadata: BackupV14Metadata) async throws -> BackupExportResult {-        let payload: BackupV14Payload+    public func export(metadata: BackupV15Metadata) async throws -> BackupExportResult {+        let payload: BackupV15Payload         do {-            payload = try await repository.backupV14Snapshot()-        } catch let error as BackupV14ExportError {+            payload = try await repository.backupV15Snapshot()+        } catch let error as BackupV15ExportError {             throw error         } catch {-            throw BackupV14ExportError.snapshotFailed(reason: String(describing: error))+            throw BackupV15ExportError.snapshotFailed(reason: String(describing: error))         }          let encoded: Data         do {-            encoded = try BackupV14Codec.encode(payload: payload, metadata: metadata)+            encoded = try BackupV15Codec.encode(payload: payload, metadata: metadata)         } catch {-            throw BackupV14ExportError.encodingFailed(reason: String(describing: error))+            throw BackupV15ExportError.encodingFailed(reason: String(describing: error))         }          do {-            let decoded = try BackupV14Codec.decode(encoded)+            let decoded = try BackupV15Codec.decode(encoded)             guard decoded.payload == payload else {-                throw BackupV14ExportError.encodingFailed(reason: "decode-validation payload mismatch")+                throw BackupV15ExportError.encodingFailed(reason: "decode-validation payload mismatch")             }-        } catch let error as BackupV14ExportError {+        } catch let error as BackupV15ExportError {             throw error         } catch {-            throw BackupV14ExportError.encodingFailed(reason: "decode-validation failed: \(error)")+            throw BackupV15ExportError.encodingFailed(reason: "decode-validation failed: \(error)")         }          do {@@ -450,17 +450,18 @@ public final class BackupV14Exporter: Sendable {                 at: stagingDirectory, withIntermediateDirectories: true)             let fileURL = stagingDirectory.appending(                 path: ExportStaging.backupFilename(-                    version: "v14", exportedAt: metadata.exportedAt))+                    version: "v\(BackupV15Document.formatVersion)",+                    exportedAt: metadata.exportedAt))             do {                 try ExportStaging.write(encoded, to: fileURL)             } catch {-                throw BackupV14ExportError.stagingFailed(reason: String(describing: error))+                throw BackupV15ExportError.stagingFailed(reason: String(describing: error))             }             return BackupExportResult(fileURL: fileURL)-        } catch let error as BackupV14ExportError {+        } catch let error as BackupV15ExportError {             throw error         } catch {-            throw BackupV14ExportError.stagingFailed(+            throw BackupV15ExportError.stagingFailed(                 reason: "preparing staging directory failed: \(error)")         }     }
Packages/AsterismCore/Sources/AsterismCore/BackupV15Types.swift Renamed +101 / -93
diff --git a/Packages/AsterismCore/Sources/AsterismCore/BackupV14Types.swift b/Packages/AsterismCore/Sources/AsterismCore/BackupV15Types.swiftsimilarity index 87%rename from Packages/AsterismCore/Sources/AsterismCore/BackupV14Types.swiftrename to Packages/AsterismCore/Sources/AsterismCore/BackupV15Types.swiftindex e7e479c9..570becd6 100644--- a/Packages/AsterismCore/Sources/AsterismCore/BackupV14Types.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/BackupV15Types.swift@@ -1,29 +1,30 @@ import Foundation -// MARK: - Backup V14 Document+// MARK: - Backup V15 Document -/// The 14/15 backup envelope: format version 14 over schema version 15-/// (`update-schedule` Req 8.1). The schema number names the store schema the-/// archive was taken from, which is V15.+/// The 15/16 backup envelope: format version 15 over schema version 16+/// (`remove-article-mode` Req 5.1). The schema number names the store schema the+/// archive was taken from, which is V16. ///-/// It **replaces** the 13/14 set outright rather than standing beside it-/// (`rule-citation-by-uuid` Q14, restated at every generation since): a work-/// carries a set of release days now, and a 13/14 file holds none — every-/// schedule the reader typed would come back from such an archive as empty,-/// which is exactly what one supported pair per build exists to stop happening-/// silently. An archive written before 14/15 is refused by version, with the-/// message naming the pair it declares (`update-schedule` Req 8.2).+/// It **replaces** the 14/15 set outright rather than standing beside it+/// (`rule-citation-by-uuid` Q14, restated at every generation since, and+/// `remove-article-mode` Q12): a Site no longer carries a junk-suffix rule,+/// because the store no longer has the column, and a 14/15 file carries one for+/// a mode this build does not know — which is exactly what one supported pair+/// per build exists to stop arriving silently. An archive written before 15/16+/// is refused by version, with the message naming the pair it declares+/// (`remove-article-mode` Req 5.3). /// /// The schema number is **pinned to the live schema by a test**-/// (`BackupV14ArchiveTests.envelopeVersionsFollowTheLiveSchema`, Q66): a schema+/// (`BackupV15ArchiveTests.envelopeVersionsFollowTheLiveSchema`, Q66): a schema /// bump moves four things and this is the only one of them that fails silently /// when it is forgotten. /// /// The envelope keys are 4/4's, unchanged through every generation since. /// Everything this one changes is inside `payload`.-public struct BackupV14Document: Codable, Equatable, Sendable {-    public static let formatVersion = 14-    public static let schemaVersion = 15+public struct BackupV15Document: Codable, Equatable, Sendable {+    public static let formatVersion = 15+    public static let schemaVersion = 16      public let backupFormatVersion: Int     public let databaseSchemaVersion: Int@@ -33,7 +34,7 @@ public struct BackupV14Document: Codable, Equatable, Sendable {     public let entryCount: Int     public let workCount: Int     public let checksum: String-    public let payload: BackupV14Payload+    public let payload: BackupV15Payload      public init(         appBuild: String,@@ -42,7 +43,7 @@ public struct BackupV14Document: Codable, Equatable, Sendable {         entryCount: Int,         workCount: Int,         checksum: String,-        payload: BackupV14Payload+        payload: BackupV15Payload     ) {         backupFormatVersion = Self.formatVersion         databaseSchemaVersion = Self.schemaVersion@@ -56,9 +57,9 @@ public struct BackupV14Document: Codable, Equatable, Sendable {     } } -// MARK: - V14 Payload+// MARK: - V15 Payload -/// The seventeen arrays a 14/15 archive holds.+/// The seventeen arrays a 15/16 archive holds. /// /// **Every record kind is enumerated whole**, and no parent record carries a /// list of its children (Req 9.3). The 6/7 payload had a Site naming its rules,@@ -68,67 +69,67 @@ public struct BackupV14Document: Codable, Equatable, Sendable { /// distinct pairs arrive under the same rule the characters do (Q17): a row /// whose Work has not arrived exports naming the Work it belongs to, and imports /// unattached (Req 9.5, Q22).-public struct BackupV14Payload: Codable, Equatable, Sendable {-    public let entries: [BackupV14Entry]-    public let works: [BackupV14Work]-    public let sites: [BackupV14Site]-    public let titlePatterns: [BackupV14TitlePattern]-    public let urlRules: [BackupV14URLRule]-    public let workTypes: [BackupV14WorkType]+public struct BackupV15Payload: Codable, Equatable, Sendable {+    public let entries: [BackupV15Entry]+    public let works: [BackupV15Work]+    public let sites: [BackupV15Site]+    public let titlePatterns: [BackupV15TitlePattern]+    public let urlRules: [BackupV15URLRule]+    public let workTypes: [BackupV15WorkType]     /// One row per Work and hostname (Req 9.1). The Work's site presence lives     /// here and nowhere else.-    public let memberships: [BackupV14Membership]+    public let memberships: [BackupV15Membership]     /// The reader's "not the same work" over an unordered pair (Req 5.5).-    public let distinctPairs: [BackupV14DistinctPair]-    public let characters: [BackupV14Character]-    public let suppressions: [BackupV14Suppression]+    public let distinctPairs: [BackupV15DistinctPair]+    public let characters: [BackupV15Character]+    public let suppressions: [BackupV15Suppression]     /// The reader's places (`place-extraction` Req 5.1), enumerated whole for     /// the reason the characters are — and one more: a `Place` declares no     /// relationship at all, so an orphan is reachable only this way (Req 5.5).-    public let places: [BackupV14Place]+    public let places: [BackupV15Place]     /// The place half of the suppression ledger. A separate array rather than a     /// kind column on `suppressions`, because the store keeps the two in     /// separate tables (Decision 2) and a shared array would be a second     /// spelling of that split.-    public let placeSuppressions: [BackupV14PlaceSuppression]+    public let placeSuppressions: [BackupV15PlaceSuppression]     /// The reader's series (`series-and-related-works` Req 13.1). A work's     /// **membership** is not here: it is part of the work's own record, and     /// travels on it.-    public let series: [BackupV14Series]+    public let series: [BackupV15Series]     /// One row per linked pair, the survivor the next reconcile would keep     /// (Req 13.2, Q14). A link naming a work the archive does not carry is     /// legal and imports unresolved, exactly as a distinct pair does.-    public let links: [BackupV14Link]+    public let links: [BackupV15Link]     /// The reader's creators, one record per folded identity     /// (`work-creators` Req 9.1).-    public let creators: [BackupV14Creator]+    public let creators: [BackupV15Creator]     /// The reader's role list, one record per folded identity, carrying the     /// list order every credit is read in.-    public let creatorRoles: [BackupV14CreatorRole]+    public let creatorRoles: [BackupV15CreatorRole]     /// One record per work-and-creator pair, as     /// [10.5](../../../../specs/work-creators/requirements.md#10.5) would keep     /// it (Req 9.2). A credit naming a work, creator or role the archive does     /// not carry is legal and imports unresolved (Req 9.5).-    public let credits: [BackupV14Credit]+    public let credits: [BackupV15Credit]      public init(-        entries: [BackupV14Entry],-        works: [BackupV14Work],-        sites: [BackupV14Site],-        titlePatterns: [BackupV14TitlePattern],-        urlRules: [BackupV14URLRule],-        workTypes: [BackupV14WorkType] = [],-        memberships: [BackupV14Membership] = [],-        distinctPairs: [BackupV14DistinctPair] = [],-        characters: [BackupV14Character] = [],-        suppressions: [BackupV14Suppression] = [],-        places: [BackupV14Place] = [],-        placeSuppressions: [BackupV14PlaceSuppression] = [],-        series: [BackupV14Series] = [],-        links: [BackupV14Link] = [],-        creators: [BackupV14Creator] = [],-        creatorRoles: [BackupV14CreatorRole] = [],-        credits: [BackupV14Credit] = []+        entries: [BackupV15Entry],+        works: [BackupV15Work],+        sites: [BackupV15Site],+        titlePatterns: [BackupV15TitlePattern],+        urlRules: [BackupV15URLRule],+        workTypes: [BackupV15WorkType] = [],+        memberships: [BackupV15Membership] = [],+        distinctPairs: [BackupV15DistinctPair] = [],+        characters: [BackupV15Character] = [],+        suppressions: [BackupV15Suppression] = [],+        places: [BackupV15Place] = [],+        placeSuppressions: [BackupV15PlaceSuppression] = [],+        series: [BackupV15Series] = [],+        links: [BackupV15Link] = [],+        creators: [BackupV15Creator] = [],+        creatorRoles: [BackupV15CreatorRole] = [],+        credits: [BackupV15Credit] = []     ) {         self.entries = entries         self.works = works@@ -150,34 +151,41 @@ public struct BackupV14Payload: Codable, Equatable, Sendable {     } } -// MARK: - V14 Records+// MARK: - V15 Records  /// One Site. **No child lists** (Req 9.3): a title rule and a URL rule each name /// their hostname, so the Site naming them back was a second spelling of one /// relationship — and the one the reference checks had to cross-examine.-public struct BackupV14Site: Codable, Equatable, Sendable {+///+/// **14/15 → 15/16 drops the junk-suffix rule** (`remove-article-mode` Req 5.1):+/// articles mode is gone and V16 has no `Site.junkSuffixRule` column for the+/// field to import into, so it leaves the wire rather than travelling as a value+/// nothing can read back.+///+/// `mode` stays the **typed** `SiteMode` rather than its raw string: a spelling+/// this build cannot name — `articles`, written by a build before this one —+/// fails the decode and refuses the archive as malformed, which is what Req 5.1+/// asks for. Reading a store row is tolerant; reading a backup never is.+public struct BackupV15Site: Codable, Equatable, Sendable {     public let hostname: String     public let displayName: String     public let mode: SiteMode-    public let junkSuffixRule: JunkSuffixRule?      public init(         hostname: String,         displayName: String,-        mode: SiteMode,-        junkSuffixRule: JunkSuffixRule?+        mode: SiteMode     ) {         self.hostname = hostname         self.displayName = displayName         self.mode = mode-        self.junkSuffixRule = junkSuffixRule     } }  /// One title rule. The arm and both trims travel as one `StoredPatternDefinition` /// — the value V8 stores in `TitlePattern.definitionData` (Q25) — rather than as /// a definition beside two loose trim columns.-public struct BackupV14TitlePattern: Codable, Equatable, Sendable {+public struct BackupV15TitlePattern: Codable, Equatable, Sendable {     public let id: UUID     public let siteHostname: String     public let version: Int@@ -204,7 +212,7 @@ public struct BackupV14TitlePattern: Codable, Equatable, Sendable {  /// One URL rule, unchanged from the generation that froze it: it never carried a /// child list and its definition was already one value.-public struct BackupV14URLRule: Codable, Equatable, Sendable {+public struct BackupV15URLRule: Codable, Equatable, Sendable {     public let id: UUID     public let version: Int     public let isCurrent: Bool@@ -238,7 +246,7 @@ public struct BackupV14URLRule: Codable, Equatable, Sendable { /// one UUID are a normal permanent state in the live store, so the exporter /// writes the directory's folded identity rather than the rows, and `modifiedAt` /// on the wire is the fold's max.-public struct BackupV14WorkType: Codable, Equatable, Sendable {+public struct BackupV15WorkType: Codable, Equatable, Sendable {     public let id: UUID     public let name: String     /// `active` / `removed` / `merged`, carried raw so an archive written by a@@ -284,7 +292,7 @@ public struct BackupV14WorkType: Codable, Equatable, Sendable { /// build accepts is one it wrote, so a record missing them is malformed, and a /// default on decode would restore a reader's abandoned work as one they are /// still reading rather than saying so.-public struct BackupV14Work: Codable, Equatable, Sendable {+public struct BackupV15Work: Codable, Equatable, Sendable {     public let id: UUID     public let displayTitle: String     public let lastParsedTitle: String?@@ -298,7 +306,7 @@ public struct BackupV14Work: Codable, Equatable, Sendable {     /// The reader's own line about it, trimmed on write and carried verbatim     /// here — empty when they have not written one.     public let verdict: String-    /// Cites a `BackupV14WorkType`, or an entry this archive could not carry — a+    /// Cites a `BackupV15WorkType`, or an entry this archive could not carry — a     /// dangling id exports verbatim and imports as unresolved rather than     /// refusing or inventing a name (`configurable-work-types` Q24).     public let workTypeID: UUID?@@ -354,7 +362,7 @@ public struct BackupV14Work: Codable, Equatable, Sendable {     /// **Required**, on the statuses' precedent above — no `decodeIfPresent`,     /// no default. An empty set is written explicitly, so "no release days" and     /// "a record from a build that had none" cannot be confused: a record-    /// lacking the key is a malformed 14/15 file, not a pre-feature one (Q22).+    /// lacking the key is a malformed 15/16 file, not a pre-feature one (Q22).     ///     /// The **typed** enum rather than the raw strings, unlike `thumbnailShape`     /// beside it: a spelling this build cannot name fails decoding, which is@@ -420,7 +428,7 @@ public struct BackupV14Work: Codable, Equatable, Sendable { /// payload (Req 9.3). Names need not be unique (Q11), so there is nothing here /// to elect and nothing to fold — two rows sharing an id would be duplicate rows /// of one series, and the reference checks refuse a payload holding both.-public struct BackupV14Series: Codable, Equatable, Sendable {+public struct BackupV15Series: Codable, Equatable, Sendable {     public let id: UUID     /// Stored trimmed and non-empty; an empty trimmed name is refused at the     /// door (Req 13.5).@@ -442,12 +450,12 @@ public struct BackupV14Series: Codable, Equatable, Sendable {  /// One related-work link (`series-and-related-works` Req 13.1). ///-/// `BackupV14DistinctPair`'s shape, because the store's row is: two UUIDs in the+/// `BackupV15DistinctPair`'s shape, because the store's row is: two UUIDs in the /// canonical sorted order, naming works the archive may not carry — an /// unresolved link imports verbatim and is tolerated (Req 13.5, 11.2). What it /// adds is the reader's type and a modification time, which is the survivor key /// over a duplicated pair (Req 11.4, Q27).-public struct BackupV14Link: Codable, Equatable, Sendable {+public struct BackupV15Link: Codable, Equatable, Sendable {     public let id: UUID     public let lowerWorkID: UUID     public let higherWorkID: UUID@@ -468,14 +476,14 @@ public struct BackupV14Link: Codable, Equatable, Sendable {     }      /// The record with its two ids in the canonical order, whatever order they-    /// arrived in — `BackupV14DistinctPair.sorted`'s reason exactly: an unsorted+    /// arrived in — `BackupV15DistinctPair.sorted`'s reason exactly: an unsorted     /// pair is a second spelling of one link, and `MembershipReconciler.dedupeLinks`     /// groups on the sorted form, so a hand-built archive's row is normalised on     /// the way in rather than left as a duplicate nothing would ever match.-    public var sorted: BackupV14Link {+    public var sorted: BackupV15Link {         let ids = WorkDistinctPair.sortedIDs(lowerWorkID, higherWorkID)         guard ids.lower != lowerWorkID || ids.higher != higherWorkID else { return self }-        return BackupV14Link(+        return BackupV15Link(             id: id, lowerWorkID: ids.lower, higherWorkID: ids.higher, linkType: linkType,             createdAt: createdAt, modifiedAt: modifiedAt)     }@@ -483,7 +491,7 @@ public struct BackupV14Link: Codable, Equatable, Sendable {  /// One creator (`work-creators` Req 9.1). ///-/// **One record per folded identity**, `BackupV14WorkType`'s rule — rows sharing+/// **One record per folded identity**, `BackupV15WorkType`'s rule — rows sharing /// a UUID are one record everywhere else in the app — but carrying the **per-field /// modification times** the directory fold reads (Q50). A single `modifiedAt` /// cannot drive a per-field fold, and stamping it onto every field would make@@ -492,7 +500,7 @@ public struct BackupV14Link: Codable, Equatable, Sendable { /// A `merged` record names its **final** survivor (Q33): the exporter chases the /// alias chain, so an archive never carries a pointer at a record that is itself /// merged, and the reference checks refuse one.-public struct BackupV14Creator: Codable, Equatable, Sendable {+public struct BackupV15Creator: Codable, Equatable, Sendable {     public let id: UUID     /// The stored spelling, trimmed. Normalized names are computed, never     /// stored, so the file carries what the reader typed.@@ -540,10 +548,10 @@ public struct BackupV14Creator: Codable, Equatable, Sendable {  /// One role of the reader's list (`work-creators` Req 9.1). ///-/// `BackupV14Creator`'s shape with `position` in the place of notes, and a third+/// `BackupV15Creator`'s shape with `position` in the place of notes, and a third /// state: a removed role is retained so that re-adding its name restores it and /// the credits holding it keep the identifier (Decision 4).-public struct BackupV14CreatorRole: Codable, Equatable, Sendable {+public struct BackupV15CreatorRole: Codable, Equatable, Sendable {     public let id: UUID     public let name: String     public let nameModifiedAt: Date@@ -585,7 +593,7 @@ public struct BackupV14CreatorRole: Codable, Equatable, Sendable { /// One credit: that one creator worked on one work, in the roles it holds /// (`work-creators` Req 9.1). ///-/// `BackupV14Link`'s shape, because the store's row is: plain identifier columns+/// `BackupV15Link`'s shape, because the store's row is: plain identifier columns /// naming records the archive may not carry. A credit whose work, creator or role /// is absent imports **unresolved** and is tolerated (Req 9.5, /// [10.2](../../../../specs/work-creators/requirements.md#10.2)) — it is never a@@ -596,7 +604,7 @@ public struct BackupV14CreatorRole: Codable, Equatable, Sendable { /// so a restore after a remove-then-restore would lose pairings /// [2.2](../../../../specs/work-creators/requirements.md#2.2) promises to bring /// back. It is sorted and deduplicated, as every write leaves it.-public struct BackupV14Credit: Codable, Equatable, Sendable {+public struct BackupV15Credit: Codable, Equatable, Sendable {     public let id: UUID     public let workID: UUID     public let creatorID: UUID@@ -625,15 +633,15 @@ public struct BackupV14Credit: Codable, Equatable, Sendable {     /// The record with its role identifiers in the one order a stored set has —     /// sorted and deduplicated, as every writer leaves them.     ///-    /// `BackupV14Link.sorted`'s role and its reason: an unsorted or repeated+    /// `BackupV15Link.sorted`'s role and its reason: an unsorted or repeated     /// list is a second spelling of one role set, and every comparison the     /// import makes is an equality on the array. The wire check refuses a     /// repeat *as stored* first (Req 9.5), so this normalises a hand-built file     /// on the way to the commit rather than hiding a refusal.-    public var normalized: BackupV14Credit {+    public var normalized: BackupV15Credit {         let roles = WorkCreditSupport.roleIDs(roleIDs)         guard roles != roleIDs else { return self }-        return BackupV14Credit(+        return BackupV15Credit(             id: id, workID: workID, creatorID: creatorID, roleIDs: roles,             createdAt: createdAt, modifiedAt: modifiedAt)     }@@ -649,7 +657,7 @@ public struct BackupV14Credit: Codable, Equatable, Sendable { /// /// The cited rule is a **bare UUID**: a membership names the rule row and /// carries no rule version (Req 10.4, Q28).-public struct BackupV14Membership: Codable, Equatable, Sendable {+public struct BackupV15Membership: Codable, Equatable, Sendable {     public let id: UUID     public let workID: UUID?     public let hostname: String@@ -686,7 +694,7 @@ public struct BackupV14Membership: Codable, Equatable, Sendable { /// unordered, so it has one spelling, and it names Works the archive may not /// carry — a pair whose Works have not arrived imports verbatim and is tolerated /// (Req 8.3).-public struct BackupV14DistinctPair: Codable, Equatable, Sendable {+public struct BackupV15DistinctPair: Codable, Equatable, Sendable {     public let id: UUID     public let lowerWorkID: UUID     public let higherWorkID: UUID@@ -704,10 +712,10 @@ public struct BackupV14DistinctPair: Codable, Equatable, Sendable {     /// `MembershipReconciler.dedupePairs` groups on the sorted form — so a     /// hand-built or older archive's row is normalised on the way in rather than     /// left as a duplicate nothing would ever match (task 20/21 review).-    public var sorted: BackupV14DistinctPair {+    public var sorted: BackupV15DistinctPair {         let ids = WorkDistinctPair.sortedIDs(lowerWorkID, higherWorkID)         guard ids.lower != lowerWorkID || ids.higher != higherWorkID else { return self }-        return BackupV14DistinctPair(+        return BackupV15DistinctPair(             id: id, lowerWorkID: ids.lower, higherWorkID: ids.higher, recordedAt: recordedAt)     } }@@ -727,7 +735,7 @@ public struct BackupV14DistinctPair: Codable, Equatable, Sendable { /// /// `characterExtractionFingerprint` rides on the record whose `note` it /// describes (Req 9.4), for the reason the Work's does.-public struct BackupV14Entry: Codable, Equatable, Sendable {+public struct BackupV15Entry: Codable, Equatable, Sendable {     public let id: UUID     public let captureTitle: String     public let captureTitleSource: CaptureTitleSource@@ -810,7 +818,7 @@ public struct BackupV14Entry: Codable, Equatable, Sendable { /// has not arrived is a tolerated in-flight state /// (`character-extraction` Q78), a reference to a work the archive does not /// carry is a file contradicting itself.-public struct BackupV14Character: Codable, Equatable, Sendable {+public struct BackupV15Character: Codable, Equatable, Sendable {     public let id: UUID     public let workID: UUID?     public let name: String@@ -848,11 +856,11 @@ public struct BackupV14Character: Codable, Equatable, Sendable {  /// One suppression row. ///-/// The enum columns travel **raw**, for the reason `BackupV14WorkType`'s+/// The enum columns travel **raw**, for the reason `BackupV15WorkType`'s /// `stateRaw` does: an archive written by a later build's wider set decodes here /// rather than refusing, and the store's own coercion answers for a value this /// build cannot name.-public struct BackupV14Suppression: Codable, Equatable, Sendable {+public struct BackupV15Suppression: Codable, Equatable, Sendable {     public let id: UUID     public let workID: UUID?     public let kindRaw: String@@ -904,7 +912,7 @@ public struct BackupV14Suppression: Codable, Equatable, Sendable {  /// One place, as the archive holds it (`place-extraction` Req 5.1). ///-/// `BackupV14Character`'s fields with **one difference**: `workID` is not+/// `BackupV15Character`'s fields with **one difference**: `workID` is not /// optional. A place names its owner in a UUID column rather than through a /// relationship, so the two kinds of absence a character has — no relationship, /// and a relationship pointing at a row that has not arrived — collapse into@@ -915,7 +923,7 @@ public struct BackupV14Suppression: Codable, Equatable, Sendable { /// contradicting itself and refuses, while a place naming one is the tolerated /// orphan of Req 5.5 and is carried verbatim. There is no shape it could be /// rewritten to that would say anything truer.-public struct BackupV14Place: Codable, Equatable, Sendable {+public struct BackupV15Place: Codable, Equatable, Sendable {     public let id: UUID     /// The owning work, as the row states it. Kept whether or not it resolves —     /// the import writes it back unchanged, so an orphan round-trips.@@ -955,11 +963,11 @@ public struct BackupV14Place: Codable, Equatable, Sendable {  /// One place-suppression row. ///-/// `BackupV14Suppression`'s shape with `BackupV14Place`'s ownership column, and+/// `BackupV15Suppression`'s shape with `BackupV15Place`'s ownership column, and /// the same tolerance: the enum columns travel **raw** so a value a later /// build's wider set wrote survives the round trip, and the owner is carried /// whether or not it resolves.-public struct BackupV14PlaceSuppression: Codable, Equatable, Sendable {+public struct BackupV15PlaceSuppression: Codable, Equatable, Sendable {     public let id: UUID     public let workID: UUID     public let kindRaw: String
Packages/AsterismCore/Sources/AsterismCore/ComposedTeachingProjection.swift Modified +1 / -12
diff --git a/Packages/AsterismCore/Sources/AsterismCore/ComposedTeachingProjection.swift b/Packages/AsterismCore/Sources/AsterismCore/ComposedTeachingProjection.swiftindex 8c2520d3..56f17d13 100644--- a/Packages/AsterismCore/Sources/AsterismCore/ComposedTeachingProjection.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/ComposedTeachingProjection.swift@@ -196,26 +196,15 @@ public struct ComposedTeachingRequest: Sendable, Equatable {     public let trimSuffix: String?     public let urlDefinition: URLRuleDefinition?     public let acknowledgeUnsettled: Bool-    /// Whether this teach may convert an articles Site back to taught — the one-    /// way out of articles mode (Req 6.3, Decision 3).-    ///-    /// Default false, and only the Sites-screen re-teach route sets it. The gate-    /// it lifts exists so an inbox-driven teaching flow cannot convert an-    /// articles Site by accident; a deliberate re-teach from the screen whose-    /// job is site management is exactly the signal the gate demands, and-    /// lifting it there and nowhere else keeps accidental conversion impossible.-    public let permitsArticlesConversion: Bool      public init(titleDefinition: PatternDefinition, trimPrefix: String? = nil,                 trimSuffix: String? = nil, urlDefinition: URLRuleDefinition? = nil,-                acknowledgeUnsettled: Bool = false,-                permitsArticlesConversion: Bool = false) {+                acknowledgeUnsettled: Bool = false) {         self.titleDefinition = titleDefinition         self.trimPrefix = trimPrefix         self.trimSuffix = trimSuffix         self.urlDefinition = urlDefinition         self.acknowledgeUnsettled = acknowledgeUnsettled-        self.permitsArticlesConversion = permitsArticlesConversion     } } 
Packages/AsterismCore/Sources/AsterismCore/DomainEnums.swift Modified +3 / -1
diff --git a/Packages/AsterismCore/Sources/AsterismCore/DomainEnums.swift b/Packages/AsterismCore/Sources/AsterismCore/DomainEnums.swiftindex d9a2f0f8..03ba842a 100644--- a/Packages/AsterismCore/Sources/AsterismCore/DomainEnums.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/DomainEnums.swift@@ -264,10 +264,12 @@ public enum URLWorkAssignmentKind: String, CaseIterable, Codable, Sendable {     case wholeTitleFallback } +/// A Site is either untaught or taught. A third value, `articles`, was retired+/// by `remove-article-mode`; a row still carrying it reads as an unknown mode+/// and quarantines its hostname like any other unknown spelling. public enum SiteMode: String, CaseIterable, Codable, Sendable {     case untaught     case taught-    case articles }  public enum AnchorOrigin: String, CaseIterable, Codable, Sendable {
Packages/AsterismCore/Sources/AsterismCore/EntryCitations.swift Modified +1 / -1
diff --git a/Packages/AsterismCore/Sources/AsterismCore/EntryCitations.swift b/Packages/AsterismCore/Sources/AsterismCore/EntryCitations.swiftindex 21b6d42d..7a4fd148 100644--- a/Packages/AsterismCore/Sources/AsterismCore/EntryCitations.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/EntryCitations.swift@@ -191,7 +191,7 @@ extension Entry {     /// One citation row, as every pass that walks them sees it.     ///     /// It used to be a table of key paths into the model and into-    /// `BackupV14Entry`, hand-enumerated nowhere else. With the citations folded+    /// `BackupV15Entry`, hand-enumerated nowhere else. With the citations folded     /// into one blob the key paths have nothing to point at, so the row is a     /// *value* now — but the seven rows, their order and their labels are     /// unchanged, because `citerHostnames` still keeps the first hostname it
Packages/AsterismCore/Sources/AsterismCore/GroupOrdering.swift Modified +7 / -7
diff --git a/Packages/AsterismCore/Sources/AsterismCore/GroupOrdering.swift b/Packages/AsterismCore/Sources/AsterismCore/GroupOrdering.swiftindex 2854aad7..b1103717 100644--- a/Packages/AsterismCore/Sources/AsterismCore/GroupOrdering.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/GroupOrdering.swift@@ -631,13 +631,13 @@ public enum GroupOrdering {      public static func authoredContent(of entry: Entry) -> EntryAuthoredContent {         // `intentionallyUnattached` deliberately carries no provenance gate,-        // unlike the assignment and the chapter title beside it. The Articles-        // path sets the same flag with `.none` provenance (Decision 10), so a-        // gate on `workAssignmentProvenance == .manual` would read an Articles-        // unattachment as bare on one row and authored on another. Recorded as-        // known: the cost is that a derived unattachment counts as authored,-        // which can classify a group as non-bare and send it to the reader —-        // the safe direction.+        // unlike the assignment and the chapter title beside it. T-2361's two+        // duplicate-resolution writers can still set the flag on a row whose own+        // provenance is `.none`, so a gate on `workAssignmentProvenance ==+        // .manual` would read that row as bare on one device and authored on+        // another (`remove-article-mode` Q11). Recorded as known: the cost is+        // that a derived unattachment counts as authored, which can classify a+        // group as non-bare and send it to the reader — the safe direction.         // One decode of the blob, not two: both provenances come out of it.         let citations = entry.citationValues         return EntryAuthoredContent(
Packages/AsterismCore/Sources/AsterismCore/LibraryProviding.swift Modified +0 / -5
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryProviding.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryProviding.swiftindex ac99f479..735022f9 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryProviding.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryProviding.swift@@ -295,11 +295,6 @@ public protocol LibraryProviding: Sendable {     /// `.refreshed(freshContract)` if any basis/outcome value changed.     func commitTeaching(_ contract: TeachingContract) async throws -> TeachingCommitOutcome -    // MARK: - Articles mode: preview → approve → commit--    func projectArticles(hostname: String, junkSuffixRule: JunkSuffixRule?) async throws -> ArticlesContract-    func commitArticles(_ contract: ArticlesContract) async throws -> ArticlesCommitOutcome-     // MARK: - Re-parse: preview → approve → commit      /// Project a single-entry Re-parse. Returns a contract for approval.
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Articles.swift Deleted +0 / -175
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Articles.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Articles.swiftdeleted file mode 100644index 5beb6f5a..00000000--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Articles.swift+++ /dev/null@@ -1,175 +0,0 @@-import Foundation-import OSLog-import SwiftData--private let articlesRepositoryLogger = Logger(-    subsystem: "me.nore.ig.Asterism",-    category: "ArticlesRepository"-)--extension LibraryRepository {-    public func projectArticles(-        hostname: String,-        junkSuffixRule: JunkSuffixRule?-    ) async throws -> ArticlesContract {-        guard capabilities.supportsArticles else {-            throw LibraryRepositoryError.invalidInput(-                operation: "projecting articles mode",-                reason: AsterismCapabilityError.articlesUnavailable(gate: capabilities.gate).description-            )-        }-        if let junkSuffixRule {-            do { try ArticleTitleCleaner.validate(junkSuffixRule) }-            catch {-                throw LibraryRepositoryError.invalidInput(-                    operation: "projecting articles mode",-                    reason: String(describing: error)-                )-            }-        }--        return try await withLockedContext(mode: .shared, operation: "projecting articles mode") { context in-            let basis = try self.buildTeachingBasis(hostname: hostname, context: context)-            guard basis.siteMode != .articles else {-                throw LibraryRepositoryError.invalidInput(-                    operation: "projecting articles mode",-                    reason: "Site is already in one-way articles mode"-                )-            }-            let request = ArticlesRequest(junkSuffixRule: junkSuffixRule)-            return ArticlesContract(-                basis: basis,-                request: request,-                outcome: Self.computeArticlesOutcome(basis: basis, request: request)-            )-        }-    }--    public func commitArticles(_ contract: ArticlesContract) async throws -> ArticlesCommitOutcome {-        guard capabilities.supportsArticles else {-            throw LibraryRepositoryError.invalidInput(-                operation: "committing articles mode",-                reason: AsterismCapabilityError.articlesUnavailable(gate: capabilities.gate).description-            )-        }--        return try await withLockedContext(mode: .exclusive, operation: "committing articles mode") { context in-            // The basis builder carries Req 3.4's refusal for a hostname with-            // more than one Site row, so this commit refuses before it writes.-            let currentBasis = try self.buildTeachingBasis(-                hostname: contract.basis.hostname,-                context: context-            )-            let currentOutcome = Self.computeArticlesOutcome(-                basis: currentBasis,-                request: contract.request-            )-            if currentBasis != contract.basis || currentOutcome != contract.outcome {-                articlesRepositoryLogger.info("Articles projection refreshed after basis changed")-                return .refreshed(ArticlesContract(-                    basis: currentBasis,-                    request: contract.request,-                    outcome: currentOutcome-                ))-            }--            let sites = try Self.fetchSites(hostname: contract.basis.hostname, context: context)-            guard let site = sites.first else {-                return .invalidated(reason: "The Site no longer exists.")-            }-            guard site.mode != .articles else {-                return .invalidated(reason: "The Site is already in one-way articles mode.")-            }--            for pattern in site.patternValues where pattern.isActive {-                pattern.isActive = false-            }-            site.mode = .articles-            site.junkSuffixRule = contract.request.junkSuffixRule--            // Make current URL rule historical (Req 8.11: articles makes URL rule historical)-            for rule in site.urlRuleValues where rule.isCurrent {-                rule.isCurrent = false-            }--            let hostname = contract.basis.hostname-            let entryDescriptor = FetchDescriptor<Entry>(-                predicate: #Predicate { $0.hostname == hostname }-            )-            let entries = try context.fetch(entryDescriptor)-            // Every row of the logical record (Req 2.7): these are derived-            // fields, and leaving one row of a split group with a chapter title-            // and a Work while its twin has neither makes the group present as-            // two different records.-            let entryGroups = Self.entryGroups(-                entries,-                canonicalWorkIDs: try Self.canonicalWorkIDs(normalising: entries, context: context))-            let timestamp = self.clock.now()--            for projection in contract.outcome.plan.entryProjections {-                guard let group = entryGroups[projection.entryID] else {-                    return .invalidated(reason: "An Entry in the approved preview no longer exists.")-                }--                for entry in group.rows {-                    if !projection.chapterProtected {-                        entry.chapterTitle = nil-                    }-                    if !projection.assignmentProtected {-                        entry.work = nil-                        entry.intentionallyUnattached = true-                    }--                    // Restore conservative keys, clear URL-derived sequence and assignment-                    // provenance (Req 8.11: articles clears URL-derived fields)-                    entry.identityBasisRaw = EntryIdentityBasis.conservative.rawValue-                    entry.urlWorkIdentity = nil-                    entry.chapterSequence = nil-                    // Restore conservative identity key (raw URL is already validated)-                    if let conservativeKey = try? EntryIdentityNormalizer.key(forRawURL: entry.rawURLString) {-                        entry.entryIdentityKey = conservativeKey-                    }--                    // Every field this sweep cleared is a citation, so it clears-                    // them where they live (V9): the identity falls back to the-                    // raw URL, both URL-derived evidence citations go, and the-                    // chapter and assignment arms go with the values above-                    // unless the projection protected them.-                    entry.editCitations { citations in-                        if !projection.chapterProtected { citations.chapterTitle = .absent }-                        if !projection.assignmentProtected { citations.workAssignment = .none }-                        citations.identity = .rawURL-                        citations.urlWork = nil-                        citations.chapterSequence = nil-                        citations.workURL = nil-                        citations.workURLAssignmentKind = nil-                    }-                    entry.modifiedAt = timestamp-                }-            }--            do { try self.saveStrategy.save(context) }-            catch {-                throw LibraryRepositoryError.libraryUnavailable(-                    operation: "atomically saving articles mode",-                    reason: String(describing: error)-                )-            }--            articlesRepositoryLogger.debug(-                "Committed articles mode for \(contract.basis.hostname, privacy: .public)"-            )-            return .committed-        }-    }--    static func computeArticlesOutcome(-        basis: TeachingBasis,-        request: ArticlesRequest-    ) -> ArticlesOutcome {-        ArticlesOutcome(plan: TitleProjectionPlanner.planArticles(-            entries: entrySnapshots(from: basis.entries),-            junkSuffixRule: request.junkSuffixRule-        ))-    }-}
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+BackupImportGates.swift Modified +14 / -9
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+BackupImportGates.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+BackupImportGates.swiftindex 7238157c..da2d44c1 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+BackupImportGates.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+BackupImportGates.swift@@ -39,15 +39,20 @@ extension LibraryRepository {         // (`docs/agent-notes/schema-migration.md`). While the snapshot only         // *added*, that showed up as saves silently dropping a column; V9's         // stage **removed**, which aborted the process instead with-        // `NSUnknownKeyException` on a column the live entity no longer had;-        // and V10 *adds* again, so the live shape is no longer even a subset of-        // the frozen one. V11 added two `Work` columns *and* two whole tables,-        // V12 added three more tables, V13 added two, and V14 adds three `Work`-        // columns — none of which a stale registration could answer. Every one-        // of those is a reason to name the live schema here, and it must be-        // re-checked on every snapshot freeze — this line has now been-        // re-checked at the V10, V11, V12 and V13 freezes and moved to V14.-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        // `NSUnknownKeyException` on a column the live entity no longer had.+        // V10 through V15 only added — V10 after V9's removal, V11 two `Work`+        // columns *and* two whole tables, V12 three more tables, V13 two, V14+        // three `Work` columns and V15 `Work.releaseDaysRaw` — none of which a+        // stale registration could answer, the live shape not even being a+        // subset of the frozen one across those six. V16 **removes**+        // `Site.junkSuffixRule` and adds nothing, so the subset relation is+        // back; that is not the safer side of the line but V9's again, because+        // a stale V15 registration answers with a column the live `Site` no+        // longer has and aborts the process rather than losing a write quietly.+        // Every one of those is a reason to name the live schema here, and it+        // must be re-checked on every snapshot freeze — this line has now been+        // re-checked at the V10 through V15 freezes and moved to V16.+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             schema: schema,             isStoredInMemoryOnly: true,
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Bootstrap.swift Modified +73 / -66
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Bootstrap.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Bootstrap.swiftindex 6c7a7a30..02663b28 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Bootstrap.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Bootstrap.swift@@ -4,45 +4,48 @@ import SwiftData  /// Runtime opening of the live library, classified then acted on. ///-/// Every store the app can reach is recorded at V14 or above, and the conversion-/// left is the one `.lightweight` stage `ModelContainer.init` runs — V14 → V15:-/// the sidecar, the V3 reader, the completion pass and every stage below V14 are+/// Every store the app can reach is recorded at V15 or above, and the conversion+/// left is the one `.lightweight` stage `ModelContainer.init` runs — V15 → V16:+/// the sidecar, the V3 reader, the completion pass and every stage below V15 are /// retired (Decision 1; Q2 of `drop-superseded-columns`, Q18 of /// `work-and-reading-status`, Q60 of `series-and-related-works`, Q15 of /// `work-creators`, Q48 of `place-extraction`, and `work-thumbnails`). What /// survives is the readiness contract. /// The app validates with `LibraryValidator` and clears residual evidence; the-/// marker it publishes contains `"15"` (`extensionOpenableMarkerVersion`), the+/// marker it publishes contains `"16"` (`extensionOpenableMarkerVersion`), the /// only version the extension opens (Q14). /// /// An *empty* store is marked ready as soon as it exists, so the app either opens /// a ready library or throws — there is no third state for the reader to resolve.-/// It is marked at `"15"` directly: there is nothing in it to bring forward (Q26).+/// It is marked at `"16"` directly: there is nothing in it to bring forward (Q26). ///-/// **There is one lagging generation: `"14"`.** V15 adds one defaulted `Work`-/// column and no table, and the whole of that is the lightweight stage-/// `ModelContainer` runs — the column's property initialiser is the attribute-/// default the stage writes — so the `.markerLagging` arm opens, validates,-/// and publishes `"15"`, with no data pass and no reconciler. The digit exists-/// even though the stage needs no help from it, because it is what keeps the-/// *extension* out of a conversion it must never run (Q3): `openContainer`-/// passes the migration plan for both roles, and only the marker check stops a-/// concurrent share-sheet invocation from performing it.+/// **There is one lagging generation: `"15"`.** V16 **removes** one `Site`+/// column, `junkSuffixRule`, and adds nothing, and the whole of that is the+/// lightweight stage `ModelContainer` runs — a removed column needs no+/// attribute default and no pass to fill one — so the `.markerLagging` arm+/// opens, validates, and publishes `"16"`, with no data pass and no+/// reconciler. The digit matters more for a removing stage than it did for the+/// adding ones, because it is what keeps the *extension* out of a conversion it+/// must never run (Q3), and a concurrent share-sheet open part-way through a+/// removal is destructive rather than merely early: `openContainer` passes the+/// migration plan for both roles, and only the marker check stops that+/// invocation from performing it. ///-/// `"13"` is **gone** rather than kept beside `"14"`, on the substitution the+/// `"14"` is **gone** rather than kept beside `"15"`, on the substitution the /// schema-migration note allows once the population has passed the old digit.-/// Like the three substitutions before it and unlike the `"10"` one, which ran a+/// Like the four substitutions before it and unlike the `"10"` one, which ran a /// commit ahead of its verification (Q32 and then Q60 of /// `series-and-related-works`), this one is behind it: the owner confirmed every-/// device on marker `"14"` on 2026-09-15 before the freeze (`update-schedule`-/// `prerequisites.md`), so the marker set and `AsterismV15MigrationPlan`'s-/// `[V14, V15]` have never disagreed at this generation.+/// device on marker `"15"` on 2026-09-21 before the freeze+/// (`remove-article-mode` Q10), so the marker set and+/// `AsterismV16MigrationPlan`'s `[V15, V16]` have never disagreed at this+/// generation. /// /// A store found on any other digit is refused, naming it, and the recovery is /// the backup archive, exactly as for a store recorded below V5. The two roles /// differ in what they accept and in what they may do about it: the app opens-/// `"14"` and `"15"` (`appOpenableMarkerVersions`) and may create, convert and-/// mark a store; the extension opens `"15"` only and writes nothing.+/// `"15"` and `"16"` (`appOpenableMarkerVersions`) and may create, convert and+/// mark a store; the extension opens `"16"` only and writes nothing. public extension LibraryRepository {     /// The result of evaluating the live library's fixed-path state under an     /// exclusive lease.@@ -50,7 +53,7 @@ public extension LibraryRepository {         case ready(LibraryRecordCounts)     } -    /// Extension-only readiness result. The extension opens only a `"15"` marker.+    /// Extension-only readiness result. The extension opens only a `"16"` marker.     enum ExtensionResult: Equatable, Sendable {         case ready(LibraryRecordCounts)     }@@ -184,7 +187,7 @@ public extension LibraryRepository {                     + "version this build opens; restore from a backup archive")          case .ready:-            // open (nothing to convert at `"15"`) → validate → clear residual+            // open (nothing to convert at `"16"`) → validate → clear residual             // evidence → counts. The marker already records the current             // generation, so nothing is published: this is the only certification             // sequence left, and it writes no marker at all.@@ -197,33 +200,32 @@ public extension LibraryRepository {             return Certification(result: .ready(counts), diagnostics: diagnostics)          case .markerLagging(let generation):-            // open (which adds the release-days column) → validate →-            // publish `"15"`.+            // open (which drops the junk-suffix column) → validate →+            // publish `"16"`.             //             // **No data pass and no reconciler.** The `"7"` arm ran             // `V8PopulationPass` and `MembershipReconciler` because V8 *added*-            // tables and blobs that something had to fill; V15 adds one-            // **defaulted** column, whose property initialiser SwiftData turns-            // into the Core Data attribute default, so the lightweight stage-            // fills it inside `ModelContainer.init` and there is nothing left-            // for a pass to do. The launch reconcile runs moments later on-            // the same store for anything else.+            // tables and blobs that something had to fill; V16 **removes** one+            // column, so there is nothing to fill and nothing to convert — the+            // stage drops it inside `ModelContainer.init` and the value it held+            // had no reader left before the column went. The launch reconcile+            // runs moments later on the same store for anything else.             //             // **Validation is the gate, and the marker goes after it.**             // There is no pass to certify itself with, so what certifies the-            // conversion is the store validating: a throw here leaves `"14"` on+            // conversion is the store validating: a throw here leaves `"15"` on             // disk, fails the open, and the next open re-enters this arm over a             // store the stage has already converted — which is safe, because-            // adding columns that are already there is a no-op.+            // removing a column that is already gone is a no-op.             //             // The residual evidence goes **last**, after the publish rather than             // with the validation: a publish that fails on a full disk leaves-            // the library at `"14"` with its historical marker and sidecar still+            // the library at `"15"` with its historical marker and sidecar still             // beside it, which is the state the next open wants to find.             let container = try openCertificationContainer(configuration, hooks: hooks)             let context = ModelContext(container)             bootstrapLogger.debug(-                "Marker generation \(generation, privacy: .public) is lagging; certifying the V15 conversion")+                "Marker generation \(generation, privacy: .public) is lagging; certifying the V16 conversion")             let diagnostics = try validateStore(context: context)             try publishReadiness(at: configuration.readinessMarkerURL)             clearResidualEvidence(configuration)@@ -242,7 +244,7 @@ public extension LibraryRepository {                 reason: kind.orphanedReason)          case .unmarkedStore:-            // open → counts → refuse if nonempty → publish `"15"`.+            // open → counts → refuse if nonempty → publish `"16"`.             //             // An *empty* unmarked store is the state a crash between store             // creation and the marker leaves, or a `publishReadiness` that@@ -269,10 +271,10 @@ public extension LibraryRepository {             return Certification(result: .ready(counts), diagnostics: .empty)          case .pristine:-            // open (which creates) → save → counts → publish `"15"`.+            // open (which creates) → save → counts → publish `"16"`.             //-            // Certified at `"15"`, the current generation: a store created by-            // these classes is already V15-shaped, so it is born in the state a+            // Certified at `"16"`, the current generation: a store created by+            // these classes is already V16-shaped, so it is born in the state a             // certified library is in (Q26) rather than at the lagging digit             // with a conversion ahead of it.             let container = try openCertificationContainer(configuration, hooks: hooks)@@ -417,22 +419,23 @@ extension LibraryRepository {         var quarantined: [String: LibraryValidationError] { diagnostics.quarantineMap() }     } -    /// Opens the fixed-path store with the live V15 schema and-    /// `AsterismV15MigrationPlan`, which declares `[V14, V15]` and one-    /// lightweight stage: this call is where an installed V14 library is+    /// Opens the fixed-path store with the live V16 schema and+    /// `AsterismV16MigrationPlan`, which declares `[V15, V16]` and one+    /// lightweight stage: this call is where an installed V15 library is     /// converted, and the only place it happens.     ///-    /// **The stage adds exactly one column.** V14 → V15 adds-    /// `Work.releaseDaysRaw` and no table at all; it is defaulted rather than-    /// optional, so its property initialiser is the attribute default the stage-    /// writes into every existing row, with no data pass behind it (Req 9.1).-    /// The V13 → V14 stage retired with its snapshot once every device was-    /// confirmed on marker `"14"`, as the V12 → V13 stage did before it-    /// (`work-thumbnails`), the V11 → V12 one before that (Q48 of-    /// `place-extraction`), the V10 → V11 one before that (Q15) and the-    /// V9 → V10 one before that (Q60).+    /// **The stage removes exactly one column.** V15 → V16 drops+    /// `Site.junkSuffixRule` and adds nothing at all; a removed column has no+    /// attribute default to write and nothing for a data pass to fill+    /// (Req 4.3). It is the second removing stage in the project's history,+    /// after V8 → V9.+    /// The V14 → V15 stage retired with its snapshot once every device was+    /// confirmed on marker `"15"`, as the V13 → V14 stage did before it+    /// (`update-schedule`), the V12 → V13 one before that (`work-thumbnails`),+    /// the V11 → V12 one before that (Q48 of `place-extraction`), the+    /// V10 → V11 one before that (Q15) and the V9 → V10 one before that (Q60).     ///-    /// A store recorded below V14 has no stage and is refused here — `classify`+    /// A store recorded below V15 has no stage and is refused here — `classify`     /// already refuses one before any container is constructed (Req 2.9,     /// Decision 1 of `retire-migration-chain`), so the refusal is a second     /// closed door rather than a new one.@@ -447,7 +450,7 @@ extension LibraryRepository {         at storeURL: URL,         mirroring cloudKitDatabase: ModelConfiguration.CloudKitDatabase = .none     ) throws -> ModelContainer {-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let storeConfiguration = ModelConfiguration(             // **Frozen persisted state (Req 3.5).** This names the store             // configuration *inside* the container, not the file — `url:` below is@@ -461,7 +464,7 @@ extension LibraryRepository {         )         return try ModelContainer(             for: schema,-            migrationPlan: AsterismV15MigrationPlan.self,+            migrationPlan: AsterismV16MigrationPlan.self,             configurations: [storeConfiguration]         )     }@@ -556,7 +559,9 @@ extension LibraryRepository {         try? FileManager.default.removeItem(at: configuration.migrationSidecarURL)     } -    /// Store-level validation on the open path — over V15, the live schema.+    /// Store-level validation on the open path, over the live schema — named+    /// that way rather than by generation, because the fact is that it is the+    /// live one, and a digit here goes stale at every bump.     /// States outside Req 1.1 still     /// fail closed; the four tolerated states and every illegal Site tuple come     /// back as diagnoses, so the library opens and quarantines what it must@@ -585,8 +590,9 @@ extension LibraryRepository {     /// put `"8"` in `"7"`'s place (Q2), `work-and-reading-status` put `"9"` in     /// `"8"`'s (Q18), `series-and-related-works` put `"10"` in `"9"`'s,     /// `work-creators` put `"11"` in `"10"`'s, `place-extraction` put `"12"` in-    /// `"11"`'s, `work-thumbnails` put `"13"` in `"12"`'s, and `update-schedule`-    /// puts `"14"` in `"13"`'s, each time+    /// `"11"`'s, `work-thumbnails` put `"13"` in `"12"`'s, `update-schedule` put+    /// `"14"` in `"13"`'s, and `remove-article-mode` puts `"15"` in `"14"`'s,+    /// each time     /// because a lagging arm no device can reach is a path nothing tests. That     /// substitution is what `docs/agent-notes/schema-migration.md` allows only     /// after re-verifying the population.@@ -596,13 +602,14 @@ extension LibraryRepository {     /// `["10", "11"]` while `AsterismV11MigrationPlan` kept the V9 → V10     /// stage, because the prerequisite confirming every device past `"9"` was     /// still unticked, and the follow-up closed the gap a commit later (Q60).-    /// **At the four bumps since, the verification came first**: the owner+    /// **At the five bumps since, the verification came first**: the owner     /// confirmed every device on `"11"` on 2026-09-07 (`work-creators` Q15), on     /// `"12"` on 2026-09-10 (`place-extraction` Q48), on `"13"` on 2026-09-12-    /// (`work-thumbnails` `prerequisites.md`) and on `"14"` on 2026-09-15-    /// (`update-schedule` `prerequisites.md`), so the set moved to-    /// `["14", "15"]` and `AsterismV15MigrationPlan` shipped as `[V14, V15]` in-    /// the same commit. A `"13"` marker is refused by a build that could not+    /// (`work-thumbnails` `prerequisites.md`), on `"14"` on 2026-09-15+    /// (`update-schedule` `prerequisites.md`) and on `"15"` on 2026-09-21+    /// (`remove-article-mode` Q10), so the set moved to+    /// `["15", "16"]` and `AsterismV16MigrationPlan` shipped as `[V15, V16]` in+    /// the same commit. A `"14"` marker is refused by a build that could not     /// convert its store anyway; the recovery is the backup archive, as for any     /// unrecognised marker.     static let appOpenableMarkerVersions: Set<String> = [@@ -610,16 +617,16 @@ extension LibraryRepository {     ]      /// The one lagging generation the app still opens: a library certified by a-    /// V14 build, which `.markerLagging` converts and re-marks. Frozen persisted+    /// V15 build, which `.markerLagging` converts and re-marks. Frozen persisted     /// state, like its successor below.-    static let laggingOpenableMarkerVersion = "14"+    static let laggingOpenableMarkerVersion = "15"      /// The only version the **extension** opens, and the one `publishReadiness`     /// writes (Q14). Frozen persisted state — these are the bytes on disk in an     /// installed library (Req 3.5). Both generations the app opens are now     /// spelled with two characters, which is why nothing anywhere may assume a     /// marker is one character long.-    static let extensionOpenableMarkerVersion = "15"+    static let extensionOpenableMarkerVersion = "16"      // The app-side counterpart of `validateMarkerContentForExtension` stood     // here. It restated the acceptance test the classifier performs, and@@ -645,7 +652,7 @@ extension LibraryRepository {     /// the fork back the moment it opened two. `multi-site-works` is that     /// moment.     ///-    /// * A generation the app *does* open — `"14"`, the update window: the app is+    /// * A generation the app *does* open — `"15"`, the update window: the app is     ///   updated and not yet launched, the library still records the previous     ///   digit, and opening the app completes the conversion. The message says     ///   so, and `configurable-work-types` Req 8.7 requires the capture to fail
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+BootstrapState.swift Modified +19 / -18
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+BootstrapState.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+BootstrapState.swiftindex d82b9dcd..2507f708 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+BootstrapState.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+BootstrapState.swift@@ -16,24 +16,24 @@ enum BootstrapState: Equatable, Sendable {     /// migration that would raise it is gone, and the recovery is the backup     /// archive.     ///-    /// **The floor is V13, not V5** — the plan is `[V13, V14]` — so V5 through-    /// V12 stores are equally beyond raising. The name is inherited from when V5+    /// **The floor is V15, not V5** — the plan is `[V15, V16]` — so V5 through+    /// V14 stores are equally beyond raising. The name is inherited from when V5     /// *was* the floor and is kept deliberately (Q35 of     /// `drop-superseded-columns`); the refusal it stands for has widened under     /// it. What has *not* widened is the reading that reaches this case:     /// `StoreMetadata` positively identifies only a below-V5 store, because     /// `NSStoreModelVersionIdentifiers` is advisory and a reader that refused     /// on anything it did not recognise would lock the owner's only library.-    /// A V5–V12 store is therefore refused a row later, by its retired marker-    /// digit (`"5"` through `"12"` all fall to `.unrecognised`), with the+    /// A V5–V14 store is therefore refused a row later, by its retired marker+    /// digit (`"5"` through `"14"` all fall to `.unrecognised`), with the     /// same recovery. Both paths refuse; only this one names a store version.     case belowV5(version: String)     /// A certified library: the readiness marker records the current-    /// generation, `"14"`, and a store is present.+    /// generation, `"16"`, and a store is present.     case ready-    /// A library certified at the **previous** generation, `"13"`, with a store-    /// present: V14's schema stage adds three optional `Work` columns and no-    /// table at all on the way in, which is the whole of the conversion, so all this+    /// A library certified at the **previous** generation, `"15"`, with a store+    /// present: V16's schema stage drops one `Site` column and adds nothing at+    /// all on the way in, which is the whole of the conversion, so all this     /// arm owes is validating it and republishing. The app does that; the     /// extension refuses and says to open the app, which is what keeps the     /// conversion out of a process that holds a shared lock (Q3).@@ -88,13 +88,13 @@ extension LibraryRepository {     /// logical write (Req 2.1, 2.8).     ///     /// **The order is the specification.** The predicates overlap — a stale-    /// historical marker beside a valid `"14"` marker is a ready library with a+    /// historical marker beside a valid `"16"` marker is a ready library with a     /// leftover, not an ambiguity — and the first match wins, which is what makes     /// overlapping evidence resolvable at all (Q15). The rows, in order:     ///     /// 1. a positively below-V5 recorded version (Req 2.9)-    /// 2. marker `"14"` and a store present (Req 2.2)-    /// 3. marker `"13"` — a generation the app still opens — and a store present+    /// 2. marker `"16"` and a store present (Req 2.2)+    /// 3. marker `"15"` — a generation the app still opens — and a store present     /// 4. any evidence with no store present (Req 2.6)     /// 5. a store present with no readiness marker of any generation (Req 2.4)     /// 6. nothing on disk (Req 2.5)@@ -107,15 +107,16 @@ extension LibraryRepository {     /// (Q18 of `work-and-reading-status`), `"10"` for `"9"` (Q32 of     /// `series-and-related-works`), `"11"` for `"10"` (Q15 of `work-creators`),     /// `"12"` for `"11"` (Q48 of `place-extraction`), `"13"` for `"12"`-    /// (`work-thumbnails`)+    /// (`work-thumbnails`), `"14"` for `"13"` (`update-schedule`) and `"15"`+    /// for `"14"` (Q10 of `remove-article-mode`)     /// — because a lagging arm no device can reach is a path nothing tests.     /// Substituting is what `docs/agent-notes/schema-migration.md` permits only     /// after confirming the population has passed the digit that goes; at the     /// `"10"` substitution that confirmation was still outstanding, so     /// `AsterismV11MigrationPlan` kept the V9 → V10 stage the marker set no-    /// longer reached until the follow-up retired it (Q60). At the three-    /// substitutions since it came first, so `AsterismV15MigrationPlan` ships-    /// as `[V14, V15]` in the same commit. A digit outside the set still falls+    /// longer reached until the follow-up retired it (Q60). At the five+    /// substitutions since it came first, so `AsterismV16MigrationPlan` ships+    /// as `[V15, V16]` in the same commit. A digit outside the set still falls     /// to the last row and is refused naming itself, with the backup archive as     /// the recovery.     ///@@ -154,7 +155,7 @@ extension LibraryRepository {         // (Decision 5). Absent, unreadable, merged and unrecognised readings all         // fall through to the marker's word, which is what ships today. The         // reading only ever names a *below-V5* store even though the plan's-        // floor is now V13 (Q35): a V5–V12 store falls through to row 7 on its+        // floor is now V15 (Q35): a V5–V14 store falls through to row 7 on its         // retired marker digit, which refuses it just the same.         if case .below(let version) = StoreMetadata.recordedVersion(at: storeURL) {             return .belowV5(version: version)@@ -169,8 +170,8 @@ extension LibraryRepository {             return .ready         } -        // 3. A generation the app opens but has not certified at: the data pass-        // and the republication are owed. The acceptance test is+        // 3. A generation the app opens but has not certified at: the+        // conversion and the republication are owed. The acceptance test is         // `appOpenableMarkerVersions`, the single live source of truth for what         // the app will open, so adding a generation there is all it takes to         // make this row admit it.
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Capture.swift Modified +1 / -1
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Capture.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Capture.swiftindex 00d9958d..db251a6c 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Capture.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Capture.swift@@ -510,7 +510,7 @@ extension EntryGroup {     /// representative. A *parsed* chapter title is a derived field (Q44) and     /// takes no part in selecting the carrier. Sourcing parity only — Entry     /// detail's heading falls back further, through `chapterSequence` and the-    /// cleaned articles title, which this basis does not carry.+    /// trimmed presentation title, which this basis does not carry.     func reShareBasis(hostname: String) -> ReShareEditBasis {         let content = presentedContent         return ReShareEditBasis(
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ComposedTeaching.swift Modified +0 / -48
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ComposedTeaching.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ComposedTeaching.swiftindex 1b7f9b8f..ba3e6963 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ComposedTeaching.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ComposedTeaching.swift@@ -50,16 +50,6 @@ extension LibraryRepository {         }         return try await withLockedContext(mode: .shared, operation: "projecting composed teaching") { context in             let basis = try self.buildComposedTeachingBasis(hostname: hostname, context: context)-            // Decision 3: articles mode's only exit is a deliberate re-teach-            // from the Sites screen, which is the one route that sets the flag.-            // Every other caller keeps the default and is refused here rather-            // than at the commit — a projection the commit will always-            // invalidate is the dead end Req 3.4 exists to prevent.-            guard basis.siteMode != .articles || request.permitsArticlesConversion else {-                throw LibraryRepositoryError.invalidInput(-                    operation: "projecting composed teaching",-                    reason: "Site '\(hostname)' is in articles mode; teaching is unavailable")-            }             let outcome = try ComposedTeachingProjectionPlanner.project(basis: basis, request: request)             return ComposedTeachingContract(basis: basis, request: request, outcome: outcome)         }@@ -105,16 +95,6 @@ extension LibraryRepository {             // 4. Resolve rule identities (no-op detection reuses current versions).             let sites = try Self.fetchSites(hostname: hostname, context: context)             guard let site = sites.first else { return .invalidated(reason: "no Site for hostname '\(hostname)'") }-            guard site.mode != .articles || contract.request.permitsArticlesConversion else {-                return .invalidated(reason: "articles Site cannot be composed-taught")-            }-            // The conversion out of articles mode (Decision 3). The `site.mode =-            // .taught` write below performs it; the junk-suffix rule goes with-            // the mode it belongs to, because the closed tuple table refuses a-            // non-articles Site that retains one — a retained "inert" rule-            // leaves a library the app refuses to open. Switching back to-            // articles authors a fresh rule anyway.-            let convertsFromArticles = site.mode == .articles              let timestamp = self.clock.now() @@ -176,7 +156,6 @@ extension LibraryRepository {             }              site.mode = .taught-            if convertsFromArticles { site.junkSuffixRule = nil }             // The composed model absorbs trims into the title rule; the store             // carries no Site-level interpretation or trim column (Req 3.1). @@ -189,33 +168,6 @@ extension LibraryRepository {                 titleTrimSuffix: Self.nonEmpty(contract.request.trimSuffix),                 url: resolvedURL.map { ($0.id, $0.definition) }, timestamp: timestamp) -            // 6b. The articles conversion's own fix-up (Decision 3).-            //-            // Articles mode marks its Entries intentionally unattached with-            // `.none` provenance, and the closed tuple table reads that pair as-            // legal *only while the Site is in articles mode*-            // (`LibraryValidator.validateAssignment`: a `.none` assignment-            // requires `intentionallyUnattached == (site.mode == .articles)`).-            // Leaving them alone would therefore make every one of them illegal-            // the moment the mode flips, and roll the conversion back.-            //-            // The mark itself must survive — §2.6, and Decision 3 says so in as-            // many words — so the provenance is promoted to `.manual` through-            // `applyManualAssignment`, the same write `moveEntry`'s "Leave-            // unattached" branch and the work-deletion detach both make (Q22:-            // one set of manual-assignment semantics, not three copies of a-            // field list). It also clears the URL assignment trio, which a-            // `.manual` row must not cite. Every row, because a logical-            // record's rows must not disagree about it (Req 2.7).-            if convertsFromArticles {-                let descriptor = FetchDescriptor<Entry>(-                    predicate: #Predicate { $0.hostname == hostname })-                for row in try context.fetch(descriptor)-                where row.intentionallyUnattached && row.workAssignmentProvenance == .none {-                    Self.applyManualAssignment(to: row, at: timestamp)-                }-            }-             // 7. Validate the complete prospective graph, then save once (Req 9.1).             // The tolerant entry point: an unrelated hostname's tolerated state             // must not roll back a teaching commit that is itself legal.
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ConfirmImport.swift Modified +25 / -40
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ConfirmImport.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ConfirmImport.swiftindex dc58131d..bfba187d 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ConfirmImport.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ConfirmImport.swift@@ -17,13 +17,13 @@ public struct InterruptedImportReport: Codable, Sendable, Equatable {     } } -/// The one field the off-host pre-pass rewrites. `BackupV14Membership`'s+/// The one field the off-host pre-pass rewrites. `BackupV15Membership`'s /// properties are `let`, so the value is rebuilt through the memberwise /// initialiser rather than mutated — which is what keeps the record a value the /// commit path can treat as verbatim.-extension BackupV14Membership {-    fileprivate func withWorkURLString(_ value: String?) -> BackupV14Membership {-        BackupV14Membership(+extension BackupV15Membership {+    fileprivate func withWorkURLString(_ value: String?) -> BackupV15Membership {+        BackupV15Membership(             id: id, workID: workID, hostname: hostname, createdAt: createdAt,             urlIdentity: urlIdentity, urlIdentityState: urlIdentityState,             urlIdentityRuleID: urlIdentityRuleID, workURLString: value)@@ -200,7 +200,7 @@ extension LibraryRepository {         // (Decision 10), because the archive's own rules are part of what makes         // its designation legal: a `.taught` restore is legal precisely because         // the active title rule arrives in this same step.-        var matchedRecords: [BackupV14Site] = []+        var matchedRecords: [BackupV15Site] = []         for record in payload.sites {             if sitesByHostname[record.hostname] != nil {                 matchedRecords.append(record)@@ -474,32 +474,19 @@ extension LibraryRepository {     /// so an archive saying "untaught" is not a claim the library lost, it is     /// the archive having nothing to say. Applying it anyway un-designates     /// whatever the reader marked after the export — and it would pass the-    /// tuple gate every time, because a freshly marked `.articles` row carries-    /// no patterns and no URL rules, which makes `(.untaught, [], [])`-    /// trivially legal.+    /// tuple gate every time, because `(.untaught, [], [])` is trivially legal.     ///-    /// The old spelling filled an empty display name and a nil junk-suffix rule-    /// and never touched the mode at all, which meant three things: an-    /// `.articles` or `.taught` designation could not be restored (the union-    /// derives only `.taught` from the rules and reads the rest off this column);-    /// the display name could never be restored either, because `Site.init`-    /// defaults it to the hostname and nothing else ever writes it; and the junk-    /// rule could land on a row whose mode said `.taught` or `.untaught`, which-    /// is a shape no teaching path writes and which `TodayPresentation`-    /// quarantines out of the recent list.-    ///-    /// Mode and junk-suffix rule therefore move **together**, and the junk rule-    /// is forced nil off `.articles` — **this pass's own rule**, not something-    /// the tuple gate enforces. `LibraryValidator` never reads-    /// `Site.junkSuffixRule` at all; the "junk rule only in `.articles`" clause-    /// lives in `LibraryRepository.validatedRecentSiteMode`. The two fields are-    /// one fact stated twice, and writing half of it is what manufactured the-    /// illegal state.+    /// The old spelling filled an empty display name and never touched the mode+    /// at all, which meant two things: a `.taught` designation could not be+    /// restored (the union derives only `.taught` from the rules and reads the+    /// rest off this column), and the display name could never be restored+    /// either, because `Site.init` defaults it to the hostname and nothing else+    /// ever writes it.     ///     /// Every write is guarded by a comparison, so re-importing the same archive     /// dirties nothing — the same property `SiteReconciler.applyUnion` keeps.     internal static func applyDesignation(-        _ record: BackupV14Site,+        _ record: BackupV15Site,         to site: Site,         patterns: [TitlePattern],         urlRules: [URLRulePattern]@@ -528,8 +515,6 @@ extension LibraryRepository {             site.displayName = record.displayName         }         if site.mode != record.mode { site.mode = record.mode }-        let junk = record.mode == .articles ? record.junkSuffixRule : nil-        if site.junkSuffixRule != junk { site.junkSuffixRule = junk }     }      // MARK: - Work commit@@ -548,7 +533,7 @@ extension LibraryRepository {     /// Work's site presence either, and a group skipped as torn must not be     /// half-updated through its memberships.     private static func commitWorks(-        _ records: [BackupV14Work],+        _ records: [BackupV15Work],         into workRows: inout [UUID: [Work]],         types: WorkTypeDirectory,         context: ModelContext,@@ -643,7 +628,7 @@ extension LibraryRepository {     /// Inserting stays unconditional: a row the library does not hold cannot be     /// regressed, and the upsert's posture is to add (Req 4.1).     private static func commitMemberships(-        _ records: [BackupV14Membership],+        _ records: [BackupV15Membership],         workRows: [UUID: [Work]],         workTargets: [UUID: Work],         appliedWorkIDs: Set<UUID>,@@ -750,10 +735,10 @@ extension LibraryRepository {     /// [1.7]: ../../../../specs/wrong-host-work-url-heal/requirements.md#17     /// [1.8]: ../../../../specs/wrong-host-work-url-heal/requirements.md#18     internal static func normalizedMemberships(-        _ records: [BackupV14Membership],+        _ records: [BackupV15Membership],         existingMembershipIDs: Set<UUID>,         appliedWorkIDs: Set<UUID>-    ) -> [BackupV14Membership] {+    ) -> [BackupV15Membership] {         var indicesByWork: [UUID: [Int]] = [:]         for (index, record) in records.enumerated() {             guard let workID = record.workID else { continue }@@ -816,7 +801,7 @@ extension LibraryRepository {     /// library — the insert branch, which is unconditional, or the update     /// branch, which is gated on the Work's record having been applied.     private static func willWriteMembership(-        _ record: BackupV14Membership,+        _ record: BackupV15Membership,         existingMembershipIDs: Set<UUID>,         appliedWorkIDs: Set<UUID>     ) -> Bool {@@ -840,7 +825,7 @@ extension LibraryRepository {     /// re-importing the same archive must write the same values back, which is     /// what makes a repeated import change nothing (Req 13.3).     private static func commitSeries(-        _ records: [BackupV14Series],+        _ records: [BackupV15Series],         context: ModelContext,         batchSize: Int,         saveStrategy: any RepositorySaveStrategy@@ -877,7 +862,7 @@ extension LibraryRepository {     /// is inserted as it stands: an unresolved link is the tolerated state of     /// Req 11.2, and the reader's to remove.     private static func commitLinks(-        _ records: [BackupV14Link],+        _ records: [BackupV15Link],         context: ModelContext,         batchSize: Int,         saveStrategy: any RepositorySaveStrategy@@ -924,7 +909,7 @@ extension LibraryRepository {     /// A credit naming a work, creator or role this library does not hold is     /// inserted as it stands (Req 9.5, 10.2), exactly as an unresolved link is.     private static func commitCredits(-        _ records: [BackupV14Credit],+        _ records: [BackupV15Credit],         context: ModelContext,         batchSize: Int,         saveStrategy: any RepositorySaveStrategy@@ -967,7 +952,7 @@ extension LibraryRepository {     /// reconciler's latest-wins rule reads — so an older archive cannot undo a     /// newer dismissal, and re-importing the same archive writes nothing.     private static func commitDistinctPairs(-        _ records: [BackupV14DistinctPair],+        _ records: [BackupV15DistinctPair],         context: ModelContext,         batchSize: Int,         saveStrategy: any RepositorySaveStrategy@@ -999,7 +984,7 @@ extension LibraryRepository {     /// the materializers so an inserted record and an updated one cannot drift     /// apart. Identity, hostname, and `createdAt` are set at construction.     internal static func apply(-        _ record: BackupV14Work, to work: Work, thumbnail: ArchiveThumbnail+        _ record: BackupV15Work, to work: Work, thumbnail: ArchiveThumbnail     ) {         work.displayTitle = record.displayTitle         work.lastParsedTitle = record.lastParsedTitle@@ -1082,7 +1067,7 @@ extension LibraryRepository {     /// The mutable half of an archive membership record. Identity, hostname and     /// `createdAt` are set at construction, so what an update moves is the     /// site-specific content: the URL identity triple and the confirmed Work URL.-    internal static func apply(_ record: BackupV14Membership, to membership: WorkSiteMembership) {+    internal static func apply(_ record: BackupV15Membership, to membership: WorkSiteMembership) {         membership.hostname = record.hostname         membership.createdAt = record.createdAt         membership.urlIdentity = record.urlIdentity@@ -1092,7 +1077,7 @@ extension LibraryRepository {         membership.workID = record.workID ?? membership.workID     } -    internal static func apply(_ record: BackupV14Entry, to entry: Entry) {+    internal static func apply(_ record: BackupV15Entry, to entry: Entry) {         entry.captureTitle = record.captureTitle         entry.captureTitleSourceRaw = record.captureTitleSource.rawValue         entry.rawURLString = record.rawURL
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Contracts.swift Modified +1 / -15
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Contracts.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Contracts.swiftindex a441c508..8c484146 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Contracts.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Contracts.swift@@ -47,20 +47,6 @@ extension LibraryRepository {          let siteMode = try Self.requireKnownSiteMode(of: site, hostname: hostname) -        // Articles mode is not valid at this gate/path-        guard siteMode != .articles else {-            throw LibraryRepositoryError.invalidInput(-                operation: "building teaching basis",-                reason: "Site '\(hostname)' is in articles mode; teaching is unavailable"-            )-        }-        guard site.junkSuffixRule == nil else {-            throw LibraryRepositoryError.corruptLibrary(-                operation: "building teaching basis",-                reason: "non-articles Site '\(hostname)' retains a junk suffix rule"-            )-        }-         let patterns = try site.patternValues.compactMap { p -> PatternBasisEntry? in             let def: PatternDefinition             do { def = try p.definition }@@ -184,7 +170,7 @@ extension LibraryRepository {             guard basis.siteMode == .untaught else {                 throw LibraryRepositoryError.invalidInput(                     operation: "initial teaching",-                    reason: "Site is already taught or in articles mode"+                    reason: "Site is already taught"                 )             } 
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+EmptyLibrary.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+EmptyLibrary.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+EmptyLibrary.swiftindex 4439be19..26ed46a0 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+EmptyLibrary.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+EmptyLibrary.swift@@ -95,7 +95,7 @@ public struct InterruptedEmptyReport: Codable, Sendable, Equatable { /// capture nothing but the model type they were built for. internal struct EmptyLibraryEntity: Sendable {     /// The entity name, which is what the contract test compares with-    /// `AsterismSchemaV15.models` and what the log line carries.+    /// `AsterismSchemaV16.models` and what the log line carries.     let name: String     /// Deletes up to one chunk and saves it, returning how many rows went —     /// rows the chunk's `prepare` hook took with them included. Zero means the@@ -133,7 +133,7 @@ extension LibraryRepository {      /// The deletion order, and the **single place the entity set is written**     /// (design, Deletion phases). `ModelContractTests` compares its names with-    /// `AsterismSchemaV15.models`, so a schema that gains an entity this pass+    /// `AsterismSchemaV16.models`, so a schema that gains an entity this pass     /// does not delete fails the build rather than leaving rows behind.     ///     /// Children before parents. The order buys two things beyond Req 3.3: every
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+EntryDetail.swift Modified +11 / -16
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+EntryDetail.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+EntryDetail.swiftindex 5aef70ad..921f3c1e 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+EntryDetail.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+EntryDetail.swift@@ -252,13 +252,12 @@ extension LibraryRepository {             }              // With no Site row, or a Site row whose tuple is illegal (Q39), there-            // is no trustworthy cleaning or trimming to apply, so the immutable-            // capture title is the presentation title.+            // is no trustworthy trimming to apply, so the immutable capture+            // title is the presentation title.             let displayTitle: String-            if let legalSite, let mode = siteMode {+            if legalSite != nil, let mode = siteMode {                 displayTitle = Self.presentationTitle(-                    for: entrySnap.captureTitle, siteMode: mode, site: legalSite,-                    activePattern: pickedPattern)+                    for: entrySnap.captureTitle, siteMode: mode, activePattern: pickedPattern)             } else {                 displayTitle = entrySnap.captureTitle             }@@ -313,21 +312,19 @@ extension LibraryRepository {         }     } -    /// The presentation title for an entry: articles clean junk suffixes,-    /// Work-only Sites trim the retained affixes. The immutable capture title-    /// stays visible as evidence in provenance disclosure.-    /// `activePattern` is the caller's already-resolved Decision 1 pick for-    /// `site`, passed in rather than re-picked here so a screen cannot trim by+    /// The presentation title for an entry: a Work-only Site trims the retained+    /// affixes, every other Site shows the capture title as it stands. The+    /// immutable capture title stays visible as evidence in provenance+    /// disclosure.+    /// `activePattern` is the caller's already-resolved Decision 1 pick for the+    /// Site, passed in rather than re-picked here so a screen cannot trim by     /// one rule while it discloses another.     internal static func presentationTitle(         for captureTitle: String,         siteMode: SiteMode,-        site: Site,         activePattern: TitlePattern?     ) -> String {         switch siteMode {-        case .articles:-            return ArticleTitleCleaner.clean(captureTitle, using: site.junkSuffixRule)         case .taught:             // The whole-title rule's Work name is the trimmed capture title.             guard let stored = activePattern.flatMap({ try? $0.storedDefinition }),@@ -335,7 +332,7 @@ extension LibraryRepository {             else { return captureTitle }             return TitleTrimApplicator.apply(                 prefix: stored.trimPrefix, suffix: stored.trimSuffix, to: captureTitle)-        default:+        case .untaught:             return captureTitle         }     }@@ -388,8 +385,6 @@ extension LibraryRepository {             // Whole-title (Work-only) Sites are re-taught through the composed             // surface; they expose no inline re-teach/re-parse title actions.             return isWorkOnly ? [] : [.reTeach, .reParse]-        case .articles:-            return []         }     } }
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Export.swift Modified +3 / -3
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Export.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Export.swiftindex b582172c..24641610 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Export.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Export.swift@@ -188,7 +188,7 @@ extension LibraryRepository {             if let group {                 // The group's carrier content, so a split work presents the same                 // title in the export as on its own screen (Req 1.9).-                // An **empty** series directory, for `mapV14WorkRecord`'s+                // An **empty** series directory, for `mapV15WorkRecord`'s                 // reason: the two fields read off this snapshot are the title                 // and the type label, and the directory only ever fills                 // `series` — the membership label, which an entry block does not@@ -229,13 +229,13 @@ extension LibraryRepository {         context: ModelContext     ) throws -> String {         // With no Site row — or a mode this app does not define — there is no-        // cleaning to apply, and the immutable capture title is the+        // trimming to apply, and the immutable capture title is the         // presentation title. Export never refuses over either.         guard let site = try sites.site(for: hostname, context: context),             let mode = SiteMode(rawValue: site.modeRaw)         else { return captureTitle }         return presentationTitle(-            for: captureTitle, siteMode: mode, site: site, activePattern: site.activePattern)+            for: captureTitle, siteMode: mode, activePattern: site.activePattern)     }      private static func siteDisplayName(
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+OutcomeComputation.swift Modified +2 / -12
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+OutcomeComputation.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+OutcomeComputation.swiftindex b2131712..17b46bc3 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+OutcomeComputation.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+OutcomeComputation.swift@@ -90,23 +90,13 @@ extension LibraryRepository {     static func computeCaptureOutcome(basis: CaptureBasis, request: CaptureRequest) -> CaptureOutcome {         let rawURL = request.rawURLString -        if basis.siteMode == .articles {-            return CaptureOutcome(-                projectedChapter: nil, projectedWorkTitle: nil,-                workOutcome: nil, projectedWorkID: nil,-                actionable: false, intentionallyUnattached: true,-                displayTitle: ArticleTitleCleaner.clean(request.captureTitle, using: basis.junkSuffixRule),-                composedIdentityKey: rawURL, composedIdentityKeyVersion: 1,-                composedChapterSequence: nil, composedAssignment: nil)-        }-         guard basis.siteMode == .taught, let titleRuleBasis = basis.currentTitleRule else {             // Untaught, quarantined, or a taught Site with no active title rule             // (transitional M3 Work-only): conservative capture, no rule application.             return CaptureOutcome(                 projectedChapter: nil, projectedWorkTitle: nil,                 workOutcome: nil, projectedWorkID: nil,-                actionable: true, intentionallyUnattached: false,+                actionable: true,                 composedIdentityKey: rawURL, composedIdentityKeyVersion: 1,                 composedChapterSequence: nil, composedAssignment: nil)         }@@ -141,7 +131,7 @@ extension LibraryRepository {             projectedChapter: derivation.chapterTitle,             projectedWorkTitle: derivation.workName,             workOutcome: workOutcome, projectedWorkID: projectedWorkID,-            actionable: actionable, intentionallyUnattached: false,+            actionable: actionable,             composedIdentityKey: derivation.identity.key,             composedIdentityKeyVersion: derivation.identity.version,             composedChapterSequence: derivation.chapterSequence?.value,
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ReparseCapture.swift Modified +5 / -38
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ReparseCapture.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ReparseCapture.swiftindex 9d03bf04..dca703b0 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ReparseCapture.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+ReparseCapture.swift@@ -354,10 +354,8 @@ extension LibraryRepository {             // transaction inserted for a hostname that had none.             entry.site = site             let quarantined = self.quarantineReason(hostname: validated.hostname) != nil-            if site.mode == .articles {-                entry.intentionallyUnattached = true-            } else if site.mode == .taught, !quarantined,-                      let activePattern = site.activePattern {+            if site.mode == .taught, !quarantined,+               let activePattern = site.activePattern {                 // A current rule whose stored bytes will not decode is skipped,                 // not propagated: the Entry then derives from the title rule                 // alone and keeps the conservative identity key, which is@@ -403,7 +401,7 @@ extension LibraryRepository {             // wrote came from, extraction replay included.             do {                 try LibraryValidator.validateEntryTuple(-                    entry: entry, site: site, works: entry.work.map { [$0] } ?? [])+                    entry: entry, works: entry.work.map { [$0] } ?? [])             } catch {                 context.rollback()                 return .invalidated(reason: "capture produced an invalid Entry tuple: \(error)")@@ -516,42 +514,12 @@ extension LibraryRepository {                     Self.workBasisEntry(from: work, hostnames: onHostname.hostnames(of: work))                 }.sorted { $0.id.uuidString < $1.id.uuidString }             return CaptureBasis(-                siteMode: .untaught, hostname: hostname, activePattern: nil,-                junkSuffixRule: nil, works: worksBasis)+                siteMode: .untaught, hostname: hostname, activePattern: nil, works: worksBasis)         }          let siteMode: SiteMode         if let site {-            let mode = try Self.requireKnownSiteMode(of: site, hostname: hostname)-            if mode == .articles {-                guard capabilities.supportsArticles else {-                    throw LibraryRepositoryError.invalidInput(-                        operation: "building capture basis",-                        reason: "articles mode is unavailable at gate \(capabilities.gate.rawValue)"-                    )-                }-                guard site.patternValues.allSatisfy({ !$0.isActive }) else {-                    throw LibraryRepositoryError.corruptLibrary(-                        operation: "building capture basis",-                        reason: "articles Site '\(hostname)' retains an active pattern"-                    )-                }-                if let rule = site.junkSuffixRule {-                    do { try ArticleTitleCleaner.validate(rule) }-                    catch {-                        throw LibraryRepositoryError.corruptLibrary(-                            operation: "building capture basis",-                            reason: "articles Site '\(hostname)' has invalid junk suffix rule: \(error)"-                        )-                    }-                }-            } else if site.junkSuffixRule != nil {-                throw LibraryRepositoryError.corruptLibrary(-                    operation: "building capture basis",-                    reason: "non-articles Site '\(hostname)' retains a junk suffix rule"-                )-            }-            siteMode = mode+            siteMode = try Self.requireKnownSiteMode(of: site, hostname: hostname)         } else {             siteMode = .untaught         }@@ -645,7 +613,6 @@ extension LibraryRepository {         return CaptureBasis(             siteMode: siteMode, hostname: hostname,             activePattern: activePatternBasis,-            junkSuffixRule: site?.junkSuffixRule,             works: worksBasis,             currentTitleRule: currentTitleRule,             currentURLRule: currentURLRule,
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+RuleSuggestion.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+RuleSuggestion.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+RuleSuggestion.swiftindex 16c01313..ace3f1e4 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+RuleSuggestion.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+RuleSuggestion.swift@@ -5,8 +5,8 @@ import SwiftData // // One row per hostname carrying exactly what the suggestion coordinator needs // and nothing that would make it expensive: the sweep picks auto-eligible-// hostnames from it (not in articles mode, at least one capture, a rule-// missing on one side) and orders them by most recent capture, and+// hostnames from it (at least one capture, a rule missing on one side) and+// orders them by most recent capture, and // `reconcile` compares the same fields to the fingerprint it recorded when an // attempt started. Neither `sites()` nor `TodayPresentation` can serve: the // first carries no URL-rule presence or capture recency, the second is capped
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Sites.swift Modified +0 / -1
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Sites.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Sites.swiftindex bcadbe2f..29e57b0d 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Sites.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+Sites.swift@@ -77,7 +77,6 @@ extension LibraryRepository {             mode: mode,             // Oldest rule first.             patternIDs: site.patternValues.sorted(by: RuleSelection.precedes).map(\.id),-            junkSuffixRule: site.junkSuffixRule,             workCount: workCount)     } 
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+TodayPresentation.swift Modified +8 / -19
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+TodayPresentation.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+TodayPresentation.swiftindex 18d610b1..6827fb69 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+TodayPresentation.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository+TodayPresentation.swift@@ -154,7 +154,7 @@ extension LibraryRepository {                 // to the winner `fetchSites` already resolves the mode from, so                 // the pill leads somewhere and the row counts toward the banner                 // it belongs in.-                let actionable = mode.map { Self.isRecentEntryActionable(entry, siteMode: $0) } ?? false+                let actionable = mode != nil && Self.isRecentEntryActionable(entry)                 var actionType: RecentRowActionType                 let displayCaptureTitle: String                 let replay: CitationReplay@@ -171,7 +171,6 @@ extension LibraryRepository {                     displayCaptureTitle = Self.presentationTitle(                         for: entry.captureTitle,                         siteMode: mode,-                        site: site,                         activePattern: picked                     )                     replay = Self.replayCitedPattern(for: entry, citingSite: { group.carrier.site })@@ -388,27 +387,17 @@ extension LibraryRepository {          let activeCount = patterns.count(where: \.isActive)         switch mode {-        case .untaught where !patterns.isEmpty || site.junkSuffixRule != nil:-            return nil-        case .taught where patterns.isEmpty || activeCount != 1 || site.junkSuffixRule != nil:+        case .untaught:+            return patterns.isEmpty ? mode : nil+        case .taught:             // A taught Site always retains exactly one active title pattern-            // (Decision 5) — whole-title, chapter-less, or ordinary — and no junk.-            return nil-        case .articles where activeCount != 0:-            return nil-        case .articles:-            if let rule = site.junkSuffixRule {-                guard (try? ArticleTitleCleaner.validate(rule)) != nil else { return nil }-            }-            return mode-        default:-            return mode+            // (Decision 5) — whole-title, chapter-less, or ordinary.+            return activeCount == 1 ? mode : nil         }     } -    private static func isRecentEntryActionable(_ entry: EntrySnapshot, siteMode: SiteMode) -> Bool {-        guard siteMode != .articles else { return false }-        return ActionabilityEvaluator.isActionable(+    private static func isRecentEntryActionable(_ entry: EntrySnapshot) -> Bool {+        ActionabilityEvaluator.isActionable(             chapterTitle: entry.chapterTitle,             chapterSequence: entry.chapterSequence,             chapterProvenance: entry.chapterTitleProvenance,
Packages/AsterismCore/Sources/AsterismCore/LibraryRepository.swift Modified +1 / -1
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository.swiftindex d4400a81..b475735c 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryRepository.swift@@ -1686,7 +1686,7 @@ public actor LibraryRepository {     // The four `map*Record` mappers stood here — `Entry`/`Work`/`Site`/     // `TitlePattern` to the V2 `*Record` structs, for the snapshot     // `validateStore` validated. They went with it; the live export path has its-    // own `map*Record` family in `BackupArchiveProjection`, over `BackupV14Entry`+    // own `map*Record` family in `BackupArchiveProjection`, over `BackupV15Entry`     // and friends, and never used these.      internal func withLockedContext<Value: Sendable>(
Packages/AsterismCore/Sources/AsterismCore/LibraryValidator.swift Modified +33 / -28
diff --git a/Packages/AsterismCore/Sources/AsterismCore/LibraryValidator.swift b/Packages/AsterismCore/Sources/AsterismCore/LibraryValidator.swiftindex 0cbc80dd..d63b4c9b 100644--- a/Packages/AsterismCore/Sources/AsterismCore/LibraryValidator.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/LibraryValidator.swift@@ -232,7 +232,10 @@ public enum LibraryValidator {         for hostname in Set(hostnames).sorted() {             let rows = try context.fetch(                 FetchDescriptor<Site>(predicate: #Predicate { $0.hostname == hostname }))-            guard let winner = SiteResolutionOrder.sorted(rows).first else { continue }+            // The winner itself has no reader left — an Entry's tuple is+            // replayed against `entry.site` — but a hostname with no Site row+            // at all still has nothing to validate against, so the guard stays.+            guard !rows.isEmpty else { continue }             let entries = try context.fetch(                 FetchDescriptor<Entry>(predicate: #Predicate { $0.hostname == hostname }))             // V8: a Work is on this hostname because it holds a membership for@@ -291,7 +294,7 @@ public enum LibraryValidator {             for entry in winners(of: entries, in: entryIndex, id: { $0.id.uuidString }) {                 do {                     try validate(-                        entry: entry, site: winner, works: workIndex,+                        entry: entry, works: workIndex,                         tolerateUnlinkedCitations: true)                 } catch let error as LibraryValidationError { record(hostname, error) }             }@@ -426,7 +429,11 @@ public enum LibraryValidator {         // unvalidated; collapsing them is phase 3's work, and validating them         // against a graph that indexes only winners would manufacture spurious         // tuple diagnoses out of a state Q12 says must not quarantine.-        var sites: [String: Site] = [:]+        //+        // Since `remove-article-mode` dropped the validator's last read of the+        // winning row, only the hostname's presence is asked of this index, so+        // it holds hostnames and sorts nothing.+        var siteHostnames: Set<String> = []         for group in siteRows {             // T-2295: diagnosed only while a losing row still owns a rule —             // one spelling, shared with the foreground scan.@@ -434,7 +441,7 @@ public enum LibraryValidator {                 tolerated.append(                     .duplicateSiteRows(hostname: group.key, rowCount: group.rows.count))             }-            sites[group.key] = SiteResolutionOrder.sorted(group.rows).first+            siteHostnames.insert(group.key)         }         // Membership is tested against the whole group, so a duplicate         // application UUID does not also register as a broken Work/Entry inverse.@@ -539,7 +546,7 @@ public enum LibraryValidator {                 tolerated.append(.workWithoutMembership(workID: work.id.uuidString))                 continue             }-            for hostname in hostnames.sorted() where sites[hostname] == nil {+            for hostname in hostnames.sorted() where !siteHostnames.contains(hostname) {                 guard strictness == .tolerant else {                     throw unresolved("Work", work.id.uuidString, "Site \(hostname)")                 }@@ -548,7 +555,7 @@ public enum LibraryValidator {             // As before: a Work none of whose hostnames has a Site row has its             // tuple left unvalidated, the same reduction in coverage the Entry             // arm documents below.-            let known = hostnames.filter { sites[$0] != nil }+            let known = hostnames.filter { siteHostnames.contains($0) }             guard !known.isEmpty else { continue }             do {                 try validate(work: work, entries: entries)@@ -558,12 +565,12 @@ public enum LibraryValidator {         }         for group in entryRows {             guard let entry = entries[group.key]?.first else { continue }-            guard let site = sites[entry.hostname] else {+            guard siteHostnames.contains(entry.hostname) else {                 guard strictness == .tolerant else {                     throw unresolved("Entry", entry.id.uuidString, "Site \(entry.hostname)")                 }                 // **A reduction in coverage, accepted deliberately.**-                // `validate(entry:site:…)` replays the Entry's tuple against its+                // `validate(entry:works:…)` replays the Entry's tuple against its                 // Site's rules, so with no Site row there is nothing to replay it                 // against: validating the tuple against no rules has no meaning.                 // The Entry is therefore recorded as `.siteMissing` and its tuple@@ -576,7 +583,7 @@ public enum LibraryValidator {             }             do {                 try validate(-                    entry: entry, site: site, works: works,+                    entry: entry, works: works,                     tolerateUnlinkedCitations: strictness == .tolerant)             } catch let error as LibraryValidationError {                 record(entry.hostname, error)@@ -600,10 +607,12 @@ public enum LibraryValidator {     ///     /// Every cited pattern and rule — the extraction replay included — resolves     /// among what `entry.site` owns (Req 3.2), so there is no cited search space-    /// to pass. `site` is what the tuple's mode and ownership are read against —-    /// the same row the write site assigned (Req 1.4).+    /// to pass and no Site row to pass either: the caller's row and the Entry's+    /// relationship are the same row by Req 1.4, and it is the relationship that+    /// is read. The Site the write site assigned went with the last arm that+    /// read it (`remove-article-mode`).     public static func validateEntryTuple(-        entry: Entry, site: Site, works: [Work]+        entry: Entry, works: [Work]     ) throws {         var worksByID: [String: [Work]] = [:]         for work in works { worksByID[work.id.uuidString, default: []].append(work) }@@ -614,7 +623,7 @@ public enum LibraryValidator {         // (Req 1.4), so an unlinked citation here is a bug in the writer, not a         // state to survive.         try validate(-            entry: entry, site: site, works: worksByID,+            entry: entry, works: worksByID,             tolerateUnlinkedCitations: false)     } @@ -862,15 +871,13 @@ public enum LibraryValidator {             return patterns.isEmpty                 && urlRules.allSatisfy { $0.origin == .importedV2 && !$0.isCurrent }         case .taught:-            // Decision 5: a taught non-articles Site always holds exactly one-            // active title rule. Any (WC/W) title form combined with any URL field-            // set (none/I/IS/S) is legal, including the acknowledged-unsettled+            // Decision 5: a taught Site always holds exactly one active title+            // rule. Any (WC/W) title form combined with any URL field set+            // (none/I/IS/S) is legal, including the acknowledged-unsettled             // W + I/none combination (Req 2.1); at most one current URL rule is             // enforced by `validate(site:)`, which is a per-row storage claim and             // not part of this tuple table.             return activePatternCount == 1-        case .articles:-            return activePatternCount == 0 && urlRules.allSatisfy { !$0.isCurrent }         }     } @@ -880,7 +887,6 @@ public enum LibraryValidator {         switch mode {         case .untaught: "untaught tuple may retain only imported V2 URL history"         case .taught: "taught tuple requires exactly one active title rule"-        case .articles: "articles tuple cannot have active title or URL rules"         }     } @@ -983,7 +989,6 @@ public enum LibraryValidator {      private static func validate(         entry: Entry,-        site: Site,         works: [String: [Work]],         tolerateUnlinkedCitations: Bool     ) throws {@@ -1081,9 +1086,8 @@ public enum LibraryValidator {             throw invalid("Entry", id, "identity basis and cited identity arm disagree")         } -        try validateChapter(entry, id: id, provenance: citations.chapterTitle, site: site, citation)-        try validateAssignment(entry, id: id, citations: citations, site: site, work: entry.work,-            citation)+        try validateChapter(entry, id: id, provenance: citations.chapterTitle, citation)+        try validateAssignment(entry, id: id, citations: citations, work: entry.work, citation)     }      private static func validateV2(@@ -1250,7 +1254,6 @@ public enum LibraryValidator {         _ entry: Entry,         id: String,         provenance: FieldProvenance,-        site: Site,         _ citation: CitationContext     ) throws {         switch provenance.kind {@@ -1267,7 +1270,7 @@ public enum LibraryValidator {             // Cited id, resolved among the patterns this Entry's own Site owns             // (Req 3.2); an Entry with no Site relationship tolerates a pattern             // that does not resolve (Req 3.4, Q27).-            guard site.mode != .articles, let title = entry.chapterTitle, !M2Unicode.isBlank(title),+            guard let title = entry.chapterTitle, !M2Unicode.isBlank(title),                   let patternID = provenance.patternID,                   resolves(citedPattern: patternID, citation) else {                 throw invalid("Entry", id, "pattern chapter provenance does not resolve")@@ -1292,7 +1295,6 @@ public enum LibraryValidator {         _ entry: Entry,         id: String,         citations: EntryCitations,-        site: Site,         work: Work?,         _ citation: CitationContext     ) throws {@@ -1309,8 +1311,11 @@ public enum LibraryValidator {             // withdraw every write on the site — the manual re-assignment that             // is the only repair included. The row is counted by             // `entriesWithoutCitationBlobCount` instead.+            // `remove-article-mode` Q6: a `none` assignment is a capture nobody+            // has decided about, so it may not claim a deliberate unattachment.+            // Articles mode was the one exception and it is gone.             guard work == nil || entry.citationsAreAbsent, !hasURLReference,-                  entry.intentionallyUnattached == (site.mode == .articles) else {+                  !entry.intentionallyUnattached else {                 throw invalid("Entry", id, "none assignment has incompatible relationship or provenance")             }         case .manual:@@ -1319,7 +1324,7 @@ public enum LibraryValidator {                 throw invalid("Entry", id, "manual assignment has incompatible relationship or provenance")             }         case .pattern:-            guard site.mode != .articles, !entry.intentionallyUnattached, !hasURLReference else {+            guard !entry.intentionallyUnattached, !hasURLReference else {                 throw invalid("Entry", id, "pattern assignment has incompatible provenance")             }         case .urlRule(let cited):
Packages/AsterismCore/Sources/AsterismCore/MembershipReconciler.swift Modified +1 / -1
diff --git a/Packages/AsterismCore/Sources/AsterismCore/MembershipReconciler.swift b/Packages/AsterismCore/Sources/AsterismCore/MembershipReconciler.swiftindex 3d715832..362d0228 100644--- a/Packages/AsterismCore/Sources/AsterismCore/MembershipReconciler.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/MembershipReconciler.swift@@ -359,7 +359,7 @@ enum MembershipReconciler {     /// alone lands one ULP away from the same instant built through     /// `MillisecondInstant`, and the archive's date encoding quantizes on the way     /// out — so an unquantized `createdAt` decodes back as a *different* `Date`-    /// and `BackupV14Exporter`'s decode-validation refuses the file it just wrote.+    /// and `BackupV15Exporter`'s decode-validation refuses the file it just wrote.     /// A library holding a minted membership could not be backed up at all     /// ([4.2](../../../../specs/wrong-host-work-url-heal/requirements.md#42)).     /// The value stays a pure function of stored content, so two devices healing
Packages/AsterismCore/Sources/AsterismCore/Models.swift Modified +28 / -24
diff --git a/Packages/AsterismCore/Sources/AsterismCore/Models.swift b/Packages/AsterismCore/Sources/AsterismCore/Models.swiftindex c6235e66..adccab6e 100644--- a/Packages/AsterismCore/Sources/AsterismCore/Models.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/Models.swift@@ -1,66 +1,66 @@ import Foundation import SwiftData -// The live model classes are V15's, nested inside `AsterismSchemaV15`+// The live model classes are V16's, nested inside `AsterismSchemaV16` // (Decision 6, Q20). Top-level typealiases keep every call site (`Entry`, // `Site`, …) unchanged. //-// The nesting is what makes the frozen `AsterismSchemaV14` snapshot possible+// The nesting is what makes the frozen `AsterismSchemaV15` snapshot possible // beside the live one: both carry nested classes with the same SwiftData entity // names, which is legal only while there is exactly one // *top-level* `@Model` per entity name — and there are none, because every // top-level name here is a typealias. Two top-level `@Model`s sharing an entity // name crash `ModelContext` (`docs/agent-notes/schema-migration.md`).-public typealias Entry = AsterismSchemaV15.Entry-public typealias Work = AsterismSchemaV15.Work-public typealias Site = AsterismSchemaV15.Site-public typealias TitlePattern = AsterismSchemaV15.TitlePattern-public typealias URLRulePattern = AsterismSchemaV15.URLRulePattern-public typealias WorkTypeEntity = AsterismSchemaV15.WorkTypeEntity+public typealias Entry = AsterismSchemaV16.Entry+public typealias Work = AsterismSchemaV16.Work+public typealias Site = AsterismSchemaV16.Site+public typealias TitlePattern = AsterismSchemaV16.TitlePattern+public typealias URLRulePattern = AsterismSchemaV16.URLRulePattern+public typealias WorkTypeEntity = AsterismSchemaV16.WorkTypeEntity /// V8: a Work's presence on one site (Q3). One row per hostname, carrying that /// site's URL identity, the rule that derived it and the confirmed Work URL — /// and since V9 the only home any of them has.-public typealias WorkSiteMembership = AsterismSchemaV15.WorkSiteMembership+public typealias WorkSiteMembership = AsterismSchemaV16.WorkSiteMembership /// V8: a reader's "not the same work" over an unordered pair of Works (Q20).-public typealias WorkDistinctPair = AsterismSchemaV15.WorkDistinctPair+public typealias WorkDistinctPair = AsterismSchemaV16.WorkDistinctPair /// V11: a reader-named, ordered collection a Work belongs to at most once /// (`series-and-related-works` Decision 1).-public typealias Series = AsterismSchemaV15.Series+public typealias Series = AsterismSchemaV16.Series /// V11: an undirected, typed connection between two distinct Works /// (`series-and-related-works` Decision 5).-public typealias WorkLink = AsterismSchemaV15.WorkLink+public typealias WorkLink = AsterismSchemaV16.WorkLink /// V12: a person a work is credited to, a reader-managed directory record /// (`work-creators` Decision 2).-public typealias Creator = AsterismSchemaV15.Creator+public typealias Creator = AsterismSchemaV16.Creator /// V12: one entry in the ordered role list credits reference by identity /// (`work-creators` Decision 1).-public typealias CreatorRole = AsterismSchemaV15.CreatorRole+public typealias CreatorRole = AsterismSchemaV16.CreatorRole /// V12: one work-and-creator pairing, carrying the roles that creator holds on /// that work (`work-creators` Decision 6).-public typealias WorkCredit = AsterismSchemaV15.WorkCredit+public typealias WorkCredit = AsterismSchemaV16.WorkCredit // `Character` is deliberately **not** aliased at the top level: the stdlib owns // that name, and shadowing it module-wide would silently retype every // `[Character]` in `MarkdownExport` and `HTMLEntityDecoder` — and every one a // future file writes. The SwiftData entity is still named "Character" (that is // the nested class's name, and what the CloudKit record type and the archive // key on); only the Swift spelling call sites use is qualified.-public typealias CharacterRecord = AsterismSchemaV15.Character-public typealias CharacterSuppression = AsterismSchemaV15.CharacterSuppression+public typealias CharacterRecord = AsterismSchemaV16.Character+public typealias CharacterSuppression = AsterismSchemaV16.CharacterSuppression /// V13: one named location of one work, the second `RecordRow` table /// (`place-extraction` Decision 3). Unlike `Character` the name collides with /// nothing in the stdlib, so it is aliased at the top level under its own name.-public typealias Place = AsterismSchemaV15.Place+public typealias Place = AsterismSchemaV16.Place /// V13: a place's remembered decision not to re-propose, its own record type /// rather than a column on `CharacterSuppression` (`place-extraction` /// Decision 2).-public typealias PlaceSuppression = AsterismSchemaV15.PlaceSuppression+public typealias PlaceSuppression = AsterismSchemaV16.PlaceSuppression  /// The presentation-enum tolerance policy for the **model accessors**, in one /// place (Q2). /// /// Not the only coercion in the codebase, and not meant to be: the archive /// paths spell their own `?? .default` — `WorkTypeDirectory`,-/// `ArchiveRecordBuilders`, `BackupV14Types`, `BackupArchiveProjection` — each+/// `ArchiveRecordBuilders`, `BackupV15Types`, `BackupArchiveProjection` — each /// answering what *that* wire may say rather than what a stored column may /// hold. Those are deliberately separate policies, not omissions from this one. ///@@ -133,7 +133,7 @@ enum JSONBlob {     } } -extension AsterismSchemaV15 {+extension AsterismSchemaV16 {  @Model public final class Entry {@@ -694,7 +694,11 @@ public final class Site {     /// and the repository fetches memberships by predicate instead.     @Relationship(deleteRule: .nullify, inverse: \WorkSiteMembership.site)     var workMemberships: [WorkSiteMembership]?-    public var junkSuffixRule: JunkSuffixRule?+    // `junkSuffixRule` stood here: the reader-taught title cleaner articles mode+    // applied. It went with the mode at V16 (`remove-article-mode` Req 4.1). The+    // `JunkSuffixRule` type stays in `ValueObjects.swift`, unchanged and with no+    // consumer but the frozen `AsterismSchemaV15` snapshot, which is frozen by+    // reference to it (Q8).      public init(hostname: String, displayName: String? = nil) {         self.hostname = hostname@@ -707,7 +711,7 @@ public final class Site {     }      /// The Site's active title pattern (Decision 5: a taught Site always holds-    /// exactly one). Nil for untaught/articles Sites.+    /// exactly one). Nil for an untaught Site.     ///     /// One of the two accessors every reader of a current rule goes through     /// (T-2281 Req 4.2, Q11): `RuleSelection.current` carries the Decision 1@@ -1754,7 +1758,7 @@ public final class PlaceSuppression {     } } -} // extension AsterismSchemaV15+} // extension AsterismSchemaV16  /// A rule-derived URL identity a creation site already holds, passed through /// `Work.create` so the minted membership is born carrying it (Req 1.3, 3.1).
Packages/AsterismCore/Sources/AsterismCore/ProjectionContract.swift Modified +5 / -40
diff --git a/Packages/AsterismCore/Sources/AsterismCore/ProjectionContract.swift b/Packages/AsterismCore/Sources/AsterismCore/ProjectionContract.swiftindex 76cee22e..fdebc3bf 100644--- a/Packages/AsterismCore/Sources/AsterismCore/ProjectionContract.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/ProjectionContract.swift@@ -55,12 +55,6 @@ public enum CaptureCommitOutcome: Equatable, Sendable {     case raced(CaptureLookupDisposition) } -public enum ArticlesCommitOutcome: Equatable, Sendable {-    case committed-    case refreshed(ArticlesContract)-    case invalidated(reason: String)-}- // MARK: - Teaching contract types  public typealias TeachingContract = ProjectionContract<TeachingBasis, TeachingRequest, TeachingOutcome>@@ -198,26 +192,6 @@ public struct TeachingOutcome: Sendable, Equatable {     } } -// MARK: - Articles-mode contract types--public typealias ArticlesContract = ProjectionContract<TeachingBasis, ArticlesRequest, ArticlesOutcome>--public struct ArticlesRequest: Sendable, Equatable {-    public let junkSuffixRule: JunkSuffixRule?--    public init(junkSuffixRule: JunkSuffixRule?) {-        self.junkSuffixRule = junkSuffixRule-    }-}--public struct ArticlesOutcome: Sendable, Equatable {-    public let plan: ArticleProjectionPlan--    public init(plan: ArticleProjectionPlan) {-        self.plan = plan-    }-}- // MARK: - Re-parse contract types  public typealias ReparseContract = ProjectionContract<ReparseBasis, ReparseRequest, ReparseOutcome>@@ -267,7 +241,6 @@ public struct CaptureBasis: Sendable, Equatable {     public let siteMode: SiteMode     public let hostname: String     public let activePattern: PatternBasisEntry?-    public let junkSuffixRule: JunkSuffixRule?     public let works: [WorkBasisEntry]     /// The Site's active title rule (with trims) for composed capture-time rule     /// application (Req 6.1). Nil when the Site has no active title rule.@@ -279,14 +252,13 @@ public struct CaptureBasis: Sendable, Equatable {     public let composedWorks: [ComposedWorkBasis]      public init(siteMode: SiteMode, hostname: String, activePattern: PatternBasisEntry?,-                junkSuffixRule: JunkSuffixRule? = nil, works: [WorkBasisEntry],+                works: [WorkBasisEntry],                 currentTitleRule: ComposedTitleRuleBasis? = nil,                 currentURLRule: ComposedURLRuleBasis? = nil,                 composedWorks: [ComposedWorkBasis] = []) {         self.siteMode = siteMode         self.hostname = hostname         self.activePattern = activePattern-        self.junkSuffixRule = junkSuffixRule         self.works = works         self.currentTitleRule = currentTitleRule         self.currentURLRule = currentURLRule@@ -344,12 +316,8 @@ public struct CaptureOutcome: Sendable, Equatable {     public let workOutcome: WorkMatchOutcome?     /// Projected Work ID (nil for create-pending/ambiguous).     public let projectedWorkID: UUID?-    /// Presentation-only title after any articles suffix cleaning.-    public let displayTitle: String?     /// Whether the saved Entry will be actionable.     public let actionable: Bool-    /// Whether the Entry will be intentionally unattached.-    public let intentionallyUnattached: Bool     /// Composed capture-time rule application (Req 6.1). The identity key and its     /// version the Entry will carry (v1 conservative = raw URL). For non-composed     /// captures this is the conservative raw URL at version 1.@@ -360,16 +328,15 @@ public struct CaptureOutcome: Sendable, Equatable {     /// The composed Work assignment, or nil when the Site applies no title rule.     public let composedAssignment: ComposedAssignmentProjection? -    /// Whether the projection carries a title of its own — the projected chapter-    /// or the articles display title. A parse failure leaves both nil (Q1).+    /// Whether the projection carries a title of its own: the projected chapter.+    /// A parse failure leaves it nil (Q1).     public var hasParsedTitle: Bool {-        projectedChapter != nil || displayTitle != nil+        projectedChapter != nil     }      public init(projectedChapter: String?, projectedWorkTitle: String?,                 workOutcome: WorkMatchOutcome?, projectedWorkID: UUID?,-                actionable: Bool, intentionallyUnattached: Bool,-                displayTitle: String? = nil,+                actionable: Bool,                 composedIdentityKey: String = "", composedIdentityKeyVersion: Int = 1,                 composedChapterSequence: String? = nil,                 composedAssignment: ComposedAssignmentProjection? = nil) {@@ -377,9 +344,7 @@ public struct CaptureOutcome: Sendable, Equatable {         self.projectedWorkTitle = projectedWorkTitle         self.workOutcome = workOutcome         self.projectedWorkID = projectedWorkID-        self.displayTitle = displayTitle         self.actionable = actionable-        self.intentionallyUnattached = intentionallyUnattached         self.composedIdentityKey = composedIdentityKey         self.composedIdentityKeyVersion = composedIdentityKeyVersion         self.composedChapterSequence = composedChapterSequence
Packages/AsterismCore/Sources/AsterismCore/RecordRow.swift Modified +4 / -4
diff --git a/Packages/AsterismCore/Sources/AsterismCore/RecordRow.swift b/Packages/AsterismCore/Sources/AsterismCore/RecordRow.swiftindex e901e301..6e6f90d0 100644--- a/Packages/AsterismCore/Sources/AsterismCore/RecordRow.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/RecordRow.swift@@ -196,7 +196,7 @@ extension CharacterRecord: RecordRow {             timestamp: timestamp, work: work)     } -    public static func make(imported record: BackupV14Character) -> CharacterRecord {+    public static func make(imported record: BackupV15Character) -> CharacterRecord {         ArchiveRecordBuilders.makeCharacter(record)     } @@ -235,7 +235,7 @@ extension CharacterSuppression: SuppressionRow {             evidence: evidence, status: status, actionAt: actionAt)     } -    public static func make(imported record: BackupV14Suppression) -> CharacterSuppression {+    public static func make(imported record: BackupV15Suppression) -> CharacterSuppression {         ArchiveRecordBuilders.makeSuppression(record)     } @@ -291,7 +291,7 @@ extension Place: RecordRow {             timestamp: timestamp, workID: work?.id ?? UUID())     } -    public static func make(imported record: BackupV14Place) -> Place {+    public static func make(imported record: BackupV15Place) -> Place {         ArchiveRecordBuilders.makePlace(record)     } @@ -342,7 +342,7 @@ extension PlaceSuppression: SuppressionRow {             evidence: evidence, status: status, actionAt: actionAt)     } -    public static func make(imported record: BackupV14PlaceSuppression) -> PlaceSuppression {+    public static func make(imported record: BackupV15PlaceSuppression) -> PlaceSuppression {         ArchiveRecordBuilders.makePlaceSuppression(record)     } 
Packages/AsterismCore/Sources/AsterismCore/SiteReconciler.swift Modified +1 / -5
diff --git a/Packages/AsterismCore/Sources/AsterismCore/SiteReconciler.swift b/Packages/AsterismCore/Sources/AsterismCore/SiteReconciler.swiftindex 1c2b258f..7a2f19fd 100644--- a/Packages/AsterismCore/Sources/AsterismCore/SiteReconciler.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/SiteReconciler.swift@@ -177,15 +177,11 @@ enum SiteReconciler {             survivor.mode = projection.mode             changed = true         }-        if survivor.junkSuffixRule == nil, let junk = projection.junkSuffixRule {-            survivor.junkSuffixRule = junk-            changed = true-        }          // A stripped row holds no rules at all afterwards, and `.taught` with no         // active title rule is an illegal tuple. Leaving it would have the         // reconciler manufacture exactly the quarantine it exists to prevent.-        // `.articles` and `.untaught` are both legal empty, so they stay.+        // `.untaught` is legal empty, so it stays.         for row in projection.strippedRows where row.mode == .taught {             row.mode = .untaught             changed = true
Packages/AsterismCore/Sources/AsterismCore/SiteUnionProjection.swift Modified +0 / -3
diff --git a/Packages/AsterismCore/Sources/AsterismCore/SiteUnionProjection.swift b/Packages/AsterismCore/Sources/AsterismCore/SiteUnionProjection.swiftindex 6e0464cf..6a612f09 100644--- a/Packages/AsterismCore/Sources/AsterismCore/SiteUnionProjection.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/SiteUnionProjection.swift@@ -47,7 +47,6 @@ enum SiteUnionProjection {         let hostname: String         let displayName: String         let mode: SiteMode-        let junkSuffixRule: JunkSuffixRule?          /// The row teaching consolidates onto, or nil for a hostname that has no         /// row at all — a rowless hostname is a transient arrival state, and the@@ -261,7 +260,6 @@ enum SiteUnionProjection {             mode: mode(                 survivor: survivor, keptActive: keptActive, keptCurrent: keptCurrent,                 patterns: unionPatterns, rules: unionRules),-            junkSuffixRule: ordered.compactMap(\.junkSuffixRule).first,             survivor: survivor,             strippedRows: stripped,             patterns: projectedPatterns,@@ -299,7 +297,6 @@ enum SiteUnionProjection {     ) -> SiteMode {         if keptActive != nil { return .taught }         guard let survivor else { return .untaught }-        if survivor.mode == .articles { return .articles }         if patterns.isEmpty, keptCurrent == nil,            rules.allSatisfy({ $0.origin == .importedV2 && !$0.isCurrent }) {             return .untaught
Packages/AsterismCore/Sources/AsterismCore/Snapshots.swift Modified +0 / -6
diff --git a/Packages/AsterismCore/Sources/AsterismCore/Snapshots.swift b/Packages/AsterismCore/Sources/AsterismCore/Snapshots.swiftindex ceccd917..91c44997 100644--- a/Packages/AsterismCore/Sources/AsterismCore/Snapshots.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/Snapshots.swift@@ -281,10 +281,6 @@ public struct SiteSnapshot: Equatable, Sendable {     public let displayName: String     public let mode: SiteMode     public let patternIDs: [UUID]-    /// `urlIdentityRule` is **gone** (V8, task 8). The column it mirrored is one-    /// of the retained-but-unread set (Decision 3), permanently nil in every-    /// live store, and nothing on the Sites screen ever read the snapshot field.-    public let junkSuffixRule: JunkSuffixRule?     /// How many Works hold a membership for this hostname (Req 6.5, Q38).     ///     /// Distinct Works, not membership rows: a duplicate membership sync produced@@ -308,7 +304,6 @@ extension SiteSnapshot {         displayName: String,         mode: SiteMode,         patternIDs: [UUID] = [],-        junkSuffixRule: JunkSuffixRule? = nil,         workCount: Int = 0     ) -> SiteSnapshot {         SiteSnapshot(@@ -316,7 +311,6 @@ extension SiteSnapshot {             displayName: displayName,             mode: mode,             patternIDs: patternIDs,-            junkSuffixRule: junkSuffixRule,             workCount: workCount)     } }
Packages/AsterismCore/Sources/AsterismCore/Thumbnails/ThumbnailValues.swift Modified +1 / -1
diff --git a/Packages/AsterismCore/Sources/AsterismCore/Thumbnails/ThumbnailValues.swift b/Packages/AsterismCore/Sources/AsterismCore/Thumbnails/ThumbnailValues.swiftindex 986523bb..04b5d72b 100644--- a/Packages/AsterismCore/Sources/AsterismCore/Thumbnails/ThumbnailValues.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/Thumbnails/ThumbnailValues.swift@@ -16,7 +16,7 @@ nonisolated let thumbnailLog = Logger(subsystem: "AsterismCore", category: "Thum /// because of it. /// /// **The raw spellings are stored bytes and frozen at schema V14**-/// (`AsterismSchemaV15`'s header). They are what `Work.thumbnailShapeRaw`+/// (`AsterismSchemaV16`'s header). They are what `Work.thumbnailShapeRaw` /// holds in every installed library, so renaming a case is a schema bump. /// Reading is tolerant and writing is not, as for every enum column here: a set /// but unrecognised spelling reads as `.portrait`
Packages/AsterismCore/Sources/AsterismCore/TodayPresentation.swift Modified +2 / -1
diff --git a/Packages/AsterismCore/Sources/AsterismCore/TodayPresentation.swift b/Packages/AsterismCore/Sources/AsterismCore/TodayPresentation.swiftindex 3067144b..c47eb45f 100644--- a/Packages/AsterismCore/Sources/AsterismCore/TodayPresentation.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/TodayPresentation.swift@@ -270,7 +270,8 @@ internal enum CitationReplay: Equatable { public struct EntryTeachingDetail: Equatable, Sendable {     /// The entry snapshot used to build this detail (avoids duplicate reads).     public let entry: EntrySnapshot-    /// Presentation title; cleaned for articles mode while `entry.captureTitle` remains immutable evidence.+    /// Presentation title; trimmed by a Work-only Site's title rule while+    /// `entry.captureTitle` remains immutable evidence.     public let displayTitle: String     /// The assigned Work's presented display title, or nil where the Entry holds     /// no assignment — or holds one naming a Work with no rows behind it, the
Packages/AsterismCore/Sources/AsterismCore/WorkTypeSeeding.swift Modified +8 / -2
diff --git a/Packages/AsterismCore/Sources/AsterismCore/WorkTypeSeeding.swift b/Packages/AsterismCore/Sources/AsterismCore/WorkTypeSeeding.swiftindex c734991e..df5f6ba5 100644--- a/Packages/AsterismCore/Sources/AsterismCore/WorkTypeSeeding.swift+++ b/Packages/AsterismCore/Sources/AsterismCore/WorkTypeSeeding.swift@@ -41,16 +41,22 @@ public enum WorkTypeSeeding {     /// default the user removed. The spellings are Q3's — the legacy value     /// `toon` is deliberately *not* among them, because `webtoon` is the name     /// the list is seeded with while `toon` stays a legacy value on works.+    ///+    /// **`D0000003-0000-4000-8000-000000000003` is retired and never reused**+    /// (`remove-article-mode` Req 6.3, Q5). It was the `article` default, which+    /// went with articles mode. Libraries seeded by an earlier build still hold+    /// that row; it is theirs to keep or remove in Settings, and the+    /// per-identifier guard below is what leaves it alone. Minting a *different*+    /// default under it would fold the new type into every one of those rows.     public static let seeds: [Seed] = [         Seed(id: UUID(uuidString: "D0000001-0000-4000-8000-000000000001")!, name: "novel"),         Seed(id: UUID(uuidString: "D0000002-0000-4000-8000-000000000002")!, name: "webtoon"),-        Seed(id: UUID(uuidString: "D0000003-0000-4000-8000-000000000003")!, name: "article"),     ]      /// Inserts every default the library holds no row for, in one save.     ///     /// - Returns: the identifiers actually inserted, empty where the library-    ///   already accounted for all three.+    ///   already accounted for all of them.     @discardableResult     public static func run(context: ModelContext) throws -> [UUID] {         // The whole table, which is tens of rows by construction — the same
Packages/AsterismCore/Sources/ConstellationKit/SiteGlyph.swift Modified +4 / -5
diff --git a/Packages/AsterismCore/Sources/ConstellationKit/SiteGlyph.swift b/Packages/AsterismCore/Sources/ConstellationKit/SiteGlyph.swiftindex 9b16f24c..b2b53943 100644--- a/Packages/AsterismCore/Sources/ConstellationKit/SiteGlyph.swift+++ b/Packages/AsterismCore/Sources/ConstellationKit/SiteGlyph.swift@@ -7,10 +7,9 @@ public enum SiteGlyphKind: Sendable, Hashable {     case site     /// An unrecognised host. Flat, dim, unglowed (§6).     case unknown-    /// An articles-mode site — and, by the style guide's shared treatment, any-    /// row with no site identity to celebrate (the unattached-notes row borrows-    /// this case for the same dim ✎). Flat, dim, unglowed.-    case articles+    /// A row with no site identity to celebrate: the unattached-notes row, which+    /// is what the style guide's dim ✎ stands for. Flat, dim, unglowed.+    case unattached }  /// Derives a site glyph's colors from its hostname.@@ -111,7 +110,7 @@ public struct SiteGlyph: View {             switch kind {             case .site: coloredGlyph             case .unknown: dimGlyph(symbol: "questionmark")-            case .articles: dimGlyph(symbol: "pencil")+            case .unattached: dimGlyph(symbol: "pencil")             }         }         .frame(width: size, height: size)
Packages/AsterismCore/Tests/AsterismCoreTests/ArticlesModeTests.swift Deleted +0 / -126
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/ArticlesModeTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/ArticlesModeTests.swiftdeleted file mode 100644index 2e9fbf9e..00000000--- a/Packages/AsterismCore/Tests/AsterismCoreTests/ArticlesModeTests.swift+++ /dev/null@@ -1,126 +0,0 @@-import Foundation-import Testing-@testable import AsterismCore--@Suite("M2.2 articles-mode planning", .serialized)-struct ArticlesModePlannerTests {-    private let none = try! FieldProvenance(kind: .none)--    @Test("Suffix authoring stores contiguous end anchors and preserves exact source prefix")-    func suffixAuthoringAndCleaning() throws {-        let derivedRule = try ArticleTitleCleaner.deriveRule(-            from: "Story Title — Example Site | Archive",-            suffixSegmentCount: 2-        )-        let rule = try #require(derivedRule)--        #expect(rule.version == 1)-        #expect(rule.anchors == [-            try SegmentPositionSpec(origin: .end, offset: 1),-            try SegmentPositionSpec(origin: .end, offset: 0),-        ])-        #expect(ArticleTitleCleaner.clean(-            "Another Story — Example Site | Archive",-            using: rule-        ) == "Another Story")-    }--    @Test("Suffix authoring rejects blank examples and cleaning falls back for short titles")-    func suffixValidationAndFallback() throws {-        #expect(throws: ArticleTitleCleaningError.self) {-            _ = try ArticleTitleCleaner.deriveRule(from: "Story — Site", suffixSegmentCount: 2)-        }--        let derivedRule = try ArticleTitleCleaner.deriveRule(-            from: "Story — Site",-            suffixSegmentCount: 1-        )-        let rule = try #require(derivedRule)-        #expect(ArticleTitleCleaner.clean("Undelimited title", using: rule) == "Undelimited title")-        #expect(ArticleTitleCleaner.clean("Only — Site", using: rule) == "Only")-        #expect(try ArticleTitleCleaner.deriveRule(from: "Story — Site", suffixSegmentCount: 0) == nil)-    }--    @Test("Article projection preserves manual fields, clears derived fields, and settles every entry")-    func projectionProtectsManualFields() throws {-        let patternID = UUID()-        let manualWorkID = UUID()-        let entries = [-            makeEntry(-                title: "Manual chapter — Site",-                chapter: "Curated chapter",-                chapterProvenance: try FieldProvenance(kind: .manual),-                assignmentProvenance: try FieldProvenance(-                    kind: .pattern,-                    patternID: patternID-                )-            ),-            makeEntry(-                title: "Manual work — Site",-                chapter: "Derived chapter",-                chapterProvenance: try FieldProvenance(-                    kind: .pattern,-                    patternID: patternID-                ),-                workID: manualWorkID,-                assignmentProvenance: try FieldProvenance(kind: .manual)-            ),-        ]-        let derivedRule = try ArticleTitleCleaner.deriveRule(-            from: entries[0].captureTitle,-            suffixSegmentCount: 1-        )-        let rule = try #require(derivedRule)--        let plan = TitleProjectionPlanner.planArticles(entries: entries, junkSuffixRule: rule)-        let projections = Dictionary(uniqueKeysWithValues: plan.entryProjections.map { ($0.entryID, $0) })-        let first = try #require(projections[entries[0].id])-        let second = try #require(projections[entries[1].id])--        #expect(first.projectedChapter == "Curated chapter")-        #expect(first.chapterProvenance == .preserved(entries[0].chapterTitleProvenance))-        #expect(first.projectedWorkID == nil)-        #expect(first.assignmentProvenance == .cleared)-        #expect(first.intentionallyUnattached)-        #expect(first.displayTitle == "Manual chapter")-        #expect(!first.actionableAfter)--        #expect(second.projectedChapter == nil)-        #expect(second.chapterProvenance == .cleared)-        #expect(second.projectedWorkID == manualWorkID)-        #expect(second.assignmentProvenance == .preserved(entries[1].workAssignmentProvenance))-        #expect(!second.intentionallyUnattached)-        #expect(!second.actionableAfter)-    }--    private func makeEntry(-        title: String,-        chapter: String? = nil,-        chapterProvenance: FieldProvenance? = nil,-        workID: UUID? = nil,-        assignmentProvenance: FieldProvenance? = nil-    ) -> EntrySnapshot {-        let id = UUID()-        let date = Date(timeIntervalSince1970: 1_750_000_000)-        return EntrySnapshot(-            id: id,-            captureTitle: title,-            captureTitleSource: .safariDocument,-            rawURLString: "https://example.com/\(id)",-            canonicalURLString: nil,-            hostname: "example.com",-            entryIdentityKey: id.uuidString,-            identityKeyVersion: 1,-            chapterTitle: chapter,-            chapterTitleProvenance: chapterProvenance ?? none,-            note: "",-            rating: nil,-            firstCapturedAt: date,-            lastSharedAt: date,-            modifiedAt: date,-            workID: workID,-            workAssignmentProvenance: assignmentProvenance ?? none,-            intentionallyUnattached: false-        )-    }-}
Packages/AsterismCore/Tests/AsterismCoreTests/ArticlesReteachFlagTests.swift Deleted +0 / -132
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/ArticlesReteachFlagTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/ArticlesReteachFlagTests.swiftdeleted file mode 100644index a938ba6d..00000000--- a/Packages/AsterismCore/Tests/AsterismCoreTests/ArticlesReteachFlagTests.swift+++ /dev/null@@ -1,132 +0,0 @@-import Foundation-import Testing--@testable import AsterismCore--// The one way out of articles mode (Req 6.3, Decision 3): a re-teach launched-// from the Sites screen, and only from there. The gate that keeps inbox-driven-// teaching from converting an articles site by accident stays in place-// everywhere else, so both states are tested.--@Suite("Articles re-teach flag", .serialized)-struct ArticlesReteachFlagTests {-    private let host = "articles.test"--    private func titleRule() throws -> PatternDefinition {-        .segment(work: try SegmentRangeSpec(origin: .end, offset: 0, length: 1), ignored: [])-    }--    /// An articles site reached the way the app reaches it: taught into articles-    /// mode, which is what marks its entries intentionally unattached.-    private func articlesFixture() async throws -> (fixture: M5Fixture, entryID: UUID) {-        let fixture = try await M5Fixture()-        let entryID = UUID()-        try await fixture.repository.seedM5Rows(-            sites: [M5SeedSite(hostname: host, displayName: "Articles Site")],-            entries: [-                M5SeedEntry(-                    id: entryID, captureTitle: "Chapter 7 - A Serial", hostname: host, path: "7",-                    workAssignmentProvenance: .none)-            ])-        let rule = try ArticleTitleCleaner.deriveRule(-            from: "Chapter 7 - A Serial", suffixSegmentCount: 1)-        let contract = try await fixture.repository.projectArticles(-            hostname: host, junkSuffixRule: rule)-        let outcome = try await fixture.repository.commitArticles(contract)-        #expect(outcome == .committed)-        #expect(try await fixture.repository.entry(id: entryID).intentionallyUnattached)-        return (fixture, entryID)-    }--    @Test("By default, composed teaching still refuses an articles site (the accident gate)")-    func defaultFlagRefusesProjection() async throws {-        let (fixture, _) = try await articlesFixture()-        await #expect(throws: LibraryRepositoryError.self) {-            _ = try await fixture.repository.projectComposedTeaching(-                hostname: self.host,-                request: ComposedTeachingRequest(titleDefinition: try self.titleRule()))-        }-        // The other teaching entry point is untouched by this milestone.-        await #expect(throws: LibraryRepositoryError.self) {-            _ = try await fixture.repository.projectInitialTeaching(-                hostname: self.host, patternDefinition: try self.titleRule())-        }-    }--    @Test("By default, the commit refuses too — the flag is not a projection-only lift")-    func defaultFlagRefusesCommit() async throws {-        let (fixture, _) = try await articlesFixture()-        let permitted = try await fixture.repository.projectComposedTeaching(-            hostname: host,-            request: ComposedTeachingRequest(-                titleDefinition: try titleRule(), acknowledgeUnsettled: true,-                permitsArticlesConversion: true))--        // The same basis and outcome the flagged projection produced, carried by-        // a request that does not permit the conversion: a caller cannot commit-        // its way past the gate by re-labelling an approved contract.-        let unpermitted = ComposedTeachingContract(-            basis: permitted.basis,-            request: ComposedTeachingRequest(-                titleDefinition: try titleRule(), acknowledgeUnsettled: true),-            outcome: permitted.outcome)-        let outcome = try await fixture.repository.commitComposedTeaching(unpermitted)-        guard case .invalidated = outcome else {-            Issue.record("expected the commit to refuse, got \(outcome)")-            return-        }-        let site = try #require(try await fixture.repository.sites().first)-        #expect(site.mode == .articles)-    }--    @Test("With the flag, the re-teach converts the site back to taught (6.3, Decision 3)")-    func flaggedReteachConverts() async throws {-        let (fixture, _) = try await articlesFixture()-        let contract = try await fixture.repository.projectComposedTeaching(-            hostname: host,-            request: ComposedTeachingRequest(-                titleDefinition: try titleRule(), acknowledgeUnsettled: true,-                permitsArticlesConversion: true))-        let outcome = try await fixture.repository.commitComposedTeaching(contract)-        guard case .committed = outcome else {-            Issue.record("expected the re-teach to commit, got \(outcome)")-            return-        }--        let site = try #require(try await fixture.repository.sites().first)-        #expect(site.mode == .taught)-        #expect(site.patternIDs.count == 1)-        // The junk rule belongs to articles mode alone, and the closed tuple-        // table refuses it on a taught Site — a library that cannot be opened is-        // not an acceptable price for keeping an inert value.-        #expect(site.junkSuffixRule == nil)--        // The conversion leaves a library the app can open.-        await fixture.repository.shutdown()-        _ = try await LibraryRepository.openForApp(-            LibraryConfiguration(rootDirectory: fixture.directory))-    }--    @Test("Intentionally-unattached entries stay unattached through the conversion (§2.6)")-    func unattachedEntriesSurviveTheConversion() async throws {-        let (fixture, entryID) = try await articlesFixture()-        let contract = try await fixture.repository.projectComposedTeaching(-            hostname: host,-            request: ComposedTeachingRequest(-                titleDefinition: try titleRule(), acknowledgeUnsettled: true,-                permitsArticlesConversion: true))-        _ = try await fixture.repository.commitComposedTeaching(contract)--        let entry = try await fixture.repository.entry(id: entryID)-        #expect(entry.intentionallyUnattached)-        #expect(entry.workID == nil)-        // Articles mode's `.none` provenance is legal only in articles mode, so-        // the conversion promotes it to the same shape Move to…'s "Leave-        // unattached" branch writes — the mark survives, the tuple stays legal.-        #expect(-            try await fixture.repository.m5UnattachmentFields(of: entryID)-                == M5UnattachmentFields(-                    hasWork: false, intentionallyUnattached: true, assignmentProvenance: .manual,-                    citesWorkPattern: false))-    }-}
Packages/AsterismCore/Tests/AsterismCoreTests/BackupExportDegradedRefusalTests.swift Modified +47 / -47
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupExportDegradedRefusalTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupExportDegradedRefusalTests.swiftindex 0dc69504..6c94e365 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupExportDegradedRefusalTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupExportDegradedRefusalTests.swift@@ -34,7 +34,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()          #expect(Set(payload.sites.map(\.hostname)) == ["present.example", "orphan.example"])         let synthesised = try #require(payload.sites.first { $0.hostname == "orphan.example" })@@ -75,11 +75,11 @@ struct BackupExportDegradedRefusalTests {         #expect(await repository.diagnostics.quarantineMap()["quarantined.example"] != nil)          let staging = fixture.directory.appending(path: "staging")-        let exporter = BackupV14Exporter(repository: repository, stagingDirectory: staging)+        let exporter = BackupV15Exporter(repository: repository, stagingDirectory: staging)         let result = try await exporter.export(-            metadata: BackupV14Metadata(appBuild: "1", exportedAt: Date()))+            metadata: BackupV15Metadata(appBuild: "1", exportedAt: Date())) -        let decoded = try BackupV14Codec.decode(try Data(contentsOf: result.fileURL))+        let decoded = try BackupV15Codec.decode(try Data(contentsOf: result.fileURL))         #expect(decoded.payload.entries.count == 1)         #expect(decoded.payload.titlePatterns.count == 2)         // The union demoted one of the two, which is what makes the archive legal@@ -102,7 +102,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()          #expect(payload.sites.count == 1)         let site = try #require(payload.sites.first)@@ -140,7 +140,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()          let pattern = try #require(payload.titlePatterns.first)         #expect(pattern.id == patternID)@@ -169,7 +169,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()          #expect(payload.entries.count == 1)         #expect(payload.entries.first?.id == shared)@@ -194,7 +194,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let error = try await expectRefusal { _ = try await repository.backupV14Snapshot() }+        let error = try await expectRefusal { _ = try await repository.backupV15Snapshot() }          guard case .tornGroups(let payload) = error else {             Issue.record("expected .tornGroups, got \(error)")@@ -221,7 +221,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let error = try await expectRefusal { _ = try await repository.backupV14Snapshot() }+        let error = try await expectRefusal { _ = try await repository.backupV15Snapshot() }          guard case .unrepresentableValue(let record, _, let value) = error else {             Issue.record("expected .unrepresentableValue, got \(error)")@@ -253,7 +253,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let error = try await expectRefusal { _ = try await repository.backupV14Snapshot() }+        let error = try await expectRefusal { _ = try await repository.backupV15Snapshot() }          guard case .unrepresentableValue(let record, let field, let value) = error else {             Issue.record("expected .unrepresentableValue, got \(error)")@@ -282,7 +282,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let error = try await expectRefusal { _ = try await repository.backupV14Snapshot() }+        let error = try await expectRefusal { _ = try await repository.backupV15Snapshot() }          guard case .unrepresentableValue(let record, let field, let value) = error else {             Issue.record("expected .unrepresentableValue, got \(error)")@@ -310,7 +310,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()          let record = try #require(payload.works.first { $0.id == workID })         #expect(record.workStatus == .hiatus)@@ -338,7 +338,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()          let record = try #require(payload.works.first { $0.id == workID })         // The 7/8 record has nowhere to put a legacy type at all (Req 10.3, Q16).@@ -360,7 +360,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let error = try await expectRefusal { _ = try await repository.backupV14Snapshot() }+        let error = try await expectRefusal { _ = try await repository.backupV15Snapshot() }          guard case .unrepresentableValue(_, _, let value) = error else {             Issue.record("expected .unrepresentableValue, got \(error)")@@ -400,7 +400,7 @@ struct BackupExportDegradedRefusalTests {             memberships: try context.fetch(FetchDescriptor<WorkSiteMembership>()))         #expect(omitted == [staleID]) -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()          #expect(payload.urlRules.map(\.id) == [currentID])         #expect(payload.urlRules.first?.siteHostname == payload.sites.first?.hostname)@@ -431,11 +431,11 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository()         let staging = fixture.directory.appending(path: "staging")-        let exporter = BackupV14Exporter(repository: repository, stagingDirectory: staging)+        let exporter = BackupV15Exporter(repository: repository, stagingDirectory: staging)          let error = try await expectRefusal {             _ = try await exporter.export(-                metadata: BackupV14Metadata(appBuild: "1", exportedAt: Date()))+                metadata: BackupV15Metadata(appBuild: "1", exportedAt: Date()))         }          guard case .unrepresentableValue(let record, let field, _) = error else {@@ -479,7 +479,7 @@ struct BackupExportDegradedRefusalTests {             entries: try context.fetch(FetchDescriptor<Entry>()))         #expect(omitted == [retiredID]) -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()          #expect(payload.titlePatterns.map(\.id) == [activeID])         #expect(payload.titlePatterns.first?.siteHostname == payload.sites.first?.hostname)@@ -507,11 +507,11 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository()         let staging = fixture.directory.appending(path: "staging")-        let exporter = BackupV14Exporter(repository: repository, stagingDirectory: staging)+        let exporter = BackupV15Exporter(repository: repository, stagingDirectory: staging)          let error = try await expectRefusal {             _ = try await exporter.export(-                metadata: BackupV14Metadata(appBuild: "1", exportedAt: Date()))+                metadata: BackupV15Metadata(appBuild: "1", exportedAt: Date()))         }          guard case .unrepresentableValue(let record, let field, _) = error else {@@ -543,11 +543,11 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository()         let staging = fixture.directory.appending(path: "staging")-        let exporter = BackupV14Exporter(repository: repository, stagingDirectory: staging)+        let exporter = BackupV15Exporter(repository: repository, stagingDirectory: staging)          let error = try await expectRefusal {             _ = try await exporter.export(-                metadata: BackupV14Metadata(appBuild: "1", exportedAt: Date()))+                metadata: BackupV15Metadata(appBuild: "1", exportedAt: Date()))         }          guard case .unrepresentableValue(let record, let field, _) = error else {@@ -591,7 +591,7 @@ struct BackupExportDegradedRefusalTests {         for order in [activeFirst, retiredFirst] {             #expect(order.map(\.id) == [sharedID, sharedID])             let error = try #require(-                throws: BackupV14ExportError.self,+                throws: BackupV15ExportError.self,                 "the partition must refuse an all-unreadable group holding the active row"             ) {                 try LibraryRepository.partitionUnreadableTitlePatterns(order, entries: entries)@@ -605,10 +605,10 @@ struct BackupExportDegradedRefusalTests {         }          let staging = fixture.directory.appending(path: "staging")-        let exporter = BackupV14Exporter(repository: repository, stagingDirectory: staging)+        let exporter = BackupV15Exporter(repository: repository, stagingDirectory: staging)         let error = try await expectRefusal {             _ = try await exporter.export(-                metadata: BackupV14Metadata(appBuild: "1", exportedAt: Date()))+                metadata: BackupV15Metadata(appBuild: "1", exportedAt: Date()))         }         guard case .unrepresentableValue(let record, _, _) = error else {             Issue.record("expected .unrepresentableValue, got \(error)")@@ -637,7 +637,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let error = try await expectRefusal { _ = try await repository.backupV14Snapshot() }+        let error = try await expectRefusal { _ = try await repository.backupV15Snapshot() }          guard case .referencesStillArriving = error else {             Issue.record("expected .referencesStillArriving, got \(error)")@@ -678,7 +678,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let error = try await expectRefusal { _ = try await repository.backupV14Snapshot() }+        let error = try await expectRefusal { _ = try await repository.backupV15Snapshot() }          guard case .referencesStillArriving(let detail) = error else {             Issue.record("expected .referencesStillArriving, got \(error)")@@ -706,7 +706,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let error = try await expectRefusal { _ = try await repository.backupV14Snapshot() }+        let error = try await expectRefusal { _ = try await repository.backupV15Snapshot() }          guard case .referencesStillArriving(let detail) = error else {             Issue.record("expected .referencesStillArriving, got \(error)")@@ -732,11 +732,11 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository()         let staging = fixture.directory.appending(path: "staging")-        let exporter = BackupV14Exporter(repository: repository, stagingDirectory: staging)+        let exporter = BackupV15Exporter(repository: repository, stagingDirectory: staging)          let error = try await expectRefusal {             _ = try await exporter.export(-                metadata: BackupV14Metadata(appBuild: "1", exportedAt: Date()))+                metadata: BackupV15Metadata(appBuild: "1", exportedAt: Date()))         }          guard case .referencesStillArriving = error else {@@ -755,7 +755,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let error = try await expectRefusal { _ = try await repository.backupV14Snapshot() }+        let error = try await expectRefusal { _ = try await repository.backupV15Snapshot() }          guard case .referencesStillArriving = error else {             Issue.record("expected .referencesStillArriving, got \(error)")@@ -780,11 +780,11 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository()         let staging = fixture.directory.appending(path: "staging")-        let exporter = BackupV14Exporter(repository: repository, stagingDirectory: staging)+        let exporter = BackupV15Exporter(repository: repository, stagingDirectory: staging)          let error = try await expectRefusal {             _ = try await exporter.export(-                metadata: BackupV14Metadata(appBuild: "1", exportedAt: Date()))+                metadata: BackupV15Metadata(appBuild: "1", exportedAt: Date()))         }          guard case .tornGroups = error else {@@ -811,7 +811,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()         let target = try Self.importIntoEmptyStore(payload)          // What reconciliation would settle on: one row per hostname holding the@@ -836,7 +836,7 @@ struct BackupExportDegradedRefusalTests {         }         let repository = try fixture.diagnosedRepository() -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()         let target = try Self.importIntoEmptyStore(payload)          let rows = try target.fetch(FetchDescriptor<Site>())@@ -862,13 +862,13 @@ struct BackupExportDegradedRefusalTests {         #expect(await repository.diagnostics.isEmpty)          let staging = fixture.directory.appending(path: "staging")-        let exporter = BackupV14Exporter(repository: repository, stagingDirectory: staging)+        let exporter = BackupV15Exporter(repository: repository, stagingDirectory: staging)         let result = try await exporter.export(-            metadata: BackupV14Metadata(appBuild: "1", exportedAt: Date()))+            metadata: BackupV15Metadata(appBuild: "1", exportedAt: Date())) -        let decoded = try BackupV14Codec.decode(try Data(contentsOf: result.fileURL))-        #expect(decoded.backupFormatVersion == 14)-        #expect(decoded.databaseSchemaVersion == 15)+        let decoded = try BackupV15Codec.decode(try Data(contentsOf: result.fileURL))+        #expect(decoded.backupFormatVersion == 15)+        #expect(decoded.databaseSchemaVersion == 16)         #expect(decoded.payload.entries.count == 1)         #expect(decoded.payload.sites.count == 1)         exporter.cleanup(result)@@ -878,12 +878,12 @@ struct BackupExportDegradedRefusalTests {      private func expectRefusal(         _ body: () async throws -> Void-    ) async throws -> BackupV14ExportError {+    ) async throws -> BackupV15ExportError {         do {             try await body()             Issue.record("expected a named refusal, but the export proceeded")             return .snapshotFailed(reason: "no refusal")-        } catch let error as BackupV14ExportError {+        } catch let error as BackupV15ExportError {             return error         }     }@@ -891,13 +891,13 @@ struct BackupExportDegradedRefusalTests {     /// The archive's own import path, into a fresh empty store. Both round-trip     /// tests go through the strict reference validator on the way in, which is     /// what makes "the archive is legal" an assertion rather than a hope.-    private static func importIntoEmptyStore(_ payload: BackupV14Payload) throws -> ModelContext {-        let encoded = try BackupV14Codec.encode(+    private static func importIntoEmptyStore(_ payload: BackupV15Payload) throws -> ModelContext {+        let encoded = try BackupV15Codec.encode(             payload: payload,-            metadata: BackupV14Metadata(appBuild: "1", exportedAt: DegradedExportFixture.epoch))-        let decoded = try BackupV14Codec.decode(encoded)+            metadata: BackupV15Metadata(appBuild: "1", exportedAt: DegradedExportFixture.epoch))+        let decoded = try BackupV15Codec.decode(encoded) -        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             schema: schema, isStoredInMemoryOnly: true, cloudKitDatabase: .none)         let container = try ModelContainer(for: schema, configurations: [configuration])
Packages/AsterismCore/Tests/AsterismCoreTests/BackupGoldenExportTests.swift Modified +125 / -130
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupGoldenExportTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupGoldenExportTests.swiftindex cce7c0f5..b7262285 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupGoldenExportTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupGoldenExportTests.swift@@ -4,7 +4,7 @@ import Testing  @testable import AsterismCore -/// The byte-for-byte pin on the 14/15 export (`update-schedule` Req 8.1).+/// The byte-for-byte pin on the 15/16 export (`remove-article-mode` Req 5.4). /// /// Nothing in the other suites would notice a change to a key's spelling, a sort /// order, or a number's formatting: they assert on decoded *values*, and a@@ -25,18 +25,21 @@ import Testing /// is a literal, `M5Fixture` runs on a `FixedRepositoryClock`, and the canonical /// encoder sorts keys while the projection sorts every array by identifier. ///-/// **Recorded at 14/15 for `update-schedule`.** A Work record gained the-/// reader's release days — a required list of typed weekdays, the empty set-/// written explicitly (Q22) — and the envelope moved with it. One work in the-/// library carries a schedule and the rest carry the empty array, so the bytes-/// pin both shapes. It still carries the cover 13/14 added: the **committed**+/// **Recorded at 15/16 for `remove-article-mode`.** A Site record lost its+/// junk-suffix rule — V16 has no column for it (Req 5.1, Q12) — and the envelope+/// moved with it. The fixture's four Sites are untaught and taught only; the+/// articles one became `trimmed.example`, a taught Site holding the fixture's+/// only `trimSuffix` rule as its active pattern (Q7). It still carries the+/// release days 14/15 added — one work with a schedule and the rest with the+/// explicitly-written empty array, so the bytes pin both shapes — and the cover+/// 13/14 added: the **committed** /// golden JPEG (`work-thumbnails` Q54) rather than one encoded on the fly, so /// the archive's bytes pin the wire rather than the encoder. /// Re-recording is a deliberate act with a repeatable /// procedure: run this suite's byte test with `ASTERISM_RECORD_GOLDEN=1` set and /// it writes the fixture and fails, then run it again without the flag /// (`rule-citation-by-uuid` Q22).-@Suite("Backup 14/15 golden export", .serialized)+@Suite("Backup 15/16 golden export", .serialized) struct BackupGoldenExportTests {      /// The recorded archive. Regenerating it is a deliberate act — see the@@ -44,10 +47,10 @@ struct BackupGoldenExportTests {     private static var goldenURL: URL {         URL(fileURLWithPath: #filePath)             .deletingLastPathComponent()-            .appending(path: "Fixtures/backup-14-15-golden.json")+            .appending(path: "Fixtures/backup-15-16-golden.json")     } -    /// Every array the 14/15 payload declares is non-empty, so the golden below is+    /// Every array the 15/16 payload declares is non-empty, so the golden below is     /// evidence about the whole projection rather than about the half a smaller     /// fixture would reach.     @Test("The golden library populates every payload array")@@ -76,10 +79,8 @@ struct BackupGoldenExportTests {         // quietly drops one fails here rather than only moving the golden bytes.         #expect(payload.works.contains { $0.workTypeID != nil && $0.typeName != nil })         #expect(payload.workTypes.contains { $0.canonicalID != nil })-        // The optional columns a nil leaves out of the file entirely, so the-        // golden pins their spelling rather than only their absence.-        #expect(payload.sites.contains { $0.junkSuffixRule != nil })-        #expect(payload.sites.contains { $0.mode == .articles })+        // The optional column a nil leaves out of the file entirely, so the+        // golden pins its spelling rather than only its absence.         #expect(payload.titlePatterns.contains { $0.definition.trimSuffix != nil })         // Req 8.1: a Work carrying all three status fields off their defaults,         // so the golden bytes pin those spellings and not only `ongoing` /@@ -92,7 +93,7 @@ struct BackupGoldenExportTests {         // `update-schedule` Req 8.1: one work with a non-empty schedule and the         // rest with the explicitly-written empty one, so the golden pins both         // shapes — the day spellings and canonical order, and the empty array-        // that tells a 14/15 record apart from a pre-feature one (Q22).+        // that tells a 15/16 record apart from a pre-feature one (Q22).         #expect(payload.works.contains { $0.releaseDays == [.monday, .thursday] })         #expect(payload.works.contains { $0.releaseDays.isEmpty })         #expect(payload.entries.contains { $0.canonicalURL != nil })@@ -184,10 +185,10 @@ struct BackupGoldenExportTests {                 == 1)     } -    @Test("The 14/15 export of the golden library is byte-identical to the recorded archive")+    @Test("The 15/16 export of the golden library is byte-identical to the recorded archive")     func exportIsByteIdenticalToTheRecordedArchive() async throws {         let payload = try await Self.exportedPayload()-        let encoded = try BackupV14Codec.encode(+        let encoded = try BackupV15Codec.encode(             payload: payload, metadata: BackupGoldenLibrary.metadata)          // Q22: every generation bump used to re-record the golden by hand from@@ -209,7 +210,7 @@ struct BackupGoldenExportTests {         #expect(             encoded == golden,             """-            the 14/15 export of the golden library no longer produces the recorded \+            the 15/16 export of the golden library no longer produces the recorded \             bytes. An archive's bytes are its identity — the checksum is taken \             over them — so this is a wire-format change unless it is a bug. \             Establish which before re-recording \(Self.goldenURL.lastPathComponent) \@@ -224,8 +225,8 @@ struct BackupGoldenExportTests {         let golden = try Data(contentsOf: Self.goldenURL)         let plan = try BackupImporter.plan(from: golden) -        #expect(plan.metadata.formatVersion == 14)-        #expect(plan.metadata.schemaVersion == 15)+        #expect(plan.metadata.formatVersion == 15)+        #expect(plan.metadata.schemaVersion == 16)         #expect(plan.counts.entries == plan.metadata.entryCount)         #expect(plan.counts.works == plan.metadata.workCount)     }@@ -251,13 +252,13 @@ struct BackupGoldenExportTests {     /// `recordedArchiveRestoresIntoAV9Library` went away (Q23).     @Test("An export imported into an empty library re-exports the same bytes")     func exportImportExportIsByteIdentical() async throws {-        let first = try BackupV14Codec.encode(+        let first = try BackupV15Codec.encode(             payload: try await Self.exportedPayload(), metadata: BackupGoldenLibrary.metadata)          let target = try await M5Fixture()         try await target.repository.confirmImport(plan: try BackupImporter.plan(from: first))-        let second = try BackupV14Codec.encode(-            payload: try await target.repository.backupV14Snapshot(),+        let second = try BackupV15Codec.encode(+            payload: try await target.repository.backupV15Snapshot(),             metadata: BackupGoldenLibrary.metadata)          #expect(second == first)@@ -269,7 +270,7 @@ struct BackupGoldenExportTests {     /// detached, and the dismissed pair imports verbatim.     @Test("An orphan membership and a dismissed pair survive the restore")     func orphansSurviveTheRestore() async throws {-        let archive = try BackupV14Codec.encode(+        let archive = try BackupV15Codec.encode(             payload: try await Self.exportedPayload(), metadata: BackupGoldenLibrary.metadata)          let target = try await M5Fixture()@@ -286,17 +287,17 @@ struct BackupGoldenExportTests {      /// Imports the golden archive into a fresh library, seeds the duplicate rows     /// no write path produces, and exports what results.-    private static func exportedPayload() async throws -> BackupV14Payload {+    private static func exportedPayload() async throws -> BackupV15Payload {         let fixture = try await M5Fixture()         let plan = try BackupImporter.plan(-            from: try BackupV14Codec.encode(+            from: try BackupV15Codec.encode(                 payload: BackupGoldenLibrary.payload, metadata: BackupGoldenLibrary.metadata))         try await fixture.repository.confirmImport(plan: plan)         try await fixture.repository.seedM5Rows(             sites: BackupGoldenLibrary.duplicateSites,             works: BackupGoldenLibrary.duplicateWorks,             entries: BackupGoldenLibrary.duplicateEntries)-        return try await fixture.repository.backupV14Snapshot()+        return try await fixture.repository.backupV15Snapshot()     } } @@ -331,7 +332,7 @@ extension LibraryRepository { }  /// The archive the golden library is built from: one record of every kind the-/// 14/15 payload can hold, with literal identifiers and one literal date.+/// 15/16 payload can hold, with literal identifiers and one literal date. enum BackupGoldenLibrary {     static let created = Date(timeIntervalSince1970: 1_000_000) @@ -352,11 +353,11 @@ enum BackupGoldenLibrary {      static let taughtHost = "golden.example"     static let plainHost = "plain.example"-    static let articlesHost = "articles.example"+    static let trimmedHost = "trimmed.example"     static let duplicateHost = "dupe.example"      static let patternID = UUID(uuidString: "cccccccc-cccc-cccc-cccc-cccccccccccc")!-    static let articlePatternID = UUID(uuidString: "cccccccc-cccc-cccc-cccc-ccccccccccc2")!+    static let trimmedPatternID = UUID(uuidString: "cccccccc-cccc-cccc-cccc-ccccccccccc2")!     static let ruleID = UUID(uuidString: "dddddddd-dddd-dddd-dddd-dddddddddddd")!     static let typedWorkID = UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeeee")!     static let foldedWorkID = UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeee2")!@@ -366,12 +367,12 @@ enum BackupGoldenLibrary {     static let absentWorkID = UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeee9")!     static let notedEntryID = UUID(uuidString: "22222222-2222-2222-2222-222222222222")!     static let plainEntryID = UUID(uuidString: "22222222-2222-2222-2222-222222222223")!-    static let articleEntryID = UUID(uuidString: "22222222-2222-2222-2222-222222222224")!+    static let trimmedEntryID = UUID(uuidString: "22222222-2222-2222-2222-222222222224")!      static let taughtMembershipID = UUID(uuidString: "77777777-0000-4000-8000-000000000001")!     static let secondSiteMembershipID = UUID(uuidString: "77777777-0000-4000-8000-000000000002")!     static let plainMembershipID = UUID(uuidString: "77777777-0000-4000-8000-000000000003")!-    static let articleMembershipID = UUID(uuidString: "77777777-0000-4000-8000-000000000004")!+    static let trimmedMembershipID = UUID(uuidString: "77777777-0000-4000-8000-000000000004")!     static let orphanMembershipID = UUID(uuidString: "77777777-0000-4000-8000-000000000005")!     static let duplicateMembershipID = UUID(uuidString: "77777777-0000-4000-8000-000000000006")!     static let distinctPairID = UUID(uuidString: "88888888-0000-4000-8000-000000000001")!@@ -433,20 +434,20 @@ enum BackupGoldenLibrary {     static let workIdentity = "golden.example/story/actual-title"     static let workURL = "https://golden.example/story/actual-title"     static let secondSiteWorkURL = "https://plain.example/works/actual-title"-    static let articleTitleSuffix = " - Articles Example"+    static let trimmedTitleSuffix = " - Trimmed Example" -    static var metadata: BackupV14Metadata {-        BackupV14Metadata(appBuild: "golden", exportedAt: created)+    static var metadata: BackupV15Metadata {+        BackupV15Metadata(appBuild: "golden", exportedAt: created)     }      // MARK: The archive -    static var payload: BackupV14Payload {-        BackupV14Payload(-            entries: [notedEntry, plainEntry, articleEntry],+    static var payload: BackupV15Payload {+        BackupV15Payload(+            entries: [notedEntry, plainEntry, trimmedEntry],             works: [typedWork, foldedWork, legacyWork],-            sites: [taughtSite, plainSite, articlesSite],-            titlePatterns: [pattern, articlePattern],+            sites: [taughtSite, plainSite, trimmedSite],+            titlePatterns: [pattern, trimmedPattern],             urlRules: [rule],             workTypes: [                 workType(id: novelTypeID, name: "novel"),@@ -454,7 +455,7 @@ enum BackupGoldenLibrary {                     id: foldedTypeID, name: "novella", state: .merged, canonicalID: novelTypeID),             ],             memberships: [-                taughtMembership, secondSiteMembership, plainMembership, articleMembership,+                taughtMembership, secondSiteMembership, plainMembership, trimmedMembership,                 orphanMembership,             ],             distinctPairs: [distinctPair],@@ -474,7 +475,7 @@ enum BackupGoldenLibrary {     /// Two active creators and the alias one of them absorbed. The alias points     /// at its final survivor, which is the only shape the reference checks     /// accept (Req 9.5).-    private static var creators: [BackupV14Creator] {+    private static var creators: [BackupV15Creator] {         [             creator(id: creatorID, name: "Mori Ayane", notes: "Also draws."),             creator(id: studioID, name: "Studio Lantern"),@@ -488,7 +489,7 @@ enum BackupGoldenLibrary {     /// them — pristine on every field, so an import of this archive into a fresh     /// library matches them by identifier and writes nothing — plus a role the     /// reader added and one they removed.-    private static var creatorRoles: [BackupV14CreatorRole] {+    private static var creatorRoles: [BackupV15CreatorRole] {         CreatorRoleSeeding.seeds.map {             role(                 id: $0.id, name: $0.name, position: $0.position,@@ -503,7 +504,7 @@ enum BackupGoldenLibrary {     /// removed role as well (Q27), the artist credit holding a role identifier     /// no record answers for, and a credit whose work this archive never     /// carried.-    private static var credits: [BackupV14Credit] {+    private static var credits: [BackupV15Credit] {         [             credit(                 id: authorCreditID, workID: typedWorkID, creatorID: creatorID,@@ -520,8 +521,8 @@ enum BackupGoldenLibrary {     private static func creator(         id: UUID, name: String, notes: String = "", state: CreatorState = .active,         canonicalID: UUID? = nil-    ) -> BackupV14Creator {-        BackupV14Creator(+    ) -> BackupV15Creator {+        BackupV15Creator(             id: id, name: name, nameModifiedAt: created, notes: notes,             notesModifiedAt: created, stateRaw: state.rawValue, stateModifiedAt: created,             canonicalID: canonicalID, createdAt: created, modifiedAt: created)@@ -530,8 +531,8 @@ enum BackupGoldenLibrary {     private static func role(         id: UUID, name: String, position: Int, state: CreatorRoleState = .active,         stamp: Date = created-    ) -> BackupV14CreatorRole {-        BackupV14CreatorRole(+    ) -> BackupV15CreatorRole {+        BackupV15CreatorRole(             id: id, name: name, nameModifiedAt: stamp, position: position,             positionModifiedAt: stamp, stateRaw: state.rawValue, stateModifiedAt: stamp,             canonicalID: nil, createdAt: stamp, modifiedAt: stamp)@@ -539,91 +540,85 @@ enum BackupGoldenLibrary {      private static func credit(         id: UUID, workID: UUID, creatorID: UUID, roleIDs: [UUID]-    ) -> BackupV14Credit {-        BackupV14Credit(+    ) -> BackupV15Credit {+        BackupV15Credit(             id: id, workID: workID, creatorID: creatorID,             roleIDs: roleIDs.map(\.uuidString).sorted(),             createdAt: created, modifiedAt: created)     }      /// The one series row, carrying notes so the golden pins that column too.-    private static var series: BackupV14Series {-        BackupV14Series(+    private static var series: BackupV15Series {+        BackupV15Series(             id: seriesID, name: "Ashfall Cycle", notes: "Read 2.5 after 2.",             createdAt: created, modifiedAt: created)     }      /// A link over two Works the archive carries.-    private static var resolvedLink: BackupV14Link {+    private static var resolvedLink: BackupV15Link {         let ids = WorkDistinctPair.sortedIDs(typedWorkID, legacyWorkID)-        return BackupV14Link(+        return BackupV15Link(             id: resolvedLinkID, lowerWorkID: ids.lower, higherWorkID: ids.higher,             linkType: "adaptation", createdAt: created, modifiedAt: created)     }      /// Req 13.5's tolerated half for links: one end has not arrived. It imports     /// verbatim and stays the reader's to remove.-    private static var unresolvedLink: BackupV14Link {+    private static var unresolvedLink: BackupV15Link {         let ids = WorkDistinctPair.sortedIDs(foldedWorkID, absentWorkID)-        return BackupV14Link(+        return BackupV15Link(             id: unresolvedLinkID, lowerWorkID: ids.lower, higherWorkID: ids.higher,             linkType: "spin-off", createdAt: created, modifiedAt: created)     }      /// The whole-title rule names the Work by trimming the boilerplate prefix.-    private static var pattern: BackupV14TitlePattern {-        BackupV14TitlePattern(+    private static var pattern: BackupV15TitlePattern {+        BackupV15TitlePattern(             id: patternID, siteHostname: taughtHost, version: 1, isActive: true,             createdAt: created,             definition: StoredPatternDefinition(                 definition: .wholeTitle, trimPrefix: titlePrefix))     } -    /// The articles site's retained history, and the fixture's only `trimSuffix`.-    private static var articlePattern: BackupV14TitlePattern {-        BackupV14TitlePattern(-            id: articlePatternID, siteHostname: articlesHost, version: 1, isActive: false,+    /// The second taught site's active rule, and the fixture's only `trimSuffix`.+    private static var trimmedPattern: BackupV15TitlePattern {+        BackupV15TitlePattern(+            id: trimmedPatternID, siteHostname: trimmedHost, version: 1, isActive: true,             createdAt: created,             definition: StoredPatternDefinition(-                definition: .wholeTitle, trimSuffix: articleTitleSuffix))+                definition: .wholeTitle, trimSuffix: trimmedTitleSuffix))     }      /// A sequence-only query rule extracts "94" from the raw URL.-    private static var rule: BackupV14URLRule {-        BackupV14URLRule(+    private static var rule: BackupV15URLRule {+        BackupV15URLRule(             id: ruleID, version: 1, isCurrent: true, createdAt: created,             origin: .readerTaught,             definition: .sequence(locator: .query(name: ExactScalarString("chapter"))),             siteHostname: taughtHost)     } -    /// Carries the `junkSuffixRule` column, which no other site in the fixture-    /// sets and which is therefore absent from the file altogether without it.-    private static var taughtSite: BackupV14Site {-        BackupV14Site(-            hostname: taughtHost, displayName: "Golden", mode: .taught,-            junkSuffixRule: try! JunkSuffixRule(-                version: 1, anchors: [try! SegmentPositionSpec(origin: .end, offset: 0)]))+    private static var taughtSite: BackupV15Site {+        BackupV15Site(+            hostname: taughtHost, displayName: "Golden", mode: .taught)     } -    private static var plainSite: BackupV14Site {-        BackupV14Site(-            hostname: plainHost, displayName: "Plain", mode: .untaught, junkSuffixRule: nil)+    private static var plainSite: BackupV15Site {+        BackupV15Site(+            hostname: plainHost, displayName: "Plain", mode: .untaught)     } -    /// The third site mode. `.articles` may hold neither an active title rule-    /// nor a current URL rule, so its retained pattern is inactive — which is-    /// also where the fixture's `trimSuffix` lives.-    private static var articlesSite: BackupV14Site {-        BackupV14Site(-            hostname: articlesHost, displayName: "Articles", mode: .articles,-            junkSuffixRule: nil)+    /// A second taught site, holding the fixture's only `trimSuffix` rule and+    /// no URL rule at all — the taught tuple the first site does not cover.+    private static var trimmedSite: BackupV15Site {+        BackupV15Site(+            hostname: trimmedHost, displayName: "Trimmed", mode: .taught)     }      private static func workType(         id: UUID, name: String, state: WorkTypeState = .active, canonicalID: UUID? = nil-    ) -> BackupV14WorkType {-        BackupV14WorkType(+    ) -> BackupV15WorkType {+        BackupV15WorkType(             id: id, name: name, stateRaw: state.rawValue, canonicalID: canonicalID,             createdAt: created, modifiedAt: created)     }@@ -632,8 +627,8 @@ enum BackupGoldenLibrary {      /// The multi-site Work's first site: a rule-derived identity, its cited rule     /// and a confirmed Work URL.-    private static var taughtMembership: BackupV14Membership {-        BackupV14Membership(+    private static var taughtMembership: BackupV15Membership {+        BackupV15Membership(             id: taughtMembershipID, workID: typedWorkID, hostname: taughtHost,             createdAt: created, urlIdentity: workIdentity, urlIdentityState: .rule,             urlIdentityRuleID: ruleID, workURLString: workURL)@@ -642,40 +637,40 @@ enum BackupGoldenLibrary {     /// Its second site (Req 9.1): a different Work URL, no identity, and no     /// Entries at all — a membership that outlives its entries (Req 7.1) is the     /// ordinary shape after a cross-site merge.-    private static var secondSiteMembership: BackupV14Membership {-        BackupV14Membership(+    private static var secondSiteMembership: BackupV15Membership {+        BackupV15Membership(             id: secondSiteMembershipID, workID: typedWorkID, hostname: plainHost,             createdAt: created.addingTimeInterval(1), urlIdentity: nil,             urlIdentityState: .none, urlIdentityRuleID: nil, workURLString: secondSiteWorkURL)     } -    private static var plainMembership: BackupV14Membership {-        BackupV14Membership(+    private static var plainMembership: BackupV15Membership {+        BackupV15Membership(             id: plainMembershipID, workID: foldedWorkID, hostname: plainHost,             createdAt: created, urlIdentity: nil, urlIdentityState: .none,             urlIdentityRuleID: nil, workURLString: nil)     } -    private static var articleMembership: BackupV14Membership {-        BackupV14Membership(-            id: articleMembershipID, workID: legacyWorkID, hostname: articlesHost,+    private static var trimmedMembership: BackupV15Membership {+        BackupV15Membership(+            id: trimmedMembershipID, workID: legacyWorkID, hostname: trimmedHost,             createdAt: created, urlIdentity: nil, urlIdentityState: .none,             urlIdentityRuleID: nil, workURLString: nil)     }      /// Req 8.3, Q22: a membership whose Work has not arrived. It imports     /// unattached, keeps the Work it names, and is deleted only with that Work.-    private static var orphanMembership: BackupV14Membership {-        BackupV14Membership(+    private static var orphanMembership: BackupV15Membership {+        BackupV15Membership(             id: orphanMembershipID, workID: absentWorkID, hostname: plainHost,             createdAt: created, urlIdentity: "plain.example/absent",             urlIdentityState: .legacyUnverified, urlIdentityRuleID: nil, workURLString: nil)     }      /// Req 5.5: the reader said these two are not the same work.-    private static var distinctPair: BackupV14DistinctPair {+    private static var distinctPair: BackupV15DistinctPair {         let ids = WorkDistinctPair.sortedIDs(typedWorkID, foldedWorkID)-        return BackupV14DistinctPair(+        return BackupV15DistinctPair(             id: distinctPairID, lowerWorkID: ids.lower, higherWorkID: ids.higher,             recordedAt: created)     }@@ -688,8 +683,8 @@ enum BackupGoldenLibrary {     /// It is also the Work carrying all three V10 status fields **off** their     /// defaults (Req 8.1), so the golden pins their spellings rather than only     /// the ones a fresh row would have anyway.-    private static var typedWork: BackupV14Work {-        BackupV14Work(+    private static var typedWork: BackupV15Work {+        BackupV15Work(             id: typedWorkID, displayTitle: workName, lastParsedTitle: workName,             genericNotes: genericNotes, genreTags: ["fantasy"], titleProvenance: .parsed,             workStatus: .hiatus, readingStatus: .abandoned,@@ -712,8 +707,8 @@ enum BackupGoldenLibrary {      /// The work citing the **folded** type row, so the import's canonical chase     /// and the export's directory both have something to resolve.-    private static var foldedWork: BackupV14Work {-        BackupV14Work(+    private static var foldedWork: BackupV15Work {+        BackupV15Work(             id: foldedWorkID, displayTitle: "Plain Work", lastParsedTitle: nil,             genericNotes: "", genreTags: [], titleProvenance: .manual,             workStatus: .finished, readingStatus: .finished, verdict: "",@@ -726,9 +721,9 @@ enum BackupGoldenLibrary {     /// The untyped work. A pre-feature `typeRaw` has not been carried since 7/8     /// (`multi-site-works` Req 10.3, Q16), so this is what such a Work archives     /// as.-    private static var legacyWork: BackupV14Work {-        BackupV14Work(-            id: legacyWorkID, displayTitle: "An Article", lastParsedTitle: nil,+    private static var legacyWork: BackupV15Work {+        BackupV15Work(+            id: legacyWorkID, displayTitle: "A Standalone", lastParsedTitle: nil,             genericNotes: "", genreTags: [], titleProvenance: .manual,             workStatus: .ongoing, readingStatus: .reading, verdict: "",             releaseDays: [],@@ -743,14 +738,14 @@ enum BackupGoldenLibrary {     // MARK: The entries      /// The v3 key embeds host + resolved Work name + sequence.-    private static var notedEntry: BackupV14Entry {+    private static var notedEntry: BackupV15Entry {         let rawURL = "https://\(taughtHost)/read?chapter=94&x=1"         let key = EntryIdentityKeyV3Codec.encode(             try! URLSequenceNameIdentity(                 hostname: ExactScalarString(taughtHost),                 workName: ExactScalarString(workName),                 chapterSequence: ExactScalarString("94")))-        return BackupV14Entry(+        return BackupV15Entry(             id: notedEntryID, captureTitle: titlePrefix + workName, captureTitleSource: .host,             rawURL: rawURL, canonicalURL: nil, hostname: taughtHost,             entryIdentityKey: key, conservativeIdentityKey: rawURL,@@ -769,9 +764,9 @@ enum BackupGoldenLibrary {      /// The untaught site's Entry: a conservative key, which is what capture     /// writes where no rule has been taught.-    private static var plainEntry: BackupV14Entry {+    private static var plainEntry: BackupV15Entry {         let rawURL = "https://\(plainHost)/read/7"-        return BackupV14Entry(+        return BackupV15Entry(             id: plainEntryID, captureTitle: "Plain Work", captureTitleSource: .manual,             rawURL: rawURL, canonicalURL: nil, hostname: plainHost,             entryIdentityKey: rawURL, conservativeIdentityKey: rawURL,@@ -783,16 +778,16 @@ enum BackupGoldenLibrary {                 chapterTitle: try! FieldProvenance(kind: .manual), workAssignment: .manual))     } -    /// The articles site's Entry, and the fixture's only `canonicalURL`: a+    /// The trimmed site's Entry, and the fixture's only `canonicalURL`: a     /// capture whose raw URL carried a tracking parameter the canonical form     /// drops.-    private static var articleEntry: BackupV14Entry {-        let rawURL = "https://\(articlesHost)/posts/hello?utm_source=share"-        return BackupV14Entry(-            id: articleEntryID, captureTitle: "An Article" + articleTitleSuffix,+    private static var trimmedEntry: BackupV15Entry {+        let rawURL = "https://\(trimmedHost)/posts/hello?utm_source=share"+        return BackupV15Entry(+            id: trimmedEntryID, captureTitle: "A Standalone" + trimmedTitleSuffix,             captureTitleSource: .host,-            rawURL: rawURL, canonicalURL: "https://\(articlesHost)/posts/hello",-            hostname: articlesHost,+            rawURL: rawURL, canonicalURL: "https://\(trimmedHost)/posts/hello",+            hostname: trimmedHost,             entryIdentityKey: rawURL, conservativeIdentityKey: rawURL,             identityBasis: .conservative,             urlWorkIdentity: nil, chapterSequence: nil, chapterTitle: nil,@@ -803,8 +798,8 @@ enum BackupGoldenLibrary {      // MARK: The characters -    private static var guide: BackupV14Character {-        BackupV14Character(+    private static var guide: BackupV15Character {+        BackupV15Character(             id: guideID, workID: typedWorkID, name: "Grover", nameKey: "grover",             aliases: ["Klar"], note: "The guide.",             facts: [@@ -817,14 +812,14 @@ enum BackupGoldenLibrary {     }      /// The sync orphan: a character whose work has not arrived.-    private static var orphan: BackupV14Character {-        BackupV14Character(+    private static var orphan: BackupV15Character {+        BackupV15Character(             id: orphanID, workID: nil, name: "The Stranger", nameKey: "the stranger",             aliases: [], note: "", facts: [], createdAt: created, modifiedAt: created)     } -    private static var candidateSuppression: BackupV14Suppression {-        BackupV14Suppression(+    private static var candidateSuppression: BackupV15Suppression {+        BackupV15Suppression(             id: candidateSuppressionID, workID: typedWorkID,             kindRaw: CharacterSuppressionKind.candidate.rawValue, nameKey: "the crowned one",             sourceKindRaw: nil, sourceEntryID: nil, evidence: nil,@@ -832,8 +827,8 @@ enum BackupGoldenLibrary {     }      /// A fact suppression, which is the shape that carries a source and evidence.-    private static var factSuppression: BackupV14Suppression {-        BackupV14Suppression(+    private static var factSuppression: BackupV15Suppression {+        BackupV15Suppression(             id: factSuppressionID, workID: typedWorkID,             kindRaw: CharacterSuppressionKind.fact.rawValue, nameKey: "grover",             sourceKindRaw: SourceRef.entry(notedEntryID).kindRaw, sourceEntryID: notedEntryID,@@ -845,8 +840,8 @@ enum BackupGoldenLibrary {      /// The place the reader accepted: aliases, a note and a fact citing the     /// noted Entry, so the golden pins every column of the record.-    private static var keep: BackupV14Place {-        BackupV14Place(+    private static var keep: BackupV15Place {+        BackupV15Place(             id: keepID, workID: typedWorkID, name: "The High Keep",             nameKey: "high keep", aliases: ["The Keep"],             note: "The fortress above the pass.",@@ -861,15 +856,15 @@ enum BackupGoldenLibrary {     /// Req 5.5's orphan. A place names its owner in a column, so "no owner" is a     /// `workID` no record of this archive answers for — the same absent Work the     /// orphan membership names, which keeps the fixture's cast small.-    private static var orphanPlace: BackupV14Place {-        BackupV14Place(+    private static var orphanPlace: BackupV15Place {+        BackupV15Place(             id: orphanPlaceID, workID: absentWorkID, name: "The Drowned Road",             nameKey: "drowned road", aliases: [], note: "", facts: [],             createdAt: created, modifiedAt: created)     } -    private static var placeCandidateSuppression: BackupV14PlaceSuppression {-        BackupV14PlaceSuppression(+    private static var placeCandidateSuppression: BackupV15PlaceSuppression {+        BackupV15PlaceSuppression(             id: placeCandidateSuppressionID, workID: typedWorkID,             kindRaw: CharacterSuppressionKind.candidate.rawValue, nameKey: "low road",             sourceKindRaw: nil, sourceEntryID: nil, evidence: nil,@@ -878,8 +873,8 @@ enum BackupGoldenLibrary {      /// The place fact suppression, which is the shape that carries a source and     /// evidence.-    private static var placeFactSuppression: BackupV14PlaceSuppression {-        BackupV14PlaceSuppression(+    private static var placeFactSuppression: BackupV15PlaceSuppression {+        BackupV15PlaceSuppression(             id: placeFactSuppressionID, workID: typedWorkID,             kindRaw: CharacterSuppressionKind.fact.rawValue, nameKey: "high keep",             sourceKindRaw: SourceRef.entry(notedEntryID).kindRaw, sourceEntryID: notedEntryID,
Packages/AsterismCore/Tests/AsterismCoreTests/BackupGroupProjectionTests.swift Modified +37 / -37
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupGroupProjectionTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupGroupProjectionTests.swiftindex 40586e88..3ff3d26e 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupGroupProjectionTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupGroupProjectionTests.swift@@ -36,7 +36,7 @@ struct BackupGroupProjectionTests {         store.addEntry(id: shared, key: "chapter-1", capturedAt: 40, sharedAt: 90, title: "Chapter 1")         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }          #expect(payload.entries.count == 1)         let entry = try #require(payload.entries.first)@@ -58,15 +58,15 @@ struct BackupGroupProjectionTests {         store.addEntry(id: shared, key: "chapter-1", capturedAt: 40)         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }-        let encoded = try BackupV14Codec.encode(+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }+        let encoded = try BackupV15Codec.encode(             payload: payload,-            metadata: BackupV14Metadata(appBuild: "1", exportedAt: DuplicateStore.epoch))+            metadata: BackupV15Metadata(appBuild: "1", exportedAt: DuplicateStore.epoch))          // The decode gate is the reference validator, which refuses a payload         // holding one UUID twice — the shape the projection exists to prevent         // reaching it.-        let decoded = try BackupV14Codec.decode(encoded)+        let decoded = try BackupV15Codec.decode(encoded)         #expect(decoded.payload.entries.count == 1)     } @@ -86,7 +86,7 @@ struct BackupGroupProjectionTests {         store.addEntry(key: "chapter-2", capturedAt: 20, work: second, site: site)         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }          #expect(payload.works.count == 1)         let work = try #require(payload.works.first)@@ -114,7 +114,7 @@ struct BackupGroupProjectionTests {         store.addEntry(id: entryID, key: "chapter-1", capturedAt: 30, work: second, site: site)         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }          #expect(payload.entries.count == 1)         let work = try #require(payload.works.first)@@ -147,7 +147,7 @@ struct BackupGroupProjectionTests {         store.addEntry(id: shared, key: "chapter-1", capturedAt: 40, work: work, site: site)         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }          let entry = try #require(payload.entries.first)         let archivedWork = try #require(payload.works.first)@@ -157,10 +157,10 @@ struct BackupGroupProjectionTests {         // names none (Req 9.3), so an Entry that points nowhere is unattached and         // nothing contradicts it.         #expect(archivedWork.id == work.id)-        let encoded = try BackupV14Codec.encode(+        let encoded = try BackupV15Codec.encode(             payload: payload,-            metadata: BackupV14Metadata(appBuild: "1", exportedAt: DuplicateStore.epoch))-        _ = try BackupV14Codec.decode(encoded)+            metadata: BackupV15Metadata(appBuild: "1", exportedAt: DuplicateStore.epoch))+        _ = try BackupV15Codec.decode(encoded)     }      /// The Definitions' assignment normalisation, in the export (Q106): rows@@ -195,7 +195,7 @@ struct BackupGroupProjectionTests {         rowB.editCitations { $0.workAssignment = .manual }         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }          #expect(payload.entries.count == 1)         let entry = try #require(payload.entries.first)@@ -205,10 +205,10 @@ struct BackupGroupProjectionTests {         // `entryIDs` lists is gone with the child lists (Req 9.3), and what is         // left is the Entry naming one of them.         #expect(payload.works.count == 2)-        let encoded = try BackupV14Codec.encode(+        let encoded = try BackupV15Codec.encode(             payload: payload,-            metadata: BackupV14Metadata(appBuild: "1", exportedAt: DuplicateStore.epoch))-        _ = try BackupV14Codec.decode(encoded)+            metadata: BackupV15Metadata(appBuild: "1", exportedAt: DuplicateStore.epoch))+        _ = try BackupV15Codec.decode(encoded)     }      // MARK: - Req 8.3: unique-UUID set members never block export@@ -224,7 +224,7 @@ struct BackupGroupProjectionTests {         store.addEntry(key: "chapter-1", capturedAt: 20, note: "from the laptop")         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }          #expect(payload.entries.count == 2)         #expect(Set(payload.entries.map(\.note)) == ["from the phone", "from the laptop"])@@ -242,7 +242,7 @@ struct BackupGroupProjectionTests {         try store.commit()          let payload = try expectTornRefusal {-            _ = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+            _ = try store.read { try LibraryRepository.projectV15Payload(context: $0) }         }          #expect(payload.count == 1)@@ -268,7 +268,7 @@ struct BackupGroupProjectionTests {         try store.commit()          let payload = try expectTornRefusal {-            _ = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+            _ = try store.read { try LibraryRepository.projectV15Payload(context: $0) }         }          #expect(payload.count == 2)@@ -288,7 +288,7 @@ struct BackupGroupProjectionTests {         try store.commit()          let payload = try expectTornRefusal {-            _ = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+            _ = try store.read { try LibraryRepository.projectV15Payload(context: $0) }         }          #expect(payload.count == 1)@@ -321,7 +321,7 @@ struct BackupGroupProjectionTests {         try store.commit()          let payload = try expectTornRefusal {-            _ = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+            _ = try store.read { try LibraryRepository.projectV15Payload(context: $0) }         }          #expect(payload.count == 1)@@ -357,7 +357,7 @@ struct BackupGroupProjectionTests {         try store.commit()          let payload = try expectTornRefusal {-            _ = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+            _ = try store.read { try LibraryRepository.projectV15Payload(context: $0) }         }          #expect(payload.count == 2)@@ -393,7 +393,7 @@ struct BackupGroupProjectionTests {         try store.commit()          let payload = try expectTornRefusal {-            _ = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+            _ = try store.read { try LibraryRepository.projectV15Payload(context: $0) }         }          #expect(payload.count == 2)@@ -414,7 +414,7 @@ struct BackupGroupProjectionTests {         try store.commit()          _ = try expectTornRefusal {-            _ = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+            _ = try store.read { try LibraryRepository.projectV15Payload(context: $0) }         }          // The resolution outcome: both rows carry the chosen variant (Req@@ -423,7 +423,7 @@ struct BackupGroupProjectionTests {         second.note = "from the phone"         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }         #expect(payload.entries.count == 1)         #expect(payload.entries.first?.note == "from the phone")     }@@ -441,7 +441,7 @@ struct BackupGroupProjectionTests {         store.addEntry(key: "chapter-1", capturedAt: 10, site: first)         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }          #expect(payload.titlePatterns.count == 1)         #expect(payload.sites.count == 1)@@ -450,10 +450,10 @@ struct BackupGroupProjectionTests {         // The archive re-decodes: a payload holding one rule UUID twice is what         // the reference validator refuses, and what the store validates it must         // be able to export (task 20.4).-        let encoded = try BackupV14Codec.encode(+        let encoded = try BackupV15Codec.encode(             payload: payload,-            metadata: BackupV14Metadata(appBuild: "1", exportedAt: DuplicateStore.epoch))-        _ = try BackupV14Codec.decode(encoded)+            metadata: BackupV15Metadata(appBuild: "1", exportedAt: DuplicateStore.epoch))+        _ = try BackupV15Codec.decode(encoded)     }      /// The dedup must not cost a hostname its active title rule.@@ -476,14 +476,14 @@ struct BackupGroupProjectionTests {         store.addEntry(key: "chapter-1", capturedAt: 10, site: site)         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }          #expect(payload.titlePatterns.count == 1)         #expect(payload.titlePatterns.first?.isActive == true)-        let encoded = try BackupV14Codec.encode(+        let encoded = try BackupV15Codec.encode(             payload: payload,-            metadata: BackupV14Metadata(appBuild: "1", exportedAt: DuplicateStore.epoch))-        _ = try BackupV14Codec.decode(encoded)+            metadata: BackupV15Metadata(appBuild: "1", exportedAt: DuplicateStore.epoch))+        _ = try BackupV15Codec.decode(encoded)     }      /// The URL-rule half, which fails *silently* rather than refusing: nothing@@ -502,7 +502,7 @@ struct BackupGroupProjectionTests {         store.addEntry(key: "chapter-1", capturedAt: 10, site: site)         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }          #expect(payload.urlRules.count == 1)         #expect(payload.urlRules.first?.isCurrent == true)@@ -536,7 +536,7 @@ struct BackupGroupProjectionTests {         #expect(facts.first(where: \.isActive)?.version == 3)         #expect(try store.diagnose().quarantineMap().isEmpty) -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }          #expect(payload.titlePatterns.count == 1)         #expect(payload.titlePatterns.first?.isActive == true)@@ -558,7 +558,7 @@ struct BackupGroupProjectionTests {         store.addEntry(key: "chapter-1", capturedAt: 10, site: site)         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }          #expect(payload.titlePatterns.count == 1)         #expect(payload.titlePatterns.first?.isActive == true)@@ -594,7 +594,7 @@ struct BackupGroupProjectionTests {         }         try store.commit() -        let payload = try store.read { try LibraryRepository.projectV14Payload(context: $0) }+        let payload = try store.read { try LibraryRepository.projectV15Payload(context: $0) }          let pattern = try #require(payload.titlePatterns.first)         #expect(pattern.id == ruleID)@@ -608,7 +608,7 @@ struct BackupGroupProjectionTests {             try body()             Issue.record("expected a torn-groups refusal, but the export proceeded")             return TornGroupsPayload(count: 0, blockingWorkSet: nil)-        } catch let error as BackupV14ExportError {+        } catch let error as BackupV15ExportError {             guard case .tornGroups(let payload) = error else {                 Issue.record("expected .tornGroups, got \(error)")                 return TornGroupsPayload(count: 0, blockingWorkSet: nil)
Packages/AsterismCore/Tests/AsterismCoreTests/BackupGroupRoundTripTests.swift Modified +17 / -17
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupGroupRoundTripTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupGroupRoundTripTests.swiftindex ab04dc3b..62db448c 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupGroupRoundTripTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupGroupRoundTripTests.swift@@ -38,7 +38,7 @@ struct BackupGroupRoundTripTests {         let entryID = UUID()         try await repository.seedSplitEntryGroup(id: entryID) -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()         let record = try #require(payload.entries.first)         let before = try await repository.entryRows(id: entryID)         #expect(before.count == 2)@@ -63,7 +63,7 @@ struct BackupGroupRoundTripTests {         let sourceRepository = try await source.open()         let entryID = UUID()         try await sourceRepository.seedSplitEntryGroup(id: entryID)-        let payload = try await sourceRepository.backupV14Snapshot()+        let payload = try await sourceRepository.backupV15Snapshot()          let target = try RoundTripEnvironment()         let targetRepository = try await target.open()@@ -87,7 +87,7 @@ struct BackupGroupRoundTripTests {         let workID = UUID()         try await repository.seedSplitWorkGroup(id: workID) -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()         let record = try #require(payload.works.first)         let before = try await repository.workRows(id: workID)         #expect(before.count == 2)@@ -117,7 +117,7 @@ struct BackupGroupRoundTripTests {         let sourceRepository = try await source.open()         let workID = UUID()         try await sourceRepository.seedSplitWorkGroup(id: workID)-        let payload = try await sourceRepository.backupV14Snapshot()+        let payload = try await sourceRepository.backupV15Snapshot()          let target = try RoundTripEnvironment()         let targetRepository = try await target.open()@@ -149,7 +149,7 @@ struct BackupGroupRoundTripTests {         let sourceRepository = try await source.open()         _ = try await sourceRepository.confirmImport(plan: RoundTripEnvironment.plan(payload)) -        let exported = try await sourceRepository.backupV14Snapshot()+        let exported = try await sourceRepository.backupV15Snapshot()          let target = try RoundTripEnvironment()         let targetRepository = try await target.open()@@ -157,7 +157,7 @@ struct BackupGroupRoundTripTests {          // Req 5.3's citation half, as decoded values rather than as bytes.         let original = try #require(payload.entries.first?.citations)-        let citations = try await targetRepository.citations(entryID: BackupV14Fixtures.entryID)+        let citations = try await targetRepository.citations(entryID: BackupV15Fixtures.entryID)         #expect(citations == original)         // Named, so the comparison above cannot pass on two empty values.         #expect(citations?.chapterSequence?.id == Self.citedURLRuleID)@@ -172,7 +172,7 @@ struct BackupGroupRoundTripTests {     /// used to refuse are not merely decodable, they **commit**, and the rows     /// land holding the versions the archive named.     ///-    /// `BackupV14ArchiveTests` stops at a decode, which only proves the reference+    /// `BackupV15ArchiveTests` stops at a decode, which only proves the reference     /// checks let the file through. Here the same fixture goes through     /// `confirmImport` into an empty library: two title patterns share version 1     /// with one of them marked, and the marked URL rule sits *below* a retired@@ -180,7 +180,7 @@ struct BackupGroupRoundTripTests {     /// renumbering pass would admit it and move the versions.     @Test("An archive with duplicate and non-greatest rule versions imports with its versions")     func duplicateAndNonGreatestVersionsImportIntoAnEmptyLibrary() async throws {-        let payload = BackupV14Fixtures.duplicateVersionsPayload()+        let payload = BackupV15Fixtures.duplicateVersionsPayload()         let host = try #require(payload.sites.first?.hostname)          let target = try RoundTripEnvironment()@@ -211,7 +211,7 @@ struct BackupGroupRoundTripTests {     private static let citedURLRuleID = UUID(         uuidString: "dddddddd-dddd-dddd-dddd-dddddddddddd")! -    private static func expectedPatternRows(_ payload: BackupV14Payload) -> [RuleRowFacts] {+    private static func expectedPatternRows(_ payload: BackupV15Payload) -> [RuleRowFacts] {         payload.titlePatterns             .map {                 RuleRowFacts(@@ -221,7 +221,7 @@ struct BackupGroupRoundTripTests {             .sorted { $0.id.uuidString < $1.id.uuidString }     } -    private static func expectedURLRuleRows(_ payload: BackupV14Payload) -> [RuleRowFacts] {+    private static func expectedURLRuleRows(_ payload: BackupV15Payload) -> [RuleRowFacts] {         payload.urlRules             .map {                 RuleRowFacts(@@ -234,22 +234,22 @@ struct BackupGroupRoundTripTests {     /// `composedPayload` — one taught Site, one cited title rule, one cited URL     /// rule, one Entry citing both — plus a retired row of each kind sitting at     /// a higher version than the marked one.-    private static func versionSpreadPayload() -> BackupV14Payload {-        let base = BackupV14Fixtures.composedPayload()+    private static func versionSpreadPayload() -> BackupV15Payload {+        let base = BackupV15Fixtures.composedPayload()         let host = "example.com"-        let retired = BackupV14Fixtures.created.addingTimeInterval(-60)+        let retired = BackupV15Fixtures.created.addingTimeInterval(-60) -        let retiredPattern = BackupV14TitlePattern(+        let retiredPattern = BackupV15TitlePattern(             id: UUID(uuidString: "cccccccc-cccc-cccc-cccc-ccccccccccc9")!,             siteHostname: host, version: 9, isActive: false, createdAt: retired,             definition: StoredPatternDefinition(definition: .wholeTitle))-        let retiredRule = BackupV14URLRule(+        let retiredRule = BackupV15URLRule(             id: UUID(uuidString: "dddddddd-dddd-dddd-dddd-ddddddddddd9")!,             version: 7, isCurrent: false, createdAt: retired, origin: .readerTaught,             definition: .sequence(locator: .query(name: ExactScalarString("part"))),             siteHostname: host) -        return BackupV14Payload(+        return BackupV15Payload(             entries: base.entries, works: base.works, sites: base.sites,             titlePatterns: base.titlePatterns + [retiredPattern],             urlRules: base.urlRules + [retiredRule],@@ -288,7 +288,7 @@ private struct RoundTripEnvironment {      /// The plan `confirmImport` takes, straight off a payload the export just     /// produced — which is what a reader restoring their own backup hands it.-    static func plan(_ payload: BackupV14Payload) -> BackupImportPlan {+    static func plan(_ payload: BackupV15Payload) -> BackupImportPlan {         BackupImportPlan(             metadata: BackupImportMetadata(                 formatVersion: 8, schemaVersion: 9, appBuild: "test-1.0",
Packages/AsterismCore/Tests/AsterismCoreTests/BackupImportTransactionTests.swift Modified +65 / -126
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupImportTransactionTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupImportTransactionTests.swiftindex 1e04d7fb..653bfb74 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupImportTransactionTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupImportTransactionTests.swift@@ -229,46 +229,18 @@ struct BackupImportTransactionTests {      // MARK: - Req 4.1, Decision 10: the Site designation restores over an existing row -    /// T-2051. The archive's `.articles` designation reaching a row the library-    /// already holds.-    ///-    /// The failure this pins: a bad merge leaves `news.example` `.untaught` with-    /// no rules, the reader restores last week's archive, and the row keeps the-    /// damaged state — `modeRaw` was never applied to a matched row, `displayName`-    /// only where the local one was empty (which `Site.init` makes unreachable:-    /// it defaults the name to the hostname), and the junk-suffix rule only where-    /// the local one was nil. The reader was told the import committed.-    @Test("An archive's articles designation is restored onto an existing untaught row")-    func articlesDesignationRestoredOntoUntaughtRow() async throws {-        let env = try TestEnvironment()-        try createReadySiteStore(at: env.configuration, hostname: "news.example", mode: .untaught)-        let (_, repository) = try await LibraryRepository.openForApp(env.configuration)--        let junk = try junkSuffixRule(anchorCount: 1)-        _ = try await repository.confirmImport(-            plan: try makeSiteDesignationPlan(-                hostname: "news.example", displayName: "News", mode: .articles,-                junkSuffixRule: junk))--        #expect(-            try await repository.siteFacts() == [-                SiteFacts(-                    hostname: "news.example", displayName: "News", mode: .articles,-                    junkSuffixRule: junk, activePatterns: 0)-            ])-    }-     /// The same restore run twice. Convergence, not just correctness: the     /// designation is a value write, so a second application of the same archive     /// has to land on the same row unchanged.     @Test("Restoring the same designation twice converges")     func designationRestoreIsIdempotent() async throws {         let env = try TestEnvironment()-        try createReadySiteStore(at: env.configuration, hostname: "news.example", mode: .untaught)+        try createReadySiteStore(+            at: env.configuration, hostname: "novels.example", mode: .untaught)         let (_, repository) = try await LibraryRepository.openForApp(env.configuration)         let plan = try makeSiteDesignationPlan(-            hostname: "news.example", displayName: "News", mode: .articles,-            junkSuffixRule: try junkSuffixRule(anchorCount: 1))+            hostname: "novels.example", displayName: "Novels", mode: .taught,+            activePattern: true)          _ = try await repository.confirmImport(plan: plan)         let first = try await repository.siteFacts()@@ -294,91 +266,75 @@ struct BackupImportTransactionTests {         #expect(             try await repository.siteFacts() == [                 SiteFacts(-                    hostname: "novels.example", displayName: "novels.example", mode: .taught,-                    junkSuffixRule: nil, activePatterns: 1)+                    hostname: "novels.example", displayName: "novels.example",+                    mode: .taught, activePatterns: 1)             ])     } -    /// A junk-suffix rule the reader re-taught and then lost. The old spelling-    /// wrote the archive's rule only onto a row holding none, so the corrected-    /// one could never come back.-    @Test("An archive's junk-suffix rule replaces the one an articles row holds")-    func archiveJunkSuffixRuleReplacesTheLocalOne() async throws {-        let env = try TestEnvironment()-        try createReadySiteStore(-            at: env.configuration, hostname: "news.example", mode: .articles,-            junkSuffixRule: try junkSuffixRule(anchorCount: 1))-        let (_, repository) = try await LibraryRepository.openForApp(env.configuration)--        let corrected = try junkSuffixRule(anchorCount: 2)-        _ = try await repository.confirmImport(-            plan: try makeSiteDesignationPlan(-                hostname: "news.example", mode: .articles, junkSuffixRule: corrected))--        #expect(try await repository.siteFacts().first?.junkSuffixRule == corrected)-    }+    // `archivedJunkSuffixRuleIsNeverApplied` stood here. It pinned that both+    // import branches wrote nil into `Site.junkSuffixRule` rather than carrying+    // the archive's rule across; V16 removed the column, so there is no longer+    // a property for either branch to write (`remove-article-mode` Req 4.1),+    // and 15/16 removed the field from the archive record too (Req 5.1), so+    // there is nothing left on either side of the copy.      /// The other side of Decision 10: the rules the library holds outrank the     /// archive's claim about them.     ///-    /// A `.taught` row holding an active title rule cannot legally be `.articles`-    /// and cannot legally retain a junk-suffix rule, so an older archive-    /// describing the hostname as `.articles` is declined rather than written.-    /// The old spelling wrote the junk rule anyway — mode and junk rule moved-    /// independently — and left a `.taught` row retaining one, which is the-    /// quarantine tuple again.+    /// A row holding no active title rule cannot legally be `.taught`, so an+    /// archive describing the hostname that way — the rule that justifies it+    /// having not arrived — is declined rather than written. Writing the mode+    /// alone would leave `.taught` with no active rule, which is the quarantine+    /// tuple.     ///     /// **Declined whole includes the name.** The archive's display name differs     /// from the local one here deliberately: a spelling that gated only the mode-    /// and the junk rule still overwrote `displayName`, which is a partial-    /// application of a record the library refused.+    /// still overwrote `displayName`, which is a partial application of a record+    /// the library refused.     @Test("A designation the row's rules contradict is declined, name included")     func contradictedDesignationIsDeclined() async throws {         let env = try TestEnvironment()         try createReadySiteStore(-            at: env.configuration, hostname: "novels.example", mode: .taught, activePattern: true)+            at: env.configuration, hostname: "novels.example", mode: .untaught)         let (_, repository) = try await LibraryRepository.openForApp(env.configuration)          _ = try await repository.confirmImport(             plan: try makeSiteDesignationPlan(-                hostname: "novels.example", displayName: "Novels Online", mode: .articles,-                junkSuffixRule: try junkSuffixRule(anchorCount: 1)))+                hostname: "novels.example", displayName: "Novels Online", mode: .taught))          #expect(             try await repository.siteFacts() == [                 SiteFacts(-                    hostname: "novels.example", displayName: "novels.example", mode: .taught,-                    junkSuffixRule: nil, activePatterns: 1)+                    hostname: "novels.example", displayName: "novels.example",+                    mode: .untaught, activePatterns: 0)             ])     }      /// An archived `.untaught` record is not a designation to restore.     ///-    /// The tuple gate alone would let it through: the reader marks-    /// `news.example` as articles *after* the export, and marking a never-taught-    /// site leaves no patterns and no URL rules, so `(.untaught, [], [])` is-    /// trivially legal. Applying it would write `mode = .untaught,-    /// junkSuffixRule = nil` and silently un-designate the site the reader just-    /// marked. `.untaught` is the absence of a claim — no reader action writes-    /// it — so the record is declined before the gate, name included.-    @Test("An archived untaught record does not un-designate a newly marked articles row")+    /// The tuple gate alone would let it through: the reader teaches+    /// `novels.example` *after* the export, and the archive's own record names+    /// no rules, so `(.untaught, [], [])` is trivially legal for it. Applying it+    /// would write `mode = .untaught` and silently un-teach the site the reader+    /// just taught. `.untaught` is the absence of a claim — no reader action+    /// writes it — so the record is declined before the gate, name included.+    @Test("An archived untaught record does not un-designate a newly taught row")     func archivedUntaughtRecordDoesNotUndesignate() async throws {         let env = try TestEnvironment()-        let junk = try junkSuffixRule(anchorCount: 1)         try createReadySiteStore(-            at: env.configuration, hostname: "news.example", mode: .articles,-            junkSuffixRule: junk)+            at: env.configuration, hostname: "novels.example", mode: .taught,+            activePattern: true)         let (_, repository) = try await LibraryRepository.openForApp(env.configuration)          _ = try await repository.confirmImport(             plan: try makeSiteDesignationPlan(-                hostname: "news.example", displayName: "News", mode: .untaught))+                hostname: "novels.example", displayName: "Novels", mode: .untaught))          #expect(             try await repository.siteFacts() == [                 SiteFacts(-                    hostname: "news.example", displayName: "news.example", mode: .articles,-                    junkSuffixRule: junk, activePatterns: 0)+                    hostname: "novels.example", displayName: "novels.example",+                    mode: .taught, activePatterns: 1)             ])     } @@ -454,8 +410,8 @@ struct BackupImportTransactionTests {         #expect(             try await repository.siteFacts() == [                 SiteFacts(-                    hostname: "novels.example", displayName: "novels.example", mode: .taught,-                    junkSuffixRule: nil, activePatterns: 1)+                    hostname: "novels.example", displayName: "novels.example",+                    mode: .taught, activePatterns: 1)             ])     } @@ -727,7 +683,7 @@ private func createReadyEmptyV3Store(at configuration: LibraryConfiguration) thr         at: configuration.storeURL.deletingLastPathComponent(),         withIntermediateDirectories: true     )-    let schema = Schema(versionedSchema: AsterismSchemaV15.self)+    let schema = Schema(versionedSchema: AsterismSchemaV16.self)     let storeConfig = ModelConfiguration(         "AsterismV3",         schema: schema,@@ -736,12 +692,12 @@ private func createReadyEmptyV3Store(at configuration: LibraryConfiguration) thr     )     let container = try ModelContainer(         for: schema,-        migrationPlan: AsterismV15MigrationPlan.self,+        migrationPlan: AsterismV16MigrationPlan.self,         configurations: [storeConfig]     )     let context = ModelContext(container)     try context.save()-    try Data("14\n".utf8).write(to: configuration.readinessMarkerURL, options: .atomic)+    try Data("16\n".utf8).write(to: configuration.readinessMarkerURL, options: .atomic) }  private func createReadyPopulatedV3Store(at configuration: LibraryConfiguration) throws {@@ -750,7 +706,7 @@ private func createReadyPopulatedV3Store(at configuration: LibraryConfiguration)         at: configuration.storeURL.deletingLastPathComponent(),         withIntermediateDirectories: true     )-    let schema = Schema(versionedSchema: AsterismSchemaV15.self)+    let schema = Schema(versionedSchema: AsterismSchemaV16.self)     let storeConfig = ModelConfiguration(         "AsterismV3",         schema: schema,@@ -759,7 +715,7 @@ private func createReadyPopulatedV3Store(at configuration: LibraryConfiguration)     )     let container = try ModelContainer(         for: schema,-        migrationPlan: AsterismV15MigrationPlan.self,+        migrationPlan: AsterismV16MigrationPlan.self,         configurations: [storeConfig]     )     let context = ModelContext(container)@@ -782,7 +738,7 @@ private func createReadyPopulatedV3Store(at configuration: LibraryConfiguration)     // seeded already linked.     entry.site = site     try context.save()-    try Data("14\n".utf8).write(to: configuration.readinessMarkerURL, options: .atomic)+    try Data("16\n".utf8).write(to: configuration.readinessMarkerURL, options: .atomic) }  /// A certified library holding exactly one Site in the given state, for the@@ -793,7 +749,6 @@ private func createReadySiteStore(     hostname: String,     displayName: String? = nil,     mode: SiteMode,-    junkSuffixRule: JunkSuffixRule? = nil,     activePattern: Bool = false,     patternID: UUID? = nil,     patternVersion: Int = 1@@ -803,7 +758,7 @@ private func createReadySiteStore(         at: configuration.storeURL.deletingLastPathComponent(),         withIntermediateDirectories: true     )-    let schema = Schema(versionedSchema: AsterismSchemaV15.self)+    let schema = Schema(versionedSchema: AsterismSchemaV16.self)     let storeConfig = ModelConfiguration(         "AsterismV3",         schema: schema,@@ -812,14 +767,13 @@ private func createReadySiteStore(     )     let container = try ModelContainer(         for: schema,-        migrationPlan: AsterismV15MigrationPlan.self,+        migrationPlan: AsterismV16MigrationPlan.self,         configurations: [storeConfig]     )     let context = ModelContext(container)     let site = Site(hostname: hostname, displayName: displayName)     context.insert(site)     site.mode = mode-    site.junkSuffixRule = junkSuffixRule     if activePattern {         let pattern = try TitlePattern(             id: patternID ?? UUID(),@@ -829,7 +783,7 @@ private func createReadySiteStore(         context.insert(pattern)     }     try context.save()-    try Data("14\n".utf8).write(to: configuration.readinessMarkerURL, options: .atomic)+    try Data("16\n".utf8).write(to: configuration.readinessMarkerURL, options: .atomic) }  /// A certified library holding **two** Site rows for one hostname, each taught@@ -848,7 +802,7 @@ private func createReadyDuplicateSiteStore(         at: configuration.storeURL.deletingLastPathComponent(),         withIntermediateDirectories: true     )-    let schema = Schema(versionedSchema: AsterismSchemaV15.self)+    let schema = Schema(versionedSchema: AsterismSchemaV16.self)     let storeConfig = ModelConfiguration(         "AsterismV3",         schema: schema,@@ -857,7 +811,7 @@ private func createReadyDuplicateSiteStore(     )     let container = try ModelContainer(         for: schema,-        migrationPlan: AsterismV15MigrationPlan.self,+        migrationPlan: AsterismV16MigrationPlan.self,         configurations: [storeConfig]     )     let context = ModelContext(container)@@ -872,18 +826,7 @@ private func createReadyDuplicateSiteStore(         context.insert(pattern)     }     try context.save()-    try Data("14\n".utf8).write(to: configuration.readinessMarkerURL, options: .atomic)-}--/// A junk-suffix rule with `anchorCount` end-anchored positions — the shape-/// `JunkSuffixRule` requires (offsets `n-1 … 0`, every origin `.end`). Two-/// different counts give two distinguishable rules.-private func junkSuffixRule(anchorCount: Int) throws -> JunkSuffixRule {-    try JunkSuffixRule(-        version: 1,-        anchors: try (0..<anchorCount).reversed().map {-            try SegmentPositionSpec(origin: .end, offset: $0)-        })+    try Data("16\n".utf8).write(to: configuration.readinessMarkerURL, options: .atomic) }  /// An archive describing one Site and nothing else — no entries, no works, so@@ -892,18 +835,17 @@ private func makeSiteDesignationPlan(     hostname: String,     displayName: String? = nil,     mode: SiteMode,-    junkSuffixRule: JunkSuffixRule? = nil,     activePattern: Bool = false,     patternID: UUID = UUID(uuidString: "00000000-0000-0000-0000-0000000000A1")!,     patternVersion: Int = 1 ) throws -> BackupImportPlan {     let epoch = Date(timeIntervalSince1970: 1_800_000_000)-    let site = BackupV14Site(+    let site = BackupV15Site(         hostname: hostname, displayName: displayName ?? hostname,-        mode: mode, junkSuffixRule: junkSuffixRule)-    let patterns: [BackupV14TitlePattern] = activePattern+        mode: mode)+    let patterns: [BackupV15TitlePattern] = activePattern         ? [-            BackupV14TitlePattern(+            BackupV15TitlePattern(                 // Fixed, not minted: two applications of one archive must match                 // the same rule row rather than insert a second one.                 id: patternID,@@ -929,11 +871,11 @@ private func makeSiteDesignationPlan( private func makeBulkImportPlan(entryCount: Int) throws -> BackupImportPlan {     let hostname = "bulk.example"     let epoch = Date(timeIntervalSince1970: 1_800_000_000)-    let site = BackupV14Site(-        hostname: hostname, displayName: hostname, mode: .untaught, junkSuffixRule: nil)-    let entries = (0..<entryCount).map { index -> BackupV14Entry in+    let site = BackupV15Site(+        hostname: hostname, displayName: hostname, mode: .untaught)+    let entries = (0..<entryCount).map { index -> BackupV15Entry in         let rawURL = "https://\(hostname)/read?chapter=\(index)"-        return BackupV14Entry(+        return BackupV15Entry(             id: UUID(), captureTitle: "Chapter \(index)", captureTitleSource: .host,             rawURL: rawURL, canonicalURL: nil, hostname: hostname,             entryIdentityKey: rawURL,@@ -992,7 +934,7 @@ private func makeMinimalImportPlan(     let patternProvenance = try FieldProvenance(         kind: .pattern, patternID: patternID) -    let entry = BackupV14Entry(+    let entry = BackupV15Entry(         id: entryID,         captureTitle: "Imported Chapter",         captureTitleSource: .networkFetch,@@ -1018,7 +960,7 @@ private func makeMinimalImportPlan(             workAssignment: .pattern(CitedRule(id: patternID)))     ) -    let work = BackupV14Work(+    let work = BackupV15Work(         id: workID,         displayTitle: "Imported Work",         lastParsedTitle: "Imported Work",@@ -1037,7 +979,7 @@ private func makeMinimalImportPlan(      // Req 9.1: the Work's site presence is its membership, and Req 9.5 requires     // one on the Entry's hostname.-    let membership = BackupV14Membership(+    let membership = BackupV15Membership(         // Derived from the Work rather than minted: two archives *of one         // library* carry the same membership row, which is what makes a         // re-import an update rather than a second row on the same hostname.@@ -1051,7 +993,7 @@ private func makeMinimalImportPlan(         workURLString: workURL     ) -    let pattern = BackupV14TitlePattern(+    let pattern = BackupV15TitlePattern(         id: patternID,         siteHostname: siteHostname,         version: 1,@@ -1063,8 +1005,8 @@ private func makeMinimalImportPlan(                 ignored: []))     ) -    let urlRules: [BackupV14URLRule] = includeURLRule ? [-        BackupV14URLRule(+    let urlRules: [BackupV15URLRule] = includeURLRule ? [+        BackupV15URLRule(             id: urlRuleID,             version: 1,             isCurrent: true,@@ -1080,11 +1022,10 @@ private func makeMinimalImportPlan(         )     ] : [] -    let site = BackupV14Site(+    let site = BackupV15Site(         hostname: siteHostname,         displayName: siteHostname,-        mode: .taught,-        junkSuffixRule: nil+        mode: .taught     )      let metadata = BackupImportMetadata(@@ -1165,7 +1106,6 @@ private struct SiteFacts: Equatable, Sendable {     var hostname: String     var displayName: String     var mode: SiteMode-    var junkSuffixRule: JunkSuffixRule?     var activePatterns: Int } @@ -1205,7 +1145,6 @@ extension LibraryRepository {                 .map {                     SiteFacts(                         hostname: $0.hostname, displayName: $0.displayName, mode: $0.mode,-                        junkSuffixRule: $0.junkSuffixRule,                         activePatterns: $0.patternValues.count(where: \.isActive))                 }                 .sorted { $0.hostname < $1.hostname }
Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15ArchiveTests.swift Renamed +936 / -889
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupV14ArchiveTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15ArchiveTests.swiftsimilarity index 71%rename from Packages/AsterismCore/Tests/AsterismCoreTests/BackupV14ArchiveTests.swiftrename to Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15ArchiveTests.swiftindex 52cd0b9a..e3664702 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupV14ArchiveTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15ArchiveTests.swift@@ -4,10 +4,17 @@ import Testing  @testable import AsterismCore -// Archive generation 14/15 (T-2330, `work-thumbnails` Req 8.1): a Work record-// carries the reader's cover — the shape's raw spelling and the bytes, base64-// through `Codable` (Q5) — and the schema number names the store the archive was-// taken from (V14). The digest is deliberately **not** in the file: it is+// Archive generation 15/16 (T-2336, `remove-article-mode` Req 5.1): a Site+// record no longer carries a junk-suffix rule, because V16 has no column for it,+// and the schema number names the store the archive was taken from (V16). The+// Site's `mode` stays the typed `SiteMode`, so the one spelling a previous build+// could have written — `articles` — refuses the file as malformed rather than+// arriving as a tolerated default (Req 5.1). A 15/16 archive is refused by+// version, naming the pair it declares (Req 5.3).+//+// The Work record is 15/16's: it carries the reader's cover — the shape's raw+// spelling and the bytes, base64 through `Codable` (Q5) — and its release days.+// The digest is deliberately **not** in the file: it is // derived from the bytes alone (Req 1.10), so import re-derives it, which is // also what heals a row whose stored digest had stopped matching its blob // (Req 1.8). The records are otherwise 12/13's — a place table beside the@@ -33,18 +40,18 @@ import Testing  // MARK: - Codec -@Suite("Backup V14 codec")-struct BackupV14CodecTests {+@Suite("Backup V15 codec")+struct BackupV15CodecTests { -    @Test("V14 encode/decode round-trips 14/15, the multi-site gate, and the seventeen arrays")+    @Test("V15 encode/decode round-trips 15/16, the multi-site gate, and the seventeen arrays")     func roundTrip() throws {-        let payload = BackupV14Fixtures.payload()+        let payload = BackupV15Fixtures.payload() -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata())) -        #expect(decoded.backupFormatVersion == 14)-        #expect(decoded.databaseSchemaVersion == 15)+        #expect(decoded.backupFormatVersion == 15)+        #expect(decoded.databaseSchemaVersion == 16)         #expect(decoded.capabilityGate == "multi-site")         #expect(decoded.payload == payload)         #expect(decoded.payload.characters == payload.characters)@@ -56,10 +63,10 @@ struct BackupV14CodecTests {         // records whose text they describe.         #expect(             decoded.payload.entries.first?.characterExtractionFingerprint-                == BackupV14Fixtures.noteFingerprint)+                == BackupV15Fixtures.noteFingerprint)         #expect(             decoded.payload.works.first?.genericNotesExtractionFingerprint-                == BackupV14Fixtures.genericNotesFingerprint)+                == BackupV15Fixtures.genericNotesFingerprint)     }      /// Req 8.1. The two statuses travel as the typed enums, exactly as@@ -68,13 +75,13 @@ struct BackupV14CodecTests {     /// defaults, so a dropped field cannot pass as a matching default.     @Test("A Work's two statuses and verdict survive the round-trip typed")     func workStatusFieldsRoundTrip() throws {-        let payload = BackupV14Fixtures.composedPayload()+        let payload = BackupV15Fixtures.composedPayload() -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          let record = try #require(-            decoded.payload.works.first { $0.id == BackupV14Fixtures.composedWorkID })+            decoded.payload.works.first { $0.id == BackupV15Fixtures.composedWorkID })         #expect(record.workStatus == .finished)         #expect(record.readingStatus == .abandoned)         #expect(record.verdict == "Dropped it at the timeskip.")@@ -87,18 +94,18 @@ struct BackupV14CodecTests {     @Test("A character's facts, aliases, note and keys survive the round-trip")     func characterFieldsRoundTrip() throws {         let facts = [-            BackupV14Fixtures.fact(),-            BackupV14Fixtures.fact(+            BackupV15Fixtures.fact(),+            BackupV15Fixtures.fact(                 statement: "Knows the way through the pass.",                 quote: "knows the way", source: .genericNotes),         ]-        let payload = BackupV14Fixtures.payload(+        let payload = BackupV15Fixtures.payload(             characters: [-                BackupV14Fixtures.character(aliases: ["Klar", "The Guide"], facts: facts)+                BackupV15Fixtures.character(aliases: ["Klar", "The Guide"], facts: facts)             ]) -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          let character = try #require(decoded.payload.characters.first)         #expect(character.name == "Grover")@@ -107,23 +114,23 @@ struct BackupV14CodecTests {         #expect(character.note == "The guide.")         #expect(character.facts.count == 2)         #expect(character.facts.contains { $0.source == .genericNotes })-        #expect(character.facts.contains { $0.source == .entry(BackupV14Fixtures.entryID) })+        #expect(character.facts.contains { $0.source == .entry(BackupV15Fixtures.entryID) })         #expect(character.facts.allSatisfy { $0.nameKey == "grover" })     }      @Test("Both suppression kinds round-trip with their status and action time")     func suppressionKindsRoundTrip() throws {         let rows = [-            BackupV14Fixtures.suppression(),-            BackupV14Fixtures.suppression(-                id: BackupV14Fixtures.factSuppressionID, kind: .fact, nameKey: "grover",-                source: .entry(BackupV14Fixtures.entryID), evidence: "promised to guide",+            BackupV15Fixtures.suppression(),+            BackupV15Fixtures.suppression(+                id: BackupV15Fixtures.factSuppressionID, kind: .fact, nameKey: "grover",+                source: .entry(BackupV15Fixtures.entryID), evidence: "promised to guide",                 status: .cleared),         ]-        let payload = BackupV14Fixtures.payload(suppressions: rows)+        let payload = BackupV15Fixtures.payload(suppressions: rows) -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          #expect(decoded.payload.suppressions == rows)     }@@ -136,11 +143,11 @@ struct BackupV14CodecTests {     /// tolerated in-flight state (Req 6.7).     @Test("A character with no work reference validates")     func orphanCharacterValidates() throws {-        let payload = BackupV14Fixtures.payload(-            characters: [BackupV14Fixtures.character(id: BackupV14Fixtures.orphanID, workID: nil)])+        let payload = BackupV15Fixtures.payload(+            characters: [BackupV15Fixtures.character(id: BackupV15Fixtures.orphanID, workID: nil)]) -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          #expect(decoded.payload.characters.first?.workID == nil)     }@@ -152,18 +159,18 @@ struct BackupV14CodecTests {     @Test("A fact citing an entry the archive does not carry validates")     func danglingFactCitationValidates() throws {         let absent = UUID(uuidString: "DEADBEEF-0000-4000-8000-000000000001")!-        let payload = BackupV14Fixtures.payload(+        let payload = BackupV15Fixtures.payload(             characters: [-                BackupV14Fixtures.character(facts: [BackupV14Fixtures.fact(source: .entry(absent))])+                BackupV15Fixtures.character(facts: [BackupV15Fixtures.fact(source: .entry(absent))])             ],             suppressions: [-                BackupV14Fixtures.suppression(-                    id: BackupV14Fixtures.factSuppressionID, kind: .fact, nameKey: "grover",+                BackupV15Fixtures.suppression(+                    id: BackupV15Fixtures.factSuppressionID, kind: .fact, nameKey: "grover",                     source: .entry(absent), evidence: "gone")             ]) -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          #expect(decoded.payload.characters.first?.facts.first?.source == .entry(absent))         #expect(decoded.payload.suppressions.first?.sourceEntryID == absent)@@ -174,24 +181,24 @@ struct BackupV14CodecTests {     @Test("A character naming a work the archive does not carry refuses")     func characterCitingAnAbsentWorkRefuses() throws {         let absent = UUID(uuidString: "DEADBEEF-0000-4000-8000-000000000002")!-        let payload = BackupV14Fixtures.payload(-            characters: [BackupV14Fixtures.character(workID: absent)])+        let payload = BackupV15Fixtures.payload(+            characters: [BackupV15Fixtures.character(workID: absent)])          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }     }      @Test("A suppression naming a work the archive does not carry refuses")     func suppressionCitingAnAbsentWorkRefuses() throws {         let absent = UUID(uuidString: "DEADBEEF-0000-4000-8000-000000000003")!-        let payload = BackupV14Fixtures.payload(-            suppressions: [BackupV14Fixtures.suppression(workID: absent)])+        let payload = BackupV15Fixtures.payload(+            suppressions: [BackupV15Fixtures.suppression(workID: absent)])          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }     } @@ -199,23 +206,23 @@ struct BackupV14CodecTests {      @Test("Two records for one character identity refuse")     func duplicateCharacterIDRefuses() throws {-        let payload = BackupV14Fixtures.payload(-            characters: [BackupV14Fixtures.character(), BackupV14Fixtures.character()])+        let payload = BackupV15Fixtures.payload(+            characters: [BackupV15Fixtures.character(), BackupV15Fixtures.character()])          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }     }      @Test("Two records for one suppression identity refuse")     func duplicateSuppressionIDRefuses() throws {-        let payload = BackupV14Fixtures.payload(-            suppressions: [BackupV14Fixtures.suppression(), BackupV14Fixtures.suppression()])+        let payload = BackupV15Fixtures.payload(+            suppressions: [BackupV15Fixtures.suppression(), BackupV15Fixtures.suppression()])          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }     } @@ -227,43 +234,43 @@ struct BackupV14CodecTests {     @Test("A place's facts, aliases, note and keys survive the round-trip")     func placeFieldsRoundTrip() throws {         let facts = [-            BackupV14Fixtures.fact(+            BackupV15Fixtures.fact(                 statement: "Sits above the pass.", quote: "above the pass",                 nameKey: "high keep"),-            BackupV14Fixtures.fact(+            BackupV15Fixtures.fact(                 statement: "Was abandoned after the siege.", quote: "abandoned after the siege",                 nameKey: "high keep", source: .genericNotes),         ]-        let payload = BackupV14Fixtures.payload(-            places: [BackupV14Fixtures.place(aliases: ["The Keep"], facts: facts)])+        let payload = BackupV15Fixtures.payload(+            places: [BackupV15Fixtures.place(aliases: ["The Keep"], facts: facts)]) -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          let place = try #require(decoded.payload.places.first)-        #expect(place.workID == BackupV14Fixtures.workID)+        #expect(place.workID == BackupV15Fixtures.workID)         #expect(place.name == "The High Keep")         #expect(place.nameKey == "high keep")         #expect(place.aliases == ["The Keep"])         #expect(place.note == "The fortress above the pass.")         #expect(place.facts.count == 2)         #expect(place.facts.contains { $0.source == .genericNotes })-        #expect(place.facts.contains { $0.source == .entry(BackupV14Fixtures.entryID) })+        #expect(place.facts.contains { $0.source == .entry(BackupV15Fixtures.entryID) })     }      @Test("Both place-suppression kinds round-trip with their status and action time")     func placeSuppressionKindsRoundTrip() throws {         let rows = [-            BackupV14Fixtures.placeSuppression(),-            BackupV14Fixtures.placeSuppression(-                id: BackupV14Fixtures.placeFactSuppressionID, kind: .fact,-                nameKey: "high keep", source: .entry(BackupV14Fixtures.entryID),+            BackupV15Fixtures.placeSuppression(),+            BackupV15Fixtures.placeSuppression(+                id: BackupV15Fixtures.placeFactSuppressionID, kind: .fact,+                nameKey: "high keep", source: .entry(BackupV15Fixtures.entryID),                 evidence: "above the pass", status: .cleared),         ]-        let payload = BackupV14Fixtures.payload(placeSuppressions: rows)+        let payload = BackupV15Fixtures.payload(placeSuppressions: rows) -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          #expect(decoded.payload.placeSuppressions == rows)     }@@ -275,12 +282,12 @@ struct BackupV14CodecTests {     @Test("A place and a place suppression naming a work the archive does not carry validate")     func orphanPlaceValidates() throws {         let absent = UUID(uuidString: "DEADBEEF-0000-4000-8000-00000000000a")!-        let payload = BackupV14Fixtures.payload(-            places: [BackupV14Fixtures.place(id: BackupV14Fixtures.orphanPlaceID, workID: absent)],-            placeSuppressions: [BackupV14Fixtures.placeSuppression(workID: absent)])+        let payload = BackupV15Fixtures.payload(+            places: [BackupV15Fixtures.place(id: BackupV15Fixtures.orphanPlaceID, workID: absent)],+            placeSuppressions: [BackupV15Fixtures.placeSuppression(workID: absent)]) -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          #expect(decoded.payload.places.first?.workID == absent)         #expect(decoded.payload.placeSuppressions.first?.workID == absent)@@ -290,22 +297,22 @@ struct BackupV14CodecTests {     /// records for one identity contradicts itself whichever table it is.     @Test("Two records for one place or one place-suppression identity refuse")     func duplicatePlaceIDRefuses() throws {-        let duplicatePlaces = BackupV14Fixtures.payload(-            places: [BackupV14Fixtures.place(), BackupV14Fixtures.place()])+        let duplicatePlaces = BackupV15Fixtures.payload(+            places: [BackupV15Fixtures.place(), BackupV15Fixtures.place()])         #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(-                    payload: duplicatePlaces, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(+                    payload: duplicatePlaces, metadata: BackupV15Fixtures.metadata()))         } -        let duplicateSuppressions = BackupV14Fixtures.payload(+        let duplicateSuppressions = BackupV15Fixtures.payload(             placeSuppressions: [-                BackupV14Fixtures.placeSuppression(), BackupV14Fixtures.placeSuppression(),+                BackupV15Fixtures.placeSuppression(), BackupV15Fixtures.placeSuppression(),             ])         #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(-                    payload: duplicateSuppressions, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(+                    payload: duplicateSuppressions, metadata: BackupV15Fixtures.metadata()))         }     } @@ -316,29 +323,68 @@ struct BackupV14CodecTests {     /// taken from the previous schema and omits whatever the bump added. So the     /// envelope's numbers are pinned to the live schema rather than restated.     ///-    /// The tie was deliberately broken for the length of `update-schedule`'s-    /// schema phase, exactly as it was for `work-thumbnails`' (Q73): the store-    /// moved to V15 in the freeze commit and the archive followed to 14/15-    /// several commits later, by design. The `withKnownIssue` that held the-    /// window open was **self-clearing** — Swift Testing fails a known-issue-    /// block whose issue does not occur — so this commit had to take it off or-    /// go red, which is exactly what it was for. The assertion is plain again.+    /// The tie asserts **plainly** again. It was deliberately broken for the+    /// length of `remove-article-mode`'s schema commit, as it was for+    /// `update-schedule`'s and `work-thumbnails`' (Q73, Q17): the store moved to+    /// V16 one commit before the archive moved to 15/16, held open by a+    /// self-clearing `withKnownIssue`. Swift Testing fails a known-issue block+    /// whose issue does not occur, so this commit had to take the wrapper off or+    /// go red — which is exactly what it was for. `make test-core` expects zero+    /// known issues again (Req 7.1).     @Test("The archive's schema version is the live schema's, and the format is one below")     func envelopeVersionsFollowTheLiveSchema() throws {         #expect(-            BackupV14Document.schemaVersion == AsterismSchemaV15.versionIdentifier.major,+            BackupV15Document.schemaVersion == AsterismSchemaV16.versionIdentifier.major,             """-            the archive declares schema \(BackupV14Document.schemaVersion) but the store \-            is at V\(AsterismSchemaV15.versionIdentifier.major). A schema bump moves four \+            the archive declares schema \(BackupV15Document.schemaVersion) but the store \+            is at V\(AsterismSchemaV16.versionIdentifier.major). A schema bump moves four \             things (CLAUDE.md, `docs/agent-notes/schema-migration.md`), and the archive \             generation is the one that fails silently when it is forgotten.             """)-        // Both numbers move together when the archive generation does.+        // Both numbers move together when the archive generation does: 15+        // trails 16 exactly as 14 trailed 15.         #expect(-            BackupV14Document.formatVersion == BackupV14Document.schemaVersion - 1,+            BackupV15Document.formatVersion == BackupV15Document.schemaVersion - 1,             "the format number has trailed the schema number by one since 4/4 diverged")     } +    // MARK: The Site's mode (`remove-article-mode` Req 5.1)++    /// `BackupV15Site.mode` is the typed `SiteMode` rather than its raw string,+    /// so a spelling this build has no case for fails the decode and the archive+    /// is refused as malformed. Reading a store row is tolerant — an unknown+    /// `modeRaw` reads as the default and is quarantined — and reading a backup+    /// never is: restoring an unnameable mode as `untaught` would rewrite what+    /// the file says without saying so.+    ///+    /// The literal carries a neutral unknown spelling. The retired `articles` is+    /// Req 7.2's exception, spelled only in `UnknownSiteModeTests`; the door+    /// asserted here is the same one for every value the type cannot name.+    @Test("A 15/16 Site carrying a mode this build cannot name fails to decode")+    func siteWithAnUnknownModeRefuses() throws {+        let document = BackupV15Fixtures.literalDocument(+            payload: BackupV15Fixtures.unknownSiteModePayloadJSON,+            entryCount: 1, workCount: 1)++        do {+            _ = try BackupV15Codec.decode(document)+            Issue.record("expected a decode refusal, but the document decoded")+        } catch let error as BackupCodecError {+            guard case .decodingFailed = error else {+                Issue.record("expected .decodingFailed, got \(error)")+                return+            }+        }++        // The same literal with a mode this build *can* name decodes, so the+        // refusal is about the value rather than about the paste.+        let known = BackupV15Fixtures.literalDocument(+            payload: BackupV15Fixtures.citationVersionFreePayloadJSON,+            entryCount: 1, workCount: 1)+        let site = try #require(try BackupV15Codec.decode(known).payload.sites.first)+        #expect(site.mode == .taught)+    }+     // MARK: The two Req 9.5 membership refusals      /// Req 9.5, first half. An Entry's Work is in the file and holds no@@ -347,20 +393,20 @@ struct BackupV14CodecTests {     /// wholly legal on arrival (Q50).     @Test("An Entry whose present Work has no membership on its hostname refuses")     func entryWithoutAMembershipOnItsHostnameRefuses() throws {-        let base = BackupV14Fixtures.composedPayload()+        let base = BackupV15Fixtures.composedPayload()          // The premise: with the membership present the payload is legal.-        _ = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: base, metadata: BackupV14Fixtures.metadata()))+        _ = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: base, metadata: BackupV15Fixtures.metadata())) -        let uncovered = BackupV14Payload(+        let uncovered = BackupV15Payload(             entries: base.entries, works: base.works, sites: base.sites,             titlePatterns: base.titlePatterns, urlRules: base.urlRules,             workTypes: base.workTypes, memberships: [])         let error = #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(-                    payload: uncovered, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(+                    payload: uncovered, metadata: BackupV15Fixtures.metadata()))         }         guard case .unresolvedReference(let type, _, let reference) = error else {             Issue.record("expected an unresolved reference, got \(String(describing: error))")@@ -375,18 +421,18 @@ struct BackupV14CodecTests {     /// the reconciler resolves (Req 2.6, 8.2), and one an archive may not carry.     @Test("Two memberships for one Work and hostname refuse")     func duplicateMembershipForOneHostnameRefuses() throws {-        let base = BackupV14Fixtures.composedPayload()-        let twin = BackupV14Fixtures.membership(+        let base = BackupV15Fixtures.composedPayload()+        let twin = BackupV15Fixtures.membership(             id: UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeeee2")!,-            workID: BackupV14Fixtures.composedWorkID, hostname: "example.com")-        let payload = BackupV14Payload(+            workID: BackupV15Fixtures.composedWorkID, hostname: "example.com")+        let payload = BackupV15Payload(             entries: base.entries, works: base.works, sites: base.sites,             titlePatterns: base.titlePatterns, urlRules: base.urlRules,             workTypes: base.workTypes, memberships: base.memberships + [twin])          let error = #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }         guard case .invalidStateTuple(let type, _, let reason) = error else {             Issue.record("expected an invalid state tuple, got \(String(describing: error))")@@ -403,24 +449,24 @@ struct BackupV14CodecTests {     func unattachedMembershipAndPairValidate() throws {         let absent = UUID(uuidString: "DEADBEEF-0000-4000-8000-000000000010")!         let other = UUID(uuidString: "DEADBEEF-0000-4000-8000-000000000011")!-        let base = BackupV14Fixtures.composedPayload()-        let orphan = BackupV14Fixtures.membership(+        let base = BackupV15Fixtures.composedPayload()+        let orphan = BackupV15Fixtures.membership(             id: UUID(uuidString: "0adbea00-0000-4000-8000-000000000001")!,             workID: absent, hostname: "example.com")         let ids = WorkDistinctPair.sortedIDs(absent, other)-        let payload = BackupV14Payload(+        let payload = BackupV15Payload(             entries: base.entries, works: base.works, sites: base.sites,             titlePatterns: base.titlePatterns, urlRules: base.urlRules,             workTypes: base.workTypes, memberships: base.memberships + [orphan],             distinctPairs: [-                BackupV14DistinctPair(+                BackupV15DistinctPair(                     id: UUID(uuidString: "0adbea00-0000-4000-8000-000000000002")!,                     lowerWorkID: ids.lower, higherWorkID: ids.higher,-                    recordedAt: BackupV14Fixtures.created)+                    recordedAt: BackupV15Fixtures.created)             ]) -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          #expect(decoded.payload.memberships.contains { $0.workID == absent })         #expect(decoded.payload.distinctPairs.count == 1)@@ -431,20 +477,20 @@ struct BackupV14CodecTests {     /// value (Req 1.2).     @Test("A membership whose identity tuple contradicts itself refuses")     func illegalMembershipTupleRefuses() throws {-        let base = BackupV14Fixtures.composedPayload()-        let illegal = BackupV14Membership(-            id: BackupV14Fixtures.composedMembershipID,-            workID: BackupV14Fixtures.composedWorkID, hostname: "example.com",-            createdAt: BackupV14Fixtures.created, urlIdentity: nil, urlIdentityState: .rule,+        let base = BackupV15Fixtures.composedPayload()+        let illegal = BackupV15Membership(+            id: BackupV15Fixtures.composedMembershipID,+            workID: BackupV15Fixtures.composedWorkID, hostname: "example.com",+            createdAt: BackupV15Fixtures.created, urlIdentity: nil, urlIdentityState: .rule,             urlIdentityRuleID: nil, workURLString: nil)-        let payload = BackupV14Payload(+        let payload = BackupV15Payload(             entries: base.entries, works: base.works, sites: base.sites,             titlePatterns: base.titlePatterns, urlRules: base.urlRules,             workTypes: base.workTypes, memberships: [illegal])          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }     } @@ -454,29 +500,29 @@ struct BackupV14CodecTests {     /// no writer produces — the Entry's identity arm refuses the same shape.     @Test("A membership citing a rule taught for another site refuses")     func membershipCitingAnotherSitesRuleRefuses() throws {-        let base = BackupV14Fixtures.composedPayload()+        let base = BackupV15Fixtures.composedPayload()         let otherHost = "other.example"         let otherRuleID = UUID(uuidString: "dddddddd-dddd-dddd-dddd-ddddddddddd2")!-        let otherSite = BackupV14Site(-            hostname: otherHost, displayName: "Other", mode: .untaught, junkSuffixRule: nil)-        let otherRule = BackupV14URLRule(-            id: otherRuleID, version: 1, isCurrent: false, createdAt: BackupV14Fixtures.created,+        let otherSite = BackupV15Site(+            hostname: otherHost, displayName: "Other", mode: .untaught)+        let otherRule = BackupV15URLRule(+            id: otherRuleID, version: 1, isCurrent: false, createdAt: BackupV15Fixtures.created,             origin: .importedV2,             definition: .work(locator: .query(name: ExactScalarString("series"))),             siteHostname: otherHost)         // The membership is on example.com and cites other.example's rule.-        let crossSite = BackupV14Fixtures.membership(-            id: BackupV14Fixtures.composedMembershipID,-            workID: BackupV14Fixtures.composedWorkID, hostname: "example.com",+        let crossSite = BackupV15Fixtures.membership(+            id: BackupV15Fixtures.composedMembershipID,+            workID: BackupV15Fixtures.composedWorkID, hostname: "example.com",             urlIdentity: "serial-9", urlIdentityState: .rule, urlIdentityRuleID: otherRuleID)-        let payload = BackupV14Payload(+        let payload = BackupV15Payload(             entries: base.entries, works: base.works, sites: base.sites + [otherSite],             titlePatterns: base.titlePatterns, urlRules: base.urlRules + [otherRule],             workTypes: base.workTypes, memberships: [crossSite])          let error = #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }         guard case .invalidStateTuple(let type, _, let reason) = error else {             Issue.record("expected an invalid state tuple, got \(String(describing: error))")@@ -492,19 +538,19 @@ struct BackupV14CodecTests {     /// arrives, which is a tolerated state rather than a corrupt file.     @Test("A membership citing a rule the archive does not carry is accepted")     func membershipCitingAnAbsentRuleValidates() throws {-        let base = BackupV14Fixtures.composedPayload()+        let base = BackupV15Fixtures.composedPayload()         let absentRule = UUID(uuidString: "dddddddd-dddd-dddd-dddd-ddddddddddd3")!-        let dangling = BackupV14Fixtures.membership(-            id: BackupV14Fixtures.composedMembershipID,-            workID: BackupV14Fixtures.composedWorkID, hostname: "example.com",+        let dangling = BackupV15Fixtures.membership(+            id: BackupV15Fixtures.composedMembershipID,+            workID: BackupV15Fixtures.composedWorkID, hostname: "example.com",             urlIdentity: "serial-9", urlIdentityState: .rule, urlIdentityRuleID: absentRule)-        let payload = BackupV14Payload(+        let payload = BackupV15Payload(             entries: base.entries, works: base.works, sites: base.sites,             titlePatterns: base.titlePatterns, urlRules: base.urlRules,             workTypes: base.workTypes, memberships: [dangling]) -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          #expect(decoded.payload.memberships.first?.urlIdentityRuleID == absentRule)     }@@ -515,41 +561,41 @@ struct BackupV14CodecTests {     /// works' membership pairs, and the link between them.     @Test("Series, memberships and links round-trip through the codec")     func seriesAndLinksRoundTrip() throws {-        let payload = BackupV14Fixtures.seriesPayload()+        let payload = BackupV15Fixtures.seriesPayload() -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          #expect(decoded.payload.series == payload.series)         #expect(decoded.payload.links == payload.links)         let first = try #require(-            decoded.payload.works.first { $0.id == BackupV14Fixtures.composedWorkID })-        #expect(first.seriesID == BackupV14Fixtures.seriesID)+            decoded.payload.works.first { $0.id == BackupV15Fixtures.composedWorkID })+        #expect(first.seriesID == BackupV15Fixtures.seriesID)         #expect(first.seriesPosition == 1)         let second = try #require(-            decoded.payload.works.first { $0.id == BackupV14Fixtures.secondWorkID })+            decoded.payload.works.first { $0.id == BackupV15Fixtures.secondWorkID })         #expect(second.seriesPosition == 2.5)     }      @Test("Two records for one series identity refuse")     func duplicateSeriesIDRefuses() throws {-        let payload = BackupV14Fixtures.seriesPayload(-            series: [BackupV14Fixtures.seriesRecord(), BackupV14Fixtures.seriesRecord()])+        let payload = BackupV15Fixtures.seriesPayload(+            series: [BackupV15Fixtures.seriesRecord(), BackupV15Fixtures.seriesRecord()])          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }     }      @Test("Two records for one link identity refuse")     func duplicateLinkIDRefuses() throws {-        let payload = BackupV14Fixtures.seriesPayload(-            links: [BackupV14Fixtures.linkRecord(), BackupV14Fixtures.linkRecord()])+        let payload = BackupV15Fixtures.seriesPayload(+            links: [BackupV15Fixtures.linkRecord(), BackupV15Fixtures.linkRecord()])          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }     } @@ -558,15 +604,15 @@ struct BackupV14CodecTests {     /// before a file exists; this answers for an archive written elsewhere.     @Test("A link naming one work twice refuses")     func selfLinkRefuses() throws {-        let payload = BackupV14Fixtures.seriesPayload(+        let payload = BackupV15Fixtures.seriesPayload(             links: [-                BackupV14Fixtures.linkRecord(-                    a: BackupV14Fixtures.composedWorkID, b: BackupV14Fixtures.composedWorkID)+                BackupV15Fixtures.linkRecord(+                    a: BackupV15Fixtures.composedWorkID, b: BackupV15Fixtures.composedWorkID)             ])          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }     } @@ -576,31 +622,31 @@ struct BackupV14CodecTests {     @Test("Two links over one pair refuse, whichever order their ids are in")     func twoLinksForOnePairRefuse() throws {         let second = UUID(uuidString: "11115E51-0000-4000-8000-000000000002")!-        let payload = BackupV14Fixtures.seriesPayload(+        let payload = BackupV15Fixtures.seriesPayload(             links: [-                BackupV14Fixtures.linkRecord(),+                BackupV15Fixtures.linkRecord(),                 // The reversed spelling of the same pair: the payload sorts at                 // the door, so this is the same key rather than a second one.-                BackupV14Fixtures.linkRecord(-                    id: second, a: BackupV14Fixtures.secondWorkID,-                    b: BackupV14Fixtures.composedWorkID, type: "sequel"),+                BackupV15Fixtures.linkRecord(+                    id: second, a: BackupV15Fixtures.secondWorkID,+                    b: BackupV15Fixtures.composedWorkID, type: "sequel"),             ])          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }     }      @Test("A series with an empty trimmed name refuses")     func emptySeriesNameRefuses() throws {         for name in ["", "   ", "\n\t "] {-            let payload = BackupV14Fixtures.seriesPayload(-                series: [BackupV14Fixtures.seriesRecord(name: name)])+            let payload = BackupV15Fixtures.seriesPayload(+                series: [BackupV15Fixtures.seriesRecord(name: name)])             #expect(throws: BackupCodecError.self) {-                try BackupV14Codec.decode(-                    try BackupV14Codec.encode(-                        payload: payload, metadata: BackupV14Fixtures.metadata()))+                try BackupV15Codec.decode(+                    try BackupV15Codec.encode(+                        payload: payload, metadata: BackupV15Fixtures.metadata()))             }         }     }@@ -612,16 +658,16 @@ struct BackupV14CodecTests {     @Test("A half-set membership pair refuses, either half")     func halfSetMembershipRefuses() throws {         let halves: [(UUID?, Double?)] = [-            (BackupV14Fixtures.seriesID, nil),+            (BackupV15Fixtures.seriesID, nil),             (nil, 2),         ]         for (id, position) in halves {-            let payload = BackupV14Fixtures.payloadWithMembership(+            let payload = BackupV15Fixtures.payloadWithMembership(                 seriesID: id, position: position)             #expect(throws: BackupCodecError.self) {-                try BackupV14Codec.decode(-                    try BackupV14Codec.encode(-                        payload: payload, metadata: BackupV14Fixtures.metadata()))+                try BackupV15Codec.decode(+                    try BackupV15Codec.encode(+                        payload: payload, metadata: BackupV15Fixtures.metadata()))             }         }     }@@ -631,12 +677,12 @@ struct BackupV14CodecTests {     @Test("A position that is not finite or carries a second fraction digit refuses")     func illegalPositionRefuses() throws {         for position in [2.55, 1.0 / 3.0, Double.infinity, Double.nan] {-            let payload = BackupV14Fixtures.payloadWithMembership(-                seriesID: BackupV14Fixtures.seriesID, position: position)+            let payload = BackupV15Fixtures.payloadWithMembership(+                seriesID: BackupV15Fixtures.seriesID, position: position)             #expect(throws: (any Error).self) {-                try BackupV14Codec.decode(-                    try BackupV14Codec.encode(-                        payload: payload, metadata: BackupV14Fixtures.metadata()))+                try BackupV15Codec.decode(+                    try BackupV15Codec.encode(+                        payload: payload, metadata: BackupV15Fixtures.metadata()))             }         }     }@@ -650,19 +696,19 @@ struct BackupV14CodecTests {     func unresolvedReferencesValidate() throws {         let absentSeries = UUID(uuidString: "5E81E5A0-0000-4000-8000-000000000009")!         let absentWork = UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeee99")!-        let payload = BackupV14Fixtures.seriesPayload(+        let payload = BackupV15Fixtures.seriesPayload(             links: [-                BackupV14Fixtures.linkRecord(-                    a: BackupV14Fixtures.composedWorkID, b: absentWork, type: "spin-off")+                BackupV15Fixtures.linkRecord(+                    a: BackupV15Fixtures.composedWorkID, b: absentWork, type: "spin-off")             ],             firstMembership: (absentSeries, 3)) -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          #expect(             decoded.payload.works.contains {-                $0.id == BackupV14Fixtures.composedWorkID && $0.seriesID == absentSeries+                $0.id == BackupV15Fixtures.composedWorkID && $0.seriesID == absentSeries             })         #expect(             decoded.payload.links.contains {@@ -677,11 +723,11 @@ struct BackupV14CodecTests {     @Test("A link's ids are sorted at the door")     func linkIDsAreSortedAtTheDoor() throws {         let ids = WorkDistinctPair.sortedIDs(-            BackupV14Fixtures.composedWorkID, BackupV14Fixtures.secondWorkID)-        let reversed = BackupV14Fixtures.linkRecord(a: ids.higher, b: ids.lower)+            BackupV15Fixtures.composedWorkID, BackupV15Fixtures.secondWorkID)+        let reversed = BackupV15Fixtures.linkRecord(a: ids.higher, b: ids.lower)         #expect(reversed.lowerWorkID == ids.higher) -        let payload = BackupImportPayload(BackupV14Fixtures.seriesPayload(links: [reversed]))+        let payload = BackupImportPayload(BackupV15Fixtures.seriesPayload(links: [reversed]))         #expect(payload.links.map(\.lowerWorkID) == [ids.lower])         #expect(payload.links.map(\.higherWorkID) == [ids.higher])     }@@ -693,77 +739,77 @@ struct BackupV14CodecTests {     /// (Q50) and the list order a credit is presented in.     @Test("Creators, roles and credits round-trip with their per-field timestamps")     func creatorRecordsRoundTrip() throws {-        let payload = BackupV14Fixtures.creditsPayload()+        let payload = BackupV15Fixtures.creditsPayload() -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          #expect(decoded.payload.creators == payload.creators)         #expect(decoded.payload.creatorRoles == payload.creatorRoles)         #expect(decoded.payload.credits == payload.credits)          let alias = try #require(-            decoded.payload.creators.first { $0.id == BackupV14Fixtures.aliasID })+            decoded.payload.creators.first { $0.id == BackupV15Fixtures.aliasID })         #expect(alias.stateRaw == CreatorState.merged.rawValue)-        #expect(alias.canonicalID == BackupV14Fixtures.moriID)+        #expect(alias.canonicalID == BackupV15Fixtures.moriID)          let mori = try #require(-            decoded.payload.creators.first { $0.id == BackupV14Fixtures.moriID })+            decoded.payload.creators.first { $0.id == BackupV15Fixtures.moriID })         #expect(mori.notes == "Also draws.")-        #expect(mori.nameModifiedAt == BackupV14Fixtures.created)-        #expect(mori.notesModifiedAt == BackupV14Fixtures.created)+        #expect(mori.nameModifiedAt == BackupV15Fixtures.created)+        #expect(mori.notesModifiedAt == BackupV15Fixtures.created)          // A seeded role travels pristine, which is what lets the archive's own         // record of a default yield to — or beat — a local seed on arrival (Q28).         let author = try #require(-            decoded.payload.creatorRoles.first { $0.id == BackupV14Fixtures.authorRoleID })+            decoded.payload.creatorRoles.first { $0.id == BackupV15Fixtures.authorRoleID })         #expect(author.position == 0)-        #expect(author.nameModifiedAt == BackupV14Fixtures.pristine)-        #expect(author.positionModifiedAt == BackupV14Fixtures.pristine)+        #expect(author.nameModifiedAt == BackupV15Fixtures.pristine)+        #expect(author.positionModifiedAt == BackupV15Fixtures.pristine)          let letterer = try #require(-            decoded.payload.creatorRoles.first { $0.id == BackupV14Fixtures.lettererRoleID })+            decoded.payload.creatorRoles.first { $0.id == BackupV15Fixtures.lettererRoleID })         #expect(letterer.position == 3)         let editor = try #require(-            decoded.payload.creatorRoles.first { $0.id == BackupV14Fixtures.editorRoleID })+            decoded.payload.creatorRoles.first { $0.id == BackupV15Fixtures.editorRoleID })         #expect(editor.stateRaw == CreatorRoleState.removed.rawValue)          // Q27: a credit carries every role identifier it holds **in any state**,         // the removed one included, or a restore after a remove-then-restore         // would lose the pairing Req 2.2 promises to bring back.         let credit = try #require(-            decoded.payload.credits.first { $0.id == BackupV14Fixtures.moriCreditID })-        #expect(credit.roleIDs.contains(BackupV14Fixtures.editorRoleID.uuidString))+            decoded.payload.credits.first { $0.id == BackupV15Fixtures.moriCreditID })+        #expect(credit.roleIDs.contains(BackupV15Fixtures.editorRoleID.uuidString))     }      @Test(         "Two records for one creator, role or credit identity refuse",         arguments: [0, 1, 2])     func duplicateDirectoryIDsRefuse(table: Int) throws {-        let payload: BackupV14Payload+        let payload: BackupV15Payload         switch table {         case 0:-            payload = BackupV14Fixtures.creditsPayload(-                creators: BackupV14Fixtures.creatorRecords-                    + [BackupV14Fixtures.creatorRecord(-                        id: BackupV14Fixtures.moriID, name: "Mori Ayane")])+            payload = BackupV15Fixtures.creditsPayload(+                creators: BackupV15Fixtures.creatorRecords+                    + [BackupV15Fixtures.creatorRecord(+                        id: BackupV15Fixtures.moriID, name: "Mori Ayane")])         case 1:-            payload = BackupV14Fixtures.creditsPayload(-                creatorRoles: BackupV14Fixtures.creatorRoleRecords-                    + [BackupV14Fixtures.creatorRoleRecord(-                        id: BackupV14Fixtures.lettererRoleID, name: "letterer", position: 9)])+            payload = BackupV15Fixtures.creditsPayload(+                creatorRoles: BackupV15Fixtures.creatorRoleRecords+                    + [BackupV15Fixtures.creatorRoleRecord(+                        id: BackupV15Fixtures.lettererRoleID, name: "letterer", position: 9)])         default:-            payload = BackupV14Fixtures.creditsPayload(-                credits: BackupV14Fixtures.creditRecords-                    + [BackupV14Fixtures.creditRecord(-                        id: BackupV14Fixtures.moriCreditID,-                        workID: BackupV14Fixtures.secondWorkID,-                        creatorID: BackupV14Fixtures.studioID)])+            payload = BackupV15Fixtures.creditsPayload(+                credits: BackupV15Fixtures.creditRecords+                    + [BackupV15Fixtures.creditRecord(+                        id: BackupV15Fixtures.moriCreditID,+                        workID: BackupV15Fixtures.secondWorkID,+                        creatorID: BackupV15Fixtures.studioID)])         }          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }     } @@ -774,25 +820,25 @@ struct BackupV14CodecTests {     /// name.     @Test("Two active creators, or two visible roles, with one normalized name refuse")     func normalizedNameCollisionsRefuse() throws {-        let creators = BackupV14Fixtures.creditsPayload(-            creators: BackupV14Fixtures.creatorRecords-                + [BackupV14Fixtures.creatorRecord(-                    id: BackupV14Fixtures.absentCreatorID, name: "MORI AYANE")])+        let creators = BackupV15Fixtures.creditsPayload(+            creators: BackupV15Fixtures.creatorRecords+                + [BackupV15Fixtures.creatorRecord(+                    id: BackupV15Fixtures.absentCreatorID, name: "MORI AYANE")])         #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(-                    payload: creators, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(+                    payload: creators, metadata: BackupV15Fixtures.metadata()))         }          // Active against removed: the pair Req 2.2's restore could not choose         // between.-        let roles = BackupV14Fixtures.creditsPayload(-            creatorRoles: BackupV14Fixtures.creatorRoleRecords-                + [BackupV14Fixtures.creatorRoleRecord(-                    id: BackupV14Fixtures.absentRoleID, name: "Editor", position: 5)])+        let roles = BackupV15Fixtures.creditsPayload(+            creatorRoles: BackupV15Fixtures.creatorRoleRecords+                + [BackupV15Fixtures.creatorRoleRecord(+                    id: BackupV15Fixtures.absentRoleID, name: "Editor", position: 5)])         #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: roles, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: roles, metadata: BackupV15Fixtures.metadata()))         }     } @@ -802,46 +848,46 @@ struct BackupV14CodecTests {     /// whose end is another alias (Q33).     @Test("A merged record naming an absent or merged survivor refuses")     func brokenAliasChainsRefuse() throws {-        let absentSurvivor = BackupV14Fixtures.creditsPayload(+        let absentSurvivor = BackupV15Fixtures.creditsPayload(             creators: [-                BackupV14Fixtures.creatorRecord(-                    id: BackupV14Fixtures.moriID, name: "Mori Ayane"),-                BackupV14Fixtures.creatorRecord(-                    id: BackupV14Fixtures.aliasID, name: "mori ayane", state: .merged,-                    canonicalID: BackupV14Fixtures.absentCreatorID),+                BackupV15Fixtures.creatorRecord(+                    id: BackupV15Fixtures.moriID, name: "Mori Ayane"),+                BackupV15Fixtures.creatorRecord(+                    id: BackupV15Fixtures.aliasID, name: "mori ayane", state: .merged,+                    canonicalID: BackupV15Fixtures.absentCreatorID),             ])         #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(-                    payload: absentSurvivor, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(+                    payload: absentSurvivor, metadata: BackupV15Fixtures.metadata()))         } -        let chain = BackupV14Fixtures.creditsPayload(+        let chain = BackupV15Fixtures.creditsPayload(             creators: [-                BackupV14Fixtures.creatorRecord(-                    id: BackupV14Fixtures.moriID, name: "Mori Ayane"),-                BackupV14Fixtures.creatorRecord(-                    id: BackupV14Fixtures.studioID, name: "mori ayane 2", state: .merged,-                    canonicalID: BackupV14Fixtures.moriID),-                BackupV14Fixtures.creatorRecord(-                    id: BackupV14Fixtures.aliasID, name: "mori ayane", state: .merged,-                    canonicalID: BackupV14Fixtures.studioID),+                BackupV15Fixtures.creatorRecord(+                    id: BackupV15Fixtures.moriID, name: "Mori Ayane"),+                BackupV15Fixtures.creatorRecord(+                    id: BackupV15Fixtures.studioID, name: "mori ayane 2", state: .merged,+                    canonicalID: BackupV15Fixtures.moriID),+                BackupV15Fixtures.creatorRecord(+                    id: BackupV15Fixtures.aliasID, name: "mori ayane", state: .merged,+                    canonicalID: BackupV15Fixtures.studioID),             ])         #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(-                    payload: chain, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(+                    payload: chain, metadata: BackupV15Fixtures.metadata()))         } -        let roleChain = BackupV14Fixtures.creditsPayload(-            creatorRoles: BackupV14Fixtures.creatorRoleRecords-                + [BackupV14Fixtures.creatorRoleRecord(-                    id: BackupV14Fixtures.absentRoleID, name: "letters", position: 6,-                    state: .merged, canonicalID: BackupV14Fixtures.absentCreatorID)])+        let roleChain = BackupV15Fixtures.creditsPayload(+            creatorRoles: BackupV15Fixtures.creatorRoleRecords+                + [BackupV15Fixtures.creatorRoleRecord(+                    id: BackupV15Fixtures.absentRoleID, name: "letters", position: 6,+                    state: .merged, canonicalID: BackupV15Fixtures.absentCreatorID)])         #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(-                    payload: roleChain, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(+                    payload: roleChain, metadata: BackupV15Fixtures.metadata()))         }     } @@ -851,59 +897,59 @@ struct BackupV14CodecTests {     /// and no writer produces (Q65).     @Test("Two credits over one pair, and a repeated role identifier, refuse")     func malformedCreditsRefuse() throws {-        let pair = BackupV14Fixtures.creditsPayload(-            credits: BackupV14Fixtures.creditRecords-                + [BackupV14Fixtures.creditRecord(-                    id: BackupV14Fixtures.absentRoleID,-                    workID: BackupV14Fixtures.composedWorkID,-                    creatorID: BackupV14Fixtures.moriID,-                    roleIDs: [BackupV14Fixtures.artistRoleID])])+        let pair = BackupV15Fixtures.creditsPayload(+            credits: BackupV15Fixtures.creditRecords+                + [BackupV15Fixtures.creditRecord(+                    id: BackupV15Fixtures.absentRoleID,+                    workID: BackupV15Fixtures.composedWorkID,+                    creatorID: BackupV15Fixtures.moriID,+                    roleIDs: [BackupV15Fixtures.artistRoleID])])         #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: pair, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: pair, metadata: BackupV15Fixtures.metadata()))         } -        let repeated = BackupV14Fixtures.creditsPayload(+        let repeated = BackupV15Fixtures.creditsPayload(             credits: [-                BackupV14Credit(-                    id: BackupV14Fixtures.moriCreditID,-                    workID: BackupV14Fixtures.composedWorkID,-                    creatorID: BackupV14Fixtures.moriID,+                BackupV15Credit(+                    id: BackupV15Fixtures.moriCreditID,+                    workID: BackupV15Fixtures.composedWorkID,+                    creatorID: BackupV15Fixtures.moriID,                     roleIDs: [-                        BackupV14Fixtures.authorRoleID.uuidString,-                        BackupV14Fixtures.authorRoleID.uuidString,+                        BackupV15Fixtures.authorRoleID.uuidString,+                        BackupV15Fixtures.authorRoleID.uuidString,                     ],-                    createdAt: BackupV14Fixtures.created,-                    modifiedAt: BackupV14Fixtures.created)+                    createdAt: BackupV15Fixtures.created,+                    modifiedAt: BackupV15Fixtures.created)             ])         #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(-                    payload: repeated, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(+                    payload: repeated, metadata: BackupV15Fixtures.metadata()))         }     }      @Test("A creator or role with an empty trimmed name refuses")     func emptyDirectoryNamesRefuse() throws {         for name in ["", "   ", "\n\t "] {-            let creators = BackupV14Fixtures.creditsPayload(-                creators: [BackupV14Fixtures.creatorRecord(-                    id: BackupV14Fixtures.moriID, name: name)],+            let creators = BackupV15Fixtures.creditsPayload(+                creators: [BackupV15Fixtures.creatorRecord(+                    id: BackupV15Fixtures.moriID, name: name)],                 credits: [])             #expect(throws: BackupCodecError.self) {-                try BackupV14Codec.decode(-                    try BackupV14Codec.encode(-                        payload: creators, metadata: BackupV14Fixtures.metadata()))+                try BackupV15Codec.decode(+                    try BackupV15Codec.encode(+                        payload: creators, metadata: BackupV15Fixtures.metadata()))             } -            let roles = BackupV14Fixtures.creditsPayload(-                creatorRoles: [BackupV14Fixtures.creatorRoleRecord(-                    id: BackupV14Fixtures.lettererRoleID, name: name, position: 3)],+            let roles = BackupV15Fixtures.creditsPayload(+                creatorRoles: [BackupV15Fixtures.creatorRoleRecord(+                    id: BackupV15Fixtures.lettererRoleID, name: name, position: 3)],                 credits: [])             #expect(throws: BackupCodecError.self) {-                try BackupV14Codec.decode(-                    try BackupV14Codec.encode(-                        payload: roles, metadata: BackupV14Fixtures.metadata()))+                try BackupV15Codec.decode(+                    try BackupV15Codec.encode(+                        payload: roles, metadata: BackupV15Fixtures.metadata()))             }         }     }@@ -915,21 +961,21 @@ struct BackupV14CodecTests {     @Test("A credit naming an absent work, creator and role is accepted")     func unresolvedCreditsValidate() throws {         let absentWork = UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeee98")!-        let payload = BackupV14Fixtures.creditsPayload(+        let payload = BackupV15Fixtures.creditsPayload(             credits: [-                BackupV14Fixtures.creditRecord(-                    id: BackupV14Fixtures.orphanCreditID, workID: absentWork,-                    creatorID: BackupV14Fixtures.absentCreatorID,-                    roleIDs: [BackupV14Fixtures.absentRoleID])+                BackupV15Fixtures.creditRecord(+                    id: BackupV15Fixtures.orphanCreditID, workID: absentWork,+                    creatorID: BackupV15Fixtures.absentCreatorID,+                    roleIDs: [BackupV15Fixtures.absentRoleID])             ]) -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          let credit = try #require(decoded.payload.credits.first)         #expect(credit.workID == absentWork)-        #expect(credit.creatorID == BackupV14Fixtures.absentCreatorID)-        #expect(credit.roleIDs == [BackupV14Fixtures.absentRoleID.uuidString])+        #expect(credit.creatorID == BackupV15Fixtures.absentCreatorID)+        #expect(credit.roleIDs == [BackupV15Fixtures.absentRoleID.uuidString])     }      // MARK: The citation arms@@ -940,11 +986,11 @@ struct BackupV14CodecTests {     /// refused, and it still refuses.     @Test("A composed identity with no name contributor refuses")     func composedIdentityWithoutANameContributorRefuses() throws {-        let payload = BackupV14Fixtures.composedPayload(dropNameContributor: true)+        let payload = BackupV15Fixtures.composedPayload(dropNameContributor: true)          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }     } @@ -952,9 +998,9 @@ struct BackupV14CodecTests {     /// `.rawURL` is a record that cannot say which key it holds.     @Test("A URL-rule basis carrying a raw-URL citation arm refuses")     func urlRuleBasisWithARawURLArmRefuses() throws {-        let base = BackupV14Fixtures.composedPayload()+        let base = BackupV15Fixtures.composedPayload()         let entry = try #require(base.entries.first)-        let stripped = BackupV14Entry(+        let stripped = BackupV15Entry(             id: entry.id, captureTitle: entry.captureTitle,             captureTitleSource: entry.captureTitleSource, rawURL: entry.rawURL,             canonicalURL: entry.canonicalURL, hostname: entry.hostname,@@ -966,53 +1012,54 @@ struct BackupV14CodecTests {             lastSharedAt: entry.lastSharedAt, modifiedAt: entry.modifiedAt,             workID: entry.workID, intentionallyUnattached: entry.intentionallyUnattached,             citations: EntryCitations(identity: .rawURL))-        let payload = BackupV14Payload(+        let payload = BackupV15Payload(             entries: [stripped], works: base.works, sites: base.sites,             titlePatterns: base.titlePatterns, urlRules: base.urlRules,             workTypes: base.workTypes, memberships: base.memberships)          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(-                try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+            try BackupV15Codec.decode(+                try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))         }     } -    @Test("A mismatched version pair around 14/15 is refused by the codec itself")+    @Test("A mismatched version pair around 15/16 is refused by the codec itself")     func mismatchedPairsRefuse() throws {-        let encoded = try BackupV14Codec.encode(-            payload: BackupV14Fixtures.payload(), metadata: BackupV14Fixtures.metadata())+        let encoded = try BackupV15Codec.encode(+            payload: BackupV15Fixtures.payload(), metadata: BackupV15Fixtures.metadata())         var object = try #require(             try JSONSerialization.jsonObject(with: encoded) as? [String: Any])         object["databaseSchemaVersion"] = 9          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(try JSONSerialization.data(withJSONObject: object))+            try BackupV15Codec.decode(try JSONSerialization.data(withJSONObject: object))         }     } -    /// Req 8.5 through the codec: a 12/13 envelope is the pair this generation-    /// replaced (Q5), and it is refused at the door rather than half-decoded.-    @Test("A 12/13 envelope is refused by the codec")+    /// `remove-article-mode` Req 5.3 through the codec: a 14/15 envelope is the+    /// pair this generation replaced (Q2, Q12), and it is refused at the door+    /// rather than half-decoded — so nothing it carries can reach a library.+    @Test("A 14/15 envelope is refused by the codec")     func retiredEnvelopeRefuses() throws {         #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(BackupV14Fixtures.retiredGenerationDocument())+            try BackupV15Codec.decode(BackupV15Fixtures.retiredGenerationDocument())         }     }      /// A citation is the rule's UUID since 8/9, so `version` is a key the codec     /// does not write back — and the checksum is taken over the bytes as they-    /// arrived. A 14/15 file carrying one therefore fails the re-encode+    /// arrived. A 15/16 file carrying one therefore fails the re-encode     /// comparison, which is the same door every other unrepresentable key meets.     ///     /// The paired assertion is what makes this about the key rather than about     /// the paste: the identical literal with `"version":3` removed decodes.-    @Test("A 14/15 archive whose citation carries a version fails the checksum")+    @Test("A 15/16 archive whose citation carries a version fails the checksum")     func citationVersionFailsTheChecksum() throws {-        let document = BackupV14Fixtures.literalDocument(-            payload: BackupV14Fixtures.citationVersionPayloadJSON, entryCount: 1, workCount: 1)+        let document = BackupV15Fixtures.literalDocument(+            payload: BackupV15Fixtures.citationVersionPayloadJSON, entryCount: 1, workCount: 1)          do {-            _ = try BackupV14Codec.decode(document)+            _ = try BackupV15Codec.decode(document)             Issue.record("expected a checksum refusal, but the document decoded")         } catch let error as BackupCodecError {             guard case .checksumMismatch = error else {@@ -1021,16 +1068,16 @@ struct BackupV14CodecTests {             }         } -        let versionFree = BackupV14Fixtures.literalDocument(-            payload: BackupV14Fixtures.citationVersionFreePayloadJSON, entryCount: 1, workCount: 1)-        let decoded = try BackupV14Codec.decode(versionFree)+        let versionFree = BackupV15Fixtures.literalDocument(+            payload: BackupV15Fixtures.citationVersionFreePayloadJSON, entryCount: 1, workCount: 1)+        let decoded = try BackupV15Codec.decode(versionFree)         #expect(             decoded.payload.entries.first?.citations.chapterSequence                 == CitedRule(id: UUID(uuidString: "DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD")!))     }      /// Req 8.1 and Q34 from the wire side: the three status fields are declared-    /// without `decodeIfPresent` and without a default, so a 14/15 document whose+    /// without `decodeIfPresent` and without a default, so a 15/16 document whose     /// Work record omits them is malformed rather than restorable. A default     /// would put a reader's abandoned work back as one they are still reading.     ///@@ -1038,13 +1085,13 @@ struct BackupV14CodecTests {     /// gives up on the missing key before the payload is ever re-encoded — and     /// the paired assertion pins it to the three keys rather than to the paste:     /// the identical literal carrying them decodes.-    @Test("A 14/15 Work record omitting the three status fields fails to decode")+    @Test("A 15/16 Work record omitting the three status fields fails to decode")     func workOmittingTheStatusFieldsRefuses() throws {-        let document = BackupV14Fixtures.literalDocument(-            payload: BackupV14Fixtures.statusFieldsOmittedPayloadJSON, entryCount: 1, workCount: 1)+        let document = BackupV15Fixtures.literalDocument(+            payload: BackupV15Fixtures.statusFieldsOmittedPayloadJSON, entryCount: 1, workCount: 1)          do {-            _ = try BackupV14Codec.decode(document)+            _ = try BackupV15Codec.decode(document)             Issue.record("expected a decode refusal, but the document decoded")         } catch let error as BackupCodecError {             guard case .decodingFailed = error else {@@ -1053,9 +1100,9 @@ struct BackupV14CodecTests {             }         } -        let complete = BackupV14Fixtures.literalDocument(-            payload: BackupV14Fixtures.citationVersionFreePayloadJSON, entryCount: 1, workCount: 1)-        let record = try #require(try BackupV14Codec.decode(complete).payload.works.first)+        let complete = BackupV15Fixtures.literalDocument(+            payload: BackupV15Fixtures.citationVersionFreePayloadJSON, entryCount: 1, workCount: 1)+        let record = try #require(try BackupV15Codec.decode(complete).payload.works.first)         #expect(record.workStatus == .ongoing)         #expect(record.readingStatus == .reading)         #expect(record.verdict.isEmpty)@@ -1064,17 +1111,17 @@ struct BackupV14CodecTests {     /// Req 5.1 and Q51 from the wire side. The two place arrays are declared     /// like every other array — no `decodeIfPresent`, no default — so a payload     /// shaped the way a **pre-place** build wrote one is malformed here even-    /// when someone has relabelled its envelope 14/15. That is the same door the+    /// when someone has relabelled its envelope 15/16. That is the same door the     /// version refusal is, reached from the other side: an 11/12 file holds no     /// place, and a default would restore a library asserting the reader had     /// accepted none.-    @Test("A 14/15 payload without the two place arrays fails to decode")+    @Test("A 15/16 payload without the two place arrays fails to decode")     func payloadOmittingThePlaceArraysRefuses() throws {-        let document = BackupV14Fixtures.literalDocument(-            payload: BackupV14Fixtures.placeArraysOmittedPayloadJSON, entryCount: 1, workCount: 1)+        let document = BackupV15Fixtures.literalDocument(+            payload: BackupV15Fixtures.placeArraysOmittedPayloadJSON, entryCount: 1, workCount: 1)          do {-            _ = try BackupV14Codec.decode(document)+            _ = try BackupV15Codec.decode(document)             Issue.record("expected a decode refusal, but the document decoded")         } catch let error as BackupCodecError {             guard case .decodingFailed = error else {@@ -1085,9 +1132,9 @@ struct BackupV14CodecTests {          // And the identical literal carrying the two empty arrays decodes, so         // the refusal is about them rather than about the paste.-        let complete = BackupV14Fixtures.literalDocument(-            payload: BackupV14Fixtures.citationVersionFreePayloadJSON, entryCount: 1, workCount: 1)-        let decoded = try BackupV14Codec.decode(complete)+        let complete = BackupV15Fixtures.literalDocument(+            payload: BackupV15Fixtures.citationVersionFreePayloadJSON, entryCount: 1, workCount: 1)+        let decoded = try BackupV15Codec.decode(complete)         #expect(decoded.payload.places.isEmpty)         #expect(decoded.payload.placeSuppressions.isEmpty)     }@@ -1103,9 +1150,9 @@ struct BackupV14CodecTests {     /// codec refuses this one before any record is seen.     @Test("A cover whose base64 does not decode refuses the whole archive")     func undecodableCoverBase64RefusesTheArchive() throws {-        let encoded = try BackupV14Codec.encode(-            payload: BackupV14Fixtures.coveredPayload(),-            metadata: BackupV14Fixtures.metadata())+        let encoded = try BackupV15Codec.encode(+            payload: BackupV15Fixtures.coveredPayload(),+            metadata: BackupV15Fixtures.metadata())         let text = try #require(String(data: encoded, encoding: .utf8))         // The cover's own field, not `thumbnailShape`: the closing quote and         // the colon are part of the match.@@ -1115,11 +1162,11 @@ struct BackupV14CodecTests {             in: field, with: "\"thumbnail\":\"not base64 @@@@\"")          #expect(throws: BackupCodecError.self) {-            try BackupV14Codec.decode(Data(corrupted.utf8))+            try BackupV15Codec.decode(Data(corrupted.utf8))         }         // The same document with its cover intact decodes, so the refusal is         // about the base64 rather than about the edit.-        #expect(try BackupV14Codec.decode(encoded).payload.works.first?.thumbnail != nil)+        #expect(try BackupV15Codec.decode(encoded).payload.works.first?.thumbnail != nil)     }      /// Req 3.2: the version invariants are retired, so an archive whose Site@@ -1127,10 +1174,10 @@ struct BackupV14CodecTests {     /// retired one is a file the reference checks accept.     @Test("An archive with duplicate and non-greatest rule versions decodes")     func duplicateAndNonGreatestVersionsDecode() throws {-        let payload = BackupV14Fixtures.duplicateVersionsPayload()+        let payload = BackupV15Fixtures.duplicateVersionsPayload() -        let decoded = try BackupV14Codec.decode(-            try BackupV14Codec.encode(payload: payload, metadata: BackupV14Fixtures.metadata()))+        let decoded = try BackupV15Codec.decode(+            try BackupV15Codec.encode(payload: payload, metadata: BackupV15Fixtures.metadata()))          #expect(decoded.payload == payload)         #expect(decoded.payload.titlePatterns.map(\.version) == [1, 1])@@ -1140,8 +1187,8 @@ struct BackupV14CodecTests {  // MARK: - Export -@Suite("Backup V14 export", .serialized)-struct BackupV14ExportTests {+@Suite("Backup V15 export", .serialized)+struct BackupV15ExportTests {     private static let host = "characters.example"     private static let workID = UUID(uuidString: "60000000-0000-4000-8000-000000000001")!     private static let entryID = UUID(uuidString: "60000000-0000-4000-8000-000000000002")!@@ -1157,21 +1204,21 @@ struct BackupV14ExportTests {     private static let note = "Grover promised to guide them home."     private static let genericNotes = "The guide is not what he seems." -    @Test("Exporter produces a v14 filename and a valid, decodable 14/15 document")+    @Test("Exporter produces a v15 filename and a valid, decodable 15/16 document")     func exporterProducesValidDocument() async throws {         let tempDir = FileManager.default.temporaryDirectory.appending(path: UUID().uuidString)         try FileManager.default.createDirectory(at: tempDir, withIntermediateDirectories: true)         defer { try? FileManager.default.removeItem(at: tempDir) } -        let payload = BackupV14Fixtures.payload()-        let exporter = BackupV14Exporter(-            repository: MockV14SnapshotProvider(payload: payload), stagingDirectory: tempDir)-        let result = try await exporter.export(metadata: BackupV14Fixtures.metadata())+        let payload = BackupV15Fixtures.payload()+        let exporter = BackupV15Exporter(+            repository: MockV15SnapshotProvider(payload: payload), stagingDirectory: tempDir)+        let result = try await exporter.export(metadata: BackupV15Fixtures.metadata()) -        #expect(result.fileURL.lastPathComponent.contains("v14"))-        let decoded = try BackupV14Codec.decode(try Data(contentsOf: result.fileURL))-        #expect(decoded.backupFormatVersion == 14)-        #expect(decoded.databaseSchemaVersion == 15)+        #expect(result.fileURL.lastPathComponent.contains("v15"))+        let decoded = try BackupV15Codec.decode(try Data(contentsOf: result.fileURL))+        #expect(decoded.backupFormatVersion == 15)+        #expect(decoded.databaseSchemaVersion == 16)         #expect(decoded.payload == payload)         exporter.cleanup(result)     }@@ -1183,7 +1230,7 @@ struct BackupV14ExportTests {     ///     /// The second half is asserted over the encoded JSON rather than over the     /// record, because that is where it could go wrong: a `thumbnailDigest`-    /// property added to `BackupV14Work` would put a second copy of a derived+    /// property added to `BackupV15Work` would put a second copy of a derived     /// fact in the file and invite the two to disagree, and no assertion on     /// decoded values would notice.     @Test("A work's cover projects onto the archive record, without its digest")@@ -1191,20 +1238,20 @@ struct BackupV14ExportTests {         let store = try LibraryStore()         store.setThumbnail(             shapeRaw: ThumbnailShape.portrait.rawValue,-            bytes: BackupV14Fixtures.coverBytes, digest: BackupV14Fixtures.coverDigest)+            bytes: BackupV15Fixtures.coverBytes, digest: BackupV15Fixtures.coverDigest)         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          let record = try #require(payload.works.first { $0.id == Self.workID })         #expect(record.thumbnailShape == ThumbnailShape.portrait.rawValue)-        #expect(record.thumbnail == BackupV14Fixtures.coverBytes)+        #expect(record.thumbnail == BackupV15Fixtures.coverBytes) -        let encoded = try BackupV14Codec.encode(-            payload: payload, metadata: BackupV14Fixtures.metadata())+        let encoded = try BackupV15Codec.encode(+            payload: payload, metadata: BackupV15Fixtures.metadata())         let text = try #require(String(data: encoded, encoding: .utf8))         #expect(!text.contains("thumbnailDigest"))-        #expect(!text.contains(BackupV14Fixtures.coverDigest))+        #expect(!text.contains(BackupV15Fixtures.coverDigest))     }      /// Decision 3: a cover the reader zoomed out on is stored shorter than its@@ -1217,15 +1264,15 @@ struct BackupV14ExportTests {         let store = try LibraryStore()         store.setThumbnail(             shapeRaw: ThumbnailShape.portrait.rawValue,-            bytes: BackupV14Fixtures.gappedCoverBytes,-            digest: BackupV14Fixtures.gappedCoverDigest)+            bytes: BackupV15Fixtures.gappedCoverBytes,+            digest: BackupV15Fixtures.gappedCoverDigest)         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          let record = try #require(payload.works.first { $0.id == Self.workID })         #expect(record.thumbnailShape == ThumbnailShape.portrait.rawValue)-        #expect(record.thumbnail == BackupV14Fixtures.gappedCoverBytes)+        #expect(record.thumbnail == BackupV15Fixtures.gappedCoverBytes)     }      /// Req 8.3 as Q52 amends it, and the one cover state that must **not**@@ -1240,7 +1287,7 @@ struct BackupV14ExportTests {             shapeRaw: ThumbnailShape.square.rawValue, bytes: nil, digest: "never-arrived")         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          let record = try #require(payload.works.first { $0.id == Self.workID })         #expect(record.thumbnailShape == nil)@@ -1261,19 +1308,19 @@ struct BackupV14ExportTests {         let store = try LibraryStore()         store.setThumbnail(             shapeRaw: ThumbnailShape.portrait.rawValue, bytes: nil,-            digest: BackupV14Fixtures.coverDigest)+            digest: BackupV15Fixtures.coverDigest)         store.insertSiblingRow(-            shapeRaw: ThumbnailShape.portrait.rawValue, bytes: BackupV14Fixtures.coverBytes,-            digest: BackupV14Fixtures.coverDigest)+            shapeRaw: ThumbnailShape.portrait.rawValue, bytes: BackupV15Fixtures.coverBytes,+            digest: BackupV15Fixtures.coverDigest)         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          // One record for the group, whichever row the bytes came off.         #expect(payload.works.count == 1)         let record = try #require(payload.works.first { $0.id == Self.workID })         #expect(record.thumbnailShape == ThumbnailShape.portrait.rawValue)-        #expect(record.thumbnail == BackupV14Fixtures.coverBytes)+        #expect(record.thumbnail == BackupV15Fixtures.coverBytes)     }      /// The same shape with the carrier holding **stale** bytes: the cover the@@ -1288,16 +1335,16 @@ struct BackupV14ExportTests {         let stale = Data("the cover this work used to have".utf8)         store.setThumbnail(             shapeRaw: ThumbnailShape.portrait.rawValue, bytes: stale,-            digest: BackupV14Fixtures.coverDigest)+            digest: BackupV15Fixtures.coverDigest)         store.insertSiblingRow(-            shapeRaw: ThumbnailShape.portrait.rawValue, bytes: BackupV14Fixtures.coverBytes,-            digest: BackupV14Fixtures.coverDigest)+            shapeRaw: ThumbnailShape.portrait.rawValue, bytes: BackupV15Fixtures.coverBytes,+            digest: BackupV15Fixtures.coverDigest)         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          let record = try #require(payload.works.first { $0.id == Self.workID })-        #expect(record.thumbnail == BackupV14Fixtures.coverBytes)+        #expect(record.thumbnail == BackupV15Fixtures.coverBytes)         #expect(record.thumbnail != stale)     } @@ -1317,15 +1364,15 @@ struct BackupV14ExportTests {             digest: Hexadecimal.sha256(bytes))         try store.context.save() -        let error = #expect(throws: BackupV14ExportError.self) {-            _ = try LibraryRepository.projectV14Payload(context: store.context)+        let error = #expect(throws: BackupV15ExportError.self) {+            _ = try LibraryRepository.projectV15Payload(context: store.context)         }         guard case .unrepresentableValue(let record, let field, _) = error else {             Issue.record("expected .unrepresentableValue, got \(String(describing: error))")             return         }         #expect(record.contains("A Work"))-        #expect(field == BackupV14ExportError.thumbnailField)+        #expect(field == BackupV15ExportError.thumbnailField)         #expect(error?.description.contains("A Work") == true)         #expect(error?.description.contains("Remove the cover") == true)         #expect(error?.description.contains("resolve it first") == true)@@ -1344,19 +1391,19 @@ struct BackupV14ExportTests {     func unknownCoverShapeRefusesByTitle() throws {         let store = try LibraryStore()         store.setThumbnail(-            shapeRaw: "hexagon", bytes: BackupV14Fixtures.coverBytes,-            digest: BackupV14Fixtures.coverDigest)+            shapeRaw: "hexagon", bytes: BackupV15Fixtures.coverBytes,+            digest: BackupV15Fixtures.coverDigest)         try store.context.save() -        let error = #expect(throws: BackupV14ExportError.self) {-            _ = try LibraryRepository.projectV14Payload(context: store.context)+        let error = #expect(throws: BackupV15ExportError.self) {+            _ = try LibraryRepository.projectV15Payload(context: store.context)         }         guard case .unrepresentableValue(let record, let field, let value) = error else {             Issue.record("expected .unrepresentableValue, got \(String(describing: error))")             return         }         #expect(record.contains("A Work"))-        #expect(field == BackupV14ExportError.thumbnailField)+        #expect(field == BackupV15ExportError.thumbnailField)         #expect(value == "hexagon")     } @@ -1374,8 +1421,8 @@ struct BackupV14ExportTests {         store.setReleaseDaysRaw(["monday", "funday"])         try store.context.save() -        let error = #expect(throws: BackupV14ExportError.self) {-            _ = try LibraryRepository.projectV14Payload(context: store.context)+        let error = #expect(throws: BackupV15ExportError.self) {+            _ = try LibraryRepository.projectV15Payload(context: store.context)         }         guard case .unrepresentableValue(let record, let field, let value) = error else {             Issue.record("expected .unrepresentableValue, got \(String(describing: error))")@@ -1394,7 +1441,7 @@ struct BackupV14ExportTests {         store.setReleaseDaysRaw(["thursday", "monday"])         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          let record = try #require(payload.works.first { $0.id == Self.workID })         #expect(record.releaseDays == [.monday, .thursday])@@ -1418,7 +1465,7 @@ struct BackupV14ExportTests {         store.coverGenericNotes()         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          let character = try #require(payload.characters.first)         #expect(character.id == Self.characterID)@@ -1464,7 +1511,7 @@ struct BackupV14ExportTests {         store.context.insert(twin)         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          // One record for the pair, and it is the survivor's — carrying the         // address the discarded row held.@@ -1483,15 +1530,15 @@ struct BackupV14ExportTests {         store.insertCharacter(id: Self.orphanID, name: "Stranger", attachToWork: false)         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          let orphan = try #require(payload.characters.first { $0.id == Self.orphanID })         #expect(orphan.workID == nil)         // And the file it produces is legal: the validator's exemption and the         // exporter's enumeration have to agree, or the export refuses its own bytes.-        let encoded = try BackupV14Codec.encode(-            payload: payload, metadata: BackupV14Fixtures.metadata())-        #expect(try BackupV14Codec.decode(encoded).payload == payload)+        let encoded = try BackupV15Codec.encode(+            payload: payload, metadata: BackupV15Fixtures.metadata())+        #expect(try BackupV15Codec.decode(encoded).payload == payload)     }      /// Req 6.5. One character UUID over two rows that disagree about something@@ -1504,8 +1551,8 @@ struct BackupV14ExportTests {         store.insertCharacter(id: Self.characterID, name: "Grover", note: "A traitor.")         try store.context.save() -        #expect(throws: BackupV14ExportError.self) {-            try LibraryRepository.projectV14Payload(context: store.context)+        #expect(throws: BackupV15ExportError.self) {+            try LibraryRepository.projectV15Payload(context: store.context)         }     } @@ -1524,12 +1571,12 @@ struct BackupV14ExportTests {             ])         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          #expect(payload.characters.first?.facts.first?.source == .entry(absent))-        let encoded = try BackupV14Codec.encode(-            payload: payload, metadata: BackupV14Fixtures.metadata())-        #expect(try BackupV14Codec.decode(encoded).payload == payload)+        let encoded = try BackupV15Codec.encode(+            payload: payload, metadata: BackupV15Fixtures.metadata())+        #expect(try BackupV15Codec.decode(encoded).payload == payload)     }      // MARK: The places (Req 5.1, 5.3, 5.5)@@ -1551,7 +1598,7 @@ struct BackupV14ExportTests {         store.insertPlaceSuppression(nameKey: "low road")         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          let place = try #require(payload.places.first)         #expect(place.id == Self.placeID)@@ -1580,7 +1627,7 @@ struct BackupV14ExportTests {         store.insertPlaceSuppression(nameKey: "elsewhere", workID: Self.absentWorkID)         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          let orphan = try #require(payload.places.first { $0.id == Self.orphanPlaceID })         #expect(orphan.workID == Self.absentWorkID)@@ -1588,9 +1635,9 @@ struct BackupV14ExportTests {         // And the file it produces is legal: the validator's exemption and the         // exporter's enumeration have to agree, or the export refuses its own         // bytes.-        let encoded = try BackupV14Codec.encode(-            payload: payload, metadata: BackupV14Fixtures.metadata())-        #expect(try BackupV14Codec.decode(encoded).payload == payload)+        let encoded = try BackupV15Codec.encode(+            payload: payload, metadata: BackupV15Fixtures.metadata())+        #expect(try BackupV15Codec.decode(encoded).payload == payload)     }      /// Req 5.3: a torn place group is the same thing a torn character group is —@@ -1603,8 +1650,8 @@ struct BackupV14ExportTests {         store.insertPlace(id: Self.placeID, name: "The High Keep", note: "Still garrisoned.")         try store.context.save() -        #expect(throws: BackupV14ExportError.self) {-            try LibraryRepository.projectV14Payload(context: store.context)+        #expect(throws: BackupV15ExportError.self) {+            try LibraryRepository.projectV15Payload(context: store.context)         }     } @@ -1631,7 +1678,7 @@ struct BackupV14ExportTests {         store.insertLink(id: selfLink, a: Self.workID, b: Self.workID, type: "sequel")         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          #expect(payload.links.map(\.id) == [newer])         #expect(payload.links.map(\.linkType) == ["sequel"])@@ -1650,7 +1697,7 @@ struct BackupV14ExportTests {         store.placeWork(seriesID: seriesID, position: 2.5)         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          #expect(payload.series.map(\.id) == [seriesID])         #expect(payload.series.first?.name == "Ashfall Cycle")@@ -1677,8 +1724,8 @@ struct BackupV14ExportTests {             store.placeWork(seriesID: id, position: position)             try store.context.save() -            let error = #expect(throws: BackupV14ExportError.self) {-                try LibraryRepository.projectV14Payload(context: store.context)+            let error = #expect(throws: BackupV15ExportError.self) {+                try LibraryRepository.projectV15Payload(context: store.context)             }             guard case .unrepresentableValue(let record, _, _) = error else {                 Issue.record("expected an unrepresentable-value refusal, got \(String(describing: error))")@@ -1715,7 +1762,7 @@ struct BackupV14ExportTests {         store.insertCreatorRole(id: Self.roleID, name: "letterer", position: 3)         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          #expect(payload.creators.count == 3)         let record = try #require(payload.creators.first { $0.id == mori })@@ -1733,9 +1780,9 @@ struct BackupV14ExportTests {          // And the file it produces is legal: the projection and the reference         // checks have to agree, or the export refuses its own bytes.-        let encoded = try BackupV14Codec.encode(-            payload: payload, metadata: BackupV14Fixtures.metadata())-        #expect(try BackupV14Codec.decode(encoded).payload == payload)+        let encoded = try BackupV15Codec.encode(+            payload: payload, metadata: BackupV15Fixtures.metadata())+        #expect(try BackupV15Codec.decode(encoded).payload == payload)     }      /// Q68: a merged record whose survivor is not in the library reads as@@ -1752,14 +1799,14 @@ struct BackupV14ExportTests {             stateModifiedAt: Self.early)         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          let record = try #require(payload.creators.first { $0.id == alias })         #expect(record.stateRaw == CreatorState.merged.rawValue)         #expect(record.canonicalID == nil)-        let encoded = try BackupV14Codec.encode(-            payload: payload, metadata: BackupV14Fixtures.metadata())-        #expect(try BackupV14Codec.decode(encoded).payload == payload)+        let encoded = try BackupV15Codec.encode(+            payload: payload, metadata: BackupV15Fixtures.metadata())+        #expect(try BackupV15Codec.decode(encoded).payload == payload)     }      /// Req 9.2: one credit per work-and-creator pair, bucketed on the@@ -1790,7 +1837,7 @@ struct BackupV14ExportTests {             modifiedAt: Self.early.addingTimeInterval(120))         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          #expect(payload.credits.count == 1)         let record = try #require(payload.credits.first)@@ -1838,7 +1885,7 @@ struct BackupV14ExportTests {             modifiedAt: Self.early.addingTimeInterval(120))         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          #expect(payload.creators.count == 2)         #expect(@@ -1862,9 +1909,9 @@ struct BackupV14ExportTests {         #expect(credit.roleIDs == [author.uuidString, artist.uuidString].sorted())          // The check that used to refuse this library's own archive.-        let encoded = try BackupV14Codec.encode(-            payload: payload, metadata: BackupV14Fixtures.metadata())-        #expect(try BackupV14Codec.decode(encoded).payload == payload)+        let encoded = try BackupV15Codec.encode(+            payload: payload, metadata: BackupV15Fixtures.metadata())+        #expect(try BackupV15Codec.decode(encoded).payload == payload)     }      /// Req 10.2 at the export door: nothing is pruned for naming a work,@@ -1882,20 +1929,20 @@ struct BackupV14ExportTests {             createdAt: Self.early, modifiedAt: Self.early)         try store.context.save() -        let payload = try LibraryRepository.projectV14Payload(context: store.context)+        let payload = try LibraryRepository.projectV15Payload(context: store.context)          let record = try #require(payload.credits.first)         #expect(record.workID == absentWork)         #expect(record.creatorID == absentCreator)         #expect(record.roleIDs == [absentRole.uuidString])-        let encoded = try BackupV14Codec.encode(-            payload: payload, metadata: BackupV14Fixtures.metadata())-        #expect(try BackupV14Codec.decode(encoded).payload == payload)+        let encoded = try BackupV15Codec.encode(+            payload: payload, metadata: BackupV15Fixtures.metadata())+        #expect(try BackupV15Codec.decode(encoded).payload == payload)     }      // MARK: - Fixture -    /// An in-memory V14 store holding one taught-enough Site, one Work with+    /// An in-memory V16 store holding one taught-enough Site, one Work with     /// generic notes and one noted Entry. The container is retained for the     /// test's lifetime: a `ModelContext` does not keep its container alive.     private final class LibraryStore {@@ -1907,7 +1954,7 @@ struct BackupV14ExportTests {         private var carrier: Work!          init() throws {-            let schema = Schema(versionedSchema: AsterismSchemaV15.self)+            let schema = Schema(versionedSchema: AsterismSchemaV16.self)             container = try ModelContainer(                 for: schema,                 configurations: [@@ -1915,23 +1962,23 @@ struct BackupV14ExportTests {                         schema: schema, isStoredInMemoryOnly: true, cloudKitDatabase: .none)                 ])             context = ModelContext(container)-            let site = Site(hostname: BackupV14ExportTests.host, displayName: "Characters")+            let site = Site(hostname: BackupV15ExportTests.host, displayName: "Characters")             site.mode = .untaught             context.insert(site)              let work = Work.create(-                in: context, id: BackupV14ExportTests.workID, title: "A Work",-                hostname: BackupV14ExportTests.host, site: site,-                timestamp: BackupV14ExportTests.early)-            work.genericNotes = BackupV14ExportTests.genericNotes+                in: context, id: BackupV15ExportTests.workID, title: "A Work",+                hostname: BackupV15ExportTests.host, site: site,+                timestamp: BackupV15ExportTests.early)+            work.genericNotes = BackupV15ExportTests.genericNotes             carrier = work -            let rawURL = "https://\(BackupV14ExportTests.host)/read/1"+            let rawURL = "https://\(BackupV15ExportTests.host)/read/1"             let entry = Entry(-                id: BackupV14ExportTests.entryID, captureTitle: "Chapter 1",+                id: BackupV15ExportTests.entryID, captureTitle: "Chapter 1",                 captureTitleSource: .host, rawURLString: rawURL,-                hostname: BackupV14ExportTests.host, entryIdentityKey: rawURL,-                timestamp: BackupV14ExportTests.early, note: BackupV14ExportTests.note)+                hostname: BackupV15ExportTests.host, entryIdentityKey: rawURL,+                timestamp: BackupV15ExportTests.early, note: BackupV15ExportTests.note)             entry.conservativeIdentityKey = rawURL             entry.editCitations { $0.workAssignment = .manual }             context.insert(entry)@@ -1948,14 +1995,14 @@ struct BackupV14ExportTests {             let character = CharacterRecord(                 id: id, name: name, nameKey: RecordNameKey.normalize(name),                 aliases: aliases, note: note, facts: facts,-                timestamp: BackupV14ExportTests.early)+                timestamp: BackupV15ExportTests.early)             context.insert(character)             if attachToWork { character.work = work }         }          func insertSuppression(nameKey: String) {             let row = CharacterSuppression(-                kind: .candidate, nameKey: nameKey, actionAt: BackupV14ExportTests.early)+                kind: .candidate, nameKey: nameKey, actionAt: BackupV15ExportTests.early)             context.insert(row)             row.work = work         }@@ -1965,22 +2012,22 @@ struct BackupV14ExportTests {         /// seed the non-resolving owner of Req 5.5.         func insertPlace(             id: UUID, name: String, aliases: [String] = [], note: String = "",-            facts: [RecordFact] = [], workID: UUID = BackupV14ExportTests.workID+            facts: [RecordFact] = [], workID: UUID = BackupV15ExportTests.workID         ) {             context.insert(                 Place(                     id: id, name: name, nameKey: RecordNameKey.normalize(name),                     aliases: aliases, note: note, facts: facts,-                    timestamp: BackupV14ExportTests.early, workID: workID))+                    timestamp: BackupV15ExportTests.early, workID: workID))         }          func insertPlaceSuppression(-            nameKey: String, workID: UUID = BackupV14ExportTests.workID+            nameKey: String, workID: UUID = BackupV15ExportTests.workID         ) {             context.insert(                 PlaceSuppression(                     workID: workID, kind: .candidate, nameKey: nameKey,-                    actionAt: BackupV14ExportTests.early))+                    actionAt: BackupV15ExportTests.early))         }          /// The three cover columns, written straight onto the work row.@@ -2006,9 +2053,9 @@ struct BackupV14ExportTests {         /// original row the carrier.         func insertSiblingRow(shapeRaw: String?, bytes: Data?, digest: String?) {             let sibling = Work.create(-                in: context, id: BackupV14ExportTests.workID, title: carrier.displayTitle,-                hostname: BackupV14ExportTests.host, site: carrier.primaryMembership?.site,-                timestamp: BackupV14ExportTests.early.addingTimeInterval(60))+                in: context, id: BackupV15ExportTests.workID, title: carrier.displayTitle,+                hostname: BackupV15ExportTests.host, site: carrier.primaryMembership?.site,+                timestamp: BackupV15ExportTests.early.addingTimeInterval(60))             sibling.lastParsedTitle = carrier.lastParsedTitle             sibling.titleProvenanceRaw = carrier.titleProvenanceRaw             sibling.genericNotes = carrier.genericNotes@@ -2026,20 +2073,20 @@ struct BackupV14ExportTests {         func coverEntry() {             try? context.fetch(FetchDescriptor<Entry>()).first?                 .characterExtractionFingerprint = CharacterCoverageFingerprint.of(-                    BackupV14ExportTests.note)+                    BackupV15ExportTests.note)         }          func coverGenericNotes() {             work?.genericNotesExtractionFingerprint = CharacterCoverageFingerprint.of(-                BackupV14ExportTests.genericNotes)+                BackupV15ExportTests.genericNotes)         }          // `series-and-related-works` Req 13.          func insertSeries(             id: UUID, name: String, notes: String = "",-            createdAt: Date = BackupV14ExportTests.early,-            modifiedAt: Date = BackupV14ExportTests.early+            createdAt: Date = BackupV15ExportTests.early,+            modifiedAt: Date = BackupV15ExportTests.early         ) {             context.insert(                 Series(@@ -2051,13 +2098,13 @@ struct BackupV14ExportTests {         /// self-link no writer produces and the projection drops.         func insertLink(             id: UUID, a: UUID, b: UUID, type: String,-            modifiedAt: Date = BackupV14ExportTests.early+            modifiedAt: Date = BackupV15ExportTests.early         ) {             let sorted = WorkDistinctPair.sortedIDs(a, b)             context.insert(                 WorkLink(                     id: id, lowerWorkID: sorted.lower, higherWorkID: sorted.higher,-                    linkType: type, createdAt: BackupV14ExportTests.early,+                    linkType: type, createdAt: BackupV15ExportTests.early,                     modifiedAt: modifiedAt))         } @@ -2088,7 +2135,7 @@ struct BackupV14ExportTests {             let row = Creator(                 id: id, name: name, notes: notes, stateRaw: state.rawValue,                 canonicalID: canonicalID)-            row.createdAt = BackupV14ExportTests.early+            row.createdAt = BackupV15ExportTests.early             row.nameModifiedAt = nameModifiedAt             row.notesModifiedAt = notesModifiedAt             row.stateModifiedAt = stateModifiedAt@@ -2099,14 +2146,14 @@ struct BackupV14ExportTests {         func insertCreatorRole(             id: UUID, name: String, position: Int, state: CreatorRoleState = .active,             canonicalID: UUID? = nil,-            nameModifiedAt: Date = BackupV14ExportTests.early,-            positionModifiedAt: Date = BackupV14ExportTests.early,-            stateModifiedAt: Date = BackupV14ExportTests.early+            nameModifiedAt: Date = BackupV15ExportTests.early,+            positionModifiedAt: Date = BackupV15ExportTests.early,+            stateModifiedAt: Date = BackupV15ExportTests.early         ) {             let row = CreatorRole(                 id: id, name: name, position: position, stateRaw: state.rawValue,                 canonicalID: canonicalID)-            row.createdAt = BackupV14ExportTests.early+            row.createdAt = BackupV15ExportTests.early             row.nameModifiedAt = nameModifiedAt             row.positionModifiedAt = positionModifiedAt             row.stateModifiedAt = stateModifiedAt@@ -2129,20 +2176,20 @@ struct BackupV14ExportTests {  // MARK: - Import -@Suite("Backup 14/15 import", .serialized)-struct BackupV14ImportTests {+@Suite("Backup 15/16 import", .serialized)+struct BackupV15ImportTests {      // MARK: One accepted pair (Decision 2) -    @Test("The importer accepts 14/15")+    @Test("The importer accepts 15/16")     func acceptedGeneration() throws {-        let data = try BackupV14Codec.encode(-            payload: BackupV14Fixtures.payload(), metadata: BackupV14Fixtures.metadata())+        let data = try BackupV15Codec.encode(+            payload: BackupV15Fixtures.payload(), metadata: BackupV15Fixtures.metadata())          let plan = try BackupImporter.plan(from: data)-        #expect(plan.metadata.formatVersion == 14)-        #expect(plan.metadata.schemaVersion == 15)-        #expect(plan.payload == BackupImportPayload(BackupV14Fixtures.payload()))+        #expect(plan.metadata.formatVersion == 15)+        #expect(plan.metadata.schemaVersion == 16)+        #expect(plan.payload == BackupImportPayload(BackupV15Fixtures.payload()))     }      /// The retired generations refuse **by version**, and the refusal names the@@ -2154,17 +2201,17 @@ struct BackupV14ImportTests {     /// tell the reader their backup is corrupt. It is not corrupt; it is old,     /// and the message has to say so (Req 13.1, Q13).     ///-    /// (13, 14) leads the list: it is the generation this one replaced, and the-    /// one a reader upgrading across `update-schedule` is holding-    /// (`update-schedule` Req 8.2).+    /// (14, 15) leads the list: it is the generation this one replaced, and the+    /// one a reader upgrading across `remove-article-mode` is holding+    /// (`remove-article-mode` Req 5.3, Q2).     @Test(         "A retired generation refuses by version, naming the pair",         arguments: [-            (13, 14), (12, 13), (11, 12), (10, 11), (9, 10), (8, 9), (7, 8), (6, 7), (4, 4),-            (5, 6), (3, 3),+            (14, 15), (13, 14), (12, 13), (11, 12), (10, 11), (9, 10), (8, 9), (7, 8), (6, 7),+            (4, 4), (5, 6), (3, 3),         ])     func retiredGenerationsRefuseByVersion(pair: (format: Int, schema: Int)) throws {-        let data = BackupV14Fixtures.retiredGenerationDocument(+        let data = BackupV15Fixtures.retiredGenerationDocument(             format: pair.format, schema: pair.schema)         // The envelope is intact — this is a version refusal, not a decode one.         #expect((try? JSONSerialization.jsonObject(with: data)) != nil)@@ -2179,12 +2226,12 @@ struct BackupV14ImportTests {         #expect(reason.contains("format \(pair.format)"))         #expect(reason.contains("schema \(pair.schema)"))         // Req 13.1 names both pairs: the archive's and the one this build reads.-        #expect(reason.contains("(\(BackupV14Document.formatVersion)/\(BackupV14Document.schemaVersion))"))+        #expect(reason.contains("(\(BackupV15Document.formatVersion)/\(BackupV15Document.schemaVersion))"))     } -    @Test("A mismatched pair around 14/15 is unsupported")+    @Test("A mismatched pair around 15/16 is unsupported")     func mismatchedPairsReject() throws {-        for (format, schema) in [(14, 14), (14, 16), (13, 15), (15, 15)] {+        for (format, schema) in [(15, 15), (15, 17), (14, 16), (16, 16)] {             let data = try JSONSerialization.data(withJSONObject: [                 "backupFormatVersion": format,                 "databaseSchemaVersion": schema,@@ -2197,40 +2244,40 @@ struct BackupV14ImportTests {      // MARK: What lands (Req 6.1) -    @Test("A 14/15 archive commits its characters, suppressions and coverage")+    @Test("A 15/16 archive commits its characters, suppressions and coverage")     func archiveCommits() async throws {         let fixture = try await M5Fixture()          let result = try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.payload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.payload()))         guard case .committed = result else {             Issue.record("expected committed, got \(result)")             return         }          let characters = try await fixture.repository.m5AllCharacters()-        let grover = try #require(characters.first { $0.id == BackupV14Fixtures.groverID })+        let grover = try #require(characters.first { $0.id == BackupV15Fixtures.groverID })         #expect(grover.name == "Grover")         #expect(grover.nameKey == "grover")         #expect(grover.aliases == ["Klar"])         #expect(grover.note == "The guide.")         #expect(grover.facts.map(\.quote) == ["promised to guide them home"])-        #expect(grover.facts.first?.source == .entry(BackupV14Fixtures.entryID))-        #expect(grover.workID == BackupV14Fixtures.workID, "the character joins its work")+        #expect(grover.facts.first?.source == .entry(BackupV15Fixtures.entryID))+        #expect(grover.workID == BackupV15Fixtures.workID, "the character joins its work")          let suppressions = try await fixture.repository.m5SuppressionRows()-        let row = try #require(suppressions.first { $0.id == BackupV14Fixtures.suppressionID })+        let row = try #require(suppressions.first { $0.id == BackupV15Fixtures.suppressionID })         #expect(row.nameKey == "the crowned one")         #expect(row.kind == .candidate)         #expect(row.status == .active)-        #expect(row.workID == BackupV14Fixtures.workID)+        #expect(row.workID == BackupV15Fixtures.workID)          #expect(-            try await fixture.repository.m5EntryCoverage(BackupV14Fixtures.entryID)-                == BackupV14Fixtures.noteFingerprint)+            try await fixture.repository.m5EntryCoverage(BackupV15Fixtures.entryID)+                == BackupV15Fixtures.noteFingerprint)         #expect(-            try await fixture.repository.m5WorkCoverage(BackupV14Fixtures.workID)-                == BackupV14Fixtures.genericNotesFingerprint)+            try await fixture.repository.m5WorkCoverage(BackupV15Fixtures.workID)+                == BackupV15Fixtures.genericNotesFingerprint)     }      /// Req 6.7 through the archive: a character with no work is a tolerated@@ -2240,14 +2287,14 @@ struct BackupV14ImportTests {         let fixture = try await M5Fixture()          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(                     characters: [-                        BackupV14Fixtures.character(id: BackupV14Fixtures.orphanID, workID: nil)+                        BackupV15Fixtures.character(id: BackupV15Fixtures.orphanID, workID: nil)                     ])))          let characters = try await fixture.repository.m5AllCharacters()-        let orphan = try #require(characters.first { $0.id == BackupV14Fixtures.orphanID })+        let orphan = try #require(characters.first { $0.id == BackupV15Fixtures.orphanID })         #expect(orphan.workID == nil)     } @@ -2259,13 +2306,13 @@ struct BackupV14ImportTests {         let fixture = try await M5Fixture()          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(entryFingerprint: "not-this-note")))+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(entryFingerprint: "not-this-note"))) -        #expect(try await fixture.repository.m5EntryCoverage(BackupV14Fixtures.entryID) == nil)+        #expect(try await fixture.repository.m5EntryCoverage(BackupV15Fixtures.entryID) == nil)         #expect(-            try await fixture.repository.m5WorkCoverage(BackupV14Fixtures.workID)-                == BackupV14Fixtures.genericNotesFingerprint)+            try await fixture.repository.m5WorkCoverage(BackupV15Fixtures.workID)+                == BackupV15Fixtures.genericNotesFingerprint)     }      // MARK: Value guards and idempotence (Req 6.1, 7.7's shape)@@ -2274,22 +2321,22 @@ struct BackupV14ImportTests {     /// rows: the memberships and the pairs are asserted beside the characters and     /// suppressions, because they are the two the 7/8 format added and the two a     /// second import could silently rewrite.-    @Test("Importing the same 14/15 archive twice changes nothing the second time")+    @Test("Importing the same 15/16 archive twice changes nothing the second time")     func importingTwiceChangesNothing() async throws {         let fixture = try await M5Fixture()-        let base = BackupV14Fixtures.payload()+        let base = BackupV15Fixtures.payload()         let stranger = UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeee99")!-        let ids = WorkDistinctPair.sortedIDs(BackupV14Fixtures.workID, stranger)-        let plan = BackupV14Fixtures.plan(-            BackupV14Payload(+        let ids = WorkDistinctPair.sortedIDs(BackupV15Fixtures.workID, stranger)+        let plan = BackupV15Fixtures.plan(+            BackupV15Payload(                 entries: base.entries, works: base.works, sites: base.sites,                 titlePatterns: base.titlePatterns, urlRules: base.urlRules,                 workTypes: base.workTypes, memberships: base.memberships,                 distinctPairs: [-                    BackupV14DistinctPair(+                    BackupV15DistinctPair(                         id: UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeee98")!,                         lowerWorkID: ids.lower, higherWorkID: ids.higher,-                        recordedAt: BackupV14Fixtures.created)+                        recordedAt: BackupV15Fixtures.created)                 ],                 characters: base.characters, suppressions: base.suppressions,                 places: base.places, placeSuppressions: base.placeSuppressions))@@ -2314,20 +2361,20 @@ struct BackupV14ImportTests {     func olderArchiveDoesNotRegressACharacter() async throws {         let fixture = try await M5Fixture()         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.payload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.payload()))          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(                     characters: [-                        BackupV14Fixtures.character(+                        BackupV15Fixtures.character(                             name: "Renamed by an older device", note: "older",-                            modifiedAt: BackupV14Fixtures.created.addingTimeInterval(-1_000))+                            modifiedAt: BackupV15Fixtures.created.addingTimeInterval(-1_000))                     ])))          let grover = try #require(             try await fixture.repository.m5AllCharacters()-                .first { $0.id == BackupV14Fixtures.groverID })+                .first { $0.id == BackupV15Fixtures.groverID })         #expect(grover.name == "Grover")         #expect(grover.note == "The guide.")     }@@ -2344,25 +2391,25 @@ struct BackupV14ImportTests {     @Test("An archived cover restores byte-identical, with the digest re-derived")     func archivedCoverRestoresWithTheDigestReDerived() async throws {         let fixture = try await M5Fixture()-        let archive = try BackupV14Codec.encode(-            payload: BackupV14Fixtures.coveredPayload(),-            metadata: BackupV14Fixtures.metadata())+        let archive = try BackupV15Codec.encode(+            payload: BackupV15Fixtures.coveredPayload(),+            metadata: BackupV15Fixtures.metadata())          try await fixture.repository.confirmImport(plan: try BackupImporter.plan(from: archive))          #expect(-            try await fixture.repository.thumbnailColumns(of: BackupV14Fixtures.workID)+            try await fixture.repository.thumbnailColumns(of: BackupV15Fixtures.workID)                 == [ThumbnailColumns(-                    byteCount: BackupV14Fixtures.coverBytes.count,+                    byteCount: BackupV15Fixtures.coverBytes.count,                     shapeRaw: ThumbnailShape.portrait.rawValue,-                    digest: BackupV14Fixtures.coverDigest)])+                    digest: BackupV15Fixtures.coverDigest)])         // Byte-identical, not merely the same length — and read back through the         // production accessor, which is digest-gated, so a mismatch reads as nil         // rather than as the wrong picture.         #expect(             try await fixture.repository.thumbnailBytes(-                workID: BackupV14Fixtures.workID, digest: BackupV14Fixtures.coverDigest)-                == BackupV14Fixtures.coverBytes)+                workID: BackupV15Fixtures.workID, digest: BackupV15Fixtures.coverDigest)+                == BackupV15Fixtures.coverBytes)     }      /// Decision 3 through the whole archive: a cover stored shorter than its box@@ -2373,10 +2420,10 @@ struct BackupV14ImportTests {     @Test("A gapped cover round-trips and is not dropped on import")     func gappedCoverRoundTrips() async throws {         let fixture = try await M5Fixture()-        let archive = try BackupV14Codec.encode(-            payload: BackupV14Fixtures.coveredPayload(-                bytes: BackupV14Fixtures.gappedCoverBytes),-            metadata: BackupV14Fixtures.metadata())+        let archive = try BackupV15Codec.encode(+            payload: BackupV15Fixtures.coveredPayload(+                bytes: BackupV15Fixtures.gappedCoverBytes),+            metadata: BackupV15Fixtures.metadata())          let result = try await fixture.repository.confirmImport(             plan: try BackupImporter.plan(from: archive))@@ -2388,9 +2435,9 @@ struct BackupV14ImportTests {         #expect(report.droppedThumbnails.isEmpty)         #expect(             try await fixture.repository.thumbnailBytes(-                workID: BackupV14Fixtures.workID,-                digest: BackupV14Fixtures.gappedCoverDigest)-                == BackupV14Fixtures.gappedCoverBytes)+                workID: BackupV15Fixtures.workID,+                digest: BackupV15Fixtures.gappedCoverDigest)+                == BackupV15Fixtures.gappedCoverBytes)     }      /// Req 8.4 on the **insert** path: a record whose bytes decode as `Data` and@@ -2406,9 +2453,9 @@ struct BackupV14ImportTests {         let fixture = try await M5Fixture()          let result = try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.coveredPayload(-                    bytes: BackupV14Fixtures.undecodableCoverBytes)))+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.coveredPayload(+                    bytes: BackupV15Fixtures.undecodableCoverBytes)))          guard case .committed(let counts, let report) = result else {             Issue.record("expected committed, got \(result)")@@ -2419,7 +2466,7 @@ struct BackupV14ImportTests {         #expect(counts.works >= 1)         #expect(report.droppedThumbnails == ["Actual Title"])         #expect(-            try await fixture.repository.thumbnailColumns(of: BackupV14Fixtures.workID)+            try await fixture.repository.thumbnailColumns(of: BackupV15Fixtures.workID)                 == [ThumbnailColumns.empty])     } @@ -2433,16 +2480,16 @@ struct BackupV14ImportTests {     func undecodableCoverClearsALocalCover() async throws {         let fixture = try await M5Fixture()         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.coveredPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.coveredPayload()))         #expect(-            try await fixture.repository.thumbnailColumns(of: BackupV14Fixtures.workID)+            try await fixture.repository.thumbnailColumns(of: BackupV15Fixtures.workID)                 != [ThumbnailColumns.empty])          let result = try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.coveredPayload(-                    bytes: BackupV14Fixtures.undecodableCoverBytes,-                    modifiedAt: BackupV14Fixtures.created.addingTimeInterval(1_000))))+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.coveredPayload(+                    bytes: BackupV15Fixtures.undecodableCoverBytes,+                    modifiedAt: BackupV15Fixtures.created.addingTimeInterval(1_000))))          guard case .committed(_, let report) = result else {             Issue.record("expected committed, got \(result)")@@ -2450,7 +2497,7 @@ struct BackupV14ImportTests {         }         #expect(report.droppedThumbnails == ["Actual Title"])         #expect(-            try await fixture.repository.thumbnailColumns(of: BackupV14Fixtures.workID)+            try await fixture.repository.thumbnailColumns(of: BackupV15Fixtures.workID)                 == [ThumbnailColumns.empty])     } @@ -2462,16 +2509,16 @@ struct BackupV14ImportTests {     func olderArchiveDoesNotReplaceANewerLocalCover() async throws {         let fixture = try await M5Fixture()         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.coveredPayload(-                    modifiedAt: BackupV14Fixtures.created.addingTimeInterval(1_000))))+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.coveredPayload(+                    modifiedAt: BackupV15Fixtures.created.addingTimeInterval(1_000))))          let result = try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.coveredPayload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.coveredPayload(                     shapeRaw: ThumbnailShape.square.rawValue,-                    bytes: BackupV14Fixtures.undecodableCoverBytes,-                    modifiedAt: BackupV14Fixtures.created)))+                    bytes: BackupV15Fixtures.undecodableCoverBytes,+                    modifiedAt: BackupV15Fixtures.created)))          guard case .committed(_, let report) = result else {             Issue.record("expected committed, got \(result)")@@ -2479,11 +2526,11 @@ struct BackupV14ImportTests {         }         #expect(report.droppedThumbnails.isEmpty)         #expect(-            try await fixture.repository.thumbnailColumns(of: BackupV14Fixtures.workID)+            try await fixture.repository.thumbnailColumns(of: BackupV15Fixtures.workID)                 == [ThumbnailColumns(-                    byteCount: BackupV14Fixtures.coverBytes.count,+                    byteCount: BackupV15Fixtures.coverBytes.count,                     shapeRaw: ThumbnailShape.portrait.rawValue,-                    digest: BackupV14Fixtures.coverDigest)])+                    digest: BackupV15Fixtures.coverDigest)])     }      /// Req 1.11's argument, applied to import: importing the same archive twice@@ -2499,21 +2546,21 @@ struct BackupV14ImportTests {     @Test("Importing the same archive twice leaves the cover untouched")     func importingTwiceLeavesTheCoverUntouched() async throws {         let fixture = try await M5Fixture()-        let plan = BackupV14Fixtures.plan(BackupV14Fixtures.coveredPayload())+        let plan = BackupV15Fixtures.plan(BackupV15Fixtures.coveredPayload())          try await fixture.repository.confirmImport(plan: plan)         let columnsAfterFirst = try await fixture.repository-            .thumbnailColumns(of: BackupV14Fixtures.workID)+            .thumbnailColumns(of: BackupV15Fixtures.workID)          try await fixture.repository.confirmImport(plan: plan)          #expect(-            try await fixture.repository.thumbnailColumns(of: BackupV14Fixtures.workID)+            try await fixture.repository.thumbnailColumns(of: BackupV15Fixtures.workID)                 == columnsAfterFirst)         #expect(             try await fixture.repository.thumbnailBytes(-                workID: BackupV14Fixtures.workID, digest: BackupV14Fixtures.coverDigest)-                == BackupV14Fixtures.coverBytes)+                workID: BackupV15Fixtures.workID, digest: BackupV15Fixtures.coverDigest)+                == BackupV15Fixtures.coverBytes)     }      /// The half the repository API cannot show: whether the second application@@ -2526,7 +2573,7 @@ struct BackupV14ImportTests {     /// which is what Req 1.8 promises a restore does.     @Test("Re-applying the same archive cover writes nothing, and a broken blob heals")     func reapplyingTheSameCoverWritesNothing() throws {-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let container = try ModelContainer(             for: schema,             configurations: [@@ -2537,14 +2584,14 @@ struct BackupV14ImportTests {         context.autosaveEnabled = false         let work = Work.create(             in: context, title: "Covered", hostname: "a.example",-            timestamp: BackupV14Fixtures.created)+            timestamp: BackupV15Fixtures.created)         let cover = ArchiveThumbnail.value(             shapeRaw: ThumbnailShape.portrait.rawValue,-            bytes: BackupV14Fixtures.coverBytes,-            digest: BackupV14Fixtures.coverDigest)+            bytes: BackupV15Fixtures.coverBytes,+            digest: BackupV15Fixtures.coverDigest)         LibraryRepository.applyThumbnail(cover, to: work)         try context.save()-        #expect(work.thumbnailDigest == BackupV14Fixtures.coverDigest)+        #expect(work.thumbnailDigest == BackupV15Fixtures.coverDigest)          LibraryRepository.applyThumbnail(cover, to: work)         #expect(!context.hasChanges, "a second import of the same cover must write nothing")@@ -2556,7 +2603,7 @@ struct BackupV14ImportTests {         try context.save()         LibraryRepository.applyThumbnail(cover, to: work)         #expect(context.hasChanges, "a restore must heal a row whose blob is not its digest")-        #expect(work.thumbnailData == BackupV14Fixtures.coverBytes)+        #expect(work.thumbnailData == BackupV15Fixtures.coverBytes)         try context.save()          // The clearing arm, both ways round.@@ -2575,7 +2622,7 @@ struct BackupV14ImportTests {         let fixture = try await M5Fixture()          let result = try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.coveredPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.coveredPayload()))          guard case .committed(_, let report) = result else {             Issue.record("expected committed, got \(result)")@@ -2588,20 +2635,20 @@ struct BackupV14ImportTests {     func newerArchiveUpdatesACharacter() async throws {         let fixture = try await M5Fixture()         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.payload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.payload()))          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(                     characters: [-                        BackupV14Fixtures.character(+                        BackupV15Fixtures.character(                             name: "Grover Underwood", note: "Still the guide.",-                            modifiedAt: BackupV14Fixtures.created.addingTimeInterval(1_000))+                            modifiedAt: BackupV15Fixtures.created.addingTimeInterval(1_000))                     ])))          let grover = try #require(             try await fixture.repository.m5AllCharacters()-                .first { $0.id == BackupV14Fixtures.groverID })+                .first { $0.id == BackupV15Fixtures.groverID })         #expect(grover.name == "Grover Underwood")         #expect(grover.note == "Still the guide.")         // The retained key never moves with a rename (Q19/Q46) — including a@@ -2615,21 +2662,21 @@ struct BackupV14ImportTests {     func olderSuppressionDoesNotUndoAClear() async throws {         let fixture = try await M5Fixture()         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(                     suppressions: [-                        BackupV14Fixtures.suppression(+                        BackupV15Fixtures.suppression(                             status: .cleared,-                            actionAt: BackupV14Fixtures.created.addingTimeInterval(1_000))+                            actionAt: BackupV15Fixtures.created.addingTimeInterval(1_000))                     ])))          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(suppressions: [BackupV14Fixtures.suppression()])))+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(suppressions: [BackupV15Fixtures.suppression()])))          let row = try #require(             try await fixture.repository.m5SuppressionRows()-                .first { $0.id == BackupV14Fixtures.suppressionID })+                .first { $0.id == BackupV15Fixtures.suppressionID })         #expect(row.status == .cleared)     } @@ -2641,53 +2688,53 @@ struct BackupV14ImportTests {     ///     /// It was parameterised over the generations that had nowhere to write a     /// character. Those read paths are gone (Decision 2), so the state is now-    /// reached the only way it still can be — a 14/15 archive whose arrays are+    /// reached the only way it still can be — a 15/16 archive whose arrays are     /// empty.     @Test("Importing an archive with no characters creates none")     func archivesWithoutCharactersCreateNone() async throws {         let fixture = try await M5Fixture()          let plan = try BackupImporter.plan(-            from: try BackupV14Codec.encode(-                payload: BackupV14Fixtures.composedPayload(),-                metadata: BackupV14Fixtures.metadata()))+            from: try BackupV15Codec.encode(+                payload: BackupV15Fixtures.composedPayload(),+                metadata: BackupV15Fixtures.metadata()))         try await fixture.repository.confirmImport(plan: plan)          #expect(try await fixture.repository.m5AllCharacters().isEmpty)         #expect(try await fixture.repository.m5SuppressionRows().isEmpty)         #expect(try await fixture.repository.m5AllPlaces().isEmpty)         #expect(try await fixture.repository.m5PlaceSuppressionRows().isEmpty)-        #expect(try await fixture.repository.m5EntryCoverage(BackupV14Fixtures.entryID) == nil)+        #expect(try await fixture.repository.m5EntryCoverage(BackupV15Fixtures.entryID) == nil)     }      // MARK: The places (Req 5.1, 5.3, 5.5) -    /// Req 5.1: a 14/15 archive lands its places and their suppressions into a+    /// Req 5.1: a 15/16 archive lands its places and their suppressions into a     /// library that holds only the seeds, on the same terms the characters     /// arrive on — the generic merge is one body called once per kind, and this     /// is the place call's evidence that it ran.-    @Test("A 14/15 archive commits its places and place suppressions")+    @Test("A 15/16 archive commits its places and place suppressions")     func archiveCommitsPlaces() async throws {         let fixture = try await M5Fixture()          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.payload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.payload()))          let places = try await fixture.repository.m5AllPlaces()-        let keep = try #require(places.first { $0.id == BackupV14Fixtures.keepID })+        let keep = try #require(places.first { $0.id == BackupV15Fixtures.keepID })         #expect(keep.name == "The High Keep")         #expect(keep.nameKey == "high keep")         #expect(keep.aliases == ["The Keep"])         #expect(keep.note == "The fortress above the pass.")         #expect(keep.facts.map(\.quote) == ["above the pass"])-        #expect(keep.workID == BackupV14Fixtures.workID, "the place joins its work")+        #expect(keep.workID == BackupV15Fixtures.workID, "the place joins its work")          let rows = try await fixture.repository.m5PlaceSuppressionRows()-        let row = try #require(rows.first { $0.id == BackupV14Fixtures.placeSuppressionID })+        let row = try #require(rows.first { $0.id == BackupV15Fixtures.placeSuppressionID })         #expect(row.nameKey == "low road")         #expect(row.kind == .candidate)         #expect(row.status == .active)-        #expect(row.workID == BackupV14Fixtures.workID)+        #expect(row.workID == BackupV15Fixtures.workID)     }      /// Req 5.5 and Q60: an owner the archive names and this library cannot@@ -2700,24 +2747,24 @@ struct BackupV14ImportTests {         let fixture = try await M5Fixture()          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(                     places: [-                        BackupV14Fixtures.place(-                            id: BackupV14Fixtures.orphanPlaceID, workID: absent)+                        BackupV15Fixtures.place(+                            id: BackupV15Fixtures.orphanPlaceID, workID: absent)                     ],-                    placeSuppressions: [BackupV14Fixtures.placeSuppression(workID: absent)])))+                    placeSuppressions: [BackupV15Fixtures.placeSuppression(workID: absent)])))          let orphan = try #require(             try await fixture.repository.m5AllPlaces()-                .first { $0.id == BackupV14Fixtures.orphanPlaceID })+                .first { $0.id == BackupV15Fixtures.orphanPlaceID })         #expect(orphan.workID == absent)         #expect(             try await fixture.repository.m5PlaceSuppressionRows()-                .first { $0.id == BackupV14Fixtures.placeSuppressionID }?.workID == absent)+                .first { $0.id == BackupV15Fixtures.placeSuppressionID }?.workID == absent) -        let payload = try await fixture.repository.backupV14Snapshot()-        #expect(payload.places.first { $0.id == BackupV14Fixtures.orphanPlaceID }?.workID == absent)+        let payload = try await fixture.repository.backupV15Snapshot()+        #expect(payload.places.first { $0.id == BackupV15Fixtures.orphanPlaceID }?.workID == absent)         #expect(payload.placeSuppressions.contains { $0.workID == absent })     } @@ -2734,7 +2781,7 @@ struct BackupV14ImportTests {     func archivedOrphanDoesNotMoveALocalPlace() async throws {         let localWorkID = UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeee96")!         let absent = UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeee97")!-        let older = BackupV14Fixtures.created.addingTimeInterval(-1_000)+        let older = BackupV15Fixtures.created.addingTimeInterval(-1_000)         let fixture = try await M5Fixture()         try await fixture.repository.seedM5Rows(             sites: [M5SeedSite(hostname: "b.example")],@@ -2744,17 +2791,17 @@ struct BackupV14ImportTests {             ],             places: [                 M5SeedPlace(-                    id: BackupV14Fixtures.keepID, name: "The Keep", nameKey: "high keep",+                    id: BackupV15Fixtures.keepID, name: "The Keep", nameKey: "high keep",                     workID: localWorkID, createdAt: older, modifiedAt: older)             ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(places: [BackupV14Fixtures.place(workID: absent)])))+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(places: [BackupV15Fixtures.place(workID: absent)])))          let keep = try #require(             try await fixture.repository.m5AllPlaces()-                .first { $0.id == BackupV14Fixtures.keepID })+                .first { $0.id == BackupV15Fixtures.keepID })         #expect(keep.workID == localWorkID, "an owner that resolves to nothing never moves a place")         #expect(keep.name == "The High Keep", "the archive's content still applies")     }@@ -2765,22 +2812,22 @@ struct BackupV14ImportTests {     @Test("A local orphan place adopts an archived work this library resolves")     func localOrphanPlaceAdoptsAResolvingWork() async throws {         let unresolvable = UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeee95")!-        let older = BackupV14Fixtures.created.addingTimeInterval(-1_000)+        let older = BackupV15Fixtures.created.addingTimeInterval(-1_000)         let fixture = try await M5Fixture()         try await fixture.repository.seedM5Rows(             places: [                 M5SeedPlace(-                    id: BackupV14Fixtures.keepID, name: "The Keep", nameKey: "high keep",+                    id: BackupV15Fixtures.keepID, name: "The Keep", nameKey: "high keep",                     workID: unresolvable, createdAt: older, modifiedAt: older)             ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.payload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.payload()))          let keep = try #require(             try await fixture.repository.m5AllPlaces()-                .first { $0.id == BackupV14Fixtures.keepID })-        #expect(keep.workID == BackupV14Fixtures.workID)+                .first { $0.id == BackupV15Fixtures.keepID })+        #expect(keep.workID == BackupV15Fixtures.workID)         #expect(keep.name == "The High Keep")     } @@ -2794,7 +2841,7 @@ struct BackupV14ImportTests {     func archivedOrphanDoesNotMoveAPlaceSuppression() async throws {         let localWorkID = UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeee94")!         let absent = UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeee97")!-        let older = BackupV14Fixtures.created.addingTimeInterval(-1_000)+        let older = BackupV15Fixtures.created.addingTimeInterval(-1_000)         let fixture = try await M5Fixture()         try await fixture.repository.seedM5Rows(             sites: [M5SeedSite(hostname: "b.example")],@@ -2804,18 +2851,18 @@ struct BackupV14ImportTests {             ],             placeSuppressions: [                 M5SeedPlaceSuppression(-                    id: BackupV14Fixtures.placeSuppressionID, workID: localWorkID,+                    id: BackupV15Fixtures.placeSuppressionID, workID: localWorkID,                     nameKey: "old key", actionAt: older)             ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(-                    placeSuppressions: [BackupV14Fixtures.placeSuppression(workID: absent)])))+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(+                    placeSuppressions: [BackupV15Fixtures.placeSuppression(workID: absent)])))          let row = try #require(             try await fixture.repository.m5PlaceSuppressionRows()-                .first { $0.id == BackupV14Fixtures.placeSuppressionID })+                .first { $0.id == BackupV15Fixtures.placeSuppressionID })         #expect(             row.workID == localWorkID,             "an owner that resolves to nothing never moves a suppression")@@ -2824,10 +2871,10 @@ struct BackupV14ImportTests {      /// The idempotence half, over the two arrays this generation adds: a second     /// import of the same file writes nothing.-    @Test("Importing the same 14/15 archive twice leaves the places untouched")+    @Test("Importing the same 15/16 archive twice leaves the places untouched")     func importingTwiceLeavesPlacesUntouched() async throws {         let fixture = try await M5Fixture()-        let plan = BackupV14Fixtures.plan(BackupV14Fixtures.payload())+        let plan = BackupV15Fixtures.plan(BackupV15Fixtures.payload())          try await fixture.repository.confirmImport(plan: plan)         let placesAfterFirst = try await fixture.repository.m5AllPlaces()@@ -2847,35 +2894,35 @@ struct BackupV14ImportTests {     func placeModificationGuard() async throws {         let fixture = try await M5Fixture()         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.payload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.payload()))          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(                     places: [-                        BackupV14Fixtures.place(+                        BackupV15Fixtures.place(                             name: "Renamed by an older device", note: "older",-                            modifiedAt: BackupV14Fixtures.created.addingTimeInterval(-1_000))+                            modifiedAt: BackupV15Fixtures.created.addingTimeInterval(-1_000))                     ])))          var keep = try #require(             try await fixture.repository.m5AllPlaces()-                .first { $0.id == BackupV14Fixtures.keepID })+                .first { $0.id == BackupV15Fixtures.keepID })         #expect(keep.name == "The High Keep")         #expect(keep.note == "The fortress above the pass.")          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(                     places: [-                        BackupV14Fixtures.place(+                        BackupV15Fixtures.place(                             name: "The Keep Above the Pass", note: "Still standing.",-                            modifiedAt: BackupV14Fixtures.created.addingTimeInterval(1_000))+                            modifiedAt: BackupV15Fixtures.created.addingTimeInterval(1_000))                     ])))          keep = try #require(             try await fixture.repository.m5AllPlaces()-                .first { $0.id == BackupV14Fixtures.keepID })+                .first { $0.id == BackupV15Fixtures.keepID })         #expect(keep.name == "The Keep Above the Pass")         #expect(keep.note == "Still standing.")         // The retained key never moves with a rename, an archived one included.@@ -2889,22 +2936,22 @@ struct BackupV14ImportTests {     func olderPlaceSuppressionDoesNotUndoAClear() async throws {         let fixture = try await M5Fixture()         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(                     placeSuppressions: [-                        BackupV14Fixtures.placeSuppression(+                        BackupV15Fixtures.placeSuppression(                             status: .cleared,-                            actionAt: BackupV14Fixtures.created.addingTimeInterval(1_000))+                            actionAt: BackupV15Fixtures.created.addingTimeInterval(1_000))                     ])))          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.payload(-                    placeSuppressions: [BackupV14Fixtures.placeSuppression()])))+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.payload(+                    placeSuppressions: [BackupV15Fixtures.placeSuppression()])))          let row = try #require(             try await fixture.repository.m5PlaceSuppressionRows()-                .first { $0.id == BackupV14Fixtures.placeSuppressionID })+                .first { $0.id == BackupV15Fixtures.placeSuppressionID })         #expect(row.status == .cleared)     } @@ -2915,22 +2962,22 @@ struct BackupV14ImportTests {     @Test("An import into an empty library reproduces series, memberships and links")     func seriesAndLinksImportWhole() async throws {         let fixture = try await M5Fixture()-        let plan = BackupV14Fixtures.plan(BackupV14Fixtures.seriesPayload())+        let plan = BackupV15Fixtures.plan(BackupV15Fixtures.seriesPayload())          try await fixture.repository.confirmImport(plan: plan)          let series = try await fixture.repository.seriesRowValues()-        #expect(series.map(\.id) == [BackupV14Fixtures.seriesID])+        #expect(series.map(\.id) == [BackupV15Fixtures.seriesID])         #expect(series.first?.name == "Ashfall Cycle")         #expect(series.first?.notes == "Read 2.5 after 2.")         #expect(-            try await fixture.repository.membershipColumns(of: BackupV14Fixtures.composedWorkID)-                == [SeriesColumns(seriesID: BackupV14Fixtures.seriesID, position: 1)])+            try await fixture.repository.membershipColumns(of: BackupV15Fixtures.composedWorkID)+                == [SeriesColumns(seriesID: BackupV15Fixtures.seriesID, position: 1)])         #expect(-            try await fixture.repository.membershipColumns(of: BackupV14Fixtures.secondWorkID)-                == [SeriesColumns(seriesID: BackupV14Fixtures.seriesID, position: 2.5)])+            try await fixture.repository.membershipColumns(of: BackupV15Fixtures.secondWorkID)+                == [SeriesColumns(seriesID: BackupV15Fixtures.seriesID, position: 2.5)])         let links = try await fixture.repository.workLinkRowValues()-        #expect(links.map(\.id) == [BackupV14Fixtures.linkID])+        #expect(links.map(\.id) == [BackupV15Fixtures.linkID])         #expect(links.first?.linkType == "adaptation")          // A repeated import writes the same values back and removes nothing.@@ -2949,29 +2996,29 @@ struct BackupV14ImportTests {         let local = UUID(uuidString: "5E81E5A0-0000-4000-8000-0000000000ff")!         let localLink = UUID(uuidString: "11115E51-0000-4000-8000-0000000000ff")!         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.seriesPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.seriesPayload()))         // Two rows only this library holds, and a newer local edit to the         // series the archive also carries.         try await fixture.repository.seedSeries([SeedSeries(id: local, name: "Quiet Shelf")])         try await fixture.repository.seedWorkLinks([             SeedWorkLink(-                id: localLink, a: BackupV14Fixtures.composedWorkID,+                id: localLink, a: BackupV15Fixtures.composedWorkID,                 b: UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeee97")!, type: "prequel")         ])         try await fixture.repository.updateSeries(-            id: BackupV14Fixtures.seriesID, name: "Renamed here", notes: "later")+            id: BackupV15Fixtures.seriesID, name: "Renamed here", notes: "later")         try await fixture.repository.retypeLink(-            id: BackupV14Fixtures.linkID, type: "retyped here")+            id: BackupV15Fixtures.linkID, type: "retyped here")          // The same archive again: its records are now older than both rows.         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.seriesPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.seriesPayload()))          let afterOlder = try await fixture.repository.seriesRowValues()-        #expect(afterOlder.first { $0.id == BackupV14Fixtures.seriesID }?.name == "Renamed here")+        #expect(afterOlder.first { $0.id == BackupV15Fixtures.seriesID }?.name == "Renamed here")         #expect(             try await fixture.repository.workLinkRowValues()-                .first { $0.id == BackupV14Fixtures.linkID }?.linkType == "retyped here")+                .first { $0.id == BackupV15Fixtures.linkID }?.linkType == "retyped here")         // Nothing the archive does not carry was removed.         #expect(afterOlder.contains { $0.id == local })         #expect(try await fixture.repository.workLinkIDs().contains(localLink))@@ -2981,19 +3028,19 @@ struct BackupV14ImportTests {         // own epoch — not merely later than the archive's own `created`.         let later = M5Fixture.epoch.addingTimeInterval(3_600)         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.seriesPayload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.seriesPayload(                     series: [-                        BackupV14Fixtures.seriesRecord(name: "Renamed there", modifiedAt: later)+                        BackupV15Fixtures.seriesRecord(name: "Renamed there", modifiedAt: later)                     ],-                    links: [BackupV14Fixtures.linkRecord(type: "retyped there", modifiedAt: later)])))+                    links: [BackupV15Fixtures.linkRecord(type: "retyped there", modifiedAt: later)])))          #expect(             try await fixture.repository.seriesRowValues()-                .first { $0.id == BackupV14Fixtures.seriesID }?.name == "Renamed there")+                .first { $0.id == BackupV15Fixtures.seriesID }?.name == "Renamed there")         #expect(             try await fixture.repository.workLinkRowValues()-                .first { $0.id == BackupV14Fixtures.linkID }?.linkType == "retyped there")+                .first { $0.id == BackupV15Fixtures.linkID }?.linkType == "retyped there")     }      /// Req 13.5's tolerated half, at the store rather than on the wire: a work@@ -3006,16 +3053,16 @@ struct BackupV14ImportTests {         let absentSeries = UUID(uuidString: "5E81E5A0-0000-4000-8000-000000000009")!         let absentWork = UUID(uuidString: "eeeeeeee-eeee-eeee-eeee-eeeeeeeeee99")!         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.seriesPayload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.seriesPayload(                     links: [-                        BackupV14Fixtures.linkRecord(-                            a: BackupV14Fixtures.composedWorkID, b: absentWork, type: "spin-off")+                        BackupV15Fixtures.linkRecord(+                            a: BackupV15Fixtures.composedWorkID, b: absentWork, type: "spin-off")                     ],                     firstMembership: (absentSeries, 3))))          #expect(-            try await fixture.repository.membershipColumns(of: BackupV14Fixtures.composedWorkID)+            try await fixture.repository.membershipColumns(of: BackupV15Fixtures.composedWorkID)                 == [SeriesColumns(seriesID: absentSeries, position: 3)])         let links = try await fixture.repository.workLinkRowValues()         #expect(links.count == 1)@@ -3032,47 +3079,47 @@ struct BackupV14ImportTests {     @Test("An import into a seeds-only library reproduces creators, roles and credits")     func creatorsImportWhole() async throws {         let fixture = try await M5Fixture()-        let plan = BackupV14Fixtures.plan(BackupV14Fixtures.creditsPayload())+        let plan = BackupV15Fixtures.plan(BackupV15Fixtures.creditsPayload())          try await fixture.repository.confirmImport(plan: plan)          let creators = CreatorDirectory(rows: try await fixture.repository.creatorRowValues())-        let mori = try #require(creators[BackupV14Fixtures.moriID])+        let mori = try #require(creators[BackupV15Fixtures.moriID])         #expect(mori.name == "Mori Ayane")         #expect(mori.notes == "Also draws.")         #expect(mori.state == .active)         // The archive's own field timestamps, so the next sync fold and a         // repeated import see exactly what the exporting device saw (Q50).-        #expect(mori.nameModifiedAt == BackupV14Fixtures.created)-        #expect(mori.notesModifiedAt == BackupV14Fixtures.created)-        let alias = try #require(creators[BackupV14Fixtures.aliasID])+        #expect(mori.nameModifiedAt == BackupV15Fixtures.created)+        #expect(mori.notesModifiedAt == BackupV15Fixtures.created)+        let alias = try #require(creators[BackupV15Fixtures.aliasID])         #expect(alias.state == .merged)-        #expect(alias.canonicalID == BackupV14Fixtures.moriID)+        #expect(alias.canonicalID == BackupV15Fixtures.moriID)         // A credit naming the alias reads as its survivor on arrival.-        #expect(creators.canonicalID(of: BackupV14Fixtures.aliasID) == BackupV14Fixtures.moriID)+        #expect(creators.canonicalID(of: BackupV15Fixtures.aliasID) == BackupV15Fixtures.moriID)          let roles = CreatorRoleDirectory(             rows: try await fixture.repository.creatorRoleRowValues())         #expect(roles.identities.count == 5)         #expect(roles.options.map(\.name) == ["author", "artist", "translator", "letterer"])-        #expect(roles[BackupV14Fixtures.lettererRoleID]?.position == 3)-        #expect(roles[BackupV14Fixtures.editorRoleID]?.state == .removed)+        #expect(roles[BackupV15Fixtures.lettererRoleID]?.position == 3)+        #expect(roles[BackupV15Fixtures.editorRoleID]?.state == .removed)         // The three defaults are still the seeded identities the library minted         // at open: the archive's records of them matched by identifier.-        #expect(roles[BackupV14Fixtures.authorRoleID]?.isPristine == true)+        #expect(roles[BackupV15Fixtures.authorRoleID]?.isPristine == true)          let credits = try await fixture.repository.creditRows()         #expect(credits.count == 3)-        let credit = try #require(credits.first { $0.id == BackupV14Fixtures.moriCreditID })+        let credit = try #require(credits.first { $0.id == BackupV15Fixtures.moriCreditID })         #expect(             credit.roleIDs                 == [-                    BackupV14Fixtures.authorRoleID.uuidString,-                    BackupV14Fixtures.editorRoleID.uuidString,+                    BackupV15Fixtures.authorRoleID.uuidString,+                    BackupV15Fixtures.editorRoleID.uuidString,                 ].sorted())         // Req 9.5's tolerance at the store: the credit whose work the archive         // never carried is here, unresolved and nobody's to prune.-        #expect(credits.contains { $0.id == BackupV14Fixtures.orphanCreditID })+        #expect(credits.contains { $0.id == BackupV15Fixtures.orphanCreditID })          let creatorsAfterFirst = try await fixture.repository.creatorRowValues()         let rolesAfterFirst = try await fixture.repository.creatorRoleRowValues()@@ -3091,22 +3138,22 @@ struct BackupV14ImportTests {     @Test("An identifier match takes each field only when the archive's stamp beats the local")     func identifierMatchAppliesPerField() async throws {         let fixture = try await M5Fixture()-        let later = BackupV14Fixtures.created.addingTimeInterval(1_000)+        let later = BackupV15Fixtures.created.addingTimeInterval(1_000)         try await fixture.repository.seedCreators([             SeedCreator(-                id: BackupV14Fixtures.moriID, name: "Renamed here",-                nameModifiedAt: later, createdAt: BackupV14Fixtures.created)+                id: BackupV15Fixtures.moriID, name: "Renamed here",+                nameModifiedAt: later, createdAt: BackupV15Fixtures.created)         ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.creditsPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.creditsPayload()))          let creators = CreatorDirectory(rows: try await fixture.repository.creatorRowValues())-        let mori = try #require(creators[BackupV14Fixtures.moriID])+        let mori = try #require(creators[BackupV15Fixtures.moriID])         #expect(mori.name == "Renamed here")         #expect(mori.nameModifiedAt == later)         #expect(mori.notes == "Also draws.")-        #expect(mori.notesModifiedAt == BackupV14Fixtures.created)+        #expect(mori.notesModifiedAt == BackupV15Fixtures.created)     }      /// The other half of the rule: an archive field nobody has ever touched@@ -3115,20 +3162,20 @@ struct BackupV14ImportTests {     @Test("A pristine archive field never overrides a reader-touched local one")     func pristineArchiveFieldNeverStands() async throws {         let fixture = try await M5Fixture()-        let touched = BackupV14Fixtures.created.addingTimeInterval(1_000)+        let touched = BackupV15Fixtures.created.addingTimeInterval(1_000)         // A second row of the seeded identity, carrying the reader's rename.         try await fixture.repository.seedCreatorRoles([             SeedCreatorRole(-                id: BackupV14Fixtures.authorRoleID, name: "writer", position: 0,+                id: BackupV15Fixtures.authorRoleID, name: "writer", position: 0,                 nameModifiedAt: touched)         ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.creditsPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.creditsPayload()))          let roles = CreatorRoleDirectory(             rows: try await fixture.repository.creatorRoleRowValues())-        #expect(roles[BackupV14Fixtures.authorRoleID]?.name == "writer")+        #expect(roles[BackupV15Fixtures.authorRoleID]?.name == "writer")     }      /// Req 9.4: `merged` is terminal on the **local** side. An identity that@@ -3144,44 +3191,44 @@ struct BackupV14ImportTests {     func mergedStateIsTerminal() async throws {         let fixture = try await M5Fixture()         let survivor = UUID(uuidString: "c8ea1080-0000-4000-8000-0000000000a1")!-        let later = BackupV14Fixtures.created.addingTimeInterval(3_000)+        let later = BackupV15Fixtures.created.addingTimeInterval(3_000)         try await fixture.repository.seedCreators([             // Locally merged already: the archive's `active` record cannot             // resurrect it, even carrying a later state stamp.-            SeedCreator(id: survivor, name: "Kept", nameModifiedAt: BackupV14Fixtures.created),+            SeedCreator(id: survivor, name: "Kept", nameModifiedAt: BackupV15Fixtures.created),             SeedCreator(-                id: BackupV14Fixtures.moriID, name: "Mori Ayane", state: .merged,+                id: BackupV15Fixtures.moriID, name: "Mori Ayane", state: .merged,                 canonicalID: survivor,-                nameModifiedAt: BackupV14Fixtures.created,-                stateModifiedAt: BackupV14Fixtures.created),+                nameModifiedAt: BackupV15Fixtures.created,+                stateModifiedAt: BackupV15Fixtures.created),             // Locally active, and the archive says it merged into `mori`, which             // resolves here to `survivor`: the archive's later stamp applies.             SeedCreator(-                id: BackupV14Fixtures.aliasID, name: "mori ayane",-                nameModifiedAt: BackupV14Fixtures.created.addingTimeInterval(2_000),-                stateModifiedAt: BackupV14Fixtures.created),+                id: BackupV15Fixtures.aliasID, name: "mori ayane",+                nameModifiedAt: BackupV15Fixtures.created.addingTimeInterval(2_000),+                stateModifiedAt: BackupV15Fixtures.created),         ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.creditsPayload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.creditsPayload(                     creators: [-                        BackupV14Fixtures.creatorRecord(-                            id: BackupV14Fixtures.moriID, name: "Mori Ayane",+                        BackupV15Fixtures.creatorRecord(+                            id: BackupV15Fixtures.moriID, name: "Mori Ayane",                             notes: "Also draws.", stateModifiedAt: later),-                        BackupV14Fixtures.creatorRecord(-                            id: BackupV14Fixtures.studioID, name: "Studio Lantern"),-                        BackupV14Fixtures.creatorRecord(-                            id: BackupV14Fixtures.aliasID, name: "mori ayane",-                            state: .merged, canonicalID: BackupV14Fixtures.moriID,+                        BackupV15Fixtures.creatorRecord(+                            id: BackupV15Fixtures.studioID, name: "Studio Lantern"),+                        BackupV15Fixtures.creatorRecord(+                            id: BackupV15Fixtures.aliasID, name: "mori ayane",+                            state: .merged, canonicalID: BackupV15Fixtures.moriID,                             stateModifiedAt: later),                     ])))          let creators = CreatorDirectory(rows: try await fixture.repository.creatorRowValues())-        let mori = try #require(creators[BackupV14Fixtures.moriID])+        let mori = try #require(creators[BackupV15Fixtures.moriID])         #expect(mori.state == .merged)         #expect(mori.canonicalID == survivor)-        let alias = try #require(creators[BackupV14Fixtures.aliasID])+        let alias = try #require(creators[BackupV15Fixtures.aliasID])         #expect(alias.state == .merged)         // The chain the archive's pointer made — alias into mori into survivor —         // is collapsed by the same commit's reconcile.@@ -3195,25 +3242,25 @@ struct BackupV14ImportTests {     @Test("An archived merge carrying no survivor leaves a live creator active")     func survivorlessArchivedMergeLeavesTheCreatorActive() async throws {         let fixture = try await M5Fixture()-        let later = BackupV14Fixtures.created.addingTimeInterval(3_000)+        let later = BackupV15Fixtures.created.addingTimeInterval(3_000)         try await fixture.repository.seedCreators([             SeedCreator(-                id: BackupV14Fixtures.moriID, name: "Mori Ayane",-                nameModifiedAt: BackupV14Fixtures.created,-                stateModifiedAt: BackupV14Fixtures.created)+                id: BackupV15Fixtures.moriID, name: "Mori Ayane",+                nameModifiedAt: BackupV15Fixtures.created,+                stateModifiedAt: BackupV15Fixtures.created)         ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.creditsPayload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.creditsPayload(                     creators: [-                        BackupV14Fixtures.creatorRecord(-                            id: BackupV14Fixtures.moriID, name: "Mori Ayane",+                        BackupV15Fixtures.creatorRecord(+                            id: BackupV15Fixtures.moriID, name: "Mori Ayane",                             state: .merged, canonicalID: nil, stateModifiedAt: later)                     ])))          let creators = CreatorDirectory(rows: try await fixture.repository.creatorRowValues())-        #expect(creators[BackupV14Fixtures.moriID]?.state == .active)+        #expect(creators[BackupV15Fixtures.moriID]?.state == .active)         #expect(creators.options.contains { $0.name == "Mori Ayane" })     } @@ -3227,20 +3274,20 @@ struct BackupV14ImportTests {         let fixture = try await M5Fixture()          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.creditsPayload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.creditsPayload(                     creators: [-                        BackupV14Fixtures.creatorRecord(-                            id: BackupV14Fixtures.moriID, name: "Mori Ayane",+                        BackupV15Fixtures.creatorRecord(+                            id: BackupV15Fixtures.moriID, name: "Mori Ayane",                             state: .merged, canonicalID: nil)                     ])))          let rows = try await fixture.repository.creatorRowValues()-        let row = try #require(rows.first { $0.id == BackupV14Fixtures.moriID })+        let row = try #require(rows.first { $0.id == BackupV15Fixtures.moriID })         #expect(row.stateRaw == CreatorState.merged.rawValue)         #expect(row.canonicalID == nil, "the survivorless pointer is kept, not invented")         #expect(-            CreatorDirectory(rows: rows)[BackupV14Fixtures.moriID]?.state == .merged,+            CreatorDirectory(rows: rows)[BackupV15Fixtures.moriID]?.state == .merged,             "and the same commit's reconcile leaves it there — there is no chain to collapse")     } @@ -3250,26 +3297,26 @@ struct BackupV14ImportTests {     @Test("An archived merge naming an absent survivor leaves a live creator active")     func archivedMergeNamingAnAbsentSurvivorIsSkipped() async throws {         let fixture = try await M5Fixture()-        let later = BackupV14Fixtures.created.addingTimeInterval(3_000)+        let later = BackupV15Fixtures.created.addingTimeInterval(3_000)         try await fixture.repository.seedCreators([             SeedCreator(-                id: BackupV14Fixtures.moriID, name: "Mori Ayane",-                nameModifiedAt: BackupV14Fixtures.created,-                stateModifiedAt: BackupV14Fixtures.created)+                id: BackupV15Fixtures.moriID, name: "Mori Ayane",+                nameModifiedAt: BackupV15Fixtures.created,+                stateModifiedAt: BackupV15Fixtures.created)         ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.creditsPayload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.creditsPayload(                     creators: [-                        BackupV14Fixtures.creatorRecord(-                            id: BackupV14Fixtures.moriID, name: "Mori Ayane",-                            state: .merged, canonicalID: BackupV14Fixtures.absentCreatorID,+                        BackupV15Fixtures.creatorRecord(+                            id: BackupV15Fixtures.moriID, name: "Mori Ayane",+                            state: .merged, canonicalID: BackupV15Fixtures.absentCreatorID,                             stateModifiedAt: later)                     ])))          let creators = CreatorDirectory(rows: try await fixture.repository.creatorRowValues())-        #expect(creators[BackupV14Fixtures.moriID]?.state == .active)+        #expect(creators[BackupV15Fixtures.moriID]?.state == .active)     }      /// And the positive case: a survivor the archive itself carries, on a@@ -3277,30 +3324,30 @@ struct BackupV14ImportTests {     @Test("An archived merge naming a present survivor and stamped later applies")     func archivedMergeWithAPresentSurvivorApplies() async throws {         let fixture = try await M5Fixture()-        let later = BackupV14Fixtures.created.addingTimeInterval(3_000)+        let later = BackupV15Fixtures.created.addingTimeInterval(3_000)         try await fixture.repository.seedCreators([             SeedCreator(-                id: BackupV14Fixtures.moriID, name: "Mori Ayane",-                nameModifiedAt: BackupV14Fixtures.created,-                stateModifiedAt: BackupV14Fixtures.created)+                id: BackupV15Fixtures.moriID, name: "Mori Ayane",+                nameModifiedAt: BackupV15Fixtures.created,+                stateModifiedAt: BackupV15Fixtures.created)         ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.creditsPayload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.creditsPayload(                     creators: [-                        BackupV14Fixtures.creatorRecord(-                            id: BackupV14Fixtures.moriID, name: "Mori Ayane",-                            state: .merged, canonicalID: BackupV14Fixtures.studioID,+                        BackupV15Fixtures.creatorRecord(+                            id: BackupV15Fixtures.moriID, name: "Mori Ayane",+                            state: .merged, canonicalID: BackupV15Fixtures.studioID,                             stateModifiedAt: later),-                        BackupV14Fixtures.creatorRecord(-                            id: BackupV14Fixtures.studioID, name: "Studio Lantern"),+                        BackupV15Fixtures.creatorRecord(+                            id: BackupV15Fixtures.studioID, name: "Studio Lantern"),                     ])))          let creators = CreatorDirectory(rows: try await fixture.repository.creatorRowValues())-        let mori = try #require(creators[BackupV14Fixtures.moriID])+        let mori = try #require(creators[BackupV15Fixtures.moriID])         #expect(mori.state == .merged)-        #expect(mori.canonicalID == BackupV14Fixtures.studioID)+        #expect(mori.canonicalID == BackupV15Fixtures.studioID)     }      /// The stamp rule holds for a merge like any other field: an archive older@@ -3309,26 +3356,26 @@ struct BackupV14ImportTests {     @Test("An archived merge older than the local state writes nothing")     func archivedMergeOlderThanTheLocalStateIsIgnored() async throws {         let fixture = try await M5Fixture()-        let touched = BackupV14Fixtures.created.addingTimeInterval(3_000)+        let touched = BackupV15Fixtures.created.addingTimeInterval(3_000)         try await fixture.repository.seedCreators([             SeedCreator(-                id: BackupV14Fixtures.moriID, name: "Mori Ayane",+                id: BackupV15Fixtures.moriID, name: "Mori Ayane",                 nameModifiedAt: touched, stateModifiedAt: touched)         ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.creditsPayload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.creditsPayload(                     creators: [-                        BackupV14Fixtures.creatorRecord(-                            id: BackupV14Fixtures.moriID, name: "Mori Ayane",-                            state: .merged, canonicalID: BackupV14Fixtures.studioID),-                        BackupV14Fixtures.creatorRecord(-                            id: BackupV14Fixtures.studioID, name: "Studio Lantern"),+                        BackupV15Fixtures.creatorRecord(+                            id: BackupV15Fixtures.moriID, name: "Mori Ayane",+                            state: .merged, canonicalID: BackupV15Fixtures.studioID),+                        BackupV15Fixtures.creatorRecord(+                            id: BackupV15Fixtures.studioID, name: "Studio Lantern"),                     ])))          let creators = CreatorDirectory(rows: try await fixture.repository.creatorRowValues())-        #expect(creators[BackupV14Fixtures.moriID]?.state == .active)+        #expect(creators[BackupV15Fixtures.moriID]?.state == .active)     }      /// Q54: an archive record matching a local one **by name only** is inserted@@ -3342,20 +3389,20 @@ struct BackupV14ImportTests {         try await fixture.repository.seedCreators([             SeedCreator(                 id: local, name: "Mori Ayane",-                nameModifiedAt: BackupV14Fixtures.created.addingTimeInterval(-1_000),-                createdAt: BackupV14Fixtures.created.addingTimeInterval(-1_000))+                nameModifiedAt: BackupV15Fixtures.created.addingTimeInterval(-1_000),+                createdAt: BackupV15Fixtures.created.addingTimeInterval(-1_000))         ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.creditsPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.creditsPayload()))          let creators = CreatorDirectory(rows: try await fixture.repository.creatorRowValues())         // Both records are still there — nothing an import touches is deleted.         #expect(creators[local] != nil)-        #expect(creators[BackupV14Fixtures.moriID] != nil)+        #expect(creators[BackupV15Fixtures.moriID] != nil)         // The earliest-created non-pristine identity survives, and the other         // reads as it (Req 10.3).-        #expect(creators.canonicalID(of: BackupV14Fixtures.moriID) == local)+        #expect(creators.canonicalID(of: BackupV15Fixtures.moriID) == local)         #expect(creators.options.count(where: { $0.name == "Mori Ayane" }) == 1)     } @@ -3371,17 +3418,17 @@ struct BackupV14ImportTests {         try await fixture.repository.seedCreatorRoles([             SeedCreatorRole(                 id: colorist, name: "colorist", position: 3,-                nameModifiedAt: BackupV14Fixtures.created,-                positionModifiedAt: BackupV14Fixtures.created,-                createdAt: BackupV14Fixtures.created)+                nameModifiedAt: BackupV15Fixtures.created,+                positionModifiedAt: BackupV15Fixtures.created,+                createdAt: BackupV15Fixtures.created)         ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.creditsPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.creditsPayload()))          let roles = CreatorRoleDirectory(             rows: try await fixture.repository.creatorRoleRowValues())-        let letterer = try #require(roles[BackupV14Fixtures.lettererRoleID])+        let letterer = try #require(roles[BackupV15Fixtures.lettererRoleID])         #expect(letterer.position == 4, "appended after the local maximum, not at the archive's 3")         #expect(letterer.positionModifiedAt == M5Fixture.epoch)         #expect(roles.options.map(\.name) == ["author", "artist", "translator", "colorist", "letterer"])@@ -3394,41 +3441,41 @@ struct BackupV14ImportTests {     @Test("An archived role state later than the local one is taken, in both directions")     func archivedRoleStateIsTakenByStamp() async throws {         let fixture = try await M5Fixture()-        let later = BackupV14Fixtures.created.addingTimeInterval(1_000)+        let later = BackupV15Fixtures.created.addingTimeInterval(1_000)         try await fixture.repository.seedCreatorRoles([             SeedCreatorRole(-                id: BackupV14Fixtures.lettererRoleID, name: "letterer", position: 3,-                nameModifiedAt: BackupV14Fixtures.created,-                positionModifiedAt: BackupV14Fixtures.created,-                stateModifiedAt: BackupV14Fixtures.created,-                createdAt: BackupV14Fixtures.created),+                id: BackupV15Fixtures.lettererRoleID, name: "letterer", position: 3,+                nameModifiedAt: BackupV15Fixtures.created,+                positionModifiedAt: BackupV15Fixtures.created,+                stateModifiedAt: BackupV15Fixtures.created,+                createdAt: BackupV15Fixtures.created),             SeedCreatorRole(-                id: BackupV14Fixtures.editorRoleID, name: "editor", position: 4,+                id: BackupV15Fixtures.editorRoleID, name: "editor", position: 4,                 state: .removed,-                nameModifiedAt: BackupV14Fixtures.created,-                positionModifiedAt: BackupV14Fixtures.created,-                stateModifiedAt: BackupV14Fixtures.created,-                createdAt: BackupV14Fixtures.created),+                nameModifiedAt: BackupV15Fixtures.created,+                positionModifiedAt: BackupV15Fixtures.created,+                stateModifiedAt: BackupV15Fixtures.created,+                createdAt: BackupV15Fixtures.created),         ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.creditsPayload(-                    creatorRoles: BackupV14Fixtures.seededRoleRecords + [-                        BackupV14Fixtures.creatorRoleRecord(-                            id: BackupV14Fixtures.lettererRoleID, name: "letterer",+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.creditsPayload(+                    creatorRoles: BackupV15Fixtures.seededRoleRecords + [+                        BackupV15Fixtures.creatorRoleRecord(+                            id: BackupV15Fixtures.lettererRoleID, name: "letterer",                             position: 3, state: .removed, stateModifiedAt: later),-                        BackupV14Fixtures.creatorRoleRecord(-                            id: BackupV14Fixtures.editorRoleID, name: "editor",+                        BackupV15Fixtures.creatorRoleRecord(+                            id: BackupV15Fixtures.editorRoleID, name: "editor",                             position: 4, stateModifiedAt: later),                     ])))          let roles = CreatorRoleDirectory(             rows: try await fixture.repository.creatorRoleRowValues())-        #expect(roles[BackupV14Fixtures.lettererRoleID]?.state == .removed)-        #expect(roles[BackupV14Fixtures.lettererRoleID]?.stateModifiedAt == later)-        #expect(roles[BackupV14Fixtures.editorRoleID]?.state == .active)-        #expect(roles[BackupV14Fixtures.editorRoleID]?.stateModifiedAt == later)+        #expect(roles[BackupV15Fixtures.lettererRoleID]?.state == .removed)+        #expect(roles[BackupV15Fixtures.lettererRoleID]?.stateModifiedAt == later)+        #expect(roles[BackupV15Fixtures.editorRoleID]?.state == .active)+        #expect(roles[BackupV15Fixtures.editorRoleID]?.stateModifiedAt == later)     }      /// The other half: an archived state older than the local one writes@@ -3437,25 +3484,25 @@ struct BackupV14ImportTests {     @Test("An archived role state older than the local one writes nothing")     func archivedRoleStateOlderThanTheLocalOneIsIgnored() async throws {         let fixture = try await M5Fixture()-        let touched = BackupV14Fixtures.created.addingTimeInterval(2_000)+        let touched = BackupV15Fixtures.created.addingTimeInterval(2_000)         try await fixture.repository.seedCreatorRoles([             SeedCreatorRole(-                id: BackupV14Fixtures.lettererRoleID, name: "letterer", position: 3,+                id: BackupV15Fixtures.lettererRoleID, name: "letterer", position: 3,                 state: .removed,-                nameModifiedAt: BackupV14Fixtures.created,-                positionModifiedAt: BackupV14Fixtures.created,+                nameModifiedAt: BackupV15Fixtures.created,+                positionModifiedAt: BackupV15Fixtures.created,                 stateModifiedAt: touched,-                createdAt: BackupV14Fixtures.created)+                createdAt: BackupV15Fixtures.created)         ])          // The archive's `letterer` is active, stamped at `created`.         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.creditsPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.creditsPayload()))          let roles = CreatorRoleDirectory(             rows: try await fixture.repository.creatorRoleRowValues())-        #expect(roles[BackupV14Fixtures.lettererRoleID]?.state == .removed)-        #expect(roles[BackupV14Fixtures.lettererRoleID]?.stateModifiedAt == touched)+        #expect(roles[BackupV15Fixtures.lettererRoleID]?.state == .removed)+        #expect(roles[BackupV15Fixtures.lettererRoleID]?.stateModifiedAt == touched)     }      /// Req 9.4's append, over **every** archive-only role rather than the@@ -3469,23 +3516,23 @@ struct BackupV14ImportTests {         try await fixture.repository.seedCreatorRoles([             SeedCreatorRole(                 id: colorist, name: "colorist", position: 3, state: .removed,-                nameModifiedAt: BackupV14Fixtures.created,-                positionModifiedAt: BackupV14Fixtures.created,-                stateModifiedAt: BackupV14Fixtures.created,-                createdAt: BackupV14Fixtures.created)+                nameModifiedAt: BackupV15Fixtures.created,+                positionModifiedAt: BackupV15Fixtures.created,+                stateModifiedAt: BackupV15Fixtures.created,+                createdAt: BackupV15Fixtures.created)         ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.creditsPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.creditsPayload()))          let roles = CreatorRoleDirectory(             rows: try await fixture.repository.creatorRoleRowValues())-        let letterer = try #require(roles[BackupV14Fixtures.lettererRoleID])+        let letterer = try #require(roles[BackupV15Fixtures.lettererRoleID])         #expect(letterer.position == 4, "past the removed role's 3, not onto it")         #expect(letterer.positionModifiedAt == M5Fixture.epoch)         // The removed one appends too, at the reader's end of the list rather         // than at the place the archive recorded.-        let editor = try #require(roles[BackupV14Fixtures.editorRoleID])+        let editor = try #require(roles[BackupV15Fixtures.editorRoleID])         #expect(editor.state == .removed)         #expect(editor.position == 5)         #expect(editor.positionModifiedAt == M5Fixture.epoch)@@ -3501,54 +3548,54 @@ struct BackupV14ImportTests {     func creditGuardHoldsBothWays() async throws {         let fixture = try await M5Fixture()         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.creditsPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.creditsPayload()))         let stored = [-            BackupV14Fixtures.authorRoleID.uuidString,-            BackupV14Fixtures.editorRoleID.uuidString,+            BackupV15Fixtures.authorRoleID.uuidString,+            BackupV15Fixtures.editorRoleID.uuidString,         ].sorted()          func reimport(roleIDs: [UUID], modifiedAt: Date) async throws {             try await fixture.repository.confirmImport(-                plan: BackupV14Fixtures.plan(-                    BackupV14Fixtures.creditsPayload(+                plan: BackupV15Fixtures.plan(+                    BackupV15Fixtures.creditsPayload(                         credits: [-                            BackupV14Fixtures.creditRecord(-                                id: BackupV14Fixtures.moriCreditID,-                                workID: BackupV14Fixtures.composedWorkID,-                                creatorID: BackupV14Fixtures.moriID,+                            BackupV15Fixtures.creditRecord(+                                id: BackupV15Fixtures.moriCreditID,+                                workID: BackupV15Fixtures.composedWorkID,+                                creatorID: BackupV15Fixtures.moriID,                                 roleIDs: roleIDs, modifiedAt: modifiedAt)                         ])))         }          func roleIDs() async throws -> [String] {             try await fixture.repository.creditRows()-                .first { $0.id == BackupV14Fixtures.moriCreditID }?.roleIDs ?? []+                .first { $0.id == BackupV15Fixtures.moriCreditID }?.roleIDs ?? []         }          // Older: nothing moves.         try await reimport(-            roleIDs: [BackupV14Fixtures.artistRoleID],-            modifiedAt: BackupV14Fixtures.created.addingTimeInterval(-1_000))+            roleIDs: [BackupV15Fixtures.artistRoleID],+            modifiedAt: BackupV15Fixtures.created.addingTimeInterval(-1_000))         #expect(try await roleIDs() == stored)          // Equal, and a strict subset: the union the row holds stands (Q67).         try await reimport(-            roleIDs: [BackupV14Fixtures.authorRoleID], modifiedAt: BackupV14Fixtures.created)+            roleIDs: [BackupV15Fixtures.authorRoleID], modifiedAt: BackupV15Fixtures.created)         #expect(try await roleIDs() == stored)          // Equal, and a superset: the archive widens it.         try await reimport(             roleIDs: [-                BackupV14Fixtures.authorRoleID, BackupV14Fixtures.editorRoleID,-                BackupV14Fixtures.translatorRoleID,-            ], modifiedAt: BackupV14Fixtures.created)-        #expect(try await roleIDs().contains(BackupV14Fixtures.translatorRoleID.uuidString))+                BackupV15Fixtures.authorRoleID, BackupV15Fixtures.editorRoleID,+                BackupV15Fixtures.translatorRoleID,+            ], modifiedAt: BackupV15Fixtures.created)+        #expect(try await roleIDs().contains(BackupV15Fixtures.translatorRoleID.uuidString))          // Strictly later: the archive wins outright, narrowing included.         try await reimport(-            roleIDs: [BackupV14Fixtures.artistRoleID],-            modifiedAt: BackupV14Fixtures.created.addingTimeInterval(1_000))-        #expect(try await roleIDs() == [BackupV14Fixtures.artistRoleID.uuidString])+            roleIDs: [BackupV15Fixtures.artistRoleID],+            modifiedAt: BackupV15Fixtures.created.addingTimeInterval(1_000))+        #expect(try await roleIDs() == [BackupV15Fixtures.artistRoleID.uuidString])     }      /// Req 9.4's last clause: a pair the import leaves held twice converges per@@ -3559,29 +3606,29 @@ struct BackupV14ImportTests {     func duplicatePairConvergesInTheImport() async throws {         let fixture = try await M5Fixture()         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.creditsPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.creditsPayload()))         // A second row over the same pair, reached through the alias — created         // after the archive's, so the archive's row is the head.         let through = UUID(uuidString: "c8ed1700-0000-4000-8000-0000000000a1")!         try await fixture.repository.seedCredits([             SeedCredit(-                id: through, workID: BackupV14Fixtures.composedWorkID,-                creatorID: BackupV14Fixtures.aliasID,-                roleIDs: [BackupV14Fixtures.translatorRoleID.uuidString])+                id: through, workID: BackupV15Fixtures.composedWorkID,+                creatorID: BackupV15Fixtures.aliasID,+                roleIDs: [BackupV15Fixtures.translatorRoleID.uuidString])         ])          try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.creditsPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.creditsPayload()))          let rows = try await fixture.repository.creditRows()-            .filter { $0.workID == BackupV14Fixtures.composedWorkID }-        #expect(rows.map(\.id) == [BackupV14Fixtures.moriCreditID])+            .filter { $0.workID == BackupV15Fixtures.composedWorkID }+        #expect(rows.map(\.id) == [BackupV15Fixtures.moriCreditID])         #expect(             rows.first?.roleIDs                 == [-                    BackupV14Fixtures.authorRoleID.uuidString,-                    BackupV14Fixtures.editorRoleID.uuidString,-                    BackupV14Fixtures.translatorRoleID.uuidString,+                    BackupV15Fixtures.authorRoleID.uuidString,+                    BackupV15Fixtures.editorRoleID.uuidString,+                    BackupV15Fixtures.translatorRoleID.uuidString,                 ].sorted())     } @@ -3600,37 +3647,37 @@ struct BackupV14ImportTests {         try await fixture.repository.seedCreators([             SeedCreator(                 id: kept, name: "Mori Ayane",-                nameModifiedAt: BackupV14Fixtures.created,-                createdAt: BackupV14Fixtures.created),+                nameModifiedAt: BackupV15Fixtures.created,+                createdAt: BackupV15Fixtures.created),             SeedCreator(                 id: renamed, name: "Ayane Mori",-                nameModifiedAt: BackupV14Fixtures.created,-                createdAt: BackupV14Fixtures.created.addingTimeInterval(1_000)),+                nameModifiedAt: BackupV15Fixtures.created,+                createdAt: BackupV15Fixtures.created.addingTimeInterval(1_000)),         ])         try await fixture.repository.seedCredits([             SeedCredit(-                id: keptCredit, workID: BackupV14Fixtures.composedWorkID, creatorID: kept,-                roleIDs: [BackupV14Fixtures.authorRoleID.uuidString],-                createdAt: BackupV14Fixtures.created,-                modifiedAt: BackupV14Fixtures.created),+                id: keptCredit, workID: BackupV15Fixtures.composedWorkID, creatorID: kept,+                roleIDs: [BackupV15Fixtures.authorRoleID.uuidString],+                createdAt: BackupV15Fixtures.created,+                modifiedAt: BackupV15Fixtures.created),             SeedCredit(-                id: otherCredit, workID: BackupV14Fixtures.composedWorkID,+                id: otherCredit, workID: BackupV15Fixtures.composedWorkID,                 creatorID: renamed,-                roleIDs: [BackupV14Fixtures.artistRoleID.uuidString],-                createdAt: BackupV14Fixtures.created.addingTimeInterval(1_000),-                modifiedAt: BackupV14Fixtures.created.addingTimeInterval(1_000)),+                roleIDs: [BackupV15Fixtures.artistRoleID.uuidString],+                createdAt: BackupV15Fixtures.created.addingTimeInterval(1_000),+                modifiedAt: BackupV15Fixtures.created.addingTimeInterval(1_000)),         ])          // Creators only: no roles, and no credits at all.         try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.creditsPayload(+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.creditsPayload(                     creators: [-                        BackupV14Fixtures.creatorRecord(+                        BackupV15Fixtures.creatorRecord(                             id: renamed, name: "Mori Ayane",-                            nameModifiedAt: BackupV14Fixtures.created+                            nameModifiedAt: BackupV15Fixtures.created                                 .addingTimeInterval(2_000),-                            createdAt: BackupV14Fixtures.created.addingTimeInterval(1_000))+                            createdAt: BackupV15Fixtures.created.addingTimeInterval(1_000))                     ],                     creatorRoles: [], credits: []))) @@ -3638,13 +3685,13 @@ struct BackupV14ImportTests {         #expect(creators.canonicalID(of: renamed) == kept)          let rows = try await fixture.repository.creditRows()-            .filter { $0.workID == BackupV14Fixtures.composedWorkID }+            .filter { $0.workID == BackupV15Fixtures.composedWorkID }         #expect(rows.map(\.id) == [keptCredit])         #expect(             rows.first?.roleIDs                 == [-                    BackupV14Fixtures.authorRoleID.uuidString,-                    BackupV14Fixtures.artistRoleID.uuidString,+                    BackupV15Fixtures.authorRoleID.uuidString,+                    BackupV15Fixtures.artistRoleID.uuidString,                 ].sorted())     } @@ -3658,60 +3705,60 @@ struct BackupV14ImportTests {     /// seam it is a claim about: the store's blob, the projection's group scan,     /// the codec's base64 and the importer's re-derived digest. The suites     /// either side of it pin one seam each over a payload built in memory.-    @Test("A 14/15 archive exported from one library imports whole into another")+    @Test("A 15/16 archive exported from one library imports whole into another")     func exportedArchivesRoundTrip() async throws {         let source = try await M5Fixture()         try await source.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.coveredPayload()))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.coveredPayload())) -        let payload = try await source.repository.backupV14Snapshot()+        let payload = try await source.repository.backupV15Snapshot()         let plan = try BackupImporter.plan(-            from: try BackupV14Codec.encode(-                payload: payload, metadata: BackupV14Fixtures.metadata()))+            from: try BackupV15Codec.encode(+                payload: payload, metadata: BackupV15Fixtures.metadata()))          let target = try await M5Fixture()         try await target.repository.confirmImport(plan: plan)          let characters = try await target.repository.m5AllCharacters()-        let grover = try #require(characters.first { $0.id == BackupV14Fixtures.groverID })+        let grover = try #require(characters.first { $0.id == BackupV15Fixtures.groverID })         #expect(grover.name == "Grover")         #expect(grover.facts.map(\.quote) == ["promised to guide them home"])-        #expect(grover.workID == BackupV14Fixtures.workID)+        #expect(grover.workID == BackupV15Fixtures.workID)         #expect(             try await target.repository.m5SuppressionRows()-                .contains { $0.id == BackupV14Fixtures.suppressionID })+                .contains { $0.id == BackupV15Fixtures.suppressionID })         #expect(-            try await target.repository.m5EntryCoverage(BackupV14Fixtures.entryID)-                == BackupV14Fixtures.noteFingerprint)+            try await target.repository.m5EntryCoverage(BackupV15Fixtures.entryID)+                == BackupV15Fixtures.noteFingerprint)          // Req 5.1: the second kind makes the same trip, through the same         // exporter, codec and gate.         let keep = try #require(             try await target.repository.m5AllPlaces()-                .first { $0.id == BackupV14Fixtures.keepID })+                .first { $0.id == BackupV15Fixtures.keepID })         #expect(keep.name == "The High Keep")         #expect(keep.facts.map(\.quote) == ["above the pass"])-        #expect(keep.workID == BackupV14Fixtures.workID)+        #expect(keep.workID == BackupV15Fixtures.workID)         #expect(             try await target.repository.m5PlaceSuppressionRows()-                .contains { $0.id == BackupV14Fixtures.placeSuppressionID })+                .contains { $0.id == BackupV15Fixtures.placeSuppressionID })          // Req 8.1: the cover made the same trip, byte for byte, with the digest         // re-derived at the far end from bytes the file never carried one for.         #expect(-            try await target.repository.thumbnailColumns(of: BackupV14Fixtures.workID)+            try await target.repository.thumbnailColumns(of: BackupV15Fixtures.workID)                 == [ThumbnailColumns(-                    byteCount: BackupV14Fixtures.coverBytes.count,+                    byteCount: BackupV15Fixtures.coverBytes.count,                     shapeRaw: ThumbnailShape.portrait.rawValue,-                    digest: BackupV14Fixtures.coverDigest)])+                    digest: BackupV15Fixtures.coverDigest)])         #expect(             try await target.repository.thumbnailBytes(-                workID: BackupV14Fixtures.workID, digest: BackupV14Fixtures.coverDigest)-                == BackupV14Fixtures.coverBytes)+                workID: BackupV15Fixtures.workID, digest: BackupV15Fixtures.coverDigest)+                == BackupV15Fixtures.coverBytes)     }      /// `catch-up-mode` Q6: the fourth reading status is vocabulary, not-    /// structure, so it travels under the **unchanged** 14/15 pair — the wire+    /// structure, so it travels under the **unchanged** 15/16 pair — the wire     /// field is already the typed enum and no generation moves for it.     ///     /// Asserted across the same three seams the cover crosses, because a value@@ -3719,35 +3766,35 @@ struct BackupV14ImportTests {     /// default and read as a reader who never fell behind: out of the store     /// through the real projection, through the codec, and into a different     /// library.-    @Test("A work on catchingUp exports and imports unchanged under 14/15")+    @Test("A work on catchingUp exports and imports unchanged under 15/16")     func catchingUpRoundTrips() async throws {         let source = try await M5Fixture()         try await source.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.composedPayload(readingStatus: .catchingUp)))+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.composedPayload(readingStatus: .catchingUp))) -        let payload = try await source.repository.backupV14Snapshot()+        let payload = try await source.repository.backupV15Snapshot()         #expect(-            payload.works.first { $0.id == BackupV14Fixtures.composedWorkID }?.readingStatus+            payload.works.first { $0.id == BackupV15Fixtures.composedWorkID }?.readingStatus                 == .catchingUp) -        let encoded = try BackupV14Codec.encode(-            payload: payload, metadata: BackupV14Fixtures.metadata())-        #expect(try BackupV14Codec.decode(encoded).backupFormatVersion == 14)+        let encoded = try BackupV15Codec.encode(+            payload: payload, metadata: BackupV15Fixtures.metadata())+        #expect(try BackupV15Codec.decode(encoded).backupFormatVersion == 15)          let target = try await M5Fixture()         try await target.repository.confirmImport(plan: try BackupImporter.plan(from: encoded))          #expect(-            try await target.repository.work(id: BackupV14Fixtures.composedWorkID).readingStatus+            try await target.repository.work(id: BackupV15Fixtures.composedWorkID).readingStatus                 == .catchingUp)     } }  // MARK: - Test Doubles -private final class MockV14SnapshotProvider: BackupV14SnapshotProviding, @unchecked Sendable {-    let payload: BackupV14Payload-    init(payload: BackupV14Payload) { self.payload = payload }-    func backupV14Snapshot() async throws -> BackupV14Payload { payload }+private final class MockV15SnapshotProvider: BackupV15SnapshotProviding, @unchecked Sendable {+    let payload: BackupV15Payload+    init(payload: BackupV15Payload) { self.payload = payload }+    func backupV15Snapshot() async throws -> BackupV15Payload { payload } }
Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15Fixtures.swift Renamed +164 / -136
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupV14Fixtures.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15Fixtures.swiftsimilarity index 86%rename from Packages/AsterismCore/Tests/AsterismCoreTests/BackupV14Fixtures.swiftrename to Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15Fixtures.swiftindex 0e1df052..36dbf69a 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupV14Fixtures.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15Fixtures.swift@@ -4,9 +4,10 @@ import Foundation  @testable import AsterismCore -/// Shared builders for 14/15 payloads — the only archive shape the app reads or-/// writes. 14/15 adds the reader's cover to the Work record (T-2330), over a V14-/// store; 12/13 added a place table and a place-suppression table (T-2276).+/// Shared builders for 15/16 payloads — the only archive shape the app reads or+/// writes. 15/16 drops the junk-suffix rule from the Site record (T-2336), over+/// a V16 store; 12/13 added a place table and a place-suppression table+/// (T-2276). /// /// It absorbed the 4/4, 5/6, 6/7, 7/8, 8/9, 9/10, 10/11 and 11/12 fixture enums /// as each generation's read and write paths were deleted. 7/8 changed the@@ -17,8 +18,9 @@ import Foundation /// (T-2281): the rule's UUID and nothing else. 9/10 added a Work's work status, /// reading status and verdict (T-2306). 10/11 added a series table, a link table /// and a Work's series membership (T-2308). 11/12 added the creator table, the-/// role list and the credits (T-2316). 14/15 added the cover (T-2330).-enum BackupV14Fixtures {+/// role list and the credits (T-2316). 13/14 added the cover (T-2330). 14/15+/// added the release days (`update-schedule`).+enum BackupV15Fixtures {     static let created = Date(timeIntervalSince1970: 1_000_000)      // MARK: - The cover (`work-thumbnails` Req 8.1)@@ -78,12 +80,12 @@ enum BackupV14Fixtures {         shapeRaw: String? = ThumbnailShape.portrait.rawValue,         bytes: Data? = coverBytes,         modifiedAt: Date = created-    ) -> BackupV14Payload {+    ) -> BackupV15Payload {         let base = payload()-        return BackupV14Payload(+        return BackupV15Payload(             entries: base.entries,             works: base.works.map { record in-                BackupV14Work(+                BackupV15Work(                     id: record.id, displayTitle: record.displayTitle,                     lastParsedTitle: record.lastParsedTitle,                     genericNotes: record.genericNotes, genreTags: record.genreTags,@@ -133,7 +135,7 @@ enum BackupV14Fixtures {     static let suppressionID = UUID(uuidString: "5099E5ED-0000-4000-8000-000000000001")!     static let factSuppressionID = UUID(uuidString: "5099E5ED-0000-4000-8000-000000000002")! -    /// The place the 14/15 fixtures carry, and the one whose `workID` resolves to+    /// The place the 15/16 fixtures carry, and the one whose `workID` resolves to     /// nothing — the tolerated orphan of Req 5.5, which a place expresses with a     /// dangling id rather than with `nil` (Q60, Q67).     static let keepID = UUID(uuidString: "91ACE000-0000-4000-8000-000000000001")!@@ -150,8 +152,8 @@ enum BackupV14Fixtures {         canonicalID: UUID? = nil,         createdAt: Date = created,         modifiedAt: Date = created-    ) -> BackupV14WorkType {-        BackupV14WorkType(+    ) -> BackupV15WorkType {+        BackupV15WorkType(             id: id, name: name, stateRaw: state.rawValue, canonicalID: canonicalID,             createdAt: createdAt, modifiedAt: modifiedAt)     }@@ -169,8 +171,8 @@ enum BackupV14Fixtures {         urlIdentityState: WorkURLIdentityState = .none,         urlIdentityRuleID: UUID? = nil,         workURLString: String? = nil-    ) -> BackupV14Membership {-        BackupV14Membership(+    ) -> BackupV15Membership {+        BackupV15Membership(             id: id, workID: workID, hostname: hostname, createdAt: createdAt,             urlIdentity: urlIdentity, urlIdentityState: urlIdentityState,             urlIdentityRuleID: urlIdentityRuleID, workURLString: workURLString)@@ -191,13 +193,13 @@ enum BackupV14Fixtures {         brokenAlias: Bool = false,         workTypeID: UUID? = novelTypeID,         typeName: String? = "novel",-        workTypes: [BackupV14WorkType] = [workTypeRecord(id: novelTypeID, name: "novel")]-    ) -> BackupV14Payload {+        workTypes: [BackupV15WorkType] = [workTypeRecord(id: novelTypeID, name: "novel")]+    ) -> BackupV15Payload {         let host = minimalHost         let patternID = UUID(uuidString: "bbbbbbbb-bbbb-bbbb-bbbb-bbbbbbbbbbbb")!         let rawURL = "https://example.com/read/7" -        let pattern = BackupV14TitlePattern(+        let pattern = BackupV15TitlePattern(             id: patternID, siteHostname: host, version: 1, isActive: activePattern,             createdAt: created,             definition: StoredPatternDefinition(@@ -205,10 +207,10 @@ enum BackupV14Fixtures {                     work: try! SegmentRangeSpec(origin: .start, offset: 0, length: 1),                     ignored: []))) -        let site = BackupV14Site(-            hostname: host, displayName: "Example", mode: .taught, junkSuffixRule: nil)+        let site = BackupV15Site(+            hostname: host, displayName: "Example", mode: .taught) -        let work = BackupV14Work(+        let work = BackupV15Work(             id: minimalWorkID, displayTitle: "Constellation", lastParsedTitle: "Constellation",             genericNotes: "", genreTags: [], titleProvenance: .parsed,             workStatus: .ongoing, readingStatus: .reading, verdict: "",@@ -216,7 +218,7 @@ enum BackupV14Fixtures {             workTypeID: workTypeID, typeName: typeName,             createdAt: created, modifiedAt: created) -        let entry = BackupV14Entry(+        let entry = BackupV15Entry(             id: minimalEntryID, captureTitle: "Chapter 7", captureTitleSource: .host,             rawURL: rawURL, canonicalURL: nil, hostname: host,             entryIdentityKey: rawURL,@@ -227,7 +229,7 @@ enum BackupV14Fixtures {             modifiedAt: created, workID: minimalWorkID, intentionallyUnattached: false,             citations: EntryCitations(workAssignment: .manual)) -        return BackupV14Payload(+        return BackupV15Payload(             entries: [entry], works: [work], sites: [site],             titlePatterns: [pattern], urlRules: [], workTypes: workTypes,             memberships: [@@ -249,8 +251,8 @@ enum BackupV14Fixtures {         readingStatus: ReadingStatus = .abandoned,         workTypeID: UUID? = novelTypeID,         typeName: String? = "novel",-        workTypes: [BackupV14WorkType] = [workTypeRecord(id: novelTypeID, name: "novel")]-    ) -> BackupV14Payload {+        workTypes: [BackupV15WorkType] = [workTypeRecord(id: novelTypeID, name: "novel")]+    ) -> BackupV15Payload {         let host = "example.com"         let patternID = UUID(uuidString: "cccccccc-cccc-cccc-cccc-cccccccccccc")!         let ruleID = UUID(uuidString: "dddddddd-dddd-dddd-dddd-dddddddddddd")!@@ -258,25 +260,25 @@ enum BackupV14Fixtures {         let workName = "Actual Title"          // The whole-title rule names the Work by trimming the boilerplate prefix.-        let pattern = BackupV14TitlePattern(+        let pattern = BackupV15TitlePattern(             id: patternID, siteHostname: host, version: 1, isActive: true, createdAt: created,             definition: StoredPatternDefinition(                 definition: .wholeTitle, trimPrefix: "TtH • Story • "))          // A sequence-only query rule extracts "94" from the raw URL.-        let rule = BackupV14URLRule(+        let rule = BackupV15URLRule(             id: ruleID, version: 1, isCurrent: true, createdAt: created,             origin: .readerTaught,             definition: .sequence(locator: .query(name: ExactScalarString("chapter"))),             siteHostname: host) -        let site = BackupV14Site(-            hostname: host, displayName: "Example", mode: .taught, junkSuffixRule: nil)+        let site = BackupV15Site(+            hostname: host, displayName: "Example", mode: .taught)          // Req 8.1: the composed fixture's Work carries all three off their         // defaults, so a round trip that dropped one would show as a difference         // rather than as a default that happened to match.-        let work = BackupV14Work(+        let work = BackupV15Work(             id: composedWorkID, displayTitle: workName, lastParsedTitle: workName,             genericNotes: "", genreTags: [], titleProvenance: .parsed,             workStatus: .finished, readingStatus: readingStatus,@@ -291,7 +293,7 @@ enum BackupV14Fixtures {                 hostname: ExactScalarString(host), workName: ExactScalarString(workName),                 chapterSequence: ExactScalarString("94"))) -        let entry = BackupV14Entry(+        let entry = BackupV15Entry(             id: entryID, captureTitle: "TtH • Story • Actual Title", captureTitleSource: .host,             rawURL: rawURL, canonicalURL: nil, hostname: host,             entryIdentityKey: v3Key, conservativeIdentityKey: rawURL,@@ -306,7 +308,7 @@ enum BackupV14Fixtures {                 chapterSequence: CitedRule(id: ruleID),                 workAssignment: .pattern(CitedRule(id: patternID)))) -        return BackupV14Payload(+        return BackupV15Payload(             entries: [entry], works: [work], sites: [site],             titlePatterns: [pattern], urlRules: [rule], workTypes: workTypes,             memberships: [@@ -327,8 +329,8 @@ enum BackupV14Fixtures {         notes: String = "Read 2.5 after 2.",         createdAt: Date = created,         modifiedAt: Date = created-    ) -> BackupV14Series {-        BackupV14Series(+    ) -> BackupV15Series {+        BackupV15Series(             id: id, name: name, notes: notes, createdAt: createdAt, modifiedAt: modifiedAt)     } @@ -341,8 +343,8 @@ enum BackupV14Fixtures {         type: String = "adaptation",         createdAt: Date = created,         modifiedAt: Date = created-    ) -> BackupV14Link {-        BackupV14Link(+    ) -> BackupV15Link {+        BackupV15Link(             id: id, lowerWorkID: a, higherWorkID: b, linkType: type,             createdAt: createdAt, modifiedAt: modifiedAt)     }@@ -351,21 +353,21 @@ enum BackupV14Fixtures {     /// both, and a link between them: the smallest payload that exercises every     /// V12 shape at once.     static func seriesPayload(-        series: [BackupV14Series] = [seriesRecord()],-        links: [BackupV14Link] = [linkRecord()],+        series: [BackupV15Series] = [seriesRecord()],+        links: [BackupV15Link] = [linkRecord()],         firstMembership: (series: UUID, position: Double)? = (seriesID, 1),         secondMembership: (series: UUID, position: Double)? = (seriesID, 2.5)-    ) -> BackupV14Payload {+    ) -> BackupV15Payload {         let base = composedPayload()         let host = "example.com"-        let second = BackupV14Work(+        let second = BackupV15Work(             id: secondWorkID, displayTitle: "The Side Story", lastParsedTitle: nil,             genericNotes: "", genreTags: [], titleProvenance: .manual,             workStatus: .ongoing, readingStatus: .reading, verdict: "",             releaseDays: [],             workTypeID: nil, typeName: nil, createdAt: created, modifiedAt: created,             seriesID: secondMembership?.series, seriesPosition: secondMembership?.position)-        return BackupV14Payload(+        return BackupV15Payload(             entries: base.entries,             works: base.works.map { placed($0, membership: firstMembership) } + [second],             sites: base.sites,@@ -381,12 +383,12 @@ enum BackupV14Fixtures {             links: links)     } -    /// The composed Work with a membership pair. `BackupV14Work`'s fields are+    /// The composed Work with a membership pair. `BackupV15Work`'s fields are     /// `let`, so a copy is a full restatement.     static func placed(-        _ record: BackupV14Work, membership: (series: UUID, position: Double)?-    ) -> BackupV14Work {-        BackupV14Work(+        _ record: BackupV15Work, membership: (series: UUID, position: Double)?+    ) -> BackupV15Work {+        BackupV15Work(             id: record.id, displayTitle: record.displayTitle,             lastParsedTitle: record.lastParsedTitle, genericNotes: record.genericNotes,             genreTags: record.genreTags, titleProvenance: record.titleProvenance,@@ -401,13 +403,13 @@ enum BackupV14Fixtures {     /// half-set and out-of-range shapes no writer produces and both archive     /// doors refuse (Req 13.5).     static func payloadWithMembership(-        seriesID: UUID?, position: Double?, series: [BackupV14Series] = [seriesRecord()]-    ) -> BackupV14Payload {+        seriesID: UUID?, position: Double?, series: [BackupV15Series] = [seriesRecord()]+    ) -> BackupV15Payload {         let base = composedPayload()-        return BackupV14Payload(+        return BackupV15Payload(             entries: base.entries,             works: base.works.map {-                BackupV14Work(+                BackupV15Work(                     id: $0.id, displayTitle: $0.displayTitle,                     lastParsedTitle: $0.lastParsedTitle, genericNotes: $0.genericNotes,                     genreTags: $0.genreTags, titleProvenance: $0.titleProvenance,@@ -459,8 +461,8 @@ enum BackupV14Fixtures {         notesModifiedAt: Date = created,         stateModifiedAt: Date = created,         createdAt: Date = created-    ) -> BackupV14Creator {-        BackupV14Creator(+    ) -> BackupV15Creator {+        BackupV15Creator(             id: id, name: name, nameModifiedAt: nameModifiedAt, notes: notes,             notesModifiedAt: notesModifiedAt, stateRaw: state.rawValue,             stateModifiedAt: stateModifiedAt, canonicalID: canonicalID,@@ -478,8 +480,8 @@ enum BackupV14Fixtures {         positionModifiedAt: Date = created,         stateModifiedAt: Date = created,         createdAt: Date = created-    ) -> BackupV14CreatorRole {-        BackupV14CreatorRole(+    ) -> BackupV15CreatorRole {+        BackupV15CreatorRole(             id: id, name: name, nameModifiedAt: nameModifiedAt, position: position,             positionModifiedAt: positionModifiedAt, stateRaw: state.rawValue,             stateModifiedAt: stateModifiedAt, canonicalID: canonicalID,@@ -490,7 +492,7 @@ enum BackupV14Fixtures {     /// One of the three defaults exactly as a library that has only ever seeded     /// holds it: the frozen identity, the shipped spelling and place, and the     /// pristine sentinel on every timestamp.-    static func seededRoleRecord(_ seed: CreatorRoleSeeding.Seed) -> BackupV14CreatorRole {+    static func seededRoleRecord(_ seed: CreatorRoleSeeding.Seed) -> BackupV15CreatorRole {         creatorRoleRecord(             id: seed.id, name: seed.name, position: seed.position,             nameModifiedAt: pristine, positionModifiedAt: pristine,@@ -498,7 +500,7 @@ enum BackupV14Fixtures {     }      /// The three seeds, in list order.-    static var seededRoleRecords: [BackupV14CreatorRole] {+    static var seededRoleRecords: [BackupV15CreatorRole] {         CreatorRoleSeeding.seeds.map(seededRoleRecord)     } @@ -509,8 +511,8 @@ enum BackupV14Fixtures {         roleIDs: [UUID] = [],         createdAt: Date = created,         modifiedAt: Date = created-    ) -> BackupV14Credit {-        BackupV14Credit(+    ) -> BackupV15Credit {+        BackupV15Credit(             id: id, workID: workID, creatorID: creatorID,             roleIDs: roleIDs.map(\.uuidString).sorted(),             createdAt: createdAt, modifiedAt: modifiedAt)@@ -518,7 +520,7 @@ enum BackupV14Fixtures {      /// The two creators, the alias between them, and the archive's role list:     /// the three seeds plus a reader-added `letterer` and a removed `editor`.-    static var creatorRecords: [BackupV14Creator] {+    static var creatorRecords: [BackupV15Creator] {         [             creatorRecord(id: moriID, name: "Mori Ayane", notes: "Also draws."),             creatorRecord(id: studioID, name: "Studio Lantern"),@@ -527,7 +529,7 @@ enum BackupV14Fixtures {         ]     } -    static var creatorRoleRecords: [BackupV14CreatorRole] {+    static var creatorRoleRecords: [BackupV15CreatorRole] {         seededRoleRecords + [             creatorRoleRecord(id: lettererRoleID, name: "letterer", position: 3),             creatorRoleRecord(@@ -539,7 +541,7 @@ enum BackupV14Fixtures {     /// including the removed one, one naming the **alias** creator, and one whose     /// work the archive does not carry — the tolerated unresolved shape of     /// Req 9.5.-    static var creditRecords: [BackupV14Credit] {+    static var creditRecords: [BackupV15Credit] {         [             creditRecord(                 id: moriCreditID, workID: composedWorkID, creatorID: moriID,@@ -557,12 +559,12 @@ enum BackupV14Fixtures {     /// `seriesPayload` plus the whole V12 surface: the creator table, the role     /// list and the credits over both works.     static func creditsPayload(-        creators: [BackupV14Creator]? = nil,-        creatorRoles: [BackupV14CreatorRole]? = nil,-        credits: [BackupV14Credit]? = nil-    ) -> BackupV14Payload {+        creators: [BackupV15Creator]? = nil,+        creatorRoles: [BackupV15CreatorRole]? = nil,+        credits: [BackupV15Credit]? = nil+    ) -> BackupV15Payload {         let base = seriesPayload()-        return BackupV14Payload(+        return BackupV15Payload(             entries: base.entries, works: base.works, sites: base.sites,             titlePatterns: base.titlePatterns, urlRules: base.urlRules,             workTypes: base.workTypes, memberships: base.memberships,@@ -582,12 +584,12 @@ enum BackupV14Fixtures {     /// unanchored — which selection would happily resolve on a single-component     /// path, so the import gate's `validate` call is the only thing standing     /// between such an archive and the store (Req 1.3, Q5/Q7).-    static func unanchoredRulePayload(leftAnchored: Bool) -> BackupV14Payload {+    static func unanchoredRulePayload(leftAnchored: Bool) -> BackupV15Payload {         let host = "unanchored.example"         let patternID = UUID(uuidString: "ffffffff-ffff-ffff-ffff-fffffffffff1")!         let ruleID = UUID(uuidString: "ffffffff-ffff-ffff-ffff-fffffffffff2")! -        let pattern = BackupV14TitlePattern(+        let pattern = BackupV15TitlePattern(             id: patternID, siteHostname: host, version: 1, isActive: true, createdAt: created,             definition: StoredPatternDefinition(                 definition: .segment(@@ -595,16 +597,16 @@ enum BackupV14Fixtures {                     ignored: [])))          let left: PathAnchor = leftAnchored ? .literal(ExactScalarString("series")) : .unanchored-        let rule = BackupV14URLRule(+        let rule = BackupV15URLRule(             id: ruleID, version: 1, isCurrent: true, createdAt: created,             origin: .readerTaught,             definition: .work(locator: .pathBracketed(left: left, right: .unanchored)),             siteHostname: host) -        let site = BackupV14Site(-            hostname: host, displayName: "Unanchored", mode: .taught, junkSuffixRule: nil)+        let site = BackupV15Site(+            hostname: host, displayName: "Unanchored", mode: .taught) -        return BackupV14Payload(+        return BackupV15Payload(             entries: [], works: [], sites: [site],             titlePatterns: [pattern], urlRules: [rule], workTypes: [])     }@@ -619,16 +621,16 @@ enum BackupV14Fixtures {     /// Fixed UUIDs and a fixed date, so the encoded bytes are stable and can be     /// asserted on directly — which a fixture generated by a teaching commit     /// cannot be (it mints random UUIDs and wall-clock timestamps).-    static func combinedRulePayload(presence: URLSequencePresence) -> BackupV14Payload {+    static func combinedRulePayload(presence: URLSequencePresence) -> BackupV15Payload {         let patternID = UUID(uuidString: "ffffffff-ffff-ffff-ffff-fffffffffff3")!         let ruleID = UUID(uuidString: "ffffffff-ffff-ffff-ffff-fffffffffff4")! -        let pattern = BackupV14TitlePattern(+        let pattern = BackupV15TitlePattern(             id: patternID, siteHostname: combinedRuleHost, version: 1, isActive: true,             createdAt: created,             definition: StoredPatternDefinition(definition: .wholeTitle)) -        let rule = BackupV14URLRule(+        let rule = BackupV15URLRule(             id: ruleID, version: 1, isCurrent: true, createdAt: created,             origin: .readerTaught,             definition: .combined(@@ -641,11 +643,10 @@ enum BackupV14Fixtures {                     sequencePresence: presence)),             siteHostname: combinedRuleHost) -        let site = BackupV14Site(-            hostname: combinedRuleHost, displayName: "Combined", mode: .taught,-            junkSuffixRule: nil)+        let site = BackupV15Site(+            hostname: combinedRuleHost, displayName: "Combined", mode: .taught) -        return BackupV14Payload(+        return BackupV15Payload(             entries: [], works: [], sites: [site],             titlePatterns: [pattern], urlRules: [rule], workTypes: [])     }@@ -675,26 +676,37 @@ enum BackupV14Fixtures {         + #""origin":"readerTaught","siteHostname":"combined.example","version":1}],"#         + #""workTypes":[],"works":[]}"# -    /// A payload literal wrapped in the 14/15 envelope, with the checksum taken+    /// A payload literal wrapped in the 15/16 envelope, with the checksum taken     /// over that literal text rather than over a re-encoding of it.     ///     /// The checksum is what makes such a fixture a test rather than a-    /// restatement: `BackupV14Codec.decode` re-encodes the payload it decoded and+    /// restatement: `BackupV15Codec.decode` re-encodes the payload it decoded and     /// compares a SHA-256, so a literal carrying a key the codec does not write     /// back — an omitted spelling the build no longer produces, or a citation     /// `version` it now ignores — fails with `checksumMismatch` (Decision 1).+    ///+    /// The envelope's two numbers are the **document's own constants** rather+    /// than literals: left behind at the next generation move they would refuse+    /// every fixture below by *version*, which is a refusal none of them exists+    /// to pin, and the decode failures they do pin would stop being reached+    /// without a single test going red.     static func literalDocument(         payload: String, entryCount: Int = 0, workCount: Int = 0,         appBuild: String = "literal"     ) -> Data {         let checksum = SHA256.hash(data: Data(payload.utf8))             .map { String(format: "%02x", $0) }.joined()-        return Data(-            (#"{"appBuild":"\#(appBuild)","backupFormatVersion":14,"#-                + #""capabilityGate":"multi-site","checksum":"\#(checksum)","#-                + #""databaseSchemaVersion":15,"entryCount":\#(entryCount),"#-                + #""exportedAt":"1970-01-12T13:46:40.000Z","payload":\#(payload),"#-                + #""workCount":\#(workCount)}"#).utf8)+        let format = BackupV15Document.formatVersion+        let schema = BackupV15Document.schemaVersion+        // Built in steps rather than as one concatenation: with the two numbers+        // interpolated the single expression no longer type-checks in+        // reasonable time.+        var envelope = #"{"appBuild":"\#(appBuild)","backupFormatVersion":\#(format),"#+        envelope += #""capabilityGate":"multi-site","checksum":"\#(checksum)","#+        envelope += #""databaseSchemaVersion":\#(schema),"entryCount":\#(entryCount),"#+        envelope += #""exportedAt":"1970-01-12T13:46:40.000Z","payload":\#(payload),"#+        envelope += #""workCount":\#(workCount)}"#+        return Data(envelope.utf8)     }      static func sequencePresenceOmittedDocument(appBuild: String = "pre-feature") -> Data {@@ -705,7 +717,7 @@ enum BackupV14Fixtures {      /// `composedPayload()` as the current encoder writes it, with `"version":3`     /// hand-added to the Entry's chapter-sequence citation — the shape a build-    /// before T-2281 wrote, and the one a 14/15 archive may not carry.+    /// before T-2281 wrote, and the one a 15/16 archive may not carry.     ///     /// Captured from `BackupCanonicalJSON.encoder()` and pasted, for the reason     /// Q17 gives: an encoder that no longer writes the key cannot produce@@ -764,7 +776,7 @@ enum BackupV14Fixtures {     // MARK: - A Work missing the three status fields (Req 8.1)      /// The bytes this build writes, with `workStatus`, `readingStatus` and-    /// `verdict` struck from the one Work record — the shape a 14/15 file may not+    /// `verdict` struck from the one Work record — the shape a 15/16 file may not     /// carry, because all three are required and there is no default (Q34).     ///     /// It starts from the version-free literal because that is already the@@ -780,9 +792,9 @@ enum BackupV14Fixtures {     // MARK: - The release days (`update-schedule` Req 8.1, Q22, Q36)      /// The bytes this build writes, with `releaseDays` struck from the one Work-    /// record — the shape a **pre-feature** build wrote, wearing a 14/15+    /// record — the shape a **pre-feature** build wrote, wearing a 15/16     /// envelope. The field is required and has no default (Q22), so this is a-    /// malformed 14/15 file rather than a restorable one: a default would make+    /// malformed 15/16 file rather than a restorable one: a default would make     /// "the reader set no days" indistinguishable from "this record predates the     /// column".     static var releaseDaysOmittedPayloadJSON: String {@@ -810,7 +822,7 @@ enum BackupV14Fixtures {     // MARK: - A payload missing the two place arrays (Req 5.1)      /// The same literal with the two place arrays struck out — the **shape** a-    /// pre-feature build writes, wearing a 14/15 envelope. Both arrays are+    /// pre-feature build writes, wearing a 15/16 envelope. Both arrays are     /// declared without `decodeIfPresent` and without a default (Q51), so this     /// fails the typed decode rather than restoring a library that asserts the     /// reader accepted no places.@@ -819,6 +831,22 @@ enum BackupV14Fixtures {             of: #""placeSuppressions":[],"places":[],"#, with: "")     } +    // MARK: - A Site carrying a mode this build cannot name (`remove-article-mode` Req 5.1)++    /// The same literal with the one Site's `mode` replaced by a spelling this+    /// build has no case for. `BackupV15Site.mode` is the typed `SiteMode`, so+    /// the value fails the decode and the archive is refused as malformed.+    ///+    /// The spelling is a **neutral** one rather than the retired `articles`,+    /// which Req 7.2 keeps to `UnknownSiteModeTests`: what is pinned here is the+    /// typed column, and every unnameable value meets it at the same door. The+    /// retired spelling's own consequences are that suite's, and a 14/15 file —+    /// the only file that could carry it — is refused a step earlier, by pair.+    static var unknownSiteModePayloadJSON: String {+        citationVersionFreePayloadJSON.replacingOccurrences(+            of: #""mode":"taught""#, with: #""mode":"a-mode-this-build-has-no-case-for""#)+    }+     // MARK: - Duplicate and non-greatest rule versions (Req 3.2)      /// A Site holding two title patterns at version 1 — one retired, one active@@ -827,21 +855,21 @@ enum BackupV14Fixtures {     /// Both shapes were refusals until T-2281 retired the invariant: a Site's     /// rule versions had to be unique and the marked row had to hold the     /// greatest. The column is advisory now, so this archive imports.-    static func duplicateVersionsPayload() -> BackupV14Payload {+    static func duplicateVersionsPayload() -> BackupV15Payload {         let host = "versions.example"         let retiredPatternID = UUID(uuidString: "ffffffff-ffff-ffff-ffff-fffffffffff5")!         let activePatternID = UUID(uuidString: "ffffffff-ffff-ffff-ffff-fffffffffff6")!         let retiredRuleID = UUID(uuidString: "ffffffff-ffff-ffff-ffff-fffffffffff7")!         let currentRuleID = UUID(uuidString: "ffffffff-ffff-ffff-ffff-fffffffffff8")! -        func pattern(_ id: UUID, active: Bool, createdAt: Date) -> BackupV14TitlePattern {-            BackupV14TitlePattern(+        func pattern(_ id: UUID, active: Bool, createdAt: Date) -> BackupV15TitlePattern {+            BackupV15TitlePattern(                 id: id, siteHostname: host, version: 1, isActive: active, createdAt: createdAt,                 definition: StoredPatternDefinition(definition: .wholeTitle))         } -        func rule(_ id: UUID, version: Int, current: Bool, createdAt: Date) -> BackupV14URLRule {-            BackupV14URLRule(+        func rule(_ id: UUID, version: Int, current: Bool, createdAt: Date) -> BackupV15URLRule {+            BackupV15URLRule(                 id: id, version: version, isCurrent: current, createdAt: createdAt,                 origin: .readerTaught,                 definition: .sequence(@@ -849,11 +877,11 @@ enum BackupV14Fixtures {                 siteHostname: host)         } -        return BackupV14Payload(+        return BackupV15Payload(             entries: [], works: [],             sites: [-                BackupV14Site(-                    hostname: host, displayName: "Versions", mode: .taught, junkSuffixRule: nil)+                BackupV15Site(+                    hostname: host, displayName: "Versions", mode: .taught)             ],             titlePatterns: [                 pattern(retiredPatternID, active: false, createdAt: created),@@ -870,21 +898,21 @@ enum BackupV14Fixtures {      // MARK: - Two current URL rules (illegal) -    static func twoCurrentRulePayload() -> BackupV14Payload {+    static func twoCurrentRulePayload() -> BackupV15Payload {         let host = "dup.example"         let patternID = UUID()         let ruleA = UUID()         let ruleB = UUID() -        let pattern = BackupV14TitlePattern(+        let pattern = BackupV15TitlePattern(             id: patternID, siteHostname: host, version: 1, isActive: true, createdAt: created,             definition: StoredPatternDefinition(                 definition: .segment(                     work: try! SegmentRangeSpec(origin: .start, offset: 0, length: 1),                     ignored: []))) -        func rule(_ id: UUID, _ version: Int) -> BackupV14URLRule {-            BackupV14URLRule(+        func rule(_ id: UUID, _ version: Int) -> BackupV15URLRule {+            BackupV15URLRule(                 id: id, version: version, isCurrent: true, createdAt: created,                 origin: .readerTaught,                 definition: .sequence(@@ -892,10 +920,10 @@ enum BackupV14Fixtures {                 siteHostname: host)         } -        let site = BackupV14Site(-            hostname: host, displayName: "Dup", mode: .taught, junkSuffixRule: nil)+        let site = BackupV15Site(+            hostname: host, displayName: "Dup", mode: .taught) -        return BackupV14Payload(+        return BackupV15Payload(             entries: [], works: [], sites: [site],             titlePatterns: [pattern], urlRules: [rule(ruleA, 1), rule(ruleB, 2)],             workTypes: [])@@ -922,8 +950,8 @@ enum BackupV14Fixtures {         facts: [RecordFact] = [fact()],         createdAt: Date = created,         modifiedAt: Date = created-    ) -> BackupV14Character {-        BackupV14Character(+    ) -> BackupV15Character {+        BackupV15Character(             id: id, workID: workID, name: name, nameKey: nameKey, aliases: aliases,             note: note, facts: facts, createdAt: createdAt, modifiedAt: modifiedAt)     }@@ -937,8 +965,8 @@ enum BackupV14Fixtures {         evidence: String? = nil,         status: CharacterSuppressionStatus = .active,         actionAt: Date = created-    ) -> BackupV14Suppression {-        BackupV14Suppression(+    ) -> BackupV15Suppression {+        BackupV15Suppression(             id: id, workID: workID, kindRaw: kind.rawValue, nameKey: nameKey,             sourceKindRaw: source?.kindRaw, sourceEntryID: source?.entryID,             evidence: evidence, statusRaw: status.rawValue, actionAt: actionAt)@@ -959,8 +987,8 @@ enum BackupV14Fixtures {         facts: [RecordFact] = [placeFact()],         createdAt: Date = created,         modifiedAt: Date = created-    ) -> BackupV14Place {-        BackupV14Place(+    ) -> BackupV15Place {+        BackupV15Place(             id: id, workID: workID, name: name, nameKey: nameKey, aliases: aliases,             note: note, facts: facts, createdAt: createdAt, modifiedAt: modifiedAt)     }@@ -983,8 +1011,8 @@ enum BackupV14Fixtures {         evidence: String? = nil,         status: CharacterSuppressionStatus = .active,         actionAt: Date = created-    ) -> BackupV14PlaceSuppression {-        BackupV14PlaceSuppression(+    ) -> BackupV15PlaceSuppression {+        BackupV15PlaceSuppression(             id: id, workID: workID, kindRaw: kind.rawValue, nameKey: nameKey,             sourceKindRaw: source?.kindRaw, sourceEntryID: source?.entryID,             evidence: evidence, statusRaw: status.rawValue, actionAt: actionAt)@@ -1001,15 +1029,15 @@ enum BackupV14Fixtures {     /// it and the defaults are taken from them — a caller passing something else     /// is describing a stale pair on purpose.     static func payload(-        characters: [BackupV14Character] = [character()],-        suppressions: [BackupV14Suppression] = [suppression()],-        places: [BackupV14Place] = [place()],-        placeSuppressions: [BackupV14PlaceSuppression] = [placeSuppression()],+        characters: [BackupV15Character] = [character()],+        suppressions: [BackupV15Suppression] = [suppression()],+        places: [BackupV15Place] = [place()],+        placeSuppressions: [BackupV15PlaceSuppression] = [placeSuppression()],         entryFingerprint: String? = noteFingerprint,         workFingerprint: String? = genericNotesFingerprint-    ) -> BackupV14Payload {+    ) -> BackupV15Payload {         let base = composedPayload()-        return BackupV14Payload(+        return BackupV15Payload(             entries: base.entries.map { noted($0, fingerprint: entryFingerprint) },             works: base.works.map { annotated($0, fingerprint: workFingerprint) },             sites: base.sites,@@ -1025,16 +1053,16 @@ enum BackupV14Fixtures {     }      static func metadata(appBuild: String = "test-12", exportedAt: Date = created)-        -> BackupV14Metadata+        -> BackupV15Metadata     {-        BackupV14Metadata(appBuild: appBuild, exportedAt: exportedAt)+        BackupV15Metadata(appBuild: appBuild, exportedAt: exportedAt)     } -    static func plan(_ payload: BackupV14Payload) -> BackupImportPlan {+    static func plan(_ payload: BackupV15Payload) -> BackupImportPlan {         BackupImportPlan(             metadata: BackupImportMetadata(-                formatVersion: BackupV14Document.formatVersion,-                schemaVersion: BackupV14Document.schemaVersion,+                formatVersion: BackupV15Document.formatVersion,+                schemaVersion: BackupV15Document.schemaVersion,                 appBuild: "test-12", exportedAt: created,                 capabilityGate: "multi-site", entryCount: payload.entries.count,                 workCount: payload.works.count),@@ -1047,17 +1075,17 @@ enum BackupV14Fixtures {      // MARK: - A refused envelope -    /// An 11/12 envelope, hand-written because nothing in the app can mint one+    /// A 14/15 envelope, hand-written because nothing in the app can mint one     /// any more. Structurally valid JSON with a well-formed payload: what makes     /// it unimportable is the version pair, which is exactly the distinction the-    /// refusal has to draw (`place-extraction` Req 5.1, Q51).+    /// refusal has to draw (`remove-article-mode` Req 5.3, Q2).     ///-    /// 11/12 is the generation immediately behind this one, and the one a reader-    /// is most likely to still hold: an archive exported before T-2276 carries-    /// no place table and no place suppressions, so the only thing this build-    /// could do with one is invent the absence of every place the reader-    /// accepted.-    static func retiredGenerationDocument(format: Int = 12, schema: Int = 13) -> Data {+    /// 14/15 is the generation immediately behind this one, and the one a reader+    /// is most likely to still hold: its Site records carry a junk-suffix rule+    /// for a mode this build does not know and a column V16 does not have, so+    /// the only thing this build could do with one is drop what it carries+    /// silently.+    static func retiredGenerationDocument(format: Int = 14, schema: Int = 15) -> Data {         let payload = #"{"entries":[],"sites":[],"titlePatterns":[],"urlRules":[],"works":[]}"#         let checksum = SHA256.hash(data: Data(payload.utf8))             .map { String(format: "%02x", $0) }.joined()@@ -1070,11 +1098,11 @@ enum BackupV14Fixtures {      // MARK: - Copies of the frozen records -    /// The composed Entry with a note and its covered revision. `BackupV14Entry`'s+    /// The composed Entry with a note and its covered revision. `BackupV15Entry`'s     /// fields are `let`, so a copy is a full restatement — stated once here     /// rather than in each suite.-    private static func noted(_ record: BackupV14Entry, fingerprint: String?) -> BackupV14Entry {-        BackupV14Entry(+    private static func noted(_ record: BackupV15Entry, fingerprint: String?) -> BackupV15Entry {+        BackupV15Entry(             id: record.id, captureTitle: record.captureTitle,             captureTitleSource: record.captureTitleSource, rawURL: record.rawURL,             canonicalURL: record.canonicalURL, hostname: record.hostname,@@ -1092,8 +1120,8 @@ enum BackupV14Fixtures {     }      /// The composed Work with generic notes and its covered revision.-    private static func annotated(_ record: BackupV14Work, fingerprint: String?) -> BackupV14Work {-        BackupV14Work(+    private static func annotated(_ record: BackupV15Work, fingerprint: String?) -> BackupV15Work {+        BackupV15Work(             id: record.id, displayTitle: record.displayTitle,             lastParsedTitle: record.lastParsedTitle, genericNotes: genericNotes,             genreTags: record.genreTags, titleProvenance: record.titleProvenance,
Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15ImportMatrixTests.swift Renamed +58 / -48
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupV14ImportMatrixTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15ImportMatrixTests.swiftsimilarity index 69%rename from Packages/AsterismCore/Tests/AsterismCoreTests/BackupV14ImportMatrixTests.swiftrename to Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15ImportMatrixTests.swiftindex 06363047..971e9244 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/BackupV14ImportMatrixTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/BackupV15ImportMatrixTests.swift@@ -5,16 +5,16 @@ import Testing  /// Task 9 of `update-schedule`: the release days at the archive's two doors. ///-/// `BackupV14ArchiveTests` covers the generation as a whole; this suite is the-/// matrix for the one field 14/15 adds. Req 8.1 asks for three things and they+/// `BackupV15ArchiveTests` covers the generation as a whole; this suite is the+/// matrix for the one field 14/15 added. Req 8.1 asks for three things and they /// pull in opposite directions, which is why they are pinned together: an empty /// set is written **explicitly** and restores as empty, a non-empty one restores /// exactly, and a record that omits the key — or carries a day this build cannot /// name — is malformed rather than restorable. A default on decode would make /// the first and the third indistinguishable (Q22), and a tolerant read would /// make the fourth silently lose a day the reader typed (Q36).-@Suite("Backup 14/15 import: release days", .serialized)-struct BackupV14ImportMatrixTests {+@Suite("Backup 15/16 import: release days", .serialized)+struct BackupV15ImportMatrixTests {      // MARK: - What restores (Req 8.1) @@ -23,13 +23,13 @@ struct BackupV14ImportMatrixTests {         let fixture = try await M5Fixture()          let result = try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(BackupV14Fixtures.composedPayload(releaseDays: [])))+            plan: BackupV15Fixtures.plan(BackupV15Fixtures.composedPayload(releaseDays: [])))         guard case .committed = result else {             Issue.record("expected committed, got \(result)")             return         } -        let work = try await fixture.repository.work(id: BackupV14Fixtures.composedWorkID)+        let work = try await fixture.repository.work(id: BackupV15Fixtures.composedWorkID)         #expect(work.releaseDays == [])         #expect(work.releaseDaysRaw == [])     }@@ -39,14 +39,14 @@ struct BackupV14ImportMatrixTests {         let fixture = try await M5Fixture()          let result = try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.composedPayload(releaseDays: [.thursday, .monday])))+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.composedPayload(releaseDays: [.thursday, .monday])))         guard case .committed = result else {             Issue.record("expected committed, got \(result)")             return         } -        let work = try await fixture.repository.work(id: BackupV14Fixtures.composedWorkID)+        let work = try await fixture.repository.work(id: BackupV15Fixtures.composedWorkID)         #expect(work.releaseDays == [.monday, .thursday])         // Req 7.5: one spelling in the store, whatever order the file held.         #expect(work.releaseDaysRaw == ["monday", "thursday"])@@ -61,18 +61,18 @@ struct BackupV14ImportMatrixTests {     func importReplacesTheLocalSchedule() async throws {         let fixture = try await M5Fixture()         _ = try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.composedPayload(releaseDays: [.friday])))+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.composedPayload(releaseDays: [.friday])))         #expect(-            try await fixture.repository.work(id: BackupV14Fixtures.composedWorkID).releaseDays+            try await fixture.repository.work(id: BackupV15Fixtures.composedWorkID).releaseDays                 == [.friday])          // The same record, a second later, with the schedule cleared.-        let cleared = BackupV14Fixtures.composedPayload(releaseDays: [])-        let newer = BackupV14Payload(+        let cleared = BackupV15Fixtures.composedPayload(releaseDays: [])+        let newer = BackupV15Payload(             entries: cleared.entries,             works: cleared.works.map { record in-                BackupV14Work(+                BackupV15Work(                     id: record.id, displayTitle: record.displayTitle,                     lastParsedTitle: record.lastParsedTitle,                     genericNotes: record.genericNotes, genreTags: record.genreTags,@@ -87,10 +87,10 @@ struct BackupV14ImportMatrixTests {             urlRules: cleared.urlRules, workTypes: cleared.workTypes,             memberships: cleared.memberships) -        _ = try await fixture.repository.confirmImport(plan: BackupV14Fixtures.plan(newer))+        _ = try await fixture.repository.confirmImport(plan: BackupV15Fixtures.plan(newer))          #expect(-            try await fixture.repository.work(id: BackupV14Fixtures.composedWorkID).releaseDays+            try await fixture.repository.work(id: BackupV15Fixtures.composedWorkID).releaseDays                 == [])     } @@ -101,14 +101,14 @@ struct BackupV14ImportMatrixTests {     func olderArchiveDoesNotRegressTheSchedule() async throws {         let fixture = try await M5Fixture()         _ = try await fixture.repository.confirmImport(-            plan: BackupV14Fixtures.plan(-                BackupV14Fixtures.composedPayload(releaseDays: [.friday])))+            plan: BackupV15Fixtures.plan(+                BackupV15Fixtures.composedPayload(releaseDays: [.friday]))) -        let stale = BackupV14Fixtures.composedPayload(releaseDays: [.monday])-        let older = BackupV14Payload(+        let stale = BackupV15Fixtures.composedPayload(releaseDays: [.monday])+        let older = BackupV15Payload(             entries: stale.entries,             works: stale.works.map { record in-                BackupV14Work(+                BackupV15Work(                     id: record.id, displayTitle: record.displayTitle,                     lastParsedTitle: record.lastParsedTitle,                     genericNotes: record.genericNotes, genreTags: record.genreTags,@@ -123,10 +123,10 @@ struct BackupV14ImportMatrixTests {             urlRules: stale.urlRules, workTypes: stale.workTypes,             memberships: stale.memberships) -        _ = try await fixture.repository.confirmImport(plan: BackupV14Fixtures.plan(older))+        _ = try await fixture.repository.confirmImport(plan: BackupV15Fixtures.plan(older))          #expect(-            try await fixture.repository.work(id: BackupV14Fixtures.composedWorkID).releaseDays+            try await fixture.repository.work(id: BackupV15Fixtures.composedWorkID).releaseDays                 == [.friday])     } @@ -137,14 +137,14 @@ struct BackupV14ImportMatrixTests {     /// the typed decode gives up on the missing key before the payload is ever     /// re-encoded — and the paired assertion pins it to that key rather than to     /// the paste: the identical literal carrying it decodes.-    @Test("A 14/15 Work record omitting releaseDays fails to decode")+    @Test("A 15/16 Work record omitting releaseDays fails to decode")     func recordWithoutTheFieldRefuses() throws {-        let document = BackupV14Fixtures.literalDocument(-            payload: BackupV14Fixtures.releaseDaysOmittedPayloadJSON,+        let document = BackupV15Fixtures.literalDocument(+            payload: BackupV15Fixtures.releaseDaysOmittedPayloadJSON,             entryCount: 1, workCount: 1)          do {-            _ = try BackupV14Codec.decode(document)+            _ = try BackupV15Codec.decode(document)             Issue.record("expected a decode refusal, but the document decoded")         } catch let error as BackupCodecError {             guard case .decodingFailed = error else {@@ -153,10 +153,10 @@ struct BackupV14ImportMatrixTests {             }         } -        let complete = BackupV14Fixtures.literalDocument(-            payload: BackupV14Fixtures.citationVersionFreePayloadJSON,+        let complete = BackupV15Fixtures.literalDocument(+            payload: BackupV15Fixtures.citationVersionFreePayloadJSON,             entryCount: 1, workCount: 1)-        let record = try #require(try BackupV14Codec.decode(complete).payload.works.first)+        let record = try #require(try BackupV15Codec.decode(complete).payload.works.first)         #expect(record.releaseDays == [])     } @@ -164,14 +164,14 @@ struct BackupV14ImportMatrixTests {     /// build has no case for fails the decode. There is no tolerant reading of a     /// backup — restoring `funday` as nothing would drop a day the reader typed,     /// silently, out of the file that is supposed to be the copy.-    @Test("A 14/15 Work record carrying an unknown day fails to decode")+    @Test("A 15/16 Work record carrying an unknown day fails to decode")     func recordWithAnUnknownDayRefuses() throws {-        let document = BackupV14Fixtures.literalDocument(-            payload: BackupV14Fixtures.unknownReleaseDayPayloadJSON,+        let document = BackupV15Fixtures.literalDocument(+            payload: BackupV15Fixtures.unknownReleaseDayPayloadJSON,             entryCount: 1, workCount: 1)          do {-            _ = try BackupV14Codec.decode(document)+            _ = try BackupV15Codec.decode(document)             Issue.record("expected a decode refusal, but the document decoded")         } catch let error as BackupCodecError {             guard case .decodingFailed = error else {@@ -182,20 +182,23 @@ struct BackupV14ImportMatrixTests {          // The same literal with a spelling this build *can* name decodes, so the         // refusal is about the value rather than about the key or the paste.-        let known = BackupV14Fixtures.literalDocument(-            payload: BackupV14Fixtures.populatedReleaseDaysPayloadJSON,+        let known = BackupV15Fixtures.literalDocument(+            payload: BackupV15Fixtures.populatedReleaseDaysPayloadJSON,             entryCount: 1, workCount: 1)-        let record = try #require(try BackupV14Codec.decode(known).payload.works.first)+        let record = try #require(try BackupV15Codec.decode(known).payload.works.first)         #expect(record.releaseDays == [.monday, .thursday])     } -    /// Req 8.2: the generation this one replaced is refused **by version**, with-    /// the message naming both pairs. A 13/14 file is not corrupt — it is one-    /// build old, and its Work records carry no schedule at all, which is-    /// precisely why it cannot be read as a 14/15 one.-    @Test("A 13/14 archive is refused by pair, naming it and the supported one")-    func thePreviousGenerationRefusesByPair() throws {-        let data = BackupV14Fixtures.retiredGenerationDocument(format: 13, schema: 14)+    /// `remove-article-mode` Req 5.3: the generation this one replaced is refused+    /// **by version**, with the message naming both pairs, and nothing is+    /// written. A 14/15 file is not corrupt — it is one build old, and its Site+    /// records carry a junk-suffix rule for a mode this build does not know,+    /// which is precisely why it cannot be read as a 15/16 one (Q2).+    @Test("A 14/15 archive is refused by pair, naming it and the supported one")+    func thePreviousGenerationRefusesByPair() async throws {+        let fixture = try await M5Fixture()+        let before = try await fixture.repository.sites()+        let data = BackupV15Fixtures.retiredGenerationDocument(format: 14, schema: 15)          let error = #expect(throws: BackupImportError.self) {             try BackupImporter.plan(from: data)@@ -204,8 +207,15 @@ struct BackupV14ImportMatrixTests {             Issue.record("expected an unsupported-format refusal, got \(String(describing: error))")             return         }-        #expect(reason.contains("format 13"))-        #expect(reason.contains("schema 14"))-        #expect(reason.contains("(14/15)"))+        #expect(reason.contains("format 14"))+        #expect(reason.contains("schema 15"))+        #expect(reason.contains("(15/16)"))++        // And it writes nothing (Req 5.3). The refusal is at `plan`, which runs+        // outside the repository actor and holds no lease, so there is no plan+        // for `confirmImport` to take — the library is structurally unreachable+        // from a 14/15 file, and the hostnames are here to say so out loud.+        let after = try await fixture.repository.sites()+        #expect(after.map(\.hostname) == before.map(\.hostname))     } }
Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapActionTests.swift Modified +4 / -4
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapActionTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapActionTests.swiftindex 650931bb..37772b05 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapActionTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapActionTests.swift@@ -125,7 +125,7 @@ struct BootstrapActionTests {         // are not what "empty" means here: the guard asks whether anything of the         // *reader's* would be certified sight unseen.         #expect(result == .ready(.seededEmpty))-        #expect(try root.markerText() == "15",+        #expect(try root.markerText() == "16",                 "a crash between store creation and the marker is repaired, not terminal")         withExtendedLifetime(root) {}     }@@ -269,7 +269,7 @@ struct BootstrapActionTests {         // the owner's library (Decision 5) — and the container construction is         // what fails.         try Data("this is not a sqlite store".utf8).write(to: root.storeURL, options: .atomic)-        try root.writeMarker("15\n")+        try root.writeMarker("16\n")         let before = try root.digest()          await #expect(throws: (any Error).self) {@@ -309,10 +309,10 @@ private enum RefusedState: String, CaseIterable, Sendable {         switch self {         case .storeRecordedBelowV5:             try root.installStoreRecordedAtFourZeroZero()-            try root.writeMarker("15\n")+            try root.writeMarker("16\n")         case .readinessMarkerWithoutAStore:             try root.createStoreDirectory()-            try root.writeMarker("15\n")+            try root.writeMarker("16\n")         case .historicalMarkerWithoutAStore:             try root.createStoreDirectory()             try root.writeHistoricalMarker()
Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapClassifierTests.swift Modified +10 / -10
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapClassifierTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapClassifierTests.swiftindex 14b01022..200dceb6 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapClassifierTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapClassifierTests.swift@@ -18,7 +18,7 @@ import Testing /// | Axis | Values | /// |---|---| /// | Store family | absent / main file only / companions only / full family |-/// | Readiness marker | absent / `"4"` / `"5"` / `"6"` / `"12"` / `"13"` / `"14"` / unrecognised text / non-UTF-8 bytes |+/// | Readiness marker | absent / `"4"` / `"5"` / `"6"` / `"13"` / `"14"` / `"15"` / `"16"` / unrecognised text / non-UTF-8 bytes | /// | Historical marker | present / absent | /// | Migration artefact | present / absent | /// | Recorded version | at-or-above V5 / below / indeterminate |@@ -88,11 +88,11 @@ struct BootstrapClassifierTests {      /// `bothMarkersV4Governs` as a classification: the historical marker is a     /// leftover, and the row that matches first wins.-    @Test("A \"15\" marker beside a stale historical marker classifies ready")+    @Test("A \"16\" marker beside a stale historical marker classifies ready")     func readyMarkerGovernsOverAHistoricalMarker() throws {         let root = try ClassifierRoot()         try root.seedBornAtLiveStore()-        try root.writeMarker("15\n")+        try root.writeMarker("16\n")         try root.writeHistoricalMarker()          #expect(try LibraryRepository.classify(root.configuration, fileManager: .default) == .ready)@@ -102,11 +102,11 @@ struct BootstrapClassifierTests {     /// Req 1.2 forbids *resuming from* a migration artefact, not tolerating one.     /// A certified library that still carries one is ready, and the artefact is     /// cleared after the open rather than being allowed to refuse it.-    @Test("A \"15\" marker beside a leftover migration artefact classifies ready")+    @Test("A \"16\" marker beside a leftover migration artefact classifies ready")     func readyMarkerGovernsOverALeftoverArtefact() throws {         let root = try ClassifierRoot()         try root.seedBornAtLiveStore()-        try root.writeMarker("15\n")+        try root.writeMarker("16\n")         try root.writeMigrationArtefact()          #expect(try LibraryRepository.classify(root.configuration, fileManager: .default) == .ready)@@ -360,7 +360,7 @@ struct BootstrapClassifierTests {         // it, which is `.indeterminate` — and `.indeterminate` proceeds.         try root.createStoreDirectory()         try Data("not a database".utf8).write(to: root.storeURL, options: .atomic)-        try root.writeMarker("15\n")+        try root.writeMarker("16\n")         try #require(StoreMetadata.recordedVersion(at: root.storeURL) == .indeterminate)          #expect(try LibraryRepository.classify(root.configuration, fileManager: .default) == .ready,@@ -426,9 +426,9 @@ private struct Cell: Sendable, CustomStringConvertible {         case .four: try root.writeMarker("4\n")         case .five: try root.writeMarker("5\n")         case .six: try root.writeMarker("6\n")-        case .thirteen: try root.writeMarker("13\n")         case .fourteen: try root.writeMarker("14\n")         case .fifteen: try root.writeMarker("15\n")+        case .sixteen: try root.writeMarker("16\n")         case .unrecognisedText: try root.writeMarker("99\n")         case .nonUTF8: try root.writeMarkerBytes(ClassifierRoot.nonUTF8MarkerBytes)         }@@ -441,8 +441,8 @@ private struct Cell: Sendable, CustomStringConvertible {     func expectedState(recordedVersion: StoreMetadata.RecordedVersion) -> BootstrapState {         if case .below(let version) = recordedVersion { return .belowV5(version: version) }         let storePresent = family.isStorePresent-        if marker == .fifteen, storePresent { return .ready }-        if marker == .fourteen, storePresent { return .markerLagging(generation: "14") }+        if marker == .sixteen, storePresent { return .ready }+        if marker == .fifteen, storePresent { return .markerLagging(generation: "15") }         if !storePresent {             if marker != .absent { return .orphanedEvidence(kind: .readinessMarker) }             if historicalMarker { return .orphanedEvidence(kind: .historicalMarker) }@@ -469,7 +469,7 @@ private enum StoreFamily: String, CaseIterable, Sendable { }  private enum MarkerAxis: String, CaseIterable, Sendable {-    case absent, four, five, six, thirteen, fourteen, fifteen, unrecognisedText, nonUTF8+    case absent, four, five, six, fourteen, fifteen, sixteen, unrecognisedText, nonUTF8 }  /// What the seeded main file is meant to record. The expectation is derived from
Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapStateCoverageTests.swift Modified +15 / -14
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapStateCoverageTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapStateCoverageTests.swiftindex 1aa167ea..53b2ef33 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapStateCoverageTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/BootstrapStateCoverageTests.swift@@ -42,7 +42,7 @@ struct AppBootstrapStateTests {      // MARK: - Req 2.2: the marker records the current generation and the store is present -    @Test("A populated library whose marker records \"10\" validates and opens ready")+    @Test("A populated library whose marker records \"16\" validates and opens ready")     func readyMarkerOpensReady() async throws {         let root = try LibraryRoot()         try await root.seedReadyLibrary(hostname: "r.example")@@ -57,9 +57,9 @@ struct AppBootstrapStateTests {      /// The ordered match of the design's state table: evidence overlaps, and the     /// first matching predicate wins. A stale historical marker beside a valid-    /// `"15"` marker is a *ready* library with a leftover, not an ambiguous+    /// `"16"` marker is a *ready* library with a leftover, not an ambiguous     /// state — and the leftover goes after the open, never before it.-    @Test("A stale historical marker beside a \"14\" marker resolves to ready and is cleared")+    @Test("A stale historical marker beside a \"16\" marker resolves to ready and is cleared")     func readyMarkerGovernsOverAHistoricalMarker() async throws {         let root = try LibraryRoot()         try await root.seedReadyLibrary(hostname: "b.example")@@ -183,7 +183,7 @@ struct ExtensionBootstrapStateTests {         #expect(result == .ready(oneSite))     } -    /// Every state the containing app has not brought to a `"15"` marker, with the+    /// Every state the containing app has not brought to a `"16"` marker, with the     /// same assertion over all of them: the open fails, and the library's state is     /// byte-identical afterwards apart from the lock file the extension is allowed     /// to create.@@ -232,17 +232,18 @@ private enum PreCertificationState: String, CaseIterable, Sendable {     case storeWithRetiredMarkerSix     /// `configurable-work-types` Req 8.7's update window, with the **live**     /// generation: the app has been updated and not yet launched, so the library-    /// still records `"14"`. The app opens it — the V14 → V15 stage adds one-    /// optional `Work` columns on the way in — validates and republishes at-    /// `"15"`; the extension must not, because it holds only a shared lock and+    /// still records `"15"`. The app opens it — the V15 → V16 stage drops one+    /// `Site` column on the way in — validates and republishes at+    /// `"16"`; the extension must not, because it holds only a shared lock and     /// must never migrate. The case name is historical: the lagging row holds-    /// one generation at a time, and it has been substituted six times since —+    /// one generation at a time, and it has been substituted seven times since —     /// `"8"` for `"7"` (Q2 of `drop-superseded-columns`), `"9"` for `"8"` (Q18     /// of `work-and-reading-status`), `"10"` for `"9"` (Q32 of     /// `series-and-related-works`), `"11"` for `"10"` (Q15 of-    /// `work-creators`), `"12"` for `"11"` (Q48 of `place-extraction`) and-    /// `"13"` for `"12"` (`work-thumbnails`) and `"14"` for `"13"`-    /// (`update-schedule`), which is why the seed below writes `"14"`.+    /// `work-creators`), `"12"` for `"11"` (Q48 of `place-extraction`),+    /// `"13"` for `"12"` (`work-thumbnails`), `"14"` for `"13"`+    /// (`update-schedule`) and `"15"` for `"14"` (Q10 of+    /// `remove-article-mode`), which is why the seed below writes `"15"`.     case storeWithLaggingMarkerSeven      func seed(into root: LibraryRoot) async throws {@@ -268,7 +269,7 @@ private enum PreCertificationState: String, CaseIterable, Sendable {         case .storeWithRetiredMarkerSix:             try root.writeMarker("6\n")         case .storeWithLaggingMarkerSeven:-            try root.writeMarker("14\n")+            try root.writeMarker("15\n")         }     } }@@ -278,7 +279,7 @@ private enum PreCertificationState: String, CaseIterable, Sendable { /// The bytes a certified library's readiness marker holds. Frozen persisted state /// — `FrozenLibraryPathTests` is where that is pinned; here it is the value the /// ready cases compare against.-private let readyMarkerBytes = "15\n"+private let readyMarkerBytes = "16\n"  /// The counts of a library seeded with exactly one `Site`. ///@@ -323,7 +324,7 @@ private final class LibraryRoot {     // MARK: - Seeding      /// The state Req 2.2 is about, reached the way the app reaches it: the-    /// app-role opener creates the store, certifies it and marks it `"15"`, and one+    /// app-role opener creates the store, certifies it and marks it `"16"`, and one     /// row is written through the repository it returns. No container opener and     /// no migration path is involved, so nothing here is removed by a later task.     func seedReadyLibrary(hostname: String) async throws {
Packages/AsterismCore/Tests/AsterismCoreTests/CapabilityGatingTests.swift Modified +0 / -1
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/CapabilityGatingTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/CapabilityGatingTests.swiftindex 0dcac5db..13e3fa83 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/CapabilityGatingTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/CapabilityGatingTests.swift@@ -18,7 +18,6 @@ struct CapabilityGatingTests {     @Test("The m4 gate is a superset of m3")     func m4IsSuperset() {         let m4 = AsterismCapabilities.m4-        #expect(m4.supportsArticles)         #expect(m4.supportsPhraseTeaching)         #expect(m4.supportsURLIdentity)         #expect(m4.allows(patternForm: .segment))
Packages/AsterismCore/Tests/AsterismCoreTests/CaptureStateTests.swift Modified +15 / -46
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/CaptureStateTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/CaptureStateTests.swiftindex 6520dbc0..113bde2d 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/CaptureStateTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/CaptureStateTests.swift@@ -227,7 +227,7 @@ struct CaptureStateTests {             outcome: CaptureOutcome(                 projectedChapter: "5 (updated)", projectedWorkTitle: "Test Work",                 workOutcome: .reuse(workID: UUID()), projectedWorkID: UUID(),-                actionable: false, intentionallyUnattached: false+                actionable: false             )         )         fixture.coordinator.commitOutcome = .refreshed(freshContract)@@ -258,7 +258,7 @@ struct CaptureStateTests {             outcome: CaptureOutcome(                 projectedChapter: "5", projectedWorkTitle: "Test Work Updated",                 workOutcome: .reuse(workID: UUID()), projectedWorkID: UUID(),-                actionable: false, intentionallyUnattached: false+                actionable: false             )         )         fixture.coordinator.commitOutcome = .refreshed(freshContract)@@ -398,9 +398,7 @@ struct CaptureStateTests {             projectedWorkTitle: cell.projectedChapter == nil ? nil : "Test Work",             workOutcome: nil,             projectedWorkID: nil,-            actionable: cell.projectedChapter == nil,-            intentionallyUnattached: false,-            displayTitle: cell.displayTitle+            actionable: cell.projectedChapter == nil         )         #expect(outcome.hasParsedTitle == cell.hidesRawTitle,                 "\(cell.name): raw page title \"\(cell.rawPageTitle)\"")@@ -452,7 +450,7 @@ struct CaptureStateTests {         fixture.coordinator.projectCaptureResult = .success(makeContract(outcome: CaptureOutcome(             projectedChapter: "5", projectedWorkTitle: "Test Work",             workOutcome: nil, projectedWorkID: claimedID,-            actionable: false, intentionallyUnattached: false,+            actionable: false,             composedAssignment: .claim(workID: claimedID)         )))         fixture.coordinator.shareWorkContextResult = .success(@@ -589,7 +587,7 @@ struct CaptureStateTests {         fixture.coordinator.projectCaptureResult = .success(makeContract(outcome: CaptureOutcome(             projectedChapter: "6", projectedWorkTitle: "Test Work",             workOutcome: .reuse(workID: workID), projectedWorkID: workID,-            actionable: false, intentionallyUnattached: false,+            actionable: false,             composedChapterSequence: "1043128"         )))         await fixture.viewModel.setManualTitle("Chapter 6", coordinator: fixture.coordinator)@@ -663,7 +661,7 @@ struct CaptureStateTests {         coordinator.projectCaptureResult = .success(makeContract(outcome: CaptureOutcome(             projectedChapter: "5", projectedWorkTitle: "Brand New Work",             workOutcome: .create(parsedWorkTitle: "Brand New Work"), projectedWorkID: nil,-            actionable: false, intentionallyUnattached: false+            actionable: false         )))         await viewModel.setNote("Retitled away", coordinator: coordinator)         await viewModel.loadWorkContextIfNeeded(coordinator: coordinator)@@ -735,7 +733,7 @@ struct CaptureStateTests {         fixture.coordinator.projectCaptureResult = .success(makeContract(outcome: CaptureOutcome(             projectedChapter: "5", projectedWorkTitle: "Brand New Work",             workOutcome: .create(parsedWorkTitle: "Brand New Work"), projectedWorkID: nil,-            actionable: false, intentionallyUnattached: false+            actionable: false         )))         await fixture.viewModel.setNote("Retitled", coordinator: fixture.coordinator)         await fixture.viewModel.loadWorkContextIfNeeded(coordinator: fixture.coordinator)@@ -780,7 +778,7 @@ struct CaptureStateTests {         fixture.coordinator.projectCaptureResult = .success(makeContract(outcome: CaptureOutcome(             projectedChapter: "5", projectedWorkTitle: "Brand New Work",             workOutcome: .create(parsedWorkTitle: "Brand New Work"), projectedWorkID: nil,-            actionable: false, intentionallyUnattached: false+            actionable: false         )))         await fixture.viewModel.setNote("Retitled", coordinator: fixture.coordinator) @@ -956,7 +954,7 @@ private func makeReuseOutcome(     CaptureOutcome(         projectedChapter: chapter, projectedWorkTitle: "Test Work",         workOutcome: .reuse(workID: workID), projectedWorkID: workID,-        actionable: false, intentionallyUnattached: false,+        actionable: false,         composedChapterSequence: sequence) } @@ -970,7 +968,7 @@ private struct NoCastCase: Sendable {         NoCastCase(name: "create — the work does not exist yet", outcome: CaptureOutcome(             projectedChapter: "5", projectedWorkTitle: "Brand New Work",             workOutcome: .create(parsedWorkTitle: "Brand New Work"), projectedWorkID: nil,-            actionable: false, intentionallyUnattached: false)),+            actionable: false)),         NoCastCase(name: "ambiguous — more than one work matched", outcome: CaptureOutcome(             projectedChapter: "5", projectedWorkTitle: "Test Work",             workOutcome: .ambiguous(candidates: [@@ -978,7 +976,7 @@ private struct NoCastCase: Sendable {                 WorkMatchCandidate(id: UUID(), lastParsedTitle: "Test Work", displayTitle: "Test Work")             ]),             projectedWorkID: nil,-            actionable: true, intentionallyUnattached: false)),+            actionable: true)),         NoCastCase(name: "no outcome — the projection failed", outcome: nil)     ] }@@ -990,7 +988,6 @@ private struct ParsedTitleCase: Sendable {     let name: String     let rawPageTitle: String     let projectedChapter: String?-    let displayTitle: String?     let hidesRawTitle: Bool      static let truthTable: [ParsedTitleCase] = [@@ -998,46 +995,19 @@ private struct ParsedTitleCase: Sendable {             name: "taught site, parse succeeded",             rawPageTitle: "Some Story - Chapter 5",             projectedChapter: "5",-            displayTitle: nil,-            hidesRawTitle: true),-        ParsedTitleCase(-            name: "articles site, suffix cleaned away",-            rawPageTitle: "A Long Read | The Paper",-            projectedChapter: nil,-            displayTitle: "A Long Read",-            hidesRawTitle: true),-        // Q9: the articles path always sets a display title, so a clean that-        // changed nothing still hides the raw row — the Article row would-        // otherwise repeat it verbatim.-        ParsedTitleCase(-            name: "articles site, clean was a no-op",-            rawPageTitle: "A Long Read",-            projectedChapter: nil,-            displayTitle: "A Long Read",-            hidesRawTitle: true),-        // No outcome reaches this shape: the articles branch nils-        // `projectedChapter`, the taught branch never sets `displayTitle`, and a-        // Site has one mode. The row pins the `||` itself, not a site state.-        ParsedTitleCase(-            name: "both projected fields set (unreachable; pins the ||)",-            rawPageTitle: "A Long Read - Chapter 5 | The Paper",-            projectedChapter: "5",-            displayTitle: "A Long Read",             hidesRawTitle: true),         // The last two rows are field-identical on purpose: the property reads         // the projection only, so it cannot tell these two site states apart.         ParsedTitleCase(-            name: "neither field set — untaught site (indistinguishable here)",+            name: "no chapter — untaught site (indistinguishable here)",             rawPageTitle: "Some Story - Chapter 5",             projectedChapter: nil,-            displayTitle: nil,             hidesRawTitle: false),         ParsedTitleCase(-            name: "neither field set — taught site, title misses the pattern "+            name: "no chapter — taught site, title misses the pattern "                 + "(indistinguishable here)",             rawPageTitle: "About this site",             projectedChapter: nil,-            displayTitle: nil,             hidesRawTitle: false)     ] }@@ -1133,8 +1103,7 @@ private final class FakeCaptureCoordinating: CaptureCoordinating, @unchecked Sen             projectedWorkTitle: "Test Work",             workOutcome: .reuse(workID: workID),             projectedWorkID: workID,-            actionable: false,-            intentionallyUnattached: false+            actionable: false         )     } @@ -1308,7 +1277,7 @@ private struct CaptureStateFixture {             outcome: CaptureOutcome(                 projectedChapter: nil, projectedWorkTitle: nil,                 workOutcome: nil, projectedWorkID: nil,-                actionable: true, intentionallyUnattached: false+                actionable: true             )         ))         let payload = SharePayload(
Packages/AsterismCore/Tests/AsterismCoreTests/CertificationPathTests.swift Modified +18 / -18
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/CertificationPathTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/CertificationPathTests.swiftindex aa0e5652..6b5d2035 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/CertificationPathTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/CertificationPathTests.swift@@ -16,7 +16,7 @@ import Testing /// /// What is left is the two ends: a store on a retired generation is **refused /// before a container converts it**, and an empty store is marked at birth. The-/// refusal case seeds through `V14RecordedStoreFixture` — a store the container+/// refusal case seeds through `V15RecordedStoreFixture` — a store the container /// *would* open — because a store that could not be opened anyway would prove /// nothing about when the refusal happens. @Suite("Certification paths", .serialized)@@ -44,8 +44,8 @@ struct CertificationPathTests {             .trimmingCharacters(in: .whitespacesAndNewlines)     } -    /// A store recorded at 14.0.0 — the state every installed device is in on-    /// the morning of the V15 update, and one the declared V14 → V15 stage+    /// A store recorded at 15.0.0 — the state every installed device is in on+    /// the morning of the V16 update, and one the declared V15 → V16 stage     /// converts happily. That it *is* convertible is the point: the refusal     /// below has to come from the marker, before any container exists, not from     /// a store nothing could open.@@ -54,10 +54,10 @@ struct CertificationPathTests {     /// each newly declared stage refuses the generation below it outright and     /// the shipped classifier already refused one before any container existed     /// (Req 2.9, Decision 1).-    private func installStoreArrivedAtV14(_ configuration: LibraryConfiguration) throws {-        try V14RecordedStoreFixture.install(at: configuration.storeURL)+    private func installStoreArrivedAtV15(_ configuration: LibraryConfiguration) throws {+        try V15RecordedStoreFixture.install(at: configuration.storeURL)         #expect(try V4RecordedStoreFixture.recordedModelVersions(at: configuration.storeURL)-                == ["14.0.0"], "the seed is written by the frozen snapshot, not the live classes")+                == ["15.0.0"], "the seed is written by the frozen snapshot, not the live classes")     }      // MARK: - The retired generations@@ -72,20 +72,20 @@ struct CertificationPathTests {      /// The refusal happens in `classify`, before `ModelContainer.init`. That is     /// what the recorded version proves: this store would have been converted to-    /// 15.0.0 by any container construction, and it is still recorded at 14.0.0+    /// 16.0.0 by any container construction, and it is still recorded at 15.0.0     /// afterwards. The marker is left alone for the same reason: the recovery is     /// a backup archive restored over this library, and a refusal that rewrote     /// the evidence would take that away.     ///-    /// The 14.0.0 pin only means something alongside the control that follows-    /// it: the same store, marked `"14"`, opens and is recorded 15.0.0. That is+    /// The 15.0.0 pin only means something alongside the control that follows+    /// it: the same store, marked `"15"`, opens and is recorded 16.0.0. That is     /// what makes the pin an ordering claim rather than a store nothing could     /// convert.     @Test("A store on a retired marker generation is refused before anything converts it",-          arguments: ["4", "5", "6", "7", "8", "9", "10", "11", "12", "13"])+          arguments: ["4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"])     func retiredMarkerGenerationIsRefusedBeforeConversion(digit: String) async throws {         let (dir, cfg) = try config()-        try installStoreArrivedAtV14(cfg)+        try installStoreArrivedAtV15(cfg)         try Data("\(digit)\n".utf8).write(to: cfg.readinessMarkerURL, options: .atomic)          do {@@ -97,29 +97,29 @@ struct CertificationPathTests {         }          #expect(try markerContent(cfg) == digit, "a refused open may not rewrite the marker")-        #expect(try V4RecordedStoreFixture.recordedModelVersions(at: cfg.storeURL) == ["14.0.0"],+        #expect(try V4RecordedStoreFixture.recordedModelVersions(at: cfg.storeURL) == ["15.0.0"],                 "the marker check must decide before ModelContainer.init converts anything")          // Control, mirroring the extension-side twin         // (`MarkerContractTests.extensionDeclinesBeforeOpeningAContainer`):-        // with a `"14"` marker the same store is reached, opened and converted.-        // Without it the 14.0.0 assertion above could hold because the store was+        // with a `"15"` marker the same store is reached, opened and converted.+        // Without it the 15.0.0 assertion above could hold because the store was         // unopenable rather than because the marker was read first.-        try Data("14\n".utf8).write(to: cfg.readinessMarkerURL, options: .atomic)+        try Data("15\n".utf8).write(to: cfg.readinessMarkerURL, options: .atomic)         _ = try await LibraryRepository.openForApp(cfg)-        #expect(try V4RecordedStoreFixture.recordedModelVersions(at: cfg.storeURL) == ["15.0.0"],+        #expect(try V4RecordedStoreFixture.recordedModelVersions(at: cfg.storeURL) == ["16.0.0"],                 "the same store converts once the marker check passes")         withExtendedLifetime(dir) {}     }      // MARK: - Mark-at-birth -    @Test("Mark-at-birth publishes \"15\" directly for an empty store")+    @Test("Mark-at-birth publishes \"16\" directly for an empty store")     func markAtBirthStillPublishesTheCurrentVersionDirectly() async throws {         let (dir, cfg) = try config()         let (result, _) = try await LibraryRepository.openForApp(cfg)         #expect(result == .ready(.zero))-        #expect(try markerContent(cfg) == "15",+        #expect(try markerContent(cfg) == "16",                 "an empty store has nothing to bring forward and is certified at birth (Q26)")         withExtendedLifetime(dir) {}     }
Packages/AsterismCore/Tests/AsterismCoreTests/CharacterDuplicateMachineryTests.swift Modified +3 / -3
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/CharacterDuplicateMachineryTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/CharacterDuplicateMachineryTests.swiftindex 461e52da..d050b962 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/CharacterDuplicateMachineryTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/CharacterDuplicateMachineryTests.swift@@ -296,8 +296,8 @@ struct CharacterConvergenceTests {             M5SeedCharacter(id: Self.hanna, name: "Hanna", note: "reckless", workID: Self.workID),         ]) -        await #expect(throws: BackupV14ExportError.self) {-            _ = try await fixture.repository.backupV14Snapshot()+        await #expect(throws: BackupV15ExportError.self) {+            _ = try await fixture.repository.backupV15Snapshot()         }         withExtendedLifetime(fixture) {}     }@@ -379,7 +379,7 @@ struct CharacterCitationRepointingTests {      /// The reconciler derives the stamp from the collapsing Entries rather than     /// a clock (Q56), so it is routinely *older* than the character it rewrites.-    /// `CharacterGroup.modifiedAt` is what `BackupV14Character` carries as its+    /// `CharacterGroup.modifiedAt` is what `BackupV15Character` carries as its     /// import value guard, so a backwards stamp would let an archive taken     /// before the character's last edit overwrite it.     @Test("Repointing never moves a character's modifiedAt backwards")
Packages/AsterismCore/Tests/AsterismCoreTests/CitationBlobRefreshTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/CitationBlobRefreshTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/CitationBlobRefreshTests.swiftindex dee18f68..e6219573 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/CitationBlobRefreshTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/CitationBlobRefreshTests.swift@@ -247,12 +247,12 @@ private final class BlobStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismCitationBlob-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         context = ModelContext(container)     }
Packages/AsterismCore/Tests/AsterismCoreTests/ComposedCaptureTests.swift Modified +1 / -5
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/ComposedCaptureTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/ComposedCaptureTests.swiftindex fae5bcb1..237f6d10 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/ComposedCaptureTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/ComposedCaptureTests.swift@@ -37,7 +37,7 @@ struct ComposedCaptureTests {         let context = fixture.freshContext()         let entry = try #require(try context.fetch(FetchDescriptor<Entry>()).first { $0.id == snapshot.id })         try LibraryValidator.validateEntryTuple(-            entry: entry, site: fixture.site(context), works: entry.work.map { [$0] } ?? [])+            entry: entry, works: entry.work.map { [$0] } ?? [])         #expect(entry.citationValues.identity.keyVersion == 2)         #expect(entry.conservativeIdentityKey == entry.rawURLString)         #expect(entry.chapterTitle == "Chapter 9")@@ -216,10 +216,6 @@ private struct ComposedCaptureFixture {      func freshContext() -> ModelContext { ModelContext(container) } -    func site(_ context: ModelContext) -> Site {-        (try? context.fetch(FetchDescriptor<Site>()))?.first { $0.hostname == host } ?? Site(hostname: host)-    }-     func seedSite() throws {         let context = ModelContext(container)         if (try? context.fetch(FetchDescriptor<Site>()))?.first(where: { $0.hostname == host }) == nil {
Packages/AsterismCore/Tests/AsterismCoreTests/ConvergedRuleGroupValidationTests.swift Modified +15 / -15
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/ConvergedRuleGroupValidationTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/ConvergedRuleGroupValidationTests.swiftindex 5b70591a..83c62e26 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/ConvergedRuleGroupValidationTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/ConvergedRuleGroupValidationTests.swift@@ -249,17 +249,17 @@ struct ConvergedRuleGroupValidationTests {         // The premise: the store says this library is fine.         #expect(await repository.diagnostics.quarantineMap().isEmpty) -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()          #expect(payload.titlePatterns.count == 1)         #expect(payload.titlePatterns.first?.id == shared)         #expect(payload.titlePatterns.first?.siteHostname == payload.sites.first?.hostname)         // The reference validator is what refuses a payload holding one rule         // UUID twice, so a decode is the assertion that matters here.-        let encoded = try BackupV14Codec.encode(+        let encoded = try BackupV15Codec.encode(             payload: payload,-            metadata: BackupV14Metadata(appBuild: "1", exportedAt: RuleGroupStore.epoch))-        let decoded = try BackupV14Codec.decode(encoded)+            metadata: BackupV15Metadata(appBuild: "1", exportedAt: RuleGroupStore.epoch))+        let decoded = try BackupV15Codec.decode(encoded)         #expect(decoded.payload.titlePatterns.count == 1)     } @@ -289,15 +289,15 @@ struct ConvergedRuleGroupValidationTests {         // The premise, again: the store says this library is fine.         #expect(await repository.diagnostics.quarantineMap().isEmpty) -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()          #expect(payload.titlePatterns.count == 1)         #expect(payload.titlePatterns.first?.isActive == true)         #expect(payload.sites.first?.mode == .taught)-        let encoded = try BackupV14Codec.encode(+        let encoded = try BackupV15Codec.encode(             payload: payload,-            metadata: BackupV14Metadata(appBuild: "1", exportedAt: RuleGroupStore.epoch))-        _ = try BackupV14Codec.decode(encoded)+            metadata: BackupV15Metadata(appBuild: "1", exportedAt: RuleGroupStore.epoch))+        _ = try BackupV15Codec.decode(encoded)     }      /// The URL-rule counterpart, which is the quieter failure: the archive's@@ -316,7 +316,7 @@ struct ConvergedRuleGroupValidationTests {          #expect(await repository.diagnostics.quarantineMap().isEmpty) -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()          #expect(payload.urlRules.count == 1)         #expect(payload.urlRules.first?.isCurrent == true)@@ -337,15 +337,15 @@ struct ConvergedRuleGroupValidationTests {          #expect(await repository.diagnostics.quarantineMap().isEmpty) -        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()          #expect(payload.urlRules.count == 1)         #expect(payload.urlRules.first?.id == shared)         #expect(payload.urlRules.first?.isCurrent == true)-        let encoded = try BackupV14Codec.encode(+        let encoded = try BackupV15Codec.encode(             payload: payload,-            metadata: BackupV14Metadata(appBuild: "1", exportedAt: RuleGroupStore.epoch))-        _ = try BackupV14Codec.decode(encoded)+            metadata: BackupV15Metadata(appBuild: "1", exportedAt: RuleGroupStore.epoch))+        _ = try BackupV15Codec.decode(encoded)     } } @@ -367,12 +367,12 @@ private final class RuleGroupStore {         let directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismConvergedRules-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         let container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         self.init(context: ModelContext(container))         retained = container
Packages/AsterismCore/Tests/AsterismCoreTests/CreatorConvergenceTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/CreatorConvergenceTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/CreatorConvergenceTests.swiftindex 4623495c..e1baea55 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/CreatorConvergenceTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/CreatorConvergenceTests.swift@@ -41,9 +41,9 @@ struct CreatorConvergenceTests {                 .appending(path: "CreatorConvergence-\(UUID())", directoryHint: .isDirectory)             try FileManager.default.createDirectory(                 at: directory, withIntermediateDirectories: true)-            let schema = Schema(versionedSchema: AsterismSchemaV15.self)+            let schema = Schema(versionedSchema: AsterismSchemaV16.self)             container = try ModelContainer(-                for: schema, migrationPlan: AsterismV15MigrationPlan.self,+                for: schema, migrationPlan: AsterismV16MigrationPlan.self,                 configurations: [                     ModelConfiguration(                         "AsterismV3", schema: schema,
Packages/AsterismCore/Tests/AsterismCoreTests/CreditReconcilerTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/CreditReconcilerTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/CreditReconcilerTests.swiftindex 97355cd4..93528f64 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/CreditReconcilerTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/CreditReconcilerTests.swift@@ -35,9 +35,9 @@ struct CreditReconcilerTests {                 .appending(path: "CreditReconciler-\(UUID())", directoryHint: .isDirectory)             try FileManager.default.createDirectory(                 at: directory, withIntermediateDirectories: true)-            let schema = Schema(versionedSchema: AsterismSchemaV15.self)+            let schema = Schema(versionedSchema: AsterismSchemaV16.self)             container = try ModelContainer(-                for: schema, migrationPlan: AsterismV15MigrationPlan.self,+                for: schema, migrationPlan: AsterismV16MigrationPlan.self,                 configurations: [                     ModelConfiguration(                         "AsterismV3", schema: schema,
Packages/AsterismCore/Tests/AsterismCoreTests/CrossSiteDuplicateScanTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/CrossSiteDuplicateScanTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/CrossSiteDuplicateScanTests.swiftindex 533cb2b4..a6dd067d 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/CrossSiteDuplicateScanTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/CrossSiteDuplicateScanTests.swift@@ -244,12 +244,12 @@ private final class ScanStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismCrossSiteScan-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         context = ModelContext(container)     }
Packages/AsterismCore/Tests/AsterismCoreTests/DuplicateReconcilerTestSupport.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/DuplicateReconcilerTestSupport.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/DuplicateReconcilerTestSupport.swiftindex e0a4e10f..6aa5c3b0 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/DuplicateReconcilerTestSupport.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/DuplicateReconcilerTestSupport.swift@@ -44,12 +44,12 @@ final class DuplicateStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismDuplicateReconciler-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         seed = ModelContext(container)         if let saveStrategy {
Packages/AsterismCore/Tests/AsterismCoreTests/DuplicateScanTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/DuplicateScanTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/DuplicateScanTests.swiftindex 3055eba8..7ce6729f 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/DuplicateScanTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/DuplicateScanTests.swift@@ -555,12 +555,12 @@ private final class ScanStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismDuplicateScan-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         context = ModelContext(container)     }
Packages/AsterismCore/Tests/AsterismCoreTests/EmptyLibraryTests.swift Modified +17 / -49
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/EmptyLibraryTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/EmptyLibraryTests.swiftindex 9bb85cdb..5529ba92 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/EmptyLibraryTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/EmptyLibraryTests.swift@@ -7,7 +7,7 @@ import Testing /// The deletion contract of `empty-library`, over a small seeded store. /// /// The seed is the **golden archive**, imported through the real commit path:-/// it is the one fixture in the package that populates every array a 14/15+/// it is the one fixture in the package that populates every array a 15/16 /// payload can hold, which is the same thing as populating every entity the live /// schema declares. A pass asserted over a store missing half the tables would /// say nothing about Req 3.1, and the coverage test in `ModelContractTests` only@@ -463,12 +463,12 @@ struct EmptyLibraryTests {         let fixture = try await EmptyLibraryFixture()         try await fixture.seedGoldenLibrary() -        let before = try await fixture.repository.backupV14Snapshot()+        let before = try await fixture.repository.backupV15Snapshot()         let report = try await fixture.repository.emptyLibrary()         #expect(report.outcome == .completed)          try await fixture.repository.confirmImport(plan: EmptyLibraryFixture.plan(before))-        let after = try await fixture.repository.backupV14Snapshot()+        let after = try await fixture.repository.backupV15Snapshot()          #expect(after == before)         await fixture.tearDown()@@ -493,17 +493,17 @@ struct EmptyLibraryTests {         let fixture = try await EmptyLibraryFixture(saveStrategy: strategy)         try await fixture.seedGoldenLibrary() -        let archive = try await fixture.repository.backupV14Snapshot()+        let archive = try await fixture.repository.backupV15Snapshot()         _ = try await fixture.repository.emptyLibrary()         try await fixture.repository.confirmImport(plan: EmptyLibraryFixture.plan(archive))-        let restored = try await fixture.repository.backupV14Snapshot()+        let restored = try await fixture.repository.backupV15Snapshot()         let stamps = try await fixture.repository.modificationStampsForTesting()          strategy.arm()         try await fixture.repository.confirmImport(plan: EmptyLibraryFixture.plan(archive))          #expect(strategy.saves > 0, "the second import must have reached its saves")-        #expect(try await fixture.repository.backupV14Snapshot() == restored)+        #expect(try await fixture.repository.backupV15Snapshot() == restored)         #expect(try await fixture.repository.modificationStampsForTesting() == stamps)         await fixture.tearDown()     }@@ -515,7 +515,7 @@ struct EmptyLibraryTests {         let fixture = try await EmptyLibraryFixture()         try await fixture.seedGoldenLibrary() -        let archive = try await fixture.repository.backupV14Snapshot()+        let archive = try await fixture.repository.backupV15Snapshot()         let late = try await fixture.repository.capture(             CaptureDraft(                 captureTitle: "Chapter 9 - After the export",@@ -816,36 +816,17 @@ private final class EmptyLibraryFixture {     /// kind the payload can hold, so every entity the schema declares ends up     /// with rows.     ///-    /// One record of it is normalised afterwards. The golden's taught site is a-    /// hand-built wire record carrying a junk-suffix rule, which is a shape the-    /// import's own update path forbids: `applyDesignation` forces the rule nil-    /// off `.articles` and calls that "this pass's own rule", while-    /// `ArchiveRecordBuilders.makeSite` copies the record verbatim on the insert-    /// path. So the same archive imported into an empty library and imported-    /// over an existing row produce different Site rows — a **pre-existing-    /// divergence between the importer's two branches**, unrelated to the-    /// emptying, which would otherwise be the one thing a second import moves.-    /// Dropping it here keeps this suite about the pass; the archive still-    /// carries a junk rule on the `.articles` site, which is where the column-    /// belongs.-    ///-    /// **The real fix was attempted and does not fit under a recorded golden.**-    /// Stating the rule once — `mode == .articles ? junkSuffixRule : nil`, used-    /// by both `makeSite` and `applyDesignation` — makes the two paths agree, but-    /// `BackupGoldenExportTests` then fails twice: its taught site is the only-    /// one in the fixture carrying the column, so-    /// `goldenLibraryPopulatesEveryArray` loses its `junkSuffixRule != nil` and-    /// the byte comparison against `Fixtures/backup-14-15-golden.json` moves.-    /// Landing it means moving the column onto the fixture's `.articles` site and-    /// re-recording the archive, which is a deliberate act with an owner's-    /// procedure (`rule-citation-by-uuid` Q22) and not this suite's to take.+    /// The importer's two branches used to disagree about `Site.junkSuffixRule`+    /// — `makeSite` copied it and `applyDesignation` forced it nil off+    /// `.articles` — so this seed had to normalise one record afterwards. V16+    /// dropped the column (`remove-article-mode` Req 4.1), so neither branch+    /// has anything to write and the normalisation is gone with it.     func seedGoldenLibrary() async throws {         try await repository.confirmImport(             plan: try BackupImporter.plan(-                from: try BackupV14Codec.encode(+                from: try BackupV15Codec.encode(                     payload: BackupGoldenLibrary.payload,                     metadata: BackupGoldenLibrary.metadata)))-        try await repository.dropJunkRulesOutsideArticlesForTesting()     }      /// One waiting capture, one set aside, one refusal receipt, a drain report@@ -892,11 +873,11 @@ private final class EmptyLibraryFixture {      /// The plan `confirmImport` takes, straight off a payload the export just     /// produced — what a reader restoring their own backup hands it.-    static func plan(_ payload: BackupV14Payload) -> BackupImportPlan {+    static func plan(_ payload: BackupV15Payload) -> BackupImportPlan {         BackupImportPlan(             metadata: BackupImportMetadata(-                formatVersion: BackupV14Document.formatVersion,-                schemaVersion: BackupV14Document.schemaVersion,+                formatVersion: BackupV15Document.formatVersion,+                schemaVersion: BackupV15Document.schemaVersion,                 appBuild: "empty-library-test",                 exportedAt: BackupGoldenLibrary.created, capabilityGate: "multi-site",                 entryCount: payload.entries.count, workCount: payload.works.count),@@ -917,7 +898,7 @@ extension LibraryRepository {     /// Every entity's row count, read through the pass's own phase list.     ///     /// Circular only in appearance: `ModelContractTests` pins that list against-    /// `AsterismSchemaV15.models`, so counting through it is counting the+    /// `AsterismSchemaV16.models`, so counting through it is counting the     /// schema's entities — and the alternative, a second hand-written list of     /// seventeen fetches, is one more thing to forget at the next bump.     fileprivate func emptyLibraryRowCounts() async throws -> [String: Int] {@@ -930,19 +911,6 @@ extension LibraryRepository {         }     } -    /// See `EmptyLibraryFixture.seedGoldenLibrary` for why the seed needs this.-    fileprivate func dropJunkRulesOutsideArticlesForTesting() async throws {-        try await withLockedContext(-            mode: .exclusive, operation: "normalising the seeded Site designations"-        ) { context in-            for site in try context.fetch(FetchDescriptor<Site>())-            where site.mode != .articles && site.junkSuffixRule != nil {-                site.junkSuffixRule = nil-            }-            try saveStrategy.save(context)-        }-    }-     fileprivate func tupleDiagnosesForTesting() async throws -> [String: LibraryValidationError] {         try await withLockedContext(mode: .shared, operation: "reading tuple diagnoses") { context in             try LibraryValidator.validate(context: context).tupleDiagnoses
Packages/AsterismCore/Tests/AsterismCoreTests/EnumTolerancePolicyTests.swift Modified +4 / -4
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/EnumTolerancePolicyTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/EnumTolerancePolicyTests.swiftindex ec7b5190..9cfed227 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/EnumTolerancePolicyTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/EnumTolerancePolicyTests.swift@@ -207,9 +207,9 @@ struct EnumTolerancePolicyTests {         #expect(snapshot.works.contains { $0.id == workID })          do {-            _ = try await repository.backupV14Snapshot()+            _ = try await repository.backupV15Snapshot()             Issue.record("the export archived an unrepresentable value")-        } catch let error as BackupV14ExportError {+        } catch let error as BackupV15ExportError {             guard case .unrepresentableValue(let record, let field, let value) = error else {                 Issue.record("expected .unrepresentableValue, got \(error)")                 return@@ -246,9 +246,9 @@ struct EnumTolerancePolicyTests {         let repository = try await library.openForApp()          do {-            _ = try await repository.backupV14Snapshot()+            _ = try await repository.backupV15Snapshot()             Issue.record("the export archived an unreadable citation blob")-        } catch let error as BackupV14ExportError {+        } catch let error as BackupV15ExportError {             guard case .unrepresentableValue(_, let refused, _) = error else {                 Issue.record("expected .unrepresentableValue, got \(error)")                 return
Packages/AsterismCore/Tests/AsterismCoreTests/ExportInputReadTests.swift Modified +2 / -12
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/ExportInputReadTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/ExportInputReadTests.swiftindex 6a58b06c..819eed27 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/ExportInputReadTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/ExportInputReadTests.swift@@ -127,37 +127,27 @@ struct ExportInputReadTests {         #expect(workInput.blocks.map(\.dateText) == ["12 May 2026", "13 May 2026"])     } -    @Test("Headings use the cleaned display title: articles junk-strip and whole-title trim (1.2)")+    @Test("Headings use the trimmed display title of a whole-title rule (1.2)")     func cleanedHeadings() async throws {         let fixture = try await M5Fixture()-        let articleEntry = UUID()         let trimmedEntry = UUID()         let chapteredEntry = UUID()         try await fixture.repository.seedM5Rows(             sites: [-                M5SeedSite(-                    hostname: "articles.test", mode: .articles,-                    junkExample: "Story — Example Site"),                 M5SeedSite(                     hostname: "taught.test", mode: .taught, wholeTitleRule: true,                     trimPrefix: "Read: "),             ],             entries: [-                M5SeedEntry(-                    id: articleEntry, captureTitle: "Chapter One — Example Site",-                    hostname: "articles.test", path: "one"),                 M5SeedEntry(                     id: trimmedEntry, captureTitle: "Read: The Serial", hostname: "taught.test",                     path: "serial"),-                // A chapter title outranks the cleaned capture title (1.2).+                // A chapter title outranks the trimmed capture title (1.2).                 M5SeedEntry(                     id: chapteredEntry, captureTitle: "Read: The Serial", hostname: "taught.test",                     path: "serial-2", chapterTitle: "The Long Way"),             ]) -        #expect(-            try await fixture.repository.entryExportInput(-                entryID: articleEntry, locale: auLocale).headingText == "Chapter One")         #expect(             try await fixture.repository.entryExportInput(                 entryID: trimmedEntry, locale: auLocale).headingText == "The Serial")
Packages/AsterismCore/Tests/AsterismCoreTests/FanOutWriteTests.swift Modified +3 / -3
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/FanOutWriteTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/FanOutWriteTests.swiftindex 787b823c..187f5194 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/FanOutWriteTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/FanOutWriteTests.swift@@ -644,7 +644,7 @@ final class WriteFixture {     /// identity key — the upsert shape (Decision 8), so the plan updates rather     /// than inserts.     func importPlan(entryID: UUID, note: String, modifiedAt: Date) throws -> BackupImportPlan {-        let entry = BackupV14Entry(+        let entry = BackupV15Entry(             id: entryID, captureTitle: "Chapter", captureTitleSource: .host,             rawURL: identityKey, canonicalURL: nil, hostname: "dup.example",             entryIdentityKey: identityKey,@@ -653,8 +653,8 @@ final class WriteFixture {             note: note, rating: nil, firstCapturedAt: Self.epoch, lastSharedAt: Self.epoch,             modifiedAt: modifiedAt, workID: nil, intentionallyUnattached: false,             citations: EntryCitations())-        let site = BackupV14Site(-            hostname: "dup.example", displayName: "Dup", mode: .untaught, junkSuffixRule: nil)+        let site = BackupV15Site(+            hostname: "dup.example", displayName: "Dup", mode: .untaught)         let payload = BackupImportPayload(             entries: [entry], works: [], sites: [site], titlePatterns: [], urlRules: [])         return BackupImportPlan(
Packages/AsterismCore/Tests/AsterismCoreTests/FixtureArchiveGeneratorTests.swift Modified +4 / -4
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/FixtureArchiveGeneratorTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/FixtureArchiveGeneratorTests.swiftindex 49244ff6..b07650f3 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/FixtureArchiveGeneratorTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/FixtureArchiveGeneratorTests.swift@@ -29,8 +29,8 @@ import Testing /// extension is greyed out and cannot be selected on the device. The exporter's /// own filenames are `Asterism-backup-v4-<timestamp>.json` for the same reason. ///-/// The archive is produced through the real `BackupV14Exporter` — the same-/// `backupV14Snapshot()` → `BackupV14Codec.encode` → decode-validate → write path+/// The archive is produced through the real `BackupV15Exporter` — the same+/// `backupV15Snapshot()` → `BackupV15Codec.encode` → decode-validate → write path /// the app's Settings export uses — so what lands on disk is byte-for-byte the /// kind of file the app produces, checksum and all. The generator then re-reads /// the written file through `BackupImporter.plan(from:)`, which is the same@@ -96,9 +96,9 @@ struct FixtureArchiveGeneratorTests {         // it just produced. It picks its own filename in the staging directory;         // the archive is moved to `destination` afterwards.         let staging = root.appending(path: "staging", directoryHint: .isDirectory)-        let exporter = BackupV14Exporter(repository: repository, stagingDirectory: staging)+        let exporter = BackupV15Exporter(repository: repository, stagingDirectory: staging)         let result = try await exporter.export(-            metadata: BackupV14Metadata(appBuild: "fixture-5k", exportedAt: exportedAt))+            metadata: BackupV15Metadata(appBuild: "fixture-5k", exportedAt: exportedAt))         withExtendedLifetime(container) {}          try FileManager.default.createDirectory(
Packages/AsterismCore/Tests/AsterismCoreTests/Fixtures/backup-14-15-golden.json Deleted +0 / -1
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/Fixtures/backup-14-15-golden.json b/Packages/AsterismCore/Tests/AsterismCoreTests/Fixtures/backup-14-15-golden.jsondeleted file mode 100644index 7485c06a..00000000--- a/Packages/AsterismCore/Tests/AsterismCoreTests/Fixtures/backup-14-15-golden.json+++ /dev/null@@ -1 +0,0 @@-{"appBuild":"golden","backupFormatVersion":14,"capabilityGate":"multi-site","checksum":"2b9d76d8db0aac9d9993982dd26cfa4892ad0ff555e34aa35e2975f63502059f","databaseSchemaVersion":15,"entryCount":4,"exportedAt":"1970-01-12T13:46:40.000Z","payload":{"characters":[{"aliases":["Klar"],"createdAt":"1970-01-12T13:46:40.000Z","facts":[{"nameKey":"grover","quote":"promised to guide them home","source":{"entryID":"22222222-2222-2222-2222-222222222222","kind":"entry"},"statement":"Promised to guide them home."}],"id":"C4A2ACE0-0000-4000-8000-000000000001","modifiedAt":"1970-01-12T13:46:40.000Z","name":"Grover","nameKey":"grover","note":"The guide.","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"},{"aliases":[],"createdAt":"1970-01-12T13:46:40.000Z","facts":[],"id":"C4A2ACE0-0000-4000-8000-000000000002","modifiedAt":"1970-01-12T13:46:40.000Z","name":"The Stranger","nameKey":"the stranger","note":""}],"creatorRoles":[{"createdAt":"1970-01-01T00:00:00.000Z","id":"E0000001-0000-4000-8000-000000000001","modifiedAt":"1970-01-01T00:00:00.000Z","name":"author","nameModifiedAt":"1970-01-01T00:00:00.000Z","position":0,"positionModifiedAt":"1970-01-01T00:00:00.000Z","stateModifiedAt":"1970-01-01T00:00:00.000Z","stateRaw":"active"},{"createdAt":"1970-01-01T00:00:00.000Z","id":"E0000002-0000-4000-8000-000000000002","modifiedAt":"1970-01-01T00:00:00.000Z","name":"artist","nameModifiedAt":"1970-01-01T00:00:00.000Z","position":1,"positionModifiedAt":"1970-01-01T00:00:00.000Z","stateModifiedAt":"1970-01-01T00:00:00.000Z","stateRaw":"active"},{"createdAt":"1970-01-01T00:00:00.000Z","id":"E0000003-0000-4000-8000-000000000003","modifiedAt":"1970-01-01T00:00:00.000Z","name":"translator","nameModifiedAt":"1970-01-01T00:00:00.000Z","position":2,"positionModifiedAt":"1970-01-01T00:00:00.000Z","stateModifiedAt":"1970-01-01T00:00:00.000Z","stateRaw":"active"},{"createdAt":"1970-01-12T13:46:40.000Z","id":"E0000004-0000-4000-8000-000000000004","modifiedAt":"1970-01-12T13:46:40.000Z","name":"letterer","nameModifiedAt":"1970-01-12T13:46:40.000Z","position":3,"positionModifiedAt":"1970-01-12T13:46:40.000Z","stateModifiedAt":"1970-01-12T13:46:40.000Z","stateRaw":"active"},{"createdAt":"1970-01-12T13:46:40.000Z","id":"E0000005-0000-4000-8000-000000000005","modifiedAt":"1970-01-12T13:46:40.000Z","name":"editor","nameModifiedAt":"1970-01-12T13:46:40.000Z","position":4,"positionModifiedAt":"1970-01-12T13:46:40.000Z","stateModifiedAt":"1970-01-12T13:46:40.000Z","stateRaw":"removed"}],"creators":[{"createdAt":"1970-01-12T13:46:40.000Z","id":"C8EA1080-0000-4000-8000-000000000001","modifiedAt":"1970-01-12T13:46:40.000Z","name":"Mori Ayane","nameModifiedAt":"1970-01-12T13:46:40.000Z","notes":"Also draws.","notesModifiedAt":"1970-01-12T13:46:40.000Z","stateModifiedAt":"1970-01-12T13:46:40.000Z","stateRaw":"active"},{"createdAt":"1970-01-12T13:46:40.000Z","id":"C8EA1080-0000-4000-8000-000000000002","modifiedAt":"1970-01-12T13:46:40.000Z","name":"Studio Lantern","nameModifiedAt":"1970-01-12T13:46:40.000Z","notes":"","notesModifiedAt":"1970-01-12T13:46:40.000Z","stateModifiedAt":"1970-01-12T13:46:40.000Z","stateRaw":"active"},{"canonicalID":"C8EA1080-0000-4000-8000-000000000001","createdAt":"1970-01-12T13:46:40.000Z","id":"C8EA1080-0000-4000-8000-000000000003","modifiedAt":"1970-01-12T13:46:40.000Z","name":"mori ayane","nameModifiedAt":"1970-01-12T13:46:40.000Z","notes":"","notesModifiedAt":"1970-01-12T13:46:40.000Z","stateModifiedAt":"1970-01-12T13:46:40.000Z","stateRaw":"merged"}],"credits":[{"createdAt":"1970-01-12T13:46:40.000Z","creatorID":"C8EA1080-0000-4000-8000-000000000001","id":"C8ED1700-0000-4000-8000-000000000001","modifiedAt":"1970-01-12T13:46:40.000Z","roleIDs":["E0000001-0000-4000-8000-000000000001","E0000005-0000-4000-8000-000000000005"],"workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"},{"createdAt":"1970-01-12T13:46:40.000Z","creatorID":"C8EA1080-0000-4000-8000-000000000002","id":"C8ED1700-0000-4000-8000-000000000002","modifiedAt":"1970-01-12T13:46:40.000Z","roleIDs":["E0000002-0000-4000-8000-000000000002","E000000F-0000-4000-8000-00000000000F"],"workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE2"},{"createdAt":"1970-01-12T13:46:40.000Z","creatorID":"C8EA1080-0000-4000-8000-000000000001","id":"C8ED1700-0000-4000-8000-000000000003","modifiedAt":"1970-01-12T13:46:40.000Z","roleIDs":["E0000001-0000-4000-8000-000000000001"],"workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE9"}],"distinctPairs":[{"higherWorkID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE","id":"88888888-0000-4000-8000-000000000001","lowerWorkID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE2","recordedAt":"1970-01-12T13:46:40.000Z"}],"entries":[{"captureTitle":"TtH • Story • Actual Title","captureTitleSource":"host","chapterSequence":"94","characterExtractionFingerprint":"448c04a700521270a7f5215cd2cfbbe77818591b29899fa94ca100201738f368","citations":{"chapterSequence":{"id":"DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD"},"chapterTitle":{"kind":"none"},"identity":{"composed":{"nameTitle":{"id":"CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC"},"url":{"id":"DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD"}}},"workAssignment":{"pattern":{"_0":{"id":"CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC"}}}},"conservativeIdentityKey":"https://golden.example/read?chapter=94&x=1","entryIdentityKey":"v3|h14:golden.example|n12:Actual Title|s2:94","firstCapturedAt":"1970-01-12T13:46:40.000Z","hostname":"golden.example","id":"22222222-2222-2222-2222-222222222222","identityBasis":"urlRule","intentionallyUnattached":false,"lastSharedAt":"1970-01-12T13:46:40.000Z","modifiedAt":"1970-01-12T13:46:40.000Z","note":"Grover promised to guide them home.","rating":"up","rawURL":"https://golden.example/read?chapter=94&x=1","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"},{"captureTitle":"Plain Work","captureTitleSource":"manual","chapterTitle":"A Plain Chapter","citations":{"chapterTitle":{"kind":"manual"},"identity":{"rawURL":{}},"workAssignment":{"manual":{}}},"conservativeIdentityKey":"https://plain.example/read/7","entryIdentityKey":"https://plain.example/read/7","firstCapturedAt":"1970-01-12T13:46:40.000Z","hostname":"plain.example","id":"22222222-2222-2222-2222-222222222223","identityBasis":"conservative","intentionallyUnattached":false,"lastSharedAt":"1970-01-12T13:46:40.000Z","modifiedAt":"1970-01-12T13:46:40.000Z","note":"","rawURL":"https://plain.example/read/7","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE2"},{"canonicalURL":"https://articles.example/posts/hello","captureTitle":"An Article - Articles Example","captureTitleSource":"host","citations":{"chapterTitle":{"kind":"none"},"identity":{"rawURL":{}},"workAssignment":{"manual":{}}},"conservativeIdentityKey":"https://articles.example/posts/hello?utm_source=share","entryIdentityKey":"https://articles.example/posts/hello?utm_source=share","firstCapturedAt":"1970-01-12T13:46:40.000Z","hostname":"articles.example","id":"22222222-2222-2222-2222-222222222224","identityBasis":"conservative","intentionallyUnattached":false,"lastSharedAt":"1970-01-12T13:46:40.000Z","modifiedAt":"1970-01-12T13:46:40.000Z","note":"","rawURL":"https://articles.example/posts/hello?utm_source=share","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE3"},{"captureTitle":"Twice Over","captureTitleSource":"manual","citations":{"chapterTitle":{"kind":"none"},"identity":{"rawURL":{}},"workAssignment":{"manual":{}}},"conservativeIdentityKey":"https://dupe.example/read/1","entryIdentityKey":"https://dupe.example/read/1","firstCapturedAt":"1970-01-12T13:46:40.000Z","hostname":"dupe.example","id":"D0000000-0000-4000-8000-000000000002","identityBasis":"conservative","intentionallyUnattached":false,"lastSharedAt":"1970-01-12T13:46:40.000Z","modifiedAt":"1970-01-12T13:46:40.000Z","note":"","rawURL":"https://dupe.example/read/1","workID":"D0000000-0000-4000-8000-000000000001"}],"links":[{"createdAt":"1970-01-12T13:46:40.000Z","higherWorkID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE","id":"11115E51-0000-4000-8000-000000000001","linkType":"adaptation","lowerWorkID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE3","modifiedAt":"1970-01-12T13:46:40.000Z"},{"createdAt":"1970-01-12T13:46:40.000Z","higherWorkID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE9","id":"11115E51-0000-4000-8000-000000000002","linkType":"spin-off","lowerWorkID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE2","modifiedAt":"1970-01-12T13:46:40.000Z"}],"memberships":[{"createdAt":"1970-01-12T13:46:40.000Z","hostname":"golden.example","id":"77777777-0000-4000-8000-000000000001","urlIdentity":"golden.example/story/actual-title","urlIdentityRuleID":"DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD","urlIdentityState":"rule","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE","workURLString":"https://golden.example/story/actual-title"},{"createdAt":"1970-01-12T13:46:41.000Z","hostname":"plain.example","id":"77777777-0000-4000-8000-000000000002","urlIdentityState":"none","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE","workURLString":"https://plain.example/works/actual-title"},{"createdAt":"1970-01-12T13:46:40.000Z","hostname":"plain.example","id":"77777777-0000-4000-8000-000000000003","urlIdentityState":"none","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE2"},{"createdAt":"1970-01-12T13:46:40.000Z","hostname":"articles.example","id":"77777777-0000-4000-8000-000000000004","urlIdentityState":"none","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE3"},{"createdAt":"1970-01-12T13:46:40.000Z","hostname":"plain.example","id":"77777777-0000-4000-8000-000000000005","urlIdentity":"plain.example/absent","urlIdentityState":"legacyUnverified","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE9"},{"createdAt":"1970-01-12T13:46:40.000Z","hostname":"dupe.example","id":"77777777-0000-4000-8000-000000000006","urlIdentityState":"none","workID":"D0000000-0000-4000-8000-000000000001"}],"placeSuppressions":[{"actionAt":"1970-01-12T13:46:40.000Z","id":"5099E5ED-0000-4000-8000-000000000011","kindRaw":"candidate","nameKey":"low road","statusRaw":"active","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"},{"actionAt":"1970-01-12T13:46:40.000Z","evidence":"above the pass","id":"5099E5ED-0000-4000-8000-000000000012","kindRaw":"fact","nameKey":"high keep","sourceEntryID":"22222222-2222-2222-2222-222222222222","sourceKindRaw":"entry","statusRaw":"active","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"}],"places":[{"aliases":["The Keep"],"createdAt":"1970-01-12T13:46:40.000Z","facts":[{"nameKey":"high keep","quote":"above the pass","source":{"entryID":"22222222-2222-2222-2222-222222222222","kind":"entry"},"statement":"Sits above the pass."}],"id":"91ACE000-0000-4000-8000-000000000001","modifiedAt":"1970-01-12T13:46:40.000Z","name":"The High Keep","nameKey":"high keep","note":"The fortress above the pass.","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"},{"aliases":[],"createdAt":"1970-01-12T13:46:40.000Z","facts":[],"id":"91ACE000-0000-4000-8000-000000000002","modifiedAt":"1970-01-12T13:46:40.000Z","name":"The Drowned Road","nameKey":"drowned road","note":"","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE9"}],"series":[{"createdAt":"1970-01-12T13:46:40.000Z","id":"5E81E5A0-0000-4000-8000-000000000001","modifiedAt":"1970-01-12T13:46:40.000Z","name":"Ashfall Cycle","notes":"Read 2.5 after 2."}],"sites":[{"displayName":"Articles","hostname":"articles.example","mode":"articles"},{"displayName":"Dupe","hostname":"dupe.example","mode":"untaught"},{"displayName":"Golden","hostname":"golden.example","junkSuffixRule":{"anchors":[{"offset":0,"origin":"end"}],"version":1},"mode":"taught"},{"displayName":"Plain","hostname":"plain.example","mode":"untaught"}],"suppressions":[{"actionAt":"1970-01-12T13:46:40.000Z","id":"5099E5ED-0000-4000-8000-000000000001","kindRaw":"candidate","nameKey":"the crowned one","statusRaw":"active","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"},{"actionAt":"1970-01-12T13:46:40.000Z","evidence":"promised to guide them home","id":"5099E5ED-0000-4000-8000-000000000002","kindRaw":"fact","nameKey":"grover","sourceEntryID":"22222222-2222-2222-2222-222222222222","sourceKindRaw":"entry","statusRaw":"active","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"}],"titlePatterns":[{"createdAt":"1970-01-12T13:46:40.000Z","definition":{"definition":{"wholeTitle":{}},"trimSuffix":" - Articles Example"},"id":"CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCC2","isActive":false,"siteHostname":"articles.example","version":1},{"createdAt":"1970-01-12T13:46:40.000Z","definition":{"definition":{"wholeTitle":{}},"trimPrefix":"TtH • Story • "},"id":"CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC","isActive":true,"siteHostname":"golden.example","version":1}],"urlRules":[{"createdAt":"1970-01-12T13:46:40.000Z","definition":{"sequence":{"locator":{"query":{"name":"chapter"}}}},"id":"DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD","isCurrent":true,"origin":"readerTaught","siteHostname":"golden.example","version":1}],"workTypes":[{"canonicalID":"D0000001-0000-4000-8000-000000000001","createdAt":"1970-01-12T13:46:40.000Z","id":"00000000-0000-0000-0000-0000000000A1","modifiedAt":"1970-01-12T13:46:40.000Z","name":"novel","stateRaw":"merged"},{"canonicalID":"00000000-0000-0000-0000-0000000000A1","createdAt":"1970-01-12T13:46:40.000Z","id":"00000000-0000-0000-0000-0000000000A2","modifiedAt":"1970-01-12T13:46:40.000Z","name":"novella","stateRaw":"merged"},{"createdAt":"1970-01-01T00:00:00.000Z","id":"D0000001-0000-4000-8000-000000000001","modifiedAt":"1970-01-01T00:00:00.000Z","name":"novel","stateRaw":"active"},{"createdAt":"1970-01-01T00:00:00.000Z","id":"D0000002-0000-4000-8000-000000000002","modifiedAt":"1970-01-01T00:00:00.000Z","name":"webtoon","stateRaw":"active"},{"createdAt":"1970-01-01T00:00:00.000Z","id":"D0000003-0000-4000-8000-000000000003","modifiedAt":"1970-01-01T00:00:00.000Z","name":"article","stateRaw":"active"}],"works":[{"createdAt":"1970-01-12T13:46:40.000Z","displayTitle":"Twice Over","genericNotes":"","genreTags":[],"id":"D0000000-0000-4000-8000-000000000001","modifiedAt":"1970-01-12T13:46:40.000Z","readingStatus":"reading","releaseDays":[],"titleProvenance":"manual","verdict":"","workStatus":"ongoing"},{"createdAt":"1970-01-12T13:46:40.000Z","displayTitle":"Plain Work","genericNotes":"","genreTags":[],"id":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE2","modifiedAt":"1970-01-12T13:46:40.000Z","readingStatus":"finished","releaseDays":[],"seriesID":"5E81E5A0-0000-4000-8000-000000000001","seriesPosition":1,"titleProvenance":"manual","typeName":"novel","verdict":"","workStatus":"finished","workTypeID":"00000000-0000-0000-0000-0000000000A2"},{"createdAt":"1970-01-12T13:46:40.000Z","displayTitle":"An Article","genericNotes":"","genreTags":[],"id":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE3","modifiedAt":"1970-01-12T13:46:40.000Z","readingStatus":"reading","releaseDays":[],"seriesID":"5E81E5A0-0000-4000-8000-000000000009","seriesPosition":4,"titleProvenance":"manual","verdict":"","workStatus":"ongoing"},{"createdAt":"1970-01-12T13:46:40.000Z","displayTitle":"Actual Title","genericNotes":"The guide is not what he seems.","genericNotesExtractionFingerprint":"15b785793033dc26edf6396b3f0e1c27aa1ffaa61043ff49f907a970319a0499","genreTags":["fantasy"],"id":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE","lastParsedTitle":"Actual Title","modifiedAt":"1970-01-12T13:46:40.000Z","readingStatus":"abandoned","releaseDays":["monday","thursday"],"seriesID":"5E81E5A0-0000-4000-8000-000000000001","seriesPosition":2.5,"thumbnail":"/9j/4AAQSkZJRgABAQAASABIAAD/wAARCAOEAlgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9sAQwABAQEBAQECAQECAwICAgMEAwMDAwQGBAQEBAQGBwYGBgYGBgcHBwcHBwcHCAgICAgICQkJCQkLCwsLCwsLCwsL/9sAQwECAgIDAwMFAwMFCwgGCAsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsL/90ABAAm/9oADAMBAAIRAxEAPwD8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9k=","thumbnailShape":"portrait","titleProvenance":"parsed","typeName":"novel","verdict":"Stalled three years in; I gave up waiting.","workStatus":"hiatus","workTypeID":"00000000-0000-0000-0000-0000000000A1"}]},"workCount":4}\ No newline at end of file
Packages/AsterismCore/Tests/AsterismCoreTests/Fixtures/backup-15-16-golden.json Added +1 / -0
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/Fixtures/backup-15-16-golden.json b/Packages/AsterismCore/Tests/AsterismCoreTests/Fixtures/backup-15-16-golden.jsonnew file mode 100644index 00000000..e274f87b--- /dev/null+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/Fixtures/backup-15-16-golden.json@@ -0,0 +1 @@+{"appBuild":"golden","backupFormatVersion":15,"capabilityGate":"multi-site","checksum":"55c847921e26c78f991251486f774da60bc85a062bf44a079b2b38aee907d7c9","databaseSchemaVersion":16,"entryCount":4,"exportedAt":"1970-01-12T13:46:40.000Z","payload":{"characters":[{"aliases":["Klar"],"createdAt":"1970-01-12T13:46:40.000Z","facts":[{"nameKey":"grover","quote":"promised to guide them home","source":{"entryID":"22222222-2222-2222-2222-222222222222","kind":"entry"},"statement":"Promised to guide them home."}],"id":"C4A2ACE0-0000-4000-8000-000000000001","modifiedAt":"1970-01-12T13:46:40.000Z","name":"Grover","nameKey":"grover","note":"The guide.","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"},{"aliases":[],"createdAt":"1970-01-12T13:46:40.000Z","facts":[],"id":"C4A2ACE0-0000-4000-8000-000000000002","modifiedAt":"1970-01-12T13:46:40.000Z","name":"The Stranger","nameKey":"the stranger","note":""}],"creatorRoles":[{"createdAt":"1970-01-01T00:00:00.000Z","id":"E0000001-0000-4000-8000-000000000001","modifiedAt":"1970-01-01T00:00:00.000Z","name":"author","nameModifiedAt":"1970-01-01T00:00:00.000Z","position":0,"positionModifiedAt":"1970-01-01T00:00:00.000Z","stateModifiedAt":"1970-01-01T00:00:00.000Z","stateRaw":"active"},{"createdAt":"1970-01-01T00:00:00.000Z","id":"E0000002-0000-4000-8000-000000000002","modifiedAt":"1970-01-01T00:00:00.000Z","name":"artist","nameModifiedAt":"1970-01-01T00:00:00.000Z","position":1,"positionModifiedAt":"1970-01-01T00:00:00.000Z","stateModifiedAt":"1970-01-01T00:00:00.000Z","stateRaw":"active"},{"createdAt":"1970-01-01T00:00:00.000Z","id":"E0000003-0000-4000-8000-000000000003","modifiedAt":"1970-01-01T00:00:00.000Z","name":"translator","nameModifiedAt":"1970-01-01T00:00:00.000Z","position":2,"positionModifiedAt":"1970-01-01T00:00:00.000Z","stateModifiedAt":"1970-01-01T00:00:00.000Z","stateRaw":"active"},{"createdAt":"1970-01-12T13:46:40.000Z","id":"E0000004-0000-4000-8000-000000000004","modifiedAt":"1970-01-12T13:46:40.000Z","name":"letterer","nameModifiedAt":"1970-01-12T13:46:40.000Z","position":3,"positionModifiedAt":"1970-01-12T13:46:40.000Z","stateModifiedAt":"1970-01-12T13:46:40.000Z","stateRaw":"active"},{"createdAt":"1970-01-12T13:46:40.000Z","id":"E0000005-0000-4000-8000-000000000005","modifiedAt":"1970-01-12T13:46:40.000Z","name":"editor","nameModifiedAt":"1970-01-12T13:46:40.000Z","position":4,"positionModifiedAt":"1970-01-12T13:46:40.000Z","stateModifiedAt":"1970-01-12T13:46:40.000Z","stateRaw":"removed"}],"creators":[{"createdAt":"1970-01-12T13:46:40.000Z","id":"C8EA1080-0000-4000-8000-000000000001","modifiedAt":"1970-01-12T13:46:40.000Z","name":"Mori Ayane","nameModifiedAt":"1970-01-12T13:46:40.000Z","notes":"Also draws.","notesModifiedAt":"1970-01-12T13:46:40.000Z","stateModifiedAt":"1970-01-12T13:46:40.000Z","stateRaw":"active"},{"createdAt":"1970-01-12T13:46:40.000Z","id":"C8EA1080-0000-4000-8000-000000000002","modifiedAt":"1970-01-12T13:46:40.000Z","name":"Studio Lantern","nameModifiedAt":"1970-01-12T13:46:40.000Z","notes":"","notesModifiedAt":"1970-01-12T13:46:40.000Z","stateModifiedAt":"1970-01-12T13:46:40.000Z","stateRaw":"active"},{"canonicalID":"C8EA1080-0000-4000-8000-000000000001","createdAt":"1970-01-12T13:46:40.000Z","id":"C8EA1080-0000-4000-8000-000000000003","modifiedAt":"1970-01-12T13:46:40.000Z","name":"mori ayane","nameModifiedAt":"1970-01-12T13:46:40.000Z","notes":"","notesModifiedAt":"1970-01-12T13:46:40.000Z","stateModifiedAt":"1970-01-12T13:46:40.000Z","stateRaw":"merged"}],"credits":[{"createdAt":"1970-01-12T13:46:40.000Z","creatorID":"C8EA1080-0000-4000-8000-000000000001","id":"C8ED1700-0000-4000-8000-000000000001","modifiedAt":"1970-01-12T13:46:40.000Z","roleIDs":["E0000001-0000-4000-8000-000000000001","E0000005-0000-4000-8000-000000000005"],"workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"},{"createdAt":"1970-01-12T13:46:40.000Z","creatorID":"C8EA1080-0000-4000-8000-000000000002","id":"C8ED1700-0000-4000-8000-000000000002","modifiedAt":"1970-01-12T13:46:40.000Z","roleIDs":["E0000002-0000-4000-8000-000000000002","E000000F-0000-4000-8000-00000000000F"],"workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE2"},{"createdAt":"1970-01-12T13:46:40.000Z","creatorID":"C8EA1080-0000-4000-8000-000000000001","id":"C8ED1700-0000-4000-8000-000000000003","modifiedAt":"1970-01-12T13:46:40.000Z","roleIDs":["E0000001-0000-4000-8000-000000000001"],"workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE9"}],"distinctPairs":[{"higherWorkID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE","id":"88888888-0000-4000-8000-000000000001","lowerWorkID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE2","recordedAt":"1970-01-12T13:46:40.000Z"}],"entries":[{"captureTitle":"TtH • Story • Actual Title","captureTitleSource":"host","chapterSequence":"94","characterExtractionFingerprint":"448c04a700521270a7f5215cd2cfbbe77818591b29899fa94ca100201738f368","citations":{"chapterSequence":{"id":"DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD"},"chapterTitle":{"kind":"none"},"identity":{"composed":{"nameTitle":{"id":"CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC"},"url":{"id":"DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD"}}},"workAssignment":{"pattern":{"_0":{"id":"CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC"}}}},"conservativeIdentityKey":"https://golden.example/read?chapter=94&x=1","entryIdentityKey":"v3|h14:golden.example|n12:Actual Title|s2:94","firstCapturedAt":"1970-01-12T13:46:40.000Z","hostname":"golden.example","id":"22222222-2222-2222-2222-222222222222","identityBasis":"urlRule","intentionallyUnattached":false,"lastSharedAt":"1970-01-12T13:46:40.000Z","modifiedAt":"1970-01-12T13:46:40.000Z","note":"Grover promised to guide them home.","rating":"up","rawURL":"https://golden.example/read?chapter=94&x=1","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"},{"captureTitle":"Plain Work","captureTitleSource":"manual","chapterTitle":"A Plain Chapter","citations":{"chapterTitle":{"kind":"manual"},"identity":{"rawURL":{}},"workAssignment":{"manual":{}}},"conservativeIdentityKey":"https://plain.example/read/7","entryIdentityKey":"https://plain.example/read/7","firstCapturedAt":"1970-01-12T13:46:40.000Z","hostname":"plain.example","id":"22222222-2222-2222-2222-222222222223","identityBasis":"conservative","intentionallyUnattached":false,"lastSharedAt":"1970-01-12T13:46:40.000Z","modifiedAt":"1970-01-12T13:46:40.000Z","note":"","rawURL":"https://plain.example/read/7","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE2"},{"canonicalURL":"https://trimmed.example/posts/hello","captureTitle":"A Standalone - Trimmed Example","captureTitleSource":"host","citations":{"chapterTitle":{"kind":"none"},"identity":{"rawURL":{}},"workAssignment":{"manual":{}}},"conservativeIdentityKey":"https://trimmed.example/posts/hello?utm_source=share","entryIdentityKey":"https://trimmed.example/posts/hello?utm_source=share","firstCapturedAt":"1970-01-12T13:46:40.000Z","hostname":"trimmed.example","id":"22222222-2222-2222-2222-222222222224","identityBasis":"conservative","intentionallyUnattached":false,"lastSharedAt":"1970-01-12T13:46:40.000Z","modifiedAt":"1970-01-12T13:46:40.000Z","note":"","rawURL":"https://trimmed.example/posts/hello?utm_source=share","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE3"},{"captureTitle":"Twice Over","captureTitleSource":"manual","citations":{"chapterTitle":{"kind":"none"},"identity":{"rawURL":{}},"workAssignment":{"manual":{}}},"conservativeIdentityKey":"https://dupe.example/read/1","entryIdentityKey":"https://dupe.example/read/1","firstCapturedAt":"1970-01-12T13:46:40.000Z","hostname":"dupe.example","id":"D0000000-0000-4000-8000-000000000002","identityBasis":"conservative","intentionallyUnattached":false,"lastSharedAt":"1970-01-12T13:46:40.000Z","modifiedAt":"1970-01-12T13:46:40.000Z","note":"","rawURL":"https://dupe.example/read/1","workID":"D0000000-0000-4000-8000-000000000001"}],"links":[{"createdAt":"1970-01-12T13:46:40.000Z","higherWorkID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE","id":"11115E51-0000-4000-8000-000000000001","linkType":"adaptation","lowerWorkID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE3","modifiedAt":"1970-01-12T13:46:40.000Z"},{"createdAt":"1970-01-12T13:46:40.000Z","higherWorkID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE9","id":"11115E51-0000-4000-8000-000000000002","linkType":"spin-off","lowerWorkID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE2","modifiedAt":"1970-01-12T13:46:40.000Z"}],"memberships":[{"createdAt":"1970-01-12T13:46:40.000Z","hostname":"golden.example","id":"77777777-0000-4000-8000-000000000001","urlIdentity":"golden.example/story/actual-title","urlIdentityRuleID":"DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD","urlIdentityState":"rule","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE","workURLString":"https://golden.example/story/actual-title"},{"createdAt":"1970-01-12T13:46:41.000Z","hostname":"plain.example","id":"77777777-0000-4000-8000-000000000002","urlIdentityState":"none","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE","workURLString":"https://plain.example/works/actual-title"},{"createdAt":"1970-01-12T13:46:40.000Z","hostname":"plain.example","id":"77777777-0000-4000-8000-000000000003","urlIdentityState":"none","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE2"},{"createdAt":"1970-01-12T13:46:40.000Z","hostname":"trimmed.example","id":"77777777-0000-4000-8000-000000000004","urlIdentityState":"none","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE3"},{"createdAt":"1970-01-12T13:46:40.000Z","hostname":"plain.example","id":"77777777-0000-4000-8000-000000000005","urlIdentity":"plain.example/absent","urlIdentityState":"legacyUnverified","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE9"},{"createdAt":"1970-01-12T13:46:40.000Z","hostname":"dupe.example","id":"77777777-0000-4000-8000-000000000006","urlIdentityState":"none","workID":"D0000000-0000-4000-8000-000000000001"}],"placeSuppressions":[{"actionAt":"1970-01-12T13:46:40.000Z","id":"5099E5ED-0000-4000-8000-000000000011","kindRaw":"candidate","nameKey":"low road","statusRaw":"active","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"},{"actionAt":"1970-01-12T13:46:40.000Z","evidence":"above the pass","id":"5099E5ED-0000-4000-8000-000000000012","kindRaw":"fact","nameKey":"high keep","sourceEntryID":"22222222-2222-2222-2222-222222222222","sourceKindRaw":"entry","statusRaw":"active","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"}],"places":[{"aliases":["The Keep"],"createdAt":"1970-01-12T13:46:40.000Z","facts":[{"nameKey":"high keep","quote":"above the pass","source":{"entryID":"22222222-2222-2222-2222-222222222222","kind":"entry"},"statement":"Sits above the pass."}],"id":"91ACE000-0000-4000-8000-000000000001","modifiedAt":"1970-01-12T13:46:40.000Z","name":"The High Keep","nameKey":"high keep","note":"The fortress above the pass.","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"},{"aliases":[],"createdAt":"1970-01-12T13:46:40.000Z","facts":[],"id":"91ACE000-0000-4000-8000-000000000002","modifiedAt":"1970-01-12T13:46:40.000Z","name":"The Drowned Road","nameKey":"drowned road","note":"","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE9"}],"series":[{"createdAt":"1970-01-12T13:46:40.000Z","id":"5E81E5A0-0000-4000-8000-000000000001","modifiedAt":"1970-01-12T13:46:40.000Z","name":"Ashfall Cycle","notes":"Read 2.5 after 2."}],"sites":[{"displayName":"Dupe","hostname":"dupe.example","mode":"untaught"},{"displayName":"Golden","hostname":"golden.example","mode":"taught"},{"displayName":"Plain","hostname":"plain.example","mode":"untaught"},{"displayName":"Trimmed","hostname":"trimmed.example","mode":"taught"}],"suppressions":[{"actionAt":"1970-01-12T13:46:40.000Z","id":"5099E5ED-0000-4000-8000-000000000001","kindRaw":"candidate","nameKey":"the crowned one","statusRaw":"active","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"},{"actionAt":"1970-01-12T13:46:40.000Z","evidence":"promised to guide them home","id":"5099E5ED-0000-4000-8000-000000000002","kindRaw":"fact","nameKey":"grover","sourceEntryID":"22222222-2222-2222-2222-222222222222","sourceKindRaw":"entry","statusRaw":"active","workID":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE"}],"titlePatterns":[{"createdAt":"1970-01-12T13:46:40.000Z","definition":{"definition":{"wholeTitle":{}},"trimSuffix":" - Trimmed Example"},"id":"CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCC2","isActive":true,"siteHostname":"trimmed.example","version":1},{"createdAt":"1970-01-12T13:46:40.000Z","definition":{"definition":{"wholeTitle":{}},"trimPrefix":"TtH • Story • "},"id":"CCCCCCCC-CCCC-CCCC-CCCC-CCCCCCCCCCCC","isActive":true,"siteHostname":"golden.example","version":1}],"urlRules":[{"createdAt":"1970-01-12T13:46:40.000Z","definition":{"sequence":{"locator":{"query":{"name":"chapter"}}}},"id":"DDDDDDDD-DDDD-DDDD-DDDD-DDDDDDDDDDDD","isCurrent":true,"origin":"readerTaught","siteHostname":"golden.example","version":1}],"workTypes":[{"canonicalID":"D0000001-0000-4000-8000-000000000001","createdAt":"1970-01-12T13:46:40.000Z","id":"00000000-0000-0000-0000-0000000000A1","modifiedAt":"1970-01-12T13:46:40.000Z","name":"novel","stateRaw":"merged"},{"canonicalID":"00000000-0000-0000-0000-0000000000A1","createdAt":"1970-01-12T13:46:40.000Z","id":"00000000-0000-0000-0000-0000000000A2","modifiedAt":"1970-01-12T13:46:40.000Z","name":"novella","stateRaw":"merged"},{"createdAt":"1970-01-01T00:00:00.000Z","id":"D0000001-0000-4000-8000-000000000001","modifiedAt":"1970-01-01T00:00:00.000Z","name":"novel","stateRaw":"active"},{"createdAt":"1970-01-01T00:00:00.000Z","id":"D0000002-0000-4000-8000-000000000002","modifiedAt":"1970-01-01T00:00:00.000Z","name":"webtoon","stateRaw":"active"}],"works":[{"createdAt":"1970-01-12T13:46:40.000Z","displayTitle":"Twice Over","genericNotes":"","genreTags":[],"id":"D0000000-0000-4000-8000-000000000001","modifiedAt":"1970-01-12T13:46:40.000Z","readingStatus":"reading","releaseDays":[],"titleProvenance":"manual","verdict":"","workStatus":"ongoing"},{"createdAt":"1970-01-12T13:46:40.000Z","displayTitle":"Plain Work","genericNotes":"","genreTags":[],"id":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE2","modifiedAt":"1970-01-12T13:46:40.000Z","readingStatus":"finished","releaseDays":[],"seriesID":"5E81E5A0-0000-4000-8000-000000000001","seriesPosition":1,"titleProvenance":"manual","typeName":"novel","verdict":"","workStatus":"finished","workTypeID":"00000000-0000-0000-0000-0000000000A2"},{"createdAt":"1970-01-12T13:46:40.000Z","displayTitle":"A Standalone","genericNotes":"","genreTags":[],"id":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEE3","modifiedAt":"1970-01-12T13:46:40.000Z","readingStatus":"reading","releaseDays":[],"seriesID":"5E81E5A0-0000-4000-8000-000000000009","seriesPosition":4,"titleProvenance":"manual","verdict":"","workStatus":"ongoing"},{"createdAt":"1970-01-12T13:46:40.000Z","displayTitle":"Actual Title","genericNotes":"The guide is not what he seems.","genericNotesExtractionFingerprint":"15b785793033dc26edf6396b3f0e1c27aa1ffaa61043ff49f907a970319a0499","genreTags":["fantasy"],"id":"EEEEEEEE-EEEE-EEEE-EEEE-EEEEEEEEEEEE","lastParsedTitle":"Actual Title","modifiedAt":"1970-01-12T13:46:40.000Z","readingStatus":"abandoned","releaseDays":["monday","thursday"],"seriesID":"5E81E5A0-0000-4000-8000-000000000001","seriesPosition":2.5,"thumbnail":"/9j/4AAQSkZJRgABAQAASABIAAD/wAARCAOEAlgDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9sAQwABAQEBAQECAQECAwICAgMEAwMDAwQGBAQEBAQGBwYGBgYGBgcHBwcHBwcHCAgICAgICQkJCQkLCwsLCwsLCwsL/9sAQwECAgIDAwMFAwMFCwgGCAsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsLCwsL/90ABAAm/9oADAMBAAIRAxEAPwD8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9D8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9H8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9L8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9P8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9T8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9X8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9b8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9f8p6KKK/pg/HwooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooAKKKKACiiigAooooA/9k=","thumbnailShape":"portrait","titleProvenance":"parsed","typeName":"novel","verdict":"Stalled three years in; I gave up waiting.","workStatus":"hiatus","workTypeID":"00000000-0000-0000-0000-0000000000A1"}]},"workCount":4}\ No newline at end of file
Packages/AsterismCore/Tests/AsterismCoreTests/FrozenLibraryPathTests.swift Modified +41 / -40
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/FrozenLibraryPathTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/FrozenLibraryPathTests.swiftindex 009822d4..2bc94fbb 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/FrozenLibraryPathTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/FrozenLibraryPathTests.swift@@ -74,9 +74,9 @@ struct FrozenLibraryPathTests {     ///     /// The *digit* advances with each marker generation — `configurable-work-types`     /// moved it from `"5"` to `"6"` (Q26), `character-extraction` from `"6"` to-    /// `"7"` (Q80), and it now reads `"15"`, the sixth two-character+    /// `"7"` (Q80), and it now reads `"16"`, the seventh two-character     /// generation. What is frozen is the shape and the filename beside it.-    private static let markerContents = "15\n"+    private static let markerContents = "16\n"      /// Everything a fresh app-role open is allowed to leave in the root, SQLite's     /// own `-wal`/`-shm` companions excluded. An extra entry here is a path@@ -279,18 +279,18 @@ struct FrozenLibraryPathTests {     /// name here — see the rule in the suite's doc comment.     @Test("No declared identifier carries a version number it does not describe")     func noIdentifierNamesAVersionItDoesNotDescribe() throws {-        /// The store schemas this package declares — V15 live, V14 frozen as+        /// The store schemas this package declares — V16 live, V15 frozen as         /// the `from` version of the one lightweight stage — the plan that         /// stages it, and the floor the recorded-version reading refuses below.         ///-        /// V5 through V13 went with the stages that named them,+        /// V5 through V14 went with the stages that named them,         /// each on `retire-migration-chain` Decision 6's population precondition         /// (Q2 of `drop-superseded-columns`, Q18 of `work-and-reading-status`,         /// Q60 of `series-and-related-works`, Q15 of `work-creators`, Q48 of-        /// `place-extraction`, `work-thumbnails` for V12 and `update-schedule`-        /// for V13). V9+        /// `place-extraction`, `work-thumbnails` for V12, `update-schedule`+        /// for V13 and `remove-article-mode` for V14). V9         /// shipped in that feature's phase 1 with its stage retained (Q32) and-        /// went in the follow-up; V10 through V13 each went in the freeze+        /// went in the follow-up; V10 through V14 each went in the freeze         /// commit of the bump that superseded them, the owner having confirmed         /// the population before it ran.         ///@@ -302,18 +302,18 @@ struct FrozenLibraryPathTests {         /// both deliberately unversioned by name because they always mean the         /// current generation.         let declaresAStoreSchemaOrMarkerGeneration: Set<String> = [-            "AsterismSchemaV14", "AsterismSchemaV15",-            "AsterismV15MigrationPlan",+            "AsterismSchemaV15", "AsterismSchemaV16",+            "AsterismV16MigrationPlan",             "atOrAboveV5", "belowV5", "firstV5Major",         ]-        /// The archive format — 14/15, the one shape the app reads and writes,+        /// The archive format — 15/16, the one shape the app reads and writes,         /// plus the 2/2 URL-rule origin the store still names. These name a         /// serialization version, not a store schema, and they are accurate:-        /// `update-schedule` Req 8.1 mints format 14 over schema 15,+        /// `remove-article-mode` Req 5.1 mints format 15 over schema 16,         /// and every record this generation carries is its own rather than one         /// an earlier generation froze.         ///-        /// Every earlier generation's **read and write path** is gone, 13/14+        /// Every earlier generation's **read and write path** is gone, 14/15         /// included, so every name that described one — the codecs, documents,         /// payloads, exporters, snapshot protocols, reference and shape         /// validators, per-generation planners, gates and materializers — is@@ -325,22 +325,22 @@ struct FrozenLibraryPathTests {         /// single format, and a digit in their names would be a digit describing         /// nothing.         let namesTheArchiveFormat: Set<String> = [-            "BackupV14Entry", "BackupV14Site", "BackupV14TitlePattern", "BackupV14URLRule",-            "BackupV14Work", "BackupV14WorkType", "BackupV14Membership", "BackupV14DistinctPair",-            "BackupV14Character", "BackupV14Codec", "BackupV14Series", "BackupV14Link",-            "BackupV14Document", "BackupV14ExportError", "BackupV14Exporter", "BackupV14Metadata",-            "BackupV14Payload", "BackupV14ReferenceValidator",-            "BackupV14SnapshotProviding", "BackupV14Suppression",-            "BackupV14Creator", "BackupV14CreatorRole", "BackupV14Credit",-            "BackupV14Place", "BackupV14PlaceSuppression",-            "backupV14Snapshot",+            "BackupV15Entry", "BackupV15Site", "BackupV15TitlePattern", "BackupV15URLRule",+            "BackupV15Work", "BackupV15WorkType", "BackupV15Membership", "BackupV15DistinctPair",+            "BackupV15Character", "BackupV15Codec", "BackupV15Series", "BackupV15Link",+            "BackupV15Document", "BackupV15ExportError", "BackupV15Exporter", "BackupV15Metadata",+            "BackupV15Payload", "BackupV15ReferenceValidator",+            "BackupV15SnapshotProviding", "BackupV15Suppression",+            "BackupV15Creator", "BackupV15CreatorRole", "BackupV15Credit",+            "BackupV15Place", "BackupV15PlaceSuppression",+            "backupV15Snapshot",             "importedV2", "importedV2Path",-            "mapV14EntryRecord", "mapV14SiteRecord", "mapV14TitlePatternRecord",-            "mapV14URLRuleRecord", "mapV14WorkRecord",-            "mapV14CharacterRecord", "mapV14SuppressionRecord",-            "mapV14PlaceRecord", "mapV14PlaceSuppressionRecord",-            "mapV14CreatorRecords", "mapV14CreatorRoleRecords",-            "projectV14Payload",+            "mapV15EntryRecord", "mapV15SiteRecord", "mapV15TitlePatternRecord",+            "mapV15URLRuleRecord", "mapV15WorkRecord",+            "mapV15CharacterRecord", "mapV15SuppressionRecord",+            "mapV15PlaceRecord", "mapV15PlaceSuppressionRecord",+            "mapV15CreatorRecords", "mapV15CreatorRoleRecords",+            "projectV15Payload",         ]         /// The Entry identity-key generation, `EntryIdentityKeyV2Codec` /         /// `V3Codec`. A v2 key and a v3 key are different encodings of the same@@ -390,30 +390,31 @@ struct FrozenLibraryPathTests {         }         #expect(             declared.sorted() == [-                "AsterismSchemaV14", "AsterismSchemaV15",+                "AsterismSchemaV15", "AsterismSchemaV16",             ],             "the package declares versioned schemas \(declared); Req 3.3 allows only ones a plan references") -        let referenced = AsterismV15MigrationPlan.schemas.map { String(describing: $0) }+        let referenced = AsterismV16MigrationPlan.schemas.map { String(describing: $0) }         #expect(-            referenced == ["AsterismSchemaV14", "AsterismSchemaV15"],+            referenced == ["AsterismSchemaV15", "AsterismSchemaV16"],             "the plan references \(referenced), which is not the set of declared schemas")-        // One lightweight stage, and it purely **adds**: V14 → V15 adds one-        // defaulted `Work` column inside `ModelContainer.init` and no table at-        // all, with no data pass behind it. The V8 stage retired with the+        // One lightweight stage, and it purely **removes**: V15 → V16 drops+        // one `Site` column inside `ModelContainer.init` and no table at all,+        // with no data pass behind it. It is the second removing stage in the+        // project's history, after V8 → V9. The V8 stage retired with the         // snapshot it named (Q18); the V9 one shipped retained (Q32 of         // `series-and-related-works`) and went in the follow-up (Q60); the V10-        // through V13 ones each went in the freeze commit of the bump that+        // through V14 ones each went in the freeze commit of the bump that         // superseded them (Q15 of `work-creators`, Q65 of `place-extraction`,-        // `work-thumbnails`, and this bump).+        // `work-thumbnails`, `update-schedule`, and this bump).         #expect(-            AsterismV15MigrationPlan.stages.count == 1,-            "the plan stages \(AsterismV15MigrationPlan.stages.count) migrations; V14 → V15 is one")-        #expect(-            AsterismSchemaV14.versionIdentifier == Schema.Version(14, 0, 0),-            "the frozen snapshot's version stamp is the `from` side every V14 store is matched on")+            AsterismV16MigrationPlan.stages.count == 1,+            "the plan stages \(AsterismV16MigrationPlan.stages.count) migrations; V15 → V16 is one")         #expect(             AsterismSchemaV15.versionIdentifier == Schema.Version(15, 0, 0),+            "the frozen snapshot's version stamp is the `from` side every V15 store is matched on")+        #expect(+            AsterismSchemaV16.versionIdentifier == Schema.Version(16, 0, 0),             "the live schema's version stamp is what every recorded store is compared against")     } 
Packages/AsterismCore/Tests/AsterismCoreTests/GroupBulkWriteTests.swift Modified +2 / -36
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/GroupBulkWriteTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/GroupBulkWriteTests.swiftindex 30781be1..94496356 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/GroupBulkWriteTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/GroupBulkWriteTests.swift@@ -4,8 +4,8 @@ import Testing  @testable import AsterismCore -/// The bulk write paths — import upsert, re-parse, composed teaching, the-/// Articles and Contracts appliers — against split identity groups.+/// The bulk write paths — import upsert, re-parse, composed teaching and the+/// Contracts applier — against split identity groups. /// /// They all resolved one row per application UUID and wrote to it, which /// under-writes a split group: the twin keeps the old derived values, so the@@ -244,38 +244,4 @@ struct GroupBulkWriteTests {         // curate.         #expect(Set(rows.map(\.note)) == ["device one", "device two"])     }--    @Test("Articles mode clears derived fields on every row of a split group")-    func articlesFansOut() async throws {-        let library = try WriteFixture()-        let shared = UUID()-        try library.seed { store in-            let site = store.insertSite(hostname: "dup.example")-            site.mode = .taught-            _ = try store.insertTitlePattern(site: site, isActive: true)-            let work = store.insertWork(-                hostname: "dup.example", title: "A Serial", offset: 0)-            for offset in [TimeInterval(0), 30] {-                let row = store.insertEntry(-                    id: shared, hostname: "dup.example", title: "A Serial - Chapter 1",-                    offset: offset)-                row.work = work-                row.chapterTitle = "Chapter 1"-            }-        }-        let repository = try await library.openForApp()--        let contract = try await repository.projectArticles(-            hostname: "dup.example", junkSuffixRule: nil)-        let outcome = try await repository.commitArticles(contract)--        guard case .committed = outcome else {-            Issue.record("expected a committed outcome, got \(outcome)")-            return-        }-        let rows = try library.entryRows(id: shared)-        #expect(rows.count == 2)-        #expect(rows.allSatisfy { $0.work == nil })-        #expect(rows.allSatisfy { $0.intentionallyUnattached })-    } }
Packages/AsterismCore/Tests/AsterismCoreTests/GroupFetchTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/GroupFetchTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/GroupFetchTests.swiftindex 17cfb205..fb93602b 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/GroupFetchTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/GroupFetchTests.swift@@ -260,12 +260,12 @@ private final class GroupStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismGroupFetch-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         context = ModelContext(container)     }
Packages/AsterismCore/Tests/AsterismCoreTests/GroupOrderingTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/GroupOrderingTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/GroupOrderingTests.swiftindex 172cc1b1..9b127e87 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/GroupOrderingTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/GroupOrderingTests.swift@@ -908,12 +908,12 @@ private final class OrderingStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismGroupOrdering-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         context = ModelContext(container)     }
Packages/AsterismCore/Tests/AsterismCoreTests/HeldStoreLock.swift Modified +1 / -1
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/HeldStoreLock.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/HeldStoreLock.swiftindex 27118bde..7e0de365 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/HeldStoreLock.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/HeldStoreLock.swift@@ -9,7 +9,7 @@ import SQLite3 /// its SQLite connection synchronously. The close follows on its own, takes the /// exclusive lock while it checkpoints, and any raw connection that reads inside /// that window is answered `SQLITE_BUSY` — "database is locked". Measured on this-/// repository (2026-09-19): straight after `V14RecordedStoreFixture.install` the+/// repository (2026-09-19): straight after `V15RecordedStoreFixture.install` the /// first read failed with code 5 beside a 168,952-byte log, and the same read /// succeeded 3.8 ms later beside an empty one. A window that short cannot be hit /// on purpose, so the regressions hold the same lock themselves.
Packages/AsterismCore/Tests/AsterismCoreTests/IdentityResolutionTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/IdentityResolutionTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/IdentityResolutionTests.swiftindex baa12438..8e0b9c71 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/IdentityResolutionTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/IdentityResolutionTests.swift@@ -284,12 +284,12 @@ private final class ResolutionStore {     }      private static func makeContainer(at directory: URL) throws -> ModelContainer {-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         return try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])     } 
Packages/AsterismCore/Tests/AsterismCoreTests/LibraryGraphBaselineTests.swift Modified +23 / -33
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryGraphBaselineTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryGraphBaselineTests.swiftindex fc9fc3d6..bd48948a 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryGraphBaselineTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryGraphBaselineTests.swift@@ -149,7 +149,6 @@ enum BaselineSeed {      static let alphaHost = "alpha.test"     static let betaHost = "beta.test"-    static let gammaHost = "gamma.test"     /// A hostname with no `Site` row, so one Entry's `site` edge is nil — the one     /// state Req 2.1 permits a certified library to hold.     static let orphanHost = "orphan.test"@@ -167,15 +166,14 @@ enum BaselineSeed {     static let alphaEntryID = UUID(uuidString: "B1000000-0000-4000-8000-000000000011")!     static let betaManualEntryID = UUID(uuidString: "B2000000-0000-4000-8000-000000000012")!     static let betaPatternEntryID = UUID(uuidString: "B3000000-0000-4000-8000-000000000013")!-    static let gammaEntryID = UUID(uuidString: "B4000000-0000-4000-8000-000000000014")!     static let orphanEntryID = UUID(uuidString: "B5000000-0000-4000-8000-000000000015")!      static let expectedCounts = LibraryRecordCounts(-        entries: 5, works: 1, sites: 3, titlePatterns: 1, urlRulePatterns: 1,+        entries: 4, works: 1, sites: 2, titlePatterns: 1, urlRulePatterns: 1,         workTypes: WorkTypeSeeding.seeds.count)      /// V6's sixth entity. The graph seed writes none — the baseline graph-    /// predates the type list — but every app-role open mints the three defaults+    /// predates the type list — but every app-role open mints the defaults     /// (`configurable-work-types` Q25), so this is what the section holds. The     /// rows are deterministic by construction: frozen identifiers and epoch     /// timestamps (Decision 9), which is why they can sit in a hand-maintained@@ -185,11 +183,10 @@ enum BaselineSeed {  extension LibraryRepository { -    /// Writes the baseline graph in one save: three Sites in the three modes, a-    /// taught Site's active title rule and current URL rule, one Work, and five-    /// Entries covering an attached Entry, a pattern-cited chapter, an articles-    /// Site's intentionally unattached Entry, and an Entry whose Site row is-    /// absent.+    /// Writes the baseline graph in one save: two Sites in the two modes, a+    /// taught Site's active title rule and current URL rule, one Work, and four+    /// Entries covering an attached Entry, a pattern-cited chapter, and an Entry+    /// whose Site row is absent.     ///     /// Rows are written straight into a locked context rather than through the     /// capture path: the capture path derives identity keys and timestamps from@@ -227,12 +224,6 @@ extension LibraryRepository {             context.insert(rule)             beta.urlRules = [rule] -            let gamma = Site(hostname: BaselineSeed.gammaHost, displayName: "Gamma Articles")-            gamma.mode = .articles-            gamma.junkSuffixRule = try JunkSuffixRule(-                version: 1, anchors: [try SegmentPositionSpec(origin: .end, offset: 0)])-            context.insert(gamma)-             let work = Work.create(                 in: context, id: BaselineSeed.workID, membershipID: BaselineSeed.membershipID,                 title: "Beta Serial", hostname: BaselineSeed.betaHost, site: beta,@@ -281,14 +272,6 @@ extension LibraryRepository {                     kind: .pattern, patternID: pattern.id)             } -            // An articles Site's Entries are unattached on purpose (Req 2.1's-            // tuple table pairs `.none` assignment with `intentionallyUnattached`-            // exactly where the Site is in articles mode).-            let article = entry(-                id: BaselineSeed.gammaEntryID, title: "A Gamma Article",-                hostname: BaselineSeed.gammaHost, path: "posts/1", site: gamma)-            article.intentionallyUnattached = true-             _ = entry(                 id: BaselineSeed.orphanEntryID, title: "An Orphaned Capture",                 hostname: BaselineSeed.orphanHost, path: "read/1", site: nil)@@ -417,7 +400,23 @@ enum LibraryGraphSerializer {             "# reads as having no schedule. Re-recorded by adding that one field",             "# to each work line and reviewing the diff line by line (Q40), not",             "# by regenerating the file.",-            "format 12",+            "# format 12's *content* changed with remove-article-mode's first",+            "# commit, before its shape did: the seed's third Site was the",+            "# articles one, and the mode is gone, so that Site, its one Entry",+            "# and its inverse line went with it, and the retired `article`",+            "# default left the work-type section.",+            "# format 13 is schema V16 (remove-article-mode, T-2336): every site",+            "# line loses junkSuffixRule, and no section is added or removed —",+            "# V16 is the second stage in the project's history to remove",+            "# anything, after V8 -> V9, and the first to remove a column",+            "# without adding one. Every field the seed carried read nil here",+            "# already, so the absence of the field rather than a changed value",+            "# is the whole diff, which is the point: the V15 -> V16 stage takes",+            "# the column and leaves every existing row otherwise as it found",+            "# it. Hand-edited by deleting that one field from each site line",+            "# and reviewing the diff line by line (Req 7.4), not by",+            "# regenerating the file.",+            "format 13",             "counts entries=\(entries.count) works=\(works.count) sites=\(sites.count) "                 + "titlePatterns=\(patterns.count) urlRulePatterns=\(rules.count) "                 + "workTypes=\(workTypes.count) memberships=\(memberships.count) "@@ -433,7 +432,6 @@ enum LibraryGraphSerializer {                     ("hostname", quoted(site.hostname)),                     ("displayName", quoted(site.displayName)),                     ("modeRaw", quoted(site.modeRaw)),-                    ("junkSuffixRule", json(site.junkSuffixRule)),                 ]))         } @@ -756,14 +754,6 @@ enum LibraryGraphSerializer {         String(format: "%.3f", date.timeIntervalSince1970)     } -    private static func json<Value: Encodable>(_ value: Value?) -> String {-        guard let value else { return "nil" }-        let encoder = JSONEncoder()-        encoder.outputFormatting = [.sortedKeys, .withoutEscapingSlashes]-        guard let data = try? encoder.encode(value) else { return "<unencodable>" }-        return quoted(text(data))-    }-     private static func text(_ data: Data) -> String {         String(data: data, encoding: .utf8) ?? data.base64EncodedString()     }
Packages/AsterismCore/Tests/AsterismCoreTests/LibraryToleranceScanTests.swift Modified +6 / -5
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryToleranceScanTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryToleranceScanTests.swiftindex 6bd0e3c0..9dee9f66 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryToleranceScanTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryToleranceScanTests.swift@@ -208,9 +208,10 @@ struct LibraryToleranceScanTests {         let store = try ToleranceScanStore()         let site = store.insertSite(hostname: "illegal.example")         site.mode = .taught  // taught with zero active title rules: an illegal tuple-        let articles = store.insertSite(hostname: "articles.example")-        articles.mode = .articles-        try store.insertTitlePattern(site: articles, isActive: true)  // illegal for .articles+        let untaughtWithRules = store.insertSite(hostname: "retaining.example")+        untaughtWithRules.mode = .untaught+        // Illegal for `.untaught`, which may hold no title rule at all.+        try store.insertTitlePattern(site: untaughtWithRules, isActive: true)         store.insertEntry(hostname: "illegal.example")         try store.save() @@ -367,12 +368,12 @@ private final class ToleranceScanStore {     }      private static func makeContainer(at directory: URL) throws -> ModelContainer {-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         return try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])     } 
Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorNilSiteToleranceTests.swift Modified +1 / -1
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorNilSiteToleranceTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorNilSiteToleranceTests.swiftindex c90b3b26..1fac2492 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorNilSiteToleranceTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorNilSiteToleranceTests.swift@@ -318,7 +318,7 @@ struct LibraryValidatorNilSiteToleranceTests {          #expect(throws: LibraryValidationError.self) {             try LibraryValidator.validateEntryTuple(-                entry: fixture.entry, site: fixture.site, works: [fixture.work])+                entry: fixture.entry, works: [fixture.work])         }     } }
Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorTests.swift Modified +42 / -15
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorTests.swiftindex 533c943b..ec590a68 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorTests.swift@@ -19,7 +19,6 @@ struct LibraryValidatorTests {             try ValidatorFixtures.wholeTitleSequence().graph,  // taught W + S (v3)             try ValidatorFixtures.wholeTitleUnsettled(),  // taught W + none (conservative, unsettled)             try ValidatorFixtures.untaughtImportedHistory(),-            try ValidatorFixtures.articles(),         ] {             #expect(try LibraryValidator.validateStrict(graph: graph).isEmpty)         }@@ -33,9 +32,8 @@ struct LibraryValidatorTests {     /// here directly rather than inferred from either of them.     ///     /// Note what the table does **not** mention: `Site.junkSuffixRule`. The-    /// validator never reads that column — the "a junk rule belongs only to-    /// `.articles`" clause lives in `LibraryRepository.validatedRecentSiteMode`,-    /// and the import enforces it as its own rule.+    /// validator never reads that column, and since `remove-article-mode`+    /// nothing else does either — it is dropped in V16.     @Test("The Site tuple table answers every mode against every rule combination")     func siteTupleTable() throws {         let timestamp = Date(timeIntervalSince1970: 1000)@@ -56,11 +54,6 @@ struct LibraryValidatorTests {             (.taught, [activePattern], [], true),             (.taught, [], [currentRule], false),             (.taught, [activePattern], [currentRule], true),-            // Articles: no active title rule and no current URL rule.-            (.articles, [], [], true),-            (.articles, [activePattern], [], false),-            (.articles, [], [currentRule], false),-            (.articles, [activePattern], [currentRule], false),         ]         for row in table {             let label: Comment = """@@ -74,10 +67,9 @@ struct LibraryValidatorTests {         }     } -    /// The three clauses the four-way table cannot reach: an untaught row may-    /// retain imported-V2 URL history and only that, an articles row may retain-    /// historical rules of any origin, and "exactly one active title rule"-    /// counts identity groups rather than rows (Decision 15).+    /// The two clauses the four-way table cannot reach: an untaught row may+    /// retain imported-V2 URL history and only that, and "exactly one active+    /// title rule" counts identity groups rather than rows (Decision 15).     @Test("Retained URL history and converged rule groups are legal tuples")     func siteTupleRetainedHistoryAndGroupCounting() throws {         let timestamp = Date(timeIntervalSince1970: 1000)@@ -92,8 +84,6 @@ struct LibraryValidatorTests {             LibraryValidator.siteTupleIsLegal(.untaught, patterns: [], urlRules: [importedHistory]))         #expect(             !LibraryValidator.siteTupleIsLegal(.untaught, patterns: [], urlRules: [taughtHistory]))-        #expect(-            LibraryValidator.siteTupleIsLegal(.articles, patterns: [], urlRules: [taughtHistory]))          // One rule materialised twice — a converged CloudKit group, not two         // teachings — is still one active title rule.@@ -314,6 +304,43 @@ struct LibraryValidatorTests {                 "bytes decoding to `.none` beside a Work are a partial write, not upgrade residue")     } +    // MARK: - The unattachment flag (`remove-article-mode` Req 3.3)++    /// The invariant the mode's removal leaves standing on its own: a `none`+    /// assignment is a capture that has not been decided about, so it may not+    /// claim a deliberate unattachment. Articles mode was the one exception,+    /// and the exception is what went (Q6).+    @Test(+        "A none assignment carrying the unattachment flag is diagnosed in either mode",+        arguments: [SiteMode.untaught, .taught])+    func noneAssignmentRefusesTheUnattachmentFlag(mode: SiteMode) throws {+        let flagged = try ValidatorFixtures.workLessEntry(+            mode: mode, manualAssignment: false, intentionallyUnattached: true)+        let hostname = try #require(flagged.sites.first).hostname+        #expect(try LibraryValidator.validateStrict(graph: flagged)[hostname] != nil)++        let unflagged = try ValidatorFixtures.workLessEntry(+            mode: mode, manualAssignment: false, intentionallyUnattached: false)+        #expect(try LibraryValidator.validateStrict(graph: unflagged).isEmpty)+    }++    /// The reader's own "leave unattached": manual provenance, no Work, flag+    /// set. This is the only legal way to hold the flag, and it is legal in+    /// both modes.+    @Test(+        "A manual assignment with no Work requires the unattachment flag",+        arguments: [SiteMode.untaught, .taught])+    func manualAssignmentWithNoWorkCarriesTheFlag(mode: SiteMode) throws {+        let flagged = try ValidatorFixtures.workLessEntry(+            mode: mode, manualAssignment: true, intentionallyUnattached: true)+        #expect(try LibraryValidator.validateStrict(graph: flagged).isEmpty)++        let unflagged = try ValidatorFixtures.workLessEntry(+            mode: mode, manualAssignment: true, intentionallyUnattached: false)+        let hostname = try #require(unflagged.sites.first).hostname+        #expect(try LibraryValidator.validateStrict(graph: unflagged)[hostname] != nil)+    }+     // MARK: - Per-Site scoping      @Test("An illegal Site is diagnosed while unrelated Sites stay clean")
Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorToleranceTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorToleranceTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorToleranceTests.swiftindex b492d13a..511d7e9f 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorToleranceTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/LibraryValidatorToleranceTests.swift@@ -447,12 +447,12 @@ private final class ValidatorStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismValidatorTolerance-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         context = ModelContext(container)     }
Packages/AsterismCore/Tests/AsterismCoreTests/LookupFirstCaptureStateTests.swift Modified +1 / -1
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/LookupFirstCaptureStateTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/LookupFirstCaptureStateTests.swiftindex 763292f7..6290804e 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/LookupFirstCaptureStateTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/LookupFirstCaptureStateTests.swift@@ -357,7 +357,7 @@ private struct LookupCaptureFixture {         _ seed: (ModelContext, String) -> Void     ) throws -> LookupCaptureFixture {         let url = "https://example.com/chapter-1"-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let container = try ModelContainer(             for: schema,             configurations: [
Packages/AsterismCore/Tests/AsterismCoreTests/M4BulkChunkPerformanceTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/M4BulkChunkPerformanceTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/M4BulkChunkPerformanceTests.swiftindex b52fc931..469ee2d9 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/M4BulkChunkPerformanceTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/M4BulkChunkPerformanceTests.swift@@ -140,7 +140,7 @@ struct M4BulkChunkPerformanceTests { /// hostname, every one of them carrying the Site relationship whose assignment /// is the cost being measured. private enum M4ChunkFixture {-    static func exportedFixturePayload() async throws -> BackupV14Payload {+    static func exportedFixturePayload() async throws -> BackupV15Payload {         let root = FileManager.default.temporaryDirectory             .appending(                 path: "asterism-m4-chunk-source-\(UUID().uuidString)", directoryHint: .isDirectory)@@ -154,7 +154,7 @@ private enum M4ChunkFixture {         let repository = LibraryRepository.makeRepository(             configuration, container, .m4, SystemRepositoryClock(), ModelContextSaveStrategy())         try await repository.seedM4PerformanceFixture()-        let payload = try await repository.backupV14Snapshot()+        let payload = try await repository.backupV15Snapshot()         withExtendedLifetime(container) {}         return payload     }
Packages/AsterismCore/Tests/AsterismCoreTests/M4DuplicateScalePerformanceTests.swift Modified +6 / -6
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/M4DuplicateScalePerformanceTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/M4DuplicateScalePerformanceTests.swiftindex 1fcd9a19..ca72a3d4 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/M4DuplicateScalePerformanceTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/M4DuplicateScalePerformanceTests.swift@@ -274,7 +274,7 @@ struct M4DuplicateScalePerformanceTests {     /// records what the projection alone costs so the claim is a reading rather     /// than an argument.     ///-    /// The *projection* is timed, not `BackupV14Exporter.export`: the encode,+    /// The *projection* is timed, not `BackupV15Exporter.export`: the encode,     /// the decode-validation and the file write dominate and none of them     /// changed.     @Test("Backup projection over a duplicate-free library (Q116, informational)")@@ -283,7 +283,7 @@ struct M4DuplicateScalePerformanceTests {         let repository = try await store.openApp()          let measured = try await measureDistributionAsync(iterations: 5) {-            _ = try await repository.backupV14Snapshot()+            _ = try await repository.backupV15Snapshot()         }         reportPerformance("backup-projection-duplicate-free", measured)     }@@ -342,7 +342,7 @@ struct M4DuplicateScalePerformanceTests {             .appending(                 path: "asterism-m4-cover-export-\(UUID().uuidString)", directoryHint: .isDirectory)         defer { try? FileManager.default.removeItem(at: staging) }-        let exporter = BackupV14Exporter(repository: repository, stagingDirectory: staging)+        let exporter = BackupV15Exporter(repository: repository, stagingDirectory: staging)         // The same settle its sibling takes, and for the same reason: the store         // open above allocates, `measurePeakResident` reads its baseline the         // moment the block starts, and a baseline read over the open's own@@ -353,7 +353,7 @@ struct M4DuplicateScalePerformanceTests {          let (result, peak, duration) = try await measurePeakResident {             try await exporter.export(-                metadata: BackupV14Metadata(appBuild: "m4-performance", exportedAt: Date()))+                metadata: BackupV15Metadata(appBuild: "m4-performance", exportedAt: Date()))         }         let size = try Self.fileSize(of: result.fileURL) @@ -516,9 +516,9 @@ struct M4DuplicateScalePerformanceTests {     ) async throws -> (fileURL: URL, size: Int) {         let source = try await M4DuplicatePerformanceStore(state: nil)         let repository = try await source.openApp()-        let exported = try await BackupV14Exporter(+        let exported = try await BackupV15Exporter(             repository: repository, stagingDirectory: staging-        ).export(metadata: BackupV14Metadata(appBuild: "m4-performance", exportedAt: Date()))+        ).export(metadata: BackupV15Metadata(appBuild: "m4-performance", exportedAt: Date()))         await repository.shutdown()         return (exported.fileURL, try fileSize(of: exported.fileURL))     }
Packages/AsterismCore/Tests/AsterismCoreTests/M5RepositoryTestSupport.swift Modified +1 / -10
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/M5RepositoryTestSupport.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/M5RepositoryTestSupport.swiftindex a01d87cf..61ad8544 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/M5RepositoryTestSupport.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/M5RepositoryTestSupport.swift@@ -19,9 +19,6 @@ struct M5SeedSite: Sendable {     var hostname: String     var displayName: String?     var mode: SiteMode = .untaught-    /// A junk-suffix rule derived from this example, for an articles Site.-    var junkExample: String?-    var junkSuffixSegments: Int = 1     /// A whole-title (Work-only) active pattern with these trims, for a taught Site.     var wholeTitleRule: Bool = false     var trimPrefix: String?@@ -29,14 +26,12 @@ struct M5SeedSite: Sendable {      init(         hostname: String, displayName: String? = nil, mode: SiteMode = .untaught,-        junkExample: String? = nil, junkSuffixSegments: Int = 1, wholeTitleRule: Bool = false,+        wholeTitleRule: Bool = false,         trimPrefix: String? = nil, trimSuffix: String? = nil     ) {         self.hostname = hostname         self.displayName = displayName         self.mode = mode-        self.junkExample = junkExample-        self.junkSuffixSegments = junkSuffixSegments         self.wholeTitleRule = wholeTitleRule         self.trimPrefix = trimPrefix         self.trimSuffix = trimSuffix@@ -457,10 +452,6 @@ extension LibraryRepository {             for seed in sites {                 let site = Site(hostname: seed.hostname, displayName: seed.displayName)                 site.mode = seed.mode-                if let example = seed.junkExample {-                    site.junkSuffixRule = try ArticleTitleCleaner.deriveRule(-                        from: example, suffixSegmentCount: seed.junkSuffixSegments)-                }                 context.insert(site)                 if seed.wholeTitleRule {                     let pattern = try TitlePattern(
Packages/AsterismCore/Tests/AsterismCoreTests/MarkerContractTests.swift Modified +35 / -34
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/MarkerContractTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/MarkerContractTests.swiftindex 99d8ef21..b90ff315 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/MarkerContractTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/MarkerContractTests.swift@@ -12,18 +12,19 @@ import Testing /// constructs a container. /// /// **The app opens two generations and the extension one.**-/// `update-schedule` publishes `"15"` and holds `"14"` in-/// `appOpenableMarkerVersions` as the generation V15 upgrades from (Req 9.2):-/// the app opens it — the lightweight stage adds one defaulted `Work` column-/// and no table at all inside `ModelContainer.init` — validates the store and-/// republishes at `"15"`, with no data pass and no reconciler. The extension-/// refuses `"14"` outright, because it holds only a shared lock and must never-/// convert or write. `"4"`–`"13"` stay retired (`data-model-cleanups`+/// `remove-article-mode` publishes `"16"` and holds `"15"` in+/// `appOpenableMarkerVersions` as the generation V16 upgrades from (Req 4.4):+/// the app opens it — the lightweight stage drops one `Site` column and no+/// table at all inside `ModelContainer.init` — validates the store and+/// republishes at `"16"`, with no data pass and no reconciler. The extension+/// refuses `"15"` outright, because it holds only a shared lock and must never+/// convert or write — which matters more for a *removing* stage than it did for+/// the adding ones. `"4"`–`"14"` stay retired (`data-model-cleanups` /// Decision 2, Q2 of `drop-superseded-columns` for `"7"`, Q18 of /// `work-and-reading-status` for `"8"`, Q32 of `series-and-related-works` for /// `"9"`, Q15 of `work-creators` for `"10"`, Q48 of `place-extraction` for-/// `"11"`, `work-thumbnails` for `"12"` and this bump for `"13"`) and are-/// refused by both.+/// `"11"`, `work-thumbnails` for `"12"`, `update-schedule` for `"13"` and this+/// bump for `"14"`) and are refused by both. /// /// The extension's refusal therefore **forks** (Req 2.3), as it did before /// Decision 2 collapsed it: a generation the app opens is resolvable by opening@@ -54,7 +55,7 @@ struct MarkerContractTests {      /// A first run: creates an empty store and marks it ready at birth. An     /// empty store has nothing to migrate, so mark-at-birth certifies it at-    /// `"15"` directly (Q26).+    /// `"16"` directly (Q26).     private func makeReadyLibrary(_ configuration: LibraryConfiguration) async throws {         _ = try await LibraryRepository.openForApp(configuration)     }@@ -93,41 +94,41 @@ struct MarkerContractTests {      // MARK: - App side accepts one generation -    @Test("The app opens a library marked \"15\"")+    @Test("The app opens a library marked \"16\"")     func appAcceptsTheCurrentMarkerVersion() async throws {         let (_, cfg) = try config()         try await makeReadyLibrary(cfg)-        #expect(try markerContent(cfg) == "15",+        #expect(try markerContent(cfg) == "16",                 "an empty store has nothing to bring forward, so it is certified at birth (Q26)")          let (current, _) = try await LibraryRepository.openForApp(cfg)         #expect(current == .ready(.seededEmpty), "a certified library opens in the app")-        #expect(try markerContent(cfg) == "15", "and the open leaves the marker as it found it")+        #expect(try markerContent(cfg) == "16", "and the open leaves the marker as it found it")     } -    /// Req 9.2: the previous generation is *opened*, not refused — the stage-    /// adds one defaulted `Work` column on the way in, and the app republishes+    /// Req 4.4: the previous generation is *opened*, not refused — the stage+    /// drops one `Site` column on the way in, and the app republishes     /// at the current generation once the store has validated.-    @Test("The app opens a library marked \"14\" and republishes it at \"15\"")+    @Test("The app opens a library marked \"15\" and republishes it at \"16\"")     func appUpgradesTheLaggingGeneration() async throws {         let (_, cfg) = try config()         try await makeReadyLibrary(cfg)-        try writeMarker(cfg, "14\n")+        try writeMarker(cfg, "15\n")          let (result, repository) = try await LibraryRepository.openForApp(cfg)         await repository.shutdown()          #expect(result == .ready(.seededEmpty))-        #expect(try markerContent(cfg) == "15",+        #expect(try markerContent(cfg) == "16",                 "the marker moves only after the converted store has validated")     }      /// The retired generations sit in this list beside the digits no build ever-    /// published, which is the point of Decision 2: `"4"` through `"13"` are+    /// published, which is the point of Decision 2: `"4"` through `"14"` are     /// now exactly as openable as `"45"`.     @Test("The app fails closed on every marker version it does not open",           arguments: ["4\n", "5\n", "6\n", "7\n", "8\n", "9\n", "10\n", "11\n", "12\n",-                      "13\n", "3\n", "45\n", "", "four\n"])+                      "13\n", "14\n", "3\n", "45\n", "", "four\n"])     func appRejectsEveryOtherMarkerVersion(content: String) async throws {         let (_, cfg) = try config()         try await makeReadyLibrary(cfg)@@ -143,7 +144,7 @@ struct MarkerContractTests {     /// The refusal names the digit, so the one library this can happen to says     /// which generation it is on rather than only that it is wrong.     @Test("The refusal names the marker generation it found",-          arguments: ["4", "5", "6", "7", "8", "9", "10", "11", "12", "13"])+          arguments: ["4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"])     func appRefusalNamesTheRetiredGeneration(digit: String) async throws {         let (_, cfg) = try config()         try await makeReadyLibrary(cfg)@@ -160,11 +161,11 @@ struct MarkerContractTests {      // MARK: - Extension side requires the current version -    @Test("The extension opens a library marked \"15\"")+    @Test("The extension opens a library marked \"16\"")     func extensionAcceptsTheCurrentVersion() async throws {         let (_, cfg) = try config()         try await makeReadyLibrary(cfg)-        #expect(try markerContent(cfg) == "15")+        #expect(try markerContent(cfg) == "16")          let (result, _) = try await LibraryRepository.openForExtension(cfg)         #expect(result == .ready(.seededEmpty))@@ -182,26 +183,26 @@ struct MarkerContractTests {      /// Req 8.7 of `configurable-work-types`, now with the live generation:     /// between the app being updated and first launched the library still-    /// records `"14"`, and a capture in that window must fail safely rather than+    /// records `"15"`, and a capture in that window must fail safely rather than     /// convert the store under a shared lock. The message is the actionable one,     /// because opening the app is what resolves it.     @Test("The extension declines the update window and says to open the app")     func extensionDeclinesTheUpdateWindow() async throws {         let (_, cfg) = try config()         try await makeReadyLibrary(cfg)-        try writeMarker(cfg, "14\n")+        try writeMarker(cfg, "15\n")          await #expect(throws: Self.openTheApp) {             try await LibraryRepository.openForExtension(cfg)         }-        #expect(try markerContent(cfg) == "14", "the extension may not republish readiness")+        #expect(try markerContent(cfg) == "15", "the extension may not republish readiness")     }      /// The other half of the fork: a generation the app does not open either     /// keeps the "has not initialized" wording, because opening the app would     /// not resolve it.     @Test("The extension declines a retired generation with the unknown-digit message",-          arguments: ["5", "6", "7", "8", "9", "10", "11", "12", "13"])+          arguments: ["5", "6", "7", "8", "9", "10", "11", "12", "13", "14"])     func extensionDeclinesARetiredGeneration(retired: String) async throws {         let (_, cfg) = try config()         try await makeReadyLibrary(cfg)@@ -216,26 +217,26 @@ struct MarkerContractTests {     @Test("The extension declines a \"4\" marker before it constructs a ModelContainer")     func extensionDeclinesBeforeOpeningAContainer() async throws {         let (_, cfg) = try config()-        // A genuinely 14.0.0-recorded store, not a corrupt one: the container-        // *would* open it, converting it to 15.0.0 in a process holding only a+        // A genuinely 15.0.0-recorded store, not a corrupt one: the container+        // *would* open it, converting it to 16.0.0 in a process holding only a         // shared lock (Q14). A store that cannot be opened at all would prove         // nothing about the ordering, which is why this uses the         // frozen-snapshot seed.-        try V14RecordedStoreFixture.install(at: cfg.storeURL)+        try V15RecordedStoreFixture.install(at: cfg.storeURL)         try writeMarker(cfg, "4\n")          await #expect(throws: Self.declined) {             try await LibraryRepository.openForExtension(cfg)         }-        #expect(try V4RecordedStoreFixture.recordedModelVersions(at: cfg.storeURL) == ["14.0.0"],+        #expect(try V4RecordedStoreFixture.recordedModelVersions(at: cfg.storeURL) == ["15.0.0"],                 "the marker check must decide before ModelContainer.init converts anything") -        // Control: with a "15" marker the same store is reached, opened, and+        // Control: with a "16" marker the same store is reached, opened, and         // converted. Without this the assertion above could hold because the         // store was unopenable rather than because the marker was read first.-        try writeMarker(cfg, "15\n")+        try writeMarker(cfg, "16\n")         _ = try await LibraryRepository.openForExtension(cfg)-        #expect(try V4RecordedStoreFixture.recordedModelVersions(at: cfg.storeURL) == ["15.0.0"],+        #expect(try V4RecordedStoreFixture.recordedModelVersions(at: cfg.storeURL) == ["16.0.0"],                 "the same store converts once the marker check passes")     } 
Packages/AsterismCore/Tests/AsterismCoreTests/MarkerGenerationSixteenTests.swift Renamed +67 / -65
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/MarkerGenerationFifteenTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/MarkerGenerationSixteenTests.swiftsimilarity index 77%rename from Packages/AsterismCore/Tests/AsterismCoreTests/MarkerGenerationFifteenTests.swiftrename to Packages/AsterismCore/Tests/AsterismCoreTests/MarkerGenerationSixteenTests.swiftindex 3f244a5d..1a210f58 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/MarkerGenerationFifteenTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/MarkerGenerationSixteenTests.swift@@ -4,41 +4,43 @@ import Testing  @testable import AsterismCore -/// The `"14"` → `"15"` generation, end to end (Req 9.1, 9.2).+/// The `"15"` → `"16"` generation, end to end (Req 4.4). ///-/// V15's arm has the same shape as V14's: the lightweight stage does the whole+/// V16's arm has the same shape as V15's: the lightweight stage does the whole /// of the conversion inside `ModelContainer.init`, so there is no data pass and /// no reconciler to run after it. What is left is the sequence — open, validate, /// publish — the failure that must leave the marker where it found it, and both /// halves of the extension's fork. ///-/// V15 **adds one column**, where V14 added three: `Work.releaseDaysRaw`, and no-/// table anywhere. Unlike V14's three it is *defaulted* rather than optional, so-/// the property initialiser `= []` is the Core Data attribute default the stage-/// writes into every existing row. `V14RecordedStoreTests` is where the addition-/// is asserted column by column; this suite is about the marker and the order.+/// V16 **removes one column**, where V15 added one: `Site.junkSuffixRule`, and+/// no table anywhere. It is the first removing stage since V8 → V9, which is+/// why the extension's refusal matters more here than it did at the adding+/// bumps — a concurrent share-sheet open part-way through a removal is+/// destructive rather than merely early. `V15RecordedStoreTests` is where the+/// removal is asserted row by row; this suite is about the marker and the+/// order. ///-/// Every case runs over a library a **V14 build** left behind: a store recorded-/// at 14.0.0 with no release-days column, marked `"14"`.-@Suite("Marker generation 15", .serialized)-struct MarkerGenerationFifteenTests {+/// Every case runs over a library a **V15 build** left behind: a store recorded+/// at 15.0.0 with a populated junk-suffix rule, marked `"15"`.+@Suite("Marker generation 16", .serialized)+struct MarkerGenerationSixteenTests {      private final class Root {         let url: URL         let configuration: LibraryConfiguration         init() throws {             url = FileManager.default.temporaryDirectory.appending(-                path: "MarkerFourteen-\(UUID())", directoryHint: .isDirectory)+                path: "MarkerSixteen-\(UUID())", directoryHint: .isDirectory)             try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)             configuration = LibraryConfiguration(rootDirectory: url)         }         deinit { try? FileManager.default.removeItem(at: url) } -        /// What a device that has run the V14 build holds: the store recorded-        /// at 14.0.0, and the marker at `"14"`.-        func seedV14Library() throws {-            try V14RecordedStoreFixture.install(at: configuration.storeURL)-            try writeMarker("14\n")+        /// What a device that has run the V15 build holds: the store recorded+        /// at 15.0.0, and the marker at `"15"`.+        func seedV15Library() throws {+            try V15RecordedStoreFixture.install(at: configuration.storeURL)+            try writeMarker("15\n")         }          func writeMarker(_ content: String) throws {@@ -53,36 +55,36 @@ struct MarkerGenerationFifteenTests {      // MARK: - The classification -    @Test("A \"14\" marker over a store classifies as the lagging generation")-    func fourteenIsLagging() throws {+    @Test("A \"15\" marker over a store classifies as the lagging generation")+    func fifteenIsLagging() throws {         let root = try Root()-        try root.seedV14Library()+        try root.seedV15Library()          #expect(try LibraryRepository.classify(root.configuration, fileManager: .default)-                == .markerLagging(generation: "14"))+                == .markerLagging(generation: "15"))         withExtendedLifetime(root) {}     } -    @Test("A \"15\" marker over a store classifies ready")-    func fifteenIsReady() throws {+    @Test("A \"16\" marker over a store classifies ready")+    func sixteenIsReady() throws {         let root = try Root()-        try root.seedV14Library()-        try root.writeMarker("15\n")+        try root.seedV15Library()+        try root.writeMarker("16\n")          #expect(try LibraryRepository.classify(root.configuration, fileManager: .default) == .ready)         withExtendedLifetime(root) {}     } -    /// `"13"` joins the retired digits: the arm that used to convert it is gone+    /// `"14"` joins the retired digits: the arm that used to convert it is gone     /// from the marker set and the refusal names the digit like any other. The-    /// V13 → V14 *stage* went in the same commit, as V14's own predecessor did-    /// (`work-thumbnails`), so the plan can no longer convert such a store+    /// V14 → V15 *stage* went in the same commit, as V15's own predecessor did+    /// (`update-schedule`), so the plan can no longer convert such a store     /// either.     @Test("Any other generation is unrecognised, and the refusal names it",-          arguments: ["4", "5", "6", "7", "8", "9", "10", "11", "12", "13"])+          arguments: ["4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"])     func otherGenerationsAreUnrecognised(digit: String) throws {         let root = try Root()-        try root.seedV14Library()+        try root.seedV15Library()         try root.writeMarker("\(digit)\n")          guard case .unrecognised(let reason) = try LibraryRepository.classify(@@ -97,13 +99,12 @@ struct MarkerGenerationFifteenTests {     // MARK: - The arm      /// The whole sequence: the store converts on the way in, it validates, and-    /// only then does the marker move. Nothing else runs — the stage adds one-    /// empty column and the launch reconcile handles anything that arrived-    /// since.+    /// only then does the marker move. Nothing else runs — the stage drops one+    /// column and the launch reconcile handles anything that arrived since.     @Test("The app arm converts, validates and republishes")     func armRunsTheWholeSequence() async throws {         let root = try Root()-        try root.seedV14Library()+        try root.seedV15Library()          let (result, repository) = try await LibraryRepository.openForApp(root.configuration)         defer { withExtendedLifetime(root) {} }@@ -115,9 +116,9 @@ struct MarkerGenerationFifteenTests {         }         #expect(counts.works == 1)         #expect(counts.entries == 3)-        #expect(try root.markerText() == "15")+        #expect(try root.markerText() == "16")         #expect(try V4RecordedStoreFixture.recordedModelVersions(at: root.configuration.storeURL)-                == ["15.0.0"], "the store the arm opened is recorded at the version it converted to")+                == ["16.0.0"], "the store the arm opened is recorded at the version it converted to")          let facts = try await repository.withLockedContext(             mode: .shared, operation: "reading the converted library"@@ -132,8 +133,8 @@ struct MarkerGenerationFifteenTests {         }         await repository.shutdown()         #expect(facts.memberships == [-            "\(V14RecordedStoreFixture.hostname)|\(V14RecordedStoreFixture.workIdentity)"-                + "|\(V14RecordedStoreFixture.workID.uuidString)",+            "\(V15RecordedStoreFixture.hostname)|\(V15RecordedStoreFixture.workIdentity)"+                + "|\(V15RecordedStoreFixture.workID.uuidString)",         ])         // The arm converts nothing beyond the stage, so the fixture's one         // nil-blob Entry is still nil-blob on the far side — a report, not a@@ -146,7 +147,7 @@ struct MarkerGenerationFifteenTests {     @Test("The second open is an ordinary ready open")     func secondOpenIsReady() async throws {         let root = try Root()-        try root.seedV14Library()+        try root.seedV15Library()         let (_, first) = try await LibraryRepository.openForApp(root.configuration)         await first.shutdown() @@ -158,33 +159,34 @@ struct MarkerGenerationFifteenTests {             Issue.record("expected a ready library, got \(result)")             return         }-        #expect(try root.markerText() == "15")+        #expect(try root.markerText() == "16")         withExtendedLifetime(root) {}     } -    /// **The marker goes last**, so a throw anywhere above it leaves `"14"` on+    /// **The marker goes last**, so a throw anywhere above it leaves `"15"` on     /// disk and the next open re-enters the arm over an already converted store-    /// — which is a no-op, because adding a column that is already there is one.+    /// — which is a no-op, because removing a column that is already gone is+    /// one.     ///     /// The arm has exactly two things that can throw — the open and the     /// validation — and both are above `publishReadiness`. This drives the open,     /// because it is the one a test can force: the store is replaced by bytes no     /// coordinator will read, restored, and opened again. What it pins is the     /// ordering, not which of the two failed.-    @Test("A failed open leaves the marker at \"14\", and the next open completes it")+    @Test("A failed open leaves the marker at \"15\", and the next open completes it")     func aFailedOpenLeavesTheMarkerAlone() async throws {         let root = try Root()-        try root.seedV14Library()+        try root.seedV15Library()         let intact = try Data(contentsOf: root.configuration.storeURL)         try Data("not a database".utf8).write(to: root.configuration.storeURL, options: .atomic)          await #expect(throws: (any Error).self) {             try await LibraryRepository.openForApp(root.configuration)         }-        #expect(try root.markerText() == "14",+        #expect(try root.markerText() == "15",                 "the marker may not move over an open that did not complete")         #expect(try LibraryRepository.classify(root.configuration, fileManager: .default)-                == .markerLagging(generation: "14"),+                == .markerLagging(generation: "15"),                 "the next open re-enters the same arm")          try intact.write(to: root.configuration.storeURL, options: .atomic)@@ -194,19 +196,19 @@ struct MarkerGenerationFifteenTests {             Issue.record("expected the retry to reach a ready library, got \(result)")             return         }-        #expect(try root.markerText() == "15")+        #expect(try root.markerText() == "16")         withExtendedLifetime(root) {}     }      /// Validation opens with diagnoses rather than refusing, exactly as the-    /// `.ready` arm does — a library that opened on V14 opens on V15,+    /// `.ready` arm does — a library that opened on V15 opens on V16,     /// quarantines and all. Only a validation that *throws* stops the marker.     @Test("A library with a quarantined hostname still opens, and reports it")     func validationDiagnosesRatherThanRefuses() async throws {         let root = try Root()-        try root.seedV14Library()+        try root.seedV15Library()         // Break the cited chapter pattern's definition, which is an-        // `.unreadableTitlePattern` quarantine on V14 and must stay one on V15.+        // `.unreadableTitlePattern` quarantine on V15 and must stay one on V16.         do {             let container = try LibraryRepository.openContainer(at: root.configuration.storeURL)             let context = ModelContext(container)@@ -224,15 +226,15 @@ struct MarkerGenerationFifteenTests {          let (result, repository) = try await LibraryRepository.openForApp(root.configuration)         let quarantined = await repository.quarantineReason(-            hostname: V14RecordedStoreFixture.hostname)+            hostname: V15RecordedStoreFixture.hostname)         await repository.shutdown()          guard case .ready = result else {             Issue.record("a diagnosable library must still open, got \(result)")             return         }-        #expect(try root.markerText() == "15")-        #expect(quarantined != nil, "the broken title rule quarantines its hostname, as on V14")+        #expect(try root.markerText() == "16")+        #expect(quarantined != nil, "the broken title rule quarantines its hostname, as on V15")         withExtendedLifetime(root) {}     } @@ -248,7 +250,7 @@ struct MarkerGenerationFifteenTests {     @Test("A failed publish leaves the historical marker and the sidecar in place")     func aFailedPublishKeepsTheResidualEvidence() throws {         let root = try Root()-        try root.seedV14Library()+        try root.seedV15Library()         try Data("3\n".utf8).write(             to: root.configuration.historicalMarkerURL, options: .atomic)         try Data("stale\n".utf8).write(@@ -264,9 +266,9 @@ struct MarkerGenerationFifteenTests {          #expect(throws: (any Error).self) {             try LibraryRepository.act(-                on: .markerLagging(generation: "14"), root.configuration, hooks: .production)+                on: .markerLagging(generation: "15"), root.configuration, hooks: .production)         }-        #expect(try root.markerText() == "14",+        #expect(try root.markerText() == "15",                 "the marker may not move over a publish that did not complete")         #expect(files.fileExists(atPath: root.configuration.historicalMarkerURL.path))         #expect(files.fileExists(atPath: root.configuration.migrationSidecarURL.path),@@ -276,27 +278,27 @@ struct MarkerGenerationFifteenTests {      // MARK: - The extension's fork -    @Test("The extension refuses \"14\" and says to open the app")+    @Test("The extension refuses \"15\" and says to open the app")     func extensionRefusesTheLaggingGeneration() async throws {         let root = try Root()-        try root.seedV14Library()+        try root.seedV15Library()          await #expect(throws: LibraryRepositoryError.libraryUnavailable(             operation: "opening library from extension",             reason: "Open Asterism to finish updating the library")) {             try await LibraryRepository.openForExtension(root.configuration)         }-        #expect(try root.markerText() == "14", "the extension may not convert or republish")+        #expect(try root.markerText() == "15", "the extension may not convert or republish")         #expect(try V4RecordedStoreFixture.recordedModelVersions(at: root.configuration.storeURL)-                == ["14.0.0"], "and may not let ModelContainer.init convert the store")+                == ["15.0.0"], "and may not let ModelContainer.init convert the store")         withExtendedLifetime(root) {}     }      @Test("The extension keeps the existing reason for a generation no build opens",-          arguments: ["4", "5", "6", "7", "8", "9", "10", "11", "12", "13"])+          arguments: ["4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"])     func extensionRefusesUnknownDigits(digit: String) async throws {         let root = try Root()-        try root.seedV14Library()+        try root.seedV15Library()         try root.writeMarker("\(digit)\n")          await #expect(throws: LibraryRepositoryError.libraryUnavailable(@@ -307,13 +309,13 @@ struct MarkerGenerationFifteenTests {         withExtendedLifetime(root) {}     } -    @Test("The extension opens \"15\"")+    @Test("The extension opens \"16\"")     func extensionOpensTheCurrentGeneration() async throws {         let root = try Root()-        try root.seedV14Library()+        try root.seedV15Library()         let (_, repository) = try await LibraryRepository.openForApp(root.configuration)         await repository.shutdown()-        #expect(try root.markerText() == "15")+        #expect(try root.markerText() == "16")          let (result, _) = try await LibraryRepository.openForExtension(root.configuration)         guard case .ready = result else {
Packages/AsterismCore/Tests/AsterismCoreTests/MembershipReconcilerTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/MembershipReconcilerTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/MembershipReconcilerTests.swiftindex b63a8437..61dd025c 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/MembershipReconcilerTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/MembershipReconcilerTests.swift@@ -1052,12 +1052,12 @@ private final class ReconcileStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismMembershipReconciler-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         context = ModelContext(container)     }
Packages/AsterismCore/Tests/AsterismCoreTests/MembershipTestSupport.swift Modified +5 / -5
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/MembershipTestSupport.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/MembershipTestSupport.swiftindex 161080c0..814b5ab5 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/MembershipTestSupport.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/MembershipTestSupport.swift@@ -109,7 +109,7 @@ extension LibraryRepository {         }     } -    /// Exports and decode-validates, which is exactly what `BackupV14Exporter`+    /// Exports and decode-validates, which is exactly what `BackupV15Exporter`     /// does — and `BackupArchiveReferenceChecks` is where a membership whose     /// hostname and cited identity rule describe **different sites** is refused,     /// along with the rest of the identity tuple. Three separate membership bugs@@ -119,11 +119,11 @@ extension LibraryRepository {         sourceLocation: SourceLocation = #_sourceLocation     ) async throws {         do {-            let payload = try await backupV14Snapshot()-            let encoded = try BackupV14Codec.encode(+            let payload = try await backupV15Snapshot()+            let encoded = try BackupV15Codec.encode(                 payload: payload,-                metadata: BackupV14Metadata(appBuild: "test", exportedAt: M5Fixture.epoch))-            _ = try BackupV14Codec.decode(encoded)+                metadata: BackupV15Metadata(appBuild: "test", exportedAt: M5Fixture.epoch))+            _ = try BackupV15Codec.decode(encoded)         } catch {             Issue.record(                 comment ?? "the archive is not legal: \(error)", sourceLocation: sourceLocation)
Packages/AsterismCore/Tests/AsterismCoreTests/MembershipValidationTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/MembershipValidationTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/MembershipValidationTests.swiftindex dc54a279..be083401 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/MembershipValidationTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/MembershipValidationTests.swift@@ -345,12 +345,12 @@ private final class MembershipStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismMembershipValidation-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         context = ModelContext(container)     }
Packages/AsterismCore/Tests/AsterismCoreTests/MirroringBootstrapLifecycleTests.swift Modified +3 / -3
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/MirroringBootstrapLifecycleTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/MirroringBootstrapLifecycleTests.swiftindex c54b0d64..069f651a 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/MirroringBootstrapLifecycleTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/MirroringBootstrapLifecycleTests.swift@@ -126,7 +126,7 @@ struct MirroringBootstrapLifecycleTests {         // container is constructed, the store is marked at the current         // generation — so CloudKit cannot fill an unmarked store         // (Req 6.1, Q22, Q35).-        #expect(call.markerVersion == "15")+        #expect(call.markerVersion == "16")         #expect(call.storeExists)         #expect(call.containerID == Self.fixtureContainer)         #expect(call.storeURL == configuration.storeURL)@@ -149,7 +149,7 @@ struct MirroringBootstrapLifecycleTests {             mirroring: recordingHooks(configuration, log: log, bootstrapBox: bootstrapBox))          #expect(log.callCount == 1)-        #expect(log.calls.first?.markerVersion == "15")+        #expect(log.calls.first?.markerVersion == "16")         #expect(await repository.mirroring.isMirroring)         // Q35/Q43 on this path too. The already-certified branch opens its own         // certification container to run the validator over an existing marker,@@ -176,7 +176,7 @@ struct MirroringBootstrapLifecycleTests {          #expect(result == .ready(LibraryRecordCounts(             entries: 0, works: 0, sites: 1, titlePatterns: 0).withSeededWorkTypes))-        #expect(log.calls.first?.markerVersion == "15")+        #expect(log.calls.first?.markerVersion == "16")         #expect(await repository.mirroring.isMirroring)         withExtendedLifetime(dir) {}     }
Packages/AsterismCore/Tests/AsterismCoreTests/ModelContractTests.swift Modified +200 / -98
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/ModelContractTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/ModelContractTests.swiftindex 9a1be65f..17365069 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/ModelContractTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/ModelContractTests.swift@@ -17,18 +17,16 @@ import Testing struct ModelContractTests {     @Test("Capability gates and persisted raw values are stable")     func capabilitiesAndRawValues() {-        let expectedLegacyGates: [(AsterismCapabilities, Bool, Bool)] = [-            (.m2_0, false, false),-            (.m2_1, false, false),-            (.m2_2, true, false),-            (.m2_3, true, true),+        let expectedLegacyGates: [(AsterismCapabilities, Bool)] = [+            (.m2_0, false),+            (.m2_1, false),+            (.m2_2, false),+            (.m2_3, true),         ]-        for (capabilities, supportsArticles, supportsPhrase) in expectedLegacyGates {+        for (capabilities, supportsPhrase) in expectedLegacyGates {             #expect(capabilities.allows(patternForm: .segment))-            #expect(capabilities.supportsArticles == supportsArticles)             #expect(capabilities.allows(patternForm: .phrase) == supportsPhrase)         }-        #expect(AsterismCapabilities.m3.supportsArticles)         #expect(AsterismCapabilities.m3.allows(patternForm: .phrase))         // `multi-site-works` (Q29) flipped the current runtime gate to         // `.multiSite`; the codec stamps its own literal, so an archive's gate@@ -78,7 +76,10 @@ struct ModelContractTests {         #expect(ReadingStatus.finished.isDone)         #expect(ReadingStatus.abandoned.isDone)         #expect(FieldProvenanceKind.allCases.map(\.rawValue) == ["none", "pattern", "urlRule", "manual"])-        #expect(SiteMode.allCases.map(\.rawValue) == ["untaught", "taught", "articles"])+        // `remove-article-mode` Req 3.1: two modes, not three. A row still+        // carrying the retired `"articles"` spelling is an unknown value like+        // any other — `UnknownSiteModeTests` is where that is asserted.+        #expect(SiteMode.allCases.map(\.rawValue) == ["untaught", "taught"])         #expect(AnchorOrigin.allCases.map(\.rawValue) == ["start", "end"])         #expect(URLRuleComponent.allCases.map(\.rawValue) == ["pathSegment", "queryItem"])     }@@ -114,6 +115,10 @@ struct ModelContractTests {         #expect(throws: ModelInvariantError.self) { try URLIdentityRule(version: 0, component: .pathSegment, origin: .start, offset: 0) }         #expect(throws: ModelInvariantError.self) { try URLIdentityRule(version: 1, component: .queryItem, queryName: "   ") }         #expect(throws: ModelInvariantError.self) { try URLIdentityRule(version: 1, component: .pathSegment, queryName: "chapter") }+        // `JunkSuffixRule` has had no live consumer since V16 dropped+        // `Site.junkSuffixRule`, and this line is deliberately kept: the frozen+        // `AsterismSchemaV15` snapshot is frozen *by reference* to the type, so+        // its shape is still a stored shape (Req 4.5, Q8).         #expect(throws: ModelInvariantError.self) { try JunkSuffixRule(version: 0, anchors: []) }         #expect(throws: ModelInvariantError.self) { try FieldProvenance(kind: .pattern, patternID: nil) }         #expect(throws: ModelInvariantError.self) { try FieldProvenance(kind: .manual, patternID: UUID()) }@@ -172,12 +177,12 @@ struct ModelContractTests {         #expect(entry.intentionallyUnattached == false)     } -    /// The entity list is the store's shape. **V15 declares exactly V14's-    /// seventeen entities** — the second column-only stage in a row, and the-    /// fourth bump in five to add no table at all. The frozen snapshot is the+    /// The entity list is the store's shape. **V16 declares exactly V15's+    /// seventeen entities** — the third column-only stage in a row, and the+    /// fifth bump in six to add no table at all. The frozen snapshot is the     /// `from` side of the one lightweight stage, so a divergence here is a store     /// that will not open, not a test that needs updating.-    @Test("V15 declares exactly V14's seventeen entities")+    @Test("V16 declares exactly V15's seventeen entities")     func schemaEntityLists() {         let seventeen = [             "Entry", "Work", "Site", "TitlePattern", "URLRulePattern", "WorkTypeEntity",@@ -185,10 +190,10 @@ struct ModelContractTests {             "Series", "WorkLink", "Creator", "CreatorRole", "WorkCredit",             "Place", "PlaceSuppression",         ]+        #expect(AsterismSchemaV16.versionIdentifier == Schema.Version(16, 0, 0))+        #expect(AsterismSchemaV16.models.map { String(describing: $0) } == seventeen)         #expect(AsterismSchemaV15.versionIdentifier == Schema.Version(15, 0, 0))         #expect(AsterismSchemaV15.models.map { String(describing: $0) } == seventeen)-        #expect(AsterismSchemaV14.versionIdentifier == Schema.Version(14, 0, 0))-        #expect(AsterismSchemaV14.models.map { String(describing: $0) } == seventeen)     }      /// `empty-library` Req 3.1: the deletion pass names **every** entity the@@ -203,7 +208,7 @@ struct ModelContractTests {     func emptyLibraryPhasesCoverTheSchema() {         let phased = Set(             LibraryRepository.emptyLibraryPhases.flatMap { $0.entities.map(\.name) })-        let declared = Set(AsterismSchemaV15.models.map { String(describing: $0) })+        let declared = Set(AsterismSchemaV16.models.map { String(describing: $0) })         #expect(             phased == declared,             """@@ -212,52 +217,99 @@ struct ModelContractTests {             """)     } -    /// **V15 adds exactly one `Work` column and nothing else**, which is the-    /// whole of this bump — and is therefore asserted as a *delta* rather than-    /// as equality: the live `Work` entity must be the frozen one plus-    /// `releaseDaysRaw`, and it must still carry every column the earlier stages-    /// supplied, V14's three thumbnail ones included.+    /// **V16 removes exactly one `Site` column and adds nothing**, which is+    /// the whole of this bump (Req 4.1) — and is therefore asserted as a *delta*+    /// rather than as equality: the live `Site` entity must be the frozen one+    /// minus `junkSuffixRule`, and every other entity must be identical+    /// property for property.     ///-    /// The "and absent from the previous snapshot" half went with the snapshots-    /// that carried the older columns: there is no frozen schema below V14 left-    /// to compare against. For *this* one it is back, because V14 is the-    /// `from` side every installed library is matched on and the column is-    /// precisely what the stage has to produce.-    @Test("V15's Work is V14's plus exactly releaseDaysRaw")-    func workColumnsAreTheReleaseDaysDeltaAtV15() {-        let inherited = [-            "workStatusRaw", "readingStatusRaw", "verdict",              // V10-            "seriesID", "seriesPosition",                                // V11-            "thumbnailData", "thumbnailShapeRaw", "thumbnailDigest",     // V14+    /// It is the first removing delta since V8 → V9, which reverses the usual+    /// direction of the two halves: what has to be absent is on the *live*+    /// side, and what has to be present is on the frozen one. Both are asserted,+    /// because "the column is gone" and "nothing else went with it" are+    /// different claims and this bump makes both.+    ///+    /// "Identical property for property" is meant literally, and it is why the+    /// second half reads `propertyShapes(of:in:)` rather than the name set: a+    /// column that kept its name while changing value type, optionality,+    /// uniqueness or attribute options — `.externalStorage` on+    /// `Work.thumbnailData` is the live example — and a relationship that kept+    /// its name while changing destination, cardinality, delete rule or+    /// inverse, are all shape changes a lightweight stage may not make, and all+    /// invisible to a comparison of names.+    @Test("V16's Site is V15's minus exactly junkSuffixRule, and no other entity moves")+    func siteColumnsAreTheJunkSuffixDeltaAtV16() {+        let retained = [+            "hostname", "displayName", "modeRaw",+            "patterns", "urlRules", "entries", "workMemberships",         ]-        let added = ["releaseDaysRaw"]-        let live = Self.workProperties(Schema(versionedSchema: AsterismSchemaV15.self))-        let frozen = Self.workProperties(Schema(versionedSchema: AsterismSchemaV14.self))-        for column in inherited {-            #expect(frozen.contains(column), "Work.\(column) is missing from the V14 schema")-            #expect(live.contains(column), "Work.\(column) is missing from the V15 schema")+        let removed = ["junkSuffixRule"]+        let live = Self.properties(of: "Site", in: Schema(versionedSchema: AsterismSchemaV16.self))+        let frozen = Self.properties(+            of: "Site", in: Schema(versionedSchema: AsterismSchemaV15.self))+        for column in retained {+            #expect(frozen.contains(column), "Site.\(column) is missing from the V15 schema")+            #expect(live.contains(column), "Site.\(column) is missing from the V16 schema")         }-        for column in added {-            #expect(live.contains(column), "Work.\(column) is missing from the V15 schema")-            #expect(!frozen.contains(column), "Work.\(column) is in the frozen V14 snapshot")+        for column in removed {+            #expect(frozen.contains(column), "Site.\(column) is not in the frozen V15 snapshot")+            #expect(!live.contains(column), "Site.\(column) is still in the V16 schema")         }         #expect(-            live.subtracting(frozen) == Set(added),+            frozen.subtracting(live) == Set(removed),             """-            V14 -> V15 is meant to add exactly releaseDaysRaw, but \-            it added \(live.subtracting(frozen).sorted())+            V15 -> V16 is meant to remove exactly junkSuffixRule, but \+            it removed \(frozen.subtracting(live).sorted())             """)         #expect(-            frozen.subtracting(live).isEmpty,-            "V14 -> V15 removes \(frozen.subtracting(live).sorted()); this stage only adds")-        // The control: the frozen snapshot is a real schema, not an empty read.-        #expect(frozen.contains("titleProvenanceRaw"))+            live.subtracting(frozen).isEmpty,+            "V15 -> V16 adds \(live.subtracting(frozen).sorted()); this stage only removes")++        let liveSchema = Schema(versionedSchema: AsterismSchemaV16.self)+        let frozenSchema = Schema(versionedSchema: AsterismSchemaV15.self)++        // `Site`'s surviving columns are unchanged in *shape*, not merely+        // present by name: the same delta over `propertyShapes`, with the+        // removed column dropped from the frozen side.+        let liveSiteShapes = Self.propertyShapes(of: "Site", in: liveSchema)+        let frozenSiteShapes = Self.propertyShapes(of: "Site", in: frozenSchema)+            .filter { !removed.contains($0.key) }+        #expect(+            liveSiteShapes == frozenSiteShapes,+            """+            V15 -> V16 changed a surviving Site column's shape: \+            \(Self.shapeDifferences(live: liveSiteShapes, frozen: frozenSiteShapes))+            """)++        // Every other entity is identical property for property — name, value+        // type, optionality, uniqueness and attribute options for a column;+        // destination, optionality, cardinality, delete rule and inverse for a+        // relationship. This is the "and nothing else" half. `Work` is named on+        // its own below because it is the table the last four bumps moved; this+        // loop covers all seventeen.+        for name in liveSchema.entities.map(\.name) where name != "Site" {+            let liveShapes = Self.propertyShapes(of: name, in: liveSchema)+            let frozenShapes = Self.propertyShapes(of: name, in: frozenSchema)+            #expect(+                liveShapes == frozenShapes,+                """+                V15 -> V16 changed \(name), which this stage may not touch: \+                \(Self.shapeDifferences(live: liveShapes, frozen: frozenShapes))+                """)+        }+        // The control: the frozen snapshot is a real schema, not an empty read,+        // and `Work` still carries every column the earlier stages supplied.+        #expect(frozen.contains("modeRaw"))+        #expect(+            Self.properties(of: "Work", in: liveSchema)+                .isSuperset(of: ["releaseDaysRaw", "thumbnailData", "workStatusRaw", "seriesID"]))     }      /// `releaseDaysRaw` as CloudKit will materialise it and as the store will-    /// lay it out (Q27): **defaulted, non-optional, non-unique** — the shape-    /// `genreTags` has had since V5, and the shape that makes the property-    /// initialiser the Core Data attribute default the V14 → V15 stage writes.+    /// lay it out (`update-schedule` Q27): **defaulted, non-optional,+    /// non-unique** — the shape `genreTags` has had since V5, and the shape that+    /// made the property initialiser the Core Data attribute default the+    /// V14 → V15 stage wrote. V16 inherits it untouched.     @Test("releaseDaysRaw is a defaulted, non-unique string array")     func releaseDaysColumnIsCloudKitLegal() throws {         // A work is born with no release days, which is Req 1.1 read off the@@ -275,12 +327,12 @@ struct ModelContractTests {         work.releaseDays = [.sunday, .monday, .sunday]         #expect(work.releaseDaysRaw == ["monday", "sunday"], "the setter writes canonical order") -        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let entity = try #require(schema.entities.first { $0.name == "Work" })         #expect(entity.uniquenessConstraints.isEmpty, "Work declares a uniqueness constraint")         let attributes = entity.properties.compactMap { $0 as? Schema.Attribute }         let byName = Dictionary(uniqueKeysWithValues: attributes.map { ($0.name, $0) })-        let column = try #require(byName["releaseDaysRaw"], "Work.releaseDaysRaw is not in V15")+        let column = try #require(byName["releaseDaysRaw"], "Work.releaseDaysRaw is not in V16")         #expect(!column.isOptional, "Work.releaseDaysRaw is defaulted, not optional")         #expect(!column.isUnique, "Work.releaseDaysRaw declares a uniqueness constraint")         #expect(@@ -295,15 +347,15 @@ struct ModelContractTests {         #expect(byName["genreTags"].map { String(describing: $0.valueType) } == "Array<String>")     } -    /// **V15 adds no table at all**, which is what makes this the second-    /// column-only bump in a row: the two schemas' entity *names* are identical,-    /// V13's two place tables included.-    @Test("V15 adds no entity, and the frozen V14 carries every table it inherited")-    func noTableIsAddedAtV15() {-        let live = Set(Schema(versionedSchema: AsterismSchemaV15.self).entities.map(\.name))-        let frozen = Set(Schema(versionedSchema: AsterismSchemaV14.self).entities.map(\.name))-        #expect(live == frozen, "V14 -> V15 changed the entity list: \(live.symmetricDifference(frozen))")-        // The control: the frozen snapshot is a real schema, and it is V14's —+    /// **V16 adds and removes no table at all**, which is what makes this a+    /// column-only bump in the removing direction: the two schemas' entity+    /// *names* are identical, V13's two place tables included.+    @Test("V16 changes no entity, and the frozen V15 carries every table it inherited")+    func noTableChangesAtV16() {+        let live = Set(Schema(versionedSchema: AsterismSchemaV16.self).entities.map(\.name))+        let frozen = Set(Schema(versionedSchema: AsterismSchemaV15.self).entities.map(\.name))+        #expect(live == frozen, "V15 -> V16 changed the entity list: \(live.symmetricDifference(frozen))")+        // The control: the frozen snapshot is a real schema, and it is V15's —         // it carries every table the stages before it added.         #expect(frozen.isSuperset(of: ["Place", "PlaceSuppression"]))         #expect(frozen.isSuperset(of: ["Creator", "CreatorRole", "WorkCredit"]))@@ -314,10 +366,10 @@ struct ModelContractTests {     ///     /// **`thumbnailData` carries `.externalStorage` on the live schema**, which     /// is part of the stored shape rather than a hint: it is what keeps a-    /// whole-table fault for titles from reading a single cover (Req 7.1,-    /// Req 9.3), and the V14 freeze carried it across verbatim. The attribute is-    /// the only one in the schema, so this is also the pin that a later edit-    /// cannot quietly drop it.+    /// whole-table fault for titles from reading a single cover+    /// (`work-thumbnails` Req 7.1, Req 9.3), and the V14 and V15 freezes carried+    /// it across verbatim. The attribute is the only one in the schema, so this+    /// is also the pin that a later edit cannot quietly drop it.     @Test("The three thumbnail columns are optional, external where it matters, and CloudKit-legal")     func thumbnailColumnsAreCloudKitLegal() throws {         // A work is born without a cover: all three nil, which is what let the@@ -329,7 +381,7 @@ struct ModelContractTests {         #expect(work.thumbnailShape == nil)         #expect(work.thumbnailIdentity == nil) -        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let entity = try #require(schema.entities.first { $0.name == "Work" })         #expect(entity.uniquenessConstraints.isEmpty, "Work declares a uniqueness constraint")         // `properties` is `[any SchemaProperty]` and the relationships are in@@ -338,7 +390,7 @@ struct ModelContractTests {         let attributes = entity.properties.compactMap { $0 as? Schema.Attribute }         let byName = Dictionary(uniqueKeysWithValues: attributes.map { ($0.name, $0) })         for column in ["thumbnailData", "thumbnailShapeRaw", "thumbnailDigest"] {-            let attribute = try #require(byName[column], "Work.\(column) is not in the V15 schema")+            let attribute = try #require(byName[column], "Work.\(column) is not in the V16 schema")             #expect(attribute.isOptional, "Work.\(column) must be optional: nil is 'no cover'")             #expect(!attribute.isUnique, "Work.\(column) declares a uniqueness constraint")         }@@ -355,26 +407,26 @@ struct ModelContractTests {         #expect(byName["displayTitle"]?.options.contains(.externalStorage) == false)     } -    /// The same pin over the **frozen** `AsterismSchemaV14` snapshot.+    /// The same pin over the **frozen** `AsterismSchemaV15` snapshot.     ///     /// `docs/agent-notes/schema-migration.md` requires `@Attribute` options to be     /// carried across verbatim when a version is frozen, and nothing else asserts-    /// that for V14: the recorded-store fixture writes through the same snapshot+    /// that for V15: the recorded-store fixture writes through the same snapshot     /// it reads back, so a snapshot that quietly lost `.externalStorage` would     /// still round-trip and the divergence from the live schema would surface     /// only as a migration that rewrites every cover.-    @Test("The frozen V14 snapshot still carries `.externalStorage` on Work.thumbnailData")-    func frozenV14ThumbnailDataIsExternallyStored() throws {-        let schema = Schema(versionedSchema: AsterismSchemaV14.self)+    @Test("The frozen V15 snapshot still carries `.externalStorage` on Work.thumbnailData")+    func frozenV15ThumbnailDataIsExternallyStored() throws {+        let schema = Schema(versionedSchema: AsterismSchemaV15.self)         let entity = try #require(schema.entities.first { $0.name == "Work" })         let attributes = entity.properties.compactMap { $0 as? Schema.Attribute }         let byName = Dictionary(uniqueKeysWithValues: attributes.map { ($0.name, $0) })-        let bytes = try #require(byName["thumbnailData"], "Work.thumbnailData is not in the V14 schema")+        let bytes = try #require(byName["thumbnailData"], "Work.thumbnailData is not in the V15 schema")         #expect(             bytes.isOptional, "Work.thumbnailData must be optional on the frozen snapshot too")         #expect(             bytes.options.contains(.externalStorage),-            "The frozen V14 Work.thumbnailData lost `.externalStorage`, which the live schema still declares")+            "The frozen V15 Work.thumbnailData lost `.externalStorage`, which the live schema still declares")         // The same control as above, over the snapshot: the neighbouring columns         // are not external, so this is reading the attribute rather than a         // property every column carries.@@ -421,10 +473,10 @@ struct ModelContractTests {          // The schema's own view: nothing unique, no relationship on either new         // table, and the owner a column rather than a reference.-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         for name in ["Place", "PlaceSuppression"] {             guard let entity = schema.entities.first(where: { $0.name == name }) else {-                Issue.record("the V14 schema has no \(name) entity")+                Issue.record("the live schema has no \(name) entity")                 continue             }             #expect(entity.relationships.isEmpty, "\(name) declares a relationship")@@ -498,10 +550,10 @@ struct ModelContractTests {          // The schema's own view: nothing unique, no relationships on any of the         // three, and every foreign reference a column rather than a reference.-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         for name in ["Creator", "CreatorRole", "WorkCredit"] {             guard let entity = schema.entities.first(where: { $0.name == name }) else {-                Issue.record("the V14 schema has no \(name) entity")+                Issue.record("the live schema has no \(name) entity")                 continue             }             #expect(entity.relationships.isEmpty, "\(name) declares a relationship")@@ -539,10 +591,10 @@ struct ModelContractTests {          // The schema's own view: nothing unique, no relationships on either new         // table, and the two link ends are UUID columns rather than references.-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         for name in ["Series", "WorkLink"] {             guard let entity = schema.entities.first(where: { $0.name == name }) else {-                Issue.record("the V14 schema has no \(name) entity")+                Issue.record("the live schema has no \(name) entity")                 continue             }             #expect(entity.relationships.isEmpty, "\(name) declares a relationship")@@ -670,9 +722,9 @@ struct ModelContractTests {     /// archive wire records, `trimPrefix` on `StoredPatternDefinition`) is not a     /// column, and a textual grep could not tell them apart — which is why the     /// V8-era half of this pin needed an allowlist and this one does not.-    @Test("No dropped column is in the V14 schema")+    @Test("No dropped column is in the live schema")     func droppedColumnsAreGoneFromTheSchema() {-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         var propertiesByEntity: [String: Set<String>] = [:]         for entity in schema.entities {             propertiesByEntity[entity.name, default: []]@@ -683,7 +735,7 @@ struct ModelContractTests {         for (entity, columns) in Self.droppedColumns {             let held = propertiesByEntity[entity] ?? []             for column in columns {-                #expect(!held.contains(column), "\(entity).\(column) is back in the V14 schema")+                #expect(!held.contains(column), "\(entity).\(column) is back in the live schema")             }         }         // The control: the columns that superseded them *are* there, so a run@@ -693,19 +745,19 @@ struct ModelContractTests {         #expect(propertiesByEntity["Work"]?.contains("siteMemberships") == true)     } -    /// **Every frozen snapshot is a stage's `from` side.** `AsterismSchemaV14`-    /// is the one the plan names; V5 through V13 went with the stages that named+    /// **Every frozen snapshot is a stage's `from` side.** `AsterismSchemaV15`+    /// is the one the plan names; V5 through V14 went with the stages that named     /// them (Q2 of `drop-superseded-columns`, Q18 of `work-and-reading-status`,     /// Q60 of `series-and-related-works`, Q15 of `work-creators`, Q48 of-    /// `place-extraction`, `work-thumbnails` for V12, and this bump for V13),-    /// and+    /// `place-extraction`, `work-thumbnails` for V12, `update-schedule` for V13,+    /// and this bump for V14), and     /// a file that starts declaring a snapshot without a stage to be the `from`     /// side of is a store shape nothing can reach.     ///-    /// There are two declarations rather than one because `AsterismSchemaV15` is-    /// the live schema, and the count of *snapshots* is one: V13 went in this+    /// There are two declarations rather than one because `AsterismSchemaV16` is+    /// the live schema, and the count of *snapshots* is one: V14 went in this     /// bump's freeze commit, the owner having confirmed every device on marker-    /// `"14"` before it ran.+    /// `"15"` before it ran (Q10).     ///     /// The columns V9 dropped are now named **nowhere** in the package's     /// sources: the frozen V8 snapshot that was their last home went with the@@ -752,11 +804,11 @@ struct ModelContractTests {          #expect(             declaringSnapshots.sorted() == [-                "AsterismSchemaV14.swift", "AsterismSchemaV15.swift",+                "AsterismSchemaV15.swift", "AsterismSchemaV16.swift",             ],             """             the package declares versioned schemas in \(declaringSnapshots.sorted()); \-            the plan is [V14, V15] and every snapshot must be a stage's `from` side+            the plan is [V15, V16] and every snapshot must be a stage's `from` side             """)         #expect(             naming.isEmpty,@@ -768,10 +820,60 @@ struct ModelContractTests {     }  -    /// Every stored property and relationship of one schema's `Work` entity.-    private static func workProperties(_ schema: Schema) -> Set<String> {-        guard let work = schema.entities.first(where: { $0.name == "Work" }) else { return [] }-        return Set(work.properties.map(\.name)).union(work.relationships.map(\.name))+    /// Every stored property and relationship of one schema's named entity, by+    /// name only. The *shape* behind each name is `propertyShapes(of:in:)`.+    private static func properties(of name: String, in schema: Schema) -> Set<String> {+        guard let entity = schema.entities.first(where: { $0.name == name }) else { return [] }+        return Set(entity.properties.map(\.name)).union(entity.relationships.map(\.name))+    }++    /// The same entity keyed by property name, with each value a rendering of+    /// the property's **stored shape** rather than merely its name.+    ///+    /// The delta pin above claims two entities are identical property for+    /// property. A name-set comparison cannot make that claim: a column that+    /// changed type, gained or lost optionality, picked up `.externalStorage`,+    /// or a relationship that changed destination, delete rule or inverse under+    /// a name that stayed put, all read as unchanged. These strings carry what+    /// a lightweight stage may not silently move.+    ///+    /// A relationship's `valueType` is deliberately **not** part of it. The two+    /// schemas nest different Swift classes under the same entity names, so it+    /// differs for every relationship on both sides and would make the pin+    /// always red. `destination` is the entity *name*, which is the portable+    /// form of the same fact.+    private static func propertyShapes(of name: String, in schema: Schema) -> [String: String] {+        guard let entity = schema.entities.first(where: { $0.name == name }) else { return [:] }+        var shapes: [String: String] = [:]+        for attribute in entity.attributes {+            shapes[attribute.name] = """+                attribute \(attribute.valueType) \+                optional=\(attribute.isOptional) unique=\(attribute.isUnique) \+                transient=\(attribute.isTransient) \+                options=\(attribute.options.map { String(describing: $0) }.sorted())+                """+        }+        for relationship in entity.relationships {+            shapes[relationship.name] = """+                relationship -> \(relationship.destination) \+                optional=\(relationship.isOptional) toOne=\(relationship.isToOneRelationship) \+                delete=\(relationship.deleteRule) \+                inverse=\(relationship.inverseName ?? "none")+                """+        }+        return shapes+    }++    /// The per-property disagreement between two `propertyShapes` readings, so+    /// a failure names the column and what moved rather than printing two+    /// seventeen-line dictionaries.+    private static func shapeDifferences(+        live: [String: String], frozen: [String: String]+    ) -> String {+        Set(live.keys).union(frozen.keys).sorted().compactMap { name -> String? in+            guard live[name] != frozen[name] else { return nil }+            return "\(name): live \(live[name] ?? "absent") / frozen \(frozen[name] ?? "absent")"+        }.joined(separator: "; ")     }      /// Whether `code` names `member` at all — declaring it or reading it, at a@@ -986,7 +1088,7 @@ private struct ModelFixture {     /// The live schema, in memory. It was `AsterismSchemaV2` — a schema no     /// library was written by, which is exactly the divergence Req 4.1 is about.     init() throws {-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             schema: schema,             isStoredInMemoryOnly: true,
Packages/AsterismCore/Tests/AsterismCoreTests/MultiSiteReadPathTests.swift Modified +4 / -4
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/MultiSiteReadPathTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/MultiSiteReadPathTests.swiftindex 6c436096..353871bf 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/MultiSiteReadPathTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/MultiSiteReadPathTests.swift@@ -121,10 +121,10 @@ struct MultiSiteReadPathTests {             // The model itself: `siteMemberships` is declared here and             // `membershipValues` / `membership(for:)` are its accessors.             "Models.swift",-            // The frozen V14 snapshot **declares** the inverse array; it reads+            // The frozen V15 snapshot **declares** the inverse array; it reads             // nothing, and nothing reads it — a snapshot carries stored columns             // and no accessors at all.-            "AsterismSchemaV14.swift",+            "AsterismSchemaV15.swift",             // The reconcilers and the scan, which are *about* the membership             // graph and read it whole per pass rather than per row.             "DuplicateReconciler.swift", "DuplicateScan.swift", "MembershipReconciler.swift",@@ -201,12 +201,12 @@ private final class MembershipStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismMultiSiteRead-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         context = ModelContext(container)     }
Packages/AsterismCore/Tests/AsterismCoreTests/MultiSiteReviewFixTests.swift Modified +7 / -7
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/MultiSiteReviewFixTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/MultiSiteReviewFixTests.swiftindex 401e1731..3aec10f8 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/MultiSiteReviewFixTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/MultiSiteReviewFixTests.swift@@ -259,7 +259,7 @@ struct MultiSiteReviewFixTests {     @Test("An Entry citing another site's rule is refused before a file exists")     func exportGateRefusesACrossSiteEntryCitation() throws {         let ruleID = UUID()-        let rule = BackupV14URLRule(+        let rule = BackupV15URLRule(             id: ruleID, version: 1, isCurrent: true, createdAt: Self.epoch,             origin: .readerTaught,             definition: .work(locator: .query(name: ExactScalarString("identity"))),@@ -268,12 +268,12 @@ struct MultiSiteReviewFixTests {             hostname: "a.example",             citations: EntryCitations(chapterSequence: CitedRule(id: ruleID))) -        #expect(throws: BackupV14ExportError.self) {+        #expect(throws: BackupV15ExportError.self) {             try LibraryRepository.requireCitationsResolve(                 entries: [entry], memberships: [], titlePatterns: [], urlRules: [rule])         }         // Same rule, taught for the Entry's own site: legal.-        let sameSite = BackupV14URLRule(+        let sameSite = BackupV15URLRule(             id: ruleID, version: 1, isCurrent: true, createdAt: Self.epoch,             origin: .readerTaught,             definition: .work(locator: .query(name: ExactScalarString("identity"))),@@ -285,7 +285,7 @@ struct MultiSiteReviewFixTests {     @Test("A chapter rule taught for another site is refused too")     func exportGateRefusesACrossSitePatternCitation() throws {         let patternID = UUID()-        let pattern = BackupV14TitlePattern(+        let pattern = BackupV15TitlePattern(             id: patternID, siteHostname: "b.example", version: 1, isActive: true,             createdAt: Self.epoch,             definition: StoredPatternDefinition(definition: .wholeTitle))@@ -295,7 +295,7 @@ struct MultiSiteReviewFixTests {                 chapterTitle: try FieldProvenance(                     kind: .pattern, patternID: patternID))) -        #expect(throws: BackupV14ExportError.self) {+        #expect(throws: BackupV15ExportError.self) {             try LibraryRepository.requireCitationsResolve(                 entries: [entry], memberships: [], titlePatterns: [pattern], urlRules: [])         }@@ -303,9 +303,9 @@ struct MultiSiteReviewFixTests {      private static func wireEntry(         hostname: String, citations: EntryCitations-    ) -> BackupV14Entry {+    ) -> BackupV15Entry {         let url = "https://\(hostname)/one"-        return BackupV14Entry(+        return BackupV15Entry(             id: UUID(), captureTitle: "Chapter", captureTitleSource: .host, rawURL: url,             canonicalURL: nil, hostname: hostname, entryIdentityKey: url,             conservativeIdentityKey: url, identityBasis: .conservative, urlWorkIdentity: nil,
Packages/AsterismCore/Tests/AsterismCoreTests/PendingCaptureDrainTests.swift Modified +14 / -34
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/PendingCaptureDrainTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/PendingCaptureDrainTests.swiftindex 9231d806..aa687eec 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/PendingCaptureDrainTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/PendingCaptureDrainTests.swift@@ -518,22 +518,23 @@ struct PendingCaptureDrainTests {     }      /// Req 3.6: the commit uses the rules, sites and work types in force at-    /// commit time, not at share time. Asserted through the site mode because it-    /// is visible on the committed row: an articles-mode site sets-    /// `intentionallyUnattached`, and the site is taught *after* the share.+    /// commit time, not at share time. Asserted through the Work assignment+    /// because it is visible on the committed row: an untaught hostname assigns+    /// none, and the site is taught *after* the share.     @Test("A site taught between the share and the commit governs the commit")     func rulesInForceAtCommitTimeAreUsed() async throws {         let fixture = try DrainFixture()         _ = try await fixture.preserve("https://ex.com/read/1", sharedAt: DrainFixture.shareInstant)         // The reader teaches the site while the capture is waiting.-        try fixture.seedArticlesSite()+        try fixture.seedTaughtSite()          let report = await fixture.drain.drain()          #expect(report.newEntries == 1)         let committed = try #require(             fixture.entries().first { $0.id == report.committedEntryIDs.first })-        #expect(committed.intentionallyUnattached)+        #expect(committed.work != nil, "the rule taught after the share governs the commit")+        #expect(committed.workAssignmentProvenance == .pattern)     }      // MARK: - The sheet's own commit (Reqs 1.2, 5.3, Q34)@@ -596,33 +597,6 @@ struct PendingCaptureDrainTests {         #expect(after.classification == .silentlyResolvable)     } -    /// Decision 10, asserted rather than assumed: an articles-mode capture sets-    /// `intentionallyUnattached`, `authoredContent` applies no provenance gate to-    /// that flag, and so a drained articles row is *not* bare. Req 4.7 excludes-    /// articles sites for this reason, and the drain does not special-case them —-    /// doing so would make a drained articles capture differ from a directly-    /// captured one and break Req 3.1.-    @Test("A drained articles row becomes a variant, which is the documented exclusion")-    func aDrainedArticlesRowIsAVariant() async throws {-        let fixture = try DrainFixture()-        try fixture.seedArticlesSite()-        try fixture.seedEntry(id: UUID(), rawURL: "https://ex.com/read/1", note: "the reader's prose")-        try fixture.seedEntry(id: UUID(), rawURL: "https://ex.com/read/1", note: "the reader's prose")-        let before = try fixture.entryDuplicateSet()-        _ = try await fixture.preserve("https://ex.com/read/1", sharedAt: DrainFixture.shareInstant)--        let report = await fixture.drain.drain()--        #expect(report.newEntries == 1)-        let drained = try #require(-            fixture.entries().first { $0.id == report.committedEntryIDs.first })-        #expect(drained.intentionallyUnattached)-        let after = try fixture.entryDuplicateSet()-        #expect(before.variants.count == 1)-        #expect(after.variants.count == 2)-        #expect(after.classification == .divergent)-    }-     // MARK: - Pass bounds and overlap      /// Q24: the pass runs before first paint on activation and each record can@@ -1108,11 +1082,17 @@ private struct DrainFixture {         return first     } -    func seedArticlesSite() throws {+    /// A taught site holding one whole-title rule, so a capture committed after+    /// it exists is assigned to a Work named from the capture title.+    func seedTaughtSite() throws {         let context = ModelContext(container)         let site = Site(hostname: host)-        site.mode = .articles+        site.mode = .taught         context.insert(site)+        let pattern = try TitlePattern(+            version: 1, isActive: true, createdAt: Self.seedInstant,+            definition: .wholeTitle, site: site)+        context.insert(pattern)         try context.save()     } 
Packages/AsterismCore/Tests/AsterismCoreTests/PlaceDuplicateMachineryTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/PlaceDuplicateMachineryTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/PlaceDuplicateMachineryTests.swiftindex 02908671..ed5eba23 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/PlaceDuplicateMachineryTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/PlaceDuplicateMachineryTests.swift@@ -272,8 +272,8 @@ struct PlaceConvergenceTests {             M5SeedPlace(id: Self.harbour, name: "Harbour", note: "quay", workID: Self.workID),         ]) -        await #expect(throws: BackupV14ExportError.self) {-            _ = try await fixture.repository.backupV14Snapshot()+        await #expect(throws: BackupV15ExportError.self) {+            _ = try await fixture.repository.backupV15Snapshot()         }         withExtendedLifetime(fixture) {}     }
Packages/AsterismCore/Tests/AsterismCoreTests/RecordRowTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/RecordRowTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/RecordRowTests.swiftindex e448d6c3..4a5bfd9c 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/RecordRowTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/RecordRowTests.swift@@ -97,7 +97,7 @@ struct RecordRowTests {     @Test("make(imported:) carries the record, and attach(to: nil) leaves ownership alone")     func importedRecordAttaches() async throws {         let fixture = try await seeded([])-        let record = BackupV14Character(+        let record = BackupV15Character(             id: Self.hanna, workID: Self.workID, name: "Hanna", nameKey: "hanna",             aliases: ["Hanne"], note: "the lead",             facts: [RecordFact(@@ -144,7 +144,7 @@ struct RecordRowTests {             #expect(rows.first?.kindRaw == CharacterSuppressionKind.candidate.rawValue)             #expect(rows.first?.statusRaw == CharacterSuppressionStatus.active.rawValue) -            let imported = CharacterSuppression.make(imported: BackupV14Suppression(+            let imported = CharacterSuppression.make(imported: BackupV15Suppression(                 id: Self.absent, workID: Self.workID, kindRaw: "fact", nameKey: "bruce",                 sourceKindRaw: "genericNotes", sourceEntryID: nil, evidence: "he left",                 statusRaw: "cleared", actionAt: M5Fixture.epoch))
Packages/AsterismCore/Tests/AsterismCoreTests/RefreshUnionInvariantTests.swift Modified +2 / -3
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/RefreshUnionInvariantTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/RefreshUnionInvariantTests.swiftindex 4290d984..8c4dc184 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/RefreshUnionInvariantTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/RefreshUnionInvariantTests.swift@@ -19,7 +19,7 @@ import Testing /// /// What that would actually re-enable is asserted here rather than assumed: /// capture would start applying an illegal Site's rules again-/// (`+ReparseCapture.swift:284`, `:396`), and `BackupV14Exporter.swift:41` would+/// (`+ReparseCapture.swift:284`, `:396`), and `BackupV15Exporter.swift:41` would /// stop gating. The four Req 3.4 write-path guards read /// `diagnostics.diagnoses` for `.duplicateSiteRows` (Q41), a class the scan does /// re-derive, so they are the weaker half of the assertion — pinned anyway,@@ -108,7 +108,7 @@ struct RefreshUnionInvariantTests {         #expect(await repository.quarantineReason(hostname: tupleHost) != nil)         for attempt in 0...2 {             if attempt > 0 { try await repository.refreshDiagnostics() }-            let payload = try await repository.backupV14Snapshot()+            let payload = try await repository.backupV15Snapshot()             // One wire Site per hostname, including the duplicated one and the             // rowless one (Q38, Q40).             #expect(Set(payload.sites.map(\.hostname))@@ -139,7 +139,6 @@ struct RefreshUnionInvariantTests {                 hostname: duplicatedHost, request: request)             _ = try await repository.projectInitialTeaching(                 hostname: duplicatedHost, patternDefinition: try Self.wcSegment())-            _ = try await repository.projectArticles(hostname: duplicatedHost, junkSuffixRule: nil)         }     } 
Packages/AsterismCore/Tests/AsterismCoreTests/RepositoryTeachingTests.swift Modified +35 / -133
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/RepositoryTeachingTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/RepositoryTeachingTests.swiftindex 193cbb87..df2996c4 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/RepositoryTeachingTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/RepositoryTeachingTests.swift@@ -555,6 +555,41 @@ struct RepositoryReparseTests {         #expect(entry.workID != nil)     } +    /// `remove-article-mode` Req 2.2: neither a capture nor a re-parse writes+    /// `intentionallyUnattached`. The flag is the reader's own — "leave+    /// unattached" writes it with manual provenance and nothing else may.+    @Test("Capture and re-parse never mark an Entry intentionally unattached")+    func captureAndReparseNeverUnattach() async throws {+        let fixture = try await TeachingFixture()++        // Untaught: no rule at all applies.+        let untaught = try await fixture.capture(+            title: "Ch1 - Fiction | Site", rawURL: "https://example.com/1")+        #expect(!untaught.intentionallyUnattached)++        let definition = PatternDefinition.segment(+            work: try SegmentRangeSpec(origin: .end, offset: 1, length: 1),+            ignored: [try SegmentPositionSpec(origin: .end, offset: 0)]+        )+        _ = try await fixture.repository.commitTeaching(+            try await fixture.repository.projectInitialTeaching(+                hostname: "example.com", patternDefinition: definition))++        // Taught: the rule applies, and still writes no unattachment.+        let taught = try await fixture.capture(+            title: "Ch2 - Fiction | Site", rawURL: "https://example.com/2")+        #expect(!taught.intentionallyUnattached)++        try await fixture.clearPatternFields(entryID: untaught.id)+        let contract = try await fixture.repository.projectReparse(entryID: untaught.id)+        guard case .committed = try await fixture.repository.commitReparse(contract) else {+            Issue.record("expected the re-parse to commit")+            return+        }+        let reparsed = try await fixture.repository.entry(id: untaught.id)+        #expect(!reparsed.intentionallyUnattached)+    }+     @Test("Re-parse stale: preview, mutate Work, commit old → refreshed, no save, no mutation")     func reparseStale() async throws {         let save = InstrumentedSaveStrategy()@@ -1176,139 +1211,6 @@ struct RepositoryEntryTeachingDetailTests {     } } -// MARK: - M2.2 articles mode--@Suite("Repository articles-mode transactions", .serialized)-struct RepositoryArticlesModeTests {-    @Test("Articles transition is atomic, deactivates patterns, preserves manual fields, and cleans presentation")-    func transitionAndPresentation() async throws {-        let save = InstrumentedSaveStrategy()-        let fixture = try await TeachingFixture(saveStrategy: save, capabilities: .m2_2)-        let manualChapterEntry = try await fixture.capture(-            title: "Chapter 1 - Fiction | Example Site",-            rawURL: "https://example.com/1"-        )-        let manualAssignmentEntry = try await fixture.capture(-            title: "Chapter 2 - Fiction | Example Site",-            rawURL: "https://example.com/2"-        )-        let definition = PatternDefinition.segment(-            work: try SegmentRangeSpec(origin: .end, offset: 1, length: 1),-            ignored: [try SegmentPositionSpec(origin: .end, offset: 0)]-        )-        _ = try await fixture.repository.commitTeaching(-            try await fixture.repository.projectInitialTeaching(-                hostname: "example.com",-                patternDefinition: definition-            )-        )-        try await fixture.seedManualChapter(entryID: manualChapterEntry.id, chapter: "Curated chapter")-        let manualWork = try await fixture.repository.createWork(-            NewWorkDraft(displayTitle: "Curated Work", hostname: "example.com")-        )-        try await fixture.repository.moveEntry(manualAssignmentEntry.id, to: .existing(manualWork.id))-        save.resetCounts()--        let derivedRule = try ArticleTitleCleaner.deriveRule(-            from: manualChapterEntry.captureTitle,-            suffixSegmentCount: 1-        )-        let rule = try #require(derivedRule)-        let contract = try await fixture.repository.projectArticles(-            hostname: "example.com",-            junkSuffixRule: rule-        )-        #expect(contract.outcome.plan.entryProjections.allSatisfy { !$0.actionableAfter })--        let result = try await fixture.repository.commitArticles(contract)-        guard case .committed = result else {-            Issue.record("Expected committed articles transition, got \(result)")-            return-        }-        #expect(save.attemptCount == 1)-        let committedMode = try await fixture.siteMode(hostname: "example.com")-        let activePatternCount = try await fixture.activePatternCount(hostname: "example.com")-        #expect(committedMode == .articles)-        #expect(activePatternCount == 0)--        let first = try await fixture.repository.entry(id: manualChapterEntry.id)-        #expect(first.captureTitle == manualChapterEntry.captureTitle)-        #expect(first.chapterTitle == "Curated chapter")-        #expect(first.chapterTitleProvenance.kind == .manual)-        #expect(first.workID == nil)-        #expect(first.workAssignmentProvenance.kind == .none)-        #expect(first.intentionallyUnattached)--        let second = try await fixture.repository.entry(id: manualAssignmentEntry.id)-        #expect(second.chapterTitle == nil)-        #expect(second.chapterTitleProvenance.kind == .none)-        #expect(second.workID == manualWork.id)-        #expect(second.workAssignmentProvenance.kind == .manual)-        #expect(!second.intentionallyUnattached)--        let recent = try await fixture.repository.todayPresentation(calendar: .current)-        #expect(recent.actionableCount == 0)-        #expect(recent.allRows.allSatisfy { $0.siteMode == .articles && !$0.isActionable })-        #expect(recent.allRows.contains { $0.id == first.id && $0.captureTitle == "Chapter 1 - Fiction" })-    }--    @Test("Stale articles confirmation writes nothing and returns a complete refreshed projection")-    func staleTransition() async throws {-        let save = InstrumentedSaveStrategy()-        let fixture = try await TeachingFixture(saveStrategy: save, capabilities: .m2_2)-        let entry = try await fixture.capture(title: "Article - Site", rawURL: "https://example.com/1")-        let derivedRule = try ArticleTitleCleaner.deriveRule(from: entry.captureTitle, suffixSegmentCount: 1)-        let rule = try #require(derivedRule)-        let contract = try await fixture.repository.projectArticles(hostname: "example.com", junkSuffixRule: rule)-        _ = try await fixture.capture(title: "Another - Site", rawURL: "https://example.com/2")-        save.resetCounts()--        let result = try await fixture.repository.commitArticles(contract)-        guard case .refreshed(let refreshed) = result else {-            Issue.record("Expected refreshed articles contract, got \(result)")-            return-        }-        #expect(save.attemptCount == 0)-        #expect(refreshed.outcome.plan.entryProjections.count == 2)-        let currentMode = try await fixture.siteMode(hostname: "example.com")-        #expect(currentMode == .untaught)-    }--    @Test("Future article capture is intentionally unattached, non-actionable, and keeps immutable evidence")-    func futureCapture() async throws {-        let fixture = try await TeachingFixture(capabilities: .m2_2)-        let seed = try await fixture.capture(title: "Article - Site", rawURL: "https://example.com/1")-        let derivedRule = try ArticleTitleCleaner.deriveRule(from: seed.captureTitle, suffixSegmentCount: 1)-        let rule = try #require(derivedRule)-        _ = try await fixture.repository.commitArticles(-            try await fixture.repository.projectArticles(hostname: "example.com", junkSuffixRule: rule)-        )--        let contract = try await fixture.repository.projectCapture(-            hostname: "example.com",-            captureTitle: "Future Article - Site",-            captureTitleSource: .safariDocument,-            rawURLString: "https://example.com/2",-            canonicalURLString: nil,-            note: "",-            rating: nil-        )-        #expect(contract.outcome.displayTitle == "Future Article")-        #expect(contract.outcome.intentionallyUnattached)-        #expect(!contract.outcome.actionable)--        let result = try await fixture.repository.commitCapture(contract)-        guard case .committed(let captured) = result else {-            Issue.record("Expected committed article capture")-            return-        }-        #expect(captured.captureTitle == "Future Article - Site")-        #expect(captured.chapterTitle == nil)-        #expect(captured.workID == nil)-        #expect(captured.intentionallyUnattached)-    }-}- @Suite("Repository M2.3 phrase integration", .serialized) struct RepositoryPhraseIntegrationTests {     private var phraseDefinition: PatternDefinition {
Packages/AsterismCore/Tests/AsterismCoreTests/RetiredUnreadableRuleTests.swift Modified +6 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/RetiredUnreadableRuleTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/RetiredUnreadableRuleTests.swiftindex faff70d4..464d650c 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/RetiredUnreadableRuleTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/RetiredUnreadableRuleTests.swift@@ -107,8 +107,12 @@ struct RetiredUnreadableRuleTests {         try addRetiredPattern(fixture) { $0.definitionData = nil }          let repository = fixture.undiagnosedRepository()-        let contract = try await repository.projectArticles(-            hostname: UnreadableRuleFixture.hostname, junkSuffixRule: nil)+        let boundary = try #require(+            try fixture.freshContext().fetch(FetchDescriptor<Entry>()).first).id+        let contract = try await repository.projectReplacement(+            hostname: UnreadableRuleFixture.hostname,+            patternDefinition: .wholeTitle,+            boundaryEntryID: boundary)         // The retired row is left out; the active one is the basis.         #expect(contract.basis.patterns.count == 1)         #expect(contract.basis.patterns.first?.isActive == true)
Packages/AsterismCore/Tests/AsterismCoreTests/RuleOrderingTests.swift Modified +9 / -5
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/RuleOrderingTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/RuleOrderingTests.swiftindex cf10f465..a648b15d 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/RuleOrderingTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/RuleOrderingTests.swift@@ -57,11 +57,15 @@ struct RuleOrderingTests {     func teachingBasisOrdersByCreatedAt() async throws {         let fixture = try OrderingFixture()         let ids = try fixture.seedThreePatterns()--        // Any projection will do: all of them build the same basis, and the-        // articles one has the fewest preconditions on a taught Site.-        let contract = try await fixture.repository()-            .projectArticles(hostname: OrderingFixture.hostname, junkSuffixRule: nil)+        let boundary = try fixture.seedEntry()++        // Any projection over `buildTeachingBasis` will do: they all build the+        // same basis, and the replacement one is the shortest route to it on a+        // taught Site.+        let contract = try await fixture.repository().projectReplacement(+            hostname: OrderingFixture.hostname,+            patternDefinition: .wholeTitle,+            boundaryEntryID: boundary)         #expect(contract.basis.patterns.map(\.id) == [ids.alpha, ids.beta, ids.gamma])     } 
Packages/AsterismCore/Tests/AsterismCoreTests/RuleSelectionTests.swift Modified +1 / -1
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/RuleSelectionTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/RuleSelectionTests.swiftindex 34a3f51f..97dee16c 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/RuleSelectionTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/RuleSelectionTests.swift@@ -98,7 +98,7 @@ struct RuleSelectionTests {     /// hands back the same registered objects in the same order every time,     /// which is a property of that context, not of the accessor.     private func container() throws -> ModelContainer {-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         return try ModelContainer(             for: schema,             configurations: [ModelConfiguration(
Packages/AsterismCore/Tests/AsterismCoreTests/RuleSuggestionCandidatesTests.swift Modified +1 / -3
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/RuleSuggestionCandidatesTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/RuleSuggestionCandidatesTests.swiftindex a1865719..5ec0d47e 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/RuleSuggestionCandidatesTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/RuleSuggestionCandidatesTests.swift@@ -74,7 +74,7 @@ struct RuleSuggestionCandidatesTests {         // Seeded backwards: the rows come out of a dictionary of winners, so         // only an explicit sort can put them back in hostname order.         try fixture.seed { context in-            insertSite(context, hostname: "c.example", mode: .articles)+            insertSite(context, hostname: "c.example", mode: .untaught)             insertSite(context, hostname: "b.example", mode: .untaught)             insertSite(context, hostname: "a.example", mode: .untaught)         }@@ -120,14 +120,12 @@ struct RuleSuggestionCandidatesTests {             insertSite(context, hostname: "untaught.example", mode: .untaught)             let taught = insertSite(context, hostname: "taught.example", mode: .taught)             try insertTitlePattern(context, site: taught, version: 1, isActive: true)-            insertSite(context, hostname: "articles.example", mode: .articles)         }          let rows = try await fixture.repository.ruleSuggestionCandidates(hostnames: nil)          #expect(try candidate(rows, "untaught.example").siteMode == .untaught)         #expect(try candidate(rows, "taught.example").siteMode == .taught)-        #expect(try candidate(rows, "articles.example").siteMode == .articles)     }      @Test("Rule ids come from the active title pattern and the current URL rule")
Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swiftindex b0d985ab..b10dfb12 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/SiteReconcilerTests.swift@@ -453,12 +453,12 @@ private final class ReconcilerStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismSiteReconciler-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         context = ModelContext(container)         self.saveStrategy = saveStrategy ?? saveRecorder
Packages/AsterismCore/Tests/AsterismCoreTests/SiteUnionProjectionTests.swift Modified +55 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/SiteUnionProjectionTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/SiteUnionProjectionTests.swiftindex bc5319a1..5280bf6a 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/SiteUnionProjectionTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/SiteUnionProjectionTests.swift@@ -108,6 +108,59 @@ struct SiteUnionProjectionTests {         #expect(projected.patterns.count(where: \.isActive) == 1)     } +    /// `remove-article-mode` Req 3.5: the election is between the two modes, and+    /// what decides it is the kept active pattern rather than any row's mode+    /// column. Two rows that disagree in their columns, the surviving one+    /// claiming `untaught` while owning the active pattern, still elect+    /// `.taught`; and a set whose columns claim `taught` while no row owns a+    /// rule at all elects `.untaught`.+    @Test("The kept active pattern elects taught over rows whose columns say untaught")+    func keptActivePatternElectsTaught() throws {+        let store = try ProjectionStore()+        let rows = try store.makeRows([+            SiteUnionRowSpec(mode: .taught),+            SiteUnionRowSpec(patterns: [(version: 1, active: true)], mode: .untaught),+        ])++        let projected = SiteUnionProjection.project(hostname: ProjectionStore.hostname, rows: rows)++        #expect(projected.survivor === rows[1], "the row owning the active rule survives")+        #expect(projected.mode == .taught)+    }++    @Test("A set whose columns claim taught but owns no rule elects untaught")+    func columnsWithoutRulesElectUntaught() throws {+        let store = try ProjectionStore()+        let rows = try store.makeRows([+            SiteUnionRowSpec(mode: .taught), SiteUnionRowSpec(mode: .taught),+        ])++        let projected = SiteUnionProjection.project(hostname: ProjectionStore.hostname, rows: rows)++        #expect(projected.mode == .untaught)+    }++    /// A row whose `modeRaw` holds a spelling this build has no case for reads+    /// as `.untaught` (`ToleratedEnum`), so no third answer can leave the+    /// election. The row keeps a retained-but-inactive pattern on purpose: that+    /// is the arm where the election falls through to the survivor's own column+    /// instead of answering from the kept active rule, so the raw reading is+    /// what the result turns on. The suite that spells the retired value is+    /// `UnknownSiteModeTests` (Req 7.2); any unknown spelling reads the same.+    @Test("A survivor holding an unknown raw mode projects untaught")+    func unknownRawModeProjectsUntaught() throws {+        let store = try ProjectionStore()+        let rows = try store.makeRows([+            SiteUnionRowSpec(patterns: [(version: 1, active: false)], mode: .taught)+        ])+        rows[0].modeRaw = "a-mode-this-build-has-no-case-for"++        let projected = SiteUnionProjection.project(hostname: ProjectionStore.hostname, rows: rows)++        #expect(projected.survivor === rows[0])+        #expect(projected.mode == .untaught)+    }+     // MARK: - Q6: the archived name follows the name rule, not the survivor      @Test("A name only a losing row carries reaches the archived Site")@@ -376,12 +429,12 @@ private final class ProjectionStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismSiteUnion-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         context = ModelContext(container)     }
Packages/AsterismCore/Tests/AsterismCoreTests/SitesListReadTests.swift Modified +5 / -10
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/SitesListReadTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/SitesListReadTests.swiftindex fd2bd401..48dcc7fb 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/SitesListReadTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/SitesListReadTests.swift@@ -15,7 +15,7 @@ struct SitesListReadTests {         #expect(try await fixture.repository.sites().isEmpty)     } -    @Test("Every stored site appears once per hostname, in all three modes (6.1)")+    @Test("Every stored site appears once per hostname, in both modes (6.1)")     func allModesOneRowPerHostname() async throws {         let fixture = try await M5Fixture()         try await fixture.repository.seedM5Rows(sites: [@@ -23,20 +23,15 @@ struct SitesListReadTests {             M5SeedSite(                 hostname: "taught.test", displayName: "Middle Site", mode: .taught,                 wholeTitleRule: true),-            M5SeedSite(-                hostname: "articles.test", displayName: "Zulu Site", mode: .articles,-                junkExample: "Story — Zulu Site"),         ])          let sites = try await fixture.repository.sites()-        #expect(sites.map(\.hostname) == ["untaught.test", "taught.test", "articles.test"])-        #expect(sites.map(\.mode) == [.untaught, .taught, .articles])-        #expect(sites.map(\.displayName) == ["Alpha Site", "Middle Site", "Zulu Site"])-        // The taught row's active pattern is disclosed; the articles row's junk-        // rule is what its screen needs to describe the mode.+        #expect(sites.map(\.hostname) == ["untaught.test", "taught.test"])+        #expect(sites.map(\.mode) == [.untaught, .taught])+        #expect(sites.map(\.displayName) == ["Alpha Site", "Middle Site"])+        // The taught row's active pattern is disclosed.         #expect(sites[0].patternIDs.isEmpty)         #expect(sites[1].patternIDs.count == 1)-        #expect(sites[2].junkSuffixRule != nil)     }      @Test("Duplicate Site rows resolve to the hostname's winner, not to two rows (Q24)")
Packages/AsterismCore/Tests/AsterismCoreTests/StoreMetadataTests.swift Modified +5 / -5
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/StoreMetadataTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/StoreMetadataTests.swiftindex 1dcca5bc..14fdecfc 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/StoreMetadataTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/StoreMetadataTests.swift@@ -199,17 +199,17 @@ struct StoreMetadataTests {     @Test("A conversion still in the write-ahead log is read from the log, not the main file")     func uncommittedConversionIsReadFromTheLog() throws {         let dir = try TempDir()-        try V14RecordedStoreFixture.install(at: dir.storeURL)+        try V15RecordedStoreFixture.install(at: dir.storeURL)         #expect(StoreMetadata.recordedVersion(at: dir.storeURL) == .atOrAboveV5,                 "the premise: the seed is a store the classifier admits")-        #expect(try V4RecordedStoreFixture.recordedModelVersions(at: dir.storeURL) == ["14.0.0"])+        #expect(try V4RecordedStoreFixture.recordedModelVersions(at: dir.storeURL) == ["15.0.0"])          let container = try LibraryRepository.openContainer(at: dir.storeURL)         _ = ModelContext(container)         try #require(FileManager.default.fileExists(atPath: dir.storeURL.path + "-wal"),                      "the conversion has to be in the log for this to be the hazard") -        #expect(try V4RecordedStoreFixture.recordedModelVersions(at: dir.storeURL) == ["15.0.0"],+        #expect(try V4RecordedStoreFixture.recordedModelVersions(at: dir.storeURL) == ["16.0.0"],                 "the conversion is committed in the log, so a reader of the log sees it")         #expect(StoreMetadata.recordedVersion(at: dir.storeURL) == .atOrAboveV5,                 "a reader that ignored the log would still have to answer, not refuse")@@ -302,7 +302,7 @@ struct StoreMetadataTests {     @Test("The fixture's version reader waits out a closing connection too")     func theFixtureReaderWaitsOutAClosingConnection() async throws {         let dir = try TempDir()-        try V14RecordedStoreFixture.install(at: dir.storeURL)+        try V15RecordedStoreFixture.install(at: dir.storeURL)         StoreSettling.foldWriteAheadLog(at: dir.storeURL)         let lock = try HeldStoreLock(at: dir.storeURL) @@ -311,7 +311,7 @@ struct StoreMetadataTests {         try await Task.sleep(for: Self.lockHold)         lock.release() -        #expect(try await versions == ["14.0.0"])+        #expect(try await versions == ["15.0.0"])         withExtendedLifetime(dir) {}     } }
Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailBytesReachTests.swift Modified +4 / -3
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailBytesReachTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailBytesReachTests.swiftindex 7e3fc98c..949a3ad6 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailBytesReachTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailBytesReachTests.swift@@ -30,12 +30,13 @@ struct ThumbnailBytesReachTests {     /// The Core sources allowed to name it, and why each one may.     ///     /// * `Models.swift` — the declaration itself, plus the accessors beside it.-    /// * `AsterismSchemaV14.swift` — the frozen snapshot, which **declares** the+    /// * `AsterismSchemaV15.swift` — the frozen snapshot, which **declares** the     ///   column with its `.externalStorage` attribute and reads nothing: a     ///   snapshot carries stored columns and no accessors at all. It is on the     ///   list because a freeze that dropped the attribute would change the     ///   stored shape of a schema every installed library is matched on-    ///   (`update-schedule`, the V14 freeze).+    ///   (`remove-article-mode`, the V15 freeze; `update-schedule`, the V14 one+    ///   before it).     /// * `ThumbnailStoreProbe.swift` — the Decision 2 probe's **own** two     ///   models, `ProbeExternalWork` and `ProbeInlineWork`, which share the     ///   property name on purpose: the probe measures what that shape costs.@@ -76,7 +77,7 @@ struct ThumbnailBytesReachTests {     ///   the cost of *not* reading.     private static let sanctioned: Set<String> = [         "Models.swift",-        "AsterismSchemaV14.swift",+        "AsterismSchemaV15.swift",         "GroupOrdering.swift",         "Thumbnails/ThumbnailStoreProbe.swift",         "LibraryRepository+Thumbnails.swift",
Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailIdentityTests.swift Modified +1 / -1
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailIdentityTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailIdentityTests.swiftindex e71d4973..7a882a8d 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailIdentityTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailIdentityTests.swift@@ -34,7 +34,7 @@ struct ThumbnailIdentityTests {         #expect(ToleratedEnum.read("hexagon") as ThumbnailShape? == nil)     } -    /// The raw spellings are stored bytes, frozen at V14 (`AsterismSchemaV15`'s+    /// The raw spellings are stored bytes, frozen at V14 (`AsterismSchemaV16`'s     /// header), and the pixel sizes are Req 1.2's hard invariant.     @Test("ThumbnailShape's raw spellings and pixel sizes are the stored contract")     func shapeContract() {
Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailStoreProbeTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailStoreProbeTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailStoreProbeTests.swiftindex 571068cb..ea11c886 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailStoreProbeTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/ThumbnailStoreProbeTests.swift@@ -55,8 +55,8 @@ struct ThumbnailStoreProbeTests {         let probeNames = Set(ThumbnailStoreProbe.schema.entities.map(\.name))         #expect(probeNames == ["ProbeExternalWork", "ProbeInlineWork"]) -        let live = Set(Schema(versionedSchema: AsterismSchemaV15.self).entities.map(\.name))-        let frozen = Set(Schema(versionedSchema: AsterismSchemaV14.self).entities.map(\.name))+        let live = Set(Schema(versionedSchema: AsterismSchemaV16.self).entities.map(\.name))+        let frozen = Set(Schema(versionedSchema: AsterismSchemaV15.self).entities.map(\.name))         #expect(live.isDisjoint(with: probeNames))         #expect(frozen.isDisjoint(with: probeNames))     }
Packages/AsterismCore/Tests/AsterismCoreTests/URLOptionalSequenceTests.swift Modified +15 / -15
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/URLOptionalSequenceTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/URLOptionalSequenceTests.swiftindex cc4b6216..5b653551 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/URLOptionalSequenceTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/URLOptionalSequenceTests.swift@@ -890,7 +890,7 @@ struct URLOptionalSequenceReconcilerTests { @Suite("Optional chapter sequence — archive") struct URLOptionalSequenceArchiveTests { -  private static func combinedRule(of payload: BackupV14Payload) throws -> URLTwoFieldTemplate? {+  private static func combinedRule(of payload: BackupV15Payload) throws -> URLTwoFieldTemplate? {     guard case .combined(_, let template) = try #require(payload.urlRules.first).definition else {       return nil     }@@ -903,12 +903,12 @@ struct URLOptionalSequenceArchiveTests {   /// so this asserts the asymmetric `Codable` from the reading side.   @Test("A pre-feature archive decodes, and its combined rule is still required")   func preFeatureArchiveDecodes() throws {-    let document = BackupV14Fixtures.sequencePresenceOmittedDocument()+    let document = BackupV15Fixtures.sequencePresenceOmittedDocument()     #expect(!String(decoding: document, as: UTF8.self).contains("sequencePresence")) -    let decoded = try BackupV14Codec.decode(document)+    let decoded = try BackupV15Codec.decode(document) -    #expect(decoded.payload == BackupV14Fixtures.combinedRulePayload(presence: .required))+    #expect(decoded.payload == BackupV15Fixtures.combinedRulePayload(presence: .required))     #expect(try Self.combinedRule(of: decoded.payload)?.sequencePresence == .required)   } @@ -917,17 +917,17 @@ struct URLOptionalSequenceArchiveTests {   /// this feature would produce — which is what keeps it importable there.   @Test("An archive with no declared-optional rule encodes the pre-feature bytes")   func requiredArchiveIsByteIdenticalToPreFeature() throws {-    let encoded = try BackupV14Codec.encode(-      payload: BackupV14Fixtures.combinedRulePayload(presence: .required),-      metadata: BackupV14Metadata(-        appBuild: "pre-feature", exportedAt: BackupV14Fixtures.created))+    let encoded = try BackupV15Codec.encode(+      payload: BackupV15Fixtures.combinedRulePayload(presence: .required),+      metadata: BackupV15Metadata(+        appBuild: "pre-feature", exportedAt: BackupV15Fixtures.created))     let json = String(decoding: encoded, as: UTF8.self)      #expect(!json.contains("sequencePresence"))     #expect(-      json.contains(BackupV14Fixtures.sequencePresenceOmittedPayloadJSON),+      json.contains(BackupV15Fixtures.sequencePresenceOmittedPayloadJSON),       "the exported payload is no longer the pre-feature payload")-    #expect(encoded == BackupV14Fixtures.sequencePresenceOmittedDocument())+    #expect(encoded == BackupV15Fixtures.sequencePresenceOmittedDocument())   }    /// Req 5.4: a declared-optional rule survives export and import unchanged. The@@ -935,17 +935,17 @@ struct URLOptionalSequenceArchiveTests {   /// `URLRulePattern` a reader would end up with, not merely a decoded value.   @Test("A declared-optional rule round-trips through export and import")   func optionalRuleRoundTripsThroughTheArchive() throws {-    let payload = BackupV14Fixtures.combinedRulePayload(presence: .optional)-    let encoded = try BackupV14Codec.encode(+    let payload = BackupV15Fixtures.combinedRulePayload(presence: .optional)+    let encoded = try BackupV15Codec.encode(       payload: payload,-      metadata: BackupV14Metadata(appBuild: "with-feature", exportedAt: BackupV14Fixtures.created))+      metadata: BackupV15Metadata(appBuild: "with-feature", exportedAt: BackupV15Fixtures.created))     #expect(String(decoding: encoded, as: UTF8.self).contains(#""sequencePresence":"optional""#)) -    let decoded = try BackupV14Codec.decode(encoded)+    let decoded = try BackupV15Codec.decode(encoded)     #expect(decoded.payload == payload)     #expect(try Self.combinedRule(of: decoded.payload)?.sequencePresence == .optional) -    let schema = Schema(versionedSchema: AsterismSchemaV15.self)+    let schema = Schema(versionedSchema: AsterismSchemaV16.self)     let container = try ModelContainer(       for: schema,       configurations: [
Packages/AsterismCore/Tests/AsterismCoreTests/UnknownSiteModeTests.swift Added +182 / -0
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/UnknownSiteModeTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/UnknownSiteModeTests.swiftnew file mode 100644index 00000000..c4946a8a--- /dev/null+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/UnknownSiteModeTests.swift@@ -0,0 +1,182 @@+import Foundation+import SwiftData+import Testing++@testable import AsterismCore++/// Req 3.4 of `remove-article-mode`: a `Site` row carrying a mode value this+/// build has no case for is handled as any other unknown mode value, and+/// `"articles"` is now one of those values.+///+/// **This suite is the one place the sources spell `articles`** (Req 7.2). It+/// writes the raw string into `modeRaw` rather than an enum case, because the+/// case is gone and the point is what happens to a row a *previous* build+/// wrote — or a device still running one syncs in.+///+/// The four consequences, all of them pre-existing behaviour for an unknown+/// mode: the hostname is quarantined under `.siteTuple` and reported by Library+/// Check, it is omitted from the sites list, the export refuses it by name, and+/// none of that stops the library opening or the readiness marker being+/// published.+@Suite("A Site row with an unknown mode value", .serialized)+struct UnknownSiteModeTests {++    private static let unknownHost = "articles.example"+    private static let knownHost = "taught.example"+    /// The raw column value a build that still had the mode would have written.+    private static let retiredModeRaw = "articles"++    // MARK: - Fixture++    private final class Root {+        let url: URL+        let configuration: LibraryConfiguration+        private var containers: [ModelContainer] = []++        init() throws {+            url = FileManager.default.temporaryDirectory+                .appending(path: "UnknownSiteMode-\(UUID())", directoryHint: .isDirectory)+            try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)+            configuration = LibraryConfiguration(rootDirectory: url)+            try FileManager.default.createDirectory(+                at: configuration.storeURL.deletingLastPathComponent(),+                withIntermediateDirectories: true)+        }++        deinit { try? FileManager.default.removeItem(at: url) }++        /// One Site holding the retired raw value beside one ordinary untaught+        /// Site, written straight into the store — no write path produces this.+        ///+        /// `markerGeneration` is what a device holds when it reaches this+        /// library. The default is the current generation, which classifies+        /// `.ready` and is all the quarantine cases need. Seeding the *lagging*+        /// generation instead is what sends `openForApp` down the certifying+        /// arm, so a test of the marker actually watches it move.+        func seed(+            markerGeneration: String = LibraryRepository.extensionOpenableMarkerVersion+        ) throws {+            let container = try LibraryRepository.openContainer(at: configuration.storeURL)+            let context = ModelContext(container)++            let retired = Site(hostname: UnknownSiteModeTests.unknownHost)+            retired.modeRaw = UnknownSiteModeTests.retiredModeRaw+            context.insert(retired)+            let rawURL = "https://\(UnknownSiteModeTests.unknownHost)/one"+            let entry = Entry(+                captureTitle: "A Page", captureTitleSource: .host, rawURLString: rawURL,+                hostname: UnknownSiteModeTests.unknownHost, entryIdentityKey: rawURL,+                timestamp: Date(timeIntervalSince1970: 10))+            entry.conservativeIdentityKey = rawURL+            context.insert(entry)++            let known = Site(hostname: UnknownSiteModeTests.knownHost)+            known.mode = .untaught+            context.insert(known)++            try context.save()+            try SiteRelationshipPopulationPass.run(context: context)+            withExtendedLifetime(container) {}+            try Data("\(markerGeneration)\n".utf8)+                .write(to: configuration.readinessMarkerURL, options: .atomic)+        }++        func markerText() throws -> String {+            try String(contentsOf: configuration.readinessMarkerURL, encoding: .utf8)+                .trimmingCharacters(in: .whitespacesAndNewlines)+        }++        func openForApp() async throws -> LibraryRepository {+            let (_, repository) = try await LibraryRepository.openForApp(+                configuration, capabilities: .multiSite,+                clock: FixedRepositoryClock(Date(timeIntervalSince1970: 1_800_000_000)),+                saveStrategy: ModelContextSaveStrategy())+            return repository+        }+    }++    // MARK: - Tests++    @Test("The hostname is quarantined under the Site-tuple diagnosis and reported by Library Check")+    func unknownModeQuarantinesItsHostname() async throws {+        let root = try Root()+        try root.seed()++        let repository = try await root.openForApp()++        #expect(await repository.quarantineReason(hostname: Self.unknownHost) != nil)+        #expect(await repository.quarantineReason(hostname: Self.knownHost) == nil)+        let diagnostics = await repository.diagnostics+        #expect(diagnostics.quarantineMap()[Self.unknownHost] != nil)+        #expect(diagnostics.diagnoses.contains {+            if case .siteTuple(let hostname, _) = $0 { hostname == Self.unknownHost } else { false }+        })+        await repository.shutdown()+        withExtendedLifetime(root) {}+    }++    @Test("The hostname is omitted from the sites list")+    func unknownModeIsAbsentFromTheSitesList() async throws {+        let root = try Root()+        try root.seed()++        let repository = try await root.openForApp()++        let sites = try await repository.sites()+        #expect(sites.map(\.hostname) == [Self.knownHost])+        await repository.shutdown()+        withExtendedLifetime(root) {}+    }++    @Test("The export refuses the archive and names the hostname and the value")+    func unknownModeRefusesTheExport() async throws {+        let root = try Root()+        try root.seed()++        let repository = try await root.openForApp()++        do {+            _ = try await repository.backupV15Snapshot()+            Issue.record("expected the export to refuse a Site whose mode has no case")+        } catch let error as BackupV15ExportError {+            guard case .unrepresentableValue(let record, let field, let value) = error else {+                Issue.record("expected .unrepresentableValue, got \(error)")+                await repository.shutdown()+                return+            }+            #expect(record.contains(Self.unknownHost))+            #expect(field == "mode")+            #expect(value == Self.retiredModeRaw)+        }+        await repository.shutdown()+        withExtendedLifetime(root) {}+    }++    /// Seeded at the *lagging* generation so the open takes the certifying arm+    /// of `act(on:)` — the one that validates the store and then publishes. A+    /// library seeded at the current generation classifies `.ready` and+    /// republishes nothing, so asserting the marker there would only re-read+    /// what the seed wrote.+    @Test("The library still opens and the certifying arm still publishes the marker")+    func unknownModeDoesNotStopTheBootstrap() async throws {+        let root = try Root()+        try root.seed(markerGeneration: LibraryRepository.laggingOpenableMarkerVersion)++        #expect(try LibraryRepository.classify(root.configuration, fileManager: .default)+                == .markerLagging(generation: LibraryRepository.laggingOpenableMarkerVersion),+                "the seed must leave the certifying arm to run, not the ready one")++        let repository = try await root.openForApp()++        // The quarantine is a per-hostname diagnosis, never a refusal to open+        // and never a reason to withhold the marker: the validation the arm+        // gates on tolerates the unknown value, so the marker moves.+        #expect(try root.markerText() == LibraryRepository.extensionOpenableMarkerVersion)+        // And it moved over the row that carries the unknown value, not over a+        // library that had dropped or repaired it.+        #expect(try await repository.debugCounts().sites == 2)+        #expect(await repository.quarantineReason(hostname: Self.unknownHost) != nil)+        await repository.shutdown()+        withExtendedLifetime(root) {}+    }+}
Packages/AsterismCore/Tests/AsterismCoreTests/V15RecordedStoreFixture.swift Renamed +100 / -92
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/V14RecordedStoreFixture.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/V15RecordedStoreFixture.swiftsimilarity index 82%rename from Packages/AsterismCore/Tests/AsterismCoreTests/V14RecordedStoreFixture.swiftrename to Packages/AsterismCore/Tests/AsterismCoreTests/V15RecordedStoreFixture.swiftindex 7efa0dc5..7cc4f3aa 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/V14RecordedStoreFixture.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/V15RecordedStoreFixture.swift@@ -3,35 +3,36 @@ import SwiftData  @testable import AsterismCore -/// A store genuinely **recorded at 14.0.0**, seeded in-process through the-/// frozen `AsterismSchemaV14` snapshot — the library a device that ran the V14-/// build holds on the morning of the V15 update.+/// A store genuinely **recorded at 15.0.0**, seeded in-process through the+/// frozen `AsterismSchemaV15` snapshot — the library a device that ran the V15+/// build holds on the morning of the V16 update. ///-/// It succeeds `V5`/`V6`/…/`V13RecordedStoreFixture`, each of which went with-/// the stage that named it — V13's in this feature's freeze commit, once every-/// device was confirmed on marker `"14"` (`update-schedule`-/// `prerequisites.md`, ticked 2026-09-15). It is now the only convertible-/// fixture in the package; anything older than V14 fails closed.+/// It succeeds `V5`/`V6`/…/`V14RecordedStoreFixture`, each of which went with+/// the stage that named it — V14's in this feature's freeze commit, once every+/// device was confirmed on marker `"15"` (`remove-article-mode` Q10, confirmed+/// 2026-09-21). It is now the only convertible+/// fixture in the package; anything older than V15 fails closed. /// /// Seeding through the snapshot rather than committing a `.sqlite` is what the-/// nesting buys: a container over `AsterismSchemaV14` records 14.0.0 in the+/// nesting buys: a container over `AsterismSchemaV15` records 15.0.0 in the /// store's own metadata, and the fixture cannot drift out of sync with the /// snapshot it is built from. ///-/// **No `Work` row carries release days**, because V14 has no column to put them-/// in. That is the whole point of this fixture at V15: what the stage has to-/// produce is one **defaulted** `Work` column reading `[]` on every existing-/// row, with no table added and no data pass behind it, and-/// `V14RecordedStoreTests` asserts it on the **raw** column — the-/// `releaseDays` accessor answers an empty array whether or not the default ever-/// landed, exactly as `ToleratedEnum` would have at V10.+/// **`Site.junkSuffixRule` is seeded non-nil, and it is the point of this+/// fixture at V16.** V16 is the first *removing* stage since V8 → V9, so what+/// has to be observed is a populated column disappearing without taking+/// anything else with it: the seeded rule is a real `JunkSuffixRule` with two+/// anchors, written through the frozen snapshot, and on the far side of the+/// stage the live `Site` has no such property to read at all. That the column+/// is gone from the schema rather than merely nil is `ModelContractTests`'+/// delta pin; what `V15RecordedStoreTests` adds is that every other row and+/// field came through the removal unchanged. ///-/// The V14 additions the fixture *does* have — the three thumbnail columns, one-/// of them the schema's only external-storage attribute — are seeded for the-/// opposite reason, exactly as the V13 fixture seeded `Place` and-/// `PlaceSuppression` and the V12 one seeded `Creator`, `CreatorRole` and-/// `WorkCredit`: they are what the previous stage supplied, and a conversion-/// that lost them would be invisible if the fixture had left them nil. The bytes+/// Every column V15 *does* have is seeded away from its default for the+/// converse reason, `Work.releaseDaysRaw` included — V15's own addition, seeded+/// with two days rather than left at `[]`, so a removing stage that disturbed a+/// neighbouring column would show here. The three thumbnail columns are seeded+/// too, one of them the schema's only external-storage attribute: the bytes /// are a small opaque blob rather than a real JPEG — every thumbnail state is /// tolerated (`work-thumbnails` Req 1.8, Req 9.4), and what is asserted on the /// far side is that the three columns crossed unchanged, not that they decode.@@ -39,7 +40,7 @@ import SwiftData /// V13's two tables are seeded for the same reason: one `Place` naming the Work /// the fixture holds, and one `PlaceSuppression` in the candidate shape. ///-/// The rest of the inventory is the retired `V13RecordedStoreFixture`'s, carried+/// The rest of the inventory is the retired `V14RecordedStoreFixture`'s, carried /// forward unchanged: one row per entity, /// **except `Entry`, which gets three, and `TitlePattern`, which gets two**. /// Entry A carries the v2 identity arm and the URL-rule work assignment, Entry B@@ -48,8 +49,6 @@ import SwiftData /// reads as the default and is *reported* rather than quarantined (Q6, Q25 of /// `drop-superseded-columns`). The second title rule is the retired segment arm, /// so the `definitionData` blob is exercised on both arms.-/// `Site.junkSuffixRule` is seeded non-nil because it is the one composite-/// Codable `Site` still has. /// /// V7's and V8's tables ride through untouched, which is exactly why a /// `Character` with a fact, a `CharacterSuppression` and a `WorkDistinctPair`@@ -74,15 +73,17 @@ import SwiftData /// another suite's live container in use while this one holds the registration, /// and the package would abort rather than fail a test. ///-/// **And the ordering is the only thing holding it up**, as it has been since-/// V10. A stage that only *removed* left the live stored shape a subset of the-/// frozen one, so a live key a stale registration could not answer did not-/// exist. V15 **adds**: `Work.releaseDaysRaw` is a key this snapshot cannot-/// answer at all. The create-seed-save-release ordering below is what answers-/// that.-enum V14RecordedStoreFixture {-    static let hostname = "frozen14.example"-    static let siteDisplayName = "Frozen Fourteen"+/// **The ordering is still the thing holding it up**, even though V16 is the+/// first version since V9 whose live stored shape is a strict *subset* of the+/// frozen one — a removing stage leaves no live key a stale snapshot+/// registration could fail to answer. That subset relation is a second net, not+/// a replacement: the frozen registration can still answer `junkSuffixRule`,+/// which the live schema has no column for, and the next adding version loses+/// the subset again. The create-seed-save-release ordering below is what is+/// relied on.+enum V15RecordedStoreFixture {+    static let hostname = "frozen15.example"+    static let siteDisplayName = "Frozen Fifteen"     static let patternID = UUID(uuidString: "22222222-2222-2222-2222-00000000000e")!     static let patternVersion = 5     /// The Site's second, retired title rule — the segment arm. Inactive,@@ -107,17 +108,17 @@ enum V14RecordedStoreFixture {     static let workTypeID = UUID(uuidString: "66666666-6666-6666-6666-00000000000e")!     static let workTypeName = "Web Serial"     static let characterID = UUID(uuidString: "77777777-7777-7777-7777-00000000000e")!-    static let characterName = "Fourteen of Frozen"-    static let characterNameKey = "fourteen of frozen"-    static let characterAliases = ["Fourteen", "Frozen Fourteen"]+    static let characterName = "Fifteen of Frozen"+    static let characterNameKey = "fifteen of frozen"+    static let characterAliases = ["Fifteen", "Frozen Fifteen"]     static let characterNote = "The one the fixture names."     static let suppressionID = UUID(uuidString: "88888888-8888-8888-8888-00000000000e")!     static let suppressionNameKey = "the narrator"-    static let workName = "A Frozen Fourteen"-    static let genericNotes = "generic notes, recorded at 14.0.0"-    static let workURLString = "https://frozen14.example/series/99"+    static let workName = "A Frozen Fifteen"+    static let genericNotes = "generic notes, recorded at 15.0.0"+    static let workURLString = "https://frozen15.example/series/99"     static let workIdentity = "99"-    static let genreTags = ["frozen", "fourteen"]+    static let genreTags = ["frozen", "fifteen"]     static let timestamp = Date(timeIntervalSince1970: 1_845_000_000)      /// V10's three columns, seeded away from their defaults, exactly as the@@ -133,7 +134,7 @@ enum V14RecordedStoreFixture {     /// Both columns are optional, so nil is the default here.     static let seriesID = UUID(uuidString: "bbbbbbbb-bbbb-bbbb-bbbb-00000000000e")!     static let seriesName = "The Frozen Sequence"-    static let seriesNotes = "notes about the sequence, recorded at 14.0.0"+    static let seriesNotes = "notes about the sequence, recorded at 15.0.0"     static let seriesPosition = 2.5     static let linkID = UUID(uuidString: "cccccccc-cccc-cccc-cccc-00000000000e")!     /// The other end of the seeded link. No `Work` carries it, for the reason@@ -166,51 +167,59 @@ enum V14RecordedStoreFixture {     static let placeSuppressionID = UUID(uuidString: "2b2b2b2b-2b2b-2b2b-2b2b-00000000000e")!     static let placeSuppressionNameKey = "the unnamed hall" -    /// V14's own three `Work` columns, the last of which was the schema's first-    /// `@Attribute(.externalStorage)`. Seeded away from nil so the V14 → V15+    /// V14's three `Work` columns, the last of which was the schema's first+    /// `@Attribute(.externalStorage)`. Seeded away from nil so the V15 → V16     /// stage carrying them across is visible — including the sidecar the bytes     /// live in, which is the half a column-only assertion could not see.     ///     /// The bytes are a small opaque blob rather than a real JPEG. Every     /// thumbnail state is tolerated (`work-thumbnails` Req 1.8, Req 9.4), and-    /// what `V14RecordedStoreTests` asserts on the far side is that the three+    /// what `V15RecordedStoreTests` asserts on the far side is that the three     /// columns crossed unchanged — not that they decode, which is the codec's     /// own suite's question.     static let thumbnailShape = ThumbnailShape.portrait     static var thumbnailBytes: Data { Data(repeating: 0x0e, count: 4_096) }     static var thumbnailDigest: String { Hexadecimal.sha256(thumbnailBytes) } +    /// V15's own column, seeded **non-empty** rather than left at its `[]`+    /// default: it is the neighbour of the column V16 removes, and a removing+    /// stage that disturbed it would be invisible against a fixture that had+    /// left it empty. The raw spellings are what the store holds, so the array+    /// is written in canonical Monday-first order.+    static let releaseDays: [ReleaseDay] = [.monday, .thursday]+    static var releaseDaysRaw: [String] { releaseDays.map(\.rawValue) }+     static let trimPrefix = "Read: "-    static let trimSuffix = " | Frozen Fourteen"+    static let trimSuffix = " | Frozen Fifteen"     static let phraseSeparator = " — " -    static let entryANote = "Recorded at 14.0.0 ✓"+    static let entryANote = "Recorded at 15.0.0 ✓"     static let entryASequence = "11"     static let entryAChapterTitle = "Chapter 11"-    static let entryACaptureTitle = "Read: Chapter 11 — A Frozen Fourteen | Frozen Fourteen"-    static let entryARawURL = "https://frozen14.example/read?series=99&chapter=11"+    static let entryACaptureTitle = "Read: Chapter 11 — A Frozen Fifteen | Frozen Fifteen"+    static let entryARawURL = "https://frozen15.example/read?series=99&chapter=11" -    static let entryACanonicalURL = "https://frozen14.example/read?chapter=11&series=99"+    static let entryACanonicalURL = "https://frozen15.example/read?chapter=11&series=99" -    static let entryBNote = "Recorded at 14.0.0, name-keyed"+    static let entryBNote = "Recorded at 15.0.0, name-keyed"     static let entryBSequence = "12"     static let entryBChapterTitle = "Chapter 12"-    static let entryBCaptureTitle = "Read: Chapter 12 — A Frozen Fourteen | Frozen Fourteen"-    static let entryBRawURL = "https://frozen14.example/read?series=99&chapter=12"+    static let entryBCaptureTitle = "Read: Chapter 12 — A Frozen Fifteen | Frozen Fifteen"+    static let entryBRawURL = "https://frozen15.example/read?series=99&chapter=12"      /// Entry C is the nil-blob row: captured through the share extension by a     /// build that predates the blob and never rewritten, so its `citationsData`     /// is still absent. It reads as the default `EntryCitations`, which is why     /// its identity fields are the conservative, unassigned tuple.     static let entryCNote = "Captured before the citation blob existed"-    static let entryCCaptureTitle = "Read: Chapter 13 — A Frozen Fourteen | Frozen Fourteen"-    static let entryCRawURL = "https://frozen14.example/read?series=99&chapter=13"+    static let entryCCaptureTitle = "Read: Chapter 13 — A Frozen Fifteen | Frozen Fifteen"+    static let entryCRawURL = "https://frozen15.example/read?series=99&chapter=13"      /// The fact the seeded character carries, cited from Entry A — so the     /// `factsData` blob is genuinely populated rather than an empty array.     static var characterFact: RecordFact {         RecordFact(-            statement: "Fourteen is the narrator.", quote: "I am Fourteen.",+            statement: "Fifteen is the narrator.", quote: "I am Fifteen.",             nameKey: characterNameKey, source: .entry(entryAID))     } @@ -262,9 +271,12 @@ enum V14RecordedStoreFixture {         }     } -    /// The Site's `junkSuffixRule` — the one composite Codable `Site` still-    /// carries, seeded non-nil so the suite can assert it field by field on the-    /// far side of the stage.+    /// The Site's `junkSuffixRule` — the column **V16 removes**, seeded non-nil+    /// so the removal has something real to remove. It is the one composite+    /// `Codable` value `Site` ever carried, and after the stage the live class+    /// has no such property at all: `ModelContractTests` pins the column's+    /// absence from the schema, and this suite pins that nothing else went with+    /// it.     static var siteJunkSuffixRule: JunkSuffixRule {         get throws {             try JunkSuffixRule(@@ -313,9 +325,9 @@ enum V14RecordedStoreFixture {             workAssignment: .pattern(citedPattern))     } -    /// Opens a container over the frozen V14 snapshot at `storeURL`, hands its+    /// Opens a container over the frozen V15 snapshot at `storeURL`, hands its     /// context to `seed`, saves, and releases the container so the file on disk-    /// is a closed store recorded at 14.0.0.+    /// is a closed store recorded at 15.0.0.     ///     /// **The order here is the safety property**, not the schema — see the type's     /// doc comment. The snapshot container is released before this returns, so no@@ -323,7 +335,7 @@ enum V14RecordedStoreFixture {     static func write(at storeURL: URL, seed: (ModelContext) throws -> Void) throws {         try FileManager.default.createDirectory(             at: storeURL.deletingLastPathComponent(), withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV14.self)+        let schema = Schema(versionedSchema: AsterismSchemaV15.self)         let configuration = ModelConfiguration(             // The same store-configuration name `openContainer` uses; a mismatch             // here would make the reopen create a second store.@@ -342,7 +354,7 @@ enum V14RecordedStoreFixture {         guard case .success(let parsed) = TitleRuleApplicator.apply(             definition: patternDefinition, trimPrefix: trimPrefix, trimSuffix: trimSuffix,             to: captureTitle) else {-            throw ModelInvariantError.invalidCombination(field: "V14 fixture title replay")+            throw ModelInvariantError.invalidCombination(field: "V15 fixture title replay")         }         return parsed.workName     }@@ -374,7 +386,7 @@ enum V14RecordedStoreFixture {         let v3Key = try entryBIdentityKey          try write(at: storeURL) { context in-            let site = AsterismSchemaV14.Site()+            let site = AsterismSchemaV15.Site()             site.hostname = hostname             site.displayName = siteDisplayName             site.modeRaw = SiteMode.taught.rawValue@@ -382,7 +394,7 @@ enum V14RecordedStoreFixture {             context.insert(site)              // The phrase arm, in the blob that has been its only home since V9.-            let pattern = AsterismSchemaV14.TitlePattern()+            let pattern = AsterismSchemaV15.TitlePattern()             pattern.id = patternID             pattern.version = patternVersion             pattern.isActive = true@@ -393,7 +405,7 @@ enum V14RecordedStoreFixture {              // The retired segment arm. Inactive: a taught Site holds exactly one             // active title rule.-            let segmentPattern = AsterismSchemaV14.TitlePattern()+            let segmentPattern = AsterismSchemaV15.TitlePattern()             segmentPattern.id = segmentPatternID             segmentPattern.version = segmentPatternVersion             segmentPattern.isActive = false@@ -402,7 +414,7 @@ enum V14RecordedStoreFixture {             context.insert(segmentPattern)             segmentPattern.site = site -            let rule = AsterismSchemaV14.URLRulePattern()+            let rule = AsterismSchemaV15.URLRulePattern()             rule.id = urlRuleID             rule.version = urlRuleVersion             rule.isCurrent = true@@ -414,7 +426,7 @@ enum V14RecordedStoreFixture {             context.insert(rule)             rule.site = site -            let type = AsterismSchemaV14.WorkTypeEntity()+            let type = AsterismSchemaV15.WorkTypeEntity()             type.id = workTypeID             type.name = workTypeName             type.stateRaw = WorkTypeState.active.rawValue@@ -424,16 +436,11 @@ enum V14RecordedStoreFixture {             type.stateModifiedAt = timestamp             context.insert(type) -            // **No release days are seeded, because V14 has no column for-            // them** — that is what this fixture exists to say, and-            // `V14RecordedStoreTests` asserts it by the raw column reading `[]`-            // on the far side of the stage.-            //-            // Every column V10 through V14 *do* have is seeded away from its-            // default, the three thumbnail ones included, so a conversion that-            // re-applied one over an existing row would show up rather than read-            // as a pass.-            let work = AsterismSchemaV14.Work()+            // Every column V10 through V15 has is seeded away from its+            // default — the three thumbnail ones and V15's own+            // `releaseDaysRaw` included — so a removing stage that disturbed a+            // neighbouring column would show up rather than read as a pass.+            let work = AsterismSchemaV15.Work()             work.id = workID             work.displayTitle = workName             work.lastParsedTitle = workName@@ -449,6 +456,7 @@ enum V14RecordedStoreFixture {             work.createdAt = timestamp             work.modifiedAt = timestamp             work.genericNotesExtractionFingerprint = workNotesCoverage+            work.releaseDaysRaw = releaseDaysRaw             work.thumbnailData = thumbnailBytes             work.thumbnailShapeRaw = thumbnailShape.rawValue             work.thumbnailDigest = thumbnailDigest@@ -457,7 +465,7 @@ enum V14RecordedStoreFixture {             // The Work's site presence: since V9 the membership row is the only             // home it has. It cites its identity rule by UUID alone (Req 10.4,             // Q28 of `multi-site-works`), which is why no version travels with it.-            let membership = AsterismSchemaV14.WorkSiteMembership()+            let membership = AsterismSchemaV15.WorkSiteMembership()             membership.id = membershipID             membership.hostname = hostname             membership.createdAt = timestamp@@ -471,7 +479,7 @@ enum V14RecordedStoreFixture {             membership.site = site              // Entry A: the v2 identity arm and URL-rule work assignment.-            let entryA = AsterismSchemaV14.Entry()+            let entryA = AsterismSchemaV15.Entry()             entryA.id = entryAID             entryA.captureTitle = entryACaptureTitle             entryA.captureTitleSourceRaw = CaptureTitleSource.host.rawValue@@ -496,7 +504,7 @@ enum V14RecordedStoreFixture {             entryA.site = site              // Entry B: the v3 identity arm and the pattern work assignment.-            let entryB = AsterismSchemaV14.Entry()+            let entryB = AsterismSchemaV15.Entry()             entryB.id = entryBID             entryB.captureTitle = entryBCaptureTitle             entryB.captureTitleSourceRaw = CaptureTitleSource.host.rawValue@@ -519,7 +527,7 @@ enum V14RecordedStoreFixture {             // Entry C: **no citation blob**. It keeps its Work link — the             // assignment provenance is what a V8 build never wrote, the             // relationship is not (Q25 of `drop-superseded-columns`).-            let entryC = AsterismSchemaV14.Entry()+            let entryC = AsterismSchemaV15.Entry()             entryC.id = entryCID             entryC.captureTitle = entryCCaptureTitle             entryC.captureTitleSourceRaw = CaptureTitleSource.host.rawValue@@ -542,7 +550,7 @@ enum V14RecordedStoreFixture {             // assert it: a stage that lost one would surface as duplicate Works             // the reader has already told the app are distinct.             let pairIDs = WorkDistinctPair.sortedIDs(workID, distinctPairOtherWorkID)-            let pair = AsterismSchemaV14.WorkDistinctPair()+            let pair = AsterismSchemaV15.WorkDistinctPair()             pair.id = distinctPairID             pair.lowerWorkID = pairIDs.lower             pair.higherWorkID = pairIDs.higher@@ -551,7 +559,7 @@ enum V14RecordedStoreFixture {              // V11's two tables, carried forward from the retired fixture. The             // series row is the one `Work.seriesID` names.-            let series = AsterismSchemaV14.Series()+            let series = AsterismSchemaV15.Series()             series.id = seriesID             series.name = seriesName             series.notes = seriesNotes@@ -560,7 +568,7 @@ enum V14RecordedStoreFixture {             context.insert(series)              let linkIDs = WorkDistinctPair.sortedIDs(workID, linkOtherWorkID)-            let link = AsterismSchemaV14.WorkLink()+            let link = AsterismSchemaV15.WorkLink()             link.id = linkID             link.lowerWorkID = linkIDs.lower             link.higherWorkID = linkIDs.higher@@ -572,7 +580,7 @@ enum V14RecordedStoreFixture {             // V12's three tables, seeded so the stage has something to carry             // across rather than three more empty tables that would pass either             // way. The role is a fourth beside the three the app seeds.-            let creator = AsterismSchemaV14.Creator()+            let creator = AsterismSchemaV15.Creator()             creator.id = creatorID             creator.name = creatorName             creator.notes = creatorNotes@@ -584,7 +592,7 @@ enum V14RecordedStoreFixture {             creator.stateModifiedAt = timestamp             context.insert(creator) -            let role = AsterismSchemaV14.CreatorRole()+            let role = AsterismSchemaV15.CreatorRole()             role.id = creatorRoleID             role.name = creatorRoleName             role.position = creatorRolePosition@@ -596,7 +604,7 @@ enum V14RecordedStoreFixture {             role.stateModifiedAt = timestamp             context.insert(role) -            let credit = AsterismSchemaV14.WorkCredit()+            let credit = AsterismSchemaV15.WorkCredit()             credit.id = creditID             credit.workID = workID             credit.creatorID = creatorID@@ -605,7 +613,7 @@ enum V14RecordedStoreFixture {             credit.modifiedAt = timestamp             context.insert(credit) -            let character = AsterismSchemaV14.Character()+            let character = AsterismSchemaV15.Character()             character.id = characterID             character.name = characterName             character.nameKey = characterNameKey@@ -617,7 +625,7 @@ enum V14RecordedStoreFixture {             context.insert(character)             character.work = work -            let suppression = AsterismSchemaV14.CharacterSuppression()+            let suppression = AsterismSchemaV15.CharacterSuppression()             suppression.id = suppressionID             suppression.kindRaw = CharacterSuppressionKind.candidate.rawValue             suppression.nameKey = suppressionNameKey@@ -633,7 +641,7 @@ enum V14RecordedStoreFixture {             // across rather than two more empty tables that would pass either             // way. Both address their work by column, which is the shape every             // table added since V7 has taken.-            let place = AsterismSchemaV14.Place()+            let place = AsterismSchemaV15.Place()             place.id = placeID             place.name = placeName             place.nameKey = placeNameKey@@ -645,7 +653,7 @@ enum V14RecordedStoreFixture {             place.workID = workID             context.insert(place) -            let placeSuppression = AsterismSchemaV14.PlaceSuppression()+            let placeSuppression = AsterismSchemaV15.PlaceSuppression()             placeSuppression.id = placeSuppressionID             placeSuppression.workID = workID             placeSuppression.kindRaw = CharacterSuppressionKind.candidate.rawValue
Packages/AsterismCore/Tests/AsterismCoreTests/V15RecordedStoreTests.swift Renamed +71 / -68
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/V14RecordedStoreTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/V15RecordedStoreTests.swiftsimilarity index 88%rename from Packages/AsterismCore/Tests/AsterismCoreTests/V14RecordedStoreTests.swiftrename to Packages/AsterismCore/Tests/AsterismCoreTests/V15RecordedStoreTests.swiftindex 59b3416f..5f95bee6 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/V14RecordedStoreTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/V15RecordedStoreTests.swift@@ -4,50 +4,51 @@ import Testing  @testable import AsterismCore -/// The V14 → V15 conversion, over a store genuinely **recorded at 14.0.0**.+/// The V15 → V16 conversion, over a store genuinely **recorded at 15.0.0**. /// /// This is the path every installed library takes on the update that ships-/// `update-schedule`: the store on disk was written by the V14 classes, and+/// `remove-article-mode`: the store on disk was written by the V15 classes, and /// `ModelContainer.init` runs the plan's one lightweight stage on the way in.-/// Every other store a test builds is born at 15.0.0, so a regression here would+/// Every other store a test builds is born at 16.0.0, so a regression here would /// otherwise only be visible on the owner's phone. ///-/// **This stage adds exactly one column**, `Work.releaseDaysRaw` — a defaulted,-/// non-optional `[String]` on the `genreTags` shape (Q27). There is no new table-/// anywhere. Unlike V14's three optional columns, this one *does* have an-/// attribute default: the property initialiser `= []` is what SwiftData turns-/// into the Core Data attribute default, and that is what fills the column on-/// every existing row inside `ModelContainer.init` (Req 9.1). There is no data-/// pass behind it.+/// **This stage removes exactly one column**, `Site.junkSuffixRule`, and adds+/// nothing (Req 4.1). It is the first removing stage since V8 → V9, which+/// changes what there is to assert: a removed column has no attribute default+/// to land and no data pass behind it, so there is no "did the default arrive"+/// question at all. The fixture seeds the column with a real two-anchor+/// `JunkSuffixRule`, and on the far side the live `Site` has no such property+/// to read. ///-/// The assertions are therefore in two halves. The first is that the addition-/// landed and landed empty, read through the **raw** column — the `releaseDays`-/// accessor answers `[]` whether or not the default ever landed, which is-/// exactly the trap `V10RecordedStoreTests` named. The second is that nothing-/// else moved: the whole live library, field by field, exactly as the retired-/// `V14RecordedStoreTests` asserted it one generation back — the status-/// columns, the series columns, **V14's three thumbnail columns**, V12's-/// creator, role and credit rows and V13's place and place-suppression rows-/// included, all of which this fixture seeds away from their defaults precisely-/// so a re-applied default would show.-@Suite("A 14.0.0-recorded store under the V15 plan", .serialized)-struct V14RecordedStoreTests {--    private typealias Fixture = V14RecordedStoreFixture--    /// A library exactly as a V14 build leaves it: the store recorded at-    /// 14.0.0 with no release-days column, and the marker at `"14"`.+/// The assertions are therefore in two halves. The first is that the column is+/// gone from the **schema** rather than merely nil on the row — which is+/// `ModelContractTests`' delta pin, not this suite's, because a value read+/// through an absent property does not compile. The second is this suite's+/// whole job: that nothing else moved. The live library, field by field,+/// exactly as the retired `V14RecordedStoreTests` asserted it one generation+/// back — the status columns, the series columns, **V14's three thumbnail+/// columns**, **V15's `releaseDaysRaw`**, V12's creator, role and credit rows+/// and V13's place and place-suppression rows included, all of which this+/// fixture seeds away from their defaults precisely so a removing stage that+/// disturbed a neighbour would show.+@Suite("A 15.0.0-recorded store under the V16 plan", .serialized)+struct V15RecordedStoreTests {++    private typealias Fixture = V15RecordedStoreFixture++    /// A library exactly as a V15 build leaves it: the store recorded at+    /// 15.0.0 with a populated junk-suffix rule, and the marker at `"15"`.     private final class Root {         let url: URL         let configuration: LibraryConfiguration          init() throws {             url = FileManager.default.temporaryDirectory.appending(-                path: "V14Recorded-\(UUID())", directoryHint: .isDirectory)+                path: "V15Recorded-\(UUID())", directoryHint: .isDirectory)             try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true)             configuration = LibraryConfiguration(rootDirectory: url)             try Fixture.install(at: configuration.storeURL)-            try Data("14\n".utf8).write(to: configuration.readinessMarkerURL, options: .atomic)+            try Data("15\n".utf8).write(to: configuration.readinessMarkerURL, options: .atomic)         }          deinit { try? FileManager.default.removeItem(at: url) }@@ -62,20 +63,20 @@ struct V14RecordedStoreTests {         }     } -    @Test("The seeded store really is recorded at 14.0.0, on the lagging marker")-    func seedIsRecordedAtFourteenZeroZero() throws {+    @Test("The seeded store really is recorded at 15.0.0, on the lagging marker")+    func seedIsRecordedAtFifteenZeroZero() throws {         let root = try Root()-        #expect(try root.recordedVersions() == ["14.0.0"])-        #expect(try root.markerText() == "14")+        #expect(try root.recordedVersions() == ["15.0.0"])+        #expect(try root.markerText() == "15")         #expect(try LibraryRepository.classify(root.configuration, fileManager: .default)-                == .markerLagging(generation: "14"))+                == .markerLagging(generation: "15"))         withExtendedLifetime(root) {}     }      /// The whole of it: `openForApp` runs the stage, validates, publishes-    /// `"15"`, and every live row is still there afterwards with its value —-    /// plus one empty column on every Work.-    @Test("openForApp converts to 15.0.0, adding one empty Work column")+    /// `"16"`, and every live row is still there afterwards with its value —+    /// minus one column on the Site, which no longer exists to read.+    @Test("openForApp converts to 16.0.0, dropping one Site column")     func convertsWithEveryLiveRowIntact() async throws {         let root = try Root()         let (result, repository) = try await LibraryRepository.openForApp(root.configuration)@@ -87,8 +88,8 @@ struct V14RecordedStoreTests {             return         }         // The stage completed and the marker moved, in that order.-        #expect(try root.recordedVersions() == ["15.0.0"])-        #expect(try root.markerText() == "15")+        #expect(try root.recordedVersions() == ["16.0.0"])+        #expect(try root.markerText() == "16")         #expect(counts.works == 1)         #expect(counts.entries == 3)         #expect(counts.sites == 1)@@ -97,20 +98,24 @@ struct V14RecordedStoreTests {          let facts = try await repository.withLockedContext(             mode: .shared, operation: "reading the converted library"-        ) { context in try ConvertedV15Library(context: context) }+        ) { context in try ConvertedV16Library(context: context) }         await repository.shutdown() -        // MARK: what the stage added — the point of the whole suite+        // MARK: what the stage removed — the point of the whole suite         //-        // One column on `Work`, and nothing else. It is defaulted rather than-        // optional, so the attribute default `[]` is what the stage writes into-        // every existing row inside `ModelContainer.init`. Read **raw**: the-        // `releaseDays` accessor maps and canonicalises whatever the column-        // holds, so it answers an empty array whether or not the default landed-        // — the trap `V10RecordedStoreTests` named for `ToleratedEnum`, in a-        // different spelling.-        #expect(facts.releaseDaysRaw == [])-        #expect(facts.releaseDays == [])+        // One column on `Site`, and nothing else. The fixture seeded it with a+        // real two-anchor rule; there is deliberately no assertion here that it+        // reads nil, because the live class has no `junkSuffixRule` property to+        // read and an attempt would not compile. That *is* the assertion, and+        // `ModelContractTests` states it over the schema — V16's `Site` is+        // V15's minus exactly this column.+        //+        // What can be asserted here is the other half: that the removal took+        // nothing with it. V15's own `releaseDaysRaw` is the nearest+        // neighbour, seeded non-empty precisely so a disturbed column would+        // show, and it is read **raw** as well as through the accessor.+        #expect(facts.releaseDaysRaw == Fixture.releaseDaysRaw)+        #expect(facts.releaseDays == Fixture.releaseDays)          // MARK: V14's three columns, which this stage may not touch. The         // fixture seeds all three away from nil — the bytes included, which@@ -215,12 +220,6 @@ struct V14RecordedStoreTests {         #expect(facts.siteDisplayName == Fixture.siteDisplayName)         #expect(facts.siteMode == .taught) -        let junk = try #require(facts.siteJunkSuffixRule)-        #expect(junk == (try Fixture.siteJunkSuffixRule))-        #expect(junk.version == 3)-        #expect(junk.anchors.map(\.origin) == [.end, .end])-        #expect(junk.anchors.map(\.offset) == [1, 0])-         // MARK: both title rules — the blob, which is their only home         #expect(facts.patterns.count == 2)         let phrasePattern = try #require(facts.patterns[Fixture.patternID])@@ -372,9 +371,11 @@ struct V14RecordedStoreTests {     }      /// The converted graph is one the validator accepts, with no hostname-    /// quarantined. Nothing about the new column is validated — an unknown-    /// stored day value is data rather than damage (Req 1.6, Q21) — so what this-    /// pins is that the stage left a library that is still legal.+    /// quarantined. The Site the fixture seeds is `taught` with an active+    /// pattern, a legal tuple before the stage and after it, so what this pins+    /// is that removing a column left a library that is still legal (Req 4.3).+    /// The `articles` mode value is the other half of that story and has its+    /// own suite (`UnknownSiteModeTests`, Req 3.4).     @Test("The converted library validates with nothing quarantined")     func convertedLibraryValidates() async throws {         let root = try Root()@@ -389,7 +390,7 @@ struct V14RecordedStoreTests {     }      /// The extension is what the marker keeps out of the stage (Req 9.3): it-    /// refuses `"14"`, and opens the same library once the app has moved it.+    /// refuses `"15"`, and opens the same library once the app has moved it.     @Test("The extension refuses the store until the app has converted it")     func extensionOpensOnlyAfterTheApp() async throws {         let root = try Root()@@ -399,7 +400,7 @@ struct V14RecordedStoreTests {             reason: "Open Asterism to finish updating the library")) {             try await LibraryRepository.openForExtension(root.configuration)         }-        #expect(try root.recordedVersions() == ["14.0.0"],+        #expect(try root.recordedVersions() == ["15.0.0"],                 "the refusal has to land before ModelContainer.init converts the store")          let (_, app) = try await LibraryRepository.openForApp(root.configuration)@@ -426,8 +427,8 @@ struct V14RecordedStoreTests {         #expect(try LibraryRepository.classify(root.configuration, fileManager: .default) == .ready)         let (_, second) = try await LibraryRepository.openForApp(root.configuration)         await second.shutdown()-        #expect(try root.markerText() == "15")-        #expect(try root.recordedVersions() == ["15.0.0"])+        #expect(try root.markerText() == "16")+        #expect(try root.recordedVersions() == ["16.0.0"])         withExtendedLifetime(root) {}     } }@@ -437,7 +438,7 @@ struct V14RecordedStoreTests { /// Everything the converted store holds, read once inside the locked context. /// Model classes are not `Sendable` and may not leave the actor, so the whole /// comparison is done against copies.-private struct ConvertedV15Library: Sendable {+private struct ConvertedV16Library: Sendable {     struct EntryFacts: Sendable {         let captureTitle: String         let captureTitleSource: CaptureTitleSource@@ -555,7 +556,9 @@ private struct ConvertedV15Library: Sendable {     let siteHostnames: [String]     let siteDisplayName: String     let siteMode: SiteMode-    let siteJunkSuffixRule: JunkSuffixRule?+    // `siteJunkSuffixRule` stood here. The column went at V16 and the live+    // `Site` has no property to read it from, which is the whole conversion+    // this suite covers.      let patterns: [UUID: PatternFacts] @@ -602,8 +605,9 @@ private struct ConvertedV15Library: Sendable {     let thumbnailShapeRaw: String?     let thumbnailDigest: String?     let thumbnailIdentity: ThumbnailIdentity?-    /// V15's one column, **raw**. The accessor is read beside it only to show-    /// the two agree; the raw array is what proves the default landed.+    /// V15's one column, **raw**. It is the removed column's nearest+    /// neighbour, seeded non-empty so the stage leaving it alone is visible;+    /// the accessor is read beside it only to show the two agree.     let releaseDaysRaw: [String]     let releaseDays: [ReleaseDay] @@ -634,7 +638,6 @@ private struct ConvertedV15Library: Sendable {         siteHostnames = sites.map(\.hostname).sorted()         siteDisplayName = site.displayName         siteMode = site.mode-        siteJunkSuffixRule = site.junkSuffixRule          patterns = Dictionary(             uniqueKeysWithValues: try context.fetch(FetchDescriptor<TitlePattern>()).map {
Packages/AsterismCore/Tests/AsterismCoreTests/V4RecordedStoreTests.swift Modified +13 / -13
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/V4RecordedStoreTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/V4RecordedStoreTests.swiftindex 764a513f..426da851 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/V4RecordedStoreTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/V4RecordedStoreTests.swift@@ -7,16 +7,16 @@ import Testing  /// The one store in the repository actually **recorded at 4.0.0**. ///-/// Nothing on this branch can write one any more: the live classes are V14's, so-/// every store a test creates today is recorded at 14.0.0 (or at 13.0.0, through-/// the frozen snapshot — see `V14RecordedStoreFixture`). It is the only input+/// Nothing on this branch can write one any more: the live classes are V16's, so+/// every store a test creates today is recorded at 16.0.0 (or at 15.0.0, through+/// the frozen snapshot — see `V15RecordedStoreFixture`). It is the only input /// that positively reads *below* V5, which is what `StoreMetadataTests`, /// `BootstrapClassifierTests` and `BootstrapActionTests` need it for. /// /// It is no longer a *convertible* store: since the plan declares real stages, a /// model version the plan does not declare is refused rather than raised-/// implicitly. Under `AsterismV15MigrationPlan` = `[V13, V14]` the floor has-/// risen seven versions since that first became true, so 4.0.0 is refused with+/// implicitly. Under `AsterismV16MigrationPlan` = `[V15, V16]` the floor has+/// risen nine versions since that first became true, so 4.0.0 is refused with /// more room to spare than ever. What can still be asserted about it is the /// refusal. ///@@ -56,8 +56,8 @@ enum V4RecordedStoreFixture {      /// The schema versions Core Data recorded into the store's own metadata —     /// `["4.0.0"]` for this fixture (nothing converts a 4.0.0 store any more;-    /// `V14RecordedStoreTests` uses this helper to observe `"13.0.0"` before the-    /// stage and `"14.0.0"` after it).+    /// `V15RecordedStoreTests` uses this helper to observe `"15.0.0"` before the+    /// stage and `"16.0.0"` after it).     /// Read straight out of `Z_METADATA` rather than through SwiftData, so     /// asking the question cannot itself perform the conversion.     static func recordedModelVersions(at storeURL: URL) throws -> [String] {@@ -109,17 +109,17 @@ enum V4RecordedStoreFixture { /// stage ended that — a staged migration refuses a model version the plan does /// not declare — so the conversion those tests asserted, and the 5.0.0 end state /// they pinned, no longer exist to assert. The 432-Entry scale fixture went with-/// them: nothing can open it. `AsterismV15MigrationPlan` is `[V13, V14]`, so the-/// floor has since risen seven more versions and 4.0.0 is refused by a wider+/// them: nothing can open it. `AsterismV16MigrationPlan` is `[V15, V16]`, so the+/// floor has since risen nine more versions and 4.0.0 is refused by a wider /// margin than when this suite was written. /// /// Nothing shipped changes. `classify` already refuses a below-V5 store before /// any container is constructed (Req 2.9, Decision 1 of /// `retire-migration-chain`), and the recovery for one remains the 4/4 backup-/// archive. The conversion coverage is `V14RecordedStoreTests`, which seeds its-/// input through the frozen V13 snapshot — the version installed libraries-/// actually hold, and under `[V13, V14]` the only one that converts at all.-@Suite("A 4.0.0-recorded store under the V14 plan", .serialized)+/// archive. The conversion coverage is `V15RecordedStoreTests`, which seeds its+/// input through the frozen V15 snapshot — the version installed libraries+/// actually hold, and under `[V15, V16]` the only one that converts at all.+@Suite("A 4.0.0-recorded store under the V16 plan", .serialized) struct V4RecordedStoreTests {      private final class TempDir {
Packages/AsterismCore/Tests/AsterismCoreTests/ValidatorFixtures.swift Modified +36 / -8
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/ValidatorFixtures.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/ValidatorFixtures.swiftindex 2419453a..994c18c9 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/ValidatorFixtures.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/ValidatorFixtures.swift@@ -209,15 +209,43 @@ enum ValidatorFixtures {             entries: [], works: [], sites: [site], titlePatterns: [], urlRules: [rule])     } -    static func articles(hostname: String = "articles.example") throws -> LibraryGraph {+    /// One Work-less Entry on a Site in the given mode, with its assignment+    /// provenance and its unattachment flag under the test's control+    /// (`remove-article-mode` Req 3.3).+    ///+    /// The pair is the whole subject: a `none` assignment is the state a capture+    /// leaves behind and may never claim a deliberate unattachment, while a+    /// `manual` one with no Work is exactly what the reader's own "leave+    /// unattached" writes.+    static func workLessEntry(+        mode: SiteMode,+        manualAssignment: Bool,+        intentionallyUnattached: Bool,+        hostname: String = "unattached.example"+    ) throws -> LibraryGraph {         let site = Site(hostname: hostname)-        site.mode = .articles-        let historical = try URLRulePattern(-            version: 1, isCurrent: false, createdAt: Date(timeIntervalSince1970: 0),-            origin: .importedV2,-            definition: .work(locator: .query(name: ExactScalarString("story"))), site: site)-        site.urlRules = [historical]+        site.mode = mode+        var patterns: [TitlePattern] = []+        if mode == .taught {+            let pattern = try TitlePattern(+                version: 1, isActive: true, createdAt: timestamp,+                definition: .wholeTitle, site: site)+            site.patterns = [pattern]+            patterns = [pattern]+        }++        let rawURL = "https://\(hostname)/1"+        let entry = Entry(+            captureTitle: "A Capture", captureTitleSource: .host, rawURLString: rawURL,+            hostname: hostname, entryIdentityKey: rawURL, timestamp: timestamp)+        entry.identityBasis = .conservative+        entry.conservativeIdentityKey = rawURL+        entry.intentionallyUnattached = intentionallyUnattached+        entry.editCitations { $0.workAssignment = manualAssignment ? .manual : .none }+        entry.site = site+         return LibraryGraph(-            entries: [], works: [], sites: [site], titlePatterns: [], urlRules: [historical])+            entries: [entry], works: [], sites: [site],+            titlePatterns: patterns, urlRules: [])     } }
Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeConvergenceTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeConvergenceTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeConvergenceTests.swiftindex 3ced24d6..3375fcac 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeConvergenceTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeConvergenceTests.swift@@ -31,9 +31,9 @@ struct WorkTypeConvergenceTests {             directory = FileManager.default.temporaryDirectory                 .appending(path: "WorkTypeConvergence-\(UUID())", directoryHint: .isDirectory)             try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-            let schema = Schema(versionedSchema: AsterismSchemaV15.self)+            let schema = Schema(versionedSchema: AsterismSchemaV16.self)             container = try ModelContainer(-                for: schema, migrationPlan: AsterismV15MigrationPlan.self,+                for: schema, migrationPlan: AsterismV16MigrationPlan.self,                 configurations: [                     ModelConfiguration(                         "AsterismV3", schema: schema,
Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeOrderingTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeOrderingTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeOrderingTests.swiftindex ee4058af..f7be6321 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeOrderingTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeOrderingTests.swift@@ -30,9 +30,9 @@ struct WorkTypeOrderingTests {             directory = FileManager.default.temporaryDirectory                 .appending(path: "WorkTypeOrdering-\(UUID())", directoryHint: .isDirectory)             try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-            let schema = Schema(versionedSchema: AsterismSchemaV15.self)+            let schema = Schema(versionedSchema: AsterismSchemaV16.self)             container = try ModelContainer(-                for: schema, migrationPlan: AsterismV15MigrationPlan.self,+                for: schema, migrationPlan: AsterismV16MigrationPlan.self,                 configurations: [                     ModelConfiguration(                         "AsterismV3", schema: schema,
Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypePlumbingTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypePlumbingTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypePlumbingTests.swiftindex ebc2781d..994087f6 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypePlumbingTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypePlumbingTests.swift@@ -30,12 +30,12 @@ struct WorkTypePlumbingTests {             directory = FileManager.default.temporaryDirectory                 .appending(path: "WorkTypePlumbing-\(UUID())", directoryHint: .isDirectory)             try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-            let schema = Schema(versionedSchema: AsterismSchemaV15.self)+            let schema = Schema(versionedSchema: AsterismSchemaV16.self)             let configuration = ModelConfiguration(                 "AsterismV3", schema: schema,                 url: directory.appending(path: "library.store"), cloudKitDatabase: .none)             container = try ModelContainer(-                for: schema, migrationPlan: AsterismV15MigrationPlan.self,+                for: schema, migrationPlan: AsterismV16MigrationPlan.self,                 configurations: [configuration])             context = ModelContext(container)         }
Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeSeedingTests.swift Modified +46 / -4
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeSeedingTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeSeedingTests.swiftindex 3e38e031..ffc6eb53 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeSeedingTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeSeedingTests.swift@@ -63,11 +63,17 @@ struct WorkTypeSeedingTests {         withExtendedLifetime(container) {}     } -    private static let expectedNames = ["article", "novel", "webtoon"]+    private static let expectedNames = ["novel", "webtoon"]++    /// The identifier the retired `article` default was minted with+    /// (`remove-article-mode` Req 6.2, 6.3). Libraries that seeded it still hold+    /// the row, and it is never re-minted and never reused.+    private static let retiredArticleSeedID = UUID(+        uuidString: "D0000003-0000-4000-8000-000000000003")!      // MARK: - 2.1: the defaults appear -    @Test("A first app open mints the three defaults at their frozen ids, pristine and active")+    @Test("A first app open mints the two defaults at their frozen ids, pristine and active")     func firstOpenSeedsTheDefaults() async throws {         let root = try TempRoot()         try await openAndClose(root.configuration)@@ -116,6 +122,42 @@ struct WorkTypeSeedingTests {         #expect(try rows(root.configuration).map(\.name) == Self.expectedNames)     } +    // MARK: - `remove-article-mode` 6.1-6.3: the retired `article` default++    /// A library seeded by an earlier build holds the `article` row. The pass+    /// leaves it exactly where it is — it is the reader's row once minted, and+    /// removing it is theirs to do in Settings — while still adding whichever+    /// of the two remaining defaults the library lacks.+    @Test("A library holding only the retired article row keeps it and gains the two defaults")+    func aRetiredDefaultIsLeftAloneAndTheOthersArrive() async throws {+        let root = try TempRoot()+        let touched = Date(timeIntervalSince1970: 1_800_000_000)+        try await openAndClose(root.configuration)+        try mutateTypes(root.configuration) { context in+            for row in try context.fetch(FetchDescriptor<WorkTypeEntity>()) { context.delete(row) }+            context.insert(WorkTypeEntity(+                id: Self.retiredArticleSeedID, name: "article", timestamp: touched))+        }++        try await openAndClose(root.configuration)++        let after = try rows(root.configuration)+        #expect(after.map(\.name) == ["article", "novel", "webtoon"])+        let retired = try #require(after.first { $0.id == Self.retiredArticleSeedID })+        #expect(retired.name == "article")+        #expect(retired.stateRaw == WorkTypeState.active.rawValue)+        #expect(retired.nameModifiedAt == touched, "the row is not rewritten")+    }++    /// The identifier is retired, never reused (Q5): no seed may carry it, so a+    /// library that already holds the row cannot have a *different* default+    /// folded into it.+    @Test("No default is seeded under the retired article identifier")+    func theRetiredIdentifierIsNeverSeeded() {+        #expect(WorkTypeSeeding.seeds.map(\.name) == ["novel", "webtoon"])+        #expect(!WorkTypeSeeding.seeds.contains { $0.id == Self.retiredArticleSeedID })+    }+     // MARK: - 2.5: idempotence and suppression      @Test("A second open adds nothing")@@ -155,7 +197,7 @@ struct WorkTypeSeedingTests {          let seeded = try rows(root.configuration)         #expect(seeded.count == WorkTypeSeeding.seeds.count,-                "the two absent defaults are added and the present one is not duplicated")+                "the absent default is added and the present one is not duplicated")         let survivor = try #require(seeded.first { $0.id == target.id })         #expect(survivor.name == "the reader's own spelling",                 "seeding may not rewrite a row the reader has already touched")@@ -203,7 +245,7 @@ struct WorkTypeSeedingTests {         try await openAndClose(root.configuration)          #expect(try rows(root.configuration).map(\.name)-                == ["article", "light novel", "novel", "webtoon"])+                == ["light novel", "novel", "webtoon"])     }      /// Duplicate rows of one identity are a normal permanent state (Decision 9),
Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeSettingsAPITests.swift Modified +1 / -1
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeSettingsAPITests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeSettingsAPITests.swiftindex 462bdcc3..1cbee8b9 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeSettingsAPITests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/WorkTypeSettingsAPITests.swift@@ -205,7 +205,7 @@ struct WorkTypeSettingsAPITests {         let fixture = try await M5Fixture()         _ = try await fixture.repository.addWorkType(name: "Manga")         let names = try await fixture.repository.workTypes().map(\.name)-        #expect(names == ["article", "Manga", "novel", "webtoon"])+        #expect(names == ["Manga", "novel", "webtoon"])     }      // MARK: - Usage counts (Req 1.5)
Packages/AsterismCore/Tests/AsterismCoreTests/WritePathQuarantineTests.swift Modified +0 / -18
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/WritePathQuarantineTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/WritePathQuarantineTests.swiftindex a43f5453..5596805b 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/WritePathQuarantineTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/WritePathQuarantineTests.swift@@ -109,21 +109,6 @@ struct WritePathQuarantineTests {         }     } -    @Test("commitArticles commits on a duplicated hostname")-    func commitArticlesResolvesDuplicateSiteRows() async throws {-        let fixture = try WritePathFixture()-        let repository = try fixture.diagnosedRepository()-        let contract = try await repository.projectArticles(-            hostname: duplicated, junkSuffixRule: nil)--        let outcome = try await repository.commitArticles(contract)--        guard case .committed = outcome else {-            Issue.record("expected a duplicated hostname to commit, got \(outcome)")-            return-        }-    }-     /// The review projection assembles its evidence from the winner too, so it     /// describes the same row teaching writes to. A duplicated *untaught* hostname     /// has no current URL rule to review, which is the ordinary refusal — never a@@ -160,9 +145,6 @@ struct WritePathQuarantineTests {             _ = try await repository.projectInitialTeaching(                 hostname: orphaned, patternDefinition: try Self.wcSegment())         }-        await expectInvalidInput {-            _ = try await repository.projectArticles(hostname: orphaned, junkSuffixRule: nil)-        }         // The URL identity path builds an empty basis for a hostname with no         // Site row and then refuses for want of a current rule. Whatever it         // does, it must not be a quarantine refusal.
Packages/AsterismCore/Tests/AsterismCoreTests/WriteSiteRelationshipTests.swift Modified +7 / -7
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/WriteSiteRelationshipTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/WriteSiteRelationshipTests.swiftindex 0196cc0a..274bcb9c 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/WriteSiteRelationshipTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/WriteSiteRelationshipTests.swift@@ -268,7 +268,7 @@ struct WriteSiteRelationshipTests {     /// format change, no marker republication, no second pass.     @Test("materializeArchive wires both relationships from its sitesByHostname map")     func materializeWiresBothRelationships() throws {-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let container = try ModelContainer(             for: schema,             configurations: [ModelConfiguration(@@ -276,7 +276,7 @@ struct WriteSiteRelationshipTests {         let context = ModelContext(container)          try LibraryRepository.materializeArchive(-            BackupImportPayload(BackupV14Fixtures.minimalTaughtPayload()), into: context)+            BackupImportPayload(BackupV15Fixtures.minimalTaughtPayload()), into: context)          let site = try #require(try context.fetch(FetchDescriptor<Site>()).first)         let entry = try #require(try context.fetch(FetchDescriptor<Entry>()).first)@@ -297,7 +297,7 @@ struct WriteSiteRelationshipTests {         let dir = try TempDir("WriteSiteImportFill")         let cfg = configuration(dir)         let (_, repository) = try await LibraryRepository.openForApp(cfg)-        #expect(try markerContent(cfg) == "15",+        #expect(try markerContent(cfg) == "16",                 "mark-at-birth certifies an empty store at the current generation")          let plan = try importPlan()@@ -306,7 +306,7 @@ struct WriteSiteRelationshipTests {             Issue.record("expected committed, got \(result)")             return         }-        #expect(try markerContent(cfg) == "15", "the import republishes nothing")+        #expect(try markerContent(cfg) == "16", "the import republishes nothing")         try expectEveryRelationshipPopulated(cfg)         withExtendedLifetime(dir) {}     }@@ -324,7 +324,7 @@ struct WriteSiteRelationshipTests {             Issue.record("expected committed, got \(result)")             return         }-        #expect(try markerContent(cfg) == "15")+        #expect(try markerContent(cfg) == "16")         try expectEveryRelationshipPopulated(cfg)         withExtendedLifetime(dir) {}     }@@ -411,7 +411,7 @@ struct WriteSiteRelationshipTests {     }      private func importPlan() throws -> BackupImportPlan {-        let payload = BackupImportPayload(BackupV14Fixtures.minimalTaughtPayload())+        let payload = BackupImportPayload(BackupV15Fixtures.minimalTaughtPayload())         return BackupImportPlan(             metadata: BackupImportMetadata(                 formatVersion: 8, schemaVersion: 9, appBuild: "test",@@ -438,7 +438,7 @@ struct WriteSiteRelationshipTests {         entry.site = site         context.insert(entry)         try context.save()-        try Data("14\n".utf8).write(to: cfg.readinessMarkerURL, options: .atomic)+        try Data("15\n".utf8).write(to: cfg.readinessMarkerURL, options: .atomic)         withExtendedLifetime(container) {}     } 
Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLCompatibilityTests.swift Modified +9 / -9
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLCompatibilityTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLCompatibilityTests.swiftindex 3816eedf..4122aa7f 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLCompatibilityTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLCompatibilityTests.swift@@ -41,13 +41,13 @@ struct WrongHostWorkURLCompatibilityTests {      // MARK: - Req 4.1 -    @Test("The heal moves the archive's version pair")+    @Test("The heal leaves the archive's version pair where the schema put it")     func archiveVersionIsUnchanged() {-        // The file: format 14 over schema 15, the pair every archive since-        // `update-schedule` carries. The heal did not move it; the release-day-        // column did (`update-schedule` Req 8.1).-        #expect(BackupV14Document.formatVersion == 14)-        #expect(BackupV14Document.schemaVersion == 15)+        // The file: format 15 over schema 16, the pair every archive since+        // `remove-article-mode` carries. The heal did not move it; dropping+        // `Site.junkSuffixRule` did (`remove-article-mode` Req 5.1).+        #expect(BackupV15Document.formatVersion == 15)+        #expect(BackupV15Document.schemaVersion == 16)     }      @Test("A healed library's archive uses only the membership keys 9/10 declared")@@ -85,7 +85,7 @@ struct WrongHostWorkURLCompatibilityTests {         // The archive: the minted row is there, and so is the untaught wire Site         // the projection synthesised for its hostname — without which the         // reference checks would refuse a membership naming no Site.-        let decoded = try BackupV14Codec.decode(archive)+        let decoded = try BackupV15Codec.decode(archive)         let minted = try #require(             decoded.payload.memberships.first { $0.hostname == Self.destination })         #expect(minted.workID == workID)@@ -151,10 +151,10 @@ private struct CompatibilityRoot {         let outcome = try await repository.reconcileAfterSync()         #expect(outcome.memberships.movedWorkURLs == 1) -        let exporter = BackupV14Exporter(+        let exporter = BackupV15Exporter(             repository: repository, stagingDirectory: directory.appending(path: "staging"))         let result = try await exporter.export(-            metadata: BackupV14Metadata(+            metadata: BackupV15Metadata(                 appBuild: "test-1.0",                 exportedAt: WrongHostWorkURLCompatibilityTests.epoch))         let data = try Data(contentsOf: result.fileURL)
Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLImportTests.swift Modified +9 / -10
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLImportTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLImportTests.swiftindex 29fb4ae5..2cb40159 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLImportTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLImportTests.swift@@ -311,7 +311,7 @@ struct WrongHostWorkURLImportTests {             // A legacy identity state with no identity value: an illegal             // membership tuple that has nothing to do with the Work URL.             [-                BackupV14Membership(+                BackupV15Membership(                     id: work, workID: work, hostname: siteHostname, createdAt: epoch,                     urlIdentity: nil, urlIdentityState: .legacyUnverified,                     urlIdentityRuleID: nil, workURLString: nil)@@ -401,14 +401,14 @@ private let epoch = Date(timeIntervalSince1970: 1_800_000_000)  private func record(     id: UUID = UUID(), work: UUID?, hostname: String, workURL: String?-) -> BackupV14Membership {-    BackupV14Membership(+) -> BackupV15Membership {+    BackupV15Membership(         id: id, workID: work, hostname: hostname, createdAt: epoch,         urlIdentity: nil, urlIdentityState: .none, urlIdentityRuleID: nil,         workURLString: workURL) } -private func url(of records: [BackupV14Membership], _ id: UUID) -> String? {+private func url(of records: [BackupV15Membership], _ id: UUID) -> String? {     records.first { $0.id == id }?.workURLString ?? nil } @@ -418,14 +418,14 @@ private func url(of records: [BackupV14Membership], _ id: UUID) -> String? { /// a test can address them. private func makePlan(     activePattern: Bool = true,-    memberships: (_ workID: UUID, _ otherMembershipID: UUID) -> [BackupV14Membership]+    memberships: (_ workID: UUID, _ otherMembershipID: UUID) -> [BackupV15Membership] ) -> BackupImportPlan {     let workID = UUID()     let otherMembershipID = UUID()     let patternID = UUID()     let rawURL = "https://\(siteHostname)/chapter/1" -    let entry = BackupV14Entry(+    let entry = BackupV15Entry(         id: UUID(), captureTitle: "Chapter 1", captureTitleSource: .host,         rawURL: rawURL, canonicalURL: nil, hostname: siteHostname,         entryIdentityKey: rawURL, conservativeIdentityKey: rawURL,@@ -435,7 +435,7 @@ private func makePlan(         intentionallyUnattached: false,         citations: EntryCitations(             workAssignment: .pattern(CitedRule(id: patternID))))-    let work = BackupV14Work(+    let work = BackupV15Work(         id: workID, displayTitle: "Imported Work", lastParsedTitle: "Imported Work",         genericNotes: "", genreTags: [], titleProvenance: .parsed,         workStatus: .ongoing, readingStatus: .reading, verdict: "", releaseDays: [], workTypeID: nil,@@ -444,14 +444,13 @@ private func makePlan(     // `activePattern` varies is whether it is *active*, which is what makes the     // taught Site's tuple legal or not.     let patterns = [-        BackupV14TitlePattern(+        BackupV15TitlePattern(             id: patternID, siteHostname: siteHostname, version: 1, isActive: activePattern,             createdAt: epoch,             definition: StoredPatternDefinition(definition: .wholeTitle))     ]     let sites = [siteHostname, otherHostname].map {-        BackupV14Site(hostname: $0, displayName: $0, mode: $0 == siteHostname ? .taught : .untaught,-                     junkSuffixRule: nil)+        BackupV15Site(hostname: $0, displayName: $0, mode: $0 == siteHostname ? .taught : .untaught)     }     let payload = BackupImportPayload(         entries: [entry], works: [work], sites: sites, titlePatterns: patterns,
Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLValidatorTests.swift Modified +2 / -2
diff --git a/Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLValidatorTests.swift b/Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLValidatorTests.swiftindex 0b3d75dd..34248143 100644--- a/Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLValidatorTests.swift+++ b/Packages/AsterismCore/Tests/AsterismCoreTests/WrongHostWorkURLValidatorTests.swift@@ -407,12 +407,12 @@ final class WrongHostStore {         directory = FileManager.default.temporaryDirectory             .appending(path: "AsterismWrongHostWorkURL-\(UUID())", directoryHint: .isDirectory)         try FileManager.default.createDirectory(at: directory, withIntermediateDirectories: true)-        let schema = Schema(versionedSchema: AsterismSchemaV15.self)+        let schema = Schema(versionedSchema: AsterismSchemaV16.self)         let configuration = ModelConfiguration(             "AsterismV3", schema: schema,             url: directory.appending(path: "library.store"), cloudKitDatabase: .none)         container = try ModelContainer(-            for: schema, migrationPlan: AsterismV15MigrationPlan.self,+            for: schema, migrationPlan: AsterismV16MigrationPlan.self,             configurations: [configuration])         context = ModelContext(container)     }
docs/agent-notes/rule-wire-format.md Modified +7 / -4
diff --git a/docs/agent-notes/rule-wire-format.md b/docs/agent-notes/rule-wire-format.mdindex 68815ac3..01b16fc4 100644--- a/docs/agent-notes/rule-wire-format.md+++ b/docs/agent-notes/rule-wire-format.md@@ -6,9 +6,9 @@ They reach persistence twice, by different routes: - **The store**: JSON in an opaque column — `URLRulePattern.definitionData`, and   `TitlePattern`'s decoded columns. Mirrored to CloudKit as bytes, so no schema change is   involved and no schema version protects it.-- **The archive**: the *typed* value inside `BackupV14URLRule.definition` /-  `BackupV14TitlePattern.definition` — the live 14/15 wire substrate — re-encoded-  and checksummed by `BackupV14Codec`. The record types are renamed with each+- **The archive**: the *typed* value inside `BackupV15URLRule.definition` /+  `BackupV15TitlePattern.definition` — the live 15/16 wire substrate — re-encoded+  and checksummed by `BackupV15Codec`. The record types are renamed with each   generation, so a note naming `BackupV4*`/`BackupV6Codec` is describing a build   several generations back. **The rename is not evidence that anything on this   page changed**: 9/10 (`work-and-reading-status`) renamed the whole `BackupV8*`@@ -22,7 +22,10 @@ They reach persistence twice, by different routes:   (`work-thumbnails`) renamed the `BackupV12*` set for two **columns** on   `BackupV13Work` — the cover's shape and bytes — and no new record type at all,   and 14/15 (`update-schedule`) renamed the `BackupV13*` set for one more column-  on `BackupV14Work`, the work's release days, and again no new record type.+  on `BackupV14Work`, the work's release days, and again no new record type, and+  15/16 (`remove-article-mode`) renamed the `BackupV14*` set for a column+  **leaving** `BackupV15Site` — the junk-suffix rule — which is the first+  generation to rename for a removal.   No rule definition moved in any of them. Read the   generation as "which build wrote it", not as "which rule forms it can carry". 
docs/agent-notes/schema-migration.md Modified +181 / -150
diff --git a/docs/agent-notes/schema-migration.md b/docs/agent-notes/schema-migration.mdindex 240ad81a..313f2120 100644--- a/docs/agent-notes/schema-migration.md+++ b/docs/agent-notes/schema-migration.md@@ -1,9 +1,9 @@ # Schema migration -Schema **V15** is live (since `specs/update-schedule/`), with **V14**+Schema **V16** is live (since `specs/remove-article-mode/`), with **V15** frozen beside it as the `from` side of one lightweight stage. The readiness-marker set is `["14", "15"]`, and the archive generation is **14/15** — moved by-that feature's archive phase, a few commits after the schema. The app opens+marker set is `["15", "16"]`, and the archive generation is **15/16** — moved by+that feature's archive commit, one commit after the schema. The app opens `openForApp` and the share extension `openForExtension` — one opener per role, both over the same schema and the same file layout (`retire-migration-chain`'s Req 4). Read the "Current state" section; everything under "History" is@@ -12,55 +12,56 @@ background for the *next* schema bump and describes states that no longer exist. ## Current state  - **Every `@Model` is nested; there are zero top-level `@Model` types.** The live-  classes live in `extension AsterismSchemaV15 { @Model final class Entry … }`+  classes live in `extension AsterismSchemaV16 { @Model final class Entry … }`   (`Models.swift`) and are reached by top-level typealiases-  (`typealias Entry = AsterismSchemaV15.Entry`). `AsterismSchemaV14.swift` holds+  (`typealias Entry = AsterismSchemaV16.Entry`). `AsterismSchemaV15.swift` holds   the one frozen snapshot — stored columns and   `@Relationship` macros only, `public init() {}`, no accessors. The nesting is   what makes that snapshot legal; keep it.-- **`AsterismV15MigrationPlan` = `[V14, V15]`, one lightweight stage, and it-  only *adds*.** V15 is V14 plus **one `Work` column**, `releaseDaysRaw`-  (`update-schedule`) — a reader-set list of the weekdays a work publishes on,-  stored as lowercase English day names. No table is added, no existing column-  changes type, no relationship changes shape, and the entity list stays at-  seventeen.--  **Unlike V14's three, this column is defaulted rather than optional**, so its-  property initialiser (`= []`) is the Core Data attribute default the stage-  writes into every existing row — the V10 situation again, and the reason-  `V14RecordedStoreTests` asserts the **raw** `releaseDaysRaw` after conversion-  rather than the tolerant `releaseDays` accessor, which would answer `[]`-  whether or not the default ever landed. It takes the `genreTags` shape-  deliberately (`update-schedule` Q27): a `[String]` array is `CLAUDE.md`'s shape-  for a small value set, a bitmask would be unreadable in the CloudKit dashboard-  and in the archive, and a join table is the shape for a fact two devices edit-  concurrently, which one work's own days are not.--  **Reading is tolerant and writing is not**, as for the status columns: the-  `releaseDays` accessor drops a spelling this build has no case for, the setter-  writes canonical (Monday-first, de-duplicated) order, and **export refuses**-  an unknown raw value by name. A value a future build wrote therefore survives-  on device until the reader saves that work, and convergence copies the-  carrier's raw array **verbatim** rather than canonicalising it-  (`update-schedule` Q51) — a canonicalising write would normalise the siblings-  while the carrier kept its own raw, so the rows could never agree.--  **The V13 → V14 stage retired in the same commit as this freeze**, on+- **`AsterismV16MigrationPlan` = `[V15, V16]`, one lightweight stage, and it+  only *removes*.** V16 is V15 minus **one `Site` column**,+  `junkSuffixRule` (`remove-article-mode`) — the optional `JunkSuffixRule` blob+  that articles mode's title cleaner was the only reader of. No table is added or+  dropped, no existing column changes type, no relationship changes shape,+  nothing is added at all, and the entity list stays at seventeen.++  **This is the first removing stage since V9**, and it needs neither a default+  nor a data pass: a removed column has nothing to write into an existing row.+  The precedent is exact — V8 → V9 dropped optional `Codable` struct attributes+  of this same shape (`Site.urlIdentityRule`, `TitlePattern.segmentWorkAnchor`)+  in one lightweight stage — which is why `remove-article-mode` Q14 ran no spike.+  `V15RecordedStoreTests` seeds a **populated** `junkSuffixRule` through the+  frozen snapshot and proves every other field of every row survives the+  conversion; it cannot assert the removal itself, because the live `Site` has no+  such property to read and the attempt does not compile. That half is the+  schema's, pinned by `ModelContractTests`' delta pin — V16's `Site` is V15's+  minus exactly `junkSuffixRule`, with every other entity identical attribute for+  attribute (Q25, Q26).++  **`JunkSuffixRule` itself stays in `ValueObjects.swift`, unchanged and with no+  consumer but the frozen snapshot** (Q8). Snapshots are frozen *by reference*:+  the type's stored properties are the snapshot's stored shape, so moving,+  nesting or editing it makes a recorded store refuse to open (134504). It goes+  when V15 is retired, and not before.++  **The V14 → V15 stage retired in the same commit as this freeze**, on   `retire-migration-chain` Decision 6's population precondition: the owner-  confirmed every device on marker `"14"` on 2026-09-15-  (`update-schedule` `prerequisites.md`, Q13) *before* the freeze ran, so-  `AsterismSchemaV13.swift`, `V13RecordedStoreFixture` and `V13RecordedStoreTests`+  confirmed every device on marker `"15"` on 2026-09-21+  (`remove-article-mode` Q10) *before* the freeze ran, so+  `AsterismSchemaV14.swift`, `V14RecordedStoreFixture` and `V14RecordedStoreTests`   went with it, along with every `Schema(versionedSchema:)` reference that named-  V13. That is the fifth bump in a row with the verification ahead of the freeze.+  V14. That is the sixth bump in a row with the verification ahead of the freeze.    **The grep gate at a freeze is "enumerated", not "empty"** (`update-schedule`-  Q50). `Schema(versionedSchema: AsterismSchemaV14` *cannot* come back empty —-  the frozen snapshot has legitimate readers, exactly as the V13 residue did-  before this bump: `V14RecordedStoreFixture`, `ModelContractTests` ×3 and+  Q50). `Schema(versionedSchema: AsterismSchemaV15` *cannot* come back empty —+  the frozen snapshot has legitimate readers, exactly as the V14 residue did+  before this bump: `V15RecordedStoreFixture`, `ModelContractTests` ×4 and   `ThumbnailStoreProbeTests`. The gate is that every remaining hit is a-  deliberate frozen-snapshot read **and is listed in the task**, and that no-  `Sources/` file names V14 outside `AsterismSchemaV14.swift` and-  `AsterismV15MigrationPlan`. `AsterismV14MigrationPlan` and `BackupV13` are the+  deliberate frozen-snapshot read **and is listed in the task** — the+  `remove-article-mode` enumeration is in that spec's `implementation.md` — and+  that no `Sources/` file names V15 outside `AsterismSchemaV15.swift`,+  `AsterismV16MigrationPlan` and two comments in `Models.swift`.+  `AsterismV15MigrationPlan` and `AsterismSchemaV14` are the   two that do come back empty. Read a gate that returns hits against that list,   not against zero. @@ -74,10 +75,12 @@ background for the *next* schema bump and describes states that no longer exist.   one in five carrying 150 KB measured 0.2 MB resident against 62.7 MB inline,   and the phone probe measured +0.0 MB against a 10 MB gate before the freeze   ran. **The V14 freeze carried it across verbatim**, along with-  `ThumbnailShape`'s raw spellings and the SHA-256 digest function, and-  `ModelContractTests` now pins the attribute on **both** sides — on live V15 and-  on the frozen V14 `thumbnailData`, which is one of the three enumerated frozen-  reads above. The next freeze owes the same carry-across.+  `ThumbnailShape`'s raw spellings and the SHA-256 digest function, and **the V15+  freeze carried all of that across again**, adding `JunkSuffixRule` and+  `SegmentPositionSpec` as live referents frozen by reference+  (`remove-article-mode` Q8). `ModelContractTests` pins the attribute on **both**+  sides — on live V16 and on the frozen V15 `thumbnailData`, which is one of the+  enumerated frozen reads above. The next freeze owes the same carry-across.    **The V12 → V13 stage retired in the same commit as the V13 freeze**, on   `retire-migration-chain` Decision 6's population precondition: the owner@@ -167,7 +170,7 @@ background for the *next* schema bump and describes states that no longer exist.   behind it. - **V10 was V9 plus three defaulted `Work` columns** — `workStatusRaw`,   `readingStatusRaw` and `verdict` (`work-and-reading-status`). That stage is-  gone, and so is its snapshot, but its columns are part of the frozen V14 shape+  gone, and so is its snapshot, but its columns are part of the frozen V15 shape   and its defaults are bytes in every installed library.   It was for four versions the only one in the project's history to add a   **non-optional** scalar to an existing table under a bare lightweight stage;@@ -178,15 +181,20 @@ background for the *next* schema bump and describes states that no longer exist.   assert the **raw column** after conversion for the reason   `V10RecordedStoreTests` did: a `ToleratedEnum.read(_, default:)` accessor   answers `.ongoing` whether or not the default ever landed, so asserting-  through it would prove nothing. `V14RecordedStoreTests` measures the current-  stage — one defaulted array column arriving `[]`, asserted on the **raw**-  `releaseDaysRaw` rather than through the tolerant accessor, the marker stepping-  `"14"` → `"15"`, the extension's refusal on `"14"`, a clean validation, and the-  whole live library unchanged field by field — and+  through it would prove nothing. `V15RecordedStoreTests` measures the current+  stage — a **removing** one, so there is no arriving column to assert and the+  suite's headline is a deliberate absence: a populated `junkSuffixRule` seeded+  through the frozen snapshot, the marker stepping `"15"` → `"16"`, the+  extension's refusal on `"15"`, a clean validation, and the whole live library+  unchanged field by field, `Work.releaseDaysRaw` seeded non-empty because the+  removed column's nearest neighbour is where a disturbed stage would show — and   `V4RecordedStoreTests` is the below-floor refusal suite.-  `ModelContractTests` pins every half of the shape: the seventeen entities V14-  declares are exactly the seventeen V15 declares, and V15's `Work` is V14's-  `Work` plus exactly `releaseDaysRaw`, which is what makes this bump the+  `ModelContractTests` pins every half of the shape: the seventeen entities V15+  declares are exactly the seventeen V16 declares, V16's `Site` is V15's `Site`+  minus exactly `junkSuffixRule`, and every other entity is identical attribute+  for attribute — type, optionality, uniqueness and options, and each+  relationship's destination, optionality, delete rule and inverse+  (`remove-article-mode` Q25) — which is what makes this bump the   one-column one it   claims to be. It also pins `ReleaseDay`'s raw spellings and its case order, as   it pins the status enums': the case order is the canonical storage and wire@@ -196,10 +204,12 @@ background for the *next* schema bump and describes states that no longer exist.   The "and absent from the previous snapshot" half of the V10 and V11 column   pins went with `AsterismSchemaV10` (`work-creators` Q15), because for a bump   that adds only *tables* there is no frozen schema below the current one left to-  compare against — but **it is back at V15**, because V14 is the snapshot the+  compare against — but **it came back at V15**, because V14 is the snapshot the   added column is absent from, and asserting that absence is what makes the delta-  a delta rather than a list. A column-adding bump should assert both halves; a-  table-adding one cannot. It still pins that+  a delta rather than a list. **V16 turns the same pin around**: the column is+  absent from the *live* schema and present in the frozen one. A bump that moves+  a column either way should assert both halves; a table-adding one cannot. It+  still pins that   none of V9's dropped names is in `Schema(...).entities`, and that the new   tables are CloudKit-legal — every property defaulted, nothing unique, no   relationship on either of them.@@ -213,16 +223,22 @@ background for the *next* schema bump and describes states that no longer exist.   `AsterismSchemaV11` and the `V11RecordedStore*` pair went at V13   (`place-extraction` Q65), and `AsterismSchemaV12` and its pair at V14   (`work-thumbnails`), and `AsterismSchemaV13` and its pair at V15-  (`update-schedule` Q13). A store below-  V14 fails closed with `NSCocoaErrorDomain` 134504 and the recovery is the+  (`update-schedule` Q13), and `AsterismSchemaV14` and its pair at V16+  (`remove-article-mode` Q10). A store below+  V15 fails closed with `NSCocoaErrorDomain` 134504 and the recovery is the   backup archive.-  **What V9's removing stage cost is now history, and the new hazard is the-  opposite one.** V9 dropped 36 columns and the `Site.works` ↔ `Work.site`+  **Both directions have now been sharp.** V9 dropped 36 columns and the+  `Site.works` ↔ `Work.site`   inverse pair, and its consequence was that a scratch container over the frozen   snapshot *aborted the process* — see the trap below, which still stands. V10-  adds instead, and the consequence of adding is that **the live stored shape is-  no longer a subset of the frozen one**: see "Recorded-store fixtures and the-  registry".+  through V15 added instead, and the consequence of adding is that **the live+  stored shape is no longer a subset of the frozen one**: see "Recorded-store+  fixtures and the registry". **V16 removes**, so the subset relation is back for+  the first time since V9 and a stale snapshot registration cannot meet a live+  key it has no answer for. Do not rely on that: it lasts exactly until the next+  adding version, and what the fixtures actually rely on is+  `V15RecordedStoreFixture`'s create-seed-save-**release** ordering plus+  `--no-parallel`. - **The three new columns are read through tolerant accessors.**   `Work.workStatus` / `readingStatus` go through   `ToleratedEnum.read(_, default:)` on the `titleProvenance` pattern, so an@@ -230,7 +246,7 @@ background for the *next* schema bump and describes states that no longer exist.   shown or filtered, while **export refuses the same value by name** — reading   is tolerant, writing is not (`Models.swift`'s `ToleratedEnum` policy; Reqs   1.3, 2.7, 8.3). The raw spellings are frozen — they are bytes in every-  installed library and defaults in the frozen V14 snapshot;+  installed library and defaults in the frozen V15 snapshot;   a committed edit writes what the picker shows, so an unknown   raw does not survive an unrelated edit (Q19). - **No production data pass, and no `LegacyColumns`.** V8's columns were@@ -265,7 +281,7 @@ background for the *next* schema bump and describes states that no longer exist.   below the plan's floor before any container exists; the recovery is the backup   archive), but **every test seeding a store older than the plan's floor and then   opening it has to be rewritten at every bump.** The one convertible fixture is-  `V14RecordedStoreFixture`, seeded in-process+  `V15RecordedStoreFixture`, seeded in-process   through the snapshot it names; `v4-recorded-4.0.0.sqlite` survives only as the   one input that positively reads *below* the floor for the classifier suites.   **This is what happened at V10**, exactly as this note predicted it would:@@ -277,10 +293,10 @@ background for the *next* schema bump and describes states that no longer exist.   `AsterismSchemaV9` deleted `V9RecordedStoreFixture` and `V9RecordedStoreTests`   in the same commit (Q60). **V12 did it deliberately in one commit**, the   freeze and the retirement together (`work-creators` Q15), and **V13 did the-  same** (`place-extraction` Q65), and **so did V14** (`work-thumbnails`) and-  **V15** (`update-schedule`), each with the+  same** (`place-extraction` Q65), and **so did V14** (`work-thumbnails`),+  **V15** (`update-schedule`) and **V16** (`remove-article-mode`), each with the   rename of every test `Schema(versionedSchema:)` reference in that commit too.-  Do the same at V16: seed the successor fixture through the *then*-frozen V15+  Do the same at V17: seed the successor fixture through the *then*-frozen V16   snapshot, and delete its predecessor in the commit that deletes the schema it   opened. - The P1 probe's other measurements still stand@@ -317,25 +333,27 @@ background for the *next* schema bump and describes states that no longer exist.   The V3 → V4 sidecar and completion pass (`V4Migration.buildSidecar` /   `runCompletionPass`) are deleted; the sidecar *filename* survives because the   classifier reads its presence to refuse an open over a vanished store (Q19).-- **The readiness marker holds `"15"`, and the app opens two generations.**-  `extensionOpenableMarkerVersion` is `"15"` — the only one the extension opens+- **The readiness marker holds `"16"`, and the app opens two generations.**+  `extensionOpenableMarkerVersion` is `"16"` — the only one the extension opens   and the only one `publishReadiness` writes — while-  `appOpenableMarkerVersions` is `["14", "15"]` (`laggingOpenableMarkerVersion`-  is `"14"`). An *empty* store is marked ready at birth (Q26). A store carrying+  `appOpenableMarkerVersions` is `["15", "16"]` (`laggingOpenableMarkerVersion`+  is `"15"`). An *empty* store is marked ready at birth (Q26). A store carrying   any other value is refused, with it named in the message, and the recovery is   the backup archive.    **Both generations the app opens are spelled with two characters.** Nothing   anywhere may assume a marker is one character long — not a parser, not a test   fixture, not a comparison. `MarkerContractTests` and-  `MarkerGenerationFifteenTests` are where that is pinned.+  `MarkerGenerationSixteenTests` are where that is pinned. -  **V15 substitutes rather than adds**: `"13"` is gone and `"14"` took its place.+  **V16 substitutes rather than adds**: `"14"` is gone and `"16"` took its+  place, with `"15"` moving into the lagging slot.   The table below says that is only defensible after re-verifying the whole   population has passed the old digit — and **at this bump the verification came-  first** again: the owner confirmed every device on marker `"14"` on 2026-09-15-  (`update-schedule` `prerequisites.md`, Q13) before the freeze, so the marker set-  and `AsterismV15MigrationPlan` moved together, exactly as `"13"` on 2026-09-12+  first** again: the owner confirmed every device on marker `"15"` on 2026-09-21+  (`remove-article-mode` Q10) before the freeze, so the marker set+  and `AsterismV16MigrationPlan` moved together, exactly as `"14"` on 2026-09-15+  and `AsterismV15MigrationPlan` did, and `"13"` on 2026-09-12   and `AsterismV14MigrationPlan` did, and `"12"` on 2026-09-10 and `"11"` on   2026-09-07 before that   (`work-creators` Q15). The one bump that did the opposite@@ -343,37 +361,36 @@ background for the *next* schema bump and describes states that no longer exist.   kept the V9 → V10 stage instead — which does not help a device on marker   `"9"`, because the marker check refuses it before any container exists. Read   that gap as a warning rather than a precedent.-  A `"15"` generation exists at all for a stage with no data pass because+  A `"16"` generation exists at all for a stage with no data pass because   `openContainer` passes the migration plan for **both** roles, so the marker   check is the only thing keeping the stage out of the share extension (Q3). -  `BootstrapState.markerLagging` classifies a `"14"` store, and `act(on:)` runs:-  open (which adds `releaseDaysRaw`) →-  `validateStore` → `publishReadiness` (writes `"15"`) →+  `BootstrapState.markerLagging` classifies a `"15"` store, and `act(on:)` runs:+  open (which drops `Site.junkSuffixRule`) →+  `validateStore` → `publishReadiness` (writes `"16"`) →   `clearResidualEvidence`. **No data pass and no reconciler**, on the V9 arm's   own grounds (Q9 of `drop-superseded-columns`): V8's arm ran both because V8-  *added tables and blobs* something had to fill, whereas V15's one column is-  **defaulted** — the empty array is what the stage writes into every existing-  row from the property initialiser, inside `ModelContainer.init` — so there is-  nothing left for a pass to fill. What certifies+  *added tables and blobs* something had to fill, whereas V16 adds nothing at+  all — a removed column has no value to write into any row — so there is+  nothing for a pass to fill. What certifies   the conversion is the store validating, so validation is the gate and the-  marker goes after it — a throw leaves `"14"` on disk and the next open-  re-enters the arm over an already-converted store, which is safe because adding-  a column that is already there is a no-op.+  marker goes after it — a throw leaves `"15"` on disk and the next open+  re-enters the arm over an already-converted store, which is safe because+  removing a column that is already gone is a no-op.    **The generation is the case's payload, not a case of its own.**-  `markerLagging(generation:)` carries `"14"`; the per-generation cases+  `markerLagging(generation:)` carries `"15"`; the per-generation cases   `markerLaggingV4/V5/V6` were retired by `data-model-cleanups` Decision 2, so a   bump moves the two constants and the arm's wording and adds no   `BootstrapState` case at all (`place-extraction` Q64). -  The extension's refusal **forks**: `"14"` gets "Open Asterism to finish+  The extension's refusal **forks**: `"15"` gets "Open Asterism to finish   updating the library", anything else gets the shipped "has not initialized"   wording (`work-creators` Req 11.3).    The writer is `publishReadiness`, deliberately unversioned: it always writes-  the current generation, and the generation has moved eleven times (4 → 5 → 6 →-  7 → 8 → 9 → 10 → 11 → 12 → 13 → 14 → 15), as the section below records. A nonempty+  the current generation, and the generation has moved twelve times (4 → 5 → 6 →+  7 → 8 → 9 → 10 → 11 → 12 → 13 → 14 → 15 → 16), as the section below records. A nonempty   unmarked store fails the open naming the state; an empty one is marked and   opened — where "empty" means `LibraryRecordCounts.holdsNoReaderRecords`, which   excludes the seeded work-type rows the app writes itself.@@ -384,55 +401,59 @@ background for the *next* schema bump and describes states that no longer exist.   and never runs in the share extension. A failure is logged and the open   continues. Two consequences for tests: a library the app has opened is never   `LibraryRecordCounts.zero` (`.seededEmpty` in the package suites is the-  spelling), and `library-graph-baseline.txt` carries the three seeded rows.+  spelling), and `library-graph-baseline.txt` carries the seeded rows — **two**+  since `remove-article-mode` retired the `article` default, which is no longer+  seeded and whose identifier is never reused (Req 6.1, 6.3, Q5). - **`Site.titleInterpretationRaw` and `workTitleTrimRule` are gone** from the live   `Site`, and now gone entirely: the frozen `AsterismSchemaV3.Site` that carried   them is deleted, and `WorkTitleTrimRule` with it (`ValueObjects.swift` keeps a   comment where it stood). "Work-only" is derived, not stored:   `Site.isWorkOnlyTitleRule` is true when the active pattern is `.wholeTitle`. - **Capability gate is `.multiSite`** (`AsterismCapabilities.current`,-  `multi-site-works` Q29). `BackupV14Codec` stamps the literal `"multi-site"`+  `multi-site-works` Q29). `BackupV15Codec` stamps the literal `"multi-site"`   rather than reading `current`, so the archive's gate is independent of the-  runtime's. 8/9 through 14/15 all kept the literal (`rule-citation-by-uuid` Q19):+  runtime's. 8/9 through 15/16 all kept the literal (`rule-citation-by-uuid` Q19):   the gate names a store shape and a rule-form set, and neither changed. No `supports…` answer   changed with the gate — every one is m4's — so the case exists to name the   store shape it belongs to, and the *generation* is named by its format/schema   numbers, which is what the importer gates on.-- **Backup writes and reads 14/15 only.** `update-schedule` delivers in phases-  and its *archive* phase moved the envelope from 13/14 to 14/15, a few commits-  behind the freeze that took the store to V15. For the length-  of that window `BackupV13ArchiveTests`' pin of the envelope to the live schema+- **Backup writes and reads 15/16 only.** `remove-article-mode` delivers in three+  commits, and its *archive* commit moved the envelope from 14/15 to 15/16, one+  commit behind the freeze that took the store to V16. For the length+  of that window `BackupV14ArchiveTests`' pin of the envelope to the live schema   was wrapped in a self-clearing `withKnownIssue` — Swift Testing fails a   known-issue block whose issue does not occur, so the commit that moved the-  archive had to remove the wrapper or go red. It did, as `work-thumbnails`' did-  one bump earlier; the tie is whole again in `BackupV14ArchiveTests`,+  archive had to remove the wrapper or go red. It did, as `update-schedule`'s and+  `work-thumbnails`' did before it; the tie is whole again in+  `BackupV15ArchiveTests`,   and the same wrapper is the pattern to reuse if a bump ever has to split the-  two again. The rest of this bullet describes 14/15 as it stands (the+  two again. The rest of this bullet describes 15/16 as it stands (the   `data-model-cleanups` Decision 2 argument, made again: single-user population,   fully migrated).-  `BackupV14Exporter` is the only exporter and `BackupImporter.plan` accepts only-  `supportedVersions` — `(BackupV14Document.formatVersion,-  BackupV14Document.schemaVersion)`, i.e. `(14, 15)` — with any other pair refused+  `BackupV15Exporter` is the only exporter and `BackupImporter.plan` accepts only+  `supportedVersions` — `(BackupV15Document.formatVersion,+  BackupV15Document.schemaVersion)`, i.e. `(15, 16)` — with any other pair refused   by version check, naming the detected pair, not by decode failure. The archive-  format number is not the schema number: 14/15 is format 14 over schema 15, and+  format number is not the schema number: 15/16 is format 15 over schema 16, and   since `rule-citation-by-uuid` Q9 the schema number names the *store* schema-  the archive was taken from — which is why `BackupV14Document.schemaVersion` is+  the archive was taken from — which is why `BackupV15Document.schemaVersion` is   pinned to the live schema by a test rather than to a literal someone has to   remember (`place-extraction` Q66). Every older import path — 2/2, 3/3, 4/4,-  5/6, 6/7, 7/8, 8/9, 9/10, 10/11, 11/12, 12/13, 13/14 — is **deleted**; recovering an+  5/6, 6/7, 7/8, 8/9, 9/10, 10/11, 11/12, 12/13, 13/14, 14/15 — is **deleted**; recovering an   older archive means checking out a build that still carries its importer. **An   archive of the previous generation, exported before this build, is unreadable-  by it** (`work-and-reading-status` Q17): the restorable archive is one exported+  by it** (`work-and-reading-status` Q17, `remove-article-mode` Q2): the+  restorable archive is one exported   *after* upgrading. The historically-named V4/V5   *record types* (`BackupV4Entry`, `BackupV5Work`, …) that used to be the-  payload's wire substrate are deleted too: the payload is `BackupV14Payload`-  over `BackupV14Work`, `BackupV14Entry`, `BackupV14Membership`,-  `BackupV14DistinctPair` and the rest, all named for the format that carries+  payload's wire substrate are deleted too: the payload is `BackupV15Payload`+  over `BackupV15Work`, `BackupV15Entry`, `BackupV15Membership`,+  `BackupV15DistinctPair` and the rest, all named for the format that carries   them. `LegacyV2DateFormatter` and   `DuplicateJSONKeyValidator` live on in `BackupJSONCodecSupport.swift`; the live   codec uses both. -  **14/15 added one column to `BackupV14Work`, `releaseDays`** — the work's+  **14/15 added one column to `BackupV15Work`, `releaseDays`** — the work's   weekdays, **required** and written in canonical order, with an empty set   written explicitly (`update-schedule` Q22). Required rather than   `decodeIfPresent` for one reason: otherwise "a record with no release days" is@@ -464,7 +485,7 @@ background for the *next* schema bump and describes states that no longer exist.     for, refuses the export naming the work **by title** — the only refusal in     `requireRepresentableValues` that does, because the remedy is for the reader     to find that work and remove its cover, and the message says so-    (`BackupV14ExportError.thumbnailField` picks that wording). An archive record+    (`BackupV15ExportError.thumbnailField` picks that wording). An archive record     in the same state cannot be refused by anyone: a reader cannot edit an     archive, so the work imports without a cover and its title goes into     `BackupImportReport.droppedThumbnails`, which rides on@@ -479,7 +500,7 @@ background for the *next* schema bump and describes states that no longer exist.     modification guard, so it is the newer state and it carries no usable cover.    **12/13 added two arrays, `places` and `placeSuppressions`**, over-  `BackupV14Place` and `BackupV14PlaceSuppression` (`BackupV13*` at the time) — separate arrays rather than+  `BackupV15Place` and `BackupV15PlaceSuppression` (`BackupV13*` at the time) — separate arrays rather than   a kind column on the character ones, because the store keeps the two kinds in   separate tables and a shared array would be a second spelling of that split.   Both are enumerated whole, and for the places there is a second reason: a@@ -527,32 +548,34 @@ background for the *next* schema bump and describes states that no longer exist.   unopenable for no user value (Q7, Q13). `FrozenLibraryPathTests` fails if one   moves. -## Adding a schema version (V15 and later)+## Adding a schema version (V16 and later) -V14 → V15 is the freshest worked example, and the second in a row to add a-*column* rather than a table: `AsterismSchemaV14.swift` (the snapshot frozen by-`update-schedule`), `AsterismSchemaV15.swift` (live schema plus the plan), the-suite that measures the conversion (`V14RecordedStoreTests` over-`V14RecordedStoreFixture`) and the one that refuses anything older+V15 → V16 is the freshest worked example, and the first stage since V9 to+*remove* a column: `AsterismSchemaV15.swift` (the snapshot frozen by+`remove-article-mode`), `AsterismSchemaV16.swift` (live schema plus the plan), the+suite that measures the conversion (`V15RecordedStoreTests` over+`V15RecordedStoreFixture`) and the one that refuses anything older (`V4RecordedStoreTests`). V13 → V14 and V10 → V11 are the two stages that have added optional columns, V9 → V10 and V14 → V15 the two that have added a-**defaulted non-optional** one, and V8 → V9 the only one that has ever *removed*-anything. V14 is also+**defaulted non-optional** one, and V8 → V9 and V15 → V16 the two that have+*removed*. A removing stage is the cheapest of the three — no default, no data+pass, nothing for the stage to write — and `remove-article-mode` Q14 ran no+spike before it on V9's precedent. V14 is also the first to add an `@Attribute` — `.externalStorage` on `thumbnailData` — and-that option is part of the stored shape, which the V14 freeze carried across and-the next one must too.+that option is part of the stored shape, which the V14 and V15 freezes carried+across and the next one must too. What a new version has to touch:  | Step | Where | |---|---|-| Declare the snapshot | Freeze the current live schema as `AsterismSchemaV15` proper — stored columns, `@Attribute` options and `@Relationship` macros only, `public init() {}`, no accessors — and add `AsterismSchemaV16` with the new models; every entity nested, zero top-level `@Model`. Name in the frozen header every enum raw value its defaults bake in, as V14's header names `WorkStatus.ongoing` and `ReadingStatus.reading`, and carry across whatever the live header declares frozen for its own generation — at V15 that is `ThumbnailShape`'s two spellings, the SHA-256 digest function, `.externalStorage` and `ReleaseDay`'s seven raw spellings. Rename every test `Schema(versionedSchema:)` reference in **this** commit: the snapshot the old ones name is deleted here, and the test target must compile at every green commit (`place-extraction` Q65) |-| Add the stage | `AsterismV15MigrationPlan`'s successor: `.lightweight(fromVersion: V15, toVersion: V16)`, or a data pass run by the bootstrap if the change is not purely structural. Declaring it makes every store older than the plan's oldest schema **fail closed** — see the current-state bullet, and rewrite the fixtures that seed one |-| Give an added column a literal default, or make it optional | A defaulted, non-optional, non-unique scalar is the CloudKit-mirrored shape most columns here have, and its **property initialiser is what becomes the Core Data attribute default** — which is what fills existing rows during the stage. An **optional** column needs no default at all, which is what V11's two `Work` columns did: nil is the value, and there is nothing for the stage to write. A stage that adds only *tables*, as V12 and V13 both did, involves neither; V14 went back to optional columns, three of them, and V15 to a defaulted one. Either way, assert the **raw column** after conversion, not an accessor that would answer the default either way — `V14RecordedStoreTests` is the current suite and the live example, because the tolerant `releaseDays` accessor answers `[]` whether or not the column landed |-| Extend the accepted markers | `appOpenableMarkerVersions`, `laggingOpenableMarkerVersion` and `extensionOpenableMarkerVersion` (`"15"`, what `publishReadiness` writes) in `LibraryRepository+Bootstrap.swift`. **Both roles.** **Add** the new generation to the app's set rather than substituting, or every device that has not launched the new build yet fails closed. Substituting is only defensible after re-verifying the whole population has passed the old digit — `work-and-reading-status` Q18 and `drop-superseded-columns` Q2 are what that verification looks like written down, and `series-and-related-works` Q32 is what it looks like when it is *skipped*: keeping the old stage in the plan does not compensate, because the marker check refuses first, and `work-creators` Q15, `place-extraction`'s `prerequisites.md`, `work-thumbnails`' and `update-schedule`'s are what it looks like done in the right order — the box ticked before the freeze. The generation is a *string*, not a digit: `"14"` and `"15"` both have two characters. **Check what the suites use as their canonical *unrecognised* marker before taking the next value**: five suites used `"10"` for that, and it had to move to `"99"` when `"10"` went live, or they would have been asserting the refusal of a marker the app opens (Q28) |+| Declare the snapshot | Freeze the current live schema as `AsterismSchemaV16` proper — stored columns, `@Attribute` options and `@Relationship` macros only, `public init() {}`, no accessors — and add `AsterismSchemaV17` with the new models; every entity nested, zero top-level `@Model`. Name in the frozen header every enum raw value its defaults bake in, as V14's header names `WorkStatus.ongoing` and `ReadingStatus.reading`, and carry across whatever the live header declares frozen for its own generation — at V16 that is `ThumbnailShape`'s two spellings, the SHA-256 digest function, `.externalStorage`, `ReleaseDay`'s seven raw spellings and the live referents `JunkSuffixRule` and `SegmentPositionSpec`, which the frozen shape stores by reference. Rename every test `Schema(versionedSchema:)` reference in **this** commit: the snapshot the old ones name is deleted here, and the test target must compile at every green commit (`place-extraction` Q65) |+| Add the stage | `AsterismV16MigrationPlan`'s successor: `.lightweight(fromVersion: V16, toVersion: V17)`, or a data pass run by the bootstrap if the change is not purely structural. Declaring it makes every store older than the plan's oldest schema **fail closed** — see the current-state bullet, and rewrite the fixtures that seed one |+| Give an added column a literal default, or make it optional (a removed one needs neither) | A defaulted, non-optional, non-unique scalar is the CloudKit-mirrored shape most columns here have, and its **property initialiser is what becomes the Core Data attribute default** — which is what fills existing rows during the stage. An **optional** column needs no default at all, which is what V11's two `Work` columns did: nil is the value, and there is nothing for the stage to write. A stage that adds only *tables*, as V12 and V13 both did, involves neither; V14 went back to optional columns, three of them, and V15 to a defaulted one. **V16 removes instead**, which needs none of this: there is no value to write into an existing row, and the suite's assertion becomes the absence — which `V15RecordedStoreTests` cannot state directly, because the live class has no such property, so `ModelContractTests`' delta pin states it and the recorded store proves nothing else moved. Where a column *arrives*, assert the **raw column** after conversion, not an accessor that would answer the default either way — the `releaseDays` accessor answers `[]` whether or not the column landed |+| Extend the accepted markers | `appOpenableMarkerVersions`, `laggingOpenableMarkerVersion` and `extensionOpenableMarkerVersion` (`"16"`, what `publishReadiness` writes) in `LibraryRepository+Bootstrap.swift`. **Both roles.** **Add** the new generation to the app's set rather than substituting, or every device that has not launched the new build yet fails closed. Substituting is only defensible after re-verifying the whole population has passed the old digit — `work-and-reading-status` Q18 and `drop-superseded-columns` Q2 are what that verification looks like written down, and `series-and-related-works` Q32 is what it looks like when it is *skipped*: keeping the old stage in the plan does not compensate, because the marker check refuses first, and `work-creators` Q15, `place-extraction`'s `prerequisites.md`, `work-thumbnails`', `update-schedule`'s and `remove-article-mode` Q10 are what it looks like done in the right order — the box ticked before the freeze. The generation is a *string*, not a digit: `"15"` and `"16"` both have two characters. **Check what the suites use as their canonical *unrecognised* marker before taking the next value**: five suites used `"10"` for that, and it had to move to `"99"` when `"10"` went live, or they would have been asserting the refusal of a marker the app opens (Q28) | | Classify the new state | `BootstrapState` (`LibraryRepository+BootstrapState.swift`) is an ordered match the compiler checks for exhaustiveness, and the lagging generation is the **payload** of `markerLagging(generation:)` rather than a case per generation — the per-generation cases went with `data-model-cleanups` Decision 2. So a bump moves the two constants and the arm's wording and adds **no** case (`place-extraction` Q64) |-| Add the upgrade path | A marker-lagging branch that runs the data pass, validates, and publishes the new marker *after* the work it certifies — never before. **`update-schedule` is the live worked example**: `BootstrapState.markerLagging` plus the `"14"` arm in `act(on:)`, with `MarkerGenerationFifteenTests` pinning the sequence, the failure that must leave the marker put, and both halves of the extension's fork. A stage with no data pass still needs the generation, and validation is what certifies it |+| Add the upgrade path | A marker-lagging branch that runs the data pass, validates, and publishes the new marker *after* the work it certifies — never before. **`remove-article-mode` is the live worked example**: `BootstrapState.markerLagging` plus the `"15"` arm in `act(on:)`, with `MarkerGenerationSixteenTests` pinning the sequence, the failure that must leave the marker put, and both halves of the extension's fork. A stage with no data pass still needs the generation, and validation is what certifies it | | Keep the extension out | The extension opens only the current marker version. It must never migrate: it holds a shared lock, and two invocations can run concurrently. This mattered most for a stage that **removes** — a concurrent share-sheet open mid-conversion is destructive rather than merely early — but the rule is unconditional |-| Extend the archive, if the schema is reader data | A new column the reader owns needs an archive generation too — `update-schedule` is the freshest worked example, 13/14 → 14/15 with `BackupV14Exporter`/`BackupV14Codec` replacing the V13 set outright and one new **required** column on `BackupV14Work`, decoded into its typed enum so an unknown spelling refuses the archive as malformed (Q22, Q36), plus a test tying `schemaVersion` to the live schema so the fourth thing of a bump cannot be forgotten (Q66). `work-thumbnails` did it at 12/13 → 13/14 with two columns on the work record — and note what it did *not* archive: a value the bytes derive is re-derived on import rather than carried (its Req 8.1). `place-extraction` did it at 11/12 → 12/13 with two new record types, `work-creators` at 10/11 → 11/12 with three, `series-and-related-works` at 9/10 → 10/11 with two, `work-and-reading-status` at 8/9 → 9/10 (Q17, Q34) and `rule-citation-by-uuid` at 7/8 → 8/9 — or a backup silently stops round-tripping it. **A new *table* is a new record type, not a new column on an existing one**, and the importer needs an upsert guard and a refusal for every reference it cannot resolve; each older importer was deleted outright when its successor landed rather than kept beside it (`series-and-related-works` Q13). A stage that only *removes* store columns changes no wire shape: V9 re-recorded no golden. But a change to a record the archive *carries* does, whatever the store schema does — 8/9 was a codec change with no schema stage behind it, which is why Q9 pins the schema number to the store the archive was taken from. Re-record the golden through `BackupGoldenExportTests`' `ASTERISM_RECORD_GOLDEN=1` mode (`rule-citation-by-uuid` Q22) rather than by hand. **A table the archive reaches by a UUID column** — as `Place` is — also owes the update-path ownership rule of `place-extraction` Q76, because a `modifiedAt` guard cannot protect a field nothing timestamps |+| Extend the archive, if the schema is reader data | A column the reader owns needs an archive generation too, whichever way it moves — `remove-article-mode` is the freshest worked example and the first *removing* one, 14/15 → 15/16 with `BackupV15Exporter`/`BackupV15Codec` replacing the V14 set outright (Q12) and `junkSuffixRule` leaving `BackupV15Site`, `supportedVersions` becoming `(15, 16)` so a 14/15 file is refused by version and writes nothing (Req 5.3), and the Site's `mode` staying a **typed** `SiteMode` so the retired spelling refuses the archive as malformed. `update-schedule` is the adding example, 13/14 → 14/15 with one new **required** column on the work record, decoded into its typed enum for the same reason (Q22, Q36), plus a test tying `schemaVersion` to the live schema so the fourth thing of a bump cannot be forgotten (Q66). `work-thumbnails` did it at 12/13 → 13/14 with two columns on the work record — and note what it did *not* archive: a value the bytes derive is re-derived on import rather than carried (its Req 8.1). `place-extraction` did it at 11/12 → 12/13 with two new record types, `work-creators` at 10/11 → 11/12 with three, `series-and-related-works` at 9/10 → 10/11 with two, `work-and-reading-status` at 8/9 → 9/10 (Q17, Q34) and `rule-citation-by-uuid` at 7/8 → 8/9 — or a backup silently stops round-tripping it. **A new *table* is a new record type, not a new column on an existing one**, and the importer needs an upsert guard and a refusal for every reference it cannot resolve; each older importer was deleted outright when its successor landed rather than kept beside it (`series-and-related-works` Q13). A stage that removes a store column changes the wire shape only if the archive **carried** that column: V9's dropped columns were never archived, so it re-recorded no golden, while V16's `junkSuffixRule` was on the wire and the golden moved with it. But a change to a record the archive *carries* does, whatever the store schema does — 8/9 was a codec change with no schema stage behind it, which is why Q9 pins the schema number to the store the archive was taken from. Re-record the golden through `BackupGoldenExportTests`' `ASTERISM_RECORD_GOLDEN=1` mode (`rule-citation-by-uuid` Q22) rather than by hand. **A table the archive reaches by a UUID column** — as `Place` is — also owes the update-path ownership rule of `place-extraction` Q76, because a `modifiedAt` guard cannot protect a field nothing timestamps |  `specs/relational-references/` is the full worked spec for a relational bump. @@ -574,7 +597,7 @@ every freeze and confirm each hit names the new live schema.  ### Recorded-store fixtures and the registry -`V14RecordedStoreFixture` seeds a store *through* the frozen snapshot, which is+`V15RecordedStoreFixture` seeds a store *through* the frozen snapshot, which is the only way to get a genuinely previous-version store without committing a binary — and it is the same registry hazard, deliberately taken. What makes it safe is **ordering, not the schema**:@@ -589,18 +612,23 @@ safe is **ordering, not the schema**:   the registration. Dropping the flag would abort the process rather than fail a   test (`docs/agent-notes/testing.md`). -**That safety net is now the only one.** Until V10 there was a second: V9's+**That safety net is the one to rely on, in both directions.** Until V10 there+was a second: V9's stored shape was a strict subset of V8's, because the stage only removed, so a live key a stale V8 registration could not answer did not exist. The note warned that "a version that *adds* loses the subset relation, and the ordering above becomes the only thing holding it up" — **V10 was that version**, and every bump-since has widened the gap: V11 added two `Work` columns and two tables, V12+through V15 widened the gap: V11 added two `Work` columns and two tables, V12 added `Creator`, `CreatorRole` and `WorkCredit`, V13 added `Place` and `PlaceSuppression`, V14 added three `Work` columns — one of them an-external-storage blob — and V15 adds `releaseDaysRaw`, which the frozen V14-snapshot cannot name at all. A+external-storage blob — and V15 added `releaseDaysRaw`, which the frozen V14+snapshot could not name at all. A snapshot registration left live *would* meet keys it-cannot answer. Nothing but `V14RecordedStoreFixture`'s+cannot answer. **V16 removes**, so the subset relation is back for the first+time since V9 and that particular key cannot be met — but the frozen V15+registration can still answer `junkSuffixRule`, which the live schema has no+column for, and the next adding version loses the subset again. Nothing but+`V15RecordedStoreFixture`'s create-seed-save-**release** ordering, plus `make test-core`'s `--no-parallel`, keeps the registry coherent. Write the next recorded-store fixture the same way and say so in its doc comment.@@ -619,14 +647,15 @@ precondition in `specs/retire-migration-chain/` Decision 6, not a formality.  ## History — lessons for the next schema bump -### The marker generation has moved ten times, and the old ones were kept until they were provably unreachable+### The marker generation has moved twelve times, and the old ones were kept until they were provably unreachable  `"4"` (the relationship pass, `retire-migration-chain`) → `"5"` (`configurable-work-types`) → `"6"` (`character-extraction`) → `"7"` (`relational-references`) → `"8"` (`multi-site-works`) → `"9"` (`drop-superseded-columns`) → `"10"` (`work-and-reading-status`) → `"11"` (`series-and-related-works`) → `"12"` (`work-creators`) → `"13"`-(`place-extraction`) → `"14"` (`work-thumbnails`), which is what+(`place-extraction`) → `"14"` (`work-thumbnails`) → `"15"`+(`update-schedule`) → `"16"` (`remove-article-mode`), which is what `publishReadiness` writes today. Each bump superseded a statement that had read as permanent: the note said "the readiness marker holds `"5"`", then `"6"`, then `"7"`, then `"8"`, then `"9"`, then `"12"`, and each time the *old* value stayed in@@ -640,11 +669,12 @@ through `"9"` was one character, and enough of this note and its readers said string, compared as a string, and any code that indexes or length-checks it is wrong. -The set has been *shrunk* seven times. Six were on the same grounds rather than+The set has been *shrunk* nine times. Eight were on the same grounds rather than on a change of mind about the rule: `data-model-cleanups` removed `"4"`–`"6"`, `drop-superseded-columns` removed `"7"`, `work-and-reading-status` removed `"8"`, `work-creators` removed `"10"`,-`place-extraction` removed `"11"` and `work-thumbnails` removed `"12"` —+`place-extraction` removed `"11"`, `work-thumbnails` removed `"12"`,+`update-schedule` removed `"13"` and `remove-article-mode` removed `"14"` — each by establishing that the population had passed them (one user, every device confirmed on the successor). **The fourth, in order, was not — for one commit.** `series-and-related-works`@@ -652,15 +682,16 @@ removed `"9"` with the precondition unticked (Q32), and kept the V9 → V10 *sta which protects nothing, because the marker check refuses a `"9"` store before any container is constructed. The owner confirmed the population on 2026-09-06 and the follow-up retired the stage and its snapshot (Q60), so the set is back on the-rule — and both bumps since have ticked the box *before* the freeze rather than+rule — and every bump since has ticked the box *before* the freeze rather than after it (`work-creators` Q15; `place-extraction`'s `prerequisites.md`, confirmed-2026-09-10). The order still matters for the next bump: add the+2026-09-10; `work-thumbnails`'; `update-schedule` Q13; `remove-article-mode`+Q10). The order still matters for the next bump: add the generation, ship it, and only retire the predecessor once every device is known to be past it.  `V6` was likewise "the live schema" and the plan was `[V5, V6]`; so were V7, V8,-V9, V10, V11, V12 and V13. Every one of those statements was true and every one-moved on schedule.+V9, V10, V11, V12, V13, V14 and V15. Every one of those statements was true and+every one moved on schedule.  ### Nesting every entity is what makes an in-module snapshot possible @@ -680,8 +711,8 @@ snapshots are inert. zero top-level `@Model` types, and make the top-level names typealiases. The now-deleted `V4MigrationBootstrapTests` seeded genuine frozen-`AsterismSchemaV3` stores and the bootstrap migrated them in-process with no collision;-`V14RecordedStoreFixture` does the same through the-frozen V14 snapshot today. That+`V15RecordedStoreFixture` does the same through the+frozen V15 snapshot today. That in-process seeding is the second reason to keep the nesting: it is how a conversion test gets a store at the previous version without committing a binary fixture.
docs/agent-notes/testing.md Modified +14 / -9
diff --git a/docs/agent-notes/testing.md b/docs/agent-notes/testing.mdindex 93ea1091..9b3e0938 100644--- a/docs/agent-notes/testing.md+++ b/docs/agent-notes/testing.md@@ -303,7 +303,7 @@ only suites driving them were device-gated, the sole symptom was a `waitForExistence` timeout nobody ever saw. Those seeders and their fixtures have since been deleted with the device suites that were their only callers, but the two fixes they forced still bind everything that replaces them: seeders guard on-the *features* they write (`allows(patternForm:)`, `supportsArticles`), never on a+the *features* they write (`allows(patternForm:)`, `supportsURLIdentity`), never on a gate identity; and every seeded scenario carries one `test…ScenarioReachesRecent` check that is **not** device-gated, so a throwing seeder fails on `make test-ui`. @@ -381,7 +381,7 @@ unaffected.  The message above is the shape the crash took when the mismatched key was `Site.entries` and V3/V4 were the frozen snapshots. Those are long gone; the live-schema is now **V15** and the one frozen snapshot is `AsterismSchemaV14`.+schema is now **V16** and the one frozen snapshot is `AsterismSchemaV15`.  **The hazard has now been sharp in both directions, and V10 and V11 had it in the original one.** V9 was the first schema that *removed*, which made the live@@ -399,12 +399,17 @@ not an absence of it. **V14 put it back in the quieter direction**: it added three optional `Work` columns (`thumbnailData`, in external storage, `thumbnailShapeRaw` and `thumbnailDigest`), so the live entity was wider than the frozen one *within a shared entity* again, and a stale registration cost a-column that will not save while every other column persists. **V15 keeps it-there** with one more `Work` column, the defaulted `releaseDaysRaw`.-`V14RecordedStoreFixture` opens containers over-`AsterismSchemaV14` in the same process as every suite using the live V15 classes-(`V14RecordedStoreTests`, `V4RecordedStoreTests`, `CertificationPathTests`,-`StoreMetadataTests`, `MarkerContractTests`, `MarkerGenerationFifteenTests`), which is why its `write(at:)`+column that will not save while every other column persists. **V15 kept it+there** with one more `Work` column, the defaulted `releaseDaysRaw`. **V16 puts+it back in the original direction**: it *removes* `Site.junkSuffixRule` and adds+nothing, so the live stored shape is a strict subset of the frozen one again for+the first time since V9, and a stale snapshot registration cannot meet a live key+it has no answer for. That is a reprieve, not the mechanism — the next adding+version loses the subset again, and the ordering below is what is actually relied+on. `V15RecordedStoreFixture` opens containers over+`AsterismSchemaV15` in the same process as every suite using the live V16 classes+(`V15RecordedStoreTests`, `V4RecordedStoreTests`, `CertificationPathTests`,+`StoreMetadataTests`, `MarkerContractTests`, `MarkerGenerationSixteenTests`), which is why its `write(at:)` releases the snapshot container before returning — see `docs/agent-notes/schema-migration.md`, where the loss of the live-within-frozen subset relation is now a lived fact rather than a prediction.@@ -654,7 +659,7 @@ Five recorded facts changed on 2026-09-14, in one round of owner iteration on   and by `LibraryRepository.thumbnailBytes`. A test that needs a gapped cover   builds one by encoding a crop that hangs over its source:   `encode(image600x700, crop: CGRect(x: 0, y: -100, width: 600, height: 900),-  shape: .portrait)` stores 600×700. `BackupV14Fixtures.gappedCoverBytes` is+  shape: .portrait)` stores 600×700. `BackupV15Fixtures.gappedCoverBytes` is   that fixture for the archive suites. - **A query- or fragment-bearing candidate URL costs two download attempts**   (Q90): the fetcher plans the bare URL immediately after it, same source, same
docs/asterism-design.md Modified +14 / -12
diff --git a/docs/asterism-design.md b/docs/asterism-design.mdindex 9ab12586..41365a98 100644--- a/docs/asterism-design.md+++ b/docs/asterism-design.md@@ -78,10 +78,10 @@ Cut from v1 (deferred to v2, per §2.1): Characters (the v2 AI pass defines that |---|---|---| | hostname | String | Key. | | displayName | String | e.g. "Royal Road". |-| mode | Enum: untaught / taught / articles | |+| mode | Enum: untaught / taught | `articles` was the third value and was **removed** at schema V16 (`specs/remove-article-mode/`). A row still carrying the raw value reads as an unknown mode and quarantines the Site. | | patterns | [TitlePattern] | Relation. Exactly **one active pattern** in v1; historical patterns are retained (see TitlePattern). Recogniser machinery — and with it any "first match wins" semantics — is v2, deferred until a real mixed-format site demands it. | | urlIdentityRule | Rule? | Which URL path/query segment identifies a work. Versioned (see below). |-| junkSuffixRule | Rule? | For articles-mode sites: optional strip rule for display/export cleanliness. |+| ~~junkSuffixRule~~ | Rule? | For articles-mode sites: optional strip rule for display/export cleanliness. **Dropped** at schema V16 with the mode it served (`specs/remove-article-mode/`), and gone from the archive at generation 15/16. |  **TitlePattern** — a model entity, not a transformable blob, because entry provenance references pattern versions and forensics requires historical definitions to survive. @@ -240,11 +240,13 @@ Same chip interaction on the shared URL's path/query segments: tap the segment t  **Work landing URL — confirmed, never inferred.** Path truncation is not generally valid (query-param identities like Webtoons' `title_no=`, non-terminal path structures, sites whose landing page uses a different route). When the taught identity is a terminal path segment, the card offers the truncated-path candidate as an optional "work page link" step — confirm or skip. Query-param identities get no candidate. Only a human-confirmed workURL is stored; exports link the site line only when one exists (§8). -### 4.6 Articles mode+### 4.6 ~~Articles mode~~ — removed -An exit ramp on the same teach screen: "This site is just articles." Sets Site.mode = articles; entries from the site stay intentionally unattached and are never flagged unparsed. Optional refinement, same chip mechanic: mark a junk suffix to strip from display and exports.+*What it was: an exit ramp on the same teach screen — "This site is just articles." It set Site.mode = articles; entries from the site stayed intentionally unattached and were never flagged unparsed. Optional refinement, same chip mechanic: mark a junk suffix to strip from display and exports.* -Articles mode is site-global by design, but not the only tool: mixed sites (a WordPress blog hosting both a serial and unrelated articles) are handled by the per-entry **Leave unattached** override in Move to… (§6.2). Path-scoped article rules are deferred until a real site needs them.+**Removed** (`specs/remove-article-mode/`, T-2336): the owner never used it and it diluted the app's purpose. Every way in, every behaviour that read it, `SiteMode.articles`, `Site.junkSuffixRule` (schema V16) and the archive field (generation 15/16) are gone, and the `article` default work type is no longer seeded. A Site row that still carries the raw value is handled as any other unknown mode — quarantined under the Site-tuple diagnosis, omitted from the sites list, refused by export — with no conversion or repair.++Mixed sites (a WordPress blog hosting both a serial and unrelated articles) were never articles mode's job and still are not: they are handled by the per-entry **Leave unattached** override in Move to… (§6.2), which stays.  ### 4.7 Re-teaching: two distinct operations @@ -329,7 +331,7 @@ Both live under the Works tab too (`specs/work-creators/`), on the same route pa  ### 5.3 Settings (gear) -Sites list: every stored site — untaught, taught, and articles — with mode and display name (Q10 of `specs/polish-and-export/`); tap to re-teach or flip mode. Work types list. **Creator roles** (`specs/work-creators/`): the reader's own vocabulary for what a creator did on a work, seeded with `author`, `artist` and `translator` at the first open of a library and never re-seeded after that — a list the reader empties stays empty. The section lists the active roles **in the reader's order**, which is the order every credit's roles are drawn in everywhere else, and the order is set by dragging rows; beneath them sit the roles the reader removed, each with the number of credits still holding it. Removal hides a role rather than deleting it — the credits keep the identifier, and adding the name again restores that same role at the end of the list with the newly typed spelling. A role's own screen renames it, which reaches every credit holding it without writing one of them. Full-library backup export (§10). Deliberately buried.+Sites list: every stored site — untaught and taught — with mode and display name (Q10 of `specs/polish-and-export/`); tap to re-teach. Work types list. **Creator roles** (`specs/work-creators/`): the reader's own vocabulary for what a creator did on a work, seeded with `author`, `artist` and `translator` at the first open of a library and never re-seeded after that — a list the reader empties stays empty. The section lists the active roles **in the reader's order**, which is the order every credit's roles are drawn in everywhere else, and the order is set by dragging rows; beneath them sit the roles the reader removed, each with the number of credits still holding it. Removal hides a role rather than deleting it — the credits keep the identifier, and adding the name again restores that same role at the end of the list with the newly typed spelling. A role's own screen renames it, which reaches every credit holding it without writing one of them. Full-library backup export (§10). Deliberately buried.  ### 5.4 Stats @@ -445,7 +447,7 @@ Three fires reveal is great. Who lit the third? Calling it now: Ilse.  - Rating: `▲` or `▼` on the date line; **unrated shows nothing**. The date is the entry's firstCapturedAt, matching the order the per-work document is built in. - Note text verbatim; an empty note renders as heading + date line only.-- Unattached/article entries use the **cleaned capture title** (junk-strip applied) as the heading.+- Unattached entries use the **capture title** as the heading. (Until V16 an articles-mode entry used a junk-strip-cleaned one; the mode and the cleaner are gone — `specs/remove-article-mode/`.) - The link is the entry's rawURL.  **Standalone per-entry export**: the same block with a **work line** between the heading and the date line — the work's display title in emphasis, then its type in parentheses, unlinked: `*The Perfect Run* (novel)`. The type is dropped when it is the untyped default; the whole line is dropped for unattached entries and for titles empty once trimmed. Inside a per-work document the H1 already names the work, so the line never appears there. A bare "Chapter 14" is useless as a shared or archived document; the line adds identification only, not the metadata dump this section forbids (`specs/polish-and-export/`, Decision 4).@@ -496,7 +498,7 @@ Thumbnails **arrived** in `work-thumbnails` (schema V14) and are stored as exter ### v1  - Share extension: capture states, identity-key re-share editing, Safari preprocessing JS (title + canonical), bounded fetch fallback, schema-marker check before container construction.-- Teach mode: chip cycling, end-anchored derivation with contiguous work ranges, live preview, retroactive re-parse, URL-identity card with backfill, confirmed work-URL step, articles mode with junk-strip, re-teach with both scopes (§4.7).+- Teach mode: chip cycling, end-anchored derivation with contiguous work ranges, live preview, retroactive re-parse, URL-identity card with backfill, confirmed work-URL step, ~~articles mode with junk-strip~~ (removed at V16, §4.6), re-teach with both scopes (§4.7). - Recent feed (lastSharedAt order), day grouping, inbox banner/filter (unparsed + review-duplicate), inline Teach. - Works list, unattached group, empty-work sinking, New Work. - Work detail: header meta line, open-last-noted, generic notes, the chapter-notes spine with its Newest/Chapter order, rows that open their entries; title, type and genre-tag editing behind an explicit edit mode.@@ -518,7 +520,7 @@ Scope lives here; sequencing and per-item briefs live in - Thumbnail population (lazy og:image fetch on first work-page open; external-Data storage). - ~~Update-weekday field + "updating today" view~~ — **shipped** (`specs/update-schedule/`, §5.1): `releaseDaysRaw` on `Work` at schema V15, seven toggles in the editor's Status card, and the Today tab in place of Recent. The inference half was **not** built and is an explicit non-goal: the days are typed by the reader, with no clustering over capture timestamps and no Apple Intelligence involvement. - **Optional trailing sequence in a combined URL rule.** *Scheduled (2026-08-06) — a real site needs it.* `tthfanfic.org` was built for single-chapter stories, so chapter 1 sits at `/Story-28614/DianeCastle+…htm` and chapter 105 at `/Story-28614-105/DianeCastle+…htm`: one path component carrying the Work identity and an *optional* chapter indicator. The existing `.combined` form already parses the second — locator on the first path component, prefix `Story-`, separator `-`, work-then-sequence — but `URLTwoFieldTemplateApplicator` requires *exactly one* separator in the interior (`starts.count == 1`), so the first throws `ambiguousSeparator(count: 0)` and chapter 1 never joins the Work its own 104 siblings are in. The fix is an arm of `.combined` in which zero separators means the whole interior is the Work identity and the sequence is simply absent; absent should stay absent rather than defaulting to "1", since §7 orders by capture anyway and inventing a sequence is inventing data. Cost is small and well contained: `URLRuleDefinition` lives as a JSON blob in `URLRulePattern.definitionData`, not as a column, so this is a Codable arm plus whatever the archive needs — no new column, and none of the invariant relaxation the recogniser item below would force. Worth checking while specifying it: whether the site *also* serves chapter 1 as `-1`, which would give one chapter two identity keys, and how a confirmed work URL of `/Story-28614/` relates to an entry whose own URL is the same string.-- Multi-pattern recognisers for mixed-format sites (this is where first-match/priority semantics arrive); path-scoped article rules — still only if a real site demands them. The `tthfanfic.org` case above first looked like one and is not: it is a single URL shape with an optional tail, not two competing rules. Worth knowing before this is ever scheduled: the cost is not the recogniser columns but the invariant. "A taught Site holds exactly one active title rule" is asserted by the store validator, the repository contract check, entry-detail reads *and the archive codec*, and duplicate-Site reconciliation picks a single surviving active rule — so relaxing it is an archive format change.+- Multi-pattern recognisers for mixed-format sites (this is where first-match/priority semantics arrive) — still only if a real site demands them. (The path-scoped article rules that sat beside this went with articles mode, §4.6.) The `tthfanfic.org` case above first looked like one and is not: it is a single URL shape with an optional tail, not two competing rules. Worth knowing before this is ever scheduled: the cost is not the recogniser columns but the invariant. "A taught Site holds exactly one active title rule" is asserted by the store validator, the repository contract check, entry-detail reads *and the archive codec*, and duplicate-Site reconciliation picks a single surviving active rule — so relaxing it is an archive format change. - Pending-capture queue for the extension migration window (public-release prerequisite). - URL-identity auto-suggestion via URL diffing; canonical-URL opt-in for identity via taught rules. - Work-to-work linking for cross-format stories, if needed.@@ -601,7 +603,7 @@ Milestone numbers are planning labels and have drifted from the code: the runtim Local store with full v1 schema (versioned from day one); share extension with all four capture states (no parsing yet — every entry lands unparsed/unattached); Recent and Works shells; manual Move to… with New Work and Leave unattached; full-library JSON backup with self-validation. *Outcome: daily capture can start; nothing captured is ever lost or unprocessable later.*  **M2 — Title teaching & retroactive parsing.** *Shipped.*-Teach mode: chips, end-anchored derivation, live preview, articles mode, junk-strip; TitlePattern entity with history; retroactive re-parse; inbox banner/filter; per-field provenance in anger; re-teach with both scopes; entry-detail provenance disclosure and Re-parse.+Teach mode: chips, end-anchored derivation, live preview, ~~articles mode, junk-strip~~ (removed at V16, §4.6); TitlePattern entity with history; retroactive re-parse; inbox banner/filter; per-field provenance in anger; re-teach with both scopes; entry-detail provenance disclosure and Re-parse.  **M3 — URL identity & re-share.** *Shipped.* entryIdentityKey with conservative normalisation; identity-key re-share editing with lastSharedAt semantics; URL-identity teaching card, including optional chapter-sequence extraction for sites whose title supplies only the Work; backfill and collide/split preview; confirmed work-URL step; work Merge. URL teaching may extract Work identity and chapter sequence from the same path/query component; the sequence remains distinct from `chapterTitle` and does not change §7 ordering.@@ -625,7 +627,7 @@ Mirroring on the personal container; separate CloudKit containers for the person  Two constraints found while specifying M4a. **Only the app mirrors** — TN3164's *"Avoid synchronizing a store with multiple persistent containers"* names the app-and-extension-share-a-store case directly, each container keeps its own export history token (so both processes can export one object twice), and an extension is terminated too soon after completing its request for an asynchronous export to finish anyway. The extension writes locally and the app exports on next run. **The backup work is a format change, not a policy change:** export self-validates by decoding its own bytes, and that decode runs the reference validator; worse, duplicate Site rows cannot be represented at all, because `BackupV4Site` is keyed by hostname and every reference to a Site is a hostname string. Representing them means giving Site an identity in the payload. -Also unresolved here: whether Codable-struct attributes (`Site.urlIdentityRule`, `Site.junkSuffixRule`, `TitlePattern.segmentWorkAnchor`), which map to Core Data composite attributes, round-trip through CKRecord. Both V4 and V3 construct a mirroring `ModelContainer` with no model-shape rejection, so the schema needs no change on that evidence, but `initializeCloudKitSchema()` against a real container is the first task of this milestone.+Also unresolved here: whether Codable-struct attributes (`Site.urlIdentityRule`, `Site.junkSuffixRule` — both since dropped, the latter at V16 — `TitlePattern.segmentWorkAnchor`), which map to Core Data composite attributes, round-trip through CKRecord. Both V4 and V3 construct a mirroring `ModelContainer` with no model-shape rejection, so the schema needs no change on that evidence, but `initializeCloudKitSchema()` against a real container is the first task of this milestone.  **M4c — Duplicate reconciliation.** *Shipped. Spec: `specs/duplicate-reconciliation/`.* Duplicate Entries auto-collapse when note, rating, and Work assignment agree; divergent sets go to a resolution sheet through the Recent banner. Duplicate Site rows reconcile silently — they are re-derivable teaching knowledge, and the alternative degraded state is an unopenable library (that half shipped in M4b). Duplicate Works collapse only when neither side carries reader-authored content; otherwise they surface for manual Merge, since generic notes and a manually edited title are exactly the prose the app exists to protect. A capture matching an unresolved duplicate set saves a new Entry rather than refusing (§3.4, and M1's guarantee that nothing captured is lost); reconciliation handles N ≥ 2, not just the pairs §2.3 describes.@@ -640,6 +642,6 @@ Four things the spec settled that this paragraph did not anticipate, each of whi Deliberately last, and it paid: the reconciler was written against the states M4a and M4b had already made observable rather than against a guess about which kinds occur.  **M5 — Polish & export.** *Shipped. Spec: `specs/polish-and-export/`.*-Markdown exports (per-work, per-entry); search on both tabs; rating pulse; Sites settings screen; deletion prompts and edge behaviours; visual pass (Liquid Glass conventions per the mockups). Also the **articles-mode exit** M2 deferred to here (§4.6): re-teaching an articles site is accepted from the Sites screen and from nowhere else, returning the site to taught mode with the normal retroactive semantics (§4.7) and clearing its junk-suffix rule. There is still no reverse mode toggle, and the gate that stops inbox-driven teaching from converting an articles site by accident holds on every other path.+Markdown exports (per-work, per-entry); search on both tabs; rating pulse; Sites settings screen; deletion prompts and edge behaviours; visual pass (Liquid Glass conventions per the mockups). Also the **articles-mode exit** M2 deferred to here (§4.6): re-teaching an articles site was accepted from the Sites screen and from nowhere else, returning the site to taught mode with the normal retroactive semantics (§4.7) and clearing its junk-suffix rule. All of it — the exit, the gate that stopped inbox-driven teaching from converting an articles site by accident, and the mode itself — was **removed** at V16 (`specs/remove-article-mode/`).  Sequencing note: the whole M4 group precedes M5 because sync issues surface only with time and multiple devices in play — the earlier CloudKit runs against real captures, the more of its edge cases M5's polish period absorbs. The split does not weaken that: M4a is short and offline, and M4b still gets mirroring in front of real data well before M5. The accepted cost is a window during M4b in which duplicates accumulate unreconciled, which M4a guarantees will degrade rather than fail.
docs/asterism-style-guide.md Modified +1 / -1
diff --git a/docs/asterism-style-guide.md b/docs/asterism-style-guide.mdindex e879b3cd..921b2046 100644--- a/docs/asterism-style-guide.md+++ b/docs/asterism-style-guide.md@@ -79,7 +79,7 @@ No glow on: text, cards, dim glyphs (`?`, ✎), rating triangles, the spine's ra  Concentric radius system, outside-in: sheet 44 → banner/card 20–22 → field 20 → pill/button 21 (capsule) → chip 15 → tag/pill 10–12 → glyph. Buttons and the tab bar are always full capsules. Grabber: 36×4.5, 3 px radius, ~.3 white. -**Site glyphs are circles** (radius = half size) with a radial "star" gradient lit from top-left (e.g. Royal Road `radial-gradient(circle at 35% 30%, #5d86d8, #2d4a8f)`) — they read as stars, which is the point. Exceptions: unknown site `?` and article ✎ use a flat translucent circle, dim, no glow. The work-detail cover is the one rounded rectangle (62×84, radius 14), same radial treatment — see *[Work detail dark]*.+**Site glyphs are circles** (radius = half size) with a radial "star" gradient lit from top-left (e.g. Royal Road `radial-gradient(circle at 35% 30%, #5d86d8, #2d4a8f)`) — they read as stars, which is the point. Exceptions: unknown site `?` and the unattached-notes row ✎ use a flat translucent circle, dim, no glow. The work-detail cover is the one rounded rectangle (62×84, radius 14), same radial treatment — see *[Work detail dark]*.  ## 7. Components 
docs/asterism-v2-plan.md Modified +6 / -5
diff --git a/docs/asterism-v2-plan.md b/docs/asterism-v2-plan.mdindex 64dfeb58..0563bdf6 100644--- a/docs/asterism-v2-plan.md+++ b/docs/asterism-v2-plan.md@@ -341,9 +341,9 @@ parked entry now points here.    latency), or precompute when an untaught capture lands in Recent? A latency    spike decides this; do the spike before designing the interaction. 3. **Prompt shape.** How many example captures to feed, and how to choose them.-4. Should the model ever propose the **articles** exit — "this site is not-   serialised fiction"? Lean: out of scope for the first cut.-5. Does a rejected or failed suggestion leave any trace? Lean: silence.+4. Does a rejected or failed suggestion leave any trace? Lean: silence.+   (An earlier item 4 asked whether the model should propose the **articles**+   exit; articles mode was removed at V16 — `specs/remove-article-mode/`.)  **Done when.** Opening teach mode on an untaught site with several captures offers a rule that parses them, the reader can edit or ignore it with the editor@@ -507,8 +507,9 @@ Do not put dates on these. Each waits for something real to demand it.   The **markdown export shape is already the model input shape** (design §11) —   feed `MarkdownExportModel` rather than inventing a serialisation — and the   inference stays off the capture path.-- **Multi-pattern recognisers** for mixed-format sites, and path-scoped article-  rules. This is where first-match / priority semantics would arrive. The+- **Multi-pattern recognisers** for mixed-format sites. (The path-scoped article+  rules that stood beside this went with articles mode, removed at V16.) This is+  where first-match / priority semantics would arrive. The   `tthfanfic.org` case first looked like this and is not — it is item 1. Before   scheduling, know that the cost is not the recogniser columns but the invariant:   *"a taught Site holds exactly one active title rule"* is asserted by
specs/OVERVIEW.md Modified +13 / -0
diff --git a/specs/OVERVIEW.md b/specs/OVERVIEW.mdindex d9564582..38fdfa38 100644--- a/specs/OVERVIEW.md+++ b/specs/OVERVIEW.md@@ -50,6 +50,7 @@ | [Share Sheet Character Chips](#share-sheet-character-chips) | 2026-09-18 | In Progress | Smolspec (T-2317). The share sheets' cast text row becomes name-only chips; tapping one opens an inline card with that character's aliases and note, never facts. A cast past two chip rows collapses behind a `+N more` chip (Decision 1). Read-only, no schema change; `FlowLayout` moves into ConstellationKit. Supersedes `share-sheet-characters` Q2 (notes) and Q6 (no pills). | | [Launch to Today](#launch-to-today) | 2026-09-19 | Done | Full spec. Today appears without waiting for the works snapshot: its schedule is built inside the Today read (superseding `update-schedule` Q28), the works snapshot loads in the background behind a gate on Works and Stats, and the launch reconcile follows that load. Adds a launch-to-Today measurement with no budget yet, and removes the search field from Today while keeping the filter for T-2347. No schema change. | | [Today Announcements](#today-announcements) | 2026-09-19 | Done — `make test-core` (3,002 checks, zero known issues), `make test-quick` and `make build-mac` green; the six failures across `make test`, `make test-ui` and `make test-ui-ipad` are measured to reproduce at `main`'s tip (`verification-run.md` §2) | Smolspec. A release note and a getting-started guide surface on Today as one row that looks like an entry row and opens a sheet showing a bundled Markdown document, rendered natively with images; both stay reachable from a new About section in Settings. The release-note row shows when the marketing version differs from a per-device last-seen version kept in `UserDefaults` and hides when its sheet closes; getting started replaces the settled empty-library message and goes with the first entry. No schema change; the marketing version becomes 0.7.0. |+| [Remove Article Mode](#remove-article-mode) | 2026-09-21 | Done — `make test` carries UI failures `main` owns, so Req 7.1 is not met as written (Q34) | Full spec (T-2336). Removes articles mode: the one-way Site state, its UI and repository operations, `SiteMode.articles` with every arm over it, and the `article` default work type. Schema V16 drops `Site.junkSuffixRule`, the one column only the mode used, and the archive moves to 15/16; 14/15 backups stop importing. No conversion is built, because no articles Site exists (Decision 1, Q10). Three commits: remove the mode, schema V16, archive and documents. |  --- @@ -836,3 +837,15 @@ Smolspec. Two announcements, a release note and a getting-started guide, each dr - [decision_log.md](today-announcements/decision_log.md) - [verification-run.md](today-announcements/verification-run.md) - [implementation.md](today-announcements/implementation.md)++## Remove Article Mode++**Created:** 2026-09-21 · **Status:** Done — all eight tasks landed in three commits 2026-09-21/22, rebased onto `main` at `36d874e9`. `make test-core` (zero known issues), `make test-quick` and `make test-ui-ipad` green, apart from host file-protection failures recorded in `implementation.md`. `make test` carries UI failures that reproduce on `main` and are not this branch's (Q34); Req 7.1 is not met as written and its waiver is the owner's call. Q1–Q34 and Decision 1 in the log.++Full spec (T-2336). Removes articles mode: the one-way Site state, its UI and repository operations, `SiteMode.articles` with every arm over it, and the `article` default work type. Schema V16 drops `Site.junkSuffixRule`, the one column only the mode used, and the archive moves to 15/16; 14/15 backups stop importing. No conversion is built, because no articles Site exists (Decision 1, Q10). Three commits: remove the mode, schema V16, archive and documents.++- [requirements.md](remove-article-mode/requirements.md)+- [design.md](remove-article-mode/design.md)+- [tasks.md](remove-article-mode/tasks.md)+- [decision_log.md](remove-article-mode/decision_log.md)+- [implementation.md](remove-article-mode/implementation.md)
specs/remove-article-mode/decision_log.md Added +77 / -0
diff --git a/specs/remove-article-mode/decision_log.md b/specs/remove-article-mode/decision_log.mdnew file mode 100644index 00000000..ba06c49c--- /dev/null+++ b/specs/remove-article-mode/decision_log.md@@ -0,0 +1,77 @@+# Decision Log: Remove Article Mode++## Quick Decisions++| ID | Date | Decision | Rationale |+|----|------|----------|-----------|+| Q1 | 2026-09-21 | Full spec, not a smolspec | Dropping `Site.junkSuffixRule` is a schema bump, which the project rules make a full spec; the archive and the persisted mode value change too |+| Q2 | 2026-09-21 | 14/15 archives are refused by the version check; no articles-specific import handling exists | Owner: least work, for a situation that does not exist. The importer has always read exactly one generation (`docs/agent-notes/schema-migration.md`, `work-and-reading-status` Q17), and a 15/16 archive cannot contain an articles Site because export refuses an unknown mode by name |+| Q3 | 2026-09-21 | Already-seeded `article` work-type rows are left alone | Owner decision. The row is reader-owned once seeded and removable in Settings; an automatic removal would need a rule for works typed `article` and a convergence story against devices that still seed it |+| Q4 | 2026-09-21 | The dim pencil glyph stays, renamed away from articles | The unattached-notes row borrows it (`SiteGlyphKind.articles` doc comment), so only the name and the articles caller go |+| Q5 | 2026-09-21 | The retired seed identifier `D0000003-…` is never reused | Libraries that seeded it still hold rows under that identity; reuse would fold a new default into them |+| Q6 | 2026-09-21 | A `none` assignment requires `intentionallyUnattached == false` | This is the invariant `LibraryValidator.swift:1313` already enforces on every untaught and taught Site; articles mode was its only exception, so removing the exception invalidates no row that is legal today. Two duplicate-resolution writers (`LibraryRepository+DuplicateResolution.swift:697-703`, `DuplicateReconciler.swift:1636-1639`) set the flag without writing manual provenance and may already produce a row the current validator rejects; that predates this feature and is out of scope (T-2361) |+| Q7 | 2026-09-21 | The golden archive's `articles.example` Site becomes a `taught` Site, `trimmed.example`, with its retained pattern made active; `golden.example` loses its junk rule | That graph carries the fixture's only canonical URL, `trimSuffix` pattern, absent-series work and one of its two links, each asserted by `BackupGoldenExportTests`. `untaught` is not available: that tuple may hold no pattern, active or not (`LibraryValidator.swift:862`) |+| Q8 | 2026-09-21 | `JunkSuffixRule` stays in the sources, unchanged, with no consumer but the V15 snapshot | Snapshots are frozen by reference (`AsterismSchemaV14.swift:36-42`): the type's stored properties are the snapshot's stored shape, and moving, nesting or editing it makes a recorded store refuse to open (134504). It goes when V15 is retired |+| Q9 | 2026-09-21 | A two-device mirroring check after the upgrade belongs in the verification run, not the requirements | Sync is verified by hand under the device-run rule; the mixed-build window is closed by updating every device together |+| Q10 | 2026-09-21 | The owner prerequisites are already checked; the spec carries no `prerequisites.md`, and the design and tasks carry no owner steps | Owner, 2026-09-21: no articles Site exists on any device or library and every device has passed marker `"15"`, which is the population check retiring `AsterismSchemaV14` requires (`retire-migration-chain` Decision 6) |+| Q11 | 2026-09-21 | `GroupOrdering.authoredContent(of:)` keeps reading `intentionallyUnattached` without a provenance gate | Articles was the comment's stated reason, but T-2361's two duplicate-path writers can still leave the flag on a row whose own provenance is `none`; gating now would read that row as bare on one device and authored on another. The gate belongs to T-2361 |+| Q12 | 2026-09-21 | The archive set is renamed `BackupV15*` and the V14 set deleted, though only one field leaves the Site record | House convention: each generation's codec, exporter and types replace the previous set outright (`series-and-related-works` Q13), and the type names say which format they carry |+| Q13 | 2026-09-21 | The golden archive is re-recorded twice: at 14/15 in the commit that removes the mode, and as 15/16 in the archive commit | The first commit removes the enum case the golden's articles Site decodes into; the archive generation moves two commits later. Re-recording is one environment variable |+| Q14 | 2026-09-21 | No spike precedes the schema commit | V8 to V9 dropped optional Codable struct attributes of `JunkSuffixRule`'s shape in one lightweight stage (`AsterismSchemaV8.swift:175,188-189` at `260c455d^`), so the stage is precedented; `V15RecordedStoreTests` seeds a populated rule and proves it for this column |+| Q15 | 2026-09-21 | Three commits: remove the mode, schema V16, archive 15/16 with documents | Owner: the work is done in one sitting, so splitting entry points from Core semantics bought only interim states (a surviving cleaner, a capability gate outliving its UI, files touched twice). The schema commit stays alone because the project rule makes it one commit and it should read and revert as a pure schema move; the archive stays out of it because a 53-file rename would drown that diff |+| Q16 | 2026-09-21 | The entry-detail criterion was removed from Requirement 1 after approval | Entry detail offers no articles switch; it holds only comments citing `SiteDetailModel.ArticlesPrompt`, which Req 7.2 already covers. Req 1.4 and 1.5 became 1.3 and 1.4 |+| Q17 | 2026-09-21 | `make test-core` carries one known issue between the schema commit and the archive commit | The standing window the project holds open with a self-clearing `withKnownIssue`; Req 7.1's zero applies from the archive commit |+| Q18 | 2026-09-21 | Tests that used `projectArticles` to reach `TeachingBasis.patterns` move to `projectReplacement`, not to the composed-teaching projection | `ComposedTeachingBasis` carries only `currentTitleRule`; `RuleOrderingTests` would not compile against it and `RetiredUnreadableRuleTests` would assert nothing |+| Q19 | 2026-09-21 | `EntryTeachingDetail.displayTitle` stays; only `CaptureOutcome.displayTitle` goes | design.md listed both, but they are not the same fact. The capture one was only ever set on the articles branch. The entry-detail one carries `presentationTitle`, whose taught arm trims a whole-title rule's retained affixes, and `EntryDetailModel.titleCardHeading` is its one reader; removing it would put the untrimmed capture title back on a trimmed entry. Export does not read it: it calls `presentationTitle` itself |+| Q20 | 2026-09-21 | `CaptureOutcome.intentionallyUnattached` goes with the mode, and so do the parameters whose last reader was an articles arm | Found in review: after Req 2.2 both producers of the capture flag were the literal `false`, and the share extension's guard on it was constantly true. Dropped alongside it: `site:` from the validator's `validateChapter`, `validateAssignment`, `validateEntryTuple` and the private `validate(entry:…)`, `site:` from `presentationTitle`, `siteMode:` from `isRecentEntryActionable`. The `Entry` column of the same name is unaffected |+| Q21 | 2026-09-21 | The baseline's header note may name the retired mode | `library-graph-baseline.txt` and the serializer that emits its header say the seed's third Site was the articles one. Req 7.2's exceptions did not list it; it is historical prose explaining a hand edit in a hand-reviewed fixture, not a name of a live mode, and without it the five deleted lines have no recorded reason |+| Q22 | 2026-09-21 | Tests that pinned something other than the mode were re-themed, not deleted; one integration arm was dropped without a successor | `PendingCaptureDrainTests.rulesInForceAtCommitTimeAreUsed` now asserts a Work assignment from a rule taught after the share, `LibraryToleranceScanTests.scanNeverProducesATupleDiagnosis` uses an untaught row holding a pattern as its second illegal tuple, and `RuleSuggesterTests.basisReadThrowYieldsNothing` was renamed for what it pins. `PendingCaptureDrainTests.aDrainedArticlesRowIsAVariant` went with the mode: that a flag-only unattachment counts as authored (Q11) is still pinned at unit level in `GroupOrderingTests` |+| Q23 | 2026-09-21 | Commit 1 landed with `make test` and `make test-ui-ipad` still owed | Both were run on a host another session was testing on (one-minute load 100 to 176). `make test` ended with six XCUITest element-query timeouts in suites this feature does not touch, and `make test-ui-ipad` was killed twice before its runner bootstrapped, running zero tests. `make test-core` and `make test-quick` are green on the committed tree. Req 7.1 is not met until both UI targets pass on a quiet host, and that run is owed before the branch is pushed; `implementation.md` has the detail |+| Q24 | 2026-09-21 | The graph baseline's dump format moves 12 to 13 with the column | design.md's commit 2 row named only the `junkSuffixRule=` field. The fixture's own rule is that the format line says which shape it holds, and every bump since format 5 has moved it; a field leaving is a shape change. The header paragraph is written in both the fixture and `LibraryGraphSerializer.dump`, which is byte-compared against it. Hand-edited: the format line, the header, and two site lines |+| Q25 | 2026-09-21 | The V15 to V16 delta pin compares stored shape for every entity, not `Work`'s property names | A removing bump moves `Site`, and "nothing else moved" needs all seventeen entities. Review found the first version compared name sets only, so a retype or a dropped attribute option passed it; it now compares each attribute's type, optionality, uniqueness and options and each relationship's destination, optionality, delete rule and inverse. Shown falsifiable by removing `.externalStorage` from `Work.thumbnailData`. A relationship's `valueType` is excluded because the two schemas nest different Swift classes under one entity name |+| Q26 | 2026-09-21 | The removal is pinned over the schema, not over the recorded store | `V15RecordedStoreTests` cannot assert that the column is gone: the live `Site` has no such property to read. The suite seeds a populated rule through the frozen snapshot and proves every other field of every row survives; `ModelContractTests` pins that exactly `Site.junkSuffixRule` left |+| Q27 | 2026-09-21 | Between commits 2 and 3 nothing imports an archive Site carrying a populated junk-suffix rule | `archivedJunkSuffixRuleIsNeverApplied` asserted a write to a property that no longer exists and went one commit after it arrived. The field is an optional on a `Codable` record that `makeSite` does not read, and commit 3 deletes it and refuses 14/15 archives by name, so the gap is one commit wide and deliberate |+| Q28 | 2026-09-22 | The archive rename takes every generation-spelled name with it, the export filename included | design.md named three files. `FrozenLibraryPathTests.namesTheArchiveFormat` pins `mapV15*Record`, `backupV15Snapshot`, `projectV15Payload` and `MockV15SnapshotProvider`, so a partial rename does not compile, and the previous generation move did the same. The exported file's `v14` component becomes `v15`; nothing parses it, since the scavenger matches the `Asterism-backup-` prefix and both import pickers take a content type. `BackupV15Codec.label`, left at `"V13"` by the previous rename, is corrected |+| Q29 | 2026-09-22 | An archive Site with a mode this build cannot name is refused on decode, and a test pins it | `BackupV15Site.mode` stays a typed `SiteMode`, which is half of the argument for building no import mapping (Decision 1), and review found three doc comments asserting it and no test. `BackupV15ArchiveTests.siteWithAnUnknownModeRefuses` uses a neutral spelling, so Req 7.2's one-file exception for the retired value is untouched; a 14/15 file, the only one that could carry that value, is refused a step earlier by pair |+| Q30 | 2026-09-22 | A 15/16 archive that still carries a `junkSuffixRule` key on a Site fails the checksum; no key-specific test | `Codable` drops the unwritten key, the re-encode omits it, and the checksum comparison fails, as it does for any key this build does not write. `BackupV15ArchiveTests.citationVersionFailsTheChecksum` pins the mechanism. Req 5 is silent on the case and this is the right answer for a file no build produces |+| Q31 | 2026-09-22 | Fixtures that exist to reach a decode failure take their envelope pair from the document's constants | `BackupV15Fixtures.literalDocument` hard-coded the pair. Left at 14/15 its four decode-refusal fixtures would have been refused by version and proved nothing, silently. It now interpolates `BackupV15Document.formatVersion` and `.schemaVersion`; `retiredGenerationDocument` keeps its literal `(14, 15)`, because naming a retired pair is its purpose |+| Q32 | 2026-09-22 | `schema-migration.md` was rewritten where a removing bump falsified it, not renumbered | Three standing claims were true only of adding stages: that the live stored shape is never a subset of the frozen one (V16 restores the subset until the next adding version, and a stale frozen registration then answers a key the live schema lacks), that a stage needs a default, and that a removing stage changes no wire shape (true of V9, whose dropped columns were never archived; false of V16). `asterism-design.md` §4.6 is struck through and put in the past tense, not deleted, so §4.5 to §4.7 stays explained |+| Q33 | 2026-09-22 | Requirements 1.1, 1.2, 1.4, 2.1 and 2.4 are proved by deletion and the Req 7.2 grep, and 2.3 by the compiler | No test asserts the absence of a removed view or identifier; the views, identifiers and the parameters that carried the mode are gone, so there is nothing left to assert against. Recorded so the coverage reads as chosen, not missed |+| Q34 | 2026-09-22 | The seven UI failures are not this branch's, and Req 7.1's two UI targets stay red until `main` fixes them | Run on `main` at `36d874e9`: four fail there verbatim (three works-options cases already root-caused in `launch-to-today` §3.4, and the largest-Dynamic-Type entry card, which asserts before it scrolls), one is already fixed by #82, which landed after this branch was cut, and the two Today cases fail only on the first day of the displayed week, which is the day every branch run was made. This supersedes Q23's load explanation. The branch was then rebased onto `main` at `36d874e9`, after which `make test-ui-ipad` passes (30 tests, 0 failures), so `make test` is the one target left red; whether Req 7.1 is waived for the failures `main` owns is the owner's call. `implementation.md` has the table |++## Decision 1: Assume no articles Site exists and build no conversion++**Date**: 2026-09-21+**Status**: accepted++### Context++`SiteMode.articles` is a raw string persisted on `Site` rows, mirrored through CloudKit and written into archives. Removing the enum case leaves any existing `articles` row with a value the build no longer knows. Reads are tolerant (`ToleratedEnum` yields `untaught`), but the validator reports an unknown mode, which quarantines the Site under `.siteTuple`: teaching is refused, its Today rows show the rules-invalid state, the sites list omits it, and export refuses it by name. No in-app repair clears that state, and `Personal` has no Empty Library. Its entries are Work-less and flagged `intentionallyUnattached`.++The owner states the mode has never been used in the real library.++### Decision++Build no conversion, repair or import mapping for articles Sites. An `articles` mode value is handled exactly as any other unknown mode value. The owner has checked the assumption (Q10).++### Rationale++The situation does not exist in the real library, and the project has deliberately retired production data passes. A repair would be new code, on the silent path, for rows nobody holds. The existing unknown-value behaviour is loud rather than lossy: nothing is deleted or rewritten, and the failure names the Site.++### Alternatives Considered++- **Rewrite articles Sites to untaught in the reconciler**: value-guarded and deterministic, so it fits the convergence rules - Rejected because it adds a permanent reconcile phase for data that does not exist.+- **Delete the article entries**: treats article captures as not belonging in the app - Rejected as a new deletion path outside the fenced ones, and destructive.+- **Map `articles` to `untaught` on import only**: keeps old archives usable - Rejected per Q2; the owner chose the least work and no such archive is known.++### Consequences++**Positive:**+- The change stays a deletion plus a column drop, with no new pass and no new tolerated state.+- No write happens on the silent path.++**Negative:**+- An articles Site that exists despite the owner's check (Q10) is quarantined with no in-app repair. On `Development` the library can be cleared with Empty Library; on `Personal` the recovery is CloudKit's environment reset plus a restore of the pre-flight 14/15 archive through a V15 build.+- A V15 build left on a second device can still create an articles Site and sync it in, so every device updates together.++---
specs/remove-article-mode/design.md Added +150 / -0
diff --git a/specs/remove-article-mode/design.md b/specs/remove-article-mode/design.mdnew file mode 100644index 00000000..82229c9c--- /dev/null+++ b/specs/remove-article-mode/design.md@@ -0,0 +1,150 @@+# Design: Remove Article Mode++Requirements: [requirements.md](requirements.md). Decisions: [decision_log.md](decision_log.md). The schema move follows the step table under "Adding a schema version" in `docs/agent-notes/schema-migration.md`, which also defines the terms used here: the readiness marker (a generation string in a file beside the store that decides which builds may open it), the frozen snapshot, and the recorded-store fixture.++## Overview++The change is a deletion in four layers, made in three commits: the ways into articles mode, the behaviour that reads it, the column that stores its one setting (schema V16), and the archive field that carries that column (generation 15/16).++## Architecture++### Three commits++Each commit compiles and passes `make test-core` and `make test-quick`; `make test` and `make test-ui-ipad` run after commits 1 and 3, the ones that touch UI (Req 7.1). One exception is planned: between commits 2 and 3 `make test-core` reports exactly one known issue, the archive envelope trailing the schema; Req 7.1's zero holds from commit 3.++| Commit | Removes | Persisted shape | Why it stands alone |+|---|---|---|---|+| 1. Remove the mode | every way into articles mode and every behaviour that reads it: UI, plumbing, repository operations, `SiteMode.articles` and every arm over it, the capability gate, the validator exception, capture's flag and cleaned title, the junk-rule plumbing, the `article` seed | unchanged; `Site.junkSuffixRule` is still a column, written nil by import and read by nothing | Removing the enum case breaks every `switch` at once, so the case, its arms, its entry points and the fixtures that seed it go together |+| 2. Schema V16 | `Site.junkSuffixRule`, `AsterismSchemaV14` and everything that opened it | V16, marker `"16"` | The freeze, the drop, the V14 deletion and the fixture rewrite are one commit by rule (Req 4.2), and it reads and reverts as a pure schema move |+| 3. Archive 15/16 and documents | the Site record's `junkSuffixRule`, the `BackupV14*` set; docs, in-app guides, CHANGELOG | archive 15/16 | A mechanical rename across 55 Swift files (48 package, 7 app) that would drown the schema diff; held open from commit 2 by a self-clearing `withKnownIssue` |++### Commit 1: remove the mode++#### Entry points++| Surface | Change |+|---|---|+| `SitesView.swift`, `SitesModels.swift` | "Treat every page as an article" button, confirmation dialog, `ArticlesPrompt`, `canSwitchToArticles`, `didSwitchToArticles`, the request/cancel/confirm methods; `onReteach` loses its second argument |+| `ComposedTeachingView.swift`, `ComposedTeachingViewModel.swift` | `articlesAffordance`, `articlesConfirmation`, `articlesConfirmButton`, the junk-suffix stepper and count, `projectArticlesAndPublish`, `commitArticlesContract`, `supportsArticles`, `articlesRequested` |+| `AppNavigation.swift` (`PendingReteach`), `SettingsScreen.swift:81`, `ContentView.swift:710`, `AppLibraryModel.teach`, `RuleSuggester.swift:69,382`, `ComposedTeachingRequest` (`ComposedTeachingProjection.swift:199-218`) | the `permitsArticlesConversion` parameter, end to end |+| `LibraryRepository+ComposedTeaching.swift` | the permission gates (`:53-61`, `:108-109`), `convertsFromArticles`, the `junkSuffixRule = nil` write (`:179`), and the conversion fix-up that promotes `none` assignments to `manual` (`:192-217`). |+| `LibraryProviding.swift:298-301`, `MockLibraryProvider.swift:471-476,615-623` | `projectArticles`, `commitArticles` and the mock's state for them |+| `LibraryRepository+Articles.swift` | deleted; `ArticlesContract`, `ArticlesRequest`, `ArticlesOutcome`, `ArticlesCommitOutcome` leave `ProjectionContract.swift` |+| `ArticleTitlePlanning.swift` | deleted, `ArticleTitleCleaner` included |+| `AsterismCapabilities.swift` | `supportsArticles`, `AsterismCapabilityError.articlesUnavailable`, with `ModelContractTests:26-31` and `CapabilityGatingTests:21` |+| Comments citing `SiteDetailModel.ArticlesPrompt` | `EntryDetailModel.swift:354`, `EntryDetailView.swift:249`, `WorkTypesModels.swift:165`, `WorkTypesView.swift:177` and their test twins, reworded to stand without the reference |++Ten accessibility identifiers go with their views: `composed-articles-*` (six), `site-detail-articles-*` (three) and `capture.articleTitle`.++Tests:++| Test | Change |+|---|---|+| `ArticlesModeTests`, `ArticlesReteachFlagTests`, `RepositoryArticlesModeTests` (`RepositoryTeachingTests.swift:1179-1310`) | deleted |+| `WritePathQuarantineTests.commitArticlesResolvesDuplicateSiteRows`, `GroupBulkWriteTests.articlesFansOut`, `IntegrationSafetyNetTests.articlesTransitionRestoresConservativeKeys` | deleted |+| `RuleOrderingTests:64`, `RetiredUnreadableRuleTests:110` | use `projectArticles` to reach `TeachingBasis.patterns`; re-pointed at `projectReplacement(hostname:patternDefinition:boundaryEntryID:)`, which builds the same basis and needs the `taught` Site both fixtures already have. The composed-teaching basis has no `patterns` array and cannot stand in |+| `RefreshUnionInvariantTests:142` | line deleted; the loop's other two projections cover the invariant |+| `SitesModelTests`, `ComposedTeachingViewModelTests`, `AppNavigationTests:853-858` | articles tests, `articlesContract(entryCount:)`, `makeArticlesContract()` and the permission recorder go |+| `testArticlesAffordanceIsSeparateFromTitleSelection`, `testTheArticlesSwitchConfirmsBeforeItWrites` | deleted |++#### Core semantics++The eleven `switch` statements over `SiteMode`, and the `if`-based sites beside them, lose their articles arm:++| Site | What the arm does | After |+|---|---|---|+| `LibraryValidator.swift:857`, `:880` | legal tuple and its refusal reason | two tuples |+| `LibraryValidator.swift:1270`, `:1322` | `site.mode != .articles` guards | guard dropped |+| `LibraryValidator.swift:1313` | `intentionallyUnattached == (site.mode == .articles)` on a `none` assignment | `!entry.intentionallyUnattached` (Req 3.3, Q6) |+| `BackupArchiveProjection.swift:486`, `BackupArchiveReferenceChecks.swift:336` | export and import tuple checks | two tuples |+| `LibraryRepository+TodayPresentation.swift:163`, `:331`, `:351` | action type per mode, recent-site-mode validation with its junk-rule clauses (`:332-345`), non-actionable articles entries | dropped |+| `LibraryRepository+EntryDetail.swift:328`, `:384` | cleaned presentation title, empty action set | dropped |+| `SitesModels.swift:152`, `:335`, `SitesView.swift:103`, `ComposedTeachingViewModel.swift:950`, `:1067` | explanation, label, glyph, two mode comparisons | dropped |+| `SiteUnionProjection.swift:302` | articles beats the untaught fallback in the mode election | that line deleted; the rest of the election unchanged |+| `RuleSuggestionCoordinator.swift:420-423`, `LibraryRepository+Contracts.swift:50-62` | eligibility and teaching-basis refusals | dropped |+| `LibraryRepository+ReparseCapture.swift:525-551` | capture-basis validation of an articles Site, and the "non-articles Site retains a junk suffix rule" throw | dropped |++Other changes:++- **Capture and reparse.** `LibraryRepository+OutcomeComputation.swift:93-100` and `LibraryRepository+ReparseCapture.swift:357-358` are the articles writers of `intentionallyUnattached`; both go. `CaptureOutcome.displayTitle` goes; `EntryTeachingDetail.displayTitle` stays, because it carries `presentationTitle`'s trimming for `EntryDetailModel.titleCardHeading` (amended by Q19). `CaptureOutcome.intentionallyUnattached` goes too, with the parameters whose last reader was an articles arm (Q20). `CaptureView.swift:226-237` (with `capture.articleTitle`) is deleted. `CaptureOutcome.hasParsedTitle` loses its display-title clause. `CaptureView.swift:301-306` shows "No chapter parsed from title" unconditionally.+- **Junk-suffix plumbing.** `CaptureBasis.junkSuffixRule`, `SiteSnapshot.junkSuffixRule` (`Snapshots.swift:287`, filled at `LibraryRepository+Sites.swift:80`), `ProjectedSite.junkSuffixRule`, `SiteReconciler.swift:180-181` go. `BackupArchiveProjection.swift:1012` emits a literal nil; `ArchiveRecordBuilders.swift:71` and `LibraryRepository+ConfirmImport.swift:531-532` write nil.+- **Glyph.** `SiteGlyphKind.articles` is renamed `.unattached` with its doc comment rewritten; `WorksView.swift:1087` is its one remaining caller (Q4).+- **`GroupOrdering.authoredContent(of:)`** keeps reading the flag without a provenance gate; its comment cites T-2361's writers as the reason (Q11).+- **Seed.** `WorkTypeSeeding.seeds` holds `novel` and `webtoon`, with a comment retiring `D0000003-0000-4000-8000-000000000003` by name (Req 6.3). The per-identifier guard is unchanged, which is what gives Req 6.2.++Tests and fixtures:++| Test or fixture | Change |+|---|---|+| Golden builder (`BackupGoldenExportTests.swift:355-795`) | the `articles.example` Site becomes `taught` under the name `trimmed.example`, and its retained pattern (`:585`) becomes active, because an untaught tuple may hold no pattern at all (`LibraryValidator.swift:862`) and that pattern is the fixture's only `trimSuffix`. The rest of its graph is unchanged and keeps the fixture's only canonical URL, absent-series work and one of its two links (`:84,88,129,134`); `golden.example` loses its junk rule; assertions `:81-82` go. Re-recorded at 14/15 with `ASTERISM_RECORD_GOLDEN=1` (Q7, Q13) |+| Baseline builder (`LibraryGraphBaselineTests.swift:230-233,287-290`) and `library-graph-baseline.txt` | gamma Site and its entry removed; the `article` work-type line removed; by hand |+| `ValidatorFixtures.articles(hostname:)`, `M5SeedSite.junkExample`, `seedArticlesSite()`, `EmptyLibraryTests.dropJunkRulesOutsideArticlesForTesting()` | deleted with their callers |+| `BackupImportTransactionTests:232-380` (the articles-designation and junk-rule import tests), `PendingCaptureDrainTests:522-529,605`, `ExportInputReadTests:130-160`, `CaptureStateTests:1004-1020`, `LibraryValidatorTests:59-63,96`, `SitesListReadTests:27-39`, `RuleSuggestionCandidatesTests:77,123-130`, `LibraryToleranceScanTests:211-213`, `RuleSuggestionCoordinatorTests:189-190` | articles rows and tests deleted |+| `RuleSuggesterTests.articlesBasisThrowYieldsNothing` | re-themed onto a quarantined hostname, which also makes the basis throw |+| `ModelContractTests:81` | `SiteMode.allCases` pin becomes two values |+| `EntryDetailModelTests.swift:51,65` and its ten call sites, `CaptureStateTests.swift:403` and the `hasParsedTitle` truth table (`:993-1041`) | the `displayTitle:` argument goes |+| `WorkTypeSeedingTests`, `WorkTypesSettingsUITests.swift:60` | expect `novel`, `webtoon` |++Req 7.2's grep runs after commit 1 and again after commit 3.++### Commit 2: schema V16++| Step | This feature |+|---|---|+| Snapshot | `AsterismSchemaV15` becomes the frozen shape, `junkSuffixRule` and `@Attribute(.externalStorage)` on `Work.thumbnailData` included; its header names `JunkSuffixRule` and `SegmentPositionSpec` as live referents frozen by reference (Q8) and carries across everything the V14 and V15 headers declare frozen |+| Live schema | `AsterismSchemaV16`, identical but for `Site.junkSuffixRule`; typealiases retargeted; `AsterismV16MigrationPlan = [V15, V16]`, one `.lightweight` stage |+| Last writers | the two import assignments (`ArchiveRecordBuilders.swift:71`, `LibraryRepository+ConfirmImport.swift:531-532`) are deleted here, because the column is |+| Markers | `laggingOpenableMarkerVersion = "15"`, `extensionOpenableMarkerVersion = "16"`. The app's set is built from those two constants (`LibraryRepository+Bootstrap.swift:608-622`), so `"14"` leaves it; Q10 is the population check that licenses that |+| Upgrade path | the `"15"` arm of `act(on:)`: open (the stage converts), tolerant validation, `publishReadiness("16")`. No data pass, no new `BootstrapState` case |+| Extension | opens `"16"` only, so it never runs the removing stage; no other precaution applies |+| Recorded store | `V15RecordedStoreFixture` and `V15RecordedStoreTests` replace the V14 pair, with create-seed-save-release ordering. `MarkerContractTests:224`, `CertificationPathTests:58`, `StoreMetadataTests:202,305` and `V4RecordedStoreTests` move to the new fixture in this commit |+| Pinned names | `FrozenLibraryPathTests:305,393-413`; the source-scan exclusions naming `AsterismSchemaV14.swift` in `MultiSiteReadPathTests:127` and `ThumbnailBytesReachTests:79`; `ThumbnailStoreProbeTests:59`; every `Schema(versionedSchema:` hit re-checked to name V16, `LibraryRepository+BackupImportGates` first; the hits that legitimately name `AsterismSchemaV15` are enumerated in `implementation.md`, not merely counted |+| Delta pin | `ModelContractTests:175-340` asserts V16's `Site` is V15's minus exactly `junkSuffixRule`, nothing added, every other entity identical |+| Marker suite | `MarkerGenerationSixteenTests` replaces `MarkerGenerationFifteenTests` |+| Envelope tie | `BackupV14ArchiveTests.envelopeVersionsFollowTheLiveSchema` is retargeted to `AsterismSchemaV16` and wrapped in a `withKnownIssue`, which commit 3 removes |+| Baseline | the dump's `junkSuffixRule=` field and its two remaining lines (`library-graph-baseline.txt:72-73`) go, by hand (Req 7.4); the format line moves 12 to 13 with its own header paragraph, written in the fixture and in `LibraryGraphSerializer.dump` both (Q24) |++`JunkSuffixRule` stays in `ValueObjects.swift` unchanged, and `ModelContractTests:117`'s invariant on its shape stays because it protects the snapshot.++### Commit 3: archive 15/16 and documents++`BackupV15Codec`, `BackupV15Exporter` and `BackupV15Types` replace the V14 set outright (Q12). `BackupV15Site` is `BackupV14Site` without `junkSuffixRule`; `mode` stays a typed `SiteMode`, so an unknown spelling refuses the archive as malformed. `supportedVersions` is `(15, 16)`, which refuses a 14/15 archive by name (Req 5.3). The checksum runs over the encoded bytes and needs no change. The rename reaches the app target: `AppLibraryModel.swift`, `SettingsBackupModel.swift` and five app test files including `SettingsImportTests.swift:89`. The golden becomes `backup-15-16-golden.json`, re-recorded. The `withKnownIssue` comes off. After this commit `JunkSuffixRule`'s only consumer is `AsterismSchemaV15`.++Documents:++| File | Change |+|---|---|+| `Announcements/Documents/getting-started.md:80-81`, `getting-started-mac.md:82-83` | the "Treat every page as an article" paragraph (Req 1.4) |+| `docs/asterism-design.md` | §4.6 and the `mode` and `junkSuffixRule` table rows (`:81,84`), plus `:448,499,521,604,628,643` |+| `docs/asterism-style-guide.md:82`, `docs/asterism-v2-plan.md:344,510`, `docs/agent-notes/testing.md:264` | glyph exception reworded to the unattached row; articles references removed |+| `docs/agent-notes/schema-migration.md`, `CLAUDE.md` | current state: V16, marker `"16"`, snapshot V15, archive 15/16; the removing-stage count becomes two |+| `CHANGELOG.md` | Req 7.5 |++## Data Models++| Entity | V15 | V16 |+|---|---|---|+| `Site` | `hostname`, `displayName`, `modeRaw`, `patterns`, `urlRules`, `entries`, `workMemberships`, `junkSuffixRule: JunkSuffixRule?` | the same without `junkSuffixRule` |++`modeRaw`'s default stays `SiteMode.untaught.rawValue`. The stage has a precedent: V8 to V9 dropped optional Codable struct attributes of the same shape (`Site.urlIdentityRule: URLIdentityRule?`, `TitlePattern.segmentWorkAnchor: SegmentRangeSpec?`) in one lightweight stage. A V15 build left on another device can still sync `modeRaw = "articles"` into a V16 store, where it lands as the quarantine of Req 3.4. CloudKit keeps `CD_junkSuffixRule` on the server; a V16 device neither reads nor writes it.++## Error Handling++No new failure mode. Three existing ones now also cover the value `articles`: the validator's "unknown mode" (`LibraryValidator.swift:716`) with its Site-tuple quarantine, the export's by-name refusal (`BackupArchiveProjection.swift:307`), and the importer's `unsupportedFormat` for a 14/15 pair. One goes: capture no longer throws `corruptLibrary` over a junk rule on a non-articles Site.++## Testing Strategy++| Requirement | Test |+|---|---|+| 2.2 | a capture and a reparse on an untaught and a taught Site leave `intentionallyUnattached == false` |+| 3.3 | `LibraryValidatorTests`: `none` with the flag set is invalid on both modes; `manual` with no Work and the flag set is valid |+| 3.4 | a Site seeded with raw `modeRaw = "articles"`: quarantined under `.siteTuple`, absent from the sites list, export refused naming the hostname, and the bootstrap still publishes `"16"`. The one place tests spell `articles` |+| 3.5 | `SiteUnionProjection` tests elect `taught` over `untaught` |+| 4.1 | the `ModelContractTests` delta pin |+| 4.3 | `V15RecordedStoreTests`, in `V14RecordedStoreTests`' shape: a store seeded through the frozen snapshot with a populated `junkSuffixRule` on one Site converts, and every row of every entity survives field by field |+| 4.4 | `MarkerGenerationSixteenTests`: `"15"` converts and publishes `"16"` only after validation, a validation throw leaves `"15"`, the app refuses `"14"`, both halves of the extension fork |+| 5.1-5.3 | `BackupV15ArchiveTests`, `BackupV15ImportMatrixTests`, the golden export test, and a 14/15 envelope refused with the pair named |+| 6.1-6.2 | `WorkTypeSeedingTests`: an empty library gets two rows; a library holding only the `article` row keeps it and its works untouched and gains the two defaults it lacks; a library holding all three gains nothing |+| 7.2 | grep after commits 1 and 3, result recorded in `implementation.md` |++`make test-performance-m4` is not re-banded: no measured arm, suite or fixture touches an articles path or the junk rule.
specs/remove-article-mode/implementation.md Added +681 / -0
diff --git a/specs/remove-article-mode/implementation.md b/specs/remove-article-mode/implementation.mdnew file mode 100644index 00000000..232e0523--- /dev/null+++ b/specs/remove-article-mode/implementation.md@@ -0,0 +1,681 @@+# Implementation: Remove Article Mode++Requirements: [requirements.md](requirements.md). Design: [design.md](design.md).+Decisions: [decision_log.md](decision_log.md).++This file records what the commits found that the design did not, and the+Req 7.2 grep after each of them.++## Commit 1: remove the mode++### Req 7.2: the grep++`grep -rni article --include='*.swift' Asterism Packages`, run after the commit+that removes the mode. Every remaining hit belongs to one of five groups, none+of which is articles mode as a live feature:++1. **The feature's own name in a comment** — `remove-article-mode` cited as the+   reason a line reads the way it does: `DomainEnums.swift`,+   `LibraryValidator.swift`, `LibraryRepository+ConfirmImport.swift` (×2),+   `BackupArchiveProjection.swift`, `ArchiveRecordBuilders.swift`,+   `GroupOrdering.swift`, `WorkTypeSeeding.swift`, and in the tests+   `LibraryValidatorTests`, `SiteUnionProjectionTests`, `ValidatorFixtures`,+   `ModelContractTests`, `RepositoryTeachingTests`,+   `BackupImportTransactionTests`, `WorkTypeSeedingTests`,+   `LibraryGraphBaselineTests`, `EmptyLibraryTests`, `UnknownSiteModeTests`.+2. **The retired `article` work type**, which Req 6.2 and Q3 keep: its name and+   its frozen identifier in `WorkTypeSeeding`'s comment and in+   `WorkTypeSeedingTests`, plus the reader-authored type rows the work-type+   suites use as ordinary data (`WorkTypesModelTests`, `WorkDetailModelTests`,+   `WorkDetailTypePickerTests`, `WorkTypeDirectoryTests`,+   `DuplicateResolutionTests`).+3. **English-article stripping in record name folding**, a non-goal:+   `RecordFacts.strippedArticle` and the suites over it (`CharacterFactsTests`,+   `CharacterRankingTests`, `CharacterGroundingTests`).+4. **Req 7.2's stated exception** — `UnknownSiteModeTests`, the one suite that+   spells the raw value `"articles"`, because Req 3.4 is about a row a previous+   build wrote.+5. **Incidental prose in unrelated fixtures**: a capture title in+   `SearchFilterTests` and a path component in `IntegrationSafetyNetTests`.++No source or test file names articles mode as a live feature, a mode value the+build knows, a contract, a capability gate, an accessibility identifier or a+repository operation.++### Deviations from design.md++- **`EntryTeachingDetail.displayTitle` is kept.** The design's "Other changes"+  bullet says it goes with `CaptureOutcome.displayTitle`. It cannot: the two+  fields are not the same fact. `CaptureOutcome.displayTitle` was only ever set+  on the articles branch of `computeCaptureOutcome`, so it went with the branch.+  `EntryTeachingDetail.displayTitle` carries `presentationTitle(…)`, whose+  `.taught` arm trims a whole-title rule's retained affixes — behaviour the+  design's own Core-semantics table preserves by dropping only the `.articles`+  arm of that function. Removing the field would have regressed a trimmed+  entry's heading on entry detail, which Req 7 forbids. Its one reader is+  `EntryDetailModel.titleCardHeading` (`EntryDetailModel.swift:195`).+  `LibraryRepository+Export` is **not** a reader of the field: it has its own+  `displayTitle(for:hostname:sites:context:)`, which calls `presentationTitle`+  directly, so the export heading and the entry-detail heading are the same+  derivation reached two ways rather than one field read twice.+- **Unused parameters were dropped with their last reader.**+  `LibraryValidator.validateChapter` / `validateAssignment` took `site:` only+  for the `site.mode == .articles` comparisons, and+  `presentationTitle(for:siteMode:site:activePattern:)` took `site:` only for+  `site.junkSuffixRule`. Swift does not warn on an unused parameter, so leaving+  them would have been silent dead weight. `isRecentEntryActionable` lost+  `siteMode:` for the same reason. `LibraryValidator.validateEntryTuple` and+  the private `validate(entry:site:works:tolerateUnlinkedCitations:)` behind it+  lost their `site:` on the same grounds: the Site the tuple is replayed+  against is `entry.site`, read through `CitationContext`, and the passed row+  had no reader left once the `.articles` comparisons went. Three call sites+  moved with it, and the whole-graph loop's `guard let site = sites[…]` became+  a presence check.+- **Three app-test cases were re-themed rather than deleted**, because the+  behaviour they pin is not articles mode:+  `PendingCaptureDrainTests.rulesInForceAtCommitTimeAreUsed` (Req 3.6) asserted+  commit-time rules through the articles flag and now asserts them through a+  Work assignment made by a rule taught after the share;+  `LibraryToleranceScanTests.scanNeverProducesATupleDiagnosis` used an articles+  row with an active pattern as its second illegal tuple and now uses an+  untaught row holding one; `RuleSuggesterTests`' basis-throw case is themed on+  a quarantined hostname (design.md says so).+- **`BackupImportTransactionTests` lost one test and gained one.** The+  untaught → articles restore has no successor, so it went; the junk-rule+  restore became `archivedJunkSuffixRuleIsNeverApplied`, which pins that both+  import branches now write the column nil. The contradicted-designation and+  archived-untaught cases were re-themed onto the taught/untaught pair.+- **`EmptyLibraryTests.dropJunkRulesOutsideArticlesForTesting` was deleted, not+  moved.** It existed because `ArchiveRecordBuilders.makeSite` copied the+  archive's junk rule while `applyDesignation` forced it nil off `.articles`.+  Both branches now write nil, so the divergence the helper worked around is+  gone.+- **The golden fixture's `articles.example` became `trimmed.example`**, per Q7,+  and the strings that named the mode went with the hostname: the retained+  pattern is now the site's *active* rule (a taught tuple needs exactly one),+  the display name is "Trimmed", the suffix is `" - Trimmed Example"` and the+  legacy work is "A Standalone". `golden.example` lost its junk rule, and the+  two assertions naming the column and the mode went. Re-recorded at 14/15 with+  `ASTERISM_RECORD_GOLDEN=1`.+- **`library-graph-baseline.txt` needed its header comment in two places.** The+  dump's header is emitted by `LibraryGraphSerializer.dump`, not only committed+  in the file, so a note added to the fixture must be added to the serializer+  too or the byte comparison fails on the header.+- **A stale incremental build reported phantom `switch must be exhaustive`+  errors.** After `SiteMode` lost a case, three consecutive `make test-quick`+  runs failed on two-case switches that were already exhaustive, naming a+  different file each time. `make clean` fixed it. Suspect the module cache, not+  the source, when an exhaustiveness error moves between runs.++### The simulator suites on a contended host++**Superseded** by "UI failures checked against `main`" below: these failures+are deterministic and `main`'s, not load.++The commit was verified on a machine another session was running its own test+cycles on; the one-minute load average moved between 5 and **158** across the+run. `make test-core` is unaffected and passed clean twice, the second time on+the exact committed tree (3018 passing, zero known issues, zero warnings).+Everything that needs a simulator was at the host's mercy:++- `make test-quick` passed — `Test Succeeded`, zero recorded issues — on a tree+  that differs from the committed one only by two Core edits an exhaustive+  `test-core` covers. A confirming re-run afterwards never started: `Failed to+  install or launch the test runner. (Mach error -308 - (ipc/mig) server died)`+  with zero tests, at load 82.++- `make test` ended `** TEST FAILED **` with **1939 passing and 6 failing**, all+  six XCUITest element-query timeouts in suites this feature does not touch:+  `AccessibilityJourneyUITests` (1), `TodayUITests` (2),+  `WorksCreatorOptionsUITests` (1), `WorksListOptionsUITests` (2). The two+  `TodayUITests` cases reproduced on a targeted re-run, and what they fail on is+  diagnostic: the query for `today-strip-<today>` returns+  `Failed to get matching snapshot`, while+  `testTheStripDrawsTheWeekAndSaysWhatIsTrueOfEachDay` — which enumerates every+  `today-strip-` cell — passes in the same run. The cell exists; the+  accessibility snapshot request is what times out.+- `make test-ui-ipad` failed **twice** without running a single test:+  `AsterismUITests-Runner encountered an error (Early unexpected exit, operation+  never finished bootstrapping … Test crashed with signal kill before+  establishing connection)`, each time after a 600 s bootstrap timeout. That is+  the runner being killed under memory pressure, not a verdict. Both attempts+  are recorded rather than repeated further.++**Req 7.1 is therefore satisfied for `test-core`, satisfied for `test-quick` on+a tree `test-core` closes the gap on, and owed for `test` and `test-ui-ipad`**:+all three simulator targets need one clean run on a quiet host before this+branch is pushed. None of the failures names a file, a suite or a behaviour this+feature touches.++## Commit 2: schema V16++### The legitimate `AsterismSchemaV15` readers++`docs/agent-notes/schema-migration.md` makes the grep gate at a freeze+"enumerated, not empty": `AsterismSchemaV15` is the frozen snapshot now, so it+has readers by design and the gate is that every one of them is deliberate and+listed. After this commit the package names it in these places and nowhere else.++**Sources, three files:**++| File | Why it may |+|---|---|+| `AsterismSchemaV15.swift` | the declaration itself — the snapshot and its seventeen nested classes |+| `AsterismSchemaV16.swift` | `AsterismV16MigrationPlan.schemas` and its one `.lightweight` stage, which is what a frozen snapshot exists for |+| `Models.swift` (two comments) | the nesting note, and the comment standing where `Site.junkSuffixRule` was |++**Tests, six files:**++| File | Why it may |+|---|---|+| `V15RecordedStoreFixture.swift` | the recorded-store seed: one `Schema(versionedSchema:)` and one constructor per entity, create-seed-save-**release** |+| `ModelContractTests.swift` | the `Site` delta pin, the per-entity equality loop, the entity-name set, the `.externalStorage` carry-across pin over the snapshot, and the `versionIdentifier` / `models` pins |+| `FrozenLibraryPathTests.swift` | the declared-schema set, the plan's `schemas`, and the snapshot's `Schema.Version(15, 0, 0)` stamp |+| `ThumbnailStoreProbeTests.swift` | the probe's entity names must collide with neither schema |+| `MultiSiteReadPathTests.swift`, `ThumbnailBytesReachTests.swift` | the two source-scan exclusion lists: `AsterismSchemaV15.swift` **declares** `siteMemberships` and `thumbnailData` and reads nothing |++### Every `Schema(versionedSchema:` hit re-checked++51 hits. 45 name `AsterismSchemaV16` — two in `Sources/`+(`LibraryRepository+Bootstrap.swift`, `LibraryRepository+BackupImportGates.swift`)+and the rest in suites that build a live container or read the live shape. Six+name `AsterismSchemaV15`, and all six are the deliberate frozen reads above:+one in `V15RecordedStoreFixture`, one in `ThumbnailStoreProbeTests`, four in+`ModelContractTests` where the two schemas are compared to each other.++`LibraryRepository+BackupImportGates.swift:50` was checked **first**, as the+schema-migration note demands: it builds a scratch in-memory container, and+twice in the project's history it was left naming the newly frozen snapshot —+once silently dropping columns, once aborting the whole test process. It names+`AsterismSchemaV16`.++`AsterismV15MigrationPlan` and `AsterismSchemaV14` both come back **empty**, as+`AsterismV14MigrationPlan` and `BackupV13` did at the previous freeze.++### Deviations from design.md++- **The graph baseline's dump format moved to 13.** design.md's commit 2 table+  says only that the `junkSuffixRule=` field goes. But the file's own rule is+  that "the format line says which shape it holds", and every schema bump since+  format 5 has moved it — commit 1 even left a header note saying the field+  "stays on every site line until V16 drops the column". Dropping it changes the+  shape, so the format is now **13**, with its own header paragraph, written in+  both places: the fixture and `LibraryGraphSerializer.dump`, because the+  serializer emits the header it is compared against.+- **`BackupImportTransactionTests.archivedJunkSuffixRuleIsNeverApplied` was+  deleted, one commit after commit 1 created it.** It pinned that both import+  branches wrote the column nil; V16 removed the column, so there is no property+  for either branch to write and the test cannot be expressed at all. Its+  helpers went with it — the `junkSuffixRule:` parameters of+  `createReadySiteStore` and `makeSiteDesignationPlan`, and the private+  `junkSuffixRule(anchorCount:)` builder whose only caller it was — along with+  the `junkSuffixRule` field of the suite's private `SiteFacts`. The archive+  record keeps the field at 14/15, written nil at its one construction site; it+  leaves the wire at 15/16.+- **`ModelContractTests`' delta pin was generalised from `Work` to any entity.**+  The V15 pin read `Work`'s properties through a `workProperties(_:)` helper.+  V16 moves `Site`, so the helper became `properties(of:in:)` and the pin gained+  a loop asserting the other sixteen entities are identical property for+  property — the "and nothing else" half, which a `Work`-only helper could not+  state.++### What the commit found that the design did not++- **The recorded-store suite cannot assert the removal directly.** There is no+  `facts.siteJunkSuffixRule == nil` to write, because the live `Site` has no such+  property and the attempt does not compile. That *is* the assertion, and the+  schema states it through the delta pin; the suite's job is the other half —+  that nothing else moved. Where the V15 suite's headline assertion was "the+  added column landed", V16's is a deliberate absence, and the suite says so.+- **The fixture now seeds `Work.releaseDaysRaw` non-empty.** V15's own column is+  the removed column's nearest neighbour, and a removing stage that disturbed it+  would be invisible against a fixture that left it at `[]`. It is seeded+  `["monday", "thursday"]` and asserted raw as well as through the accessor.+- **A removing stage restores a safety net V10 through V15 did not have.** The+  live stored shape is a strict *subset* of the frozen one again, for the first+  time since V9, so a stale snapshot registration cannot meet a live key it+  cannot answer. That is not what is relied on:+  `V15RecordedStoreFixture`'s create-seed-save-**release** ordering plus+  `--no-parallel` is, and the frozen registration can still answer+  `junkSuffixRule`, which the live schema has no column for. Both the fixture's+  doc comment and `AsterismSchemaV16.swift`'s say so, because the next adding+  version loses the subset again.+- **Three suites' prose was stale at V15 and was corrected here.**+  `V4RecordedStoreTests` described the plan as `[V13, V14]` and+  `LibraryRepository+BootstrapState.swift` described the floor as "V13, not V5";+  both now read `[V15, V16]` / V15. `BootstrapClassifierTests`' marker axis+  dropped its `.thirteen` case for a `.sixteen` one, so the classifier table+  still covers ready, lagging and retired with the marker set as it now stands.+- **`RepositoryReShareTests` carries four pre-existing compiler warnings.** Four+  `result of call to 'commitReShareUpdate(basis:note:rating:)' is unused` lines,+  in a file this branch does not touch, against a function this branch does not+  touch. Commit 1's note that `make test-core` ran with "zero warnings" was+  read off a warm build; a forced recompile shows these four plus four+  `FoundationModels` deprecation warnings in `AsterismIntelligence`. None is new+  here, and none is in a file this commit changed.++### Test verdicts++Both targets were run on a contended host (one-minute load average 45 to 103+across the two runs), and both are green. Every changed file was `touch`ed+before the run so the warning count is read off a real recompile rather than a+warm cache.++- **`make test-core`: passed, exit 0.** Three test runs in the package:+  42 tests in 8 suites, 227 tests in 12 suites, and+  **2,799 tests in 262 suites passed after 126.6 s with 1 known issue** — 3,068+  tests, 282 suites, and the one known issue is exactly the one Q17 opens:+  `BackupV14ArchiveTests.envelopeVersionsFollowTheLiveSchema`, recorded at+  `BackupV14ArchiveTests.swift:330` as+  `BackupV14Document.schemaVersion == AsterismSchemaV16.versionIdentifier.major`+  failing, because the archive is 14/15 while the store is V16. The wrapper is+  self-clearing: commit 3 must remove it or go red.+- **`make test-quick`: `Test Succeeded`,** 1,755 passing cases, zero recorded+  issues, zero compiler warnings from the app targets. The `build-mac`+  prerequisite compiled clean. The run logs a handful of CoreData+  `SQLite error code:6922, 'disk I/O error'` lines from temporary stores being+  torn down; they are ordinary teardown noise and fail nothing.+- **No new compiler warnings.** The only warnings on a forced full recompile are+  the eight pre-existing ones named above.++`make test`, `make test-ui-ipad` and `make test-performance-m4` were **not** run+here: design.md runs the UI suites after commits 1 and 3 only, and no measured+performance arm touches an articles path or the junk rule. Q23's outstanding+simulator runs are still owed before the branch is pushed.++## Commit 3: archive 15/16 and documents++### Req 7.2: the grep, after the archive commit++`grep -rni article --include='*.swift' Asterism Packages`, run on the committed+tree: **122 hits across 42 files**, every one in one of the five groups commit 1+enumerated, with one group grown by the two schema and archive commits:++1. **The feature's own name in a comment**, explaining why a line reads the way+   it does or what stood where. Commit 1's list, plus the schema and archive+   commits' own: `DomainEnums.swift` (the retired third value), `Models.swift`+   (the comment where `junkSuffixRule` stood), `AsterismSchemaV15.swift` (the+   frozen header's note that `SiteMode.articles` was never a default),+   `AsterismSchemaV16.swift` (what a `modeRaw = "articles"` row becomes),+   `LibraryValidator.swift`, `LibraryRepository+Bootstrap.swift`,+   `BackupV15Types.swift` (the Site record's "14/15 → 15/16 drops the+   junk-suffix rule" note and why `mode` stays typed), and in the tests+   `BackupV15ArchiveTests`, `BackupGoldenExportTests`, `LibraryValidatorTests`,+   `V15RecordedStoreTests`, `ModelContractTests`, `EmptyLibraryTests`,+   `LibraryGraphBaselineTests` and the rest of commit 1's list.+2. **The retired `article` work type**, which Req 6.2 and Q3 keep: its name and+   its frozen identifier in `WorkTypeSeeding` and `WorkTypeSeedingTests`, plus+   the reader-authored type rows the work-type suites use as ordinary data.+3. **English-article stripping in record name folding**, a non-goal:+   `RecordFacts.strippedArticle` and the suites over it.+4. **Req 7.2's stated exceptions**: the frozen V15 snapshot's `junkSuffixRule`+   stored property, and `UnknownSiteModeTests`, the one suite that spells the+   raw value `"articles"` for Req 3.4. `library-graph-baseline.txt`'s header+   note is the third, recorded at Q21.+5. **Incidental prose in unrelated fixtures**: a capture title in+   `SearchFilterTests`, a path component in `IntegrationSafetyNetTests`.++No source or test file names articles mode as a live feature, a mode value the+build knows, a contract, a capability gate, an accessibility identifier, a+repository operation or an archive field. `grep -rn BackupV14` over `Sources`,+`Tests` and both app targets comes back **empty**, as `BackupV13` did at the+previous rename.++### Deviations from design.md++- **The rename reached more than the three source files and the app target.**+  design.md names `BackupV15Codec`, `BackupV15Exporter` and `BackupV15Types`.+  The previous generation's rename (`BackupV13*` → `BackupV14*`, `b931166d`)+  also carried the *function* names that spell the generation, and this one+  followed it: `mapV14*Record` → `mapV15*Record` (ten functions across+  `BackupArchiveProjection` and the exporter), `backupV14Snapshot` →+  `backupV15Snapshot` on `BackupV15SnapshotProviding` and the repository,+  `projectV14Payload` → `projectV15Payload`, and the test double+  `MockV14SnapshotProvider`. `FrozenLibraryPathTests`' `namesTheArchiveFormat`+  set pins every one of them, so a partial rename would not have compiled.+- **The exported filename's version component moved too**, `v14` → `v15`+  (`BackupV15Exporter`, `ExportStaging.backupFilename`). design.md does not+  mention it; it is part of what the generation is called, and+  `BackupV15ArchiveTests` asserts it.+- **`BackupV15Codec.label` was stale and is corrected here.** It read `"V13"` —+  the previous rename moved the types and left the literal, and two `MARK`+  comments with it. The label appears only in decode diagnostics+  (`BackupArchiveReferenceChecks`' `formatLabel`, the payload-contradiction+  refusals) and no test pins the string, so it now reads `"V15"`.+- **Two version pins outside the archive suites had to move**:+  `WrongHostWorkURLCompatibilityTests.archiveVersionIsUnchanged` and+  `BackupExportDegradedRefusalTests`' round-trip both assert the literal pair.+  They are not archive suites and design.md's file list does not reach them; a+  `make test-core` run is what found them.+- **The literal-document fixtures carry the envelope numbers.**+  `BackupV15Fixtures.literalDocument` hard-codes+  `"backupFormatVersion":15,"databaseSchemaVersion":16` in the envelope it wraps+  a pasted payload in. Left at 14/15 those fixtures would have been refused by+  *version* rather than reaching the decode failure each of them exists to pin,+  which would have quietly hollowed out four tests rather than failing them.+- **`retiredGenerationDocument`'s default pair moved to (14, 15)**, and the+  codec suite's `retiredEnvelopeRefuses` is retitled for it. The helper's+  default had been left at (12, 13) through two renames while its doc comment+  said 11/12; the default is now the generation this one replaced, which is what+  the test that uses it claims to be about, and Req 5.3's refusal.+- **Req 5.3's "writes nothing" is asserted through the door rather than after+  a write.** `BackupV15ImportMatrixTests.thePreviousGenerationRefusesByPair`+  seeds an `M5Fixture`, attempts `BackupImporter.plan` on a 14/15 envelope,+  pins the refusal and both pairs in the message, and then re-reads the sites+  list to show it is unchanged. There is no deeper assertion available: `plan`+  runs outside the repository actor and holds no lease, and `confirmImport`+  takes a plan, so a refused plan makes the library structurally unreachable.+- **`docs/agent-notes/schema-migration.md` needed the whole "Current state"+  section, not one sentence.** design.md's Documents table says "current state:+  V16, marker `"16"`, snapshot V15, archive 15/16; the removing-stage count+  becomes two". Commit 2 did not touch the file, so this commit moved every+  statement in it that named the live schema, the frozen snapshot, the marker+  set, the archive generation, the current recorded-store fixture+  (`V14RecordedStoreFixture` → `V15RecordedStoreFixture`), the current marker+  suite (`MarkerGenerationFifteenTests` → `MarkerGenerationSixteenTests`) and+  the worked examples in the "Adding a schema version" table. Three of its+  standing claims were **falsified** by a removing bump and are rewritten rather+  than renumbered: that the live stored shape is no longer a subset of the+  frozen one (V16 restores the subset, for as long as the next adding version+  takes to lose it again); that a removing stage needs a default (it needs+  none); and that "a stage that only *removes* store columns changes no wire+  shape" — true of V9, whose dropped columns were never archived, and false of+  V16, whose column was on the wire and whose golden moved with it.+- **`docs/agent-notes/testing.md` and `rule-wire-format.md` were also stale at+  V15** and are corrected here on the same grounds (Req 7.3): testing.md's+  live-schema sentence, its registry-hazard paragraph and its+  `BackupV14Fixtures` reference, and rule-wire-format.md's "live wire substrate"+  bullet and its generation list. testing.md's `supportsArticles` example of a+  feature-guard predicate became `supportsURLIdentity`, the capability gate+  having gone in commit 1.+- **`docs/asterism-design.md` §4.6 is struck through, not deleted.** The section+  is the historical design record; deleting it would leave §4.5 followed by §4.7+  and no account of why. Its two paragraphs stay, with a **Removed** note naming+  the spec, the ticket and what the retained unknown-mode behaviour is. The M2+  and M3 milestone retrospectives (`:501`, `:606`, `:645`) are treated the same+  way: they record what shipped at the time, so they are marked rather than+  rewritten. The Site table's `mode` and `junkSuffixRule` rows and the export+  heading rule (`:450`) *are* statements about the current build and were+  corrected outright.++### Design-review follow-ups++A review of this commit found one claim asserted in three doc comments and+pinned by nothing, and five stale statements. All are corrected in a follow-up+commit on the same branch; none changes production behaviour.++- **The typed `mode` now has a test.** `BackupV15Types.swift`, this section's+  own notes and `design.md:111` all state that `BackupV15Site.mode` stays the+  typed `SiteMode` so a mode spelling this build cannot name refuses the archive+  as malformed — and nothing asserted it. `BackupV15ArchiveTests`'+  `siteWithAnUnknownModeRefuses` now does, over a new+  `BackupV15Fixtures.unknownSiteModePayloadJSON`, on the pattern+  `recordWithAnUnknownDayRefuses` set: a literal payload whose one Site carries+  an unnameable mode, expected to fail with `.decodingFailed`, beside the same+  literal with a nameable one decoding. The spelling is the **neutral**+  `a-mode-this-build-has-no-case-for`, not the retired `articles`, which Req 7.2+  keeps to `UnknownSiteModeTests`: what the test pins is the typed column, which+  every unnameable value meets at the same door. Falsified locally — swapping+  the fixture's value for `untaught` fails the test — and reverted.+- **`BackupV15Fixtures.literalDocument` no longer hard-codes its envelope+  numbers.** They are `BackupV15Document.formatVersion` and `.schemaVersion`+  now, which is the deviation above in reverse: at the next generation move the+  literals would refuse every fixture below them by *version* and hollow out the+  decode refusals they exist to pin, silently. The envelope is assembled in+  steps because the single concatenated expression stopped type-checking in+  reasonable time once the two interpolations were added.+  `retiredGenerationDocument`'s `(14, 15)` stays a literal: it names a retired+  pair on purpose.+- **Four stale comments.** `BackupImporter`'s `supportedVersions` doc said+  "format 12 over schema 13", three generations behind, and now states no+  numbers at all — the next sentence already says the pair follows the+  document's constants. `BackupGoldenExportTests`' header counted the golden+  fixture's Sites as three; there are four (`dupe`, `golden`, `plain`,+  `trimmed`). `WrongHostWorkURLCompatibilityTests`' version pin had a `@Test`+  title saying the heal *moves* the pair over a function asserting it does not;+  the title now agrees with the function and the assertion.+  `docs/asterism-design.md` still offered "flip mode" on the Sites list, which+  no longer exists — the site screen shows the mode and does not edit it — and+  §4.6's struck heading was followed by an un-struck present-tense paragraph,+  now past-tense and italicised so it cannot be read as current.++**The follow-up's own `make test-core`** read `✘ Test run with 2800 tests in+262 suites failed after 163.951 seconds with 119 issues` — one test more than+the run below, **zero known issues**, and every one of the 119 in the three+pending-capture suites, each an `NSPOSIXErrorDomain Code=1 "Operation not+permitted"` on a spool file the suite had just written under+`FileProtectionType.completeUnlessOpen`. It is the host's locked login keychain,+not the branch: reverting the five changed Swift files to `fdbc01bd` and+re-running `PendingCaptureSpoolTests` alone reproduces the same 46 issues on a+pristine tree. Everything else passed. The forced recompile of the five files+emitted no warnings, with `RepositoryReShareTests.swift` touched alongside as+the control — its four pre-existing `result of call to+'commitReShareUpdate(basis:note:rating:)' is unused` lines came back, so the+zero is a real zero.++### Test verdicts++Every changed Swift file was `touch`ed before the host runs so the warning count+is read off a real recompile rather than a warm cache.++- **`make test-core`: passed, `EXIT=0`,** on a host at one-minute load 6. Three+  test runs in the package: 42 tests in 8 suites, 227 tests in 12 suites, and+  **2,799 tests in 262 suites passed after 127.2 s** — 3,068 tests, 282 suites,+  and **zero known issues**. The Q17 window is closed: the `withKnownIssue`+  around `BackupV15ArchiveTests.envelopeVersionsFollowTheLiveSchema` is gone and+  the envelope tie asserts plainly against `AsterismSchemaV16`. Req 7.1's zero+  holds from this commit.+- **No new compiler warnings.** The forced recompile of the 55 changed Swift+  files emitted none. That number needed a control, because none of the four+  warnings commit 2 recorded lives in a file this commit touches: `touch`ing+  `RepositoryReShareTests.swift` and rebuilding reproduced exactly its four+  pre-existing `result of call to 'commitReShareUpdate(basis:note:rating:)' is+  unused` lines and nothing else, so the zero is a real zero rather than a warm+  build's silence.+- **`make test-quick`: `Test Succeeded`, `EXIT=0`,** 1,759 passing cases, zero+  recorded issues, the `build-mac` prerequisite clean. Host load 127 at the+  start and 215 at the end — a contended run, which this target tolerates.+- **`make test`: `** TEST FAILED **`, `EXIT=2`.** The unit bundle's 1,759 cases+  pass; the UI bundle ran **190 tests, 2 skipped, 6 failures**, over 6,203 s.+  The host was **quiet for this one** — load 22 at the start and 6 to 15 across+  most of the UI phase, with one excursion to 174 during the first twenty+  minutes. The six are **the same six commit 1 saw** (Q23), which settles that+  they are not load flakes; see the section below for why they are not this+  branch either.+- **`make test-ui-ipad`: `** TEST FAILED **`, `EXIT=65`.** The runner+  **bootstrapped for the first time on this branch** — commit 1 never got that+  far — and executed **29 tests with 1 failure**,+  `WideLayoutUITests.testTheWorkNameInTheDetailColumnOpensTheWorkOnTheWorksPane`+  ("The name switches the window to the Works pane"). Host load 19 at the start,+  318 by the end. A second run started at load 20, was disrupted by the host+  climbing back to 130–196 — xcodebuild restarted the runner mid-suite — and+  reached the same single failure after 6 of the suite's 27 tests.++**Req 7.1 is met for `test-core` and `test-quick` and is *not* met for `test`+and `test-ui-ipad`.** Seven UI cases fail, and this commit does not claim+otherwise.++### The seven UI failures, and why they are not this branch++**The causes given in the bullets below are wrong** and are corrected in the+next section; the conclusion, that none of these is this branch's, stands.++| Suite | Test | Failure |+|---|---|---|+| `AccessibilityJourneyUITests` | `testTheEntryTitleCardsWorkNameOpensTheWorkAtLargestDynamicType` | `XCTAssertTrue failed - Recent lists a taught chapter` |+| `TodayUITests` | `testAReleaseRowOpensItsWorkOnTodayAndBackReturnsToTheSelectedDay` | `Failed to get matching snapshot` for `today-strip-2026-09-21` |+| `TodayUITests` | `testTheTabIsTodayAndTheScreenCarriesNoDayTitle` | the same, same identifier |+| `WorksCreatorOptionsUITests` | `testTheCreatorFilterNarrowsTheListAndExplainsAnEmptyOne` | `The menu offers Any` |+| `WorksListOptionsUITests` | `testTheReleaseDaysFilterNarrowsTheListByPresenceAndNamesItself` | `The menu offers Any` |+| `WorksListOptionsUITests` | `testTheStatusFiltersNarrowTheListAndNameTheirDimension` | `The menu offers Finished` |+| `WideLayoutUITests` (iPad) | `testTheWorkNameInTheDetailColumnOpensTheWorkOnTheWorksPane` | `The name switches the window to the Works pane` |++Each one is an element-location failure, and **each has a sibling in its own+suite that passes in the same run while exercising the same element, the same+helper and the same seeded scenario**:++- `TodayUITests.testTheStripDrawsTheWeekAndSaysWhatIsTrueOfEachDay` calls+  `waitFor(stripCell(daysFromLaunch: 0), …)` — the identical query for the+  identical identifier — at line 501 and **passes**. The cell exists. What+  differs is when it is asked for: the passing test has already waited for all+  seven of the week's cells before it asks for today's, while the two failing+  tests ask for it as their first strip interaction after launch. This is the+  accessibility-snapshot service failing a cold single-identifier query, which+  is what commit 1 concluded from the same evidence.+- `WorksListOptionsUITests.testTheOptionsMenuSortsFiltersAndExplainsAnEmptyList`+  drives the same clipped options popover through the same+  `UIJourneySupport.chooseWorksOption` helper and **passes**. The three+  `The menu offers …` failures are the helper's own eight-attempt scroll loop+  giving up on a row below the fold, which its doc comment names as the ordinary+  hazard at accessibility text sizes — and all three failing cases launch with+  `UICTContentSizeCategoryAccessibilityXXXL`.+- `EntryToWorkLinkUITests.testTheWorkNameOnAnEntryFromRecentOpensTheWorkInTheWorksTab`+  makes the *same* `Recent lists a taught chapter` assertion, on the same+  `seeded-composed` scenario, at default text size, and **passes** — as do all+  ten `ComposedSurfaceUITests` on that scenario. So the fixture seeds, Recent+  lists the work, and what fails is the same accessibility-size rendering.++And nothing they touch is on this branch. `git diff main...HEAD` shows the six+failing tests' own files unchanged, `Asterism/Asterism/UITestLaunchSupport.swift`+(every seeded scenario) unchanged, and `WideLayoutUITests.swift` unchanged. The+app-side files this branch does change are the teaching, sites, work-types and+entry-detail surfaces; `WorksView.swift`'s only change is+`SiteGlyph(kind: .articles)` → `.unattached`, a renamed enum case with no+behaviour behind it. The one Today-side source change,+`LibraryRepository+TodayPresentation.swift`, is **semantics-preserving for the+two remaining modes**: `actionable` went from `mode.map { … } ?? false` to+`mode != nil && …` over the same predicate, `recentSiteMode`'s switch lost only+its `.articles` arms and its `site.junkSuffixRule != nil` clauses — neither+reachable once the column and the mode are gone — and `presentationTitle` lost a+parameter whose only reader was the junk rule.++Each failing target was re-run once in isolation, which is where the+determinism showed: `make test-ui UI_TEST_BUNDLE=AsterismUITests/TodayUITests`+reproduced both Today failures with the identical message and 19 of 21 passing,+and the second `make test-ui-ipad` reproduced its one failure. Deterministic+failures in tests, scenarios and views this branch does not touch are a+pre-existing condition of the suites, not a regression introduced here — but+they are owed a fix or a recorded exception before the branch is pushed, and+Req 7.1 stays unmet until then.++## UI failures checked against `main` (2026-09-22)++The seven UI failures recorded above were run on `main` at `36d874e9` in a+throwaway worktree, simulator only, narrowed to those seven cases with the+Makefile's own flags (Xcode 27.0, iOS 27.0 runtime). **None is introduced by+this branch.** This section supersedes the causes given for them in the+Commit 1 and Commit 3 sections, two of which were wrong.++| Test | `main` 36d874e9, Tue 2026-09-22 | Branch, Mon 2026-09-21 | Branch tip `fdbc01bd`, Tue |+|---|---|---|---|+| `AccessibilityJourneyUITests.testTheEntryTitleCardsWorkNameOpensTheWorkAtLargestDynamicType` | fail, same message | fail | fail |+| `TodayUITests.testAReleaseRowOpensItsWorkOnTodayAndBackReturnsToTheSelectedDay` | pass | fail | pass |+| `TodayUITests.testTheTabIsTodayAndTheScreenCarriesNoDayTitle` | pass | fail | pass |+| `WorksCreatorOptionsUITests.testTheCreatorFilterNarrowsTheListAndExplainsAnEmptyOne` | fail, same message | fail | not re-run |+| `WorksListOptionsUITests.testTheReleaseDaysFilterNarrowsTheListByPresenceAndNamesItself` | fail, same message | fail | not re-run |+| `WorksListOptionsUITests.testTheStatusFiltersNarrowTheListAndNameTheirDimension` | fail, same message | fail | not re-run |+| `WideLayoutUITests.testTheWorkNameInTheDetailColumnOpensTheWorkOnTheWorksPane` | gone: #82 rewrote it as `…OpensTheWorkOnTodaysPane`, which passes | fail | not re-run |++- **The two Today cases fail only on the first day of the displayed week.**+  Both call `selectDay(daysFromLaunch: -1)`. On a Monday that is the previous+  week's Sunday, so the helper pages the strip back, and the tests then read+  `currentCell.isSelected` on a cell that is no longer in the tree, which+  XCUITest reports as `Failed to get matching snapshot`. Every run on this+  branch was made on Monday 2026-09-21. It is not an accessibility-snapshot+  timeout, as written above. It will fail again on any branch next Monday; the+  fix is test-side and wants its own ticket.+- **The three works-options cases** are the failure `main` already+  root-caused in `specs/launch-to-today/verification-run.md` §3.4: under+  Xcode 27 the identifier on the `Text` inside the inline `Picker` never+  reaches the menu item, the helper falls back to the visible label, and+  `Any` labels nine rows and `Finished` two, so the query is ambiguous. None+  of the three launches at `AccessibilityXXXL` and the row is on screen+  throughout, contrary to what is written above. #82 left it for its own+  bugfix spec.+- **The entry title card at the largest Dynamic Type** fails on `main`+  verbatim. The test asserts `waitForExistence` before it scrolls, and at+  that size the wrapped week strip and range pill push the row below the+  fold. First recorded failing at `215c8437`. Inferred from the timeline and+  two passing controls, not from a tree dump.+- **The iPad case is already fixed on `main`.** The branch was cut at+  `1d0a96f6` and #82 landed after it. The branch was rebased onto `main` at+  `36d874e9` on 2026-09-22 (see "After the rebase" below), which replaces the+  failing case with #82's rewritten one.++Req 7.1 therefore stood, before the rebase, as: `make test-core` and+`make test-quick` green, with zero known issues; `make test` and+`make test-ui-ipad` red for reasons `main` owns. `make test` cannot be met as+written until those are fixed on `main` (Q34).++One host note: the last `make test-core` run of the branch, on `4a8114f1`,+recorded 119 issues, every one `Operation not permitted` in the three+pending-capture suites, reproduced identically on pristine `fdbc01bd`. That+is the machine's file-protection state while it sat unattended overnight,+not the change; `fdbc01bd` itself ran 3,068 tests with zero issues and zero+known issues a few hours earlier. A clean `make test-core` on an unlocked+host is owed.++## After the rebase (2026-09-22)++Every SHA above that names one of this branch's commits is the post-rebase+one. The branch was rebased onto `main` at `36d874e9`, which brought in #82+("Launch to Today"). #82 changes four files this branch also changes:+`LibraryRepository+TodayPresentation.swift`, `LibraryRepository.swift`,+`TodayPresentation.swift` and `AppLibraryModel.swift`.++- **Conflicts: two.** `CHANGELOG.md`, where both sides added to the top of+  `### Removed` and both were kept; and `AppLibraryModel.swift`, where #82+  added `repositoryEpoch` directly above the two lines commit 3 renames to+  `BackupV15SnapshotProviding`, resolved by keeping #82's property and the+  rename. Everything else merged without conflict.+- **Silent reintroductions: none.** The merged tree was searched for the+  removed symbols (`projectArticles`, `commitArticles`, `permitsArticles`,+  `supportsArticles`, `.articles`, `junkSuffixRule` outside the frozen+  snapshot) and the old generation names (`BackupV14`, `mapV14`,+  `backupV14`, `MockV14`, `AsterismSchemaV14`, `AsterismV15MigrationPlan`).+  Every hit is a historical comment or a reference the reviews had cleared.+- The pre-rebase tip is kept locally as `backup/T-2336-pre-rebase`.++Runs on the rebased tree:++| Target | Verdict |+|---|---|+| `make test-core` | 2,810 tests in 263 suites; **119 issues, all in the three pending-capture suites** (drain 53, spool 46, preserve-first share flow 20), the same `Operation not permitted` file-protection state recorded above on the pre-rebase tree. No other suite failed and there are zero known issues. A clean run on an unlocked host is still owed. |+| `make test-quick` | `build-mac` clean. 1,772 of 1,773 pass; the one failure, `ReparseViewModelTests.duplicateSubmissionSuppressed`, races two concurrent `confirm()` calls, lives in files this branch does not touch, and passed when its suite was re-run alone (`make test-quick SKIP_MAC=1 UNIT_TEST_BUNDLE=AsterismTests/ReparseViewModelTests`, `Test Succeeded`). |+| `make test-ui-ipad` | **`Test Succeeded`, 30 tests, 0 failures**, the first green run of this target on the branch. Its one earlier failure was the case #82 rewrote. |+| `make test` | Not re-run. Four of its six failures reproduce on `main` itself and the other two depend on the weekday, so a re-run would say nothing about this branch. |++### Pre-push review follow-ups++Four reviewers read the whole rebased diff for reuse, quality, efficiency and+spec adherence. Production code changed in four places, none of them+behaviour:++- `LibraryValidator`: two content-ordered sorts of a hostname's Site rows+  survived the removal only to answer whether any row exists. The+  per-hostname gate now asks `rows.isEmpty`, and the whole-graph pass, which+  runs at open, indexes hostnames in a `Set` where it kept a map of winning+  rows nobody read.+- `validatedRecentSiteMode` was the last `switch` over `SiteMode` with a+  `default:`; it is exhaustive over the two cases now.+- The export filename takes its version from `BackupV15Document.formatVersion`+  in place of a hand-spelled `"v15"`, so the next generation move cannot ship+  a misnamed file.+- `AsterismCapabilities.Gate.m2_1` carries a note: `supportsArticles` was the+  one capability that told it from `m2_2`.++Two leftovers of this branch went from the tests: the serializer's `json`+helper, whose one caller was the deleted `junkSuffixRule` field, and the+`MarkerFifteen-` temp-directory prefix. The reuse review's other findings are+test-fixture consolidation (`UnknownSiteModeTests.Root` beside the shared+`WriteFixture`, the two V15 marker suites' `Root` classes, five copies of the+retired-marker array) and are left alone: they are refactors of test files,+not defects, and the generation-to-generation fixture copy is the documented+procedure.++The documents were corrected for what the rebase and later commits made+false: the two rebased SHAs, five marker statements in+`docs/agent-notes/schema-migration.md` still describing the V14 to V15 arm,+three CHANGELOG sentences, and the design and task lines Q19, Q24 and Q34+overruled.+
specs/remove-article-mode/requirements.md Added +102 / -0
diff --git a/specs/remove-article-mode/requirements.md b/specs/remove-article-mode/requirements.mdnew file mode 100644index 00000000..738251fc--- /dev/null+++ b/specs/remove-article-mode/requirements.md@@ -0,0 +1,102 @@+# Requirements: Remove Article Mode++Transit: T-2336. Decisions: [decision_log.md](decision_log.md).++## Introduction++Articles mode is a one-way Site state in which every captured page is kept as an independent, Work-less entry with an optional junk-suffix title cleaner. The owner has never used it and it dilutes the app's purpose of tracking serial works. This feature removes the mode, everything that exists only to serve it, and the `article` default work type, and moves the store schema to V16 so the column that only the mode used is dropped.++## Non-Goals++- Converting, repairing or migrating an existing articles Site: the owner has confirmed none exists (Decision 1, Q10).+- Reading 14/15 archives: the previous archive generation is unreadable by the new build, as at every earlier schema bump.+- Removing or retyping `article` work-type rows that already-seeded libraries hold, or works typed `article`.+- Work-less entries in general: a reader's manual unattachment, the unattached-notes row and its dim pencil glyph stay.+- The English-article stripping in record name folding (`RecordFacts.strippedArticle`), which is grammar and unrelated.+- Deleting the `CD_junkSuffixRule` field from the CloudKit schema; server fields are never deleted and the unused one is harmless.+- The edit-view violations listed under T-2328 and any other Site, teaching or capture behaviour.+- Rewriting historical specs, decision logs or existing CHANGELOG entries that describe articles mode. `specs/retire-migration-chain/library-graph-baseline.txt` is a live test fixture, not history, and is in scope ([7.4](#7.4)); so is a new CHANGELOG entry for this removal.+- Repairing the duplicate-resolution paths that can set `intentionallyUnattached` without a manual assignment, which predate this feature (Q6, T-2361).++## Requirements++### 1. No way into articles mode++**User Story:** As a reader, I want the app to offer no articles option, so that every screen is about serial works.++**Acceptance Criteria:**++1. <a name="1.1"></a>The Site detail screen SHALL NOT offer "Treat every page as an article" or its confirmation dialog.  +2. <a name="1.2"></a>The composed teaching screen SHALL NOT offer the articles affordance, its confirmation or its junk-suffix controls, and no navigation route SHALL carry an articles-conversion permission.  +3. <a name="1.3"></a>The sites list SHALL present every Site whose mode is known as either untaught or taught.  +4. <a name="1.4"></a>The in-app Getting Started documents for iPhone and Mac SHALL NOT mention articles or "Treat every page as an article".  ++### 2. No articles presentation or capture behaviour++**User Story:** As a reader, I want captures and lists to describe pages only in terms of works and chapters, so that the app speaks one vocabulary.++**Acceptance Criteria:**++1. <a name="2.1"></a>The share extension SHALL NOT show an "Article:" title line or the "Independent article" status; a capture that parses no chapter SHALL show the existing "No chapter parsed from title" status.  +2. <a name="2.2"></a>A capture or a reparse SHALL NOT set `intentionallyUnattached` to true on an entry, and a capture outcome SHALL carry no cleaned display title.  +3. <a name="2.3"></a>Today and every other list SHALL present an entry's title without junk-suffix cleaning, and SHALL compute an entry's available actions without regard to a Site being in articles mode.  +4. <a name="2.4"></a>The unattached-notes row SHALL keep its dim pencil glyph, and no glyph kind SHALL be named for or documented as articles mode.  +5. <a name="2.5"></a>Rule suggestion SHALL NOT refuse, branch on or mention an articles Site.  ++### 3. Site mode is untaught or taught++**User Story:** As the owner, I want the data model to know two Site modes, so that no code path or invariant has to account for a third.++**Acceptance Criteria:**++1. <a name="3.1"></a>`SiteMode` SHALL have exactly the values `untaught` and `taught`, and the live sources SHALL compile with no articles operation, contract, capability gate or error case.  +2. <a name="3.2"></a>The validator and the archive reference checks SHALL accept exactly the untaught and taught Site tuples.  +3. <a name="3.3"></a>The validator SHALL accept `intentionallyUnattached == true` only on an entry with a manual work assignment and no Work; an entry with a `none` assignment SHALL require `intentionallyUnattached == false`.  +4. <a name="3.4"></a>IF a Site row carries the mode value `articles` THEN the system SHALL treat it as any other unknown mode value: its hostname quarantined under the Site-tuple diagnosis and reported by Library Check, the hostname omitted from the sites list where that row is the elected one, and the export refused by name. The quarantine SHALL NOT prevent the library from opening or marker `"16"` from being published.  +5. <a name="3.5"></a>Site reconciliation and site union SHALL elect a Site's mode between `untaught` and `taught` only, and no snapshot, teaching basis, contract or union projection SHALL carry a junk-suffix rule.  ++### 4. Schema V16 drops the junk-suffix rule++**User Story:** As the owner, I want the column only articles mode used to be gone, so that the schema holds nothing the build does not use.++**Acceptance Criteria:**++1. <a name="4.1"></a>The live schema SHALL be V16 and SHALL contain no `Site.junkSuffixRule`; `ModelContractTests` SHALL fail if the column reappears.  +2. <a name="4.2"></a>The migration plan SHALL be `[V15, V16]` with one lightweight stage, `AsterismSchemaV15` SHALL be the one frozen snapshot, and `AsterismSchemaV14` SHALL be deleted with every fixture that opened it, in one commit.  +3. <a name="4.3"></a>WHEN the app opens a marker-`"15"` library THEN every row of every entity SHALL survive the stage with all remaining columns intact, and marker `"16"` SHALL be published only after the tolerant store validation completes without throwing.  +4. <a name="4.4"></a>The app SHALL open markers `"15"` and `"16"` and refuse `"14"`; the share extension SHALL open `"16"` only, refusing `"15"` with the existing "Open Asterism to finish updating the library" message.  +5. <a name="4.5"></a>The article title cleaner SHALL be deleted. `JunkSuffixRule` and the value types it stores SHALL remain top-level types with their stored-property names, types and Codable representation unchanged, because the frozen V15 snapshot is frozen by reference to them, and SHALL have no consumer outside `AsterismSchemaV15`.  ++### 5. Archive generation 15/16++**User Story:** As the owner, I want backups to match the schema, so that an archive never carries a field the library cannot hold.++**Acceptance Criteria:**++1. <a name="5.1"></a>An export SHALL write archive generation 15/16, whose Site record carries no junk-suffix rule and whose mode is `untaught` or `taught`.  +2. <a name="5.2"></a>WHEN a library is exported to a 15/16 archive and that archive is imported into an empty library THEN every record kind SHALL round-trip with every exported field equal.  +3. <a name="5.3"></a>IF a 14/15 archive is imported THEN the import SHALL be refused by the version check, naming the detected pair, and SHALL write nothing.  +4. <a name="5.4"></a>The golden archive fixture SHALL be re-recorded at 15/16 with no articles Site and no junk-suffix rule.  ++### 6. The `article` work type is no longer seeded++**User Story:** As a reader starting a new library, I want only `novel` and `webtoon` as default types, so that the type list reflects what the app is for.++**Acceptance Criteria:**++1. <a name="6.1"></a>The seeding pass SHALL insert each of `novel` and `webtoon` whose fixed identifier is absent from the library, and SHALL never insert `D0000003-0000-4000-8000-000000000003`.  +2. <a name="6.2"></a>WHEN the seeding pass runs on a library that already holds the `article` row THEN it SHALL leave that row, and every work typed with it, unchanged; the reader MAY remove it in Settings like any other type.  +3. <a name="6.3"></a>The identifier `D0000003-0000-4000-8000-000000000003` SHALL NOT be reused for any future default.  ++### 7. Nothing else changes++**User Story:** As the owner, I want the removal to leave every other behaviour and measurement where it was, so that the change is verifiable as a deletion.++**Acceptance Criteria:**++1. <a name="7.1"></a>`make test-core` SHALL pass with zero known issues and no new compiler warnings, and `make test-quick`, `make test` and `make test-ui-ipad` SHALL pass.  +   *Note (Q34, 2026-09-22): not met as written. Three works-options cases and the largest-Dynamic-Type entry card fail identically on `main` at `36d874e9`, and two Today cases fail only on the first day of the displayed week. Whether this criterion is waived for failures `main` owns is the owner's call.*  +2. <a name="7.2"></a>No source or test file SHALL name articles mode, in a suite, fixture, mock, protocol member or accessibility identifier, with two exceptions: the frozen V15 snapshot's stored property, and tests that inject the raw value `articles` to prove [3.4](#3.4).  +3. <a name="7.3"></a>`CLAUDE.md`, `docs/agent-notes/`, `docs/asterism-design.md` and `docs/asterism-style-guide.md` SHALL describe the live schema as V16, the marker as `"16"`, the snapshot as V15 and the archive as 15/16, and SHALL NOT describe articles mode as a current feature.  +4. <a name="7.4"></a>`library-graph-baseline.txt` SHALL be hand-edited, never regenerated, to the V16 graph: its articles Site, that Site's entry, every `junkSuffixRule` field and the seeded `article` work type SHALL be gone.+5. <a name="7.5"></a>`CHANGELOG.md` SHALL record the removal, the schema and archive generation change, and that 14/15 backups stop being importable.
specs/remove-article-mode/tasks.md Added +82 / -0
diff --git a/specs/remove-article-mode/tasks.md b/specs/remove-article-mode/tasks.mdnew file mode 100644index 00000000..0f1d4a5f--- /dev/null+++ b/specs/remove-article-mode/tasks.md@@ -0,0 +1,82 @@+---+references:+    - specs/remove-article-mode/requirements.md+    - specs/remove-article-mode/design.md+    - specs/remove-article-mode/decision_log.md+---+# Remove Article Mode++## Commit 1: Remove the mode++- [x] 1. Write failing tests for a library with two Site modes <!-- id:7mefo3q -->+  - Req 3.4, new: a Site seeded with raw modeRaw articles is quarantined under siteTuple, absent from the sites list, refused by name on export, and does not stop the bootstrap publishing the current marker. This is the only place tests spell the value+  - Req 3.3 in LibraryValidatorTests: a none assignment with intentionallyUnattached set is invalid on untaught and taught; a manual assignment with no Work and the flag set is valid+  - Req 2.2: a capture and a reparse on an untaught and a taught Site leave intentionallyUnattached false+  - Req 3.5 in the SiteUnionProjection tests; Req 3.1 as the SiteMode.allCases pin in ModelContractTests:81+  - Req 6.1 and 6.2 in WorkTypeSeedingTests: an empty library gets novel and webtoon; a library holding only the article row keeps it and gains the two it lacks; one holding all three gains nothing. WorkTypesSettingsUITests:60 expects two defaults+  - These stay red until task 3+  - Requirements: [2.2](requirements.md#2.2), [3.1](requirements.md#3.1), [3.3](requirements.md#3.3), [3.4](requirements.md#3.4), [3.5](requirements.md#3.5), [6.1](requirements.md#6.1), [6.2](requirements.md#6.2)++- [x] 2. Remove the articles entry points from the app and the share extension <!-- id:7mefo3r -->+  - Callers only, so Core still compiles: design.md Entry points table rows for SitesView and SitesModels, ComposedTeachingView and its view model, the permitsArticlesConversion parameter end to end from PendingReteach through AppLibraryModel.teach and RuleSuggester, and the comments citing SiteDetailModel.ArticlesPrompt+  - CaptureView loses the Article title row and shows No chapter parsed from title unconditionally+  - Ten accessibility identifiers go with their views; delete testArticlesAffordanceIsSeparateFromTitleSelection and testTheArticlesSwitchConfirmsBeforeItWrites, and the articles tests and helpers in SitesModelTests, ComposedTeachingViewModelTests and AppNavigationTests+  - The switch arms over SiteMode in SitesModels, SitesView and ComposedTeachingViewModel stay until task 3, because the case still exists+  - make test-quick passes+  - Blocked-by: 7mefo3q (Write failing tests for a library with two Site modes)+  - Requirements: [1.1](requirements.md#1.1), [1.2](requirements.md#1.2), [2.1](requirements.md#2.1), [2.5](requirements.md#2.5)++- [x] 3. Remove SiteMode articles and everything in Core that serves it <!-- id:7mefo3s -->+  - Repository surface: LibraryProviding projectArticles and commitArticles with the mock's members, LibraryRepository+Articles.swift, ArticleTitlePlanning.swift, the Articles contract types, the composed-teaching conversion gates and fix-up, supportsArticles and articlesUnavailable+  - The enum case with all eleven switches and the if-based sites in design.md's Core semantics table, the three app files included; LibraryValidator:1313 becomes not intentionallyUnattached per Q6+  - Capture and reparse stop setting the flag; CaptureOutcome.displayTitle goes with its test call sites and EntryTeachingDetail.displayTitle stays per Q19; the junk-rule plumbing goes from CaptureBasis, SiteSnapshot, ProjectedSite and SiteReconciler; export emits nil and the two import writers write nil, because the column lives until task 5+  - SiteGlyphKind.articles renamed unattached per Q4; GroupOrdering comment rewritten per Q11, behaviour unchanged; the article seed removed with its identifier retired by name in a comment+  - Tests per design.md: whole-file and whole-suite deletions, RuleOrderingTests and RetiredUnreadableRuleTests re-pointed at projectReplacement per Q18, RefreshUnionInvariantTests:142 deleted, RuleSuggesterTests re-themed onto a quarantined hostname+  - Golden builder re-themed per Q7 and re-recorded at 14/15 with ASTERISM_RECORD_GOLDEN=1; library-graph-baseline.txt hand-edited, never regenerated: gamma Site, its entry and the article work-type line+  - Task 1's tests go green. make test-core, test-quick, test and test-ui-ipad pass, except the UI failures main owns per Q34; the Req 7.2 grep result is recorded in implementation.md; this is commit 1+  - Blocked-by: 7mefo3r (Remove the articles entry points from the app and the share extension)+  - Requirements: [1.3](requirements.md#1.3), [2.2](requirements.md#2.2), [2.3](requirements.md#2.3), [2.4](requirements.md#2.4), [3.1](requirements.md#3.1), [3.2](requirements.md#3.2), [3.3](requirements.md#3.3), [3.4](requirements.md#3.4), [3.5](requirements.md#3.5), [6.1](requirements.md#6.1), [6.2](requirements.md#6.2), [6.3](requirements.md#6.3), [7.2](requirements.md#7.2), [7.4](requirements.md#7.4)++## Commit 2: Schema V16++- [x] 4. Write failing tests for the V15 to V16 stage and marker generation sixteen <!-- id:7mefo3t -->+  - V15RecordedStoreFixture and V15RecordedStoreTests in V14RecordedStoreTests' shape: seeded through the frozen snapshot with a populated junkSuffixRule on one Site, create-seed-save-release ordering stated in the doc comment, every row of every entity surviving field by field+  - MarkerGenerationSixteenTests: marker 15 converts and publishes 16 only after validation, a validation throw leaves 15, the app refuses 14, both halves of the extension fork. Check the suites' canonical unrecognised marker is still unused+  - ModelContractTests delta pin: V16's Site is V15's minus exactly junkSuffixRule, nothing added, every other entity identical+  - Red here means these do not compile until task 5 mints AsterismSchemaV16+  - Blocked-by: 7mefo3s (Remove SiteMode articles and everything in Core that serves it)+  - Requirements: [4.1](requirements.md#4.1), [4.3](requirements.md#4.3), [4.4](requirements.md#4.4)++- [x] 5. Freeze V15, drop Site.junkSuffixRule in V16 and retire V14 <!-- id:7mefo3u -->+  - One commit by rule, following the step table in docs/agent-notes/schema-migration.md and design.md's Commit 2 table: snapshot with its frozen-by-reference header and the externalStorage attribute carried across, live V16, AsterismV16MigrationPlan, typealiases+  - Markers 15 lagging and 16 current, the 15 arm of act(on:) with no data pass, no new BootstrapState case+  - Delete the last two import writers of the column, AsterismSchemaV14.swift, the V14 recorded-store pair and MarkerGenerationFifteenTests; move MarkerContractTests, CertificationPathTests, StoreMetadataTests and V4RecordedStoreTests to the V15 fixture in this commit+  - Pinned names: FrozenLibraryPathTests, the source-scan exclusions in MultiSiteReadPathTests and ThumbnailBytesReachTests, ThumbnailStoreProbeTests; every Schema(versionedSchema: hit re-checked, BackupImportGates first, and the legitimate V15 readers enumerated in implementation.md+  - JunkSuffixRule stays in ValueObjects.swift unchanged per Q8+  - envelopeVersionsFollowTheLiveSchema retargeted to V16 and wrapped in withKnownIssue per Q17; the baseline loses its junkSuffixRule= fields by hand+  - make test-core passes with exactly one known issue and make test-quick passes; this is commit 2+  - Blocked-by: 7mefo3t (Write failing tests for the V15 to V16 stage and marker generation sixteen)+  - Requirements: [4.1](requirements.md#4.1), [4.2](requirements.md#4.2), [4.3](requirements.md#4.3), [4.4](requirements.md#4.4), [4.5](requirements.md#4.5), [7.4](requirements.md#7.4)++## Commit 3: Archive 15/16 and documents++- [x] 6. Write failing tests for archive generation 15/16 <!-- id:7mefo3v -->+  - BackupV15ArchiveTests, BackupV15ImportMatrixTests and BackupV15Fixtures succeed the V14 files: an export writes 15/16 with no junk-suffix rule on the Site record, every record kind round-trips into an empty library with every exported field equal, a 14/15 envelope is refused by the version check naming the pair and writes nothing+  - The envelope test asserts plainly against AsterismSchemaV16, with no withKnownIssue+  - Blocked-by: 7mefo3u (Freeze V15, drop Site.junkSuffixRule in V16 and retire V14)+  - Requirements: [5.1](requirements.md#5.1), [5.2](requirements.md#5.2), [5.3](requirements.md#5.3)++- [x] 7. Replace the BackupV14 set with BackupV15 and re-record the golden <!-- id:7mefo3w -->+  - BackupV15Codec, BackupV15Exporter and BackupV15Types replace the V14 files outright per Q12; BackupV15Site drops junkSuffixRule and keeps mode as a typed SiteMode; supportedVersions becomes 15 and 16+  - The rename reaches 48 package files and 7 app files, AppLibraryModel, SettingsBackupModel and SettingsImportTests among them+  - Golden re-recorded as backup-15-16-golden.json through ASTERISM_RECORD_GOLDEN=1, never edited by hand+  - make test-core passes with zero known issues and make test-quick passes+  - Blocked-by: 7mefo3v (Write failing tests for archive generation 15/16)+  - Requirements: [5.1](requirements.md#5.1), [5.2](requirements.md#5.2), [5.3](requirements.md#5.3), [5.4](requirements.md#5.4), [7.1](requirements.md#7.1)++- [x] 8. Update the documents and close the source gate <!-- id:7mefo3x -->+  - The files and lines in design.md's Documents table: both in-app Getting Started guides, asterism-design.md, the style guide, the v2 plan, agent-notes testing.md and schema-migration.md, CLAUDE.md's schema paragraph, CHANGELOG.md+  - Req 7.2 grep over sources and tests: the only survivors are the frozen V15 stored property and task 1's raw-value test; result recorded in implementation.md+  - make test-core, test-quick, test and test-ui-ipad pass, except the UI failures main owns per Q34; this is commit 3+  - Blocked-by: 7mefo3w (Replace the BackupV14 set with BackupV15 and re-record the golden)+  - Requirements: [1.4](requirements.md#1.4), [7.1](requirements.md#7.1), [7.2](requirements.md#7.2), [7.3](requirements.md#7.3), [7.5](requirements.md#7.5)
specs/retire-migration-chain/library-graph-baseline.txt Modified +20 / -8
diff --git a/specs/retire-migration-chain/library-graph-baseline.txt b/specs/retire-migration-chain/library-graph-baseline.txtindex e3c1b760..eb21cf43 100644--- a/specs/retire-migration-chain/library-graph-baseline.txt+++ b/specs/retire-migration-chain/library-graph-baseline.txt@@ -67,21 +67,34 @@ # reads as having no schedule. Re-recorded by adding that one field # to each work line and reviewing the diff line by line (Q40), not # by regenerating the file.-format 12-counts entries=5 works=1 sites=3 titlePatterns=1 urlRulePatterns=1 workTypes=3 memberships=1 distinctPairs=0 series=0 links=0 creators=0 creatorRoles=3 credits=0 places=0 placeSuppressions=0-site hostname="alpha.test" displayName="Alpha Reader" modeRaw="untaught" junkSuffixRule=nil-site hostname="beta.test" displayName="Beta Serials" modeRaw="taught" junkSuffixRule=nil-site hostname="gamma.test" displayName="Gamma Articles" modeRaw="articles" junkSuffixRule="{\"anchors\":[{\"offset\":0,\"origin\":\"end\"}],\"version\":1}"+# format 12's *content* changed with remove-article-mode's first+# commit, before its shape did: the seed's third Site was the+# articles one, and the mode is gone, so that Site, its one Entry+# and its inverse line went with it, and the retired `article`+# default left the work-type section.+# format 13 is schema V16 (remove-article-mode, T-2336): every site+# line loses junkSuffixRule, and no section is added or removed —+# V16 is the second stage in the project's history to remove+# anything, after V8 -> V9, and the first to remove a column+# without adding one. Every field the seed carried read nil here+# already, so the absence of the field rather than a changed value+# is the whole diff, which is the point: the V15 -> V16 stage takes+# the column and leaves every existing row otherwise as it found+# it. Hand-edited by deleting that one field from each site line+# and reviewing the diff line by line (Req 7.4), not by+# regenerating the file.+format 13+counts entries=4 works=1 sites=2 titlePatterns=1 urlRulePatterns=1 workTypes=2 memberships=1 distinctPairs=0 series=0 links=0 creators=0 creatorRoles=3 credits=0 places=0 placeSuppressions=0+site hostname="alpha.test" displayName="Alpha Reader" modeRaw="untaught"+site hostname="beta.test" displayName="Beta Serials" modeRaw="taught" titlePattern id=A1000000-0000-4000-8000-000000000001 site="beta.test" version=1 isActive=true createdAt=1800000000.000 definitionData="{\"definition\":{\"segment\":{\"ignored\":[{\"offset\":0,\"origin\":\"end\"}],\"work\":{\"length\":1,\"offset\":0,\"origin\":\"start\"}}},\"trimPrefix\":\"The \"}" urlRulePattern id=A2000000-0000-4000-8000-000000000002 site="beta.test" version=1 isCurrent=true createdAt=1800000000.000 originRaw="readerTaught" definition="{\"work\":{\"locator\":{\"query\":{\"name\":\"sid\"}}}}" workType id=D0000001-0000-4000-8000-000000000001 name="novel" nameModifiedAt=0.000 stateRaw="active" stateModifiedAt=0.000 canonicalID=nil createdAt=0.000 modifiedAt=0.000 workType id=D0000002-0000-4000-8000-000000000002 name="webtoon" nameModifiedAt=0.000 stateRaw="active" stateModifiedAt=0.000 canonicalID=nil createdAt=0.000 modifiedAt=0.000-workType id=D0000003-0000-4000-8000-000000000003 name="article" nameModifiedAt=0.000 stateRaw="active" stateModifiedAt=0.000 canonicalID=nil createdAt=0.000 modifiedAt=0.000 work id=A3000000-0000-4000-8000-000000000003 displayTitle="Beta Serial" lastParsedTitle="Beta Serial" genericNotes="notes on the serial" workTypeID=A4000000-0000-4000-8000-000000000004 genreTags=["action","drama"] titleProvenanceRaw="parsed" workStatusRaw="ongoing" readingStatusRaw="reading" verdict="" releaseDaysRaw=[] seriesID=nil seriesPosition=nil thumbnailShapeRaw=nil thumbnailDigest=nil createdAt=1800000000.000 modifiedAt=1800000000.000 entry id=B1000000-0000-4000-8000-000000000011 site="alpha.test" work=nil hostname="alpha.test" captureTitle="An Alpha Capture" captureTitleSourceRaw="host" rawURLString="https://alpha.test/read/1" canonicalURLString=nil entryIdentityKey="https://alpha.test/read/1" conservativeIdentityKey="https://alpha.test/read/1" identityBasisRaw="conservative" urlWorkIdentity=nil chapterSequence=nil chapterTitle=nil note="" ratingRaw=nil firstCapturedAt=1800000000.000 lastSharedAt=1800000000.000 modifiedAt=1800000000.000 intentionallyUnattached=false citationsData="{\"chapterTitle\":{\"kind\":\"none\"},\"identity\":{\"rawURL\":{}},\"workAssignment\":{\"none\":{}}}" entry id=B2000000-0000-4000-8000-000000000012 site="beta.test" work=A3000000-0000-4000-8000-000000000003 hostname="beta.test" captureTitle="The Beta Serial :: Chapter One" captureTitleSourceRaw="host" rawURLString="https://beta.test/read/1" canonicalURLString=nil entryIdentityKey="https://beta.test/read/1" conservativeIdentityKey="https://beta.test/read/1" identityBasisRaw="conservative" urlWorkIdentity=nil chapterSequence=nil chapterTitle="Chapter One" note="a reader's note" ratingRaw="up" firstCapturedAt=1800000000.000 lastSharedAt=1800000000.000 modifiedAt=1800000000.000 intentionallyUnattached=false citationsData="{\"chapterTitle\":{\"kind\":\"manual\"},\"identity\":{\"rawURL\":{}},\"workAssignment\":{\"manual\":{}}}" entry id=B3000000-0000-4000-8000-000000000013 site="beta.test" work=A3000000-0000-4000-8000-000000000003 hostname="beta.test" captureTitle="The Beta Serial :: Chapter Two" captureTitleSourceRaw="host" rawURLString="https://beta.test/read/2" canonicalURLString=nil entryIdentityKey="https://beta.test/read/2" conservativeIdentityKey="https://beta.test/read/2" identityBasisRaw="conservative" urlWorkIdentity=nil chapterSequence=nil chapterTitle="Chapter Two" note="" ratingRaw=nil firstCapturedAt=1800000000.000 lastSharedAt=1800000000.000 modifiedAt=1800000000.000 intentionallyUnattached=false citationsData="{\"chapterTitle\":{\"kind\":\"pattern\",\"patternID\":\"A1000000-0000-4000-8000-000000000001\"},\"identity\":{\"rawURL\":{}},\"workAssignment\":{\"manual\":{}}}"-entry id=B4000000-0000-4000-8000-000000000014 site="gamma.test" work=nil hostname="gamma.test" captureTitle="A Gamma Article" captureTitleSourceRaw="host" rawURLString="https://gamma.test/posts/1" canonicalURLString=nil entryIdentityKey="https://gamma.test/posts/1" conservativeIdentityKey="https://gamma.test/posts/1" identityBasisRaw="conservative" urlWorkIdentity=nil chapterSequence=nil chapterTitle=nil note="" ratingRaw=nil firstCapturedAt=1800000000.000 lastSharedAt=1800000000.000 modifiedAt=1800000000.000 intentionallyUnattached=true citationsData="{\"chapterTitle\":{\"kind\":\"none\"},\"identity\":{\"rawURL\":{}},\"workAssignment\":{\"none\":{}}}" entry id=B5000000-0000-4000-8000-000000000015 site=nil work=nil hostname="orphan.test" captureTitle="An Orphaned Capture" captureTitleSourceRaw="host" rawURLString="https://orphan.test/read/1" canonicalURLString=nil entryIdentityKey="https://orphan.test/read/1" conservativeIdentityKey="https://orphan.test/read/1" identityBasisRaw="conservative" urlWorkIdentity=nil chapterSequence=nil chapterTitle=nil note="" ratingRaw=nil firstCapturedAt=1800000000.000 lastSharedAt=1800000000.000 modifiedAt=1800000000.000 intentionallyUnattached=false citationsData="{\"chapterTitle\":{\"kind\":\"none\"},\"identity\":{\"rawURL\":{}},\"workAssignment\":{\"none\":{}}}" workSiteMembership id=A5000000-0000-4000-8000-000000000005 hostname="beta.test" createdAt=1800000000.000 urlIdentity=nil urlIdentityStateRaw="none" urlIdentityRuleID=nil workURLString=nil workID=A3000000-0000-4000-8000-000000000003 work=A3000000-0000-4000-8000-000000000003 site="beta.test" creatorRole id=E0000001-0000-4000-8000-000000000001 name="author" nameModifiedAt=0.000 position=0 positionModifiedAt=0.000 stateRaw="active" stateModifiedAt=0.000 canonicalID=nil createdAt=0.000 modifiedAt=0.000@@ -89,5 +102,4 @@ creatorRole id=E0000002-0000-4000-8000-000000000002 name="artist" nameModifiedAt creatorRole id=E0000003-0000-4000-8000-000000000003 name="translator" nameModifiedAt=0.000 position=2 positionModifiedAt=0.000 stateRaw="active" stateModifiedAt=0.000 canonicalID=nil createdAt=0.000 modifiedAt=0.000 inverse-site hostname="alpha.test" patterns=[] urlRules=[] entries=[B1000000-0000-4000-8000-000000000011] workMemberships=[] inverse-site hostname="beta.test" patterns=[A1000000-0000-4000-8000-000000000001] urlRules=[A2000000-0000-4000-8000-000000000002] entries=[B2000000-0000-4000-8000-000000000012,B3000000-0000-4000-8000-000000000013] workMemberships=[A5000000-0000-4000-8000-000000000005]-inverse-site hostname="gamma.test" patterns=[] urlRules=[] entries=[B4000000-0000-4000-8000-000000000014] workMemberships=[] inverse-work id=A3000000-0000-4000-8000-000000000003 entries=[B2000000-0000-4000-8000-000000000012,B3000000-0000-4000-8000-000000000013] siteMemberships=[A5000000-0000-4000-8000-000000000005]

Things to double-check

Take a fresh backup before installing on a real device.

After this change a 14/15 backup file cannot be restored, and the store converts to V16 on first open. The pre-flight archive is the only way back.

Update every device together.

Both configurations mirror. A V15 build left on a second device shares the container with V16 builds.

make test-core on an unlocked host.

Every run on this machine since last night shows 119 Operation not permitted issues in the three pending-capture suites, identical on untouched commits. No green full run of the final tree exists yet.

Req 7.1.

make test stays red for six cases main owns. The waiver is yours to give or withhold (Q34).

The Monday-only TodayUITests pair is unticketed.

It will fail on any branch next Monday.