Skip to content

[FEATURE] Accept serialized keys on the write path - #9

Closed
JoBalk wants to merge 1 commit into
mainfrom
20260821_jb_round-trip-write-path
Closed

JoBalk wants to merge 1 commit into
mainfrom
20260821_jb_round-trip-write-path

Conversation

@JoBalk

@JoBalk JoBalk commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

[FEATURE] Accept serialized keys on the write path

Whatever key to_hash emits is now assignable: a static as: aliases the
setter, a dynamic as: resolves in a second pass over the keys the setters
rejected.

Fixed while building it:

  • nested dynamic aliases were skipped when the container used as:
  • assign_hash left a stale tail when shrinking a collection
  • dynamic_aliases sat below private despite being documented as public
  • sync wrote model. while to_object, from_object and on: read
    model., so an aliased twin could not round-trip through
    a model

Documents round-tripping in USAGE.md, adds bin/console for exercising the
working tree.

@JoBalk
JoBalk requested a review from webit-schwarzer August 21, 2026 06:26
@JoBalk
JoBalk force-pushed the 20260821_jb_round-trip-write-path branch from dfb29ea to b4ff5fd Compare August 24, 2026 06:05
Whatever key to_hash emits is now assignable: a static as: aliases the
setter, a dynamic as: resolves in a second pass over the keys the setters
rejected.

Fixed while building it:
- nested dynamic aliases were skipped when the container used as:
- assign_hash left a stale tail when shrinking a collection
- dynamic_aliases sat below private despite being documented as public
- sync wrote model.<alias> while to_object, from_object and on: read
  model.<declared name>, so an aliased twin could not round-trip through
  a model

Documents round-tripping in USAGE.md, adds bin/console for exercising the
working tree.
@JoBalk
JoBalk force-pushed the 20260821_jb_round-trip-write-path branch from b4ff5fd to 1cb0738 Compare August 24, 2026 06:06

@webit-schwarzer webit-schwarzer left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ich hab mich erstmal auf die README konzentriert, den Rest nur überflogen. Lass uns hier nochmal drüber reden.

Comment thread USAGE.md
Comment on lines +179 to +182
On the model side the alias is the name too: `sync` and `to_object` write
`model.token=`, and `from_object`, `from_objects` and `on:` read `model.token`,
each falling back to the declared name when the model does not carry the alias.
That makes `as:` the way to map a property onto a differently named attribute:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hier hab ich gleich zweimal Bauchschmerzen:

  1. Auf der Model-Ebene hätte ich als Gem-Nutzer die Umbenennung nicht erwartet. Serialisierung ist in Ordnung - aber falls ich mein Model drunter hab, sollte das übereinstimmen. Andernfalls könnte man die Frage stellen, warum es überhaupt zwei Namen gibt, wenn doch in jedem Fall nur der eine verwendet wird.
  2. Der Fallback ist nicht intuitiv. Das würde ich als Gem-Nutzer ebenfalls nicht erwarten. Das fühlt sich wie "raten" an. Ich befürchte, dass uns das auf lange Sicht mehr Probleme macht als es löst.

Comment thread USAGE.md
Comment on lines +193 to +194
A dynamic `as:` is skipped here — a name computed per instance cannot address a
fixed attribute — so those properties always use the declared name.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Den Satz versteh ich nicht. Stammt der aus einem Arbeitsstand zwischendurch?

Comment thread USAGE.md
occurredAt: "2026-08-21T09:00:00Z",
fieldName: "score",
fieldValue: 42,
labels: ["urgent", "vip"],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s.o.
Das scheint mir nicht konsistent. Hier müsste nach meinem Verständnis tags stehen, damit das wieder auf die labels Collection deserialisiert wird. Hier greift doch das o.g. "Raten" bzw. "Probieren". Oder sehe ich das falsch?

@JoBalk

JoBalk commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

Roland is right, this is overkill

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