Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Adding a missing data type for Time #267

Merged
merged 11 commits into from
Jan 12, 2025
Merged

fix: Adding a missing data type for Time #267

merged 11 commits into from
Jan 12, 2025

Conversation

traut
Copy link
Member

@traut traut commented Dec 15, 2024

No description provided.

@traut
Copy link
Member Author

traut commented Dec 15, 2024

There is a bug here, though. It looks like the encoding is not working correctly: the tests pass but github_gist publisher fails with

2024-12-15 15:56:05 INF Publishing the content command=render target=overview
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0x14020d92360 stack=[0x14020d92000, 0x14040d92000]
fatal error: stack overflow

runtime stack:
runtime.throw({0x103b0dce8?, 0x1029c421c?})
        /opt/homebrew/opt/go/libexec/src/runtime/panic.go:1067 +0x38 fp=0x16daf2da0 sp=0x16daf2d70 pc=0x102a0a3c8
runtime.newstack()
        /opt/homebrew/opt/go/libexec/src/runtime/stack.go:1117 +0x478 fp=0x16daf2ed0 sp=0x16daf2da0 pc=0x1029ef018
runtime.morestack()
        /opt/homebrew/opt/go/libexec/src/runtime/asm_arm64.s:342 +0x70 fp=0x16daf2ed0 sp=0x16daf2ed0 pc=0x102a10260

goroutine 1 gp=0x140000021c0 m=12 mp=0x14000101808 [running]:
runtime.typeAssert(0x105013c00, 0x1046a5980)
        /opt/homebrew/opt/go/libexec/src/runtime/iface.go:467 +0x144 fp=0x14020d92360 sp=0x14020d92360 pc=0x1029a6f24
github.com/blackstork-io/fabric/plugin/pluginapi/v1.encodeData({0x10475dc70, 0x140019d2f60})
        /Users/traut/Work/fabric/plugin/pluginapi/v1/data_encoder.go:47 +0x880 fp=0x14020d925b0 sp=0x14020d92360 pc=0x10367e490
github.com/blackstork-io/fabric/plugin/pluginapi/v1.encodeData({0x10475dc70, 0x140019d2f48})
        /Users/traut/Work/fabric/plugin/pluginapi/v1/data_encoder.go:48 +0x8fc fp=0x14020d92800 sp=0x14020d925b0 pc=0x10367e50c
github.com/blackstork-io/fabric/plugin/pluginapi/v1.encodeData({0x10475dc70, 0x140019d2f30})
        /Users/traut/Work/fabric/plugin/pluginapi/v1/data_encoder.go:48 +0x8fc fp=0x14020d92a50 sp=0x14020d92800 pc=0x10367e50c
github.com/blackstork-io/fabric/plugin/pluginapi/v1.encodeData({0x10475dc70, 0x140019d2f18})
        /Users/traut/Work/fabric/plugin/pluginapi/v1/data_encoder.go:48 +0x8fc fp=0x14020d92ca0 sp=0x14020d92a50 pc=0x10367e50c
github.com/blackstork-io/fabric/plugin/pluginapi/v1.encodeData({0x10475dc70, 0x140019d2f00})
        /Users/traut/Work/fabric/plugin/pluginapi/v1/data_encoder.go:48 +0x8fc fp=0x14020d92ef0 sp=0x14020d92ca0 pc=0x10367e50c
...

UPDATE: fixed

@traut traut force-pushed the date-time-in-data branch from 9062969 to fa5d9e0 Compare December 26, 2024 17:36
@traut traut force-pushed the date-time-in-data branch from fa5d9e0 to 3136827 Compare January 5, 2025 15:17
@traut traut force-pushed the date-time-in-data branch from 3136827 to 608e360 Compare January 11, 2025 14:28
@traut
Copy link
Member Author

traut commented Jan 11, 2025

There is an issue with data command which I'm not sure how to solve yet:

$ cat ./test.yaml
foo: aaa
bar: bbb
since: 2024-12-02T00:00:00Z
until: 2024-12-08T23:59:59Z

$ cat ./test.fabric

document "test" {

  data yaml "test" {
    path = "./test.yaml"
  }

}

$ fabric data document.test.data.yaml.test
2024-12-20 11:44:39 WRN This is a dev version of the software! command=data version=0.4.2-dev+dirty.rev.bb58d06ad2950c5caab0a51cc085e34e3f56515b
2024-12-20 11:44:39 INF Parsing fabric files command=data directory=.
2024-12-20 11:44:39 INF Fetching data command=data target=document.test.data.yaml.test
2024-12-20 11:44:39 INF Loading document data command=data document=test datasource=yaml name=test
{
    "bar": "bbb",
    "foo": "aaa",
    "since": ,
    "until":
}

$

Copy link
Contributor

@dobarx dobarx left a comment

Choose a reason for hiding this comment

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

LGTM. As for data cli command issue, it seems like there is a problem with library that is used to print this value:

github.com/TylerBrock/colorjson

fmt := colorjson.NewFormatter()

If you disable color while running data command it prints correctly:

fabric data document.test.data.yaml.test --color=false

BTW, I think maybe we should also rename flag to --no-color and flip value. Having bool default flags makes it requiring to pair them with =false.

@traut
Copy link
Member Author

traut commented Jan 12, 2025

thanks for investigating the issue here, @dobarx!

@traut traut merged commit bdc5db5 into main Jan 12, 2025
6 checks passed
@traut traut deleted the date-time-in-data branch January 12, 2025 17:16
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