render -p (pipe mode): outputs raw hash instead of rendered content #34

Closed
opened 2026-06-02 02:14:42 +00:00 by xingyue · 0 comments
Owner

Problem

render -p (pipe mode) outputs a raw cas:<hash> string instead of rendering the node through its template.

Reproduce

rm -rf /tmp/ocas-pipe-test && mkdir /tmp/ocas-pipe-test
H="--home /tmp/ocas-pipe-test"

# Create schema
echo '{"type":"object","properties":{"title":{"type":"string"},"done":{"type":"boolean"}},"required":["title","done"],"additionalProperties":false}' | ocas $H put @ocas/schema -p --json
# → 9S7JEYS3FKSDH

# Set template
ocas $H template set 9S7JEYS3FKSDH --inline "[{{ payload.done | ternary: 'x', ' ' }}] {{ payload.title }}"

# Store a node
echo '{"title":"Read book","done":false}' | ocas $H put @test/todo -p --json
# → CZNBAVNE8Z3GZ

# Pipe put output into render
echo '{"title":"Read book","done":false}' | ocas $H put @test/todo -p | ocas $H render -p

Actual

cas:CZNBAVNE8Z3GZ

Raw hash prefixed with cas: — not rendered through the template.

Expected

[false] Read book

(or [ ] Read book if ternary works correctly)

The pipe should resolve the hash from the { type, value } envelope and render it through the registered template.

Context

  • ocas render <hash> (non-pipe) works correctly
  • ocas get <hash> -r also works
  • Only the piped | ocas render -p path is affected
## Problem `render -p` (pipe mode) outputs a raw `cas:<hash>` string instead of rendering the node through its template. ## Reproduce ```bash rm -rf /tmp/ocas-pipe-test && mkdir /tmp/ocas-pipe-test H="--home /tmp/ocas-pipe-test" # Create schema echo '{"type":"object","properties":{"title":{"type":"string"},"done":{"type":"boolean"}},"required":["title","done"],"additionalProperties":false}' | ocas $H put @ocas/schema -p --json # → 9S7JEYS3FKSDH # Set template ocas $H template set 9S7JEYS3FKSDH --inline "[{{ payload.done | ternary: 'x', ' ' }}] {{ payload.title }}" # Store a node echo '{"title":"Read book","done":false}' | ocas $H put @test/todo -p --json # → CZNBAVNE8Z3GZ # Pipe put output into render echo '{"title":"Read book","done":false}' | ocas $H put @test/todo -p | ocas $H render -p ``` ## Actual ``` cas:CZNBAVNE8Z3GZ ``` Raw hash prefixed with `cas:` — not rendered through the template. ## Expected ``` [false] Read book ``` (or `[ ] Read book` if ternary works correctly) The pipe should resolve the hash from the `{ type, value }` envelope and render it through the registered template. ## Context - `ocas render <hash>` (non-pipe) works correctly - `ocas get <hash> -r` also works - Only the piped `| ocas render -p` path is affected
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shazhou/ocas#34