Skip to content

Content types: Field change jobs, dry run and numbering (closes #934, #584) - #1139

Merged
arnelirobles merged 14 commits into
release/5.0.0from
feature/934-content-type-change-jobs
Oct 13, 2026
Merged

arnelirobles merged 14 commits into
release/5.0.0from
feature/934-content-type-change-jobs

Conversation

@arnelirobles

Copy link
Copy Markdown
Contributor

What changed and why

Batch C12 of the 5.0 plan (#1125): content type change jobs, dry run and numbering. Five items, one commit each, a migration commit, then a commit closing the independent review's findings and a merge of release/5.0.0.

Fixes #934
Fixes #584
Refs #892

  • Content types: change a field (rename, convert, remove) through one endpoint, applied by a job #934 slice 1: the change-field endpoint and a resumable rename. POST /api/content-types/{name}/fields/{field}/change classifies a change. A displayName alone is additive and applied at once (200). A newName is a rename, applied by a FieldChange job (202) in batches of 200 that commit with their progress: copy every value to the new name, rename the field on the type (and in its uniqueness rules, transitions, numbering rule and lookup), then drop the old key. GET /api/content-types/field-changes/{id} reports step, progress and last error, and POST .../{id}/resume queues a stopped change again from its cursor. The rewrite is a new ContentFieldChanged event, so it fires no workflow and does not move updatedAt, and history shows it as FieldChanged.
  • Content types: change a field (rename, convert, remove) through one endpoint, applied by a job #934 slice 2: convert and remove. toType (with a mapping of stored values, options for a choice) converts every value; remove takes the field and its values away. A change that drops values is refused unless allowDestructive is set, and the refusal names how many entries hold one (valuesLost, counted in one SQL query).
  • Content types: change a field (rename, convert, remove) through one endpoint, applied by a job #934 slice 3: sensitivity on the job runner. PUT .../fields/{field}/sensitivity is now one FieldChange in the order it always used (raising rebuilds search text first, lowering changes the definition first). Up to 200 entries it still completes before the answer; a larger type is changed by the queue, and the response's new change names it.
  • barako: generic resource verbs with validation and dry run in the API #892: dry run. POST /api/contents, PUT /api/contents/{id}, POST /api/content-types and POST /api/content-types/{name}/fields take "dryRun": true and answer dryRun and changes (field, from, to), storing nothing.
  • Numbering as a core primitive, with the gapless cost made explicit #584: numbering on a content type. PUT /api/content-types/{name}/numbering sets a rule (field, prefix, padding, reset, time zone, strategy). Strategies are gapless (4.9's allocator), sequence (no duplicates, gaps on failed writes, no long lock) and hiLo (blocks of 50 per instance). Accounting 4.4.0 numbers journal entries through the core gapless allocator in its old JE-<year>-<six digits> format; migrations/5.0.0/accounting-number-sequences.sql (shipped from the module, with a rollback) carries each tenant's yearly count over.

What is left of #892 (so Refs): the CLI name decision and dry run on the generic write verbs beyond these four routes.

How to test

dotnet restore --locked-mode && dotnet build -c Release --no-restore
dotnet run --project BarakoCMS.Tests -c Release --no-build -- \
  -class BarakoCMS.Tests.Features.ContentTypes.ChangeFieldTests \
  -class BarakoCMS.Tests.Features.ContentTypes.DryRunTests \
  -class BarakoCMS.Tests.Numbering.NumberingRuleTests
bash scripts/openapi-contract-check.sh

Which test fails without this change

All 13 tests added for the review findings were run against the commit before the fixes and went red: ChangeFieldTests (empty new name, label sent alone, Hidden and token fields refused, definition edits wait with 409, resume refused while the job is queued, two runs of one change cannot both save, processed counted once), DryRunTests (update-only caller sees no stored value, dry run releases its Idempotency-Key), NumberingRuleTests (update keeps the number, mis-cased type still numbered, rename carries the rule and remove or convert is refused). The holdout block binds tests to hunks in existing files:

- test: BarakoCMS.Tests.Features.ContentTypes.ChangeFieldTests
  breaks: barakoCMS/Infrastructure/Services/ContentValidatorService.cs "FieldChanges.RunningAsync(session, contentType"
- test: BarakoCMS.Tests.Features.ContentTypes.ChangeFieldTests
  breaks: barakoCMS/Features/ContentType/AddField/Endpoint.cs "Definition.RefusesWhileFieldChangeRuns();"
- test: BarakoCMS.Tests.Features.ContentTypes.DryRunTests
  breaks: barakoCMS/Features/Content/Update/Endpoint.cs "Changes = await DryRunChangesAsync"
- test: BarakoCMS.Tests.Numbering.NumberingRuleTests
  breaks: barakoCMS/Infrastructure/Services/ContentCreator.cs "await NumberAsync(definition, request.ContentType"
- test: BarakoCMS.Tests.ContractSurfaceVersionTests
  breaks: barakoCMS/Features/Monitoring/Meta/ApiContract.cs "Version = 8"
- untested: barakoCMS/Infrastructure/Filters/IdempotencyFinalizer.cs #1
  why: the dry-run flag and its use are separate hunks, so one held out alone does not compile. DryRunTests.A_dry_run_leaves_its_idempotency_key_for_the_real_write went red against the commit before it
- untested: barakoCMS/Infrastructure/Services/ContentWriter.cs #1
  why: the writer's own refusal is the backstop for routes that skip the validator (workflow actions, sync). No test drives one of those during a change; on the API the validator refuses first, which ChangeFieldTests binds above
- untested: barakoCMS/Infrastructure/Services/ContentTokenIssuer.cs #1
  why: the number kept on update shares hunks with the per-type cache the token fields now read, so one held out does not compile. NumberingRuleTests.An_update_keeps_the_stored_number went red against the commit before it
- untested: BarakoCMS.Abstractions/Core/Interfaces/INumberAllocator.cs #1
  why: the dated NextAsync overload, with a default body; callers name it, so holding it out does not compile. NumberingRuleTests' Accounting tests run through it
- untested: BarakoCMS.Abstractions/Events/ContentEvents.cs #1
  why: the ContentFieldChanged record; the job and the projection name it, so holding it out does not compile. ChangeFieldTests' rename tests run through it
- untested: BarakoCMS.Abstractions/Models/Content.cs #1
  why: Apply for ContentFieldChanged, called by name from the projection, so holding it out does not compile. ChangeFieldTests checks every entry's data after a rename
- untested: BarakoCMS.Abstractions/Models/ContentTypeDefinition.cs #1
  why: the Numbering property and NumberingRule class; holding them out does not compile. NumberingRuleTests covers them
- untested: BarakoCMS.Accounting/Domain/NumberSequence.cs #1
  why: a doc comment saying the rows are read only by the migration now
- untested: BarakoCMS.Accounting/JournalEntryHook.cs #1
  why: the allocator constructor and the obsolete one that chains to it; the hunks name each other, so one held out does not compile. NumberingRuleTests.A_posted_journal_entry_is_numbered_by_the_core_allocator_in_the_modules_format covers it
- untested: BarakoCMS.Accounting/LedgerService.cs #1
  why: the allocator constructor and the obsolete one that chains to it, as for the hook. Covered by the module's registration through the same NumberingRuleTests post
- untested: barakoCMS/Extensions/ServiceCollectionExtensions.cs #1
  why: DI registrations (allocators, the gate processor) and FieldChange's optimistic concurrency. Held out, a resolve fails at startup rather than a test asserting it; ChangeFieldTests.Two_runs_of_one_change_cannot_both_save_from_the_progress_they_read went red without the concurrency line
- untested: barakoCMS/Features/Content/Create/Endpoint.cs #1
  why: the dry-run branch and the caller lookup extracted for it; the hunks name each other. DryRunTests.A_dry_run_create_answers_with_the_fields_it_would_set_and_stores_no_entry covers it
- untested: barakoCMS/Features/Content/Create/Models.cs #1
  why: dryRun on the request and response; holding it out does not compile
- untested: barakoCMS/Features/Content/History/Endpoint.cs #1
  why: the FieldChanged version name, with the switch extracted into VersionOf; the hunks name each other. ChangeFieldTests' rename is a history event
- untested: barakoCMS/Features/Content/Update/Models.cs #1
  why: dryRun and changes on the request and response; holding them out does not compile. Bound through Update/Endpoint.cs above
- untested: barakoCMS/Features/ContentType/ContentTypeResponse.cs #1
  why: numbering on the response, an additive field read from the definition
- untested: barakoCMS/Features/ContentType/Create/Endpoint.cs #1
  why: the dry-run branch and the definition builder extracted for it; the hunks name each other. DryRunTests.A_dry_run_type_create_lists_its_fields_and_stores_no_type covers it
- untested: barakoCMS/Features/ContentType/SetFieldCurrency/Endpoint.cs #1
  why: the 409 gate line, the same one-line change ChangeFieldTests binds in AddField above
- untested: barakoCMS/Features/ContentType/SetFieldOptions/Endpoint.cs #1
  why: the 409 gate line, the same one-line change ChangeFieldTests binds in AddField above
- untested: barakoCMS/Features/ContentType/SetFieldPresentation/Endpoint.cs #1
  why: the 409 gate line, the same one-line change ChangeFieldTests binds in AddField above
- untested: barakoCMS/Features/ContentType/SetFieldSensitivity/Endpoint.cs #1
  why: the rewrite onto FieldChange; its hunks name the extracted helpers, so one held out does not compile. ChangeFieldTests' two sensitivity tests and FieldSensitivityChangeTests cover it
- untested: barakoCMS/Features/ContentType/SetFieldSensitivity/Models.cs #1
  why: the change field on the response; holding it out does not compile
- untested: barakoCMS/Features/ContentType/SetLookup/Endpoint.cs #1
  why: the 409 gate line, the same one-line change ChangeFieldTests binds in AddField above
- untested: barakoCMS/Features/ContentType/SetPublicDelivery/Endpoint.cs #1
  why: the 409 gate line, the same one-line change ChangeFieldTests binds in AddField above
- untested: barakoCMS/Features/ContentType/SetRouteTemplate/Endpoint.cs #1
  why: the 409 gate line, the same one-line change ChangeFieldTests binds in AddField above
- untested: barakoCMS/Features/ContentType/SetStructuredData/Endpoint.cs #1
  why: the 409 gate line, the same one-line change ChangeFieldTests binds in AddField above
- untested: barakoCMS/Features/ContentType/SetUniqueness/Endpoint.cs #1
  why: the 409 gate line, the same one-line change ChangeFieldTests binds in AddField above
- untested: barakoCMS/Features/Public/Events/ContentChangeListener.cs #1
  why: ContentFieldChanged counted as a content event for the change feed; no test reads the feed during a rename
- untested: barakoCMS/Features/Seo/AddSeoFieldsEndpoint.cs #1
  why: the 409 gate line, the same one-line change ChangeFieldTests binds in AddField above
- untested: barakoCMS/Infrastructure/Numbering/GaplessNumberAllocator.cs #1
  why: the dated overload; the interface names it, so holding it out does not compile. NumberingRuleTests' Accounting tests count a dated period through it
- untested: barakoCMS/Infrastructure/Services/ContentProjection.cs #1
  why: ContentFieldChanged in the projection's switch and its list; held out, a stream rebuild drops the rewrite, which ContentStreamRebuildTests does not exercise for this event

Checklist

  • A test covers this, and I confirmed it fails without the change (the 13 review tests run against the pre-fix commit, and the holdout bindings above)
  • dotnet build is clean, with no new warnings (every added line checked against the Release build's warnings)
  • Public API changes keep existing consumers compiling, or the break is called out below
  • Docs updated (docs/field-changes.md, docs/dry-run.md, docs/numbering.md, docs/access-control.md)

Anything reviewers should know

Breaking HTTP change, ApiContract.Version 7 -> 8:

  • PUT .../fields/{field}/sensitivity on a type over 200 entries answers before the new level is in force (entriesReindexed 0, change running).
  • While a field change runs on a type, entry writes to it answer 400 and edits to its definition answer 409 (sensitivity, options, currency, presentation, add field, uniqueness, numbering, lookup, public delivery, route template, structured data, SEO fields).
    DeliveryVersion stays 7. Coordination: the C5 PR (Content types: Field types, site schema and blocks (closes #928, #924, #929) #1134) also moves Version 7 -> 8 for Site: json fields carry a schema checked on write, and Mode is a choice #924. Whichever merges second should take 9 when it merges release/5.0.0. openapi/baseline.json was regenerated with scripts/openapi-fetch.sh; the contract gate passes (additions and two description texts).

Package surface (additive): FieldChange, FieldChangeKind, FieldChangeState, ContentFieldChanged, NumberingRule, ContentTypeDefinition.Numbering, NumberStrategy, INumberStrategies, INumberAllocator.NextAsync(session, series, at, ct) with a default body, and barakoCMS.Infrastructure.Numbering.NumberAllocators.Gapless(). That last one is a deliberate new public type in core outside the section 6 list: the obsolete Accounting constructors need the core counter without the container. ContentCreator gained an optional constructor parameter, which changes a public type's constructor signature (source compatible, not binary). JournalEntryHook() and LedgerService(session, writer) stay, [Obsolete] with removal in 6.0. BarakoCMS.Abstractions 5.0.0, BarakoCMS.Accounting 4.4.0.

Migrations, safe on a 4.9 database: migrations/5.0.0/field-changes.sql (core) and accounting-number-sequences.sql (module), each with a rollback. Verified locally after the review fixes: on a schema the base build's db-apply made, the new build's db-assert fails before the files and passes after them (core and Suite), both files rerun cleanly, and after the rollbacks the base build's db-assert passes. scripts/upgrade-check.sh cannot run here (GHCR pulls are blocked by this environment's proxy).

Decisions for the owner:

  • Only a Public field that holds no token can be renamed, converted or removed (review finding 1). Reads and history mask by declared name, so a moved value would sit unmasked. To change a sensitive field the admin lowers it to Public first, which is itself an audited disclosure. Making reads and history mask undeclared keys would lift this; that is a separate change.
  • There is no route to abandon a running change. A change that cannot complete keeps the type's writes refused until it is resumed.
  • GET/POST /api/content-types/field-changes/{id}[/resume] need manage_content_types, while the sensitivity endpoint needs manage_public_delivery. A role holding only the latter gets a change id it cannot poll. Accept either capability, or keep as is?
  • A lookup's reveal names a field on another (singleton) type. Renaming that field on the singleton does not update the lookup that points at it.
  • Numbering covers the content API, batch create and import. A collection push, a form submission, a workflow's create-task action and an inbound sync still create entries without a number (documented in docs/numbering.md).

needs-review.sh (against release/5.0.0)

needs-review: auth/permission surface touched -- barakoCMS/Features/Public/Events/ContentChangeListener.cs
needs-review: Configure() changed in an Endpoint file -- barakoCMS/Features/ContentType/ChangeField/Endpoint.cs, barakoCMS/Features/ContentType/FieldChangeStatus/Endpoint.cs, barakoCMS/Features/ContentType/ResumeFieldChange/Endpoint.cs, barakoCMS/Features/ContentType/SetNumbering/Endpoint.cs
needs-review: dynamic SQL construction (MatchesSql/OrderBySql/Query<T>("...")) -- barakoCMS/Features/ContentType/ChangeField/ChangeFieldValues.cs
needs-review: schema or DI wiring touched (ServiceCollectionExtensions.cs, migrations/, AutoCreate) -- barakoCMS/Extensions/ServiceCollectionExtensions.cs, migrations/5.0.0/accounting-number-sequences.sql, migrations/5.0.0/field-changes.sql, migrations/5.0.0/rollback-accounting-number-sequences.sql, migrations/5.0.0/rollback-field-changes.sql
needs-review: secret handling touched (ISecretProtector, or an identifier naming secret/token/password/apikey) -- BarakoCMS.Abstractions/Core/Interfaces/INumberAllocator.cs, BarakoCMS.Tests/Features/ContentTypes/ChangeFieldTests.cs, BarakoCMS.Tests/Features/ContentTypes/DryRunTests.cs, BarakoCMS.Tests/Numbering/NumberingRuleTests.cs, barakoCMS/Core/Validation/FieldConversion.cs, barakoCMS/Features/Content/Create/Endpoint.cs, barakoCMS/Features/Content/Update/Endpoint.cs, barakoCMS/Features/ContentType/AddField/Endpoint.cs, barakoCMS/Features/ContentType/ChangeField/ChangeFieldValues.cs, barakoCMS/Features/ContentType/ChangeField/Endpoint.cs, barakoCMS/Features/ContentType/FieldChangeStatus/Endpoint.cs, barakoCMS/Features/ContentType/ResumeFieldChange/Endpoint.cs, barakoCMS/Features/ContentType/SetFieldSensitivity/Endpoint.cs, barakoCMS/Features/ContentType/SetNumbering/Endpoint.cs, barakoCMS/Infrastructure/Jobs/FieldChangeGate.cs, barakoCMS/Infrastructure/Jobs/FieldChanges.cs, barakoCMS/Infrastructure/Numbering/GaplessNumberAllocator.cs, barakoCMS/Infrastructure/Numbering/SequenceNumberAllocator.cs, barakoCMS/Infrastructure/Services/ContentCreator.cs, barakoCMS/Infrastructure/Services/ContentTokenIssuer.cs, barakoCMS/Infrastructure/Services/ContentValidatorService.cs, barakoCMS/Infrastructure/Services/ContentWriter.cs, changelog.d/934-change-field.Added.md, docs/dry-run.md, docs/field-changes.md
needs-review: background work or concurrency primitive touched (BackgroundService/IHostedService/Channel</Lease/Claim) -- barakoCMS/Features/Content/Create/Endpoint.cs

Independent review

A separate agent reviewed the branch adversarially. Findings and what was done:

  1. blocking: a renamed or removed sensitive field was read unmasked, during the job and in history. Fixed the safer way: rename, convert and remove are refused for a field that is not Public or that holds a token (the owner decision above). Test Only_a_public_field_holding_no_token_is_renamed_converted_or_removed.
  2. blocking: a dry-run update echoed stored values the caller may not read. Fixed: a caller who may read the entry sees from/to as its GET masks them, with hidden fields left out; a caller who may not is told only what it sent, every field, from null. Test A_dry_run_update_by_a_caller_who_may_not_read_the_entry_tells_them_nothing_stored.
  3. blocking: an empty newName renamed the field to "". Fixed: a validator rule, and the rename keeps the errors the rename brings (after minus before) instead of filtering by a quoted name.
  4. blocking: the sensitivity endpoint was not serialized with field changes. Fixed: every endpoint that rewrites a type's definition answers 409 while a change runs (a global pre-processor keyed on endpoint metadata), and the definition step throws instead of completing when its field is gone.
  5. blocking: resume could run a change twice. Fixed: FieldChange uses optimistic concurrency, so a stale run's batch rolls back, and resume answers 409 while the change's job is queued or running.
  6. should-fix: the write lock missed paths, and two changes could start at once. Fixed: the batch create checks it, the writer refuses on every async path (the job's own writer opts out), and starting a change takes a transaction advisory lock on the type before checking.
  7. should-fix: rename did not carry the numbering rule; remove and convert left it dangling. Fixed in FieldNames (and for the lookup that came in with the release merge).
  8. should-fix: numbering could be bypassed. Fixed: a mis-cased type name is still numbered, and an update by any route keeps the stored number (in the writer, beside tokens). The create routes that do not number are documented.
  9. should-fix: dry run skipped checks its docs claimed, and used up an Idempotency-Key. Fixed: the key is released after a dry run; the docs now say uniqueness and version checks run only on the real write.
  10. should-fix: a cancelled inline sensitivity run locked the type. Fixed: the job is queued with the change in the same commit, starting a minute later, so a request cut short is finished by the job. Bounded executions per job and an abort route are not done (the latter is an owner decision above); a job past its attempts is resumed.
  11. should-fix: LostAsync scanned every entry in the request. Fixed: one SQL count for a remove; for a convert, one grouped query over distinct stored values.
  12. should-fix: HTTP behaviour changed without the contract number. Fixed: ApiContract.Version 8, a .Breaking fragment, and the coordination note above.
  13. should-fix: Accounting's legacy constructors numbered apart. Fixed: they number through the core gapless counter via NumberAllocators.Gapless(). Test The_allocator_the_legacy_accounting_constructors_use_shares_the_core_count.
  14. should-fix: tests. Fixed: non-empty assertion first in the search text test (renamed to what it observes), tenant-crossing test for status and resume, and tests for every case above.
  15. should-fix: status and resume need a different capability than the sensitivity endpoint. Not changed: raised as an owner decision above.
  • nits carried: processed counts a rename once; numbering is in the type response; displayName with another change is refused; the rate-limited fifty-create test gets its own client IP. Not carried: cache invalidation after rename/convert/remove (bounded by the 60 s cache life), HiLo block map growth per period, series name truncation at 64 characters, case-sensitive mapping keys, RunningAsync without an index (the table holds one row per change), a deleted type completing its change. Each is small and noted here for a follow-up.

Gates

  • dotnet restore --locked-mode: 0. dotnet build -c Release --no-restore: 0, no new warnings (every added line checked against a full --no-incremental Release build's warnings).
  • Before the last release merge, one process, 74 classes (mine, the ContentTypes folder, the import, workflow, sync, SEO, public delivery and Accounting classes the write lock touches, plus TenantProfileWriteTests, SwitchTenantRequestTests, MetaEndpointTests, ContentLifecycleTests, RoleGateTests, CapabilityGateTests, OpenApiTagTests, SystemCapabilitiesTests, PublicSurfaceTests, SuiteCompositionTests and ArchitectureTests): 1346 of 1348 passed. The two failures: ShippedMigrationTests counted 8 module migrations where the merge made 9 (fixed, then 737 of 737 in the required set), and ContentTypeBlueprintTests.An_unreadable_custom_file_names_only_the_file_not_the_server_path, which needs chmod 000 to stop a read while this container runs as root; it fails the same way on the C5 branch, which touches nothing it reads, and passes in CI.
  • After merging release/5.0.0 (Audit: Record sensitive reads, one-query public lists, per-tenant site origin (closes #916) #1133): my three classes, the required set and the classes Audit: Record sensitive reads, one-query public lists, per-tenant site origin (closes #916) #1133 touched, 26 classes in one process: 850 passed, 0 failed.
  • The 13 tests for the review findings, run against the commit before the fixes: 13 failed, as required.
  • scripts/openapi-contract-check.sh origin/release/5.0.0: 0. scripts/check-method-length.py: none grew; the baseline only went down.
  • Migrations: db-assert before the files 1, after 0 (core and Suite), reruns 0, rollbacks 0, base db-assert after rollback 0.
  • scripts/preflight.sh (9 classes, this body, HOLDOUT_BASE=origin/release/5.0.0): locked restore, build, all 9 classes green, holdout fixtures 13/13, holdout 5 of 5 bindings red with their hunk out and green on restore, changelog fragments, module versions, upgrade plan, method length, pinned versions and quickstart checks all pass. The dash and banned-word step exits 1 because /root/.claude/CLAUDE.md does not exist in this environment (it was not created). The steps after it were run by hand from the script's own code with the base set to release/5.0.0: the scan for characters at or above U+2000 on added lines, the top-level markdown allowlist, workflow duplicate keys and asset provenance all pass. The banned-word list itself could not be checked.

Part of the 5.0 plan (#1125), batch C12.

🤖 Generated with Claude Code

https://claude.ai/code/session_01A1zCYm4uzgoS7C1T9yziZH


Generated by Claude Code

claude added 14 commits October 12, 2026 14:38
…hi-lo strategies, and move Accounting onto the core allocator (closes #584)
…content-type-change-jobs

# Conflicts:
#	BarakoCMS.Abstractions/Models/ContentTypeDefinition.cs
#	BarakoCMS.Tests/ShippedMigrationTests.cs
#	barakoCMS/Features/ContentType/ContentTypeResponse.cs
#	barakoCMS/barakoCMS.csproj
#	openapi/baseline.json
…content-type-change-jobs

# Conflicts:
#	scripts/method-length-baseline.txt
@arnelirobles
arnelirobles merged commit 03b1156 into release/5.0.0 Oct 13, 2026
15 checks passed
@arnelirobles
arnelirobles deleted the feature/934-content-type-change-jobs branch October 13, 2026 06:58
arnelirobles added a commit that referenced this pull request Oct 14, 2026
…, blocks and field change jobs, workflow compensation, Marten 9.49 (#1150)

* CI: OpenAPI contract gate, architecture tests, method-length ratchet, performance budget and report (closes #631) (#1129)

* Diff the served OpenAPI document against a reviewed baseline in CI

* Add architecture tests for the CLAUDE.md layout rules

* Stop methods over 70 lines from growing

* Budget image size, memory at rest, startup and delivery latency per pull request

* Measure methods with tuple return types in the length ratchet

* Tighten the OpenAPI and budget gates after review

* Report where the API's memory, threads and latency go, with ranked follow-ups

* Do not measure an object initializer inside a call as a method

* Prove the contract version check, and correct the performance report

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Console: API asks for barakoBrew, counts, metrics window, tenant roles, workflow PUT, analytics window (closes #1120) (#1128)

* Report the legacy role fallback on GET /api/me

* Add permission-aware content status counts

* Add a 24 hour window, p95, cache hits and uptime to the metrics summary

* Return the caller's roles per tenant on GET /api/me/tenants

* Add PUT /api/workflows/{id}

* Take from and to on the analytics routes, and return the previous series

* Add the workflow PUT to the role and capability gate inventories

* Refresh the OpenAPI baseline with the console API additions

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Security: Keep stored secrets under a key ring, and add a throttled public lookup (closes #900) (#1132)

* Keep stored secrets under a key ring with ids, re-wrapped at startup (#900)

* Answer a public lookup by reference plus an identifier, throttled (#804)

* Refuse an empty key ring entry or a CurrentKey with no keys, and document a rolling rotation (#900)

* Set the per-reference lookup Retry-After from its window (#804)

* Refresh the OpenAPI baseline with the key ring routes

* Split the key reading and prefixed-value migration out of two long methods

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Diagnostics, FeatureFlags: incidents view, Sentry-compatible forwarder and OFREP evaluation (closes #893) (#1131)

* Add an incidents view across failure sources, grouped and redacted on the server

* Forward captured browser errors to a Sentry-compatible receiver when configured

* Serve OpenFeature remote evaluation beside the feature flags route

* Bump BarakoCMS.Abstractions for the incident source contract

* Close redaction gaps and bound the incidents view's work after review

* Keep OFREP reasons neutral and accept weak or listed ETags

* List the OFREP flag's Key as a flag name in the replay rules

* Refresh the OpenAPI baseline with the incidents and OFREP routes

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Files: per-tenant storage, image sizes, S3 ACL default off, offsite backup copy (closes #781) (#1130)

* Default Files:S3:UsePublicReadAcl to false

* Store and return image width and height, with variants reporting their own

* Let a tenant choose and test file storage through the API

* Copy the nightly backup to S3-compatible storage when configured

* Declare manage_storage in the Files module and name the 6.0 removal

* Refresh the OpenAPI baseline with the storage settings routes

* Split the scan and variant storing out of three long Files methods

* Give the refused offsite run its own second so its archive is not overwritten

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Audit: Record sensitive reads, one-query public lists, per-tenant site origin (closes #916) (#1133)

* Audit reads of sensitive fields and share link redemptions (#916)

* Read the public list page and total in one query, add changedSince (#508)

* Link feeds, sitemaps and links.public to each tenant's own site (#923)

* Audit history and rollback reads, record the route template and API key (#916)

* Tag the feed and sitemap with the site type, note the origin precedence (#923)

* Point removals at webhooks, not the change feed, and test an offset changedSince (#508)

* Keep the changed endpoints inside the method-length ratchet

* Pin the workflow variable count at sixteen for links.public (#923)

* Split the variable list without reindenting it

* Add changedSince to the OpenAPI baseline (#508)

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Content types: Field types, site schema and blocks (closes #928, #924, #929) (#1134)

* Let an array field declare the type of its items (refs #928)

* Check json fields against a declared schema, make site Mode a choice, refuse undeclared fields (refs #924)

* Declare a parent field on a type and read the Pages tree per tenant (closes #929)

* Add a blocks field type checked against the tenant's registered block schema (refs #926)

* Keep block presets and data bindings as tenant data with CRUD (refs #926)

* Return each bound block's entries from page resolve (refs #926)

* Brace the single-statement ifs in the new field type code

* Ship the block and page settings tables as migrations, and close the review findings on blocks and trees

* Fix tests the undeclared-field refusal broke, and declare the Pages capability

* Declare the Pages capability defaults and seed them

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Config: one export, plan and apply engine for every configurable document, and Seed:File (closes #921) (#1140)

* Config: export, plan and apply engine with content type and role sections (refs #921)

* Config: workflow, permission rule, connector and site settings sections (refs #921)

* Config: forms and contents sections, Portability bundles through apply, Portability obsolete (refs #921)

* Seeding: apply the config document Seed:File names on first start (refs #905)

* Config: compare workflow branch children without response flags so a Conditional round-trips (refs #921)

* Config: answer 409 when a write lands before the commit, and clear caches whatever happens (refs #921)

* Config: name other tenants in a rule removal note only to a caller allowed to write the rules (refs #921)

* Audit: chain an entry off one the session has not saved yet (refs #921)

* Seeding: say a skipped destructive change is a likely cause, and document what a skip covers (refs #905)

* Config: stage writable sections past an unwritable one, keep deferred appends internal, bound the contents export query (refs #921)

* Workflows: brace the early return in the flag-free redaction (refs #921)

* Keep config documents out of idempotent replay and name Portability's removal version in place (refs #921)

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Build: Marten 9.49 with one 5.0 schema step, upgrade check from 4.x, MIT modules, secret store sources, Alba and Aspire spikes (closes #1000) (#1135)

* Move Marten to 9.49.0 and JasperFx to 2.84.1 with one 5.0 schema step

The new Marten replaces mt_quick_append_events; migrations/5.0.0 carries the
db-patch output against a 4.9.0 database and its rollback. Drops the Dependabot
hold on both packages.

* Start the upgrade check from 4.9.0 and 4.1.0, not 3.21.0

The job is renamed Upgrade from 4.x. A 3.x database upgrades to 4.9 first,
which the new docs/upgrading-to-5.0.md says.

* License the modules, Testing, Suite and template under MIT

The core and the contract package stay MPL-2.0 (D24). The licence is set by
rule in Directory.Build.props and checked by scripts/check-licences.sh. CLA.md
names the licence per location with a patent grant for MIT contributions, and
THIRD-PARTY-NOTICES.md says what ImageSharp's licence meant for Files 4.4.0.

* Add BarakoCMS.Secrets.Aws, a configuration source over AWS Secrets Manager

Maps configuration keys to secrets under Secrets:Aws:Map, authenticates as the
instance role, and stops startup naming a secret it cannot read.

* Add BarakoCMS.Secrets.Gcp and load both secret stores in the Suite

The Google Secret Manager source mirrors the AWS one. The Suite host adds both
before AddBarakoCMS; each adds nothing until a secret is mapped.

* Pilot Alba on ApiContractVersionHeaderTests and write up the result

The class runs as Alba scenarios on a host built from the fixture's own
configuration. docs/internal/alba-pilot.md compares the two styles and
recommends dropping Alba.

* Spike an Aspire AppHost for the local stack and write up the findings

aspire/ is not in the solution and nothing shipped references it.
docs/internal/aspire-spike.md has the timings, the compose diff and the
recommendation.

* Say the 5.0 Marten file exists for the schema check, not a bug barakoCMS hit

barakoCMS appends in Marten's Rich mode and never calls mt_quick_append_events.

* Release the secrets packages and test their store adapters

Adds both to PACKAGE_PROJECTS with a check that no packable project is left
off, tests the AWS and Google adapters against stub clients, refuses a binary
AWS secret, and pins the Suite's source order.

* Tighten the licence check and align the CLA patent clause with Apache-2.0

The Testing and Templates exception ends at their 5.x version, an unevaluable
project fails, and aspire/ is not evaluated.

* Check the 4.6.0 and 5.0.0 files together leave the function Marten builds

* Allow THIRD-PARTY-NOTICES.md at the repository root

* Give the AWS secrets host test a live resolver of its own

* Compare the first core rollback, now that a module adds a 5.0.0 file

* Run the upgrade-check self-tests from supported 4.x starts

The HR role cases start from 4.1.0, the default start is 4.9.0, and a 3.x
start is asserted to be refused before anything runs.

* Check every 5.0.0 core file and its rollback order, now there are three

* Revert "Pilot Alba on ApiContractVersionHeaderTests and write up the result"

This reverts commit 773f46a.

* Keep the Alba write-up, marked as dropped

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Workflows: Null conditions, node id, trigger registry, step outputs, compensation and executor (closes #1118) (#1136)

* Workflows: read null conditions as none and store none on save

* Workflows: build the runner node id for any machine name

* Workflows: let modules register and fire triggers, obsolete IWorkflowEngine

* Workflows: let an action return outputs a later action reads, kept by allowlist

* Workflows: undo the actions that succeeded when a run halts or is abandoned

* Workflows: let a workflow name its executor, with the built-in runner as the default

* Workflows: close the review findings on the merged branch

Output references are read from the workflow's own templates, so an entry
value holding {{actions.N.name}} is sent as text. PUT keeps or refuses a
compensation's credentials on the action rule, and the key ring re-wrap
reaches compensations. PUT stores null conditions as none. A null actions
list or null parameters no longer drop the other runs on an event. Abandon
refuses a run that finished with every action succeeded. Long methods are
split so the method-length check passes on the merged tree.

* Workflows: keep the trigger checks inline so the validator diff stays small

* List the abandon route in the gate inventories and accept it in the OpenAPI baseline

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Give the over-the-limit Kestrel tests a client that waits for the 413 (#1144)

The default handler sends the body after one second without an answer, so a slow runner could see a broken pipe instead of the status.

Co-authored-by: Claude <noreply@anthropic.com>

* Content types: Field change jobs, dry run and numbering (closes #934, #584) (#1139)

* Change a field through one endpoint, and apply a rename by a resumable job (refs #934)

* Convert a field through a mapping and remove one, refusing a destructive change without the flag (refs #934)

* Rebuild a field's search text for a sensitivity change on the job runner (refs #934)

* Answer a dry run on content type and entry writes with the checks and a diff, storing nothing (refs #892)

* Number a content type's entries by a declared rule, add sequence and hi-lo strategies, and move Accounting onto the core allocator (closes #584)

* Ship the field change table as a migration (refs #934)

* Close the review findings on field changes, dry run and numbering

* Count the module migrations both branches added

* Treat a session that cannot query field changes as having none running

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Tenants: Lifecycle status, sign-up and sign-in policy, tenant-owned roles (closes #894) (#1137)

* Give tenants a status and refuse a non-active tenant at resolution

* Add a per-tenant sign-up policy that registration, social sign-in and invitations read

* Let a tenant require MFA, limit sign-in methods and shorten sessions

* Give roles a tenant or platform owner, with a migration that keeps permissions

* Scope the roles routes and member role assignment to the caller's tenant

* Set Tenant.Status instead of the obsolete IsActive in tests, and tidy the batch's new code

* Bump Abstractions to 5.0.0 for the model changes

* Resolve VisibleToRoles names among the roles the writing tenant reaches

* Check the tenant's sign-in methods when a code is verified, not only when it is requested

* Join an Open tenant through social sign-in only with an account the sign-in created

* Refuse to delete a role a tenant names as its sign-up or MFA role

* Find a seeded role by name only among the deployment's roles

* Tell a paused tenant's status only to a token that names it, and document that an omitted status reactivates

* Split methods the batch grew past the length ratchet, and refresh its baseline

* Refresh the OpenAPI baseline with the tenant status, sign-up, sign-in and role owner fields

* List on /api/me/tenants only the roles that grant something in each tenant

* Keep the role list filter on /api/me/tenants in one hunk, and own the blueprint test's role by its tenant

* Set Tenant.Status in the public lookup tests

* Set Tenant.Status in the incidents and storage settings tests

* Add a rollback for role-tenancy.sql that restores the name index

Without it the rollback left 5.0's tenant and name index on mt_doc_roles,
so 4.x and 3.x refused to start under CreateOnly. Unchanged copies fold
back into their role, other roles sharing a name are renamed, and the
index on the name alone comes back.

* Build the Register endpoint in unit tests with the tenant-aware constructor

* Scope the config engine's roles and permission rules to the caller's tenant

* Set Tenant.Status in the seed file and the config test tenants

* Rename the seeded HR role in place in the admin contract test so it stays a platform role

* Add a rollback for tenant-status.sql, which changes nothing

* Make a role held globally a platform role in role-tenancy.sql

* Take only a platform role as a global role, and grant nothing from another tenant's role held globally

* Note a platform role change in the config plan, keep apply on the planned role, and cover the membership and seed paths

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Content types: A field change reaches block bindings, and config apply follows the field routes' rules (closes #1145) (#1146)

* Keep block bindings and config apply in step with field changes

A rename renames the field in every binding of the type. A remove, and a
config apply dropping the field, answer 409 while a binding names it.
Config apply answers 409 while a field change runs on the type, and
refuses dropping a field the numbering rule or lookup names.

* Name config conflicts when a seed file is refused

* Pin the config seam's new Conflicts list, run seam test changes directly

---------

Co-authored-by: Claude <noreply@anthropic.com>

* Release 5.0.0: prepare versions, changelog and package licences (#1147)

* Release 5.0.0: versions, changelog, Testing and Templates licences

* Move the 5.0 removal deadlines to 6.0 and make the deadline test read every attribute form

* Give the OFREP tests their own rate-limit bucket and assert the evaluation reason (#1149)

Co-authored-by: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants