Skip to content

feat(stdlib): aLib aggregate.json schema loader (alib-roadmap #11)#432

Merged
hyperpolymath merged 1 commit into
mainfrom
feat/alib-schema-loader-issue-11
May 28, 2026
Merged

feat(stdlib): aLib aggregate.json schema loader (alib-roadmap #11)#432
hyperpolymath merged 1 commit into
mainfrom
feat/alib-schema-loader-issue-11

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Summary

Closes alib-roadmap.adoc item #11 (). Unblocks #12 (test-vector executor).

Adds stdlib/AlibSchema.affine — Approach A (AffineScript-side parser, no new build tool needed) layered on the existing hpm_json_* lazy-handle FFI from stdlib/json.affine.

Public surface

pub type TestCase   = { description: String, input_count: Int }
pub type AlibOp     = { name, category, signature_string, purpose: String, test_cases: [TestCase] }
pub type AlibSchema = { schema_version: String, total_operations: Int, operations: [AlibOp] }

pub fn parse_schema(src: String)  -> Result<AlibSchema, String>
pub fn load_schema(path: String)  -> Result<AlibSchema, String>
pub fn load_estate_schema()       -> Result<AlibSchema, String>
pub fn estate_path()              -> String

test_cases[].input / output are intentionally NOT decoded to a sum type here — aggregate.json mixes Int / Float / String / Bool / arrays and per-op-named-fields objects (conditional has {condition, then_value, else_value}). The #12 executor will re-descend per-op with a known shape.

Verification

  • affinescript check stdlib/AlibSchema.affineType checking passed
  • Full stdlib re-check → all .affine files still pass
  • No regressions to stdlib/alib.affine or stdlib/json.affine

Ownership / safety

Every Some(h) from hpm_json_parse / hpm_json_object_get / hpm_json_array_get is paired with a matching hpm_json_free. The root handle is freed inside parse_schema.

Notes

  • GH Actions budget: estate is over the monthly cap; admin-merging on clean local verify per estate-wide standing directive. Type-check is the only gate that matters at this scope.
  • AffineScript syntax gotchas honoured (record literal #{...}, generics not relevant here, no label/total collisions, no for-over-while inside the tree-walk).
  • Lazy-handle pattern was preferred over to_json because to_json returns None for object roots (object-key enumeration is not yet a Zig export on hpm-json-rsr).

Test plan

🤖 Generated with Claude Code

Adds `stdlib/AlibSchema.affine` (Approach A — AffineScript-side parser
over the existing `hpm_json_*` lazy-handle FFI from `stdlib/json.affine`)
to unblock alib-roadmap item #12 (test-vector executor).

Public entry points:

  parse_schema(src: String) -> Result<AlibSchema, String>
  load_schema(path: String) -> Result<AlibSchema, String>
  load_estate_schema() -> Result<AlibSchema, String>
  estate_path() -> String

Captured fields per op (sufficient for #12 dispatch):

  AlibOp { name, category, signature_string, purpose, test_cases }
  TestCase { description, input_count }

Test-case `input` / `output` are intentionally not decoded to a sum
type here — aggregate.json mixes Int / Float / String / Bool / arrays
and per-op-named-fields objects (conditional has
`{condition, then_value, else_value}`). The #12 executor will
re-descend per-op with a known shape.

Ownership: every `Some(h)` returned by `parse` / `object_get` /
`array_get` is paired with a matching `hpm_json_free`; the root
handle is freed inside `parse_schema`.

Roadmap row #11 status: `○` -> `●`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hyperpolymath hyperpolymath merged commit 5cc87d2 into main May 28, 2026
13 of 23 checks passed
@hyperpolymath hyperpolymath deleted the feat/alib-schema-loader-issue-11 branch May 28, 2026 12:53
@github-actions
Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 81 issues detected

Severity Count
🔴 Critical 4
🟠 High 10
🟡 Medium 67

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Action actions/checkout@v6 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Action denoland/setup-deno@v2 needs attention",
    "type": "unpinned_action",
    "file": "publish-jsr.yml",
    "action": "pin_sha",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in affine-vscode-publish.yml",
    "type": "unknown",
    "file": "affine-vscode-publish.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "unknown",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "unknown",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in ci.yml",
    "type": "unknown",
    "file": "ci.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

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.

1 participant