You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: publish versioned schemas for JSONL audit/telemetry artifacts (#2380)
* Initial plan
* feat: publish versioned schemas for JSONL audit/telemetry artifacts
- Add schemas/token-usage.v1.schema.json and schemas/audit.v1.schema.json
- Add schemas/README.md documenting schema versioning policy
- Embed _schema field in token-usage.jsonl records (token-tracker.js)
- Add lightweight validateTokenUsageRecord() validation before writing
- Embed _schema:"audit/v1" in Squid audit_jsonl logformat
- Update sample audit.jsonl to include _schema field
- Add validateTokenUsageRecord tests and schema-field integration tests
- Add squid-config tests for audit_jsonl schema fields
- Add log-parser test for parsing records with _schema field
Closes #<issue>"
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/5a50cced-80d7-463b-9c96-c0662581a136
* refactor: remove redundant requires in token-tracker tests per code review
* Potential fix for pull request finding 'CodeQL / Unused variable, import, function or class'
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
* fix: address code review feedback on schema tests and null guard
- Add null/non-object guard to validateTokenUsageRecord to prevent TypeError
on writeTokenUsage(null/undefined)
- Rewrite 'token-usage JSONL record schema field' tests to actually capture
the bytes written to the JSONL stream via jest.spyOn(fs, 'createWriteStream'),
instead of the weaker not.toThrow() / metrics.increment assertions
- Add null/undefined/primitive rejection tests for validateTokenUsageRecord
Agent-Logs-Url: https://github.com/github/gh-aw-firewall/sessions/4a05b5f0-4b15-4797-96da-617484b64562
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Landon Cox <landon.cox@microsoft.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
-**Additive changes** (new optional fields) → update the existing `v1` schema, no version bump required.
15
+
-**Breaking changes** (field removal, rename, type change, new required field) → create a new `v2` schema file and bump the `_schema` value in the writer.
16
+
17
+
## Record identification
18
+
19
+
Every JSONL record includes a `_schema` field that identifies the schema name and version:
Consumers should check `_schema` before parsing fields so they can handle future versions gracefully.
27
+
28
+
## Validation
29
+
30
+
You can validate a JSONL file against its schema using any JSON Schema validator. Example using [`ajv-cli`](https://github.com/ajv-validator/ajv-cli):
0 commit comments