Export model: lift three per-document facts out of cljs_project and vanilla_js#51
Merged
Merged
Conversation
emit-action-event and step->thread-form both walked the enclosing group's :fields to find an action step's target-field :of-group, then prepended <app-ns>.<og>.db — the same lookup at two sites of the same plugin, and a fact about the document model that any future plugin would re-derive. Move it into bareforge.export.model as action-target-of-group-ns. Both call sites now consume the helper. No behaviour change; pinned by four new tests covering the collection-field hit, the scalar-field miss, the unknown-target miss, and the app-ns prefix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
view-context and inline-entry both built {field → explicit-owner-ns}
by walking the subtree with explicit-field-owners and then mapping
each picked-owner name through name->ns (falling back to the raw
string when the name was absent). Identical six lines, two sites.
Move it into bareforge.export.model as resolve-explicit-field-owners,
fold the now-dead local alias for explicit-field-owners. Three new
tests pin the mapping, the unknown-name passthrough, and the
sub-group boundary.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… entries
Both cljs_project (view-context, template-iteration paths) and
vanilla_js/codegen (node->js-hiccup) read each sub-group instance's
:source-sub and :source-field by calling (m/get-node doc (:id sg))
after find-sub-groups had already walked the same node. The walk
already holds the child node — surface those two fields on every
returned entry so callers consume them directly.
Both plugins lose the m/get-node round-trip and the
{sg+src (assoc sg ...)} re-pack in vanilla_js disappears entirely.
No behaviour change; pinned by a new test that the demo-store's
cart-item template-instance children carry the source-* keys.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
First batch of the audit's item 6 ("plugins are re-deriving facts the export model should own"). Three contained extractions; `bareforge.export.model` grows three small surfaces, plugins lose ~70 lines net plus three round-trips back through `m/get-node` to read fields already in scope.
No behaviour change. Pinned by seven new tests in `model_test` covering each helper's contract.
The audit's fourth lift — a unified `resolve-template-source` that consolidates the `:source-sub / :source-field / auto-host` three-way `cond` repeated in `view-context`, `template-iteration-expr`, and `core-group-body` — is intentionally deferred. It's the biggest of the four (touches both plugins in three places each, returns a tagged map plugins switch on) and warrants its own focused PR.
Test plan
🤖 Generated with Claude Code