Skip to content

Add AGENTS.md - #55

Merged
kogai merged 3 commits into
claude/bump-deprecated-github-actionsfrom
claude/agents-md-onix-support-c9y6cu
Sep 13, 2026
Merged

kogai merged 3 commits into
claude/bump-deprecated-github-actionsfrom
claude/agents-md-onix-support-c9y6cu

Conversation

@kogai

@kogai kogai commented Sep 13, 2026

Copy link
Copy Markdown
Owner

概要

エージェント/コントリビュータ向けのガイドとして AGENTS.md を追加しました。
このリポジトリの価値を最初に明示し、以降のすべての判断基準がそこに紐づくよう構成しています。

  1. ONIX 仕様への追従を、なるべく後方互換性を保ったまま行うこと
  2. コード生成の仕組みで、サポートできる言語をなるべく増やすこと

内容

  • 全体のパイプライン: EDItEUR の zip → bazel genrule → schema/ → src/Xsd/ のパーサ → Model/Code/Mixed の中間表現 → mustache テンプレート → generated/。言語固有の知識をテンプレートに閉じ込め、src/ を言語非依存に保つという設計方針を明記。
  • セットアップとコマンド: make schema / make build / make test / make generated/go/v3 / npx bazelisk test //e2e/go:snapshot_test。CI の 2 ジョブと対応づけ。Makefile の json ターゲットが古い点も注記。
  • 後方互換性の守り方: 生成物の diff を必ず読む、型・フィールドの削除やリネームを破壊的変更として扱う、スキーマの版はディレクトリで分ける、未対応は unimplemented / unreachable で明示して黙って落とさない、generated/ を手編集しない。EDItEUR スキーマの版を上げるときに触るファイル (WORKSPACE / org_editeur_*.bazel / BUILD.bazel / Lib.hs の schemaRoot) も手順化。
  • 新しい言語を足す手順: Lib.hs の Language / ext / template / generateTo、Main.hs の run、4 つの mustache、generated/ ディレクトリ、Makefile ターゲット、e2e、README の Current Status 表まで。
  • テストの書き方: fixtures/test_*.xsd に最小の XSD を足してから HUnit で期待値を書く、という既存の慣習と命名規則。
  • コーディング規約と、コミットしない生成物 (schema/、.stack-work/、bazel-*)。

ドキュメントの追加のみで、コードや生成物への変更はありません。

🤖 Generated with Claude Code

https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z


Generated by Claude Code

Document the two things this repository exists for: following the ONIX
spec while keeping backward compatibility, and growing the set of target
languages through code generation.

Covers the schema -> XSD parser -> intermediate representation -> mustache
pipeline, the make/bazel commands, how to bump an EDItEUR schema release,
a step-by-step procedure for adding a new target language, the fixture-
driven test convention, and which paths are generated and must not be
hand-edited.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z

kogai commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

CI について: この PR の変更が原因ではありません

Test haskell codes / Test e2e の両ジョブが失敗していますが、どちらもジョブ開始から 2 秒で、ビルドやテストが 1 行も走る前に終了しています。

##[error]This request has been automatically failed because it uses a deprecated version of
`actions/cache: v2`. Please update your workflow to use v3/v4 of actions/cache to avoid
interruptions.

原因は .github/workflows/test.yml が actions/cache@v2 を使っていることです。GitHub 側で v1/v2 が廃止され、アクションのダウンロード段階で自動的に失敗するようになっています。このファイルは main から変更しておらず、この PR の diff は AGENTS.md の追加のみ (1 ファイル、追加のみ) なので、この失敗は PR の内容とは無関係です。決定論的な失敗で flake ではないため、再実行しても同じ結果になります。

ドキュメント追加のみの PR に CI の変更を混ぜるのは避けたいので、修正はここでは入れず、パッチだけ提示します。

提案するパッチ

両ジョブの actions/cache@v2 を v4 に上げる (2 箇所):

       - name: Restore caches
-        uses: actions/cache@v2
+        uses: actions/cache@v4
         with:

あわせて、同ワークフロー内の以下も Node 12/16 ランタイム廃止の影響を受けるため、同じタイミングで上げておくのが安全です。

  • actions/checkout@v2 → v4
  • actions/setup-node@v2.1.4 → v4 (node-version: 12.x も現行の LTS に要検討)
  • haskell/actions/setup@v1 → haskell-actions/setup@v2 (リポジトリ自体が移管済み)

別 PR で対応するか、この PR に含めるか、ご希望に合わせます。


Generated by Claude Code

kogai commented Sep 13, 2026

Copy link
Copy Markdown
Owner Author

CI の修正は別 PR にしました: #56 (actions/cache v2 → v4 ほか)。この PR は AGENTS.md の追加のみのまま維持します。#56 がマージされたら、こちらは main を取り込んで CI を回し直します。


Generated by Claude Code

`make test` no longer depends on the schema download, so the command
table said something that is about to stop being true. Also point at
ADR-0003 where `make schema` is described, since that is the command
that is currently broken.

Add the rule that came out of getting this wrong once: a fixture must not
include anything outside fixtures/. Xsd.getSchema follows xs:include
recursively, so a single `../schema/` reference puts the whole suite back
on editeur.org's availability, which is exactly what test_mixed_html.xsd
did.

