feat(oq): add GCF as --format gcf output option#216
Conversation
There was a problem hiding this comment.
1 issue found across 6 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
TristanSpeakEasy
left a comment
There was a problem hiding this comment.
Requesting changes. I don’t think this is ready to merge as-is.
Main blockers:
- The Go version bump breaks the workspace locally:
go test ./oqandgo list -m allfail withmodule . listed in go.work file requires go >= 1.26.1, but go.work lists go 1.26.0. Please drop the bump unless it is truly required; ifgcf-gorequires it, we should either refactor/choose a dependency that supports the repo’s existing Go version or make a deliberate workspace-wide toolchain change separately. - This adds a new third-party dependency for an optional output format. I audited the downloaded module and didn’t see obvious runtime network/process/unsafe behavior, and
go list -depsonly showed the package itself as a non-stdlib runtime import, but this repo is intentionally dependency-light and the existing table/json/markdown/toon formatters do not add format-specific third-party deps. The cost/benefit needs maintainer buy-in, especially since the dependency is new and from the PR author’s org. - No tests were added for
FormatGCF,format(gcf), CLI wiring, count/empty output, or array/special-character behavior. Existing formats have coverage inoq/oq_test.go; this should match that bar. - The TOON semicolon issue cited in the PR body is not fixed by this PR. If TOON array elements containing
;are ambiguous, we should add a regression test and fix TOON directly rather than use it only as rationale for a new format. - CLI docs/help are incomplete: the long command help and
cmd/openapi/commands/openapi/README.mdstill only listtable,json,markdown, andtoon.
Validation run:
go test ./oq— failed before compile due to thego.work/go.modversion mismatch.go list -m all— same failure.GOWORK=off go test ./oq— passed, after downloadinggithub.com/blackwell-systems/gcf-go v1.2.1.GOWORK=off go list -deps -f '{{if not .Standard}}{{.ImportPath}}{{end}}' github.com/blackwell-systems/gcf-go— only returnedgithub.com/blackwell-systems/gcf-go.
|
Thanks for the thorough review. Addressed everything:
On the TOON semicolon issue: after investigating, a proper fix would require changing the output contract of the TOON format (the |
There was a problem hiding this comment.
2 issues found across 7 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="oq/oq_test.go">
<violation number="1" location="oq/oq_test.go:1462">
P2: TestFormatGCF_SpecialChars does not test special characters despite its name, creating a misleading coverage gap for GCF's core special-character handling feature</violation>
</file>
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic
| assert.Contains(t, out, "GCF profile=generic", "empty gcf should still have profile header") | ||
| } | ||
|
|
||
| func TestFormatGCF_SpecialChars(t *testing.T) { |
There was a problem hiding this comment.
P2: TestFormatGCF_SpecialChars does not test special characters despite its name, creating a misleading coverage gap for GCF's core special-character handling feature
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At oq/oq_test.go, line 1462:
<comment>TestFormatGCF_SpecialChars does not test special characters despite its name, creating a misleading coverage gap for GCF's core special-character handling feature</comment>
<file context>
@@ -1412,6 +1412,86 @@ func TestFormatToon_Explain(t *testing.T) {
+ assert.Contains(t, out, "GCF profile=generic", "empty gcf should still have profile header")
+}
+
+func TestFormatGCF_SpecialChars(t *testing.T) {
+ t.Parallel()
+ g := loadTestGraph(t)
</file context>
|
Dependency audit follow-up for
Conclusion: I do not see a code path in the dependency used by this PR that can send OpenAPI/query data to a third party; the imported encoder appears to process locally in memory only. |
TristanSpeakEasy
left a comment
There was a problem hiding this comment.
Follow-up after re-reviewing the latest branch, validating the current cubic findings, and auditing github.com/blackwell-systems/gcf-go@v1.2.2:
I think this is close and I’m no longer concerned about the dependency sending OpenAPI/query data to a third party. The imported gcf.EncodeGeneric(...) path processes in memory and returns a string; I did not find HTTP/DNS/socket, subprocess, filesystem, environment, or callback-sink behavior in the imported runtime package.
Recommendation before approval:
- Please rebase/resolve the current conflict with
main. The TOON finding is valid against this PR branch’s raw JSON fallback, butmainalready has the safer semicolon-array fix from #217 (toonArrayValue/toonQuote). After rebasing, this PR should keep themainimplementation rather than reintroducing the JSON fallback. - Please address the remaining GCF test cleanup:
TestFormatGCF_SpecialCharscurrently does not exercise special characters despite its name. Either rename it to reflect what it checks or add a real special-character case.
Targeted validation run locally:
mise test -run 'TestExecute_ToonEscape_SpecialChars|TestFormatToon_SpecialChars|TestFormatGCF_SpecialChars|TestFormatGCF_Success|TestFormatGCF_Count_Success|TestFormatGCF_Groups_Success|TestFormatGCF_Empty_Success|TestFormatGCF_Explain|TestFormatGCF_InlinePipeline' ./oq— passed.
Once the branch is rebased and the misleading GCF test is cleaned up, I expect this should be ready to approve.
e43074e to
b882efa
Compare
|
Rebased on main (picks up #217's |
Summary
Add
--format gcfas a new output format option for theoqquery command, alongside existing table, json, markdown, and toon formats. Also available as an inline pipeline stage:format(gcf).Why
Your TOON encoder has a silent data corruption bug
The hand-rolled
toonValuefunction informat.goencodes arrays by joining elements with semicolons:If any array element contains a semicolon, the data silently corrupts on decode. A 2-element array becomes 4 elements:
OpenAPI schemas have array fields (scopes, tags, enum values) where this can occur. GCF handles arrays natively with proper quoting, no lossy joins.
LLM comprehension
When
oqoutput is consumed by LLMs (agent workflows, AI-assisted API exploration), format comprehension accuracy matters:1,700+ evaluations across 10 models from 3 providers. No model has been trained on GCF.
Full eval data: GCF benchmarks
Data integrity
GCF is verified lossless across 43 billion+ round-trips in 5 formats (JSON, YAML, TOML, CSV, MessagePack) and 6 language implementations. Zero failures.
Unlike the hand-rolled TOON encoder, GCF has a formal spec, a decoder, conformance fixtures, and fuzz testing backing every claimed number.
Full verification data: Lossless verification
Zero dependencies
gcf-gohas zero runtime dependencies beyond the Go standard library, same as the rest of theoqpackage.Changes
oq/format.goFormatGCFfunction, importgcf-gooq/parse.go"gcf"in inlineformat()stageoq/oq.goFormatHintcommentcmd/openapi/commands/openapi/query.gocase "gcf", update--formathelp textgo.mod/go.sumgithub.com/blackwell-systems/gcf-goUsage
Links
Summary by cubic
Adds GCF as an output format to the
oqquery command and pipeline for lossless arrays and clearer LLM consumption. Use --format gcf or format(gcf).--format gcfand pipeline stageformat(gcf)toopenapi query.FormatGCFusinggithub.com/blackwell-systems/gcf-gov1.2.2; preserves types and emits native arrays.gcf.Written for commit b882efa. Summary will update on new commits.