feat(skills): cover CoreFileObject in schemas + auditing#55
Conversation
Adds schema- and audit-side rules for CoreFileObject, the built-in Infrahub generic that turns a node into a file-bearing entity (PDF, Visio, KMZ, image, certificate, contract, runbook, etc.) with auto file metadata and a GraphQL upload mutation. The skills previously covered CoreArtifactTarget and generate_template but had no guidance for CoreFileObject — driven by the opsmill/schema-library circuit_contract.yml extension and the broader file-attachment use cases (network diagrams, rack photos, compliance docs). Schema-side (managing-schemas): - rules/extension-file-object.md — capability-flag rule modeled on extension-artifact-target.md. File-type-agnostic decision matrix (diagrams, contracts, KMZ, imagery, certs, runbooks, BOMs); the five reserved read-only attributes (file_name, file_size, file_type, checksum, storage_id) called out as do-not-redeclare; "concrete node, not generic" trap; mandatory back-relationship to the parent entity; bypass antipattern (kind: Text url/path/ filename string instead of using object storage). - SKILL.md — new row in the Designing for Downstream Consumers table and a bullet in Production Patterns. - reference.md — CoreFileObject added to the built-in generics list alongside CoreArtifactTarget. Audit-side (auditing-repo): - rules/schema-file-object-misuse.md — MEDIUM severity rule flagging the three drift conditions: reserved-attribute collisions on CoreFileObject heirs, CoreFileObject declared on a generic, and the bypass antipattern of a Text url/path string on a node that should be file-bearing. Eval coverage: - new task `network-diagram-file-object` in eval.yaml — Visio diagram prompt (deliberately non-contract domain so the model has to apply the capability, not memorize the example). - new lib.py check functions: core-file-object-inherited, file-object-on-node-not-generic, no-reserved-file-attrs, no-filename-text-bypass. - new task grader graders/managing-schemas/check_file_object.py bundling the four checks with schema-version and human-friendly-id baselines. - regenerated evaluations/infrahub-managing-schemas.json. Verified grader against four fixtures: compliant (1.0); redeclared file_name+checksum (0.833, names no-reserved-file-attrs); CoreFileObject on a generic (0.667, names both file-object-on-node-not-generic and core-file-object-inherited); file_url bypass attribute (0.833, names no-filename-text-bypass). CI: rumdl clean, yamllint clean (pre-existing warning on eval.yaml:1 unrelated), evaluations/*.json in sync.
Deploying infrahub-skills with
|
| Latest commit: |
75186bd
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://aa148d69.infrahub-skills.pages.dev |
| Branch Preview URL: | https://ic-rule-core-file-object.infrahub-skills.pages.dev |
BeArchiTek
left a comment
There was a problem hiding this comment.
Review: CoreFileObject coverage
Reviewed the new rules, eval task, and grader. Overall this is in good shape — the rule prose explains the why (object storage, system-managed metadata, branch isolation) rather than leaning on bare imperatives, the cross-domain examples table keeps it from overfitting to one use case, and the antipattern section ties each failure mode to an observable symptom.
Verified locally
- Grader discriminates correctly. Ran
check_file_object.pyagainst 1 compliant + 4 violating fixtures (redeclared reserved attr /CoreFileObjecton a generic / Text-URL bypass / missing inheritance). Compliant scores1.0; each violation fails exactly the intended sub-check, nothing else. - JSON projection in sync —
scripts/sync-evals.pyproduces zero drift againsteval.yaml. - Cross-references resolve —
relationship-component-parent.mdandartifact-target-inheritance.mdboth exist. - Section prefixes valid —
extension-(schemas) andschema-(auditing) are registered in each_sections.md. - Factual backbone confirmed against Infrahub source. Checked
backend/infrahub/core/protocols.pyanddocs/schema/file-object.mdx: the five reserved attributes (file_name,file_size,file_type,checksum,storage_id),file_type= MIME,checksum= SHA-1, and read-only — all exact. This matters because the grader hard-codes those names, so a wrong attribute would mis-flag.
Recommended follow-ups (non-blocking)
-
No baseline run documented. The grader proves the structure is checkable, but there's no evidence the model actually fails the
network-diagram-file-objecttask without the rule present. If a model already reaches forCoreFileObjectunaided, the 212-line rule isn't earning its context cost. A single smoke run with vs. without the rule would confirm the lift. -
Discoverability — skill description not updated.
managing-schemas/SKILL.mdfrontmatter gained no triggers for this capability. A request like "how do I store an uploaded PDF / attachment / file in Infrahub" may not surface the schema guidance. Worth addingfile objects / attachments / uploadsto the description triggers.
Minor (no action needed)
- The bypass heuristic uses generic names (
url,path,location,filename). The schema-side grader is safely narrow — it only fires onCoreFileObjectheirs and excludesfile_nameto avoid double-counting with the reserved-attr check. The audit-rule version is intentionally broader/advisory and self-acknowledges legitimate external-pointer cases, so expect some false positives if it's ever automated. - The SKILL.md quick-table row and the prose bullet restate the same fact, but they serve different scan paths — fine to leave.
Summary
Adds schema- and audit-side rules for
CoreFileObject, the built-in Infrahub generic that turns a node into a file-bearing entity (PDF, Visio, KMZ, image, certificate, contract, runbook, etc.) with auto file metadata and a GraphQL upload mutation. The skills previously coveredCoreArtifactTargetandgenerate_templatebut had no guidance forCoreFileObject— driven by the opsmill/schema-librarycircuit_contract.ymlextension and the broader file-attachment use cases (network diagrams, rack photos, compliance docs, KMZ overlays).The rule is deliberately file-type-agnostic. The eval prompt uses a Visio network diagram, not a contract, so the model has to apply the capability rather than memorize the example.
What's in this PR
Schema-side (
infrahub-managing-schemas)rules/extension-file-object.md— capability-flag rule modeled onextension-artifact-target.md. Decision matrix covering diagrams, contracts, KMZ, imagery, certs, runbooks, BOMs; the five reserved read-only attributes (file_name,file_size,file_type,checksum,storage_id) called out as do-not-redeclare; "concrete node, not generic" trap; mandatory back-relationship to the parent entity; the bypass antipattern (kind: Texturl/path/filenamestring instead of using object storage).SKILL.md— new row in the "Designing for Downstream Consumers" table and a bullet in "Production Patterns Worth Knowing".reference.md—CoreFileObjectadded to the built-in generics list alongsideCoreArtifactTarget.Audit-side (
infrahub-auditing-repo)rules/schema-file-object-misuse.md— MEDIUM severity rule flagging three drift conditions: reserved-attribute collisions onCoreFileObjectheirs,CoreFileObjectdeclared on a generic, and the bypass antipattern of aTexturl/path string on a node that should be file-bearing.Eval coverage (Rule = Test policy)
network-diagram-file-objectineval.yaml.graders/managing-schemas/lib.py:core-file-object-inherited,file-object-on-node-not-generic,no-reserved-file-attrs,no-filename-text-bypass.graders/managing-schemas/check_file_object.pybundling the four checks withschema-versionandhuman-friendly-idbaselines.evaluations/infrahub-managing-schemas.json.Grader verification
Verified the grader against four hand-crafted fixtures:
file_name+checksumno-reserved-file-attrsCoreFileObjecton a genericfile-object-on-node-not-generic,core-file-object-inheritedfile_urlText bypass attributeno-filename-text-bypassCI lint status (local)
rumdl check .— 0 issues across 149 filesyamllint— exit 0 (only a pre-existing warning oneval.yaml:1unchanged by this branch)evaluations/*.json— in sync witheval.yamlTest plan
markdown-lint,yaml-lint,evals-syncall greenskillgrade --smokepasses on the newnetwork-diagram-file-objecttask (deferred to follow-up commit if needed)device-artifact-targettask — the new lib.py functions are additiveinherit_from: [CoreFileObject]with a back-relationship and no redeclared metadata attributes