Skip to content

Claude/update jsonic library gj8 zb#5

Merged
rjrodger merged 4 commits into
mainfrom
claude/update-jsonic-library-GJ8Zb
Apr 20, 2026
Merged

Claude/update jsonic library gj8 zb#5
rjrodger merged 4 commits into
mainfrom
claude/update-jsonic-library-GJ8Zb

Conversation

@rjrodger
Copy link
Copy Markdown
Contributor

No description provided.

claude added 3 commits April 20, 2026 15:35
- Replace @hapi/code's expect with a tiny node:assert-based shim
  supporting the .equal/.exist/.throws fluent methods used in tests.
  Normalize null-prototype objects (jsonic returns these) to plain
  objects before deepStrictEqual to match hapi/code's looser semantics.
- Remove @jsonic/doc and its 'doc' script; drop 'doc' from the
  repo-publish-quick pipeline.
- All 9 tests pass.
- Add test/spec/ with TSV spec files per directive configuration:
  happy, subobj, close-foo, close-foo-bar, inject, adder, multiplier,
  annotate. Format: <input>\t<expected-json> or <input>\t!error <regex>.
  Blank and #-prefixed lines ignored.
- Rewrite test/directive.test.ts to load & run specs; retain TS-only
  cases (implicit-list property access, xlog meta, NaN, specific error
  regex).
- Rewrite go/directive_test.go to load & run the same specs and add
  TestInject, TestAnnotate, TestSubobj which now share the TS spec
  tables.
- Include extra edge cases in the specs (nested containers, mixed
  bool/null/negative values, complex bodies, cross-directive nesting).
- README.md: landing page with a 4-quadrant index and quickstart
  snippets for TS and Go.
- docs/tutorial.md: step-by-step walkthrough (install → first
  directive → add a close token) for both languages.
- docs/how-to.md: task-oriented recipes (close tokens, shared close,
  scoped rules, conditions, option paths, custom callbacks, spec
  files, disabling defaults).
- docs/reference.md: exhaustive API listing for TS and Go — options,
  types, defaults, token naming, group tags, counters, errors, spec
  format.
- docs/explanation.md: conceptual discussion of the rule model,
  dr_<NAME> counter, implicit container guards, grammar-spec
  tagging, shared-close-token reuse, design principles.
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cfeead9944

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread go/directive_test.go Outdated
scanner := bufio.NewScanner(f)
scanner.Buffer(make([]byte, 1024*1024), 1024*1024)
for scanner.Scan() {
line := scanner.Text()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Strip CR before parsing TSV rows

Normalize each scanned line before splitting so Windows/autocrlf checkouts don't leave a trailing \r in Expected. Right now scanner.Text() is used as-is, so cases like !error unexpected become !error unexpected\r, which can cause regex mismatch, and JSON expectations can fail to unmarshal; the TS loader in the same commit already handles this with replace(/\r$/, ''), so the Go loader is currently inconsistent and can produce platform-specific false test failures.

Useful? React with 👍 / 👎.

bufio.Scanner's Text() returns lines with the \r preserved on
CRLF-terminated files, which happens when Windows / autocrlf
checkouts re-encode the TSVs. That left expected columns like
"!error unexpected\r", which then either failed to regex-match or
failed JSON unmarshal, depending on the row.

The TS loader already strips the trailing \r; mirror that in Go.
@rjrodger rjrodger merged commit e9c48dc into main Apr 20, 2026
11 checks passed
@rjrodger rjrodger deleted the claude/update-jsonic-library-GJ8Zb branch April 21, 2026 13:06
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