gcf

package
v0.209.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package gcf implements a LOSSLESS columnar re-encoding of homogeneous JSON arrays — the highest-leverage harvest from the OmniRoute compression study (see OMNIROUTE-HARVEST-DESIGN-2026-07-23.md). Tool outputs are dominated by arrays of flat objects (file matches, directory listings, test rows); their JSON repeats every key on every element. GCF states the keys once:

[{"id":1,"name":"a","ok":true}, ...x20]

becomes

```gcf-generic
GCF profile=generic
## [20]{id,name,ok}
1|a|true
...
```

Losslessness is the contract, proven the way the upstream proves it: the decoder below is the ROUND-TRIP ORACLE — production never decodes (the model reads the compact form), but every encoder path must deep-equal back through Decode in tests and fuzz. Anything the codec cannot round-trip bit-honestly it refuses to touch (fail-closed to the original text): arrays under minRows, non-object elements, nested values, unsafe field names, or an encoding that is not strictly smaller.

Format origin: the GCF generic profile from blackwell-systems/gcf-typescript (MIT), vendored into OmniRoute (MIT) and reimplemented here from its observed behavior — scalars-only, no v3.2 nested flattening. Attribution carried in NOTICE per both licenses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compact

func Compact(text string) (string, bool)

Compact rewrites every eligible JSON array in text into its GCF block: the whole text when it IS a JSON array, otherwise each ```json fenced block whose body qualifies. Returns (text, false) unchanged when nothing was eligible or nothing got smaller.

func Decode

func Decode(block string) ([]row, error)

Decode is the ROUND-TRIP ORACLE. Production never calls it — the model reads the compact form directly — but every encoding must decode back to deep-equal rows in tests and fuzz, or the encoder is not lossless and may not ship. Mirrors the upstream design (their reconstructHeadroom exists solely as the reversibility proof).

Input is one GCF block exactly as Compact emits it (fence lines included). Output rows carry the same typing parseEligible produced: string, json.Number, bool, nil; absent keys are absent (not nil).

func IsCompacted

func IsCompacted(text string) bool

IsCompacted reports whether text already carries a GCF block, so callers (and re-compaction passes) never double-encode.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL