X-01 · Create XBRL filing
SOP:
SOP_XBRL_Filing.md§6 / Step 1.0 (S0 → DRAFT)Actors: XBRL Preparer (xbrl-preparer@spade.local) — holdsMANAGE_XBRL_FILING. Pre-state: Client exists withXBRL_FILINGinenabledProductsand a populatedxbrlConfig. Post-state:XbrlFilingrow inDRAFT.taxonomyVersionpinned and immutable. URL settles to/dashboard/xbrl/<filingId>.
0. Prerequisites
- Environment up per
_shared/00-environment-setup.md. - Anchor client: STELLAR (
clientCode: STELLAR).- Existing seed: STELLAR has two filings — one in
MAPPING_IN_PROGRESS(FY2024) and one inVALIDATION_FAILED(FY2023). To exercise the create flow, pick a period that does not yet exist (e.g. FY2025).
- Existing seed: STELLAR has two filings — one in
- Logged in as
xbrl-preparer@spade.local.
1. Steps
1.1 Create the filing (Option A — Web UI)
- Sidebar → XBRL Filings → New filing.
- Pick STELLAR from the client dropdown.
- Fill in:
- Period start:
2025-01-01 - Period end:
2025-12-31 - Entry point:
FULL_XBRL(defaults fromClient.xbrlConfig.defaultEntryPoint) - Entity type:
NON_LISTED_COMPANY_FULL(defaults fromxbrlConfig.entityType) - Accounting standard:
SFRS(defaults fromxbrlConfig.accountingStandard) - Taxonomy version:
acra_2026_v1(defaults fromxbrlConfig.taxonomyVersion) — pinned at create, immutable thereafter - Optional: link to an existing
FsEngagementfor the same client + period (Phase 3 cross-product path)
- Period start:
- Submit.
1.2 Create the filing (Option B — API)
http
POST /ops/xbrl/filings
Content-Type: application/json
Authorization: Bearer <xbrl-preparer-jwt>
{
"clientId": "<stellarClientId>",
"periodStart": "2025-01-01",
"periodEnd": "2025-12-31",
"entryPoint": "FULL_XBRL",
"entityType": "NON_LISTED_COMPANY_FULL",
"accountingStandard": "SFRS",
"taxonomyVersion": "acra_2026_v1"
}The handler:
- Asserts
MANAGE_XBRL_FILING. - Asserts the client has
XBRL_FILINGinenabledProducts. - Asserts
loadTaxonomy(version)does not throw — the version must exist inpackages/xbrl/constitution/. Unknown versions raiseXbrlUnknownTaxonomyVersionError(Rule 4). - Asserts
periodStart < periodEnd. - Inserts
XbrlFilingwithstatus = DRAFT,versionNo = 1.taxonomyVersionis immutable after this point. - Emits
AuditEventxbrl.filing.created.
2. Verification
Database
sql
SELECT id, period_start, period_end, entry_point, entity_type,
accounting_standard, taxonomy_version, status, version_no
FROM xbrl_filings
WHERE client_id = '<stellarClientId>' AND period_end = '2025-12-31';
-- expect status = 'DRAFT', taxonomy_version = 'acra_2026_v1'Audit log
| Event type | Notes |
|---|---|
xbrl.filing.created | actor + payload includes pinned taxonomyVersion |
Status badge
Filing detail page shows DRAFT. The Upload source document CTA is enabled. Other tabs (Mappings / Validation / Exports) are visible but disabled.
3. Negative & edge cases
- Unknown taxonomy version — handler refuses with
400 Bad Requestandreason: "unknown_taxonomy_version". This is the Rule 4 enforcement. Test:loadTaxonomy('made_up_version')raisesXbrlUnknownTaxonomyVersionErrorin code. - Client without XBRL enabled —
400 Bad Requestwith"Client does not have XBRL_FILING enabled." - Caller without
MANAGE_XBRL_FILING—403 Forbidden.XBRL_PREPARERfor FS cross-references (read-only) is rejected. periodEnd <= periodStart—400 Bad Request.- Attempt to update
taxonomyVersionafter creation —PATCH /ops/xbrl/filings/:idrejects the field; the server keeps the pinned version regardless of what the client sends.
Next
Proceed to X-02 · Upload source document, or to X-02b · Pull from FS engagement (Phase 3 cross-product).