WP-O2: origin dimension — tolerant resolver + derivation#2825
Open
byteclimber wants to merge 2 commits into
Open
WP-O2: origin dimension — tolerant resolver + derivation#2825byteclimber wants to merge 2 commits into
byteclimber wants to merge 2 commits into
Conversation
…rigin
WP-O2a: renames DIMENSION.SOURCE -> DIMENSION.ORIGIN (and SOURCE_VALUE ->
ORIGIN_VALUE) in prompt-tags.js, and gives the authorship root its own
tolerant resolver in tag-tree.js (resolveAuthorshipRoot): it reuses an
existing `origin` root, else adopts a legacy `source` root whose children
are a subset of {ai, human}, else mints a new `origin` root — never a
second, empty one. ensureDimensionRoots/provisionDimensionTree/
ensureClosedValue route through this resolver instead of blind-creating
the authorship root. parseCreateTagBody and the provisioning seams in
markets-subworkspace.js already validate/seed against ALL_DIMENSIONS/
DIMENSION_ROOT_NAMES, so they pick up the rename automatically.
WP-O2b: generalizes makeTypeInjector (handlers/prompts.js, and its
subworkspace twin) to also strip+inject `origin` on every prompt write:
CREATE always derives to `ai`; UPDATE re-injects whichever `origin` tag
the request already carries (never re-derived), falling back to `ai`
only if none is found. prompts-storage.js's upsertPrompts now derives
`origin` from the caller's authenticated principal (service principal:
honor an asserted ai/human value; user principal: always override to
human) via the new resolveOriginForWrite; updatePromptById no longer
accepts `origin` in a PATCH body; mapRowToPrompt drops the `|| 'human'`
read fallback. brands.js wires isServicePrincipal from context.s2sConsumer
into upsertPrompts. OpenAPI docs updated to describe the new origin
semantics without changing the query filter/sort surface.
Tracks WP-O2a (spacecat-api-service#2816, SITES-48001) and WP-O2b
(spacecat-api-service#2817, SITES-48002) from serenity-docs PR #46.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
This PR will trigger a minor release when merged. |
Contributor
Author
|
Related: #2785 (intent-classification) touches the same files ( |
4 tasks
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of the origin-dimension rename: adobe/serenity-docs#46. Combines WP-O2a (tolerant resolver + root rename) and WP-O2b (derivation).
WP-O2a
DIMENSION.SOURCE→DIMENSION.ORIGIN,SOURCE_VALUE→ORIGIN_VALUE, etc. inprompt-tags.jsresolveAuthorshipRootintag-tree.js: reuses an existingoriginroot, else adopts a legacysourceroot only if its children ⊆{ai, human}, else mints a neworiginroot. Wired intoensureDimensionRoots.handlers/tags.js,markets-subworkspace.js,brand-provisioning.js,serenity.jsneeded no changes — they already resolve via the shared constants.src/support/elements/**untouched (separate, already-flagged production-triage concern).WP-O2b
makeTypeInjectornow strips+injectsorigin: CREATE derivesai/human, UPDATE re-injects the already-stored value, never re-derives.resolveOriginForWrite(candidate, isServicePrincipal): service principal may assert a value (invalid falls back tohuman), user principal always overridden tohuman.originPATCH path fromupdatePromptByIdand the|| 'human'fallback frommapRowToPrompt.originas service-principal-only on write.Test plan
test/controllers/audits.test.jsorder-dependent flakes, unrelated, pass in isolation)tsctype-check cleanit-postgresserenity IT suite not updated — it drives the real mock Docker image still pinned at@adobe/spacecat-shared-project-engine-client@1.10.0(pre-WP-O1). Needs a follow-up once WP-O1: rename authorship tag root from source to origin (PE-client mock) spacecat-shared#1815 (WP-O1) releases and this repo's dependency bumps.Depends on: adobe/spacecat-shared#1815 (WP-O1) for full IT verification.
Closes #2816, #2817
Jira: SITES-48001, SITES-48002 · Tracking: cross-repo plan in adobe/serenity-docs#46
🤖 Generated with Claude Code