docs: repo-owned query contract and dev guidance (LFXV2-2015)#53
docs: repo-owned query contract and dev guidance (LFXV2-2015)#53josep-reyero wants to merge 11 commits into
Conversation
Land this repo's share of the LFX dev AI fan-out. Repo-owned development conventions, contracts, and review evidence now live beside the code they describe. Central lfx-skills retains cross-repo routing, platform architecture, shared integration, global workflows, and reviewer-agent packaging. Inventory: lfx-architecture-scratch/2026-05-DevX-Time-to-Merge/fanout-repo-rollout-inventory.md Ownership: lfx-architecture-scratch/2026-05-DevX-Time-to-Merge/fanout-repo-owner-guidance.md Refs: https://linuxfoundation.atlassian.net/browse/LFXV2-2015 Signed-off-by: Josep Garcia-Reyero Sais <josepreyero@gmail.com>
…-service Signed-off-by: Josep Garcia-Reyero Sais <josepreyero@gmail.com> # Conflicts: # docs/resource-catalog.md
member-service now publishes b2b_org, b2b_org_settings, project_membership, and key_contact index messages. Update the fan-out query docs to match the current code: - indexed-data-types.md: add a Members section with the four lfx.index.* subjects and source file; remove the stale "Not Currently Indexed" note. - resource-catalog.md: drop the contradictory "Not Currently Queryable" section, add b2b_org_settings to the member row, correct the membership-by-status example to use filters (status is a data field, not a tag), and add key_contact and b2b_org_settings cookbook entries. - query-service-contract.md: use $OPENSEARCH_INDEX in the debug curl instead of the non-default lfx-resources index name (default is resources). Signed-off-by: Josep Garcia-Reyero Sais <josepreyero@gmail.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✅ Files skipped from review due to trivial changes (5)
WalkthroughThis PR adds comprehensive documentation for the query-service, including the canonical API contract, resource indexing patterns, usage examples, local development setup, and formalized Claude skills for AI-assisted codebase modifications. ChangesQuery Service Documentation and Guidance
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This documentation-only PR moves repo-owned query-service contract and AI/agent development guidance into this repository as part of the LFXV2-2015 fan-out effort.
Changes:
- Adds canonical query-service contract docs covering API parameters, pagination, CEL filtering, access checks, and clause limits.
- Adds indexed resource inventory and expands the resource query cookbook.
- Adds repo-local Claude skills for query-service development and resource-query workflows, while updating README and CLAUDE routing guidance.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
README.md |
Points agents to repo docs, updates local run examples, and links detailed API contract docs. |
CLAUDE.md |
Adds repo-local/central skill routing and moves detailed API behavior references into docs/. |
docs/resource-catalog.md |
Expands queryable type catalog and cookbook examples. |
docs/query-service-contract.md |
Adds canonical query-service API and implementation contract. |
docs/indexed-data-types.md |
Adds active indexed type-to-service/NATS subject inventory. |
.claude/skills/query-service-dev/SKILL.md |
Adds repo-local Go and query-pipeline development guidance. |
.claude/skills/query-service-dev/references/go-development-conventions.md |
Adds deeper Go convention reference. |
.claude/skills/query-resource/SKILL.md |
Adds query-resource workflow guidance. |
.claude/skills/query-resource/references/query-service-patterns.md |
Points skill references to the canonical contract doc. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
Address Copilot review on query-service-contract.md: - Anonymous vs Authenticated table: clarify the FGA batch check covers non-public results only; public:true results skip the check (BuildMessage sets NeedCheck=false for them) for authenticated callers too. - OpenSearch fields table: expand the `public` row to note it skips the FGA check for all callers and warn that setting it wrong exposes a private resource to everyone, not just anonymous users. - CEL Filter limitation: remove the overstatement that an out-of-first-page match "won't be found"; CEL is applied per OpenSearch page, so the match is returned once the caller follows page_token. Keep the short-page caveat. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Josep Garcia-Reyero Sais <josepreyero@gmail.com>
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
- README: PAGE_TOKEN_SECRET is required for any deployment, not only when paging; PageTokenSecret() fatals if unset and is called whenever a full page generates a token (even a first-page query). - contract: page_token is generated by the query-service (encoding the OpenSearch search_after/sort cursor via paging.EncodePageToken), not by OpenSearch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Josep Garcia-Reyero Sais <josepreyero@gmail.com>
- CLAUDE.md: align local run examples with the README — add the required PAGE_TOKEN_SECRET plus ORG_SEARCH_SOURCE, AUTH_SOURCE, and JWT_AUTH_DISABLED_MOCK_LOCAL_PRINCIPAL (defaults are jwt/clearbit, so the old mock command would fatal); expand the Configuration env-var list. - query-service-dev skill + reference: there is no 'make fmt' target, use gofmt -w plus 'make lint'; pkg/errors has no NewConflict (constructors are NewValidation, NewNotFound, NewServiceUnavailable, NewUnexpected) and wrapError maps 400/404/503/500 only. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Josep Garcia-Reyero Sais <josepreyero@gmail.com>
Reword the access-filtering note so it is clear that non-public documents missing access_check_object or access_check_relation are treated as unauthorized and excluded from results, since no access-check message can be constructed for them. Previously the doc said the query-service "skips it during access filtering", which could be read as such resources bypassing checks and being returned. Also align the field table rows for both fields. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Josep Garcia-Reyero Sais <josepreyero@gmail.com>
|
Hey @josep-reyero! Thanks for the work on this — the two-skill split and the query contract doc are both well-structured, and the documentation accuracy (verified against live code) is genuinely high quality. 👏 Nice work
Issue summary
Key findings🔴 [C-001] go.mod/go.sum downgrades — This is a docs-only PR but the branch carries dependency downgrades vs 🟡 [M-001] CEL "won't be found" wording — A section implies CEL globally pre-filters results, but CEL runs per OpenSearch page. Callers paging through results will find matches; the current wording may cause them to stop early. 🟡 [M-002] 🟡 [M-003] Principal context docs say middleware; code says service layer — 🟡 [M-004] README testing example won't compile — Constructor is 🟡 [M-005] Required-parameter validation not documented — 🟡 [M-006] Clearbit timeout default contradicts code — Bot comment reconciliationThe Copilot bot posted 6 inline comments. Two have already been addressed by recent commits ( CodeRabbit's most recent automated pass returned "no actionable comments" — consistent with the overall docs quality being high on the latest revision. Final decision🔴 Needs changes before approval — the go.mod downgrade is a security-sensitive blocker, and M-001–M-006 are accuracy issues that could mislead developers or fail to compile. Happy to re-review once the main merge and doc fixes are in. |
dealako
left a comment
There was a problem hiding this comment.
Changes requested — see review comment above for the full breakdown.
|
I updated the branch which should adress the go.mod/go.sum downgrades. |
Add the standard LFX copyright + MIT SPDX header to three git-tracked markdown files under .claude/ that were missing it: - .claude/skills/query-resource/SKILL.md (after frontmatter) - .claude/skills/query-resource/references/query-service-patterns.md - .claude/skills/query-service-dev/SKILL.md (after frontmatter) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Josep Garcia-Reyero Sais <josepreyero@gmail.com>
Address dealako CHANGES_REQUESTED items and open Copilot review threads. All claims verified against current code. - M-003: principal context is set in the Goa JWTAuth handler (cmd/service/service.go), not in internal/middleware (which only sets the request ID). Correct the Request Context guidance. - M-004: fix the README testing example so it compiles: NewResourceSearch (not NewResourceService), SetCheckAccessResponse (not SetAccessResult), and the third resourceFilter argument. - M-005: document the required-parameter rule (at least one of name, parent, type, tags, filter_grants) in the contract doc and README. - M-006: README Clearbit example default is 10s, matching NewConfig() (was incorrectly 30s). - Copilot: PageTokenSecret takes a context argument; fix call form in README and CLAUDE.md. - Copilot: CEL program cache is a TTL-bounded map (100 max, 5-min TTL, no LRU eviction), not an LRU cache; fix contract doc and SKILL.md. - Nits: contract doc H1 is now "Query Service Contract"; add the /query/resources/count endpoint to the README; document the CLEARBIT_AUTOCOMPLETE_BASE_URL env var; document the aggregation bucket cap (DefaultBucketSize = 100) for count queries. M-001 (CEL per-page wording) and M-002 (public skips FGA for all callers, both table rows) were already addressed in earlier commits (5cca89e) and remain correct in the current docs. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Josep Garcia-Reyero Sais <josepreyero@gmail.com>
|
@dealako thanks for the thorough review. Pushed C-001 (go.mod/go.sum downgrades) — Resolved. Merged your main-update; Major:
Nits:
Open Copilot threads (latest pass) — all four addressed in Deferred (ambiguous, no clear target in current code): the "stale domain naming" and "duplicate catalog entry" items from the summary table — I could not pin them to a specific stale string or duplicate row in the current docs. Happy to fix if you can point to the exact location. Also added the missing SPDX/MIT headers to the three |
Summary
Part of the LFX developer-AI fan-out (LFXV2-2015): repo-specific AI guidance moves out of the central
lfx-skillsplugin and into each owning repo, beside the code it describes. This PR lands this repo's share of that work.Why — the new architecture
Central finds the right owner and explains the shared platform; each repo explains itself. The central
lfx-skillsplugin keeps only genuinely-central surfaces: cross-repo routing, platform architecture, shared integration guidance, global workflows, and reviewer-agent distribution. Repo-specific implementation truth — conventions, generated-code boundaries, endpoint workflows, contracts, and chart defaults — now lives in the owning repo, where it changes together with the contracts, tests, and charts it describes.This fixes the drift problem a central rulebook creates: it either grows until it contains repo-specific exceptions for every service, or stays short and goes stale. Where a repo has a review lifecycle, its repo-specific reviewer agents are packaged centrally (so they're available by name in any Claude runtime) but read evidence this repo owns — its
CLAUDE.md, skills, rules, contracts, checklists, and review KB.Changes in this repo
This repo owns query/read behavior consumed by Self Serve, newsletter, and others, so doc accuracy is high-value.
query-service-dev(post-page-shrinkage pagination, CEL-vs-OpenSearch split, batched access-check pattern) andquery-resource(the per-resource query workflow).docs/query-service-contract.md,docs/indexed-data-types.md(active queryable resource inventory, including member-service'sb2b_org/b2b_org_settings/project_membership/key_contact),docs/resource-catalog.md(query cookbook).CLAUDE.mdroutes platform/topology questions to the central skills and keeps query behavior repo-owned.Kept current with
main(2026-06-11)This branch was re-merged with the latest
mainand the guidance re-audited against the current code. The documented run commands now include the env vars the service actually requires at startup (PAGE_TOKEN_SECRETand the auth/org source settings), and references to a nonexistentmake fmttarget and 409 error mapping were removed. The indexed-type inventory and resource catalog were re-verified against all publishing repos.Reference links
🤖 Generated with Claude Code