feat: dict/lookup/default funcs + --out .db fix + trivy-ghsa schema#136
Merged
jamestexas merged 2 commits intomainfrom Mar 26, 2026
Merged
feat: dict/lookup/default funcs + --out .db fix + trivy-ghsa schema#136jamestexas merged 2 commits intomainfrom
jamestexas merged 2 commits intomainfrom
Conversation
…trivy-ghsa schema
Template funcs (12 tests):
- dict: construct maps {{dict "key" val | json}}
- lookup: enum mapping {{lookup .Severity "Critical" 4 "High" 3 0}}
- default: nil/empty fallback {{default .name "unknown"}}
Bug fix (regression test):
- --out was ignored on .db source path, causing hang on NFS mount
- Added --out escape to .db branch: ingest via SQLiteWriter, materialize, exit
- TestOutFlag_DBSource verifies .db + --out --format zip works
Schema:
- examples/trivy-ghsa-schema.json: projects venturi GitHub Advisory data
into trivy-db BoltDB bucket layout (Npm::ghsa/pkg/CVE → Advisory JSON)
- Exercises _parent context, lookup, dict, replace template funcs
Engine:
- processRecord now passes record values as _parent context to collectNodes
so .db streaming path children can access parent record fields
[mache-1094a2] [rosary-3c969d]
7833872 to
bf4533f
Compare
There was a problem hiding this comment.
Pull request overview
Adds new template helpers and improves .db ingestion/export behavior to support richer schema-driven JSON reshaping and Trivy DB projection use-cases.
Changes:
- Added 3 template functions:
dict,lookup,default(+ tests and composition coverage). - Fixed
.db+--outflow to materialize outputs instead of entering the mount path. - Added an example schema (
examples/trivy-ghsa-schema.json) projecting GHSA advisories into a Trivy BoltDB-like layout and updated.dbstreaming_parentpropagation.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/ingest/template_funcs_test.go | Adds unit tests covering new dict/lookup/default functions and composition. |
| internal/ingest/engine.go | Threads _parent through .db streaming path and registers new template functions. |
| examples/trivy-ghsa-schema.json | Example topology schema to map venturi GHSA records into Trivy DB-style buckets/files. |
| cmd/out_db_test.go | Regression test ensuring .db sources honor --out without hanging. |
| cmd/mount.go | Implements .db + --out materialization short-circuit in the mount command. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… for --out, add materializeVirtuals, use first for CVE - dict: returns error on odd arg count instead of silent truncation - default: comment matches behavior (nil + empty string, not all zero values) - .db --out: check outPath BEFORE OpenSQLiteGraph/EagerScan (avoids wasted scan) - .db --out: call materializeVirtuals for consistent output (_schema.json, callers) - .db --out: defer cleanup of temp index DB - Schema: use first instead of index for CVE array (handles empty/nil safely) [mache-1094a2]
This was referenced Mar 26, 2026
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
dict,lookup,default— enables JSON reshaping in content templates--outwas ignored on.dbsource path, causing NFS mount hang (rosary-3c969d)examples/trivy-ghsa-schema.json— projects venturi GitHub Advisory data into trivy-db BoltDB layoutprocessRecordnow passes record values as_parentcontext so.dbstreaming path children can access parent fieldsTest plan
TestOutFlag_DBSource— regression test for .db + --outNpm::ghsa/curl/GHSA-test/advisory.json)task lint— 0 issuestask test— full suite greenBeads: mache-1094a2, rosary-3c969d
🤖 Generated with Claude Code