Add a section on recording design decisions as ADRs, with the criteria
for what warrants one, so the reference from docs/adr/README.md is
reciprocated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z
Both jobs on this branch die before running anything, on the
actions/cache@v2 deprecation that #56 fixes. #56 is green, so port it
here rather than wait for it to merge.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z
@kogai
kogai changed the base branch from main to claude/bump-deprecated-github-actions September 13, 2026 07:56
@kogai
kogai merged commit f4f834e into claude/bump-deprecated-github-actions Sep 13, 2026
2 checks passed
@kogai
kogai deleted the claude/agents-md-onix-support-c9y6cu branch September 13, 2026 08:00
kogai added a commit that referenced this pull request Sep 13, 2026
…st` from the schema download (#56)

* Bump deprecated GitHub Actions in the test workflow

Both CI jobs currently fail two seconds after starting, before any build
step runs:

    ##[error]This request has been automatically failed because it uses a
    deprecated version of `actions/cache: v2`.

GitHub has closed down actions/cache v1 and v2 and now auto-fails runs
that reference them at action-download time, so the workflow cannot get
as far as `make test` or the bazel e2e target.

Bump actions/cache to v4 to unblock that, and bump the remaining actions
still on the Node 12 runtime at the same time:

- actions/checkout v2 -> v4
- actions/setup-node v2.1.4 -> v4
- haskell/actions/setup v1 -> haskell-actions/setup v2 (repository moved)

Tool versions are left as they are (GHC 8.8.3, stack 2.5.1, Node 12.x) so
this change is limited to action versions. haskell-actions/setup v2 still
exposes the stack-path output the cache step depends on.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z

* Decouple `make test` from the schema download

With the deprecated actions bumped, the Haskell job now reaches `make
test` and fails there instead: `make test` depends on the `schema`
target, which fetches the EDItEUR archives, and editeur.org now answers
bazel's request with `202 Accepted` instead of the zip.

The test suite does not need those archives. Everything under test/ reads
fixtures/test_*.xsd; the only reader of ./schema is schemaRoot in
src/Lib.hs, which is the code-generation path. The dependency was an
over-specification that tied the whole feedback loop for the parser to
the availability of an external service.

Drop it from `test` and keep it on `build`, where generating code really
does need the schema. This does not fix the 202 itself: generation and
tracking new schema releases still need the download.

Also introduce docs/adr/ to record decisions like this one, with a
template, an index, and the two decisions made here.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z

* Make the mixed-HTML fixture self-contained

The previous commit dropped the `schema` prerequisite from `make test` on
the claim that nothing under test/ reads schema/. That claim was wrong,
and review caught it: fixtures/test_mixed_html.xsd included
../schema/v2/ONIX_XHTML_Subset.xsd directly. Xsd.getSchema follows
includes recursively and resolves that relative path with readFile, which
throws when the file is absent, and schema/ is gitignored — so on a clean
checkout the suite would have failed instead of running.

Commit 9352123 confirms the dependency was deliberate: it added
`test: schema` in the same change that deleted the vendored
2_1_rev03_schema/ tree and repointed this fixture at ../schema/v2/.

Rather than restore the prerequisite, move what the fixture needs into
the repository. test_mixed_html_xhtml_subset.xsd declares the 40 element
names the fixture refers to, each as a mixed complex type. That is the
property the assertions actually rest on: TestModel expects
Model.collectElements to come back empty, and that filter keeps only
elements with complexMixed = False, so the test means "XHTML elements do
not leak into models". Deleting the include instead would have made the
assertion vacuous.

The stand-in is written here rather than copied from the EDItEUR
distribution, so it raises no redistribution question.

ADR-0002 is rewritten around what is actually true, including why the
dependency was real and why a stand-in is enough.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z

* Stop `make test` from invoking bazel, and drop a debug step

BZL_BIN used `:=`, so `$(shell npx bazel info bazel-bin)` ran while make
parsed the file — on every target, `make test` included. The Haskell job
runs `make test` without ever installing node_modules, so that expansion
just fails there. Measured in this environment: `make -n test` took
18.1s and printed a bazel download error before doing anything, and
0.011s with the assignment deferred to `=`. Nothing outside the schema
recipes reads BZL_BIN, so deferring it costs nothing.

Also drop the `ls -lah` step that printed the stack tool path; it was
debugging output for the cache setup, not a check anything depends on.

Both spotted in review of this PR.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z

* Add AGENTS.md (#55)

* Add AGENTS.md describing repository values and workflows

Document the two things this repository exists for: following the ONIX
spec while keeping backward compatibility, and growing the set of target
languages through code generation.

Covers the schema -> XSD parser -> intermediate representation -> mustache
pipeline, the make/bazel commands, how to bump an EDItEUR schema release,
a step-by-step procedure for adding a new target language, the fixture-
driven test convention, and which paths are generated and must not be
hand-edited.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z

* Align AGENTS.md with the CI and ADR changes

`make test` no longer depends on the schema download, so the command
table said something that is about to stop being true. Also point at
ADR-0003 where `make schema` is described, since that is the command
that is currently broken.

Add the rule that came out of getting this wrong once: a fixture must not
include anything outside fixtures/. Xsd.getSchema follows xs:include
recursively, so a single `../schema/` reference puts the whole suite back
on editeur.org's availability, which is exactly what test_mixed_html.xsd
did.

Add a section on recording design decisions as ADRs, with the criteria
for what warrants one, so the reference from docs/adr/README.md is
reciprocated.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
kogai pushed a commit that referenced this pull request Sep 13, 2026
Both .gitignore additions are kept: node_modules/ from the npm work on
main, /third_party/distdir/ from this branch's ADR.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P8rZakwAiz1jpViUX34x1Z
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